[Libreoffice-commits] core.git: Branch 'libreoffice-6-1' - sw/qa writerfilter/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Sep 20 08:16:50 UTC 2018


 sw/qa/extras/ooxmlexport/data/tdf64264.docx              |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx               |   17 +++++++++++++++
 writerfilter/source/dmapper/DomainMapperTableManager.cxx |    2 -
 3 files changed, 18 insertions(+), 1 deletion(-)

New commits:
commit caa2b68b9f3d686aa6f99e3e341b0f76e9e4ce46
Author:     László Németh <nemeth at numbertext.org>
AuthorDate: Wed Sep 19 13:36:57 2018 +0200
Commit:     Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Thu Sep 20 10:16:24 2018 +0200

    tdf#64264 DOCX import: fix row count of repeating table header
    
    by ignoring isolated tblHeader settings, according to the standard.
    (OOXML 17.4.49 tblHeader (Repeat Table Row on Every New Page)
    "...if this row [with tblHeader property] is not contiguously connected
    with the first row of the table (that is, if this table row is not
    either the first row, or all rows between this row and the first row
    are not marked as header rows) then this property shall be ignored.")
    
    Note: with this fix, in a mixed environment, LibreOffice is able to
    fix the known problems of MS Word 2013/2016 by removing the isolated
    tblHeaders during DOCX import/export (such problems in MSO: missing
    repeating headers in a few pages or in the whole table, despite the
    correct settings; and non-modifiable repeat header row property in
    the table settings).
    
    Change-Id: I73e8394a75b77c937a4bac37d99ff747ad95a06e
    Reviewed-on: https://gerrit.libreoffice.org/60765
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit ace6bbf3da9ae27aca87865b6be887a3aed341fc)
    Reviewed-on: https://gerrit.libreoffice.org/60790
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf64264.docx b/sw/qa/extras/ooxmlexport/data/tdf64264.docx
new file mode 100644
index 000000000000..e2fea64dada7
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf64264.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index f32d14ee62a0..c7dc952d2c40 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -455,6 +455,23 @@ DECLARE_OOXMLEXPORT_TEST(testTdf118691, "tdf118691.docx")
     CPPUNIT_ASSERT_EQUAL(OUString("Before\nAfter"), xCell->getString());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf64264, "tdf64264.docx")
+{
+    // DOCX table rows with tblHeader setting mustn't modify the count of the
+    // repeated table header rows, when there is rows before them without tblHeader settings.
+    xmlDocPtr pDump = parseLayoutDump();
+    CPPUNIT_ASSERT_EQUAL(2, getPages());
+
+    // table starts on page 1 and finished on page 2
+    // and it has got only a single repeating header line
+    assertXPath(pDump, "/root/page[2]/body/tab", 1);
+    assertXPath(pDump, "/root/page[2]/body/tab/row", 47);
+    CPPUNIT_ASSERT_EQUAL(OUString("Repeating Table Header"),
+                         parseDump("/root/page[2]/body/tab/row[1]/cell[1]/txt/text()"));
+    CPPUNIT_ASSERT_EQUAL(OUString("Text"),
+                         parseDump("/root/page[2]/body/tab/row[2]/cell[1]/txt/text()"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index 613282e39683..dffcfa7b461f 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -198,7 +198,7 @@ bool DomainMapperTableManager::sprm(Sprm & rSprm)
             case NS_ooxml::LN_CT_TrPrBase_tblHeader:
                 // if nIntValue == 1 then the row is a repeated header line
                 // to prevent later rows from increasing the repeating m_nHeaderRepeat is set to NULL when repeating stops
-                if( nIntValue > 0 && m_nHeaderRepeat >= 0 )
+                if( nIntValue > 0 && m_nHeaderRepeat == static_cast<int>(m_nRow) )
                 {
                     ++m_nHeaderRepeat;
                     TablePropertyMapPtr pPropMap( new TablePropertyMap );


More information about the Libreoffice-commits mailing list