dev/null                                                          |binary
 sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak3.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx                        |   20 
+++-------
 writerfilter/source/dmapper/DomainMapper.cxx                      |   16 
++++----
 4 files changed, 14 insertions(+), 22 deletions(-)

New commits:
commit 773029159caf0164885015f6193774cebe898b9c
Author:     Justin Luth <[email protected]>
AuthorDate: Wed Dec 13 16:09:52 2023 -0500
Commit:     Xisco Fauli <[email protected]>
CommitDate: Thu Dec 14 09:40:31 2023 +0100

    tdf#158681 Revert "tdf#153613 writerfilter: don't always split para
    
    ... for shape w/ pagebreak"
    
    This reverts my 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 <[email protected]>
    (cherry picked from commit d58cd70f550e8967c2518ebb2179e15f5a3a84ea)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160695
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160746
    Reviewed-by: Xisco Fauli <[email protected]>

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
Binary files a/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak.docx 
and /dev/null 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
Binary files 
a/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak2.docx and 
/dev/null 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
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf153613_textboxAfterPgBreak3.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index 04c5789c19c6..30ac5e2ca11c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -355,26 +355,18 @@ 
DECLARE_OOXMLEXPORT_TEST(testTdf153613_inlineAfterPgBreak2, "tdf153613_inlineAft
     assertXPath(pLayout, "//page[2]//anchored", 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", "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 are on the second (last) page
+    CPPUNIT_ASSERT_EQUAL(2, getPages());
 
     const auto& pLayout = parseLayoutDump();
-    assertXPathContent(pLayout, "//page[2]/body/txt", "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", 2);
 }
 
 DECLARE_OOXMLEXPORT_TEST(testTdf153964_topMarginAfterBreak14, 
"tdf153964_topMarginAfterBreak14.docx")
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx 
b/writerfilter/source/dmapper/DomainMapper.cxx
index 2d23452c6261..4ca1900ee173 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -3745,14 +3745,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();

Reply via email to