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

Mike Kaganski mike.kaganski at collabora.com
Wed Jun 28 08:59:30 UTC 2017


 sw/qa/extras/ooxmlimport/data/tdf108714.docx          |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx              |   19 ++++++++++++++----
 writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |    8 +++----
 3 files changed, 19 insertions(+), 8 deletions(-)

New commits:
commit 553204015f954d20db65e6adcda68b823a8ef235
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date:   Wed Jun 28 10:50:28 2017 +0300

    tdf#108714 follow-up: handle deferred break in character group
    
    If an out-of-order break happens immediately after a table, then
    in following paragraph group (before character group start) the
    table level is > 0, and break is ignored.
    
    Since out-of-order break only happens at top level, the following
    character group necessarily designates a new paragraph group, so
    it's OK to handle that at the character group level, where table
    level is already updated.
    
    Change-Id: Ic1b1bb89e12407b050c2e880ad971794311845a5
    Reviewed-on: https://gerrit.libreoffice.org/39347
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sw/qa/extras/ooxmlimport/data/tdf108714.docx b/sw/qa/extras/ooxmlimport/data/tdf108714.docx
index e564d44a648b..cee4176aa8e0 100644
Binary files a/sw/qa/extras/ooxmlimport/data/tdf108714.docx and b/sw/qa/extras/ooxmlimport/data/tdf108714.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 97dd9128b9ea..4cb380910a30 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1315,8 +1315,8 @@ DECLARE_OOXMLIMPORT_TEST(testVmlAdjustments, "vml-adjustments.docx")
 
 DECLARE_OOXMLIMPORT_TEST(testTdf108714, "tdf108714.docx")
 {
-    CPPUNIT_ASSERT_EQUAL(4, getParagraphs());
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("Page break is absent - we lost bug-to-bug compatibility with Word", 3, getPages());
+    CPPUNIT_ASSERT_EQUAL(6, getParagraphs());
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Page break is absent - we lost bug-to-bug compatibility with Word", 4, getPages());
 
     // The second (empty) paragraph must be at first page, despite the <w:br> element was before it.
     // That's because Word treats such break as first element in first run of following paragraph:
@@ -1349,12 +1349,23 @@ DECLARE_OOXMLIMPORT_TEST(testTdf108714, "tdf108714.docx")
     CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE, breakType);
 
     paragraph = getParagraph(3);
-    CPPUNIT_ASSERT_EQUAL(OUString("Paragraph 2"), paragraph->getString());
+    CPPUNIT_ASSERT_EQUAL(OUString("Paragraph 3"), paragraph->getString());
     breakType = getProperty<style::BreakType>(paragraph, "BreakType");
     CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, breakType);
 
     paragraph = getParagraph(4);
-    CPPUNIT_ASSERT_EQUAL(OUString("Paragraph 3"), paragraph->getString());
+    CPPUNIT_ASSERT_EQUAL(OUString("Paragraph 4"), paragraph->getString());
+    breakType = getProperty<style::BreakType>(paragraph, "BreakType");
+    CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, breakType);
+
+    // A table with immediately following break
+    uno::Reference<text::XTextContent> table = getParagraphOrTable(5);
+    getCell(table, "A1", "Paragraph 5 in table");
+    breakType = getProperty<style::BreakType>(table, "BreakType");
+    CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE, breakType);
+
+    paragraph = getParagraph(6);
+    CPPUNIT_ASSERT_EQUAL(OUString("Paragraph 6"), paragraph->getString());
     breakType = getProperty<style::BreakType>(paragraph, "BreakType");
     CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, breakType);
 }
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index e208e60b4920..6ec8820f5293 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -345,6 +345,10 @@ void OOXMLFastContextHandler::startCharacterGroup()
             mpParserState->setInCharacterGroup(true);
             mpParserState->resolveCharacterProperties(*mpStream);
         }
+
+        // tdf#108714 : if we have a postponed break information,
+        // then apply it now, before any other paragraph content.
+        mpParserState->resolvePostponedBreak(*mpStream);
     }
 }
 
@@ -371,10 +375,6 @@ void OOXMLFastContextHandler::startParagraphGroup()
         {
             mpStream->startParagraphGroup();
             mpParserState->setInParagraphGroup(true);
-
-            // tdf#108714 : if we have a postponed break information,
-            // then apply it now, before any other paragraph content.
-            mpParserState->resolvePostponedBreak(*mpStream);
         }
     }
 }


More information about the Libreoffice-commits mailing list