oox/source/drawingml/textcharacterproperties.cxx |    5 +++++
 sd/qa/unit/data/pptx/tdf118776.pptx              |binary
 sd/qa/unit/import-tests2.cxx                     |   23 +++++++++++++++++++++++
 3 files changed, 28 insertions(+)

New commits:
commit 823a351adb0384598304d597ae7f637079ca6175
Author:     Justin Luth <justin_l...@sil.org>
AuthorDate: Tue Nov 16 13:46:07 2021 +0200
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Sat Nov 20 15:13:02 2021 +0100

    tdf#118776 drawingml: treat XML_nofill as (mostly) transparent
    
    100% transparent typically ends up as COL_AUTO which
    certainly doesn't do what is intended.
    So set as 99% transparent to get effectively
    the same invisible effect.
    
    Adapted patch and re-used unit test from an earlier
    commit authored by Xisco. This depends on tdf#137438
    not spamming the text properties with outline props.
    
    Only one existing unit test that matched this condition:
    -export-tests-ooxml1.cxx customxml.pptx
       -empty textbox - text entered here SHOULD be invisible.
    
    Change-Id: I077b748e500713188421f0eeefdfd85c46555e84
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/125301
    Tested-by: Jenkins
    Tested-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org>
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/oox/source/drawingml/textcharacterproperties.cxx 
b/oox/source/drawingml/textcharacterproperties.cxx
index 9200e9666cbf..a34cb14af639 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -111,6 +111,11 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& 
rPropMap, const XmlFil
     if ( maFillProperties.moFillType.has() )
     {
         Color aColor = maFillProperties.getBestSolidColor();
+
+        // noFill doesn't exist for characters. Map noFill to 99% transparency
+        if (maFillProperties.moFillType.get() == XML_noFill)
+            aColor.addTransformation(XML_alpha, 1000);
+
         // tdf#137438 Emulate text outline color/transparency.
         // If the outline color dominates, then use it as the text color.
         if (moTextOutlineProperties.has()
diff --git a/sd/qa/unit/data/pptx/tdf118776.pptx 
b/sd/qa/unit/data/pptx/tdf118776.pptx
new file mode 100644
index 000000000000..8df94522ab29
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf118776.pptx differ
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index 9a5021f533b6..c299ad4303dd 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -118,6 +118,7 @@ public:
     void testTdf103792();
     void testTdf103876();
     void testTdf79007();
+    void testTdf118776();
     void testTdf129686();
     void testTdf104015();
     void testTdf104201();
@@ -183,6 +184,7 @@ public:
     CPPUNIT_TEST(testTdf103792);
     CPPUNIT_TEST(testTdf103876);
     CPPUNIT_TEST(testTdf79007);
+    CPPUNIT_TEST(testTdf118776);
     CPPUNIT_TEST(testTdf129686);
     CPPUNIT_TEST(testTdf104015);
     CPPUNIT_TEST(testTdf104201);
@@ -547,6 +549,27 @@ void SdImportTest2::testTdf79007()
     xDocShRef->DoClose();
 }
 
+void SdImportTest2::testTdf118776()
+{
+    sd::DrawDocShellRef xDocShRef
+        = 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf118776.pptx"), 
PPTX);
+    uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0, 
xDocShRef));
+
+    // Get first paragraph of the text
+    uno::Reference<text::XTextRange> const xParagraph(getParagraphFromShape(0, 
xShape));
+
+    // Get first run of the paragraph
+    uno::Reference<text::XTextRange> xRun(getRunFromParagraph(0, xParagraph));
+    uno::Reference<beans::XPropertySet> xPropSet(xRun, uno::UNO_QUERY_THROW);
+    sal_Int16 nTransparency = 0;
+    xPropSet->getPropertyValue("CharTransparence") >>= nTransparency;
+
+    // Import noFill color as 99% transparency
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(99), nTransparency);
+
+    xDocShRef->DoClose();
+}
+
 void SdImportTest2::testTdf129686()
 {
     sd::DrawDocShellRef xDocShRef

Reply via email to