dev/null |binary sw/qa/core/header_footer/HeaderFooterTest.cxx | 13 ------------- sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx | 10 ---------- sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx | 12 ------------ sw/source/writerfilter/dmapper/PropertyMap.cxx | 6 ++---- 5 files changed, 2 insertions(+), 39 deletions(-)
New commits: commit 671290e8054366997e512572b2e4e38efbf95f80 Author: Justin Luth <[email protected]> AuthorDate: Mon Jul 15 14:33:32 2024 -0400 Commit: Justin Luth <[email protected]> CommitDate: Tue Jul 16 13:48:19 2024 +0200 Revert "tdf#159013 writerfilter: link to the correct first-page header" This reverts commit 25.2 358ac0da827f908ce312c6d392a3d9102f36428e. which was backported to 24.8 Although this patch made the situation "better than it was" for most cases, it will inevitably make some documents worse. Ultimately, this approach is wrong. See tdf#158977's 158977_linkNonEmptyFirst.docx. We can't only copy from the styles that "express" a H/F (and UNO doesn't let us copy from styles that hide it). A COPY appropach would need to ALWAYS import every header/footer into a dedicated "header/footer repository" page style, and every page style would need to copy its "expressed" headers/footers from the repository to its page style. That would mean our copy procedure would need to be very robust, and all of this is way too big for a bug-fixer like me to consider. I don't want to be the one on the hook expected to fix it properly. Change-Id: I2af4a03a219daabf186473839ba444ff9797ec2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170530 Tested-by: Jenkins Reviewed-by: Justin Luth <[email protected]> diff --git a/sw/qa/core/header_footer/HeaderFooterTest.cxx b/sw/qa/core/header_footer/HeaderFooterTest.cxx index 763012652c7c..acfd77f1270e 100644 --- a/sw/qa/core/header_footer/HeaderFooterTest.cxx +++ b/sw/qa/core/header_footer/HeaderFooterTest.cxx @@ -525,19 +525,6 @@ CPPUNIT_TEST_FIXTURE(HeaderFooterTest, testTdf145998_firstHeader) CPPUNIT_ASSERT_EQUAL(u"Normal Header"_ustr, parseDump("/root/page[2]/header/txt"_ostr)); } -CPPUNIT_TEST_FIXTURE(HeaderFooterTest, testTdf1159013_firstHeaderCopy) -{ - // given a document with a first-header-section, a non-first-section, then a first-link-section - createSwDoc("tdf1159013_firstHeaderCopy.docx"); - saveAndReload(u"Office Open XML Text"_ustr); - - // Sanity check - always good to test when dealing with page styles and breaks. - CPPUNIT_ASSERT_EQUAL(5, getPages()); - - // This was copying the non-first-section header instead of "linking" to the first - CPPUNIT_ASSERT_EQUAL(u"First Page header"_ustr, parseDump("/root/page[5]/header/txt"_ostr)); -} - CPPUNIT_TEST_FIXTURE(HeaderFooterTest, testEvenPageOddPageFooter_Import) { // Related tdf#135216 diff --git a/sw/qa/core/header_footer/data/tdf1159013_firstHeaderCopy.docx b/sw/qa/core/header_footer/data/tdf1159013_firstHeaderCopy.docx deleted file mode 100644 index fa2c84cbe4cd..000000000000 Binary files a/sw/qa/core/header_footer/data/tdf1159013_firstHeaderCopy.docx and /dev/null differ diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx index 5e01071bfa62..a6bbf5302f89 100644 --- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx +++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx @@ -3993,16 +3993,6 @@ void DomainMapper_Impl::PopPageHeaderFooter(PagePartType ePagePartType, PageType if (pSectionContext) { pSectionContext->clearHeaderFooterLinkToPrevious(ePagePartType, eType); - - // remember most recent "first page" header/footer so follow sections can "link" to them - if (eType == PageType::FIRST) - { - if (ePagePartType == PagePartType::Header) - m_pLastFirstHeader = pSectionContext->GetPageStyle(*this); - else if (ePagePartType == PagePartType::Footer) - m_pLastFirstFooter = pSectionContext->GetPageStyle(*this); - } - m_HeaderFooterSeen.emplace(ePagePartType, eType); } diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx b/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx index 86df252b8ff9..9ab2e6f789f8 100644 --- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx +++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx @@ -617,8 +617,6 @@ private: PropertyMapPtr m_pTopContext; tools::SvRef<SectionPropertyMap> m_pLastSectionContext; - rtl::Reference<SwXPageStyle> m_pLastFirstHeader; // last page style with different first header - rtl::Reference<SwXPageStyle> m_pLastFirstFooter; // last page style with different first footer PropertyMapPtr m_pLastCharacterContext; ::std::vector<DeletableTabStop> m_aCurrentTabStops; @@ -718,16 +716,6 @@ public: return m_pLastSectionContext.get( ); } - const rtl::Reference<SwXPageStyle>& GetLastFirstHeader() const - { - return m_pLastFirstHeader; - } - - const rtl::Reference<SwXPageStyle>& GetLastFirstFooter() const - { - return m_pLastFirstFooter; - } - css::uno::Reference<css::container::XNameContainer> const & GetPageStyles(); OUString GetUnusedPageStyleName(); css::uno::Reference<css::container::XNameContainer> const & GetCharacterStyles(); diff --git a/sw/source/writerfilter/dmapper/PropertyMap.cxx b/sw/source/writerfilter/dmapper/PropertyMap.cxx index 76e195eeb486..ea840aa6b536 100644 --- a/sw/source/writerfilter/dmapper/PropertyMap.cxx +++ b/sw/source/writerfilter/dmapper/PropertyMap.cxx @@ -1064,8 +1064,7 @@ void copyHeaderFooter(const DomainMapper_Impl& rDM_Impl, if (bCopyLeftHeader && bEvenAndOdd) copyHeaderFooterTextProperty(xPreviousStyle, xStyle, PROP_HEADER_TEXT_LEFT); if (bCopyFirstHeader && bTitlePage) - copyHeaderFooterTextProperty(rDM_Impl.GetLastFirstHeader(), xStyle, - PROP_HEADER_TEXT_FIRST); + copyHeaderFooterTextProperty(xPreviousStyle, xStyle, PROP_HEADER_TEXT_FIRST); } if (bPreviousHasFooter && bCopyFooter) @@ -1075,8 +1074,7 @@ void copyHeaderFooter(const DomainMapper_Impl& rDM_Impl, if (bCopyLeftFooter && bEvenAndOdd) copyHeaderFooterTextProperty(xPreviousStyle, xStyle, PROP_FOOTER_TEXT_LEFT); if (bCopyFirstFooter && bTitlePage) - copyHeaderFooterTextProperty(rDM_Impl.GetLastFirstFooter(), xStyle, - PROP_FOOTER_TEXT_FIRST); + copyHeaderFooterTextProperty(xPreviousStyle, xStyle, PROP_FOOTER_TEXT_FIRST); } xStyle->setPropertyValue(sHeaderIsOn, uno::Any(bPreviousHasHeader || bHasHeader));
