writerfilter/source/dmapper/DomainMapper_Impl.cxx |   76 +++++++++-------------
 1 file changed, 32 insertions(+), 44 deletions(-)

New commits:
commit a777dab7544bd11c26ae26c40cce49ab976dab2d
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Mon Mar 13 11:31:00 2023 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Wed Mar 15 12:39:40 2023 +0000

    tdf#154129 tdf#73546 writerfilter framePr: fix/deduplicate w:v/hSpace
    
    This is not quite a No Functional Change commit.
    
    Now, the difference between the two clauses that I am calling
    deduplicated is rather severe in this case.
    But that seems to be because only one half was fixed with
    4.3 commit 896714db527f39497aedee8946964e5acd73778c
    Author: umeshkadam on Fri Jan 17 19:00:29 2014 +0530
        fdo#73546 : faulty value of attribute value in <wp:anchor> tag
    
    So I expect that the "else" side is simply wrong.
    That side is generally only hit by RTF formatted files
    (or docx that are basically missing styles.xml).
    
    Change-Id: Id0fd4f4807c38f281d2fbf8f805a49d6ae9acc0d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148813
    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 538409dae704..09492826f13f 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1773,6 +1773,38 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
         aFrameProperties.push_back(
             comphelper::makePropertyValue(getPropertyName(PROP_SURROUND), 
nWrap));
 
+        sal_Int32 nRightDist = 0;
+        sal_Int32 nLeftDist = 0;
+        for (const auto pProp : vProps)
+        {
+            if (pProp->GethSpace() < 0)
+                continue;
+            nLeftDist = nRightDist = pProp->GethSpace();
+            break;
+        }
+        aFrameProperties.push_back(comphelper::makePropertyValue(
+            getPropertyName(PROP_LEFT_MARGIN),
+            nHoriOrient == text::HoriOrientation::LEFT ? 0 : nLeftDist));
+        aFrameProperties.push_back(comphelper::makePropertyValue(
+            getPropertyName(PROP_RIGHT_MARGIN),
+            nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nRightDist));
+
+        sal_Int32 nBottomDist = 0;
+        sal_Int32 nTopDist = 0;
+        for (const auto pProp : vProps)
+        {
+            if (pProp->GetvSpace() < 0)
+                continue;
+            nTopDist = nBottomDist = pProp->GetvSpace();
+            break;
+        }
+        aFrameProperties.push_back(comphelper::makePropertyValue(
+            getPropertyName(PROP_TOP_MARGIN),
+            nVertOrient == text::VertOrientation::TOP ? 0 : nTopDist));
+        aFrameProperties.push_back(comphelper::makePropertyValue(
+            getPropertyName(PROP_BOTTOM_MARGIN),
+            nVertOrient == text::VertOrientation::BOTTOM ? 0 : nBottomDist));
+
         if (vProps.size() > 1)
         {
             if (const std::optional<sal_Int16> nDirection = 
PopFrameDirection())
@@ -1780,36 +1812,6 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
                 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_FRM_DIRECTION),
 *nDirection));
             }
 
-
-            /** FDO#73546 : distL & distR should be unsigned integers <Ecma 
20.4.3.6>
-                Swapped the array elements 11,12 & 13,14 since 11 & 12 are
-                LEFT & RIGHT margins and 13,14 are TOP and BOTTOM margins 
respectively.
-            */
-            sal_Int32 nRightDist = 0;
-            sal_Int32 nLeftDist = 0;
-            for (const auto pProp : vProps)
-            {
-                if (pProp->GethSpace() < 0)
-                    continue;
-                nLeftDist = nRightDist = pProp->GethSpace();
-                break;
-            }
-
-            
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_LEFT_MARGIN),
 nHoriOrient == text::HoriOrientation::LEFT ? 0 : nLeftDist));
-            
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_RIGHT_MARGIN),
 nHoriOrient == text::HoriOrientation::RIGHT ? 0 : nRightDist));
-
-            sal_Int32 nBottomDist = 0;
-            sal_Int32 nTopDist = 0;
-            for (const auto pProp : vProps)
-            {
-                if (pProp->GetvSpace() < 0)
-                    continue;
-                nTopDist = nBottomDist = pProp->GetvSpace();
-                break;
-            }
-
-            
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_TOP_MARGIN),
 nVertOrient == text::VertOrientation::TOP ? 0 : nTopDist));
-            
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_BOTTOM_MARGIN),
 nVertOrient == text::VertOrientation::BOTTOM ? 0 : nBottomDist));
             // If there is no fill, the Word default is 100% transparency.
             // Otherwise CellColorHandler has priority, and this setting
             // will be ignored.
@@ -1820,20 +1822,6 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
             }));
             
aFrameProperties.push_back(comphelper::makePropertyValue("FrameInteropGrabBag", 
aGrabBag));
         }
-        else
-        {
-            sal_Int32 nVertDist = 
rAppendContext.pLastParagraphProperties->GethSpace();
-            if( nVertDist < 0 )
-                nVertDist = 0;
-            
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_LEFT_MARGIN),
 nVertOrient == text::VertOrientation::TOP ? 0 : nVertDist));
-            
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_RIGHT_MARGIN),
 nVertOrient == text::VertOrientation::BOTTOM ? 0 : nVertDist));
-
-            sal_Int32 nHoriDist = 
rAppendContext.pLastParagraphProperties->GetvSpace();
-            if( nHoriDist < 0 )
-                nHoriDist = 0;
-            
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));
-        }
 
         lcl_MoveBorderPropertiesToFrame(aFrameProperties,
                                         
rAppendContext.pLastParagraphProperties->GetStartingRange(),

Reply via email to