oox/source/drawingml/fillproperties.cxx | 3 +++ sd/qa/unit/data/pptx/tdf112209.pptx |binary sd/qa/unit/import-tests2.cxx | 26 ++++++++++++++++++++++++++ 3 files changed, 29 insertions(+)
New commits: commit 5a0ad13545197a4a66e0bc4933418110f73c1e9e Author: Tünde Tóth <[email protected]> AuthorDate: Wed Jan 19 14:53:50 2022 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Thu Feb 3 11:50:29 2022 +0100 tdf#112209 PPTX import: fix grayscale effect on image filled shape Some image filled shapes with grayscale effect in PPTX documents created with PowerPoint were not grayscale in Impress. Change-Id: I0a89f283f525eb47c21c5d5fa788484d8074a7e4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128616 Tested-by: Jenkins Tested-by: László Németh <[email protected]> Reviewed-by: László Németh <[email protected]> (cherry picked from commit 1bce0e3004e3ec9d62a3c43801f8f2e8ef5f7fdb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129342 Reviewed-by: Xisco Fauli <[email protected]> diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index 480bbe641737..5d17c321d0f8 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -722,6 +722,9 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap, if (xGraphic.is()) { + if (maBlipProps.moColorEffect.get(XML_TOKEN_INVALID) == XML_grayscl) + xGraphic = lclGreysScaleGraphic(xGraphic); + if (rPropMap.supportsProperty(ShapeProperty::FillBitmapName) && rPropMap.setProperty(ShapeProperty::FillBitmapName, xGraphic)) { diff --git a/sd/qa/unit/data/pptx/tdf112209.pptx b/sd/qa/unit/data/pptx/tdf112209.pptx new file mode 100644 index 000000000000..80865820dfad Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf112209.pptx differ diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx index c299ad4303dd..b62573ec354b 100644 --- a/sd/qa/unit/import-tests2.cxx +++ b/sd/qa/unit/import-tests2.cxx @@ -171,6 +171,7 @@ public: void testTdf49856(); void testTdf103347(); void testHyperlinksOnShapes(); + void testTdf112209(); CPPUNIT_TEST_SUITE(SdImportTest2); @@ -234,6 +235,7 @@ public: CPPUNIT_TEST(testTdf134210CropPosition); CPPUNIT_TEST(testTdf103347); CPPUNIT_TEST(testHyperlinksOnShapes); + CPPUNIT_TEST(testTdf112209); CPPUNIT_TEST_SUITE_END(); }; @@ -1908,6 +1910,30 @@ void SdImportTest2::testHyperlinksOnShapes() xDocShRef->DoClose(); } +void SdImportTest2::testTdf112209() +{ + sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc(u"sd/qa/unit/data/pptx/tdf112209.pptx"), PPTX); + uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0, xDocShRef), + uno::UNO_SET_THROW); + CPPUNIT_ASSERT(xShape.is()); + + uno::Reference<graphic::XGraphic> xGraphic; + xShape->getPropertyValue("FillBitmap") >>= xGraphic; + CPPUNIT_ASSERT(xGraphic.is()); + + Graphic aGraphic(xGraphic); + BitmapEx aBitmap(aGraphic.GetBitmapEx()); + + // Without the accompanying fix in place, this test would have failed with: + // - Expected: Color: R:132 G:132 B:132 A:0 + // - Actual : Color: R:21 G:170 B:236 A:0 + // i.e. the image color was blue instead of grey. + CPPUNIT_ASSERT_EQUAL(Color(0x848484), aBitmap.GetPixelColor(0, 0)); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest2); CPPUNIT_PLUGIN_IMPLEMENT();
