diff options
author | Justin Luth <justin.luth@collabora.com> | 2023-03-13 10:08:50 -0400 |
---|---|---|
committer | Justin Luth <jluth@mail.com> | 2023-03-15 09:48:42 +0000 |
commit | 1188fa78d0e7b5fd8f4c7c207fd4ec9ced666c12 (patch) | |
tree | 55136dddb522a3f8b8420be776515310c431c404 | |
parent | f2a10d9e751bdbc4ba981b6ca9d0dc127439a3c2 (diff) |
tdf#154129 writerfilter framePr: deduplicate w:x
This is not quite a No Functional Change commit.
In the previous code, a zero value for X was not added as a property
if there was no parent style.
Basically only RTF format ever has no "parent style",
so this should be a rather safe change to make.
I've done the same thing for others as well.
Change-Id: Iaf4eb45b3adae88622fa9be16b5237db101a631e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148807
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index adbb436b9fec..624a2da20b30 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -1684,6 +1684,19 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( ) aFrameProperties.push_back( comphelper::makePropertyValue(getPropertyName(PROP_SIZE_TYPE), nhRule)); + bool bValidX = false; + sal_Int32 nX = DEFAULT_VALUE; + for (const auto pProp : vProps) + { + bValidX = pProp->IsxValid(); + if (!bValidX) + continue; + nX = pProp->Getx(); + break; + } + aFrameProperties.push_back( + comphelper::makePropertyValue(getPropertyName(PROP_HORI_ORIENT_POSITION), nX)); + sal_Int16 nHoriOrient = text::HoriOrientation::NONE; for (const auto pProp : vProps) { @@ -1713,20 +1726,6 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( ) aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_FRM_DIRECTION), *nDirection)); } - //set a non negative default value - bool bValidX = false; - sal_Int32 nX = DEFAULT_VALUE; - for (const auto pProp : vProps) - { - bValidX = pProp->IsxValid(); - if (!bValidX) - continue; - nX = pProp->Getx(); - break; - } - aFrameProperties.push_back( - comphelper::makePropertyValue(getPropertyName(PROP_HORI_ORIENT_POSITION), nX)); - //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) @@ -1839,9 +1838,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->IsxValid() ) - aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_HORI_ORIENT_POSITION), rAppendContext.pLastParagraphProperties->Getx())); - if( rAppendContext.pLastParagraphProperties->GethAnchor() >= 0 ) aFrameProperties.push_back(comphelper::makePropertyValue("HoriOrientRelation", sal_Int16(rAppendContext.pLastParagraphProperties->GethAnchor()))); |