sw/source/writerfilter/dmapper/DomainMapper.cxx | 3 +- sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx | 28 +++++++++---------- sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx | 6 ++-- sw/source/writerfilter/dmapper/PropertyMap.hxx | 4 ++ 4 files changed, 22 insertions(+), 19 deletions(-)
New commits: commit 13c16ba3fd69db24cd8ac4a656bbaeaa706431e8 Author: Noel Grandin <[email protected]> AuthorDate: Tue Feb 24 20:26:12 2026 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Wed Feb 25 09:11:52 2026 +0100 use more concrete type in TableParagraph Change-Id: I758822bd78339449cdcd0a7090080946f75418ea Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200225 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/sw/source/writerfilter/dmapper/DomainMapper.cxx b/sw/source/writerfilter/dmapper/DomainMapper.cxx index 261a5c0f10bb..2cf85379ac9c 100644 --- a/sw/source/writerfilter/dmapper/DomainMapper.cxx +++ b/sw/source/writerfilter/dmapper/DomainMapper.cxx @@ -5421,7 +5421,8 @@ void DomainMapper::finishParagraph(const bool bRemove, const bool bNoNumbering) { if (m_pImpl->m_pSdtHelper->getControlType() == SdtControlType::datePicker) m_pImpl->m_pSdtHelper->createDateContentControl(); - m_pImpl->finishParagraph(m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH), bRemove, bNoNumbering); + auto pParaContext = static_cast<ParagraphPropertyMap*>(m_pImpl->GetTopContextOfType(CONTEXT_PARAGRAPH).get()); + m_pImpl->finishParagraph(pParaContext, bRemove, bNoNumbering); if (bRemove || mbIsLastPara) m_pImpl->RemoveLastParagraph(); mbIsLastPara = false; // handle other subdocuments diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx index de5f47d5926e..cc33d3c82b15 100644 --- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx +++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx @@ -2152,7 +2152,7 @@ static sal_Int32 lcl_getListId(const StyleSheetEntryPtr& rEntry, const StyleShee /// 9 indicates that numbering should be at body level (aka disabled) - rarely used by MSWord. /// 0-8 are the nine valid numbering levels. sal_Int16 DomainMapper_Impl::GetListLevel(const StyleSheetEntryPtr& pEntry, - const PropertyMapPtr& pParaContext) + const ParagraphPropertyMapPtr& pParaContext) { sal_Int16 nListLevel = -1; if (pParaContext) @@ -2225,7 +2225,7 @@ void DomainMapper_Impl::ValidateListLevel(const OUString& sStyleIdentifierD) } } -void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, const bool bRemove, const bool bNoNumbering ) +void DomainMapper_Impl::finishParagraph( const ParagraphPropertyMapPtr& pParaContext, const bool bRemove, const bool bNoNumbering ) { if (m_bDiscardHeaderFooter) return; @@ -2248,7 +2248,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con if (pFieldContext->GetFieldId() == FIELD_IF || pFieldContext->GetFieldId() == FIELD_REF) { // Conditional text fields can't contain newlines, finish the paragraph later. - FieldParagraph aFinish{pPropertyMap, bRemove}; + FieldParagraph aFinish{pParaContext, bRemove}; pFieldContext->GetParagraphsToFinish().push_back(aFinish); return; } @@ -2259,7 +2259,6 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con TagLogger::getInstance().startElement("finishParagraph"); #endif - ParagraphPropertyMap* pParaContext = dynamic_cast< ParagraphPropertyMap* >( pPropertyMap.get() ); if (m_aTextAppendStack.empty()) return; TextAppendContext& rAppendContext = m_aTextAppendStack.top(); @@ -2406,7 +2405,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con // apply INHERITED autospacing only if top margin is not set if ( bIsAutoSet || bNoTopmargin ) { - GetAnyProperty(PROP_PARA_TOP_MARGIN_BEFORE_AUTO_SPACING, pPropertyMap) >>= nBeforeAutospacing; + GetAnyProperty(PROP_PARA_TOP_MARGIN_BEFORE_AUTO_SPACING, pParaContext.get()) >>= nBeforeAutospacing; // tdf#137655 only w:beforeAutospacing=0 was specified, but not PARA_TOP_MARGIN // (see default_spacing = -1 in processing of LN_CT_Spacing_beforeAutospacing) if (bNoTopmargin && nBeforeAutospacing == convertTwipToMm100(-1)) @@ -2442,7 +2441,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con bool bAppliedBottomAutospacing = false; if (bIsAutoSet || bNoBottomMargin) { - GetAnyProperty(PROP_PARA_BOTTOM_MARGIN_AFTER_AUTO_SPACING, pPropertyMap) >>= nAfterAutospacing; + GetAnyProperty(PROP_PARA_BOTTOM_MARGIN_AFTER_AUTO_SPACING, pParaContext.get()) >>= nAfterAutospacing; if (bNoBottomMargin && nAfterAutospacing == convertTwipToMm100(-1)) { sal_Int32 nStyleAuto = -1; @@ -2482,7 +2481,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con // The paragraph style is vital to knowing all the frame properties. std::optional<PropertyMap::Property> aParaStyle - = pPropertyMap->getProperty(PROP_PARA_STYLE_NAME); + = pParaContext->getProperty(PROP_PARA_STYLE_NAME); if (aParaStyle) { OUString sName; @@ -2666,11 +2665,11 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con lcl_AddRange(pToBeSavedProperties, xTextAppend, rAppendContext); } } - applyToggleAttributes(pPropertyMap); // for paragraph marker formatting + applyToggleAttributes(pParaContext.get()); // for paragraph marker formatting std::vector<beans::PropertyValue> aProperties; - if (pPropertyMap) + if (pParaContext) { - aProperties = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(pPropertyMap->GetPropertyValues()); + aProperties = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(pParaContext->GetPropertyValues()); // tdf#64222 filter out the "paragraph marker" formatting and // set it as a separate paragraph property, not a empty hint at @@ -2937,7 +2936,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con } } - sal_Int16 nCurrentLevel = GetListLevel(pEntry, pPropertyMap); + sal_Int16 nCurrentLevel = GetListLevel(pEntry, pParaContext); if (nCurrentLevel == -1) nCurrentLevel = 0; @@ -3211,7 +3210,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con xParaProps->setPropertyValue(u"ParaLeftMargin"_ustr, aMargin); else if (isNumberingViaStyle) { - const sal_Int32 nParaLeftMargin = getNumberingProperty(nListId, GetListLevel(pEntry, pPropertyMap), u"IndentAt"_ustr); + const sal_Int32 nParaLeftMargin = getNumberingProperty(nListId, GetListLevel(pEntry, pParaContext), u"IndentAt"_ustr); if (nParaLeftMargin != 0) xParaProps->setPropertyValue(u"ParaLeftMargin"_ustr, uno::Any(nParaLeftMargin)); } @@ -3229,7 +3228,7 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con xParaProps->setPropertyValue(u"ParaFirstLineIndent"_ustr, aMargin); else if (isNumberingViaStyle) { - const sal_Int32 nFirstLineIndent = getNumberingProperty(nListId, GetListLevel(pEntry, pPropertyMap), u"FirstLineIndent"_ustr); + const sal_Int32 nFirstLineIndent = getNumberingProperty(nListId, GetListLevel(pEntry, pParaContext), u"FirstLineIndent"_ustr); if (nFirstLineIndent != 0) xParaProps->setPropertyValue(u"ParaFirstLineIndent"_ustr, uno::Any(nFirstLineIndent)); } @@ -7279,7 +7278,8 @@ DomainMapper_Impl::StartIndexSectionChecked(std::u16string_view sServiceName) { if (m_StreamStateStack.top().bParaChanged) { - finishParagraph(GetTopContextOfType(CONTEXT_PARAGRAPH), false); // resets bParaChanged + auto pParaContext = static_cast<ParagraphPropertyMap*>(GetTopContextOfType(CONTEXT_PARAGRAPH).get()); + finishParagraph(pParaContext, false); // resets bParaChanged PopProperties(CONTEXT_PARAGRAPH); PushProperties(CONTEXT_PARAGRAPH); SetIsFirstRun(true); diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx b/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx index 26aca1fbbe02..08c0b5e0f465 100644 --- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx +++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.hxx @@ -283,7 +283,7 @@ struct SubstreamContext /// Information about a paragraph to be finished after a field end. struct FieldParagraph { - PropertyMapPtr m_pPropertyMap; + ParagraphPropertyMapPtr m_pPropertyMap; bool m_bRemove = false; }; @@ -828,7 +828,7 @@ public: void setParaSdtEndDeferred(bool bParaSdtEndDeferred); bool isParaSdtEndDeferred() const; - void finishParagraph( const PropertyMapPtr& pPropertyMap, const bool bRemove = false, const bool bNoNumbering = false); + void finishParagraph( const ParagraphPropertyMapPtr& pPropertyMap, const bool bRemove = false, const bool bNoNumbering = false); void applyToggleAttributes( const PropertyMapPtr& pPropertyMap ); void MergeAtContentImageRedlineWithNext(const css::uno::Reference<css::text::XTextAppend>& xTextAppend); void appendTextPortion( const OUString& rString, const PropertyMapPtr& pPropertyMap ); @@ -1150,7 +1150,7 @@ public: SectionPropertyMap * GetSectionContext(); - sal_Int16 GetListLevel(const StyleSheetEntryPtr& pEntry, const PropertyMapPtr& pParaContext = nullptr); + sal_Int16 GetListLevel(const StyleSheetEntryPtr& pEntry, const ParagraphPropertyMapPtr& pParaContext = nullptr); void ValidateListLevel(const OUString& sStyleIdentifierD); /** diff --git a/sw/source/writerfilter/dmapper/PropertyMap.hxx b/sw/source/writerfilter/dmapper/PropertyMap.hxx index e9df9a187288..9e7a881e6f1f 100644 --- a/sw/source/writerfilter/dmapper/PropertyMap.hxx +++ b/sw/source/writerfilter/dmapper/PropertyMap.hxx @@ -604,6 +604,8 @@ public: explicit ParagraphPropertyMap() {} }; +typedef tools::SvRef< ParagraphPropertyMap > ParagraphPropertyMapPtr; + class TablePropertyMap : public PropertyMap { @@ -653,7 +655,7 @@ struct TableParagraph { rtl::Reference<SwXTextCursor> m_rStartParagraph; rtl::Reference<SwXTextCursor> m_rEndParagraph; - PropertyMapPtr m_pPropertyMap; + ParagraphPropertyMapPtr m_pPropertyMap; css::uno::Reference<css::beans::XPropertySet> m_rPropertySet; };
