summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-02-10 09:39:16 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-02-18 13:01:31 +0000
commit7ade6edccb3f697d53a05b42b2b8dc6d026de88b (patch)
tree927f529aaf35b19c2b463e5ceb63ae1602e08dc0
parent91995b930f7d35771154a439fb77d27236115d79 (diff)
fdo#74709 RTF import: implement RTF_CLPAD*
(cherry picked from commit 6b5ef795ed4a56195bf09633b03e88474f0b133c) Conflicts: sw/qa/extras/rtfexport/rtfexport.cxx Change-Id: I482735e3fc4091be983b2c7484e086f5d0dd283a Reviewed-on: https://gerrit.libreoffice.org/8056 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--sw/qa/extras/rtfexport/data/fdo74709.rtf32
-rw-r--r--sw/qa/extras/rtfexport/rtfexport.cxx7
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx28
3 files changed, 67 insertions, 0 deletions
diff --git a/sw/qa/extras/rtfexport/data/fdo74709.rtf b/sw/qa/extras/rtfexport/data/fdo74709.rtf
new file mode 100644
index 000000000000..c521084d2418
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/fdo74709.rtf
@@ -0,0 +1,32 @@
+{\rtf1\ansi\deff4\adeflang1025
+\deftab720
+\viewscale100
+{\*\pgdsctbl
+{\pgdsc0\pgdscuse451\pgwsxn11906\pghsxn16838\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\pgdscnxt0 Default Style;}
+}
+\formshade\paperh16838\paperw11906\margl1134\margr1134\margt1134\margb1134\sectd\sbknone\sectunlocked1\pgndec\pgwsxn11906\pghsxn16838\marglsxn1134\margrsxn1134\margtsxn1134\margbsxn1134\ftnbj\ftnstart1\ftnrstcont\ftnnar\aenddoc\aftnrstcont\aftnstart1\aftnnrlc
+\trowd\trql\ltrrow\trpaddft3\trpaddt0\trpaddfl3\trpaddl0\trpaddfb3\trpaddb0\trpaddfr3\trpaddr0
+\clbrdrt\brdrhair\brdrw1\brdrcf1\clbrdrl\brdrhair\brdrw1\brdrcf1\clbrdrb\brdrhair\brdrw1\brdrcf1\cellx4819
+\clbrdrt\brdrhair\brdrw1\brdrcf1\clpadfl3\clpadl58
+\clbrdrl\brdrhair\brdrw1\brdrcf1\clpadft3\clpadt58
+\clbrdrb\brdrhair\brdrw1\brdrcf1\clpadfb3\clpadb58
+\clbrdrr\brdrhair\brdrw1\brdrcf1\clpadfr3\clpadr360\cellx9638
+\pgndec\pard\plain \s20\noline\intbl\qr
+{\rtlch \ltrch\loch 1.23}
+\cell
+\pard\plain \s20\noline\intbl\qr
+{\rtlch \ltrch\loch 4.56}
+\cell\row
+\pard\trowd\trql\ltrrow\trpaddft3\trpaddt0\trpaddfl3\trpaddl0\trpaddfb3\trpaddb0\trpaddfr3\trpaddr0
+\clbrdrl\brdrhair\brdrw1\brdrcf1\clbrdrb\brdrhair\brdrw1\brdrcf1\cellx4819
+\clbrdrl\brdrhair\brdrw1\brdrcf1\clbrdrb\brdrhair\brdrw1\brdrcf1\clbrdrr\brdrhair\brdrw1\brdrcf1\cellx9638
+\pard\plain \s20\noline\intbl
+{\rtlch \ltrch\loch first word}
+\cell
+\pard\plain \s20\noline\intbl
+{\rtlch \ltrch\loch second word}
+\cell\row
+\pard\pard\plain \s0\nowidctlpar
+{\*\hyphen2\hyphlead2\hyphtrail2\hyphmax0}
+\cf0\kerning1\dbch\af5\langfe2052\dbch\af6\afs24\alang1081\loch\f4\fs24\lang2057\rtlch \ltrch\loch
+\par }
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index b6084cbed641..225ab3a5b805 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -579,6 +579,13 @@ DECLARE_RTFEXPORT_TEST(testFdo66743, "fdo66743.rtf")
CPPUNIT_ASSERT_EQUAL(sal_Int32(0xd8d8d8), getProperty<sal_Int32>(xCell, "BackColor"));
}
+DECLARE_RTFEXPORT_TEST(testFdo74709, "fdo74709.rtf")
+{
+ uno::Reference<table::XCell> xCell = getCell(getParagraphOrTable(1), "B1");
+ // This was 0, as top/bottom/left/right padding wasn't imported.
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(360)), getProperty<sal_Int32>(xCell, "RightBorderDistance"));
+}
+
#endif
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index ef7117e0dd10..dffe15fa6c6b 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3683,6 +3683,34 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
case RTF_TS:
m_aStates.top().bHasTableStyle = true;
break;
+ case RTF_CLPADB:
+ case RTF_CLPADL:
+ case RTF_CLPADR:
+ case RTF_CLPADT:
+ {
+ 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, RTFValue::Pointer_t(new RTFValue(nParam)));
+ switch (nKeyword)
+ {
+ case RTF_CLPADB:
+ nSprm = NS_ooxml::LN_CT_TcMar_bottom;
+ break;
+ case RTF_CLPADL:
+ nSprm = NS_ooxml::LN_CT_TcMar_left;
+ break;
+ case RTF_CLPADR:
+ nSprm = NS_ooxml::LN_CT_TcMar_right;
+ break;
+ case RTF_CLPADT:
+ nSprm = NS_ooxml::LN_CT_TcMar_top;
+ break;
+ default:
+ break;
+ }
+ lcl_putNestedSprm(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, RTFValue::Pointer_t(new RTFValue(aAttributes)));
+ }
+ break;
default:
{
SAL_INFO("writerfilter", "TODO handle value '" << lcl_RtfToString(nKeyword) << "'");