include/oox/ppt/slidepersist.hxx | 2 ++ oox/source/ppt/slidefragmenthandler.cxx | 3 ++- oox/source/ppt/slidepersist.cxx | 3 ++- sd/qa/unit/data/pptx/tdf99030.pptx |binary sd/qa/unit/import-tests.cxx | 26 ++++++++++++++++++++++++++ 5 files changed, 32 insertions(+), 2 deletions(-)
New commits: commit 554158f7d33742284905ed4953dd09041ea04a5d Author: Matus Uzak <[email protected]> Date: Sat Apr 9 00:43:56 2016 +0200 tdf#99030: PPTX import: Fixed lost slide background color Regression from commit f3d1ac7 Change-Id: I5cb9fe1bb6c753c34b49e72194a9fbe4c10c1654 Reviewed-on: https://gerrit.libreoffice.org/23930 Tested-by: Jenkins <[email protected]> Reviewed-by: Katarina Behrens <[email protected]> diff --git a/include/oox/ppt/slidepersist.hxx b/include/oox/ppt/slidepersist.hxx index 6fd7794..1e75c2c 100644 --- a/include/oox/ppt/slidepersist.hxx +++ b/include/oox/ppt/slidepersist.hxx @@ -84,6 +84,7 @@ public: void setBackgroundProperties( const oox::drawingml::FillPropertiesPtr& rFillPropertiesPtr ){ mpBackgroundPropertiesPtr = rFillPropertiesPtr; } const oox::drawingml::FillPropertiesPtr& getBackgroundProperties() const { return mpBackgroundPropertiesPtr; } + oox::drawingml::Color& getBackgroundColor() { return maBackgroundColor; } bool isMasterPage() const { return mbMaster; } bool isNotesPage() const { return mbNotes; } @@ -127,6 +128,7 @@ private: SlidePersistPtr mpMasterPagePtr; oox::drawingml::ShapePtr maShapesPtr; + oox::drawingml::Color maBackgroundColor; oox::drawingml::FillPropertiesPtr mpBackgroundPropertiesPtr; ::std::list< std::shared_ptr< TimeNode > > maTimeNodeList; diff --git a/oox/source/ppt/slidefragmenthandler.cxx b/oox/source/ppt/slidefragmenthandler.cxx index 63274c1..fc8ff5d 100644 --- a/oox/source/ppt/slidefragmenthandler.cxx +++ b/oox/source/ppt/slidefragmenthandler.cxx @@ -170,7 +170,8 @@ SlideFragmentHandler::~SlideFragmentHandler() pFillProperties = mpSlidePersistPtr->getTheme()->getFillStyle( rAttribs.getInteger( XML_idx, -1 ) ); FillPropertiesPtr pFillPropertiesPtr( pFillProperties ? new FillProperties( *pFillProperties ) : new FillProperties() ); mpSlidePersistPtr->setBackgroundProperties( pFillPropertiesPtr ); - return this; + ContextHandlerRef ret = new ColorContext( *this, mpSlidePersistPtr->getBackgroundColor() ); + return ret; } break; diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx index 9064a67..574892a 100644 --- a/oox/source/ppt/slidepersist.cxx +++ b/oox/source/ppt/slidepersist.cxx @@ -167,7 +167,8 @@ void SlidePersist::createBackground( const XmlFilterBase& rFilterBase ) { if ( mpBackgroundPropertiesPtr ) { - sal_Int32 nPhClr = mpBackgroundPropertiesPtr->getBestSolidColor().getColor( rFilterBase.getGraphicHelper() ); + sal_Int32 nPhClr = maBackgroundColor.isUsed() ? + maBackgroundColor.getColor( rFilterBase.getGraphicHelper() ) : API_RGB_TRANSPARENT; ::oox::drawingml::ShapePropertyMap aPropMap( rFilterBase.getModelObjectHelper() ); mpBackgroundPropertiesPtr->pushToPropMap( aPropMap, rFilterBase.getGraphicHelper(), 0, nPhClr ); diff --git a/sd/qa/unit/data/pptx/tdf99030.pptx b/sd/qa/unit/data/pptx/tdf99030.pptx new file mode 100644 index 0000000..38448f9 Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf99030.pptx differ diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index a9b7f0d..3ebd111 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -44,6 +44,7 @@ #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> #include <com/sun/star/drawing/XDrawPage.hpp> #include <com/sun/star/drawing/XDrawPagesSupplier.hpp> +#include <com/sun/star/drawing/XMasterPagesSupplier.hpp> #include <com/sun/star/animations/XAnimationNodeSupplier.hpp> #include <com/sun/star/animations/XAnimationNode.hpp> #include <com/sun/star/animations/XAnimate.hpp> @@ -114,6 +115,7 @@ public: void testTdf89927(); void testTdf93868(); void testTdf95932(); + void testTdf99030(); CPPUNIT_TEST_SUITE(SdImportTest); @@ -161,6 +163,7 @@ public: CPPUNIT_TEST(testTdf89927); CPPUNIT_TEST(testTdf93868); CPPUNIT_TEST(testTdf95932); + CPPUNIT_TEST(testTdf99030); CPPUNIT_TEST_SUITE_END(); }; @@ -1301,6 +1304,29 @@ void SdImportTest::testTdf95932() xDocShRef->DoClose(); } +void SdImportTest::testTdf99030() +{ + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/tdf99030.pptx"), PPTX); + + uno::Reference< drawing::XMasterPagesSupplier > xDoc( + xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW ); + uno::Reference< drawing::XDrawPage > xPage( + xDoc->getMasterPages()->getByIndex( 0 ), uno::UNO_QUERY_THROW ); + uno::Reference< beans::XPropertySet > xPropSet( xPage, uno::UNO_QUERY ); + + sal_Int32 nFillColor(0); + uno::Any aAny = xPropSet->getPropertyValue( "Background" ); + if (aAny.hasValue()) + { + uno::Reference< beans::XPropertySet > xBackgroundPropSet; + aAny >>= xBackgroundPropSet; + xBackgroundPropSet->getPropertyValue( "FillColor" ) >>= nFillColor; + } + CPPUNIT_ASSERT_EQUAL( sal_Int32(0x676A55), nFillColor ); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest); CPPUNIT_PLUGIN_IMPLEMENT(); _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
