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

Justin Luth justin_luth at sil.org
Wed Sep 6 07:08:07 UTC 2017


 sw/qa/extras/ww8export/data/tdf112074_RTLtableJustification.doc |binary
 sw/qa/extras/ww8export/ww8export2.cxx                           |   16 ++++++++++
 sw/source/filter/ww8/ww8par2.cxx                                |   10 +-----
 3 files changed, 19 insertions(+), 7 deletions(-)

New commits:
commit 176a723876b0138debb20f824103b2ab0c910401
Author: Justin Luth <justin_luth at sil.org>
Date:   Mon Aug 28 21:28:34 2017 -0400

    tdf#112074 doc import: use real width if no preferred width
    
    If the document did not specify a preferred table width, then
    the indent was completely wrong. I don't think the "else" clause
    ever provided a correct value.
    See https://bz.apache.org/ooo/attachment.cgi?id=63705&action=diff
    
    These documents don't round-trip at all, so making changes
    here ought to be fairly regression-safe since the documents are
    read-only anyway.
    
    Change-Id: I6308ffd22b6f7ce60b9780e00b68bc6f8b09a6fa
    Reviewed-on: https://gerrit.libreoffice.org/41664
    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/data/tdf112074_RTLtableJustification.doc b/sw/qa/extras/ww8export/data/tdf112074_RTLtableJustification.doc
new file mode 100644
index 000000000000..64ea6521e814
Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf112074_RTLtableJustification.doc differ
diff --git a/sw/qa/extras/ww8export/ww8export2.cxx b/sw/qa/extras/ww8export/ww8export2.cxx
index f9e69f03cf90..0074969fbb13 100644
--- a/sw/qa/extras/ww8export/ww8export2.cxx
+++ b/sw/qa/extras/ww8export/ww8export2.cxx
@@ -12,6 +12,8 @@
 #include <com/sun/star/graphic/XGraphic.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/text/HoriOrientation.hpp>
+#include <com/sun/star/text/WritingMode2.hpp>
 #include <com/sun/star/text/XTextFramesSupplier.hpp>
 #include <com/sun/star/text/XTextTable.hpp>
 #include <com/sun/star/text/XTextTablesSupplier.hpp>
@@ -194,6 +196,20 @@ DECLARE_WW8EXPORT_TEST(testTdf108448_endNote, "tdf108448_endNote.odt")
     CPPUNIT_ASSERT_EQUAL_MESSAGE( "Number of paragraphs in Endnote i", 1, nRet );
 }
 
+DECLARE_WW8EXPORT_TEST(testTdf112074_RTLtableJustification, "tdf112074_RTLtableJustification.doc")
+{
+    uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
+    uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Right To Left writing mode", text::WritingMode2::RL_TB, getProperty<sal_Int16>(xTable, "WritingMode"));
+    if ( !mbExported )
+    {
+        CPPUNIT_ASSERT_EQUAL_MESSAGE("Horizontal Orientation", text::HoriOrientation::LEFT_AND_WIDTH, getProperty<sal_Int16>(xTable, "HoriOrient"));
+        CPPUNIT_ASSERT_MESSAGE("Table Indent", getProperty<long>(xTable, "LeftMargin") > 3000);
+    }
+}
+
 DECLARE_WW8EXPORT_TEST(testTdf104805, "tdf104805.doc")
 {
     uno::Reference<beans::XPropertySet> xPropertySet(getStyles("NumberingStyles")->getByName("WW8Num1"), uno::UNO_QUERY);
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index e2238338b95f..abdf24a4d85b 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -2583,13 +2583,9 @@ void WW8TabDesc::CreateSwTable()
                 nLeft = GetMinLeft();
             else
             {
-                if (m_nPreferredWidth)
-                {
-                    nLeft = m_pIo->m_aSectionManager.GetTextAreaWidth();
-                    nLeft = nLeft - m_nPreferredWidth  - m_nOrgDxaLeft;
-                }
-                else
-                    nLeft = -GetMinLeft();
+                const short nTableWidth = m_nPreferredWidth ? m_nPreferredWidth : m_nSwWidth;
+                nLeft = m_pIo->m_aSectionManager.GetTextAreaWidth();
+                nLeft = nLeft - nTableWidth - m_nOrgDxaLeft;
             }
 
             aL.SetLeft(nLeft);


More information about the Libreoffice-commits mailing list