[Libreoffice-commits] core.git: sw/qa writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Mar 14 02:56:07 PDT 2014


 sw/qa/extras/rtfimport/data/fdo69289.rtf       |    6 ++++++
 sw/qa/extras/rtfimport/rtfimport.cxx           |   10 ++++++++++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |    3 +++
 3 files changed, 19 insertions(+)

New commits:
commit 3e2cda224e4119b31d85263ff16a383e693dcbbd
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Mar 14 10:50:25 2014 +0100

    fdo#69289 RTF import: handle cells with zero width
    
    Change-Id: I31b12a5afa5d501d57b56f515ee1d2fd46a09b32

diff --git a/sw/qa/extras/rtfimport/data/fdo69289.rtf b/sw/qa/extras/rtfimport/data/fdo69289.rtf
new file mode 100644
index 0000000..96054a9
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo69289.rtf
@@ -0,0 +1,6 @@
+{\rtf\ansi
+{
+\trowd\trgaph30\trleft-30\trrh256\clvertalb\cellx1280\clvertalb\cellx1280\clvertalb\cellx2560\pard\plain\intbl
+\ql a\cell\ql b\cell\ql c\cell\row
+}
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 6010c7c..5965aae 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1518,6 +1518,16 @@ DECLARE_RTFIMPORT_TEST(testCharColor, "char-color.rtf")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0x365F91), getProperty<sal_Int32>(getParagraph(1), "CharColor"));
 }
 
+DECLARE_RTFIMPORT_TEST(testFdo69289, "fdo69289.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(0), uno::UNO_QUERY);
+    uno::Reference<table::XTableRows> xTableRows(xTable->getRows(), uno::UNO_QUERY);
+    // There were only 2 cells (1 separators) in the table, should be 3 (2 separators).
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators").getLength());
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index cdb77b5..1f9306e 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3510,6 +3510,9 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
                                     ? m_nNestedCurrentCellX
                                     : m_nTopLevelCurrentCellX);
                 int nCellX = nParam - rCurrentCellX;
+                const int COL_DFLT_WIDTH = 41; // sw/source/filter/inc/wrtswtbl.hxx, minimal possible width of cells.
+                if (!nCellX)
+                    nCellX = COL_DFLT_WIDTH;
 
                 // If there is a negative left margin, then the first cellx is relative to that.
                 RTFValue::Pointer_t pTblInd = m_aStates.top().aTableRowSprms.find(NS_ooxml::LN_CT_TblPrBase_tblInd);


More information about the Libreoffice-commits mailing list