Kaydet (Commit) a6f171a3 authored tarafından PriyankaGaikwad's avatar PriyankaGaikwad Kaydeden (comit) Caolán McNamara

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/15428Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 049e8412
......@@ -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 )
......
......@@ -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()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment