summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <jluth@mail.com>2023-12-13 16:09:52 -0500
committerJustin Luth <jluth@mail.com>2023-12-14 02:55:31 +0100
commitde773a115c25c36993f5bb5a463ea5db452b5be5 (patch)
tree85a5989bcfa757440e4bc64ccf25dce35cd02362
parent944b5a435c14435841d70f09bc922a6a5c0a741c (diff)
tdf#158681 Revert "tdf#153613 writerfilter: don't always split para
... for shape w/ pagebreak" This reverts 7.6 commit a9bc19c2d4a35606668aa2dcc53355651b71ee78. The commit in general is probably fine. However, it fails in case of an empty paragraph (with only anchors). Unfortunately, there is no way of knowing ahead of time, so either everything needs to be processed after a delay, or else the paragraph needs to be split and then re-joined in case it is not an empty paragraph. Both options are extremely non-trivial - I don't know how to do either of them. In this case it is also the last paragraph in the document, again something not known during import and which has special-casing in MSO. make CppunitTest_sw_ooxmlexport18 \ CPPUNIT_TEST_NAME=testTdf153613_textboxAfterPgBreak3 Change-Id: I4471e216b6523032b85178d85795434694cc1e22 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160720 Tested-by: Jenkins Reviewed-by: Justin Luth <jluth@mail.com> (cherry picked from commit d58cd70f550e8967c2518ebb2179e15f5a3a84ea) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160695
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak.docxbin6704 -> 0 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak2.docxbin19306 -> 0 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak3.docxbin0 -> 22616 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport18.cxx20
-rw-r--r--writerfilter/source/dmapper/DomainMapper.cxx16
5 files changed, 14 insertions, 22 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak.docx b/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak.docx
deleted file mode 100644
index 4ad4dfba8110..000000000000
--- a/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak.docx
+++ /dev/null
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak2.docx b/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak2.docx
deleted file mode 100644
index 26006abd2fe3..000000000000
--- a/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak2.docx
+++ /dev/null
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak3.docx b/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak3.docx
new file mode 100644
index 000000000000..29c63ad71ed3
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak3.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index de52a56ff0d2..967a4f24183e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -357,26 +357,18 @@ DECLARE_OOXMLEXPORT_TEST(testTdf153613_inlineAfterPgBreak2, "tdf153613_inlineAft
assertXPath(pLayout, "//page[2]//anchored"_ostr, 1);
}
-DECLARE_OOXMLEXPORT_TEST(testTdf153613_textboxAfterPgBreak, "tdf153613_textboxAfterPgBreak.docx")
+DECLARE_OOXMLEXPORT_TEST(testTdf153613_sdtAfterPgBreak, "tdf153613_sdtAfterPgBreak.docx")
{
- CPPUNIT_ASSERT_EQUAL(3, getParagraphs());
-
- const auto& pLayout = parseLayoutDump();
- assertXPathContent(pLayout, "//page[2]/body/txt"_ostr, "There should be no prior carriage return.");
+ CPPUNIT_ASSERT_EQUAL(2, getPages());
}
-DECLARE_OOXMLEXPORT_TEST(testTdf153613_textboxAfterPgBreak2, "tdf153613_textboxAfterPgBreak2.docx")
+DECLARE_OOXMLEXPORT_TEST(testTdf153613_textboxAfterPgBreak3, "tdf153613_textboxAfterPgBreak3.docx")
{
- // same as previous example, except that it is the first paragraph in the section.
- CPPUNIT_ASSERT_EQUAL(2, getParagraphs());
+ // both textboxes on on the second (last) page
+ CPPUNIT_ASSERT_EQUAL(2, getPages());
const auto& pLayout = parseLayoutDump();
- assertXPathContent(pLayout, "//page[2]/body/txt"_ostr, "There should be no prior carriage return.");
-}
-
-DECLARE_OOXMLEXPORT_TEST(testTdf153613_sdtAfterPgBreak, "tdf153613_sdtAfterPgBreak.docx")
-{
- CPPUNIT_ASSERT_EQUAL(2, getPages());
+ assertXPath(pLayout, "//page[2]/body/txt/anchored/fly"_ostr, 2);
}
DECLARE_OOXMLEXPORT_TEST(testTdf153964_topMarginAfterBreak14, "tdf153964_topMarginAfterBreak14.docx")
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 70fc7820844c..98d763b709b6 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3744,14 +3744,14 @@ void DomainMapper::lcl_startShape(uno::Reference<drawing::XShape> const& xShape)
// started shape will be on the correct page.
if (m_pImpl->isBreakDeferred(PAGE_BREAK))
{
- // RTF doesn't properly report IsFirstRun, so in order to prevent regressions
- // always split the paragraph for RTF since that is the way it has been done lately.
- if (!m_pImpl->IsFirstRun() || IsRTFImport())
- {
- m_pImpl->m_bIsSplitPara = true;
- finishParagraph();
- lcl_startParagraphGroup();
- }
+ m_pImpl->clearDeferredBreak(PAGE_BREAK);
+ lcl_startCharacterGroup();
+ sal_Unicode const sBreak[] = { 0x0d };
+ lcl_utext(sBreak, 1);
+ lcl_endCharacterGroup();
+ lcl_endParagraphGroup();
+ lcl_startParagraphGroup();
+ m_pImpl->GetTopContext()->Insert(PROP_BREAK_TYPE, uno::Any(style::BreakType_PAGE_BEFORE));
}
m_pImpl->PushShapeContext( xShape );
lcl_startParagraphGroup();