diff options
author | Mark Hung <marklh9@gmail.com> | 2015-08-02 14:40:18 +0800 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2015-08-25 11:55:05 +0000 |
commit | 43679f94b45f4d9e120c64a3fb5cc3ee77f12b11 (patch) | |
tree | 400bd571b72053f05ff51af05508ce799b87ca1c /sd | |
parent | 3ac03b3f2747e723efc93a5a4ca82d72445eecf0 (diff) |
Fix tdf#80224 Custom text color changed to black on .PPTX export
1) Indirect property values were ignored, now they are used.
2) Write endParaRPr so that PowerPoint display them.
3) Automatic colors are written as white or black based on
whether background is dark.
Change-Id: I255c16f35149b738be2daf2800b1c90389f2c7cf
Reviewed-on: https://gerrit.libreoffice.org/17472
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/data/odp/tdf80224.odp | bin | 0 -> 23894 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests.cxx | 21 | ||||
-rw-r--r-- | sd/source/filter/eppt/epptbase.hxx | 1 | ||||
-rw-r--r-- | sd/source/filter/eppt/pptx-epptbase.cxx | 4 | ||||
-rw-r--r-- | sd/source/filter/eppt/pptx-epptooxml.cxx | 5 |
5 files changed, 30 insertions, 1 deletions
diff --git a/sd/qa/unit/data/odp/tdf80224.odp b/sd/qa/unit/data/odp/tdf80224.odp Binary files differnew file mode 100644 index 000000000000..5712c1a7d7a9 --- /dev/null +++ b/sd/qa/unit/data/odp/tdf80224.odp diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 0a8a34267e8c..a90a3de70a89 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -129,6 +129,7 @@ public: #if !defined WNT void testBnc822341(); #endif + void testTdf80224(); CPPUNIT_TEST_SUITE(SdExportTest); CPPUNIT_TEST(testFdo90607); @@ -166,6 +167,7 @@ public: #if !defined WNT CPPUNIT_TEST(testBnc822341); #endif + CPPUNIT_TEST(testTdf80224); CPPUNIT_TEST_SUITE_END(); }; @@ -1240,6 +1242,25 @@ void SdExportTest::testTableCellBorder() xDocShRef->DoClose(); } +void SdExportTest::testTdf80224() +{ + ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/odp/tdf80224.odp"), ODP); + 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< drawing::XShape > xShape(xPage->getByIndex(0), uno::UNO_QUERY); + uno::Reference<text::XText> xText = uno::Reference<text::XTextRange>(xShape, uno::UNO_QUERY_THROW)->getText(); + 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->getStart(), uno::UNO_QUERY_THROW ); + sal_Int32 nCharColor; + xPropSet->getPropertyValue("CharColor") >>= nCharColor; + CPPUNIT_ASSERT_EQUAL(sal_Int32(6644396), nCharColor); + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sd/source/filter/eppt/epptbase.hxx b/sd/source/filter/eppt/epptbase.hxx index 9180464823dc..99d84cd5bd47 100644 --- a/sd/source/filter/eppt/epptbase.hxx +++ b/sd/source/filter/eppt/epptbase.hxx @@ -347,6 +347,7 @@ protected: OString mType; bool mbPresObj; bool mbEmptyPresObj; + bool mbIsBackgroundDark; sal_Int32 mnAngle; sal_uInt32 mnPages; ///< number of Slides ( w/o master pages & notes & handout ) diff --git a/sd/source/filter/eppt/pptx-epptbase.cxx b/sd/source/filter/eppt/pptx-epptbase.cxx index 45febb9bb83b..1d58016ab18d 100644 --- a/sd/source/filter/eppt/pptx-epptbase.cxx +++ b/sd/source/filter/eppt/pptx-epptbase.cxx @@ -133,6 +133,7 @@ PPTWriterBase::PPTWriterBase() , mbStatusIndicator(false) , mbPresObj(false) , mbEmptyPresObj(false) + , mbIsBackgroundDark(false) , mnAngle(0) , mnPages(0) , mnMasterPages(0) @@ -325,6 +326,9 @@ bool PPTWriterBase::GetPageByIndex( sal_uInt32 nIndex, PageType ePageType ) if ( !mXPagePropSet.is() ) break; + if (GetPropertyValue( aAny, mXPagePropSet, OUString("IsBackgroundDark") ) ) + aAny >>= mbIsBackgroundDark; + mXShapes = Reference< XShapes >( mXDrawPage, UNO_QUERY ); if ( !mXShapes.is() ) break; diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index ff020e054096..e30e7fade81b 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -412,7 +412,9 @@ void PowerPointExport::ImplWriteBackground( FSHelperPtr pFS, Reference< XPropert pFS->startElementNS( XML_p, XML_bg, FSEND ); pFS->startElementNS( XML_p, XML_bgPr, FSEND ); - PowerPointShapeExport( pFS, &maShapeMap, this ).WriteFill( rXPropSet ); + PowerPointShapeExport aDML( pFS, &maShapeMap, this ); + aDML.SetBackgroundDark(mbIsBackgroundDark); + aDML.WriteFill( rXPropSet ); pFS->endElementNS( XML_p, XML_bgPr ); pFS->endElementNS( XML_p, XML_bg ); @@ -1706,6 +1708,7 @@ void PowerPointExport::WriteShapeTree( FSHelperPtr pFS, PageType ePageType, bool PowerPointShapeExport aDML( pFS, &maShapeMap, this ); aDML.SetMaster( bMaster ); aDML.SetPageType( ePageType ); + aDML.SetBackgroundDark(mbIsBackgroundDark); sal_uInt32 nShapes; pFS->startElementNS( XML_p, XML_spTree, FSEND ); |