diff options
author | PriyankaGaikwad <priyanka.gaikwad@synerzip.com> | 2015-04-20 14:46:20 +0530 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-04-30 08:35:33 +0000 |
commit | a6f171a3c4f58ea957071f614a3611a25f2e4eec (patch) | |
tree | 90f6d14246e70d0c758dc26a23fe5d7b6aaed09b | |
parent | 049e84125fb76f7a1a051d7cac2e04e37a7cd190 (diff) |
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 <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | oox/source/export/drawingml.cxx | 12 | ||||
-rw-r--r-- | sd/qa/unit/data/pptx/rightToLeftParagraph.pptx | bin | 0 -> 31841 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests.cxx | 37 |
3 files changed, 49 insertions, 0 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index e8673d2d920f..7862bf8da1b8 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 Binary files differnew file mode 100644 index 000000000000..8c3a46c8b985 --- /dev/null +++ b/sd/qa/unit/data/pptx/rightToLeftParagraph.pptx diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 8472ce189c19..56e4c6bc1c2f 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() |