oox/source/export/drawingml.cxx | 12 ++++++++ sd/qa/unit/data/pptx/rightToLeftParagraph.pptx |binary sd/qa/unit/export-tests.cxx | 37 +++++++++++++++++++++++++ 3 files changed, 49 insertions(+)
New commits: commit a6f171a3c4f58ea957071f614a3611a25f2e4eec Author: PriyankaGaikwad <priyanka.gaik...@synerzip.com> Date: Mon Apr 20 14:46:20 2015 +0530 tdf#90673:FILESAVE:PPTX Paragraph text direction right-to-left is not exported Problem Description: After RT 'rtl' tag of <a:pPr> are not exported XML Diff: Original : <a:pPr marL="457200" indent="-457200" algn="r" rtl="1"> RT : <a:pPr algn="r"> Change-Id: I307bc748c73127c311cabd127bb98e43bd298271 Reviewed-on: https://gerrit.libreoffice.org/15428 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index e8673d2d..7862bf8 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -57,6 +57,7 @@ #include <com/sun/star/style/LineSpacingMode.hpp> #include <com/sun/star/style/ParagraphAdjust.hpp> #include <com/sun/star/text/WritingMode.hpp> +#include <com/sun/star/text/WritingMode2.hpp> #include <com/sun/star/text/GraphicCrop.hpp> #include <com/sun/star/text/XText.hpp> #include <com/sun/star/text/XTextContent.hpp> @@ -1778,6 +1779,16 @@ void DrawingML::WriteParagraphProperties( Reference< XTextContent > rParagraph ) if( GETAD( ParaLineSpacing ) ) bHasLinespacing = ( mAny >>= aLineSpacing ); + bool bRtl = false; + if( GETA( WritingMode ) ) + { + sal_Int16 nWritingMode; + if( ( mAny >>= nWritingMode ) && nWritingMode == text::WritingMode2::RL_TB ) + { + bRtl = true; + } + } + if( nLevel != -1 || nAlignment != style::ParagraphAdjust_LEFT || bHasLinespacing ) @@ -1786,6 +1797,7 @@ void DrawingML::WriteParagraphProperties( Reference< XTextContent > rParagraph ) XML_lvl, nLevel > 0 ? I32S( nLevel ) : NULL, XML_marL, NULL, XML_algn, GetAlignment( nAlignment ), + XML_rtl, bRtl ? BS(bRtl) : NULL, FSEND ); if( bHasLinespacing ) diff --git a/sd/qa/unit/data/pptx/rightToLeftParagraph.pptx b/sd/qa/unit/data/pptx/rightToLeftParagraph.pptx new file mode 100644 index 0000000..8c3a46c Binary files /dev/null and b/sd/qa/unit/data/pptx/rightToLeftParagraph.pptx differ diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 8472ce1..56e4c6b 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -58,6 +58,7 @@ #include <com/sun/star/graphic/XGraphic.hpp> #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/drawing/FillStyle.hpp> + #include <com/sun/star/text/WritingMode2.hpp> #include <svx/svdotable.hxx> #include <com/sun/star/table/XTable.hpp> #include <com/sun/star/table/XMergeableCell.hpp> @@ -91,6 +92,7 @@ public: void testBulletStartNumber(); void testLineStyle(); void testCellLeftAndRightMargin(); + void testRightToLeftParaghraph(); #if !defined WNT void testBnc822341(); @@ -118,6 +120,8 @@ public: CPPUNIT_TEST(testBulletStartNumber); CPPUNIT_TEST(testLineStyle); CPPUNIT_TEST(testCellLeftAndRightMargin); + CPPUNIT_TEST(testRightToLeftParaghraph); + #if !defined WNT CPPUNIT_TEST(testBnc822341); #endif @@ -836,6 +840,39 @@ void SdExportTest::testLineStyle() } +void SdExportTest::testRightToLeftParaghraph() +{ + ::sd::DrawDocShellRef xDocShRef = loadURL(getURLFromSrc("/sd/qa/unit/data/pptx/rightToLeftParagraph.pptx"), PPTX); + + xDocShRef = saveAndReload( xDocShRef, PPTX ); + + uno::Reference< drawing::XDrawPagesSupplier > xDoc( + xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW ); + + uno::Reference< drawing::XDrawPage > xPage( + xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY_THROW ); + + uno::Reference< beans::XPropertySet > xShape( + xPage->getByIndex(0), uno::UNO_QUERY ); + CPPUNIT_ASSERT_MESSAGE( "no shape", xShape.is() ); + + // Get first paragraph + uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY)->getText(); + CPPUNIT_ASSERT_MESSAGE( "not a text shape", xText.is() ); + uno::Reference<container::XEnumerationAccess> paraEnumAccess; + paraEnumAccess.set(xText, uno::UNO_QUERY); + uno::Reference<container::XEnumeration> paraEnum = paraEnumAccess->createEnumeration(); + uno::Reference<text::XTextRange> const xParagraph(paraEnum->nextElement(), + uno::UNO_QUERY_THROW); + uno::Reference< beans::XPropertySet > xPropSet( xParagraph, uno::UNO_QUERY_THROW ); + + sal_Int16 nWritingMode = 0; + xPropSet->getPropertyValue( "WritingMode" ) >>= nWritingMode; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Wrong paragraph WritingMode", text::WritingMode2::RL_TB, nWritingMode); + + xDocShRef->DoClose(); +} + #if !defined WNT void SdExportTest::testBnc822341()
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits