[Libreoffice-commits] core.git: oox/source sd/qa

Katarina Behrens Katarina.Behrens at cib.de
Mon Jul 17 08:44:35 UTC 2017


 oox/source/export/drawingml.cxx                   |   10 ++++++++
 sd/qa/unit/data/pptx/page_transparent_bitmap.pptx |binary
 sd/qa/unit/export-tests-ooxml2.cxx                |   27 ++++++++++++++++++++++
 3 files changed, 37 insertions(+)

New commits:
commit e50d5b52637dec44f2934a21ca4b47a51e8298f0
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Wed Jul 12 13:29:24 2017 +0200

    tdf#104743: Export transparency for bitmap fill/background
    
    Change-Id: I951ce974320f2eb5a6d3304b66f89ce71b38982c
    Reviewed-on: https://gerrit.libreoffice.org/39880
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>

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
new file mode 100644
index 000000000000..ac1dd074b83f
Binary files /dev/null and b/sd/qa/unit/data/pptx/page_transparent_bitmap.pptx differ
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);
 


More information about the Libreoffice-commits mailing list