writerfilter/source/dmapper/DomainMapper_Impl.cxx |   39 ++++++++++------------
 1 file changed, 18 insertions(+), 21 deletions(-)

New commits:
commit 2d331e6bfe8c9ca31f1a4e092dbcffb8919b8655
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Mon Mar 13 10:32:28 2023 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Wed Mar 15 09:51:21 2023 +0000

    tdf#154129 writerfilter framePr: deduplicate w:vAnchor
    
    This is not a No Functional Change commit.
    
    However, it seems that pretty much only RTF
    fails to typically have styles defined,
    since even an unspecified "Normal" style is checked.
    
    That means that in all but the most bizarre cases,
    the "no style" case would never be reached anyway.
    That really eliminates any worries about the deduplication going bad.
    
    In any case, I can't see any reason why the same qualification
    is not made if there is no parent style involved.
    
    make CppunitTest_sw_ooxmlexport5 CPPUNIT_TEST_NAME=testTdf112287
    make CppunitTest_sw_ooxmlexport5 CPPUNIT_TEST_NAME=testTdf112287B
    
    Change-Id: Ied79f83dcd18304ae0d86c0b7843cd36a532ae93
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148810
    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 34442046c706..822746e5f02e 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1744,6 +1744,24 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
         aFrameProperties.push_back(
             comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT), 
nVertOrient));
 
+        //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,
+        // but there is a defined vAlign, then a missing vAnchor should become 
'margin'.
+        if (!bValidY && nVertOrient)
+        {
+            nVAnchor = text::RelOrientation::PAGE_PRINT_AREA; // 'margin'
+        }
+        for (const auto pProp : vProps)
+        {
+            if (pProp->GetvAnchor() < 0)
+                continue;
+            nVAnchor = pProp->GetvAnchor();
+            break;
+        }
+        aFrameProperties.push_back(
+            
comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT_RELATION), 
nVAnchor));
+
         if (vProps.size() > 1)
         {
             if (const std::optional<sal_Int16> nDirection = 
PopFrameDirection())
@@ -1751,24 +1769,6 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion( )
                 
aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_FRM_DIRECTION),
 *nDirection));
             }
 
-            //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,
-            // but there is a defined vAlign, then a missing vAnchor should 
become 'margin'.
-            if (!bValidY && nVertOrient)
-            {
-                nVAnchor = text::RelOrientation::PAGE_PRINT_AREA; // 'margin'
-            }
-            for (const auto pProp : vProps)
-            {
-                if (pProp->GetvAnchor() < 0)
-                    continue;
-                nVAnchor = pProp->GetvAnchor();
-                break;
-            }
-            aFrameProperties.push_back(comphelper::makePropertyValue(
-                getPropertyName(PROP_VERT_ORIENT_RELATION), nVAnchor));
-
             text::WrapTextMode nWrap = text::WrapTextMode_NONE;
             for (const auto pProp : vProps)
             {
@@ -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->GetvAnchor() >= 0 )
-                
aFrameProperties.push_back(comphelper::makePropertyValue("VertOrientRelation", 
sal_Int16(rAppendContext.pLastParagraphProperties->GetvAnchor())));
-
             if( rAppendContext.pLastParagraphProperties->GetWrap() >= 
text::WrapTextMode_NONE )
                 
aFrameProperties.push_back(comphelper::makePropertyValue("Surround", 
rAppendContext.pLastParagraphProperties->GetWrap()));
 

Reply via email to