summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2023-03-13 10:16:02 -0400
committerJustin Luth <jluth@mail.com>2023-03-15 09:50:02 +0000
commit070e62bad980cbe15dfbe9096a5e5d962a70f07c (patch)
tree1bb6327fcef324c62a446d1735d811c0fafbc97f
parent611288b64548762e0731ed6323e1653e4fca2317 (diff)
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 <jluth@mail.com>
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx27
1 files changed, 12 insertions, 15 deletions
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())));