diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-06-11 14:30:18 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-06-11 14:56:15 +0100 |
commit | f81c775b0782259c1b5504af859237fd71ac89e6 (patch) | |
tree | 50cc06d317ce073d468047702ddf9092816dbed7 | |
parent | 8a3120ced522357f53c97b051d0af6437c7a0316 (diff) |
best effort export of ooo72950-1.odt to docx without crashing
the curious case of ooo72950-1.odt which has no nodes in the first line of the
table as seen from the visual layout perspective seeing as the table is split
over two columns with the second column portion of the table higher than the
left column portion
Change-Id: I38526bf80ff8cef1688aa5f5f686e437c4a3d6e5
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/ooo72950-1.odt | bin | 0 -> 12591 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 6 |
3 files changed, 9 insertions, 3 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/ooo72950-1.odt b/sw/qa/extras/ooxmlexport/data/ooo72950-1.odt Binary files differnew file mode 100644 index 000000000000..df0ac91828a5 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/ooo72950-1.odt diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index 14be93e1e5e3..dddbdee335b3 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -843,6 +843,12 @@ DECLARE_OOXMLEXPORT_TEST(testKDE216114, "kde216114-1.odt") assertXPath(pXmlDoc, "//w:pict", 1); } +DECLARE_OOXMLEXPORT_TEST(testOO72950, "ooo72950-1.odt") +{ + if (xmlDocPtr pXmlDoc = parseExport("word/document.xml")) + assertXPath(pXmlDoc, "//w:tbl", 1); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index a0276c454627..e5111e1073d1 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -249,7 +249,7 @@ void DocxAttributeOutput::StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pText sal_uInt32 nRow = pTextNodeInfo->getRow(); sal_uInt32 nCell = pTextNodeInfo->getCell(); - if ( nRow == 0 && nCell == 0 ) + if (nCell == 0) { // Do we have to start the table? // [If we are at the right depth already, it means that we @@ -259,14 +259,14 @@ void DocxAttributeOutput::StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pText if ( nCurrentDepth > m_tableReference->m_nTableDepth ) { // Start all the tables that begin here - for ( sal_uInt32 nDepth = m_tableReference->m_nTableDepth + 1; nDepth <= pTextNodeInfo->getDepth(); ++nDepth ) + for ( sal_uInt32 nDepth = m_tableReference->m_nTableDepth + 1; nDepth <= nCurrentDepth; ++nDepth ) { ww8::WW8TableNodeInfoInner::Pointer_t pInner( pTextNodeInfo->getInnerForDepth( nDepth ) ); StartTable( pInner ); StartTableRow( pInner ); - StartTableCell(pInner, 0, 0); + StartTableCell(pInner, 0, nDepth == nCurrentDepth ? nRow : 0); } m_tableReference->m_nTableDepth = nCurrentDepth; |