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

New commits:
commit 36db0b44905a7c4cf4ceccf47948d2785e79935f
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Thu Dec 22 17:50:46 2022 -0500
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Fri Dec 23 12:30:40 2022 +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>

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 b3a3a46dbb4e..a145a3054a4e 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -170,6 +170,13 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf152636_lostPageBreak)
     CPPUNIT_ASSERT_EQUAL(2, getPages());
 }
 
+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 a0a2a70e06c5..efd2c230465f 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1623,12 +1623,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