sw/qa/extras/ooxmlexport/data/tdf146491.odt |binary sw/qa/extras/ooxmlexport/ooxmlexport5.cxx | 11 ++++++++++- sw/source/filter/ww8/wrtw8sty.cxx | 7 ++----- 3 files changed, 12 insertions(+), 6 deletions(-)
New commits: commit 42e7dc75363ee7f326f7f9e2b4476e55300f1f7a Author: Justin Luth <[email protected]> AuthorDate: Thu Jan 6 13:05:34 2022 +0200 Commit: Justin Luth <[email protected]> CommitDate: Thu Jan 6 15:14:35 2022 +0100 tdf146491 Revert "tdf121374 ooxmlexport: export H/F to def... ...default section" This reverts LO 6.3 commit e6f5dec3250b4d26bc4bb485fad2100ee29a3528. Something else must have changed because it doesn't seem to be needed anymore. It wouldn't be terrible to duplicate headers/footers unnecessarily, One side effect is that page styles could be duplicated multiple times if there were many non-overlapping sections. If the H/F contained images, that could bloat the filesize, or in this specific bug, it was duplicating fields. Since it doesn't appear to be necessary anymore, let's just revert it. Change-Id: Id95a4f162fb2ecbf6ce0f97db056071db9ebad3d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128041 Tested-by: Jenkins Reviewed-by: Justin Luth <[email protected]> diff --git a/sw/qa/extras/ooxmlexport/data/tdf146491.odt b/sw/qa/extras/ooxmlexport/data/tdf146491.odt new file mode 100644 index 000000000000..2ee08f1d3e9b Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf146491.odt differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index d46344fe53cf..ef128fb59eef 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -1289,7 +1289,16 @@ DECLARE_OOXMLEXPORT_TEST(testSectionHeader, "sectionprot.odt") if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) { // this test must not be zero - assertXPath(pXmlDoc, "//w:headerReference", 2); + assertXPath(pXmlDoc, "//w:headerReference", 1); + } +} + +DECLARE_OOXMLEXPORT_TEST(testTdf146491, "tdf146491.odt") +{ + if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml")) + { + // This was 12 - a page style was unnecessarily created for every section. + assertXPath(pXmlDoc, "//w:footerReference", 1); } } diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 4f121ccd7cd9..e64f16f0ea97 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -1639,7 +1639,6 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt */ sal_uInt8 nBreakCode = 2; // default start new page bool bOutPgDscSet = true, bLeftRightPgChain = false, bOutputStyleItemSet = false; - bool bEnsureHeaderFooterWritten = rSepInfo.pSectionFormat && rSepInfo.bIsFirstParagraph; const SwFrameFormat* pPdFormat = &pPd->GetMaster(); bool bUsePrevSectionNextStyle = false; if ( rSepInfo.pSectionFormat ) @@ -1657,9 +1656,7 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt } } - if ( reinterpret_cast<SwSectionFormat*>(sal_IntPtr(-1)) == rSepInfo.pSectionFormat ) - bEnsureHeaderFooterWritten |= !rSepInfo.pPDNd && GetExportFormat() != ExportFormat::RTF; - else + if (reinterpret_cast<SwSectionFormat*>(sal_IntPtr(-1)) != rSepInfo.pSectionFormat) { if ( nBreakCode == 0 ) bOutPgDscSet = false; @@ -1893,7 +1890,7 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt } // Ensure that headers are written if section is first paragraph - if ( nBreakCode != 0 || bEnsureHeaderFooterWritten ) + if (nBreakCode != 0 || (rSepInfo.pSectionFormat && rSepInfo.bIsFirstParagraph)) { if ( titlePage ) {
