From 4ea43e887498f9d78f70b40bcdc53865057a78c0 Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Mon, 4 Nov 2019 08:14:41 +0300 Subject: tdf#125778 docxexport: handle pageBreak before TOX The pagebreak before the TOX was lost in docx (but not in .doc or .rtf). Change-Id: I280b0bd19a73db180b65a0937bd0fe809e5dfc6f Reviewed-on: https://gerrit.libreoffice.org/81979 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna --- .../ooxmlexport/data/tdf125778_lostPageBreakTOX.docx | Bin 0 -> 18696 bytes sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 5 +++++ sw/source/filter/ww8/wrtw8nds.cxx | 6 +++--- 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 sw/qa/extras/ooxmlexport/data/tdf125778_lostPageBreakTOX.docx diff --git a/sw/qa/extras/ooxmlexport/data/tdf125778_lostPageBreakTOX.docx b/sw/qa/extras/ooxmlexport/data/tdf125778_lostPageBreakTOX.docx new file mode 100644 index 000000000000..dd5d323e5778 Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf125778_lostPageBreakTOX.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx index 0be5f82136ed..49184bd1ade4 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx @@ -50,6 +50,11 @@ DECLARE_SW_EXPORT_TEST(testFlyInFly, "ooo39250-1-min.rtf", nullptr, Test) CPPUNIT_ASSERT_EQUAL(OUString("Frame2"), uno::Reference(xAnchorFrame, uno::UNO_QUERY_THROW)->getName()); } +DECLARE_OOXMLEXPORT_TEST(testTdf125778_lostPageBreakTOX, "tdf125778_lostPageBreakTOX.docx") +{ + CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 3, getPages() ); +} + DECLARE_OOXMLEXPORT_TEST(testTdf126994_lostPageBreak, "tdf126994_lostPageBreak.docx") { CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of Pages", 3, getPages() ); diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index bd73cc4ab542..6fe0624e0305 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -3100,8 +3100,7 @@ void MSWordExportBase::OutputSectionNode( const SwSectionNode& rSectionNode ) SwNodeIndex aIdx( rSectionNode, 1 ); const SwNode& rNd = aIdx.GetNode(); - if ( !rNd.IsSectionNode() && !IsInTable() - && rSection.GetType() != TOX_CONTENT_SECTION && rSection.GetType() != TOX_HEADER_SECTION) //No sections in table + if ( !rNd.IsSectionNode() && !IsInTable() ) //No sections in table { // if the first Node inside the section has an own // PageDesc or PageBreak attribute, then don't write @@ -3121,7 +3120,8 @@ void MSWordExportBase::OutputSectionNode( const SwSectionNode& rSectionNode ) else AttrOutput().SectionBreaks( rSectionNode ); - if ( !pSet ) + const bool bInTOX = rSection.GetType() == TOX_CONTENT_SECTION || rSection.GetType() == TOX_HEADER_SECTION; + if ( !pSet && !bInTOX ) { // new Section with no own PageDesc/-Break // -> write follow section break; -- cgit