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 <jluth@mail.com>
diff --git a/sw/qa/extras/ooxmlexport/data/tdf146491.odt b/sw/qa/extras/ooxmlexport/data/tdf146491.odt
new file mode 100644
index 0000000..2ee08f1d
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf146491.odt
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx
index d46344f..ef128fb 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 4f121cc..e64f16f 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 )
        {