summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZolnai Tamás <tamas.zolnai@collabora.com>2014-12-05 19:23:01 +0100
committerAndras Timar <andras.timar@collabora.com>2015-03-31 18:09:13 +0200
commit0207796fe509e8d00a7101d4da8f8301cb58a099 (patch)
tree1ce950525cd584096d38a836d01b501d9cc52fd8
parent6a1cca9b467f1f7205aac5734fdb20b7f7d410f0 (diff)
bnc#910045 wrong cell fill color defined by table style
Problems were with those table styles which used color themes to define cell fill color. Reviewed-on: https://gerrit.libreoffice.org/15089 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Andras Timar <andras.timar@collabora.com> (cherry picked from commit debf3ffb87d607704ddea97f6710c3ceaa9a243d) Signed-off-by: Andras Timar <andras.timar@collabora.com> Conflicts: sd/qa/unit/import-tests.cxx Change-Id: Ibde90df81ff253ba65618dde4038093d1caabfe8
-rw-r--r--oox/source/drawingml/table/tablecell.cxx11
-rw-r--r--sd/qa/unit/data/pptx/bnc910045.pptxbin0 -> 37522 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx23
3 files changed, 34 insertions, 0 deletions
diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx
index 45486fd16377..c94848aa46db 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
--- /dev/null
+++ b/sd/qa/unit/data/pptx/bnc910045.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index a9d55c528c24..c9de7bdf8534 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -96,6 +96,7 @@ public:
void testBnc862510_7();
void testPDFImport();
void testPDFImportSkipImages();
+ void testBnc910045();
CPPUNIT_TEST_SUITE(SdImportTest);
@@ -129,6 +130,7 @@ public:
CPPUNIT_TEST(testBnc862510_6);
CPPUNIT_TEST(testBnc862510_7);
CPPUNIT_TEST(testPDFImport);
+ CPPUNIT_TEST(testBnc910045);
CPPUNIT_TEST_SUITE_END();
};
@@ -1112,6 +1114,27 @@ void SdImportTest::testPDFImportSkipImages()
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<sdr::table::SdrTableObj*>(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();