summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-09-08 20:14:27 +0200
committerMiklos Vajna <vmiklos@collabora.com>2022-09-09 08:18:28 +0200
commit3c610336a58f644525d5e4d2566c35eee6f7a618 (patch)
tree64a2731aeb72475fcb40247260cc6124a6dd112b /sw
parent5f86f491701dc9f6f52129cf87644167e95ab40a (diff)
tdf#148214 RTF import: avoid fake paragraph for \page when possible
The bugdoc has 2 pages, an explicit page break between them and the first page has enough content that an additional fake paragraph at the end would lead to a 3rd, unwanted page. The fake paragraph was introduced in commit 7b58fc3dafc789aa55fff5ffef6ab83c3aa8b6e0 (fdo#48104 fix RTF import of \page in inner groups, 2012-04-02), because dmapper ignores more than 1 page breaks in a paragraph. Fix the problem by only inserting the fake paragraph in case the "page break before" paragraph property would have no effect (very first paragraph in the document) or we already sent characters (para props are lazy-sent on the first character). This keeps existing cases working, but avoids the unwanted fake paragraph in the bugdoc. I suspect the root cause is that dmapper doesn't handle multiple page breaks in a paragraph -- once that's fixed, this parBreak() call can be completely removed. Adjusted tests: - testImportHeaderFooter: this asserted the presence of fake paragraphs, which are now gone in the easy case, so this change is an improvement - testTdf133437: no visual difference before/after, probably the test intent was just "make sure this page has several shapes", the exact number isn't that interesting Change-Id: Idd2b8a70b4122eb08d9d305018d384dc0bbb276a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139704 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/rtfexport/rtfexport5.cxx4
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx4
2 files changed, 4 insertions, 4 deletions
diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx b/sw/qa/extras/rtfexport/rtfexport5.cxx
index 59390a6fb5e0..511c749a5aec 100644
--- a/sw/qa/extras/rtfexport/rtfexport5.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport5.cxx
@@ -1233,7 +1233,7 @@ DECLARE_RTFEXPORT_TEST(testTdf133437, "tdf133437.rtf")
xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
sal_Int32 shapesOnPage = xmlXPathNodeSetGetLength(pXmlNodes);
xmlXPathFreeObject(pXmlObj);
- CPPUNIT_ASSERT_EQUAL(sal_Int32(120), shapesOnPage);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(118), shapesOnPage);
}
// Third page
{
@@ -1242,7 +1242,7 @@ DECLARE_RTFEXPORT_TEST(testTdf133437, "tdf133437.rtf")
xmlNodeSetPtr pXmlNodes = pXmlObj->nodesetval;
sal_Int32 shapesOnPage = xmlXPathNodeSetGetLength(pXmlNodes);
xmlXPathFreeObject(pXmlObj);
- CPPUNIT_ASSERT_EQUAL(sal_Int32(86), shapesOnPage);
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(84), shapesOnPage);
}
}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index e3e7f887a047..86a26ca0fa1d 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1416,11 +1416,11 @@ CPPUNIT_TEST_FIXTURE(Test, testImportHeaderFooter)
OUString value = paragraph->getString();
CPPUNIT_ASSERT_EQUAL(OUString("First Page"), value);
- paragraph = getParagraph(4);
+ paragraph = getParagraph(3);
value = paragraph->getString();
CPPUNIT_ASSERT_EQUAL(OUString("Second Page"), value);
- paragraph = getParagraph(7);
+ paragraph = getParagraph(5);
value = paragraph->getString();
CPPUNIT_ASSERT_EQUAL(OUString("Third Page"), value);