writerfilter/source/dmapper/DomainMapper_Impl.cxx |   30 +++++++++-------------
 1 file changed, 13 insertions(+), 17 deletions(-)

New commits:
commit 1188fa78d0e7b5fd8f4c7c207fd4ec9ced666c12
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Mon Mar 13 10:08:50 2023 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Wed Mar 15 09:48:42 2023 +0000

    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 <jl...@mail.com>

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())));
 

Reply via email to