summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-08-28 15:45:21 +0200
committerAndras Timar <andras.timar@collabora.com>2015-01-24 15:19:38 +0100
commitf23c0e1633fb39e78a3a498ce86492c82d7fa7a0 (patch)
tree5159befa97b7b47f09d2a820bbdd7dabd12b8c38
parentb51b904b511dc3456446f4c4f62902da379198e4 (diff)
fdo#74229 import RTF_TRGAPH
Regression from commit c4b91ae3178011c66c76c711c1a6469ba658872e (fdo#55525 import RTF_TRLEFT, 2012-11-13). Change-Id: I90f2c6399cfaf8399de0cf3488a23af6cc84710d (cherry picked from commit 54bdfe0a891f2119bc35c5d82ecbc94c8cb13c0b)
-rw-r--r--sw/qa/extras/rtfimport/data/fdo74229.rtf33
-rw-r--r--sw/qa/extras/rtfimport/rtfimport.cxx10
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx11
3 files changed, 54 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfimport/data/fdo74229.rtf b/sw/qa/extras/rtfimport/data/fdo74229.rtf
new file mode 100644
index 000000000000..f425f0847a1a
--- /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 e2b9030aabf2..f0f64fdcc649 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -2086,6 +2086,16 @@ DECLARE_RTFIMPORT_TEST(testFdo86750, "fdo86750.rtf")
CPPUNIT_ASSERT_EQUAL(OUString("#anchor"), getProperty<OUString>(getRun(getParagraph(1), 1), "HyperLinkURL"));
}
+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 447493cfeacf..1a40e06591c4 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -4617,6 +4617,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) << "'");