From 13ed75dd3f84d38cce8f46792af560a5090ec180 Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Fri, 4 Jan 2019 19:28:28 +0300 Subject: tdf#122460 ww8export: always export H/F to first section Normally the first section is considered a BreakCode == 2, which guarantees that the headers/footers will attempt to be written. In the cases where it isn't, the very first section definitely needs to include any possible Headers/Footers. This was already done for DOCX via bug 78606 in LO 5.0. Both DOCX and RTF seem to ignore this first aSect, so this change won't affect them. Change-Id: Ie08eedea9202f0922e0e505a92fe4a66ef6c4a24 Reviewed-on: https://gerrit.libreoffice.org/65859 Tested-by: Jenkins Reviewed-by: Justin Luth --- sw/qa/extras/ww8export/data/tdf122460_header.odt | Bin 0 -> 9753 bytes sw/qa/extras/ww8export/ww8export3.cxx | 7 +++++++ sw/source/filter/ww8/wrtw8sty.cxx | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 sw/qa/extras/ww8export/data/tdf122460_header.odt diff --git a/sw/qa/extras/ww8export/data/tdf122460_header.odt b/sw/qa/extras/ww8export/data/tdf122460_header.odt new file mode 100644 index 000000000000..420121dc9a4d Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf122460_header.odt differ diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index ccf79c83e300..60bf801b25ef 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -54,6 +54,13 @@ DECLARE_WW8EXPORT_TEST(testTdf122429_header, "tdf122429_header.doc") CPPUNIT_ASSERT(headerIsOn); } +DECLARE_WW8EXPORT_TEST(testTdf122460_header, "tdf122460_header.odt") +{ + uno::Reference pageStyles = getStyles("PageStyles"); + uno::Reference pageStyle(pageStyles->getByName("Default Style"), uno::UNO_QUERY); + bool headerIsOn = getProperty(pageStyle, "HeaderIsOn"); + CPPUNIT_ASSERT(headerIsOn); +} DECLARE_WW8EXPORT_TEST(testFdo53985, "fdo53985.doc") { diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index b5ee75531701..af39bf4ef063 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -1012,7 +1012,7 @@ MSWordSections::MSWordSections( MSWordExportBase& rExport ) AppendSection( *static_cast(pI), *pNd, pFormat, nRstLnNum ); } else - AppendSection( rExport.m_pCurrentPageDesc, pFormat, nRstLnNum ); + AppendSection( rExport.m_pCurrentPageDesc, pFormat, nRstLnNum, /*bIsFirstParagraph=*/true ); } WW8_WrPlcSepx::WW8_WrPlcSepx( MSWordExportBase& rExport ) -- cgit