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 <vmiklos@collabora.com>
(cherry picked from commit 5d04e2c94c8b3f6c5e75ff4c394ca086de5a6e5a)
Reviewed-on: https://gerrit.libreoffice.org/82223
Reviewed-by: Xisco FaulĂ <xiscofauli@libreoffice.org>
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 0000000..9025ce6
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf126994_lostPageBreak.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
index 8539548..0fc73d0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport13.cxx
@@ -46,6 +46,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 bf8fb46..91be467 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 )