oox/source/drawingml/fillproperties.cxx | 5 +++++ oox/source/export/drawingml.cxx | 6 +++--- sd/qa/unit/data/odp/image_transparency.odp |binary sd/qa/unit/export-tests-ooxml1.cxx | 26 ++++++++++++++++++++++++++ 4 files changed, 34 insertions(+), 3 deletions(-)
New commits: commit ae3aabdb951643af8d2f7aee9c9f900245e5b384 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Mon May 6 20:52:16 2019 +0200 Commit: Tamás Zolnai <tamas.zol...@collabora.com> CommitDate: Tue May 7 20:20:02 2019 +0200 PPTX: Fix import / export of image transparency Change-Id: Ib07c606083b833389fcb82aac57ca8535d6e861f Reviewed-on: https://gerrit.libreoffice.org/71916 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index 24e5e70d685d..0b99d83733f3 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -791,6 +791,11 @@ void GraphicProperties::pushToPropMap( PropertyMap& rPropMap, const GraphicHelpe rPropMap.setProperty(PROP_GraphicCrop, aGraphCrop); } } + + if ( maBlipProps.moAlphaModFix.has() ) + { + rPropMap.setProperty(PROP_Transparency, static_cast<sal_Int16>(100 - (maBlipProps.moAlphaModFix.get() / PER_PERCENT))); + } } rPropMap.setProperty(PROP_GraphicColorMode, eColorMode); diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index 1b3ec2d6986f..7a069945d571 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1205,14 +1205,14 @@ void DrawingML::WriteImageBrightnessContrastTransparence(uno::Reference<beans::X { sal_Int16 nBright = 0; sal_Int32 nContrast = 0; - sal_Int32 nTransparence = 0; + sal_Int16 nTransparence = 0; if (GetProperty(rXPropSet, "AdjustLuminance")) nBright = mAny.get<sal_Int16>(); if (GetProperty(rXPropSet, "AdjustContrast")) nContrast = mAny.get<sal_Int32>(); - if (GetProperty(rXPropSet, "FillTransparence")) - nTransparence = mAny.get<sal_Int32>(); + if (GetProperty(rXPropSet, "Transparency")) + nTransparence = mAny.get<sal_Int16>(); if (nBright || nContrast) diff --git a/sd/qa/unit/data/odp/image_transparency.odp b/sd/qa/unit/data/odp/image_transparency.odp new file mode 100644 index 000000000000..6d3f6c232d91 Binary files /dev/null and b/sd/qa/unit/data/odp/image_transparency.odp differ diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index e8ce39dc68a0..25cd15c63131 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -103,6 +103,7 @@ public: void testTdf112633(); void testCustomXml(); void testTdf94238(); + void testPictureTransparency(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest1); @@ -134,6 +135,7 @@ public: CPPUNIT_TEST(testTdf112633); CPPUNIT_TEST(testCustomXml); CPPUNIT_TEST(testTdf94238); + CPPUNIT_TEST(testPictureTransparency); CPPUNIT_TEST_SUITE_END(); @@ -882,6 +884,30 @@ void SdOOXMLExportTest1::testTdf94238() xDocShRef->DoClose(); } +void SdOOXMLExportTest1::testPictureTransparency() +{ + // Load document and export it to a temporary file. + ::sd::DrawDocShellRef xDocShRef + = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/image_transparency.odp"), ODP); + utl::TempFile tempFile; + xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile); + uno::Reference<drawing::XDrawPagesSupplier> xDoc(xDocShRef->GetDoc()->getUnoModel(), + uno::UNO_QUERY); + CPPUNIT_ASSERT(xDoc.is()); + + uno::Reference<drawing::XDrawPage> xPage(xDoc->getDrawPages()->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT(xPage.is()); + + uno::Reference<beans::XPropertySet> xGraphicShape(getShape(0, xPage)); + CPPUNIT_ASSERT(xGraphicShape.is()); + + sal_Int16 nTransparency = 0; + CPPUNIT_ASSERT(xGraphicShape->getPropertyValue("Transparency") >>= nTransparency); + CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(51), nTransparency); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest1); CPPUNIT_PLUGIN_IMPLEMENT(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits