summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2017-08-28 22:30:32 -0400
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-09-08 12:19:04 +0200
commit3c29b0ad690c77b2ec9189981da73ffaa717e30c (patch)
tree4bbd74cc76679d0f7670cbe716ae6c72fc411277 /sw
parentf120e21012d1fcdaf9862d3818a43f37d3d0fb0b (diff)
tdf#112074 doc export: re-calculate indent for RTL table
In MSO tables, the only side that can have an indent is the logical left orientation. In right-to-left tables, the indent is measured from the physical right margin. So, we need to re-calculate LO's physical LEFT_AND_WIDTH indent to measure the distance from the right margin to the table. Importing already expects this recalculated indent. Change-Id: I9b8b7078aea8b7800cd31fbc11e2f27bd051be7d Reviewed-on: https://gerrit.libreoffice.org/41666 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Justin Luth <justin_luth@sil.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ww8export/ww8export2.cxx5
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx9
2 files changed, 10 insertions, 4 deletions
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx
index 632922f82a98..71587864e6cd 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -204,10 +204,7 @@ DECLARE_WW8EXPORT_TEST(testTdf112074_RTLtableJustification, "tdf112074_RTLtableJ
CPPUNIT_ASSERT_EQUAL_MESSAGE("Right To Left writing mode", text::WritingMode2::RL_TB, getProperty<sal_Int16>(xTable, "WritingMode"));
CPPUNIT_ASSERT_EQUAL_MESSAGE("Horizontal Orientation", text::HoriOrientation::LEFT_AND_WIDTH, getProperty<sal_Int16>(xTable, "HoriOrient"));
- if ( !mbExported )
- {
- CPPUNIT_ASSERT_MESSAGE("Table Indent", getProperty<long>(xTable, "LeftMargin") > 3000);
- }
+ CPPUNIT_ASSERT_MESSAGE("Table Indent", getProperty<long>(xTable, "LeftMargin") > 3000);
}
DECLARE_WW8EXPORT_TEST(testTdf104805, "tdf104805.doc")
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 13fa1c56272f..3b065c030afd 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -2359,6 +2359,15 @@ void WW8AttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t
nTableOffset = rHori.GetPos();
const SvxLRSpaceItem& rLRSp = pFormat->GetLRSpace();
nTableOffset += rLRSp.GetLeft();
+
+ // convert offset to be measured from right margin in right-to-left tables
+ if ( nTableOffset && m_rWW8Export.TrueFrameDirection(*pFormat) == SvxFrameDirection::Horizontal_RL_TB )
+ {
+ SwTwips nLeftPageMargin, nRightPageMargin;
+ const SwTwips nPageSize = m_rWW8Export.CurrentPageWidth(nLeftPageMargin, nRightPageMargin);
+ const SwTwips nTableWidth = pFormat->GetFrameSize().GetWidth();
+ nTableOffset = nPageSize - nLeftPageMargin - nRightPageMargin - nTableWidth - nTableOffset;
+ }
break;
}
}