[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-6.0' - oox/source sd/qa

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Fri May 10 06:23:46 UTC 2019


 oox/source/drawingml/fillproperties.cxx    |    5 +++++
 oox/source/export/drawingml.cxx            |    4 ++--
 sd/qa/unit/data/odp/image_transparency.odp |binary
 sd/qa/unit/export-tests-ooxml1.cxx         |   26 ++++++++++++++++++++++++++
 4 files changed, 33 insertions(+), 2 deletions(-)

New commits:
commit c85ad47338e87b03186f717e35c8525c7d6c0875
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue May 7 21:39:40 2019 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Fri May 10 08:23:13 2019 +0200

    PPTX: Fix import / export of image transparency
    
    Reviewed-on: https://gerrit.libreoffice.org/71916
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>
    (cherry picked from commit ae3aabdb951643af8d2f7aee9c9f900245e5b384)
    
    Change-Id: Ib07c606083b833389fcb82aac57ca8535d6e861f
    Reviewed-on: https://gerrit.libreoffice.org/71933
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index 5e9d56b8ed8d..b521b3683a88 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -799,6 +799,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 78efe5275cfa..8846baa8395d 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1166,11 +1166,11 @@ OUString DrawingML::WriteBlip( const Reference< XPropertySet >& rXPropSet, const
     }
     sal_Int16 nBright = 0;
     sal_Int32 nContrast = 0;
-    sal_Int32 nTransparence = 0;
+    sal_Int16 nTransparence = 0;
 
     GET( nBright, AdjustLuminance );
     GET( nContrast, AdjustContrast );
-    GET( nTransparence, FillTransparence );
+    GET( nTransparence, Transparency );
 
     mpFS->startElementNS( XML_a, XML_blip,
             FSNS( XML_r, XML_embed), sRelId.toUtf8().getStr(),
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 3e328682f310..07a1de91c7eb 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();
 
@@ -894,6 +896,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();


More information about the Libreoffice-commits mailing list