sw/qa/extras/ooxmlexport/data/tdf168598.docx                |binary
 sw/qa/extras/ooxmlexport/ooxmlexport23.cxx                  |    9 +++++++++
 sw/source/writerfilter/dmapper/DomainMapperTableHandler.cxx |    3 ++-
 3 files changed, 11 insertions(+), 1 deletion(-)

New commits:
commit bd61271f10181fe6540264273753551779d4ac8a
Author:     Aron Budea <[email protected]>
AuthorDate: Mon Sep 29 14:59:18 2025 +0930
Commit:     Xisco Fauli <[email protected]>
CommitDate: Mon Sep 29 16:38:52 2025 +0200

    tdf#168598 Fix for tdf#148578 should only apply to RTF
    
    It also affected DOCX files witch compatibilityMode
    not specified.
    
    Regression from 788cc6ff3b186ceb8f265e53b5482f808f6536f4
    
    Change-Id: I1368066800ce4e6f4caa1131b1b6cf3590d8b1c1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191587
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>
    Reviewed-by: Aron Budea <[email protected]>
    (cherry picked from commit a80d7ba9c01c8c5c95bf01960d969b82dc7edffc)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191625
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf168598.docx 
b/sw/qa/extras/ooxmlexport/data/tdf168598.docx
new file mode 100644
index 000000000000..f889bd1ea734
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf168598.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport23.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport23.cxx
index 8d0376204e49..3ea202f33aa0 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport23.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport23.cxx
@@ -892,6 +892,15 @@ CPPUNIT_TEST_FIXTURE(Test, testVmlLineShapeRotated)
                 u"36.05pt,300.55pt");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testTdf168598, "tdf168598.docx")
+{
+    uno::Reference<text::XTextTable> xTable(getParagraphOrTable(2), 
uno::UNO_QUERY);
+
+    // Without the fix in place this would be -302
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-501),
+                         getProperty<sal_Int32>(xTable, "LeftMargin"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/writerfilter/dmapper/DomainMapperTableHandler.cxx 
b/sw/source/writerfilter/dmapper/DomainMapperTableHandler.cxx
index 74c25f9ad9ea..b1cb9c5ae5e9 100644
--- a/sw/source/writerfilter/dmapper/DomainMapperTableHandler.cxx
+++ b/sw/source/writerfilter/dmapper/DomainMapperTableHandler.cxx
@@ -599,8 +599,9 @@ TableStyleSheetEntry * 
DomainMapperTableHandler::endTableGetTableStyle(TableInfo
 
         // tdf#106742: since MS Word 2013 (compatibilityMode >= 15), top-level 
tables are handled the same as nested tables;
         // the default behavior when DOCX doesn't define "compatibilityMode" 
option is to add the cell spacing
+        // but not for RTF
 
-        if (0 < nMode && nMode <= 14 && rInfo.nNestLevel == 1)
+        if (m_rDMapper_Impl.IsOOXMLImport() && (nMode < 0 || (0 < nMode && 
nMode <= 14)) && rInfo.nNestLevel == 1)
         {
             const sal_Int32 nAdjustedMargin = nLeftMargin - 
rInfo.nLeftBorderDistance;
             m_aTableProperties->Insert( PROP_LEFT_MARGIN, uno::Any( 
nAdjustedMargin ) );

Reply via email to