sw/qa/extras/ww8export/data/tdf104704_mangledFooter.odt |binary
 sw/qa/extras/ww8export/ww8export4.cxx                   |    5 +++++
 sw/source/filter/ww8/ww8atr.cxx                         |    5 +++--
 3 files changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 641e8be6cd60bbb4117eb7f127b125be05ba4e21
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Wed May 31 15:33:24 2023 -0400
Commit:     Xisco Fauli <xiscofa...@libreoffice.org>
CommitDate: Thu Jun 1 09:23:04 2023 +0200

    tdf#104704 tdf#145998 doc/rtf import: don't lose section page break
    
    This fixes a LO 7.5 regression from
    commit c37f62b71fa59917ef85ff98480dff18aa936e41
    
    That 7.5 fix focused on DOCX, and didn't realize that the doc/rtf path
    couldn't handle the same logic.
    
    Just reverting to previous behaviour for DOC/RTF for now.
    (It is too hard to find relevant documents because any document
    starting with a section break on the first paragraph
    [and there are MANY of these - an ODT default],
    and that scenario harmlessly matches this code path.)
    
    Change-Id: I82cfe10e217269448d38df0ca03ce6cae3536e56
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152470
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/sw/qa/extras/ww8export/data/tdf104704_mangledFooter.odt 
b/sw/qa/extras/ww8export/data/tdf104704_mangledFooter.odt
new file mode 100644
index 000000000000..2bd8c10f9ca4
Binary files /dev/null and 
b/sw/qa/extras/ww8export/data/tdf104704_mangledFooter.odt differ
diff --git a/sw/qa/extras/ww8export/ww8export4.cxx 
b/sw/qa/extras/ww8export/ww8export4.cxx
index cd4410e3cb2e..efb198ebae00 100644
--- a/sw/qa/extras/ww8export/ww8export4.cxx
+++ b/sw/qa/extras/ww8export/ww8export4.cxx
@@ -73,6 +73,11 @@ DECLARE_WW8EXPORT_TEST(testTdf155465_paraAdjustDistribute, 
"tdf155465_paraAdjust
     CPPUNIT_ASSERT_EQUAL(style::ParagraphAdjust_LEFT, 
static_cast<style::ParagraphAdjust>(nAdjust));
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf104704_mangledFooter, 
"tdf104704_mangledFooter.odt")
+{
+    CPPUNIT_ASSERT_EQUAL(2, getPages());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index ff3d057d3042..0d48eb55bba6 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -525,8 +525,9 @@ void MSWordExportBase::OutputSectionBreaks( const 
SfxItemSet *pSet, const SwNode
             // sections during import, so minimize unnecessary duplication
             // by substituting a simple page break when the resulting section 
is identical,
             // unless this is needed to re-number the page.
-            if (!bNewPageDesc && !pItem->GetNumOffset() && m_pCurrentPageDesc
-                && m_pCurrentPageDesc->GetFollow() == pItem->GetPageDesc())
+            // DOCX only.
+            if (!bNewPageDesc && !pItem->GetNumOffset() && 
!PreferPageBreakBefore()
+                && m_pCurrentPageDesc && m_pCurrentPageDesc->GetFollow() == 
pItem->GetPageDesc())
             {
                 // A section break on the very first paragraph is ignored by 
LO/Word
                 // and should NOT be turned into a page break.

Reply via email to