oox/source/vml/vmlshape.cxx                       |    8 ++++++++
 sw/qa/extras/ooxmlimport/data/tbrl-frame-vml.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx         |   12 ++++++++++++
 3 files changed, 20 insertions(+)

New commits:
commit 31b44f010557c43d8b02cc3be590ed1629bf1ca5
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Thu Jun 13 23:17:34 2019 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Jun 14 09:07:14 2019 +0200

    sw btlr writing mode: fix tbrl import from VML
    
    Wanted to do btlr, but even tbrl (e.g. Japanese text) is not working, so
    let's do that first.
    
    Change-Id: I62cb95754ce473ecf1de2d34460e50db94e64806
    Reviewed-on: https://gerrit.libreoffice.org/73991
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 27d7b51959ca..a7529493e401 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -52,6 +52,7 @@
 #include <com/sun/star/text/GraphicCrop.hpp>
 #include <com/sun/star/security/DocumentDigitalSignatures.hpp>
 #include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
+#include <com/sun/star/text/WritingMode2.hpp>
 #include <rtl/math.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <sal/log.hxx>
@@ -726,6 +727,13 @@ Reference< XShape > SimpleShape::implConvertAndInsert( 
const Reference< XShapes
             PropertySet( xShape ).setAnyProperty( PROP_RightBorderDistance, 
makeAny( sal_Int32( getTextBox()->borderDistanceRight )));
             PropertySet( xShape ).setAnyProperty( PROP_BottomBorderDistance, 
makeAny( sal_Int32( getTextBox()->borderDistanceBottom )));
         }
+
+        if (getTextBox()->maLayoutFlow == "vertical" && 
maTypeModel.maLayoutFlowAlt.isEmpty())
+        {
+            PropertySet(xShape).setAnyProperty(PROP_WritingMode,
+                                               
uno::makeAny(text::WritingMode2::TB_RL));
+        }
+
         if (!maTypeModel.maLayoutFlowAlt.isEmpty())
         {
             // Can't handle this property here, as the frame is not attached 
yet: pass it to writerfilter.
diff --git a/sw/qa/extras/ooxmlimport/data/tbrl-frame-vml.docx 
b/sw/qa/extras/ooxmlimport/data/tbrl-frame-vml.docx
new file mode 100644
index 000000000000..c697e5846ce6
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tbrl-frame-vml.docx 
differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 1c7282623b00..80967be606d7 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -18,6 +18,7 @@
 #include <wrtsh.hxx>
 #include <com/sun/star/document/XEmbeddedObjectSupplier2.hpp>
 #include <com/sun/star/embed/Aspects.hpp>
+#include <com/sun/star/text/WritingMode2.hpp>
 
 class Test : public SwModelTestBase
 {
@@ -255,6 +256,17 @@ DECLARE_OOXMLIMPORT_TEST(testTdf113946, "tdf113946.docx")
     CPPUNIT_ASSERT_EQUAL(OUString("1695"), aTop);
 }
 
+DECLARE_OOXMLIMPORT_TEST(testTbrlFrameVml, "tbrl-frame-vml.docx")
+{
+    uno::Reference<beans::XPropertySet> xTextFrame(getShape(1), 
uno::UNO_QUERY);
+    CPPUNIT_ASSERT(xTextFrame.is());
+
+    auto nActual = getProperty<sal_Int16>(xTextFrame, "WritingMode");
+    // Without the accompanying fix in place, this test would have failed with 
'Expected: 2; Actual:
+    // 4', i.e. writing direction was inherited from page, instead of explicit 
tbrl.
+    CPPUNIT_ASSERT_EQUAL(text::WritingMode2::TB_RL, nActual);
+}
+
 DECLARE_OOXMLIMPORT_TEST(testTdf121804, "tdf121804.docx")
 {
     uno::Reference<container::XIndexAccess> xGroup(getShape(1), 
uno::UNO_QUERY);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to