diff options
-rw-r--r-- | oox/source/shape/ShapeContextHandler.cxx | 2 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlimport/data/picture-with-schemecolor.docx | bin | 0 -> 35489 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlimport/ooxmlimport.cxx | 23 |
3 files changed, 24 insertions, 1 deletions
diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx index 34ddd3db76f8..eeb70ae76943 100644 --- a/oox/source/shape/ShapeContextHandler.cxx +++ b/oox/source/shape/ShapeContextHandler.cxx @@ -272,7 +272,7 @@ void SAL_CALL ShapeContextHandler::startFastElement mpThemePtr.reset(new Theme()); - if (Element == DGM_TOKEN(relIds) || Element == LC_TOKEN(lockedCanvas) || Element == C_TOKEN(chart) || Element == WPS_TOKEN(wsp) || Element == WPG_TOKEN(wgp)) + if (Element == DGM_TOKEN(relIds) || Element == LC_TOKEN(lockedCanvas) || Element == C_TOKEN(chart) || Element == WPS_TOKEN(wsp) || Element == WPG_TOKEN(wgp) || PPT_TOKEN( pic )) { // Parse the theme relation, if available; the diagram won't have colors without it. if (!msRelationFragmentPath.isEmpty()) diff --git a/sw/qa/extras/ooxmlimport/data/picture-with-schemecolor.docx b/sw/qa/extras/ooxmlimport/data/picture-with-schemecolor.docx Binary files differnew file mode 100644 index 000000000000..bfee0e1415e8 --- /dev/null +++ b/sw/qa/extras/ooxmlimport/data/picture-with-schemecolor.docx diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 8195558a545f..15c3fdf4f18d 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -1813,6 +1813,29 @@ DECLARE_OOXMLIMPORT_TEST(testDMLShapeFillBitmapCrop, "dml-shape-fillbitmapcrop.d CPPUNIT_ASSERT_EQUAL( sal_Int32( 0 ), aGraphicCropStruct.Bottom ); } + +DECLARE_OOXMLIMPORT_TEST(testPictureWithSchemeColor, "picture-with-schemecolor.docx") +{ + // At the start of the document, a picture which has a color specified with a color scheme, lost + // it's color during import. + uno::Reference<beans::XPropertySet> xImage(getShape(1), uno::UNO_QUERY); + uno::Reference<graphic::XGraphic> xGraphic = getProperty<uno::Reference<graphic::XGraphic> >(xImage, "Graphic"); + uno::Reference<awt::XBitmap> xBitmap(xGraphic, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(341), xBitmap->getSize().Width ); + CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int32>(181), xBitmap->getSize().Height ); + + // Check some bits of the bitmap which change when color is imported. + const uno::Sequence< sal_Int8 > aDIB = xBitmap->getDIB(); + CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int8>(-91), aDIB[54] ); + CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int8>(110), aDIB[55] ); + CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int8>(49), aDIB[56] ); + CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int8>(-36), aDIB[96] ); + CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int8>(-57), aDIB[97] ); + CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int8>(-80), aDIB[98] ); + CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int8>(-91), aDIB[135] ); + CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int8>(110), aDIB[136] ); + CPPUNIT_ASSERT_EQUAL( static_cast<sal_Int8>(49), aDIB[137] ); +} #endif CPPUNIT_PLUGIN_IMPLEMENT(); |