sw/qa/extras/rtfimport/rtfimport.cxx               |    7 +++++++
 sw/source/writerfilter/rtftok/rtfdispatchvalue.cxx |    6 ++++++
 2 files changed, 13 insertions(+)

New commits:
commit 0e0ae62ded3f72768bc06e38253dacbf5af0ed5a
Author:     Oliver Specht <oliver.spe...@cib.de>
AuthorDate: Tue Jan 28 14:16:07 2025 +0100
Commit:     Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
CommitDate: Tue Feb 11 21:26:30 2025 +0100

    tdf#164266 RTF: border distance in style is not applied to table
    
    Attributes from styles are only valid if they are repeated at the
    location where the style is applied.
    
    Change-Id: I0083b833266346084d51aaf78a162b96012a0dab
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180835
    Reviewed-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>
    Tested-by: Jenkins
    Tested-by: Gabor Kelemen <gabor.kelemen.ext...@allotropia.de>

diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index 515fae3c4a5c..54315245036d 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1958,6 +1958,13 @@ CPPUNIT_TEST_FIXTURE(Test, test162198Tdf)
     sal_Int32 nRightDistance = getProperty<sal_Int32>(xCellPropSet, 
u"LeftBorderDistance"_ustr);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("left cell spacing to contents", 
sal_Int32(9), nLeftDistance);
     CPPUNIT_ASSERT_EQUAL_MESSAGE("right cell spacing to contents", 
sal_Int32(9), nRightDistance);
+
+    xCell = xTable1->getCellByName(u"B1"_ustr);
+    xCellPropSet = uno::Reference<beans::XPropertySet>(xCell, 
uno::UNO_QUERY_THROW);
+    nLeftDistance = getProperty<sal_Int32>(xCellPropSet, 
u"LeftBorderDistance"_ustr);
+    nRightDistance = getProperty<sal_Int32>(xCellPropSet, 
u"LeftBorderDistance"_ustr);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("left cell spacing to contents", 
sal_Int32(9), nLeftDistance);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("right cell spacing to contents", 
sal_Int32(9), nRightDistance);
 }
 
 CPPUNIT_TEST_FIXTURE(Test, test153192Tdf)
diff --git a/sw/source/writerfilter/rtftok/rtfdispatchvalue.cxx 
b/sw/source/writerfilter/rtftok/rtfdispatchvalue.cxx
index 85ad1613a5dd..d89c3420017a 100644
--- a/sw/source/writerfilter/rtftok/rtfdispatchvalue.cxx
+++ b/sw/source/writerfilter/rtftok/rtfdispatchvalue.cxx
@@ -665,6 +665,12 @@ bool RTFDocumentImpl::dispatchTableValue(RTFKeyword 
nKeyword, int nParam)
         case RTFKeyword::TRPADDR:
         case RTFKeyword::TRPADDT:
         {
+            // tdf#162198 prevent adding attributes to rows/cells from style 
without
+            // being repeated at the cell/row level
+            // this might be required for other attributes, too
+            if (m_aStates.top().getDestination() == Destination::STYLEENTRY)
+                return true;
+
             RTFSprms aAttributes;
             aAttributes.set(NS_ooxml::LN_CT_TblWidth_w, new RTFValue(nParam));
             switch (nKeyword)

Reply via email to