summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasily Melenchuk <vasily.melenchuk@cib.de>2019-04-12 09:31:28 +0200
committerVasily Melenchuk <vasily.melenchuk@cib.de>2021-03-04 10:44:24 +0100
commit93b66d0e99c9b601616f5110318eeec3ebac8091 (patch)
tree5fd3291ca000fd7a56d1bdb6fb4eaf1007259bc6
parentfed3ed5828eda88f82d97e95b34dfdd1ca0c9dec (diff)
tdf#124678 DOCX export: always write title page in section props
Even if page description is not set we should try to mark title page because chaining of two page styles can not work for continuous sections. Unittests were implemented previously and were taken from abandoned patch https://gerrit.libreoffice.org/c/core/+/70646 Change-Id: I0b953d72d762f868735dc658f023d96944c9d308 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111757 Tested-by: Jenkins Tested-by: Thorsten Behrens <thorsten.behrens@allotropia.de> Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de> (cherry picked from commit e305289f87ea058cc92ecd83379b848697aa5a80) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111884 Reviewed-by: Vasily Melenchuk <vasily.melenchuk@cib.de>
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf124678_no_leading_paragraph.odtbin0 -> 9122 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf124678_with_leading_paragraph.odtbin0 -> 9164 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport11.cxx21
-rw-r--r--sw/source/filter/ww8/wrtw8sty.cxx6
4 files changed, 24 insertions, 3 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf124678_no_leading_paragraph.odt b/sw/qa/extras/ooxmlexport/data/tdf124678_no_leading_paragraph.odt
new file mode 100644
index 000000000000..a694ff613633
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf124678_no_leading_paragraph.odt
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/data/tdf124678_with_leading_paragraph.odt b/sw/qa/extras/ooxmlexport/data/tdf124678_with_leading_paragraph.odt
new file mode 100644
index 000000000000..cb14c8ea4df3
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf124678_with_leading_paragraph.odt
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index f26d7570d38a..aa29afd218e0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -1395,6 +1395,27 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf101122_noFillForCustomShape, "tdf1011
"a:graphicData/wps:wsp/wps:spPr/a:custGeom/a:pathLst/a:path",
"fill");
}
+// The (tdf124678_no_leading_paragraph.odt, tdf124678_with_leading_paragraph.odt) documents are the same,
+// except:
+// - tdf124678_no_leading_paragraph.odt doesn't contain leading empty paragraph
+// before the first section
+//
+DECLARE_OOXMLEXPORT_TEST(testTdf124678_case1, "tdf124678_no_leading_paragraph.odt")
+{
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("First page header text", OUString(""), parseDump("/root/page[1]/header/txt"));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Second page header text", OUString("HEADER"), parseDump("/root/page[2]/header/txt"));
+}
+
+// The (tdf124678_no_leading_paragraph.odt, tdf124678_with_leading_paragraph.odt) documents are the same,
+// except:
+// - tdf124678_no_leading_paragraph.odt doesn't contain leading empty paragraph
+// before the first section
+//
+DECLARE_OOXMLEXPORT_TEST(testTdf124678_case2, "tdf124678_with_leading_paragraph.odt")
+{
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("First page header text", OUString(""), parseDump("/root/page[1]/header/txt"));
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("Second page header text", OUString("HEADER"), parseDump("/root/page[2]/header/txt"));
+}
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx
index caae58fbb163..282bd90efab9 100644
--- a/sw/source/filter/ww8/wrtw8sty.cxx
+++ b/sw/source/filter/ww8/wrtw8sty.cxx
@@ -1745,9 +1745,6 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt
}
}
- if( titlePage )
- AttrOutput().SectionTitlePage();
-
const SfxItemSet* pOldI = m_pISet;
const SfxPoolItem* pItem;
@@ -1813,6 +1810,9 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt
}
}
+ if (titlePage)
+ AttrOutput().SectionTitlePage();
+
AttrOutput().SectionType( nBreakCode );
if( rSepInfo.pPageDesc ) {