writerfilter/source/dmapper/DomainMapper_Impl.cxx | 27 +++++++++------------- 1 file changed, 12 insertions(+), 15 deletions(-)
New commits: commit 070e62bad980cbe15dfbe9096a5e5d962a70f07c Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Mon Mar 13 10:16:02 2023 -0400 Commit: Justin Luth <jl...@mail.com> CommitDate: Wed Mar 15 09:50:02 2023 +0000 tdf#154129 writerfilter framePr: deduplicate w:hAnchor This is not quite a No Functional Change commit. If there was no anchor specified, and no parent style, then no property was written at all. Basically only RTF format ever has no "parent style", so this should be a rather safe change to make. Change-Id: Ibeecd489deb876c64a2ba6ca2b700e4a03dbd316 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148809 Tested-by: Jenkins Reviewed-by: Justin Luth <jl...@mail.com> diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 48f92e1e6dbb..34442046c706 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1708,6 +1708,18 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( ) aFrameProperties.push_back( comphelper::makePropertyValue(getPropertyName(PROP_HORI_ORIENT), nHoriOrient)); + //Default the anchor in case FramePr_hAnchor is missing ECMA 17.3.1.11 + sal_Int16 nHAnchor = text::RelOrientation::FRAME; // 'text' + for (const auto pProp : vProps) + { + if (pProp->GethAnchor() < 0) + continue; + nHAnchor = pProp->GethAnchor(); + break; + } + aFrameProperties.push_back( + comphelper::makePropertyValue(getPropertyName(PROP_HORI_ORIENT_RELATION), nHAnchor)); + bool bValidY = false; sal_Int32 nY = DEFAULT_VALUE; for (const auto pProp : vProps) @@ -1739,18 +1751,6 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( ) aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_FRM_DIRECTION), *nDirection)); } - //Default the anchor in case FramePr_hAnchor is missing ECMA 17.3.1.11 - sal_Int16 nHAnchor = text::RelOrientation::FRAME; - for (const auto pProp : vProps) - { - if (pProp->GethAnchor() < 0) - continue; - nHAnchor = pProp->GethAnchor(); - break; - } - aFrameProperties.push_back(comphelper::makePropertyValue( - getPropertyName(PROP_HORI_ORIENT_RELATION), nHAnchor)); - //Default the anchor in case FramePr_vAnchor is missing ECMA 17.3.1.11 sal_Int16 nVAnchor = text::RelOrientation::FRAME; // 'text' // vAlign is ignored if vAnchor is set to 'text'. So, if w:y is not defined, @@ -1837,9 +1837,6 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( ) aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_TOP_MARGIN), nHoriOrient == text::HoriOrientation::LEFT ? 0 : nHoriDist)); aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_BOTTOM_MARGIN), nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nHoriDist)); - if( rAppendContext.pLastParagraphProperties->GethAnchor() >= 0 ) - aFrameProperties.push_back(comphelper::makePropertyValue("HoriOrientRelation", sal_Int16(rAppendContext.pLastParagraphProperties->GethAnchor()))); - if( rAppendContext.pLastParagraphProperties->GetvAnchor() >= 0 ) aFrameProperties.push_back(comphelper::makePropertyValue("VertOrientRelation", sal_Int16(rAppendContext.pLastParagraphProperties->GetvAnchor())));