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

New commits:
commit b4fc18e1ff073a7b4fe65c8b92cbf47655a11460
Author:     Aron Budea <[email protected]>
AuthorDate: Mon Sep 29 14:59:18 2025 +0930
Commit:     Thorsten Behrens <[email protected]>
CommitDate: Wed Nov 12 03:41:07 2025 +0100

    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]>
    (cherry picked from commit bd61271f10181fe6540264273753551779d4ac8a)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193790
    Tested-by: Thorsten Behrens <[email protected]>
    Reviewed-by: Thorsten Behrens <[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/ooxmlexport21.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
index 2b28a7663c87..e83b6a546bf4 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport21.cxx
@@ -327,6 +327,15 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf162370)
     loadAndSave("too_many_styles.odt");
 }
 
+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"));
+}
+
 } // end of anonymous namespace
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx 
b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 1a25f2c856aa..f8ebe82e1fee 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -598,8 +598,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