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

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Tue Sep 24 13:40:05 UTC 2019


 sw/qa/extras/ooxmlimport/data/tdf104167.docx    |binary
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx       |   13 +++++++++++++
 writerfilter/source/dmapper/StyleSheetTable.cxx |    9 ---------
 3 files changed, 13 insertions(+), 9 deletions(-)

New commits:
commit d7a27b4373a209cd9b5fd52792a22dd3f612acaa
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Sep 23 21:02:54 2019 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Tue Sep 24 15:39:19 2019 +0200

    tdf#104167 DOCX import: don't map Heading1 to Heading 1 para style
    
    This is nominally a regression from commit
    c12a78e42e1cbaaf4ea021c82acbec5ea177b1f6 (writerfilter: reset properties
    of reused styles, 2014-06-04), which assumed that style names are
    unique.
    
    They are not unique for the bugdoc, as it has paragraph styles named
    'heading 1' and 'Heading1', both mapped to 'Heading 1'.
    
    The mapping for the style name without a space was added in commit
    1d2af74e226bf44e1a0f1e1981ca965cffeaa0b2 (INTEGRATION: CWS xmlfilter02
    (1.27.12); FILE MERGED, 2008-01-10), in the "2007/11/22 14:53:43 os
    1.27.12.9: Tab stops almost perfect now" part, sadly without any
    indication on why that would be a good idea.
    
    The binary DOC import never mapped Heading1 to Heading 1, so it doesn't
    have this problem.
    
    Fix the problem by removing this mapping, it leads to formatting loss
    when a document has both HeadingN and Heading N styles.
    
    (cherry picked from commit a283627036c9b1c56e4b765866b8fb8a26ec87ab)
    
    Conflicts:
            sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
    
    Change-Id: I26dd999f5a536e079ac351ba5d40d20c83b99310
    Reviewed-on: https://gerrit.libreoffice.org/79429
    Reviewed-by: Xisco FaulĂ­ <xiscofauli at libreoffice.org>
    Tested-by: Xisco FaulĂ­ <xiscofauli at libreoffice.org>
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sw/qa/extras/ooxmlimport/data/tdf104167.docx b/sw/qa/extras/ooxmlimport/data/tdf104167.docx
new file mode 100644
index 000000000000..3bd881ba02df
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf104167.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 3976c96cb8f5..33c8a34d2a72 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -18,6 +18,7 @@
 #include <wrtsh.hxx>
 #include <com/sun/star/document/XEmbeddedObjectSupplier2.hpp>
 #include <com/sun/star/embed/Aspects.hpp>
+#include <com/sun/star/style/BreakType.hpp>
 
 class Test : public SwModelTestBase
 {
@@ -244,6 +245,18 @@ DECLARE_OOXMLIMPORT_TEST(testTdf124398, "tdf124398.docx")
     CPPUNIT_ASSERT_EQUAL(OUString("com.sun.star.drawing.OLE2Shape"), xShape->getShapeType());
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTdf104167, "tdf104167.docx")
+{
+    // Make sure that heading 1 paragraphs start on a new page.
+    uno::Any xStyle = getStyles("ParagraphStyles")->getByName("Heading 1");
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: 4
+    // - Actual  : 0
+    // i.e. the <w:pageBreakBefore/> was lost on import.
+    CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE,
+                         getProperty<style::BreakType>(xStyle, "BreakType"));
+}
+
 DECLARE_OOXMLIMPORT_TEST(testTdf113946, "tdf113946.docx")
 {
     OUString aTop = parseDump("/root/page/body/txt/anchored/SwAnchoredDrawObject/bounds", "top");
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index d1af96db3f87..a3fc9945e1c9 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -1263,15 +1263,6 @@ static const sal_Char* const aStyleNamePairs[] =
     "heading 7",                  "Heading 7",
     "heading 8",                  "Heading 8",
     "heading 9",                  "Heading 9",
-    "Heading1",                   "Heading 1",
-    "Heading2",                   "Heading 2",
-    "Heading3",                   "Heading 3",
-    "Heading4",                   "Heading 4",
-    "Heading5",                   "Heading 5",
-    "Heading6",                   "Heading 6",
-    "Heading7",                   "Heading 7",
-    "Heading8",                   "Heading 8",
-    "Heading9",                   "Heading 9",
     "Heading 1",                  "Heading 1",
     "Heading 2",                  "Heading 2",
     "Heading 3",                  "Heading 3",


More information about the Libreoffice-commits mailing list