diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2024-02-20 11:54:13 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2024-02-20 22:28:57 +0100 |
commit | 340f8ea4ae7f11b4d3a95499188a29fe801867cf (patch) | |
tree | 0d23e932df937606965c930ffe4b2dae64c4e1ed /writerfilter/source/dmapper/DomainMapper_Impl.cxx | |
parent | 27894455857eab436a7676de370a5bb897509f29 (diff) |
tdf#153196 writerfilter: fix page style for even/odd section break
This is a bit of a special case, where the first section starts with an
evenPage break (\sbkeven), which causes a Left-only page style to be
created.
In completeCopyHeaderFooter(), the HeaderTextFirst and FooterTextFirst
are copied from the source style to the Left-only page style, but then
they also need to be deleted from the source style, because the
Left-only page style is the one that is used for the first page of the
section, and the source style is used for the subsequent pages.
Additionally, when there is *only* a "first" header/footer, and no
previous section has one to inherit, Word will not display a
header/footer at all on subsequent pages; a PageStyle will always have a
header/footer if it has a HeaderTextFirst/FooterTextFirst.
In this case, delete the header/footer from the source style.
Unfortunately exporting this doesn't work ideally, a spurious evenPage
footer will be created, both due to the FooterShare being automatically
reset for no obvious reason in ItemSetToPageDesc(), and
setProperty("FooterIsShared", true) "stashing" the left footer since
commit b802ab694a8a7357d4657f3e11b571144fa7c7bf.
(presumably regression from commit b32881b6723072c8d1a652ea147d12e75766d504)
Change-Id: Ie4f9c49605df690e9705e14777c0e4bcb0dfad8e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163668
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'writerfilter/source/dmapper/DomainMapper_Impl.cxx')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 73287b929f0c..d5c6d553ea11 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -3902,6 +3902,11 @@ void DomainMapper_Impl::prepareHeaderFooterContent(uno::Reference<beans::XProper m_aHeaderFooterTextAppendStack.push(std::make_pair(TextAppendContext(xTextAppend, xTextCursor), ePagePartType)); } +bool DomainMapper_Impl::SeenHeaderFooter(PagePartType const partType, PageType const pageType) const +{ + return m_HeaderFooterSeen.find({partType, pageType}) != m_HeaderFooterSeen.end(); +} + /** Checks if the header and footer content on the text appended stack is empty. */ void DomainMapper_Impl::checkIfHeaderFooterIsEmpty(PagePartType ePagePartType, PageType eType) @@ -3960,7 +3965,10 @@ void DomainMapper_Impl::PopPageHeaderFooter(PagePartType ePagePartType, PageType // content is not copied from the previous section SectionPropertyMap* pSectionContext = GetSectionContext(); if (pSectionContext) + { pSectionContext->clearHeaderFooterLinkToPrevious(ePagePartType, eType); + m_HeaderFooterSeen.emplace(ePagePartType, eType); + } if (!m_aTextAppendStack.empty()) { |