diff --git a/filter/qa/unit/data/tdf91315.fodp b/filter/qa/unit/data/tdf91315.fodp new file mode 100644 index 000000000000..a3d472fc1613 --- /dev/null +++ b/filter/qa/unit/data/tdf91315.fodp @@ -0,0 +1,429 @@ + + + 2015-05-16T06:24:54.7833246752015-05-16T06:26:35.675435300PT43S1LibreOfficeDev/25.2.0.0.alpha0$Linux_X86_64 LibreOffice_project/8392aa55baf949d7fecfcce56499256866ba5de9 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <number> + + + + + + + + + + + + + + + + + + + + + + + <number> + + + + + + + + + + + + + + + + + + + + + + + + + <number> + + + + + + + + + + + בדיקה (test) + + + + + + + + + + + + + \ No newline at end of file diff --git a/filter/qa/unit/svg.cxx b/filter/qa/unit/svg.cxx index 61372d1442f6..366102fd964c 100644 --- a/filter/qa/unit/svg.cxx +++ b/filter/qa/unit/svg.cxx @@ -364,6 +364,21 @@ CPPUNIT_TEST_FIXTURE(SvgFilterTest, testMapModeText) // ahead to get the rotation. } +CPPUNIT_TEST_FIXTURE(SvgFilterTest, testTdf91315) +{ + // Load a presentation containing RTL text + loadFromFile(u"tdf91315.fodp"); + + save(u"impress_svg_Export"_ustr); + + xmlDocUniquePtr pXmlDoc = parseExportedFile(); + + assertXPath(pXmlDoc, "//svg:text[@direction='rtl']", 1); + // Without the accompanying fix, this test would have failed with: + // - Expected: 1 + // - Actual : 0 +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx index 2c19058cd3a4..6a9ae6b6219f 100644 --- a/filter/source/svg/svgwriter.cxx +++ b/filter/source/svg/svgwriter.cxx @@ -91,6 +91,7 @@ constexpr OUString aXMLAttrOffset = u"offset"_ustr; constexpr OUString aXMLAttrStopColor = u"stop-color"_ustr; constexpr OUString aXMLAttrStrokeLinejoin = u"stroke-linejoin"_ustr; constexpr OUString aXMLAttrStrokeLinecap = u"stroke-linecap"_ustr; +constexpr OUString aXMLAttrTextDirection = u"direction"_ustr; vcl::PushFlags SVGContextHandler::getPushFlags() const @@ -1332,6 +1333,15 @@ void SVGTextWriter::startTextShape() mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrTransform, aTransform ); } + // tdf#91315: Set text direction + auto nLayoutMode = mpVDev->GetLayoutMode(); + if (nLayoutMode + & (vcl::text::ComplexTextLayoutFlags::BiDiRtl + | vcl::text::ComplexTextLayoutFlags::BiDiStrong)) + { + mrExport.AddAttribute(XML_NAMESPACE_NONE, aXMLAttrTextDirection, "rtl"); + } + mpTextShapeElem.reset(new SvXMLElementExport( mrExport, XML_NAMESPACE_NONE, aXMLElemText, true, mbIWS )); startTextParagraph(); }