sw/qa/extras/ooxmlexport/ooxmlexport18.cxx        |   11 +++++++++++
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   10 ++++++----
 2 files changed, 17 insertions(+), 4 deletions(-)

New commits:
commit a24d461d736de0a29bb8ef2a20b57db4836cda3e
Author:     Justin Luth <justin.l...@collabora.com>
AuthorDate: Thu Apr 13 10:04:24 2023 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Fri Apr 14 16:55:05 2023 +0200

    tdf#154703 writerfilter framePr: RTF != INVERT_BORDER_SPACING
    
    Change-Id: I839b187f8e5822fb162255595aeeeac36427cb5a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150356
    Reviewed-by: Justin Luth <jl...@mail.com>
    Tested-by: Jenkins

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
index 37008720247f..171826175e0b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx
@@ -205,6 +205,17 @@ DECLARE_OOXMLEXPORT_TEST(testTdf154703_framePr2, 
"tdf154703_framePr2.rtf")
     // framePr frames are always imported as fully transparent
     CPPUNIT_ASSERT_EQUAL(sal_Int16(100), getProperty<sal_Int16>(getShape(1), 
"FillTransparence"));
 
+    // as opposed to testLibreOfficeHang (RTF != INVERT_BORDER_SPACING) do not 
duplicate left/right
+    uno::Reference<text::XTextRange> xTextRange(getShape(1), uno::UNO_QUERY);
+    uno::Reference<text::XText> xText = xTextRange->getText();
+    CPPUNIT_ASSERT_EQUAL(OUString("framePr"), getParagraphOfText(1, 
xText)->getString());
+    sal_Int32 nFrame = getProperty<sal_Int32>(getShape(1), 
"LeftBorderDistance");
+    sal_Int32 nPara = getProperty<sal_Int32>(getParagraphOfText(1, xText), 
"LeftBorderDistance");
+    if (!isExported()) // RTF
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(529), nFrame + nPara);
+    else // DOCX
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(529*2), nFrame + nPara);
+
     if (!isExported())
     {
         // Fill the frame with a red background. It should be transferred on 
export to the paragraph
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 07a475485eca..068347f52347 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1528,7 +1528,8 @@ bool DomainMapper_Impl::isParaSdtEndDeferred() const
 
 static void lcl_MoveBorderPropertiesToFrame(std::vector<beans::PropertyValue>& 
rFrameProperties,
     uno::Reference<text::XTextRange> const& xStartTextRange,
-    uno::Reference<text::XTextRange> const& xEndTextRange )
+    uno::Reference<text::XTextRange> const& xEndTextRange,
+    bool bIsRTFImport)
 {
     try
     {
@@ -1561,10 +1562,10 @@ static void 
lcl_MoveBorderPropertiesToFrame(std::vector<beans::PropertyValue>& r
             aValue.Value = 
xTextRangeProperties->getPropertyValue(sPropertyName);
             if( nProperty < 4 )
                 xTextRangeProperties->setPropertyValue( sPropertyName, 
uno::Any(table::BorderLine2()));
-            else if (nProperty > 5)
+            else if (nProperty > 5 || bIsRTFImport)
             {
+                // left4/right5 need to be duplicated because of 
INVERT_BORDER_SPACING (DOCX only)
                 // Do not duplicate the top6/bottom7 border spacing.
-                // left4/right5 need to be duplicated because of 
INVERT_BORDER_SPACING
                 aValue.Value <<= sal_Int32(0);
             }
             if (aValue.Value.hasValue())
@@ -1841,7 +1842,8 @@ void 
DomainMapper_Impl::CheckUnregisteredFrameConversion(bool bPreventOverlap)
 
     lcl_MoveBorderPropertiesToFrame(aFrameProperties,
                                     
rAppendContext.pLastParagraphProperties->GetStartingRange(),
-                                    
rAppendContext.pLastParagraphProperties->GetEndingRange());
+                                    
rAppendContext.pLastParagraphProperties->GetEndingRange(),
+                                    IsRTFImport());
 
     //frame conversion has to be executed after table conversion, not now
     
RegisterFrameConversion(rAppendContext.pLastParagraphProperties->GetStartingRange(),

Reply via email to