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 dc75d3cc5f2797dd5a8675004302a52bda1210c6 Author: Tamás Zolnai <tamas.zol...@collabora.com> AuthorDate: Thu May 9 13:03:13 2019 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Sat May 11 10:07:06 2019 +0200 PPTX: Fix import / export of image transparency Reviewed-on: https://gerrit.libreoffice.org/71916 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Tamás Zolnai <tamas.zol...@collabora.com> (cherry picked from commit ae3aabdb951643af8d2f7aee9c9f900245e5b384) Change-Id: Ib07c606083b833389fcb82aac57ca8535d6e861f Reviewed-on: https://gerrit.libreoffice.org/72051 Tested-by: Jenkins Reviewed-by: Andras Timar <andras.ti...@collabora.com> diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx index b255116b4a7b..a2fb6ee7a6c6 100644 --- a/oox/source/drawingml/fillproperties.cxx +++ b/oox/source/drawingml/fillproperties.cxx @@ -755,6 +755,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 a797adbc1f1e..23065ec67678 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -1154,14 +1154,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 f649d2723044..7cc50e21f963 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -101,6 +101,7 @@ public: void testTdf111884(); void testTdf112633(); void testCustomXml(); + void testPictureTransparency(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest1); @@ -131,6 +132,7 @@ public: CPPUNIT_TEST(testTdf111884); CPPUNIT_TEST(testTdf112633); CPPUNIT_TEST(testCustomXml); + CPPUNIT_TEST(testPictureTransparency); CPPUNIT_TEST_SUITE_END(); @@ -853,6 +855,30 @@ void SdOOXMLExportTest1::testCustomXml() CPPUNIT_ASSERT(pStream); } +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