diff options
author | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-02-11 18:35:38 +0100 |
---|---|---|
committer | Zolnai Tamás <tamas.zolnai@collabora.com> | 2014-02-12 13:20:31 +0100 |
commit | 2efd433478cf4820b308b20cf42595345e023af2 (patch) | |
tree | 9ff1854fa52a4b3ef178877e5af2aadeb1f41a5b | |
parent | 682ab832522b1349f1714bcb16f6e83468ea2920 (diff) |
drawingML import: picture with scheme color
Theme fragment must be loaded for pictures too.
Change-Id: If4c412926319df2beaecfc120065bd011fc3eb57
-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(); |