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 <jluth@mail.com>
This commit is contained in:
parent
a073b61339
commit
671290e805
5 changed files with 2 additions and 39 deletions
|
@ -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
|
||||
|
|
Binary file not shown.
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue