summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-06-15 09:07:31 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-06-15 09:07:31 +0200
commitd0bedaf9eface97d17787931457f3ffc89ac4216 (patch)
treeb84c96129de1a912087cfc9cc0e806d82b00d920
parent97d3624d56323431939f28593da405adb1f39480 (diff)
tdf#84832 RTF export: fix handling of custom table cell margins
Change-Id: I3ed42ae4dc007c15d4649f57e1691534088549fc
-rw-r--r--sw/qa/extras/rtfexport/data/tdf84832.docxbin0 -> 11875 bytes
-rw-r--r--sw/qa/extras/rtfexport/rtfexport.cxx7
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx6
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx5
4 files changed, 11 insertions, 7 deletions
diff --git a/sw/qa/extras/rtfexport/data/tdf84832.docx b/sw/qa/extras/rtfexport/data/tdf84832.docx
new file mode 100644
index 000000000000..0e0da12635e8
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf84832.docx
Binary files differ
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index 33d6ca41f6d2..51274966e6f7 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -658,6 +658,13 @@ DECLARE_RTFEXPORT_TEST(testFdo74709, "fdo74709.rtf")
CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(360)), getProperty<sal_Int32>(xCell, "RightBorderDistance"));
}
+DECLARE_RTFEXPORT_TEST(testTdf84832, "tdf84832.docx")
+{
+ uno::Reference<table::XCell> xCell = getCell(getParagraphOrTable(2), "A1");
+ // This was 0, as left padding wasn't exported.
+ CPPUNIT_ASSERT_EQUAL(sal_Int32(convertTwipToMm100(113)), getProperty<sal_Int32>(xCell, "LeftBorderDistance"));
+}
+
DECLARE_RTFEXPORT_TEST(testRelsize, "relsize.rtf")
{
uno::Reference<drawing::XShape> xShape = getShape(1);
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index a9061abc5aff..a09246a7e6ac 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -631,9 +631,6 @@ void RtfAttributeOutput::TableDefaultBorders(ww8::WW8TableNodeInfoInner::Pointer
* called for each cell.
*/
- const SwTableBox* pTableBox = pTableTextNodeInfoInner->getTableBox();
- SwFrameFormat* pFormat = pTableBox->GetFrameFormat();
- const SvxBoxItem& rDefault = pFormat->GetBox();
const SwWriteTableRows& aRows = m_pTableWrt->GetRows();
SwWriteTableRow* pRow = aRows[ pTableTextNodeInfoInner->getRow() ];
const SwWriteTableCell* pCell = &pRow->GetCells()[ pTableTextNodeInfoInner->getCell() ];
@@ -664,8 +661,7 @@ void RtfAttributeOutput::TableDefaultBorders(ww8::WW8TableNodeInfoInner::Pointer
{
if (const editeng::SvxBorderLine* pLn = rBox.GetLine(aBorders[i]))
m_aRowDefs.append(OutTBLBorderLine(m_rExport, pLn, aBorderNames[i]));
- if (rDefault.GetDistance(aBorders[i]) !=
- rBox.GetDistance(aBorders[i]))
+ if (rBox.GetDistance(aBorders[i]))
{
m_aRowDefs.append(aCellPadUnits[i]);
m_aRowDefs.append((sal_Int32)3);
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index e25bb1970186..31e62ee5ae8a 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -4673,19 +4673,20 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
RTFSprms aAttributes;
aAttributes.set(NS_ooxml::LN_CT_TblWidth_type, std::make_shared<RTFValue>(NS_ooxml::LN_Value_ST_TblWidth_dxa));
aAttributes.set(NS_ooxml::LN_CT_TblWidth_w, std::make_shared<RTFValue>(nParam));
+ // Top and left is swapped, that's what Word does.
switch (nKeyword)
{
case RTF_CLPADB:
nSprm = NS_ooxml::LN_CT_TcMar_bottom;
break;
case RTF_CLPADL:
- nSprm = NS_ooxml::LN_CT_TcMar_left;
+ nSprm = NS_ooxml::LN_CT_TcMar_top;
break;
case RTF_CLPADR:
nSprm = NS_ooxml::LN_CT_TcMar_right;
break;
case RTF_CLPADT:
- nSprm = NS_ooxml::LN_CT_TcMar_top;
+ nSprm = NS_ooxml::LN_CT_TcMar_left;
break;
default:
break;