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

New commits:
commit 1c04b7f1564555b0c73e52314311a4c000f94e42
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: Fri Feb 14 08:04:48 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>
    (cherry picked from commit 0e0ae62ded3f72768bc06e38253dacbf5af0ed5a)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181460
    Tested-by: allotropia jenkins <jenk...@allotropia.de>

diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index ea232b0e000a..df70124eeddd 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1971,6 +1971,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);
 }
 
 // tests should only be added to rtfIMPORT *if* they fail round-tripping in 
rtfEXPORT
diff --git a/sw/source/writerfilter/rtftok/rtfdispatchvalue.cxx 
b/sw/source/writerfilter/rtftok/rtfdispatchvalue.cxx
index e1791b5dd48f..8f536e2bc588 100644
--- a/sw/source/writerfilter/rtftok/rtfdispatchvalue.cxx
+++ b/sw/source/writerfilter/rtftok/rtfdispatchvalue.cxx
@@ -664,6 +664,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