sw/qa/extras/rtfexport/data/tdf153681.odt   |binary
 sw/qa/extras/rtfexport/rtfexport5.cxx       |   16 ++++++++++++++++
 sw/source/filter/ww8/rtfattributeoutput.cxx |    4 ----
 3 files changed, 16 insertions(+), 4 deletions(-)

New commits:
commit 6ddffa9841a20b7fddd3f742c88dba7d51cf9114
Author:     Czeber László Ádám <czeber.laszloa...@nisz.hu>
AuthorDate: Mon Feb 27 13:31:33 2023 +0100
Commit:     László Németh <nem...@numbertext.org>
CommitDate: Tue Feb 28 17:44:30 2023 +0000

    tdf#153681 RTF export: fix extra cell regression at nested tables
    
    Table rows exported with an extra empty cell, if there was a
    nested table in them (and not in the last cell).
    
    Partial revert of commit 1f77a5e8d5bf8a7f1b7bd7206996d2b2efc59462
    "n#203704 fix RTF export table output for subtables".
    
    Note: the partially reverted code was for the old table format
    (used before OOo 2.3). This old format is partially converted to the
    new table format since commit e366c928819c44b5c253c45dca6dae40b71c9808
    "sw: ODF import: convert the simplest sub-tables to rowspan tables".
    
    Change-Id: I63ebefbb99e1a95cd60ce8d8dc34c307573d4b58
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147887
    Reviewed-by: László Németh <nem...@numbertext.org>
    Tested-by: László Németh <nem...@numbertext.org>

diff --git a/sw/qa/extras/rtfexport/data/tdf153681.odt 
b/sw/qa/extras/rtfexport/data/tdf153681.odt
new file mode 100644
index 000000000000..2e2e71740de0
Binary files /dev/null and b/sw/qa/extras/rtfexport/data/tdf153681.odt differ
diff --git a/sw/qa/extras/rtfexport/rtfexport5.cxx 
b/sw/qa/extras/rtfexport/rtfexport5.cxx
index 21952ba2f647..5cb27bf74894 100644
--- a/sw/qa/extras/rtfexport/rtfexport5.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport5.cxx
@@ -1461,6 +1461,22 @@ DECLARE_RTFEXPORT_TEST(testTdf104390, "tdf104390.rtf")
     CPPUNIT_ASSERT_MESSAGE("Extra elements in paragraph", 
!xRunEnum->hasMoreElements());
 }
 
+DECLARE_RTFEXPORT_TEST(testTdf153681, "tdf153681.odt")
+{
+    uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, 
uno::UNO_QUERY_THROW);
+    uno::Reference<container::XIndexAccess> 
xTables(xTablesSupplier->getTextTables(),
+                                                    uno::UNO_QUERY_THROW);
+
+    // This is outside table
+    uno::Reference<text::XTextTable> xTable(xTables->getByIndex(1), 
uno::UNO_QUERY_THROW);
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: 2
+    // - Actual  : 3
+    // Generates extra cell
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getRows()->getCount());
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xTable->getColumns()->getCount());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx 
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 1b03e94d0a7c..0175fd5d15b5 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -1076,10 +1076,6 @@ void RtfAttributeOutput::EndTableRow()
 {
     SAL_INFO("sw.rtf", __func__ << ", (depth is " << m_nTableDepth << ")");
 
-    // Trying to end the row without writing the required number of cells? 
Fill with empty ones.
-    for (sal_uInt32 i = 0; i < m_aCells[m_nTableDepth]; i++)
-        m_aAfterRuns.append(OOO_STRING_SVTOOLS_RTF_CELL);
-
     if (m_nTableDepth > 1)
     {
         m_aAfterRuns.append(

Reply via email to