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

Tamás Zolnai tamas.zolnai at collabora.com
Sun Jan 28 13:35:10 UTC 2018


 oox/source/export/drawingml.cxx     |    9 +++++++--
 sd/qa/unit/data/pptx/tdf111786.pptx |binary
 sd/qa/unit/export-tests-ooxml2.cxx  |   23 +++++++++++++++++++++++
 3 files changed, 30 insertions(+), 2 deletions(-)

New commits:
commit 69acbf1994a2fd8606b119e7716996fb103b75c8
Author: Tamás Zolnai <tamas.zolnai at collabora.com>
Date:   Sun Jan 28 08:34:00 2018 +0100

    tdf#111786: PPTX export: Shape's line transparency is not exported
    
    Change-Id: Iab11906e6ed79e1e39bba1b07b50a25887517f3a
    Reviewed-on: https://gerrit.libreoffice.org/48763
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tamás Zolnai <tamas.zolnai at collabora.com>

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 5af5dce2d12f..1deec7c82f74 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -577,6 +577,7 @@ void DrawingML::WriteOutline( const Reference<XPropertySet>& rXPropSet )
 
     sal_uInt32 nLineWidth = 0;
     sal_uInt32 nColor = 0;
+    sal_Int32 nColorAlpha = MAX_PERCENT;
     bool bColorSet = false;
     const char* cap = nullptr;
     drawing::LineDash aLineDash;
@@ -656,6 +657,10 @@ void DrawingML::WriteOutline( const Reference<XPropertySet>& rXPropSet )
                 nColor = mAny.get<sal_uInt32>() & 0xffffff;
                 bColorSet = true;
             }
+            if ( GETA( LineTransparence ) )
+            {
+                nColorAlpha = MAX_PERCENT - (mAny.get<sal_Int16>() * PER_PERCENT);
+            }
             break;
     }
 
@@ -670,7 +675,7 @@ void DrawingML::WriteOutline( const Reference<XPropertySet>& rXPropSet )
         if( nColor != nOriginalColor )
         {
             // the user has set a different color for the line
-            WriteSolidFill( nColor );
+            WriteSolidFill( nColor, nColorAlpha );
         }
         else if( !sColorFillScheme.isEmpty() )
         {
@@ -687,7 +692,7 @@ void DrawingML::WriteOutline( const Reference<XPropertySet>& rXPropSet )
         }
         else
         {
-            WriteSolidFill( nColor );
+            WriteSolidFill( nColor, nColorAlpha );
         }
     }
 
diff --git a/sd/qa/unit/data/pptx/tdf111786.pptx b/sd/qa/unit/data/pptx/tdf111786.pptx
new file mode 100755
index 000000000000..5d8f62b24a40
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf111786.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index acb6256c0c40..b530790b038a 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -127,6 +127,7 @@ public:
     void testTdf68759();
     void testTdf90626();
     void testTdf107608();
+    void testTdf111786();
 
     CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
@@ -179,6 +180,7 @@ public:
     CPPUNIT_TEST(testTdf68759);
     CPPUNIT_TEST(testTdf90626);
     CPPUNIT_TEST(testTdf107608);
+    CPPUNIT_TEST(testTdf111786);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -1379,6 +1381,27 @@ void SdOOXMLExportTest2::testTdf107608()
     xDocShRef->DoClose();
 }
 
+void SdOOXMLExportTest2::testTdf111786()
+{
+    // Export line transparency with the color
+    ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/tdf111786.pptx"), PPTX);
+    utl::TempFile tempFile;
+    xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+
+    uno::Reference< beans::XPropertySet > xShape( getShapeFromPage( 0, 0, xDocShRef ) );
+    uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY_THROW );
+
+    sal_uInt32 nLineColor;
+    xPropSet->getPropertyValue("LineColor") >>= nLineColor;
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(0x3465A4), nLineColor);
+
+    sal_Int16 nTransparency;
+    xPropSet->getPropertyValue("LineTransparence") >>= nTransparency;
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(33), nTransparency);
+
+    xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();


More information about the Libreoffice-commits mailing list