[Libreoffice-commits] core.git: sw/qa sw/source

Justin Luth justin_luth at sil.org
Fri Sep 8 10:19:24 UTC 2017


 sw/qa/extras/ww8export/ww8export2.cxx |    5 +----
 sw/source/filter/ww8/wrtww8.cxx       |    9 +++++++++
 2 files changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 3c29b0ad690c77b2ec9189981da73ffaa717e30c
Author: Justin Luth <justin_luth at sil.org>
Date:   Mon Aug 28 22:30:32 2017 -0400

    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 at libreoffice.org>
    Reviewed-by: Justin Luth <justin_luth at sil.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>

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;
         }
     }


More information about the Libreoffice-commits mailing list