diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx index 2d8dfb8ad7b7..d753326aa4a5 100644 --- a/oox/source/drawingml/table/tablecell.cxx +++ b/oox/source/drawingml/table/tablecell.cxx @@ -116,6 +116,17 @@ void applyTableStylePart( const ::oox::core::XmlFilterBase& rFilterBase, ::oox::drawingml::FillPropertiesPtr& rPartFillPropertiesPtr( rTableStylePart.getFillProperties() ); if ( rPartFillPropertiesPtr.get() ) rFillProperties.assignUsed( *rPartFillPropertiesPtr ); + else + { + ::oox::drawingml::ShapeStyleRef& rFillStyleRef = rTableStylePart.getStyleRefs()[ XML_fillRef ]; + const Theme* pTheme = rFilterBase.getCurrentTheme(); + if (pTheme && rFillStyleRef.mnThemedIdx != 0 ) + { + rFillProperties.assignUsed( *pTheme->getFillStyle( rFillStyleRef.mnThemedIdx ) ); + sal_Int32 nPhClr = rFillStyleRef.maPhClr.getColor( rFilterBase.getGraphicHelper() ); + rFillProperties.maFillColor.setSrgbClr( nPhClr ); + } + } applyBorder( rFilterBase, rTableStylePart, XML_left, rLeftBorder ); applyBorder( rFilterBase, rTableStylePart, XML_right, rRightBorder ); diff --git a/sd/qa/unit/data/pptx/bnc910045.pptx b/sd/qa/unit/data/pptx/bnc910045.pptx new file mode 100644 index 000000000000..5788ea929c0e Binary files /dev/null and b/sd/qa/unit/data/pptx/bnc910045.pptx differ diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index fb8264ea6e5c..d9d92b965563 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -97,6 +97,7 @@ public: void testPDFImport(); void testPDFImportSkipImages(); void testBulletSuffix(); + void testBnc910045(); CPPUNIT_TEST_SUITE(SdImportTest); @@ -132,6 +133,7 @@ public: CPPUNIT_TEST(testPDFImport); CPPUNIT_TEST(testPDFImportSkipImages); CPPUNIT_TEST(testBulletSuffix); + CPPUNIT_TEST(testBnc910045); CPPUNIT_TEST_SUITE_END(); }; @@ -1139,6 +1141,27 @@ void SdImportTest::testBulletSuffix() xDocShRef->DoClose(); } +void SdImportTest::testBnc910045() +{ + // Problem with table style which defines cell color with fill style + ::sd::DrawDocShellRef xDocShRef = loadURL( getURLFromSrc("/sd/qa/unit/data/pptx/bnc910045.pptx"), PPTX ); + + SdDrawDocument *pDoc = xDocShRef->GetDoc(); + CPPUNIT_ASSERT_MESSAGE( "no document", pDoc != NULL ); + const SdrPage *pPage = pDoc->GetPage(1); + CPPUNIT_ASSERT_MESSAGE( "no page", pPage != NULL ); + + sdr::table::SdrTableObj *pTableObj = dynamic_cast(pPage->GetObj(0)); + CPPUNIT_ASSERT( pTableObj ); + uno::Reference< table::XCellRange > xTable(pTableObj->getTable(), uno::UNO_QUERY_THROW); + uno::Reference< beans::XPropertySet > xCell; + sal_Int32 nColor; + + xCell.set(xTable->getCellByPosition(0, 0), uno::UNO_QUERY_THROW); + xCell->getPropertyValue("FillColor") >>= nColor; + CPPUNIT_ASSERT_EQUAL(sal_Int32(5210557), nColor); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest); CPPUNIT_PLUGIN_IMPLEMENT();