diff options
author | Satya <skompella@opentext.com> | 2023-06-14 18:15:35 +0530 |
---|---|---|
committer | Justin Luth <jluth@mail.com> | 2023-06-15 23:39:33 +0200 |
commit | d7dd39e124f8a1fa199dd8322b642e8be04ed360 (patch) | |
tree | ae8fb7ba1e41ac6f1599cd24d42a771d6bf49a67 /writerfilter/source/dmapper/DomainMapper_Impl.cxx | |
parent | 02ba31714a5f72495df203833ec9772b380b1b77 (diff) |
tdf#155736 Modified IsInTOC() to handle IsInHeaderFooter() case.
This fixes a problem of page numbers missing in the footer.
The importer might start processing the footer before the
TOC has finished - m_bStartTOC might be true.
In this case we are not actually IsInTOC,and m_bStartTOC
should be ignored and make use of IsInHeaderFooter() and m_bStartTOCHeaderFooter to confirm if the footer/header itself
has TOC.
Change-Id: Ieede9f8e2120556630ba57b9c748935788f3cc9a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153052
Reviewed-by: Justin Luth <jluth@mail.com>
Tested-by: Justin Luth <jluth@mail.com>
Diffstat (limited to 'writerfilter/source/dmapper/DomainMapper_Impl.cxx')
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index f75fbf529c96..8b5cf8b6e049 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -2959,7 +2959,7 @@ void DomainMapper_Impl::appendTextPortion( const OUString& rString, const Proper // If we are in comments, then disable CharGrabBag, comment text doesn't support that. uno::Sequence< beans::PropertyValue > aValues = pPropertyMap->GetPropertyValues(/*bCharGrabBag=*/!m_bIsInComments); - if (m_bStartTOC || m_bStartIndex || m_bStartBibliography) + if (IsInTOC() || m_bStartIndex || m_bStartBibliography) for( auto& rValue : asNonConstRange(aValues) ) { if (rValue.Name == "CharHidden") @@ -3372,6 +3372,14 @@ void DomainMapper_Impl::fillEmptyFrameProperties(std::vector<beans::PropertyValu rFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(aMarginIds[i]), static_cast<sal_Int32>(0))); } +bool DomainMapper_Impl::IsInTOC() const +{ + if (IsInHeaderFooter()) + return m_bStartTOCHeaderFooter; + else + return m_bStartTOC; +} + void DomainMapper_Impl::ConvertHeaderFooterToTextFrame(bool bDynamicHeightTop, bool bDynamicHeightBottom) { while (!m_aHeaderFooterTextAppendStack.empty()) @@ -7063,7 +7071,7 @@ void DomainMapper_Impl::CloseFieldCommand() break; } } - if (m_bStartTOC && (aIt->second.eFieldId == FIELD_PAGEREF) ) + if (IsInTOC() && (aIt->second.eFieldId == FIELD_PAGEREF)) { bCreateField = false; } @@ -7451,7 +7459,7 @@ void DomainMapper_Impl::CloseFieldCommand() break; case FIELD_PAGEREF: case FIELD_REF: - if (xFieldProperties.is() && !m_bStartTOC) + if (xFieldProperties.is() && !IsInTOC()) { bool bPageRef = aIt->second.eFieldId == FIELD_PAGEREF; @@ -8133,9 +8141,9 @@ void DomainMapper_Impl::PopFieldContext() else { xToInsert.set(pContext->GetTC(), uno::UNO_QUERY); - if( !xToInsert.is() && !m_bStartTOC && !m_bStartIndex && !m_bStartBibliography ) + if (!xToInsert.is() && !IsInTOC() && !m_bStartIndex && !m_bStartBibliography) xToInsert = pContext->GetTextField(); - if( xToInsert.is() && !m_bStartTOC && !m_bStartIndex && !m_bStartBibliography) + if (xToInsert.is() && !IsInTOC() && !m_bStartIndex && !m_bStartBibliography) { PropertyMap aMap; // Character properties of the field show up here the @@ -8209,7 +8217,8 @@ void DomainMapper_Impl::PopFieldContext() if (!pContext->GetHyperlinkTarget().isEmpty()) xCrsrProperties->setPropertyValue("HyperLinkTarget", uno::Any(pContext->GetHyperlinkTarget())); - if (m_bStartTOC) { + if (IsInTOC()) + { OUString sDisplayName("Index Link"); xCrsrProperties->setPropertyValue("VisitedCharStyleName",uno::Any(sDisplayName)); xCrsrProperties->setPropertyValue("UnvisitedCharStyleName",uno::Any(sDisplayName)); |