[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - sw/qa sw/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Apr 24 08:54:27 PDT 2015


 sw/qa/extras/rtfexport/data/tdf80708.rtf    |   15 +++++++++++++++
 sw/qa/extras/rtfexport/rtfexport.cxx        |   11 +++++++++++
 sw/source/filter/ww8/rtfattributeoutput.cxx |    2 +-
 3 files changed, 27 insertions(+), 1 deletion(-)

New commits:
commit ffc80d79bf7c209607741cf6211dbe706990fea8
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Apr 20 16:38:32 2015 +0200

    tdf#80708 RTF export: fix unexpected table row break
    
    Regression from commit 1f77a5e8d5bf8a7f1b7bd7206996d2b2efc59462
    (n#203704 fix RTF export table output for subtables, 2012-02-08), the
    problem is that RtfAttributeOutput::StartTableRow() has two callers
    depending on if it's the first or a later row, but the m_bTableRowEnded
    flag storing if that method is called is only set in one case.
    
    Fix the problem by moving the update of the flag to the method itself.
    
    (cherry picked from commit 5e2708a5a8cad3c2f4578742264610abab677395)
    
    Conflicts:
    	sw/qa/extras/rtfexport/rtfexport.cxx
    
    Change-Id: Ieae1fb53f9528fc74d037d2fd783b3979b17cab8
    Reviewed-on: https://gerrit.libreoffice.org/15506
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/qa/extras/rtfexport/data/tdf80708.rtf b/sw/qa/extras/rtfexport/data/tdf80708.rtf
new file mode 100644
index 0000000..30b6174
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf80708.rtf
@@ -0,0 +1,15 @@
+{\rtf1
+\pard\plain
+{first table}
+\par \trowd\trql\trleft-108\ltrrow\trrh-374\trkeep\trpaddft3\trpaddt0\trpaddfl3\trpaddl0\trpaddfb3\trpaddb0\trpaddfr3\trpaddr0\clbrdrl\brdrhair\brdrcf1\cellx296\clbrdrl\brdrhair\brdrcf1\clbrdrr\brdrhair\brdrcf1\cellx702\pard\plain
+{A1}
+\cell\pard\plain \s0\ql
+{A2}
+\cell\row\pard\pard\plain \s42\ql
+{\rtlch \ltrch\loch\lang2067 second table}
+\par \trowd\trql\trleft-108\ltrrow\trrh-561\trkeep\trpaddft3\trpaddt0\trpaddfl3\trpaddl0\trpaddfb3\trpaddb0\trpaddfr3\trpaddr0\clbrdrl\brdrhair\brdrcf1\cellx296\clbrdrl\brdrhair\brdrcf1\clbrdrr\brdrhair\brdrcf1\cellx702\pard\plain \s0\ql
+{A1}
+\cell\pard\plain \s0\ql
+{A2}
+\cell\row\pard\pard\plain\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index bbd969d..2a13b4b 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -18,6 +18,7 @@
 #include <com/sun/star/table/ShadowFormat.hpp>
 #include <com/sun/star/text/FontEmphasis.hpp>
 #include <com/sun/star/text/RelOrientation.hpp>
+#include <com/sun/star/text/TableColumnSeparator.hpp>
 #include <com/sun/star/text/TextContentAnchorType.hpp>
 #include <com/sun/star/text/XFootnotesSupplier.hpp>
 #include <com/sun/star/text/XPageCursor.hpp>
@@ -858,6 +859,16 @@ DECLARE_RTFEXPORT_TEST(testTdf88583, "tdf88583.odt")
     CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x00cc00), getProperty<sal_Int32>(getParagraph(1), "FillColor"));
 }
 
+DECLARE_RTFEXPORT_TEST(testTdf80708, "tdf80708.rtf")
+{
+    uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
+    uno::Reference<text::XTextTable> xTable(xTables->getByIndex(1), uno::UNO_QUERY);
+    uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY);
+    // This was 2, i.e. the second table had 3 cols, now 2 as expected.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators").getLength());
+}
+
 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 84b031a..7071e7b 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -245,7 +245,6 @@ void RtfAttributeOutput::StartParagraph(ww8::WW8TableNodeInfo::Pointer_t pTextNo
             // In case of subtables, we may not get the first cell.
             if (pDeepInner && (pDeepInner->getCell() == 0 || m_bTableRowEnded))
             {
-                m_bTableRowEnded = false;
                 StartTableRow(pDeepInner);
             }
 
@@ -882,6 +881,7 @@ void RtfAttributeOutput::StartTableRow(ww8::WW8TableNodeInfoInner::Pointer_t pTa
 {
     sal_uInt32 nCurrentDepth = pTableTextNodeInfoInner->getDepth();
     SAL_INFO("sw.rtf", OSL_THIS_FUNC << ", (depth is " << nCurrentDepth << ")");
+    m_bTableRowEnded = false;
 
     TableDefinition(pTableTextNodeInfoInner);
 


More information about the Libreoffice-commits mailing list