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 f95f0ce163743706a3670c6e33593023c22af2ff Author: Mike Kaganski <mike.kagan...@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 <c...@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kagan...@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 4cb380910a30..2513ca8097e7 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1359,8 +1359,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 55a9ca47b6ba..8f78c8390d75 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> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits