sw/qa/extras/ooxmlexport/data/tdf126994_lostPageBreak.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport13.cxx                 |    5 +++++
 sw/source/filter/ww8/wrtww8.cxx                            |    7 ++++---
 3 files changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 5d04e2c94c8b3f6c5e75ff4c394ca086de5a6e5a
Author:     Justin Luth <justin_l...@sil.org>
AuthorDate: Tue Sep 3 14:14:10 2019 +0300
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Mon Sep 9 16:55:13 2019 +0200

    tdf#126994 ww8 export: Don't skip TOX end node
    
    The section end node processes the section page break,
    so skipping it after the Table Of Contents meant that a
    page break here was lost.
    
    This fix is specifically for DOCX although it could impact
    .doc (which already worked, and still does) and .rtf
    (which probably doesn't work with section end anyway).
    Utlimately, it just calls OutputEndNode() for an end node,
    so it shouldn't cause any difficulties.
    
    Change-Id: Iabc4a734365febb2b3e3bfed7d3c954b4b01da34
    Reviewed-on: https://gerrit.libreoffice.org/78552
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf126994_lostPageBreak.docx 
b/sw/qa/extras/ooxmlexport/data/tdf126994_lostPageBreak.docx
new file mode 100644
index 000000000000..9025ce652ebb
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf126994_lostPageBreak.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index 31abac2a3aa9..b8c9f7a9f15c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -49,6 +49,11 @@ DECLARE_SW_EXPORT_TEST(testFlyInFly, "ooo39250-1-min.rtf", 
nullptr, Test)
     CPPUNIT_ASSERT_EQUAL(OUString("Frame2"), 
uno::Reference<container::XNamed>(xAnchorFrame, 
uno::UNO_QUERY_THROW)->getName());
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf126994_lostPageBreak, 
"tdf126994_lostPageBreak.docx")
+{
+    CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 3, getPages() );
+}
+
 DECLARE_OOXMLEXPORT_TEST(testTdf121374_sectionHF, "tdf121374_sectionHF.odt")
 {
     uno::Reference<beans::XPropertySet> 
xPageStyle(getStyles("PageStyles")->getByName("Standard"), uno::UNO_QUERY);
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 86af33b312fb..42f7b7e4f29f 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -2756,12 +2756,13 @@ void MSWordExportBase::WriteText()
                 ;
             else if ( aIdx.GetNode().IsSectionNode() )
                 ;
-            else if ( !IsInTable()
-                && (rSect.GetType() != TOX_CONTENT_SECTION && rSect.GetType() 
!= TOX_HEADER_SECTION )) //No sections in table
+            else if ( !IsInTable() )    //No sections in table
             {
                 //#120140# Do not need to insert a page/section break after a 
section end. Check this case first
                 bool bNeedExportBreakHere = true;
-                if ( aIdx.GetNode().IsTextNode() )
+                if ( rSect.GetType() == TOX_CONTENT_SECTION || rSect.GetType() 
== TOX_HEADER_SECTION )
+                    bNeedExportBreakHere = false;
+                else if ( aIdx.GetNode().IsTextNode() )
                 {
                     SwTextNode *pTempNext = aIdx.GetNode().GetTextNode();
                     if ( pTempNext )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to