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

Miklos Vajna vmiklos at collabora.co.uk
Thu Aug 28 07:36:02 PDT 2014


 sw/qa/extras/rtfimport/data/fdo74229.rtf       |   33 +++++++++++++++++++++++++
 sw/qa/extras/rtfimport/rtfimport.cxx           |   10 +++++++
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   11 ++++++++
 3 files changed, 54 insertions(+)

New commits:
commit 54bdfe0a891f2119bc35c5d82ecbc94c8cb13c0b
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Aug 28 15:45:21 2014 +0200

    fdo#74229 import RTF_TRGAPH
    
    Regression from commit c4b91ae3178011c66c76c711c1a6469ba658872e
    (fdo#55525 import RTF_TRLEFT, 2012-11-13).
    
    Change-Id: I90f2c6399cfaf8399de0cf3488a23af6cc84710d

diff --git a/sw/qa/extras/rtfimport/data/fdo74229.rtf b/sw/qa/extras/rtfimport/data/fdo74229.rtf
new file mode 100644
index 0000000..f425f08
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo74229.rtf
@@ -0,0 +1,33 @@
+{\rtf1\ansi\ansicpg1252\uc1\deff0\deflang1036
+{\fonttbl
+{\f1\fmodern\fprq1\fcharset0 Courier new;}
+}
+{\colortbl;
+\red0\green0\blue0;
+\red0\green0\blue255;
+\red0\green255\blue255;
+\red0\green255\blue0;
+\red255\green0\blue255;
+\red255\green0\blue0;
+\red255\green255\blue0;
+\red255\green255\blue255;
+\red0\green0\blue128;
+\red0\green128\blue128;
+\red0\green128\blue0;
+\red128\green0\blue128;
+\red128\green0\blue0;
+\red128\green128\blue0;
+\red128\green128\blue128;
+\red192\green192\blue192;
+}
+\pard
+\trowd\trkeep\trql\trgaph67
+\clbrdrb\brdrs\brdrw10\brdrcf1\cltxlrtb\clvertalt\clcbpat8\cellx731
+\clbrdrb\brdrs\brdrw10\brdrcf1\cltxlrtb\clvertalt\clcbpat8\cellx1462
+\pard\plain\intbl\b\sb67\sa67\qc\f1\fs16\cf1
+{A1\cell}
+\pard\plain\intbl\sb67\sa67\qr\f1\fs16\cf1
+{A2\cell}
+{\row}
+\pard\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index ba3b581..2231e1f 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1918,6 +1918,16 @@ DECLARE_RTFIMPORT_TEST(testPictureWrapPolygon, "picture-wrap-polygon.rtf")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(-67)), getProperty<sal_Int32>(getShape(1), "VertOrientPosition"));
 }
 
+DECLARE_RTFIMPORT_TEST(testFdo74229, "fdo74229.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<text::XTextRange> xCell(xTable->getCellByName("A1"), uno::UNO_QUERY);
+    // This was 0, due to ignoring RTF_TRGAPH.
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(67)), getProperty<sal_Int32>(xCell, "RightBorderDistance"));
+}
+
 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 4fe164e..d0f88ec 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -4544,6 +4544,17 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
     case RTF_OUTLINELEVEL:
         m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_outlineLvl, pIntValue);
         break;
+    case RTF_TRGAPH:
+        // Half of the space between the cells of a table row: default left/right table cell margin.
+        if (nParam > 0)
+        {
+            RTFSprms aAttributes;
+            aAttributes.set(NS_ooxml::LN_CT_TblWidth_type, RTFValue::Pointer_t(new RTFValue(NS_ooxml::LN_Value_ST_TblWidth_dxa)));
+            aAttributes.set(NS_ooxml::LN_CT_TblWidth_w, pIntValue);
+            lcl_putNestedSprm(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblCellMar, NS_ooxml::LN_CT_TblCellMar_left, RTFValue::Pointer_t(new RTFValue(aAttributes)));
+            lcl_putNestedSprm(m_aStates.top().aTableRowSprms, NS_ooxml::LN_CT_TblPrBase_tblCellMar, NS_ooxml::LN_CT_TblCellMar_right, RTFValue::Pointer_t(new RTFValue(aAttributes)));
+        }
+        break;
     default:
     {
         SAL_INFO("writerfilter", "TODO handle value '" << lcl_RtfToString(nKeyword) << "'");


More information about the Libreoffice-commits mailing list