[Libreoffice-commits] core.git: sw/qa sw/source

Caolán McNamara caolanm at redhat.com
Sat Jun 20 10:23:01 PDT 2015


 sw/qa/extras/ooxmlexport/data/ooo106020-1.odt |binary
 sw/qa/extras/ooxmlexport/ooxmlexport5.cxx     |    8 ++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx  |   10 ++++++----
 3 files changed, 14 insertions(+), 4 deletions(-)

New commits:
commit 20e64b6012442749d01810869229613ea36be3a9
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sat Jun 20 18:04:12 2015 +0100

    fix assert on exporting ooo106020-1.odt to docx
    
    the dread msword column limit
    
    Change-Id: Icbf7fc396de62286d523516da815dabf62336567

diff --git a/sw/qa/extras/ooxmlexport/data/ooo106020-1.odt b/sw/qa/extras/ooxmlexport/data/ooo106020-1.odt
new file mode 100644
index 0000000..9cc774b
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/ooo106020-1.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index b655b99d..3df813e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
@@ -858,6 +858,14 @@ DECLARE_OOXMLEXPORT_TEST(fdo60957, "fdo60957-2.docx")
         assertXPath(pXmlDoc, "//w:tbl", 2);
 }
 
+//This has more cells than msword supports, we must balance the
+//number of cell start and ends
+DECLARE_OOXMLEXPORT_TEST(testOO106020, "ooo106020-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 989a717..f5dd271 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -688,16 +688,18 @@ void DocxAttributeOutput::EndSdtBlock()
     m_pSerializer->endElementNS( XML_w, XML_sdt );
 }
 
+#define MAX_CELL_IN_WORD 62
+
 void DocxAttributeOutput::SyncNodelessCells(ww8::WW8TableNodeInfoInner::Pointer_t pInner, sal_Int32 nCell, sal_uInt32 nRow)
 {
     sal_Int32 nOpenCell = lastOpenCell.back();
-    if (nOpenCell != -1 && nOpenCell != nCell)
+    if (nOpenCell != -1 && nOpenCell != nCell && nOpenCell < MAX_CELL_IN_WORD)
         EndTableCell(pInner, nOpenCell, nRow);
 
     sal_Int32 nClosedCell = lastClosedCell.back();
     for (sal_Int32 i = nClosedCell+1; i < nCell; ++i)
     {
-        if (i >= 62)    //words limit
+        if (i >= MAX_CELL_IN_WORD)
             break;
 
         if (i == 0)
@@ -725,11 +727,11 @@ void DocxAttributeOutput::FinishTableRowCell( ww8::WW8TableNodeInfoInner::Pointe
         // so simply if there are more columns, don't close the last one msoffice will handle
         // and merge the contents of the remaining ones into it (since we don't close the cell
         // here, following ones will not be opened)
-        const bool limitWorkaround = (nCell >= 62 && !pInner->isEndOfLine());
+        const bool limitWorkaround = (nCell >= MAX_CELL_IN_WORD && !pInner->isEndOfLine());
         const bool bEndCell = pInner->isEndOfCell() && !limitWorkaround;
         const bool bEndRow = pInner->isEndOfLine();
 
-        if ( bEndCell )
+        if (bEndCell)
         {
             while (pInner->getDepth() < m_tableReference->m_nTableDepth)
             {


More information about the Libreoffice-commits mailing list