[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - sw/qa writerfilter/source

Mike Kaganski mike.kaganski at collabora.com
Fri Jul 7 06:53:23 UTC 2017


 sw/qa/extras/ooxmlimport/data/tdf108714.docx   |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx       |    4 +++-
 writerfilter/source/ooxml/OOXMLParserState.cxx |    8 ++++----
 writerfilter/source/ooxml/OOXMLParserState.hxx |    2 +-
 writerfilter/source/ooxml/model.xml            |    5 +++++
 5 files changed, 13 insertions(+), 6 deletions(-)

New commits:
commit 919b6958dbb1c17c060ba9a58fe245b825b271c2
Author: Mike Kaganski <mike.kaganski at collabora.com>
Date:   Fri Jul 7 08:38:37 2017 +0300

    tdf#108714: Also support paragraph-level (line) breaks
    
    Change-Id: Ida55015363cac3ae29b82a60a9b9a5f1b39086a2
    Reviewed-on: https://gerrit.libreoffice.org/39675
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
    (cherry picked from commit f95f0ce163743706a3670c6e33593023c22af2ff)
    Reviewed-on: https://gerrit.libreoffice.org/39677
    Tested-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 cee4176aa8e0..69c4547960a6 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 ed0f0c926cf2..767f908ab6fb 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -1453,8 +1453,10 @@ DECLARE_OOXMLIMPORT_TEST(testTdf108714, "tdf108714.docx")
     CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, breakType);
 
     // A table with immediately following break
+    // Line breaks in block and paragraph levels must be taken into account
+    // Several successive out-of-place w:br's must produce required amount of breaks
     uno::Reference<text::XTextContent> table = getParagraphOrTable(5);
-    getCell(table, "A1", "Paragraph 5 in table");
+    getCell(table, "A1", "\n\n\n\nParagraph 5 in table");
     breakType = getProperty<style::BreakType>(table, "BreakType");
     CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE, breakType);
 
diff --git a/writerfilter/source/ooxml/OOXMLParserState.cxx b/writerfilter/source/ooxml/OOXMLParserState.cxx
index a655488e3194..3e4d3a7bcc0a 100644
--- a/writerfilter/source/ooxml/OOXMLParserState.cxx
+++ b/writerfilter/source/ooxml/OOXMLParserState.cxx
@@ -214,17 +214,17 @@ void OOXMLParserState::setTableProperties(const OOXMLPropertySet::Pointer_t& pPr
 // tdf#108714
 void OOXMLParserState::resolvePostponedBreak(Stream & rStream)
 {
-    if (mpPostponedBreak)
+    for (const auto & rBreak: mvPostponedBreaks)
     {
         OOXMLBreakHandler aBreakHandler(rStream);
-        mpPostponedBreak->resolve(aBreakHandler);
-        mpPostponedBreak.reset();
+        rBreak->resolve(aBreakHandler);
     }
+    mvPostponedBreaks.clear();
 }
 
 void OOXMLParserState::setPostponedBreak(const OOXMLPropertySet::Pointer_t & pProps)
 {
-    mpPostponedBreak = pProps;
+    mvPostponedBreaks.push_back(pProps);
 }
 
 void OOXMLParserState::startTable()
diff --git a/writerfilter/source/ooxml/OOXMLParserState.hxx b/writerfilter/source/ooxml/OOXMLParserState.hxx
index d328b07b2835..f2895e9b9274 100644
--- a/writerfilter/source/ooxml/OOXMLParserState.hxx
+++ b/writerfilter/source/ooxml/OOXMLParserState.hxx
@@ -59,7 +59,7 @@ class OOXMLParserState final
     bool savedInCharacterGroup;
     bool savedLastParagraphInSection;
     std::vector<SavedAlternateState> maSavedAlternateStates;
-    OOXMLPropertySet::Pointer_t mpPostponedBreak;
+    std::vector<OOXMLPropertySet::Pointer_t> mvPostponedBreaks;
 
 public:
     typedef std::shared_ptr<OOXMLParserState> Pointer_t;
diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml
index 5318d7d3c819..56aff376c8f9 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -14178,6 +14178,11 @@
         <attribute name="rsidRDefault">
           <data type="string"/>
         </attribute>
+        <!-- tdf#108714 : allow <w:br> at paragraph level (despite this is illegal according to ECMA-376-1:2016) - bug-to-bug compatibility with Word -->
+        <element name="br">
+          <ref name="CT_Br_OutOfOrder"/>
+        </element>
+        <!-- end tdf#108714 -->
       </define>
       <define name="ST_TblWidth">
         <choice>


More information about the Libreoffice-commits mailing list