summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2019-11-04 08:14:41 +0300
committerMiklos Vajna <vmiklos@collabora.com>2019-11-07 12:42:05 +0100
commit4ea43e887498f9d78f70b40bcdc53865057a78c0 (patch)
tree0fbc006789fddd31936c0a59798c77fe5516783c
parent4e10d47db52f4171cb62ec75dd6fd8901d7d7152 (diff)
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 <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf125778_lostPageBreakTOX.docxbin0 -> 18696 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport13.cxx5
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx6
3 files changed, 8 insertions, 3 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf125778_lostPageBreakTOX.docx
Binary files 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<container::XNamed>(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;