diff options
-rw-r--r-- | sw/qa/extras/rtfexport/data/tdf148578.rtf | 12 | ||||
-rw-r--r-- | sw/qa/extras/rtfexport/rtfexport3.cxx | 21 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapperTableHandler.cxx | 5 |
3 files changed, 34 insertions, 4 deletions
diff --git a/sw/qa/extras/rtfexport/data/tdf148578.rtf b/sw/qa/extras/rtfexport/data/tdf148578.rtf new file mode 100644 index 000000000000..256d63898770 --- /dev/null +++ b/sw/qa/extras/rtfexport/data/tdf148578.rtf @@ -0,0 +1,12 @@ +{\rtf1
+
+\trowd
+\trgaph567
+\cellx1851
+\cellx9206
+\pard\plain\intbl 1000\cell
+\pard\plain\intbl XX_XX_XXX1\cell
+\row
+
+\pard MMMM
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport3.cxx b/sw/qa/extras/rtfexport/rtfexport3.cxx index 55f5a0362174..a79e92814222 100644 --- a/sw/qa/extras/rtfexport/rtfexport3.cxx +++ b/sw/qa/extras/rtfexport/rtfexport3.cxx @@ -514,6 +514,27 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf127806) CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(635), aSize.Width); } +DECLARE_RTFEXPORT_TEST(testTdf148578, "tdf148578.rtf") +{ + // \trgaph567 should affect only table cell margings (~1cm), + // but do not shift table, since \trleft is not provided + uno::Reference<text::XTextTable> xTable(getParagraphOrTable(1), uno::UNO_QUERY); + + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), getProperty<sal_Int32>(xTable, "LeftMargin")); + + uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1000), + getProperty<sal_Int32>(xCell, "LeftBorderDistance")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1000), + getProperty<sal_Int32>(xCell, "RightBorderDistance")); + + xCell.set(xTable->getCellByName("B1"), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1000), + getProperty<sal_Int32>(xCell, "LeftBorderDistance")); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1000), + getProperty<sal_Int32>(xCell, "RightBorderDistance")); +} + DECLARE_RTFEXPORT_TEST(testInvalidParagraphStyle, "invalidParagraphStyle.rtf") { // Given test has character style #30, but referred as paragraph style #30 diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx index 47a2424c298a..58d96a9cd8f5 100644 --- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx +++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx @@ -613,12 +613,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 - - // Undefined should not be possible any more for DOCX, but it is for RTF. - // In any case, continue to treat undefined as version 12 during import. sal_Int32 nMode = m_rDMapper_Impl.GetSettingsTable()->GetWordCompatibilityMode(); - if (((nMode < 0) || (0 < nMode && nMode <= 14)) && rInfo.nNestLevel == 1) + if (0 < nMode && nMode <= 14 && rInfo.nNestLevel == 1) { const sal_Int32 nAdjustedMargin = nLeftMargin - rInfo.nLeftBorderDistance; m_aTableProperties->Insert( PROP_LEFT_MARGIN, uno::Any( nAdjustedMargin ) ); |