sw/qa/extras/ooxmlexport/data/tdf152636_lostPageBreak2.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx                  |    6 ++++++
 sw/source/filter/ww8/wrtw8sty.cxx                           |   11 +++++++----
 3 files changed, 13 insertions(+), 4 deletions(-)

New commits:
commit 8079fc1cc94383b3345b6dfce8346e8c1f1c60fa
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Thu Dec 22 17:50:46 2022 -0500
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Tue Jan 3 12:40:56 2023 +0000

    tdf#152636 writerfilter: handle breakcode on table page break
    
    We always have to handle two situations when dealing with
    page breaks - paragraphs and tables.
    
    Change-Id: Ie0347d70f9529ca2e846c4a5041e76da9bd03e30
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144778
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144823
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf152636_lostPageBreak2.docx 
b/sw/qa/extras/ooxmlexport/data/tdf152636_lostPageBreak2.docx
new file mode 100644
index 000000000000..255bf795a5e2
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf152636_lostPageBreak2.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index a77e2ec98ca4..03d02ff7b725 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -63,6 +63,12 @@ CPPUNIT_TEST_FIXTURE(Test, testInlineSdtHeader)
     loadAndSave("inline-sdt-header.docx");
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf152636_lostPageBreak2)
+{
+    loadAndReload("tdf152636_lostPageBreak2.docx");
+    CPPUNIT_ASSERT_EQUAL(2, getPages());
+}
+
 CPPUNIT_TEST_FIXTURE(Test, testSdtDuplicatedId)
 {
     // Given a document with 2 inline <w:sdt>, with each a <w:id>:
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx 
b/sw/source/filter/ww8/wrtw8sty.cxx
index cfce4172ce86..a36de19cbb2f 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1648,12 +1648,15 @@ void MSWordExportBase::SectionProperties( const 
WW8_SepInfo& rSepInfo, WW8_PdAtt
         //  0xfff -> Section terminated
         nBreakCode = 0;         // consecutive section
 
-        if ( rSepInfo.pPDNd && rSepInfo.pPDNd->IsContentNode() )
+        if (rSepInfo.pPDNd && (rSepInfo.pPDNd->IsContentNode() || 
rSepInfo.pPDNd->IsTableNode()))
         {
-            if ( !NoPageBreakSection( 
&rSepInfo.pPDNd->GetContentNode()->GetSwAttrSet() ) )
-            {
+            const SfxItemSet* pSet
+                = rSepInfo.pPDNd->IsContentNode()
+                      ? &rSepInfo.pPDNd->GetContentNode()->GetSwAttrSet()
+                      : 
&rSepInfo.pPDNd->GetTableNode()->GetTable().GetFrameFormat()->GetAttrSet();
+
+            if (!NoPageBreakSection(pSet))
                 nBreakCode = 2;
-            }
         }
 
         if ( reinterpret_cast<SwSectionFormat*>(sal_IntPtr(-1)) == 
rSepInfo.pSectionFormat )

Reply via email to