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

Miklos Vajna vmiklos at collabora.co.uk
Tue Jun 7 09:14:57 UTC 2016


 sw/qa/extras/rtfimport/data/tdf50821.rtf        |   10 ++++++++++
 sw/qa/extras/rtfimport/rtfimport.cxx            |    8 ++++++++
 writerfilter/source/rtftok/rtfdispatchvalue.cxx |    4 ++--
 3 files changed, 20 insertions(+), 2 deletions(-)

New commits:
commit 279f1a204f8c5b5121e9f1f9c431d17bdab1f5bd
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Jun 7 09:25:16 2016 +0200

    tdf#50821 RTF import: fix handling of \trpaddf{b,l,r,t}
    
    The width type is an attribute, not an sprm; this resulted in zero cell
    margin in the table -> the text overlapped with the border shape.
    
    Change-Id: I611feb084a16c76faf281d376e1a4a31e162f53d
    Reviewed-on: https://gerrit.libreoffice.org/25997
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sw/qa/extras/rtfimport/data/tdf50821.rtf b/sw/qa/extras/rtfimport/data/tdf50821.rtf
new file mode 100644
index 0000000..03f253d
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/tdf50821.rtf
@@ -0,0 +1,10 @@
+{\rtf1
+\pard\plain
+before\par
+\trowd \trpaddl108\trpaddfl3 \cellx10362\pard\plain\intbl
+table
+\cell\row
+\pard\plain
+end
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 390079c..17445cd 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2626,6 +2626,14 @@ DECLARE_RTFIMPORT_TEST(testTdf77349, "tdf77349.rtf")
     CPPUNIT_ASSERT_EQUAL(OUString("Image1"), xImage->getName());
 }
 
+DECLARE_RTFIMPORT_TEST(testTdf50821, "tdf50821.rtf")
+{
+    uno::Reference<text::XTextTable> xTable(getParagraphOrTable(2), uno::UNO_QUERY);
+    uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
+    // This was 0, \trpaddfl was mishandled on import.
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(191), getProperty<sal_Int32>(xCell, "LeftBorderDistance"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
index 2c75dab..d4a3720 100644
--- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
@@ -1314,8 +1314,8 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
         default:
             break;
         }
-        putNestedSprm(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, std::make_shared<RTFValue>(aAttributes));
-        putNestedSprm(m_aDefaultState.aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, std::make_shared<RTFValue>(aAttributes));
+        putNestedAttribute(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, std::make_shared<RTFValue>(aAttributes));
+        putNestedAttribute(m_aDefaultState.aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, std::make_shared<RTFValue>(aAttributes));
     }
     break;
     case RTF_TRPADDB:


More information about the Libreoffice-commits mailing list