From 2a8f6a8a81c568d9ad73838072d287ac4927649f Mon Sep 17 00:00:00 2001 From: David Tardon Date: Tue, 6 Jan 2015 17:01:30 +0100 Subject: fdo#88098 ClarisWorks: import empty starting lines/columns Change-Id: Ibe4d5be4df874336de7ae387d210deff0a927b38 --- ...-AppleWorks-spreadsheet-do-not-remove-fir.patch | 99 ++++++++++++++++++++++ ...AppleWorks-spreadsheet-Oops-correct-of-a-.patch | 31 +++++++ external/libmwaw/UnpackedTarball_libmwaw.mk | 5 ++ 3 files changed, 135 insertions(+) create mode 100644 external/libmwaw/0001-ClarisWorks-AppleWorks-spreadsheet-do-not-remove-fir.patch create mode 100644 external/libmwaw/0002-ClarisWors-AppleWorks-spreadsheet-Oops-correct-of-a-.patch (limited to 'external') diff --git a/external/libmwaw/0001-ClarisWorks-AppleWorks-spreadsheet-do-not-remove-fir.patch b/external/libmwaw/0001-ClarisWorks-AppleWorks-spreadsheet-do-not-remove-fir.patch new file mode 100644 index 000000000000..0d79446c7910 --- /dev/null +++ b/external/libmwaw/0001-ClarisWorks-AppleWorks-spreadsheet-do-not-remove-fir.patch @@ -0,0 +1,99 @@ +From c092ac823e50083c04464565365ddd4af71f8c89 Mon Sep 17 00:00:00 2001 +From: osnola +Date: Tue, 6 Jan 2015 15:39:54 +0100 +Subject: [PATCH 1/2] ClarisWorks/AppleWorks[spreadsheet]: do not remove first + empty rows and/or columns in the main spreadsheet + if we remove some first + rows/columns in a embedded spreadsheet, update the cells present in + formula... + +--- + src/lib/ClarisWksDbaseContent.cxx | 29 +++++++++++++++++++++++++++++ + src/lib/ClarisWksDbaseContent.hxx | 3 ++- + src/lib/ClarisWksSpreadsheet.cxx | 5 +++++ + 3 files changed, 36 insertions(+), 1 deletion(-) + +diff --git a/src/lib/ClarisWksDbaseContent.cxx b/src/lib/ClarisWksDbaseContent.cxx +index 7226af1..ea15544 100644 +--- a/src/lib/ClarisWksDbaseContent.cxx ++++ b/src/lib/ClarisWksDbaseContent.cxx +@@ -1393,4 +1393,33 @@ bool ClarisWksDbaseContent::readFormula(Vec2i const &cPos, long endPos, std::vec + + return true; + } ++ ++//////////////////////////////////////////////////////////// ++// ++//////////////////////////////////////////////////////////// ++void ClarisWksDbaseContent::Record::updateFormulaCells(Vec2i const &removeDelta) ++{ ++ if (m_content.m_contentType!=MWAWCellContent::C_FORMULA) ++ return; ++ std::vector &formula=m_content.m_formula; ++ for (size_t i=0; im_kind==MWAWDocument::MWAW_K_SPREADSHEET && zId==1) ++ minData=Vec2i(0,0); + std::vector colSize((size_t)(maxData[0]-minData[0]+1),72); + for (int c=minData[0], fC=0; c <= maxData[0]; ++c, ++fC) { + if (c>=0 && c < int(sheet.m_colWidths.size())) +@@ -462,6 +464,7 @@ bool ClarisWksSpreadsheet::sendSpreadsheet(int zId, MWAWListenerPtr listener) + } + sheetListener->openSheet(colSize, librevenge::RVNG_POINT); + MWAWInputStreamPtr &input= m_parserState->m_input; ++ bool recomputeCellPosition=(minData!=Vec2i(0,0)); + for (int r=minData[1], fR=0; r <= maxData[1]; ++r, ++fR) { + if (sheet.m_rowHeightMap.find(r)!=sheet.m_rowHeightMap.end()) + sheetListener->openSheetRow((float)sheet.m_rowHeightMap.find(r)->second, librevenge::RVNG_POINT); +@@ -478,6 +481,8 @@ bool ClarisWksSpreadsheet::sendSpreadsheet(int zId, MWAWListenerPtr listener) + // change the reference date from 1/1/1904 to 1/1/1900 + if (rec.m_format.m_format==MWAWCell::F_DATE && rec.m_content.isValueSet()) + rec.m_content.setValue(rec.m_content.m_value+1460); ++ if (recomputeCellPosition) ++ rec.updateFormulaCells(minData); + if (rec.m_borders) { + int wh=0; + for (int i=0, bit=1; i < 4; ++i, bit*=2) { +-- +2.1.0 + diff --git a/external/libmwaw/0002-ClarisWors-AppleWorks-spreadsheet-Oops-correct-of-a-.patch b/external/libmwaw/0002-ClarisWors-AppleWorks-spreadsheet-Oops-correct-of-a-.patch new file mode 100644 index 000000000000..98f07bc0fc5a --- /dev/null +++ b/external/libmwaw/0002-ClarisWors-AppleWorks-spreadsheet-Oops-correct-of-a-.patch @@ -0,0 +1,31 @@ +From bc03e5d29fbf3eb3f58b9f91c7e8c748239721ac Mon Sep 17 00:00:00 2001 +From: osnola +Date: Tue, 6 Jan 2015 15:48:18 +0100 +Subject: [PATCH 2/2] ClarisWors/AppleWorks[spreadsheet]: Oops, correct of a + mistake... + +--- + src/lib/ClarisWksDbaseContent.cxx | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/lib/ClarisWksDbaseContent.cxx b/src/lib/ClarisWksDbaseContent.cxx +index ea15544..e175c2e 100644 +--- a/src/lib/ClarisWksDbaseContent.cxx ++++ b/src/lib/ClarisWksDbaseContent.cxx +@@ -1413,10 +1413,10 @@ void ClarisWksDbaseContent::Record::updateFormulaCells(Vec2i const &removeDelta) + if (first) { + MWAW_DEBUG_MSG(("ClarisWksDbaseContent::Record::updateFormulaCells: some cell's positions are bad, remove formula\n")); + first=false; +- // revert to the basic cell type +- m_content.m_contentType=m_valueType; +- return; + } ++ // revert to the basic cell type ++ m_content.m_contentType=m_valueType; ++ return; + } + } + } +-- +2.1.0 + diff --git a/external/libmwaw/UnpackedTarball_libmwaw.mk b/external/libmwaw/UnpackedTarball_libmwaw.mk index 61c43a709559..e37d82d33628 100644 --- a/external/libmwaw/UnpackedTarball_libmwaw.mk +++ b/external/libmwaw/UnpackedTarball_libmwaw.mk @@ -13,4 +13,9 @@ $(eval $(call gb_UnpackedTarball_set_tarball,libmwaw,$(MWAW_TARBALL))) $(eval $(call gb_UnpackedTarball_set_patchlevel,libmwaw,1)) +$(eval $(call gb_UnpackedTarball_add_patches,libmwaw,\ + external/libmwaw/0001-ClarisWorks-AppleWorks-spreadsheet-do-not-remove-fir.patch \ + external/libmwaw/0002-ClarisWors-AppleWorks-spreadsheet-Oops-correct-of-a-.patch \ +)) + # vim: set noet sw=4 ts=4: -- cgit