oox/source/drawingml/shape.cxx                           |    6 ++++
 sd/qa/unit/data/pptx/tdf149588_transparentSolidFill.pptx |binary
 sd/qa/unit/import-tests2.cxx                             |   20 +++++++++++++++
 3 files changed, 26 insertions(+)

New commits:
commit 0cc9aaae5dc6655490513e8e4a93967f6248e23c
Author:     Attila Szűcs <attila.sz...@collabora.com>
AuthorDate: Wed Jan 4 00:40:23 2023 +0100
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Wed Jan 4 20:38:38 2023 +0000

    tdf#149588 pptx import: transparency at SolidFill
    
    When copied color (RGB) property from text content to shape,
    copy alpha component as well. (If text color have alpha component)
    
    Change-Id: Ib86c48ab7b2d3c5f9491a2211b05e90b2c2ea10f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145031
    Tested-by: Jenkins
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index fcc1e9016170..7cd02f77f91f 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -708,6 +708,12 @@ static void lcl_copyCharPropsToShape(const 
uno::Reference<drawing::XShape>& xSha
                 aFillColor = static_cast<sal_Int32>(
                     
rCharProps.maFillProperties.maFillColor.getColor(rFilter.getGraphicHelper())
                         .GetRGBColor());
+                if (rCharProps.maFillProperties.maFillColor.hasTransparency())
+                {
+                    const sal_Int16 aTransparence
+                        = 
rCharProps.maFillProperties.maFillColor.getTransparency();
+                    xSet->setPropertyValue(UNO_NAME_FILL_TRANSPARENCE, 
uno::Any(aTransparence));
+                }
             }
             xSet->setPropertyValue(UNO_NAME_FILLCOLOR, uno::Any(aFillColor));
 
diff --git a/sd/qa/unit/data/pptx/tdf149588_transparentSolidFill.pptx 
b/sd/qa/unit/data/pptx/tdf149588_transparentSolidFill.pptx
new file mode 100644
index 000000000000..8967590b9284
Binary files /dev/null and 
b/sd/qa/unit/data/pptx/tdf149588_transparentSolidFill.pptx differ
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index b258c535e2c6..5d5864a2891e 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -145,6 +145,7 @@ public:
     void testTdf89928BlackWhiteThreshold();
     void testTdf151547TransparentWhiteText();
     void testTdf149961AutofitIndentation();
+    void testTdf149588TransparentSolidFill();
 
     CPPUNIT_TEST_SUITE(SdImportTest2);
 
@@ -223,6 +224,7 @@ public:
     CPPUNIT_TEST(testTdf89928BlackWhiteThreshold);
     CPPUNIT_TEST(testTdf151547TransparentWhiteText);
     CPPUNIT_TEST(testTdf149961AutofitIndentation);
+    CPPUNIT_TEST(testTdf149588TransparentSolidFill);
 
     CPPUNIT_TEST_SUITE_END();
 };
@@ -2009,6 +2011,24 @@ void SdImportTest2::testTdf149961AutofitIndentation()
     }
 }
 
+void SdImportTest2::testTdf149588TransparentSolidFill()
+{
+    createSdImpressDoc("pptx/tdf149588_transparentSolidFill.pptx");
+    saveAndReload("Impress MS PowerPoint 2007 XML");
+
+    uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(6, 0));
+    uno::Reference<text::XTextRange> xParagraph(getParagraphFromShape(0, 
xShape));
+    uno::Reference<text::XTextRange> xRun(getRunFromParagraph(0, xParagraph));
+    uno::Reference<beans::XPropertySet> xPropSet(xRun, uno::UNO_QUERY_THROW);
+
+    Color nCharColor;
+    xPropSet->getPropertyValue("CharColor") >>= nCharColor;
+    // Without the accompanying fix in place, this test would have failed with:
+    // - Expected: Color: R:99 G:99 B:99 A   51  (T:204)
+    // - Actual  : Color: R:99 G:99 B:99 A: 255  (T:  0)
+    CPPUNIT_ASSERT_EQUAL(Color(ColorTransparency, 0xCC636363), nCharColor);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdImportTest2);
 
 CPPUNIT_PLUGIN_IMPLEMENT();

Reply via email to