From ecb6931da61d73a9ac17aabed8f94cf74000edfa Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 18 May 2015 13:33:38 +0100 Subject: don't fail on export of ooo96040-2.odt to docx If we want to close a cell of a table which encloses another table, then close that enclosed table first. These are pretty pathalogical old-school tables. For now assume this can only occur when the row of the enclosed table is cleanly closed and assert if that isn't the case. Change-Id: I28e4d40072cb8d92be361716e82574075b15dd89 --- sw/ooxmlexport_setup.mk | 1 + sw/qa/extras/ooxmlexport/data/ooo96040-2.odt | Bin 308517 -> 289214 bytes sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 8 ++++++++ sw/source/filter/ww8/docxattributeoutput.cxx | 8 ++++++++ 4 files changed, 17 insertions(+) (limited to 'sw') diff --git a/sw/ooxmlexport_setup.mk b/sw/ooxmlexport_setup.mk index 5a0cc3b2ef20..a3a2182cd9c4 100644 --- a/sw/ooxmlexport_setup.mk +++ b/sw/ooxmlexport_setup.mk @@ -30,6 +30,7 @@ define sw_ooxmlexport_components chart2/source/controller/chartcontroller \ comphelper/util/comphelp \ configmgr/source/configmgr \ + dbaccess/util/dba \ drawinglayer/drawinglayer \ embeddedobj/util/embobj \ filter/source/config/cache/filterconfig1 \ diff --git a/sw/qa/extras/ooxmlexport/data/ooo96040-2.odt b/sw/qa/extras/ooxmlexport/data/ooo96040-2.odt index e8e7e997f0e5..35a1858e533e 100644 Binary files a/sw/qa/extras/ooxmlexport/data/ooo96040-2.odt and b/sw/qa/extras/ooxmlexport/data/ooo96040-2.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index 4cf50c9433e9..a7f6078c6f7d 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -262,6 +262,14 @@ DECLARE_OOXMLEXPORT_TEST(testOldComplexMergeleft, "tdf90681-2.odt") assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[1]/w:tcPr/w:vMerge", "val", "continue"); } +DECLARE_OOXMLEXPORT_TEST(testOldComplexMergeTableInTable, "ooo96040-2.odt") +{ + xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + + if (!pXmlDoc) + return; +} + DECLARE_OOXMLEXPORT_TEST(testTablePreferredWidth, "tablePreferredWidth.docx") { xmlDocPtr pXmlDoc = parseExport("word/document.xml"); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index ad8e94d74277..986f3335fd7b 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -736,6 +736,14 @@ void DocxAttributeOutput::FinishTableRowCell( ww8::WW8TableNodeInfoInner::Pointe if ( bEndCell ) { + while (pInner->getDepth() < m_tableReference->m_nTableDepth) + { + //we expect that the higher depth row was closed, and + //we are just missing the table close + assert(lastOpenCell.back() == -1 && lastClosedCell.back() == -1); + EndTable(); + } + SyncNodelessCells(pInner, nCell, nRow); sal_Int32 nClosedCell = lastClosedCell.back(); -- cgit