[Libreoffice-commits] core.git: Branch 'distro/nisz/libreoffice-6-4' - sw/qa sw/source

László Németh (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 11 17:07:20 UTC 2020


 sw/qa/extras/ooxmlexport/data/tdf107626.odt  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport9.cxx    |    7 +++++++
 sw/source/filter/ww8/docxattributeoutput.cxx |   17 ++++++++++++++++-
 3 files changed, 23 insertions(+), 1 deletion(-)

New commits:
commit c5b8bbfeeb7420b86df131c618469a840db7281c
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Fri Mar 6 22:26:17 2020 +0100
Commit:     Gabor Kelemen <kelemen.gabor2 at nisz.hu>
CommitDate: Thu Jun 11 19:06:48 2020 +0200

    tdf#107626 DOCX table export: fix missing trailing cells
    
    resulting broken table layout with incomplete cell merging,
    for example, content in extra table rows and in columns
    of different lengths.
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90136
    Tested-by: László Németh <nemeth at numbertext.org>
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit 6db846c3c0bc1c44da1f3c7a8dea385930acc3b1)
    
    Change-Id: Ic5057e43d4c66e34ffc1373030be66815ff52563
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96143
    Tested-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>
    Reviewed-by: Gabor Kelemen <kelemen.gabor2 at nisz.hu>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf107626.odt b/sw/qa/extras/ooxmlexport/data/tdf107626.odt
new file mode 100644
index 000000000000..b7c8489cd341
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf107626.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index ece282f437aa..6e9d628763b1 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -184,6 +184,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf106690Cell, "tdf106690-cell.docx")
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(494), getProperty<sal_Int32>(getParagraphOfText(2, xCell->getText()), "ParaBottomMargin"));
 }
 
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf107626, "tdf107626.odt")
+{
+    xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+    // This was 2 (missing trailing cell in merged cell range)
+    assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[3]/w:tc", 3);
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf106970, "tdf106970.docx")
 {
     // The second paragraph (first numbered one) had 0 bottom margin:
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index ec37717bc7bc..ec73daf45c6d 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -949,9 +949,24 @@ void DocxAttributeOutput::FinishTableRowCell( ww8::WW8TableNodeInfoInner::Pointe
             sal_Int32 nClosedCell = lastClosedCell.back();
             if (nCell == nClosedCell)
             {
-                //Start missing trailing cell
+                //Start missing trailing cell(s)
                 ++nCell;
                 StartTableCell(pInner, nCell, nRow);
+
+                //Continue on missing next trailing cell(s)
+                ww8::RowSpansPtr xRowSpans = pInner->getRowSpansOfRow();
+                sal_Int32 nRemainingCells = xRowSpans->size() - nCell;
+                for (sal_Int32 i = 1; i < nRemainingCells; ++i)
+                {
+                    if (bForceEmptyParagraph)
+                    {
+                        m_pSerializer->singleElementNS(XML_w, XML_p);
+                    }
+
+                    EndTableCell(nCell);
+
+                    StartTableCell(pInner, nCell, nRow);
+                }
             }
 
             if (bForceEmptyParagraph)


More information about the Libreoffice-commits mailing list