Kaydet (Commit) f95f0ce1 authored tarafından Mike Kaganski's avatar Mike Kaganski

tdf#108714: Also support paragraph-level (line) breaks

Change-Id: Ida55015363cac3ae29b82a60a9b9a5f1b39086a2
Reviewed-on: https://gerrit.libreoffice.org/39675Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst db474104
...@@ -1359,8 +1359,10 @@ DECLARE_OOXMLIMPORT_TEST(testTdf108714, "tdf108714.docx") ...@@ -1359,8 +1359,10 @@ DECLARE_OOXMLIMPORT_TEST(testTdf108714, "tdf108714.docx")
CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, breakType); CPPUNIT_ASSERT_EQUAL(style::BreakType_PAGE_BEFORE, breakType);
// A table with immediately following break // 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); 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"); breakType = getProperty<style::BreakType>(table, "BreakType");
CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE, breakType); CPPUNIT_ASSERT_EQUAL(style::BreakType_NONE, breakType);
......
...@@ -214,17 +214,17 @@ void OOXMLParserState::setTableProperties(const OOXMLPropertySet::Pointer_t& pPr ...@@ -214,17 +214,17 @@ void OOXMLParserState::setTableProperties(const OOXMLPropertySet::Pointer_t& pPr
// tdf#108714 // tdf#108714
void OOXMLParserState::resolvePostponedBreak(Stream & rStream) void OOXMLParserState::resolvePostponedBreak(Stream & rStream)
{ {
if (mpPostponedBreak) for (const auto & rBreak: mvPostponedBreaks)
{ {
OOXMLBreakHandler aBreakHandler(rStream); OOXMLBreakHandler aBreakHandler(rStream);
mpPostponedBreak->resolve(aBreakHandler); rBreak->resolve(aBreakHandler);
mpPostponedBreak.reset();
} }
mvPostponedBreaks.clear();
} }
void OOXMLParserState::setPostponedBreak(const OOXMLPropertySet::Pointer_t & pProps) void OOXMLParserState::setPostponedBreak(const OOXMLPropertySet::Pointer_t & pProps)
{ {
mpPostponedBreak = pProps; mvPostponedBreaks.push_back(pProps);
} }
void OOXMLParserState::startTable() void OOXMLParserState::startTable()
......
...@@ -59,7 +59,7 @@ class OOXMLParserState final ...@@ -59,7 +59,7 @@ class OOXMLParserState final
bool savedInCharacterGroup; bool savedInCharacterGroup;
bool savedLastParagraphInSection; bool savedLastParagraphInSection;
std::vector<SavedAlternateState> maSavedAlternateStates; std::vector<SavedAlternateState> maSavedAlternateStates;
OOXMLPropertySet::Pointer_t mpPostponedBreak; std::vector<OOXMLPropertySet::Pointer_t> mvPostponedBreaks;
public: public:
typedef std::shared_ptr<OOXMLParserState> Pointer_t; typedef std::shared_ptr<OOXMLParserState> Pointer_t;
......
...@@ -14178,6 +14178,11 @@ ...@@ -14178,6 +14178,11 @@
<attribute name="rsidRDefault"> <attribute name="rsidRDefault">
<data type="string"/> <data type="string"/>
</attribute> </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>
<define name="ST_TblWidth"> <define name="ST_TblWidth">
<choice> <choice>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment