summaryrefslogtreecommitdiff
path: root/writerfilter/source/dmapper/DomainMapper_Impl.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2024-02-05 10:38:06 +0100
committerMiklos Vajna <vmiklos@collabora.com>2024-02-05 12:36:44 +0100
commitd918beda2ab42668014b0dd42996b6ccc97e8c3a (patch)
treecaf41debedf8d50d3c90df7255222a13e406e702 /writerfilter/source/dmapper/DomainMapper_Impl.cxx
parent1ae7a81e542c9b072e519d0ea0d4773ed26ca251 (diff)
tdf#158814 DOCX import: fix unwanted header with type="first" & no titlePg
The bugdoc had no header in Word, but had one in Writer, since commit 17e51f427b3f0cec74ac8e0a1b3f51189006ae6f (DOCX import: first page header should always set default headers as well, 2014-11-21). The code has changed a log in the meantime, today we import first page headers and left/right page headers as a single page style, but still code was missing to detect the case when <w:headerReference w:type="first"> was not followed by <w:titlePg>, which is an indicator that the first page header/footer should be used. Fix the problem by new flags to SectionPropertyMap to track if we ever seen a first/left/right header. This allows making an informed decision in SectionPropertyMap::setHeaderFooterProperties(): if the header is on, but we effectively don't have none of a first, left or right header, then it's time to turn it off, similar to what the DOC import does. Note that this only changes behavior for headers, but if there is a practical need, then the same could be also done for footers as well. Instead of adding a new test, notice that testTdf112694 in CppunitTest_sw_core_header_footer explicitly tests this case: a first header which is not a title page. So change that testcase to assert the behavior now matches Word and drop the FIXME. Change-Id: Ib604e786d7a5a197d4b562533326206697de882a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162992 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'writerfilter/source/dmapper/DomainMapper_Impl.cxx')
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index c5f0b4ddcf16..af14dffa8cc5 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3814,7 +3814,10 @@ void DomainMapper_Impl::PushPageHeaderFooter(PagePartType ePagePartType, PageTyp
if (eType == PageType::LEFT)
{
if (bHeader)
+ {
pSectionContext->m_bLeftHeader = true;
+ pSectionContext->m_bHadLeftHeader = true;
+ }
else
pSectionContext->m_bLeftFooter = true;
@@ -3823,7 +3826,10 @@ void DomainMapper_Impl::PushPageHeaderFooter(PagePartType ePagePartType, PageTyp
else if (eType == PageType::FIRST)
{
if (bHeader)
+ {
pSectionContext->m_bFirstHeader = true;
+ pSectionContext->m_bHadFirstHeader = true;
+ }
else
pSectionContext->m_bFirstFooter = true;
@@ -3832,7 +3838,10 @@ void DomainMapper_Impl::PushPageHeaderFooter(PagePartType ePagePartType, PageTyp
else
{
if (bHeader)
+ {
pSectionContext->m_bRightHeader = true;
+ pSectionContext->m_bHadRightHeader = true;
+ }
else
pSectionContext->m_bRightFooter = true;