summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2019-06-13 23:17:34 +0200
committerMiklos Vajna <vmiklos@collabora.com>2019-06-14 09:07:14 +0200
commit31b44f010557c43d8b02cc3be590ed1629bf1ca5 (patch)
treebf94a8f4ef0f55ee2cd7b0b143d86f9ec8f85115
parente598440a946ba3e7785b81f57a36673f7b88db2e (diff)
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 <vmiklos@collabora.com>
-rw-r--r--oox/source/vml/vmlshape.cxx8
-rw-r--r--sw/qa/extras/ooxmlimport/data/tbrl-frame-vml.docxbin0 -> 22756 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport2.cxx12
3 files changed, 20 insertions, 0 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/tbrl-frame-vml.docx
Binary files 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);