diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2024-01-30 20:03:45 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2024-01-31 18:35:12 +0100 |
commit | dbe78489e98d565b72a703524308523135ffdd67 (patch) | |
tree | d177e7f7b4b3b84e6483cf8f54210548815b496b | |
parent | 57abad5cf990111fd7de011809d4421dc0550193 (diff) |
tdf#158586 writerfilter: RTF import: handle \sect in frame as \par
This fixes the test testTdf158586_0 and testTdf158586_0B to look like in
Word; the case appears a bit esoteric, hopefully Word won't actually
create such documents? But Word will round-trip such bugdoc to a DOCX
where the first w:p contains all of w:framePr and w:sectPr and w:br...
Change-Id: I6ec09478a774e1e9c785e9482618c1afc388df0e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162778
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport8.cxx | 15 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdispatchsymbol.cxx | 2 |
2 files changed, 12 insertions, 5 deletions
diff --git a/sw/qa/extras/rtfexport/rtfexport8.cxx b/sw/qa/extras/rtfexport/rtfexport8.cxx index b1c694f7daa4..ebc2c3d2bf3f 100644 --- a/sw/qa/extras/rtfexport/rtfexport8.cxx +++ b/sw/qa/extras/rtfexport/rtfexport8.cxx @@ -52,17 +52,24 @@ DECLARE_RTFEXPORT_TEST(testTdf158586_0, "tdf158586_pageBreak0.rtf") { // The specified page break must be lost because it is in a text frame CPPUNIT_ASSERT_EQUAL(1, getPages()); - // CPPUNIT_ASSERT_EQUAL(1, getParagraphs()); + CPPUNIT_ASSERT_EQUAL(1, getParagraphs()); - // There should be no empty carriage return at the start of the second page - // const auto& pLayout = parseLayoutDump(); - // assertXPathContent(pLayout, "//page[1]/body/txt"_ostr, "First page");} + // There should be no empty paragraph at the start + const auto& pLayout = parseLayoutDump(); + assertXPath(pLayout, "//anchored"_ostr, 1); + assertXPathContent(pLayout, "/root/page[1]/body//txt"_ostr, "First page"); } DECLARE_RTFEXPORT_TEST(testTdf158586_0B, "tdf158586_pageBreak0B.rtf") { // The specified page break must be lost because it is in a text frame CPPUNIT_ASSERT_EQUAL(1, getPages()); + CPPUNIT_ASSERT_EQUAL(1, getParagraphs()); + + // There should be no empty paragraph at the start + const auto& pLayout = parseLayoutDump(); + assertXPath(pLayout, "//anchored"_ostr, 1); + assertXPathContent(pLayout, "/root/page[1]/body//txt"_ostr, "First page"); } DECLARE_RTFEXPORT_TEST(testTdf158586_1, "tdf158586_pageBreak1.rtf") diff --git a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx index 9347174b6da2..6c1c94b944d9 100644 --- a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx +++ b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx @@ -132,7 +132,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword) case RTFKeyword::SECT: { m_bHadSect = true; - if (m_bIgnoreNextContSectBreak) + if (m_bIgnoreNextContSectBreak || m_aStates.top().getFrame().hasProperties()) { // testContSectionPageBreak: need \par now dispatchSymbol(RTFKeyword::PAR); |