diff options
author | Justin Luth <justin_luth@sil.org> | 2019-09-03 14:14:10 +0300 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-09-09 16:55:13 +0200 |
commit | 5d04e2c94c8b3f6c5e75ff4c394ca086de5a6e5a (patch) | |
tree | 2599458eaef260d6acf927893f992e75ce7a44f2 | |
parent | b32ac08a12380228202c396fba36d8ecd85252da (diff) |
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>
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf126994_lostPageBreak.docx | bin | 0 -> 17107 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport13.cxx | 5 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 7 |
3 files changed, 9 insertions, 3 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf126994_lostPageBreak.docx b/sw/qa/extras/ooxmlexport/data/tdf126994_lostPageBreak.docx Binary files differnew file mode 100644 index 000000000000..9025ce652ebb --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf126994_lostPageBreak.docx 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 ) |