diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2017-07-12 13:29:24 +0200 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2017-07-17 10:44:01 +0200 |
commit | e50d5b52637dec44f2934a21ca4b47a51e8298f0 (patch) | |
tree | c57121499befdc1f0482acb24eac739da7e2b453 | |
parent | 6f3b39499f9c6c88d637b621ef9ec6189d4fb9ff (diff) |
tdf#104743: Export transparency for bitmap fill/background
Change-Id: I951ce974320f2eb5a6d3304b66f89ce71b38982c
Reviewed-on: https://gerrit.libreoffice.org/39880
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
-rw-r--r-- | oox/source/export/drawingml.cxx | 10 | ||||
-rw-r--r-- | sd/qa/unit/data/pptx/page_transparent_bitmap.pptx | bin | 0 -> 29823 bytes | |||
-rw-r--r-- | sd/qa/unit/export-tests-ooxml2.cxx | 27 |
3 files changed, 37 insertions, 0 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx index ddb91babb7c5..b3c4f68a2607 100644 --- a/oox/source/export/drawingml.cxx +++ b/oox/source/export/drawingml.cxx @@ -976,9 +976,11 @@ OUString DrawingML::WriteBlip( const Reference< XPropertySet >& rXPropSet, const } sal_Int16 nBright = 0; sal_Int32 nContrast = 0; + sal_Int32 nTransparence = 0; GET( nBright, AdjustLuminance ); GET( nContrast, AdjustContrast ); + GET( nTransparence, FillTransparence ); mpFS->startElementNS( XML_a, XML_blip, FSNS( XML_r, XML_embed), sRelId.toUtf8().getStr(), @@ -990,6 +992,14 @@ OUString DrawingML::WriteBlip( const Reference< XPropertySet >& rXPropSet, const XML_contrast, nContrast ? I32S( nContrast*1000 ) : nullptr, FSEND ); } + + if( nTransparence ) + { + sal_Int32 nAlphaMod = (100 - nTransparence ) * PER_PERCENT; + mpFS->singleElementNS( XML_a, XML_alphaModFix, + XML_amt, I32S( nAlphaMod), FSEND ); + } + WriteArtisticEffect( rXPropSet ); mpFS->endElementNS( XML_a, XML_blip ); diff --git a/sd/qa/unit/data/pptx/page_transparent_bitmap.pptx b/sd/qa/unit/data/pptx/page_transparent_bitmap.pptx Binary files differnew file mode 100644 index 000000000000..ac1dd074b83f --- /dev/null +++ b/sd/qa/unit/data/pptx/page_transparent_bitmap.pptx diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx index 6dee57e3df3a..9d4a063a6e5c 100644 --- a/sd/qa/unit/export-tests-ooxml2.cxx +++ b/sd/qa/unit/export-tests-ooxml2.cxx @@ -97,6 +97,7 @@ public: void testTdf92076(); void testTdf59046(); void testTdf105739(); + void testPageBitmapWithTransparency(); CPPUNIT_TEST_SUITE(SdOOXMLExportTest2); @@ -121,6 +122,7 @@ public: CPPUNIT_TEST(testTdf92076); CPPUNIT_TEST(testTdf59046); CPPUNIT_TEST(testTdf105739); + CPPUNIT_TEST(testPageBitmapWithTransparency); CPPUNIT_TEST_SUITE_END(); @@ -777,6 +779,31 @@ void SdOOXMLExportTest2::testTdf105739() xShell->DoClose(); } +void SdOOXMLExportTest2::testPageBitmapWithTransparency() +{ + ::sd::DrawDocShellRef xDocShRef = loadURL( m_directories.getURLFromSrc("/sd/qa/unit/data/pptx/page_transparent_bitmap.pptx"), PPTX ); + + xDocShRef = saveAndReload( xDocShRef.get(), ODP ); + uno::Reference< drawing::XDrawPagesSupplier > xDoc( + xDocShRef->GetDoc()->getUnoModel(), uno::UNO_QUERY_THROW ); + CPPUNIT_ASSERT_EQUAL_MESSAGE( "There should be exactly one page", static_cast<sal_Int32>(1), xDoc->getDrawPages()->getCount() ); + + uno::Reference< drawing::XDrawPage > xPage( getPage( 0, xDocShRef ) ); + + uno::Reference< beans::XPropertySet > xPropSet( xPage, uno::UNO_QUERY ); + uno::Any aAny = xPropSet->getPropertyValue( "Background" ); + CPPUNIT_ASSERT_MESSAGE("Slide background is missing", aAny.hasValue()); + + uno::Reference< beans::XPropertySet > aXBackgroundPropSet; + aAny >>= aXBackgroundPropSet; + sal_Int32 nTransparence; + aAny = aXBackgroundPropSet->getPropertyValue( "FillTransparence" ); + aAny >>= nTransparence; + CPPUNIT_ASSERT_EQUAL_MESSAGE("Slide background transparency is wrong", sal_Int32(49), nTransparence); + + xDocShRef->DoClose(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2); |