From f091460837835033b10df7674210b0856cda0ec9 Mon Sep 17 00:00:00 2001 From: Justin Luth Date: Mon, 28 Aug 2017 21:52:15 -0400 Subject: tdf#112074 doc export: for RTL tables, LEFT_AND_WIDTH is RIGHT 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 save the table's orientation as RIGHT aligned. In LO tables, only the physical left orientation can specify the indent. Importing already calculates the corrected index size. On export, the indent size will need to be re-calculated to account for the reversed the margins, but that will come in a separate patch. Change-Id: Ie2457791f913af2360af96f5038063d305e366de Reviewed-on: https://gerrit.libreoffice.org/41665 Tested-by: Jenkins Reviewed-by: Justin Luth Reviewed-by: Miklos Vajna --- sw/qa/extras/ww8export/ww8export2.cxx | 2 +- sw/source/filter/ww8/wrtww8.cxx | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx index 0074969fbb13..632922f82a98 100644 --- a/sw/qa/extras/ww8export/ww8export2.cxx +++ b/sw/qa/extras/ww8export/ww8export2.cxx @@ -203,9 +203,9 @@ DECLARE_WW8EXPORT_TEST(testTdf112074_RTLtableJustification, "tdf112074_RTLtableJ uno::Reference xTable(xTables->getByIndex(0), uno::UNO_QUERY); CPPUNIT_ASSERT_EQUAL_MESSAGE("Right To Left writing mode", text::WritingMode2::RL_TB, getProperty(xTable, "WritingMode")); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Horizontal Orientation", text::HoriOrientation::LEFT_AND_WIDTH, getProperty(xTable, "HoriOrient")); if ( !mbExported ) { - CPPUNIT_ASSERT_EQUAL_MESSAGE("Horizontal Orientation", text::HoriOrientation::LEFT_AND_WIDTH, getProperty(xTable, "HoriOrient")); CPPUNIT_ASSERT_MESSAGE("Table Indent", getProperty(xTable, "LeftMargin") > 3000); } } diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 9bdba927e7bc..13fa1c56272f 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2244,6 +2244,14 @@ void WW8AttributeOutput::TableOrientation( ww8::WW8TableNodeInfoInner::Pointer_t m_rWW8Export.InsUInt16( 2 ); } break; + case text::HoriOrientation::LEFT_AND_WIDTH: + // Width can only be specified for the LOGICAL left, so in RTL, that is always PHYSICAL right + if ( bIsRTL ) + { + m_rWW8Export.InsUInt16( NS_sprm::sprmTJc90 ); //required for LO + m_rWW8Export.InsUInt16( 2 ); + } + break; default: break; } -- cgit v1.2.3