Kaydet (Commit) 8707670c authored tarafından PriyankaGaikwad's avatar PriyankaGaikwad Kaydeden (comit) David Tardon

tdf#90174 FILESAVE: export of bullet color for pptx

Added pptx export support for bullet color.

Change-Id: I69306c8b3ace359f8dc243b83f89cfb570b9b73b
Reviewed-on: https://gerrit.libreoffice.org/14966Tested-by: 's avatarDavid Tardon <dtardon@redhat.com>
Reviewed-by: 's avatarDavid Tardon <dtardon@redhat.com>
üst 849c1b64
...@@ -1610,6 +1610,7 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa ...@@ -1610,6 +1610,7 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa
bool bHasFontDesc = false; bool bHasFontDesc = false;
OUString aGraphicURL; OUString aGraphicURL;
sal_Int16 nBulletRelSize = 0; sal_Int16 nBulletRelSize = 0;
sal_Int32 nBulletColor;
for ( sal_Int32 i = 0; i < nPropertyCount; i++ ) for ( sal_Int32 i = 0; i < nPropertyCount; i++ )
{ {
...@@ -1634,6 +1635,10 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa ...@@ -1634,6 +1635,10 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa
else if( *(OUString*)pValue == ")") else if( *(OUString*)pValue == ")")
bPBehind = true; bPBehind = true;
} }
else if(aPropName == "BulletColor")
{
nBulletColor = *( (sal_Int32*)pValue );
}
else if ( aPropName == "BulletChar" ) else if ( aPropName == "BulletChar" )
{ {
aBulletChar = OUString ( *( (OUString*)pValue ) )[ 0 ]; aBulletChar = OUString ( *( (OUString*)pValue ) )[ 0 ];
...@@ -1688,6 +1693,13 @@ void DrawingML::WriteParagraphNumbering( Reference< XPropertySet > rXPropSet, sa ...@@ -1688,6 +1693,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 );
......
...@@ -84,6 +84,7 @@ public: ...@@ -84,6 +84,7 @@ public:
void testLinkedGraphicRT(); void testLinkedGraphicRT();
void testImageWithSpecialID(); void testImageWithSpecialID();
void testTableCellFillProperties(); void testTableCellFillProperties();
void testBulletColor();
#if !defined WNT #if !defined WNT
void testBnc822341(); void testBnc822341();
#endif #endif
...@@ -107,6 +108,7 @@ public: ...@@ -107,6 +108,7 @@ public:
CPPUNIT_TEST(testLinkedGraphicRT); CPPUNIT_TEST(testLinkedGraphicRT);
CPPUNIT_TEST(testImageWithSpecialID); CPPUNIT_TEST(testImageWithSpecialID);
CPPUNIT_TEST(testTableCellFillProperties); CPPUNIT_TEST(testTableCellFillProperties);
CPPUNIT_TEST(testBulletColor);
#if !defined WNT #if !defined WNT
CPPUNIT_TEST(testBnc822341); CPPUNIT_TEST(testBnc822341);
#endif #endif
...@@ -820,6 +822,32 @@ void SdExportTest::testBnc822341() ...@@ -820,6 +822,32 @@ void SdExportTest::testBnc822341()
#endif #endif
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());
}
CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest); CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
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