sw/qa/extras/ooxmlexport/data/tdf159207_footerFramePrBorder.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport21.cxx                       |   18 
++++++++++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx                |    4 ++
 3 files changed, 22 insertions(+)

New commits:
commit 05e637b36043fac83265bbdfbdba97632a8e939e
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Sat Jan 20 19:54:54 2024 -0500
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Mon Jan 22 19:18:48 2024 +0100

    tdf#154703 writerfilter framePr: avoid unexpected frame borders
    
    This fixes my regressive 7.6 commit
    31ea6305b6a763ee48f639562313d9bd109a2923
    
    The text's first border checked (the left one) returned void
    because the property SetState was DONTCARE.
    Then it SETS the text's left border to be nothing
    (I presume to remove the border from the paragraph since
    it is moving it onto frame).
    Well, apparently that act of setting one border sets all of them
    (which makes sense since it would be one box item,
    and once the box item exists, it has a definition for each border).
    
    Therefore on the the next steps of the for loop,
    the remaining borders will exist (as nothing)
    and be dutifully moved to the frame.
    
    Apparently the default for a frame is a box with DEFINED borders,
    so omitting the moving of a nothing border resulted in a stray edge.
    
    make CppunitTest_sw_ooxmlexport21 \
        CPPUNIT_TEST_NAME=testTdf159207_footerFramePrBorder
    
    Change-Id: I217d02678b368f70643be91c4466927b4ca53988
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162409
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf159207_footerFramePrBorder.docx 
b/sw/qa/extras/ooxmlexport/data/tdf159207_footerFramePrBorder.docx
new file mode 100644
index 000000000000..7a4c54cc5c75
Binary files /dev/null and 
b/sw/qa/extras/ooxmlexport/data/tdf159207_footerFramePrBorder.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index e079a0f588a4..c912046c0bb7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -52,6 +52,24 @@ DECLARE_OOXMLEXPORT_TEST(testTdf153909_followTextFlow, 
"tdf153909_followTextFlow
     CPPUNIT_ASSERT(nTableLeft > nRectLeft);
 }
 
+CPPUNIT_TEST_FIXTURE(Test, testTdf159207_footerFramePrBorder)
+{
+    loadFromFile(u"tdf159207_footerFramePrBorder.docx"); // re-imports as 
editeng Frame/Shape
+
+    // given a doc with footer paragraphs frame (with a top border, but no 
left border)
+    uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, 
uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> 
xIndexAccess(xTextFramesSupplier->getTextFrames(),
+                                                         uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xFrame0(xIndexAccess->getByIndex(0), 
uno::UNO_QUERY);
+    auto aBorder = getProperty<table::BorderLine2>(xFrame0, "LeftBorder");
+    sal_uInt32 nBorderWidth
+        = aBorder.OuterLineWidth + aBorder.InnerLineWidth + 
aBorder.LineDistance;
+    // Without patch it failed with Expected 0, Actual 26
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Left border:", static_cast<sal_uInt32>(0), 
nBorderWidth);
+
+    // TODO: there SHOULD BE a top border, and even if loaded, it would be 
lost on re-import...
+}
+
 } // end of anonymous namespace
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index e92b5c9e76d6..b50fc74c86af 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1729,7 +1729,11 @@ static void 
lcl_MoveBorderPropertiesToFrame(std::vector<beans::PropertyValue>& r
             aValue.Name = sPropertyName;
             aValue.Value = 
xTextRangeProperties->getPropertyValue(sPropertyName);
             if( nProperty < 4 )
+            {
                 xTextRangeProperties->setPropertyValue( sPropertyName, 
uno::Any(table::BorderLine2()));
+                if (!aValue.Value.hasValue())
+                    aValue.Value <<= table::BorderLine2();
+            }
             else // border spacing
             {
                 sal_Int32 nDistance = 0;

Reply via email to