summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-04-17 15:31:19 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-04-17 20:35:00 +0100
commit9657455d985ecce30c4e9d3d799212e7cc8aa57a (patch)
treed0efbf0ead6eaf3578a1fe3574b4644ca3af1753
parent67ef5f22aa3c8f060ab5caf5b816e9806c610654 (diff)
Resolves: tdf#90681 table model can have truly empty cells
old school complex tables can create a table model where a cell exists in the table but there are no paragraphs in it. -------- | A | C | ---- | B |*D*| -------- i.e. normally for the above there are 4 nodes which get exported, even though C and D are merged. But it can be the case that there are only three nodes, and *D* is missing be conservative for now and only do this for the obviously broken no cell start but cell end case and incrementally build up the test-cases Change-Id: I5703595f61688a66b7fac7f3905ace0c207c9875
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf90681.odtbin0 -> 13089 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport5.cxx9
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx15
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.hxx2
4 files changed, 25 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf90681.odt b/sw/qa/extras/ooxmlexport/data/tdf90681.odt
new file mode 100644
index 000000000000..009e006caf86
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf90681.odt
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index f04e8b9c0bb8..bece25fc2fe3 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -228,6 +228,15 @@ DECLARE_OOXMLEXPORT_TEST(testFloatingTable, "fdo77887.docx")
}
+DECLARE_OOXMLEXPORT_TEST(testOldComplexMerge, "tdf90681.odt")
+{
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+
+ if (!pXmlDoc)
+ return;
+
+ assertXPath(pXmlDoc, "//w:vMerge[4]", "val", "continue");
+}
DECLARE_OOXMLEXPORT_TEST(testTablePreferredWidth, "tablePreferredWidth.docx")
{
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index c5404f488e20..e29339cd8b79 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -705,11 +705,21 @@ void DocxAttributeOutput::FinishTableRowCell( ww8::WW8TableNodeInfoInner::Pointe
// and merge the contents of the remaining ones into it (since we don't close the cell
// here, following ones will not be opened)
bool limitWorkaround = ( pInner->getCell() >= 62 && !pInner->isEndOfLine());
+ const bool bEndCell = pInner->isEndOfCell() && !limitWorkaround;
+ const bool bStartCell = bEndCell && !m_nCellsOpen;
- if ( pInner->isEndOfCell() && !limitWorkaround )
+ if ( bEndCell )
{
if ( bForceEmptyParagraph )
+ {
+ if (bStartCell)
+ {
+ const sal_uInt32 nCol = pInner->getCell();
+ StartTableCell(pInner, nCol+1, nRow);
+ }
+
m_pSerializer->singleElementNS( XML_w, XML_p, FSEND );
+ }
EndTableCell();
}
@@ -2986,6 +2996,7 @@ void DocxAttributeOutput::StartTableCell( ww8::WW8TableNodeInfoInner::Pointer_t
{
InitTableHelper( pTableTextNodeInfoInner );
+ ++m_nCellsOpen;
m_pSerializer->startElementNS( XML_w, XML_tc, FSEND );
// Write the cell properties here
@@ -3007,6 +3018,7 @@ void DocxAttributeOutput::EndTableCell( )
EndParaSdtBlock();
m_pSerializer->endElementNS( XML_w, XML_tc );
+ --m_nCellsOpen;
m_bBtLr = false;
m_tableReference->m_bTableCellOpen = false;
@@ -8302,6 +8314,7 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
, m_nRunSdtPrToken(0)
, m_nStateOfFlyFrame( FLY_NOT_PROCESSED )
, m_bParagraphSdtHasId(false)
+ , m_nCellsOpen(0)
{
}
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 2b253d269559..ff495417e25a 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -945,6 +945,8 @@ private:
OUString m_aRunSdtPrAlias;
/// Currently paragraph SDT has a <w:id> child element.
bool m_bParagraphSdtHasId;
+ /// Checking for balanced table cells start/ends
+ sal_Int32 m_nCellsOpen;
std::map<SvxBoxItemLine, css::table::BorderLine2> m_aTableStyleConf;