sw/qa/extras/rtfexport/rtfexport8.cxx | 15 +++++++++++---- writerfilter/source/rtftok/rtfdispatchsymbol.cxx | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-)
New commits: commit dbe78489e98d565b72a703524308523135ffdd67 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Tue Jan 30 20:03:45 2024 +0100 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Wed Jan 31 18:35:12 2024 +0100 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.st...@allotropia.de> 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);