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

tdf#90174 FILESAVE: export of bullet color for pptx

Added pptx export support for bullet color.

Change-Id: I0c7713a6d2161e1ecbe0d7f5778e78791e9759cd
Reviewed-on: https://gerrit.libreoffice.org/15169Tested-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 5ffe469a
...@@ -1644,6 +1644,7 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa ...@@ -1644,6 +1644,7 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa
OUString aGraphicURL; OUString aGraphicURL;
sal_Int16 nBulletRelSize = 0; sal_Int16 nBulletRelSize = 0;
sal_Int16 nStartWith = 1; sal_Int16 nStartWith = 1;
sal_Int32 nBulletColor = 0;
for ( sal_Int32 i = 0; i < nPropertyCount; i++ ) for ( sal_Int32 i = 0; i < nPropertyCount; i++ )
{ {
...@@ -1668,6 +1669,10 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa ...@@ -1668,6 +1669,10 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa
else if( *static_cast<OUString const *>(pValue) == ")") else if( *static_cast<OUString const *>(pValue) == ")")
bPBehind = true; bPBehind = true;
} }
else if(aPropName == "BulletColor")
{
nBulletColor = *( (sal_Int32*)pValue );
}
else if ( aPropName == "BulletChar" ) else if ( aPropName == "BulletChar" )
{ {
aBulletChar = OUString ( *( static_cast<OUString const *>(pValue) ) )[ 0 ]; aBulletChar = OUString ( *( static_cast<OUString const *>(pValue) ) )[ 0 ];
...@@ -1726,6 +1731,13 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa ...@@ -1726,6 +1731,13 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa
} }
else else
{ {
if(nBulletColor)
{
mpFS->startElementNS( XML_a, XML_buClr, FSEND );
WriteColor( nBulletColor );
mpFS->endElementNS( XML_a, XML_buClr );
}
if( nBulletRelSize && nBulletRelSize != 100 ) if( nBulletRelSize && nBulletRelSize != 100 )
mpFS->singleElementNS( XML_a, XML_buSzPct, mpFS->singleElementNS( XML_a, XML_buSzPct,
XML_val, IS( std::max( (sal_Int32)25000, std::min( (sal_Int32)400000, 1000*( (sal_Int32)nBulletRelSize ) ) ) ), FSEND ); XML_val, IS( std::max( (sal_Int32)25000, std::min( (sal_Int32)400000, 1000*( (sal_Int32)nBulletRelSize ) ) ) ), FSEND );
......
...@@ -99,6 +99,7 @@ public: ...@@ -99,6 +99,7 @@ public:
void testCellLeftAndRightMargin(); void testCellLeftAndRightMargin();
void testRightToLeftParaghraph(); void testRightToLeftParaghraph();
void testTableCellBorder(); void testTableCellBorder();
void testBulletColor();
#if !defined WNT #if !defined WNT
void testBnc822341(); void testBnc822341();
...@@ -128,6 +129,7 @@ public: ...@@ -128,6 +129,7 @@ public:
CPPUNIT_TEST(testCellLeftAndRightMargin); CPPUNIT_TEST(testCellLeftAndRightMargin);
CPPUNIT_TEST(testRightToLeftParaghraph); CPPUNIT_TEST(testRightToLeftParaghraph);
CPPUNIT_TEST(testTableCellBorder); CPPUNIT_TEST(testTableCellBorder);
CPPUNIT_TEST(testBulletColor);
#if !defined WNT #if !defined WNT
CPPUNIT_TEST(testBnc822341); CPPUNIT_TEST(testBnc822341);
...@@ -878,6 +880,33 @@ void SdExportTest::testRightToLeftParaghraph() ...@@ -878,6 +880,33 @@ void SdExportTest::testRightToLeftParaghraph()
xDocShRef->DoClose(); xDocShRef->DoClose();
} }
void SdExportTest::testBulletColor()
{
::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/bulletColor.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 );
SdDrawDocument *pDoc = xDocShRef->GetDoc();
CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL );
const SdrPage *pPage = pDoc->GetPage(1);
CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL );
SdrTextObj *pTxtObj = dynamic_cast<SdrTextObj *>( pPage->GetObj(0) );
CPPUNIT_ASSERT_MESSAGE( "no text object", pTxtObj != NULL);
const EditTextObject& aEdit = pTxtObj->GetOutlinerParaObject()->GetTextObject();
const SvxNumBulletItem *pNumFmt = dynamic_cast<const SvxNumBulletItem *>(aEdit.GetParaAttribs(0).GetItem(EE_PARA_NUMBULLET));
CPPUNIT_ASSERT(pNumFmt);
CPPUNIT_ASSERT_EQUAL_MESSAGE( "Bullet's color is wrong!", sal_uInt32(0xff0000),pNumFmt->GetNumRule()->GetLevel(0).GetBulletColor().GetColor());
}
#if !defined WNT #if !defined WNT
void SdExportTest::testBnc822341() 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