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

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Mon Nov 25 11:44:09 UTC 2019


 oox/source/drawingml/textcharacterproperties.cxx |    7 ++++++-
 sd/qa/unit/data/pptx/tdf118776.pptx              |binary
 sd/qa/unit/import-tests.cxx                      |   22 ++++++++++++++++++++++
 3 files changed, 28 insertions(+), 1 deletion(-)

New commits:
commit e01df3488abe6d319c6874ca870afb82a3ad9b1e
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Sun Oct 13 20:59:20 2019 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Nov 25 12:43:25 2019 +0100

    tdf#118776: pptx import: draw char noFill as transparent
    
    The problem is that LibreOffice doesn't have the property
    fill=none for text
    
    Change-Id: I0c7c62be102e05729f0b2cf09d95e208694b1d2b
    Reviewed-on: https://gerrit.libreoffice.org/80743
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx
index de47058e60ca..54b939ac6827 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -113,7 +113,12 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil
         Color aColor = maFillProperties.getBestSolidColor();
         rPropMap.setProperty(PROP_CharColor, aColor.getColor(rFilter.getGraphicHelper()));
 
-        if (aColor.hasTransparency())
+        if( maFillProperties.moFillType.get() == XML_noFill )
+        {
+            // noFill doesn't exist for characters. Map noFill to 99% transparency
+            rPropMap.setProperty(PROP_CharTransparence, sal_Int16((MAX_PERCENT - 1) / PER_PERCENT) );
+        }
+        else if (aColor.hasTransparency())
         {
             rPropMap.setProperty(PROP_CharTransparence, aColor.getTransparency());
         }
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-tests.cxx b/sd/qa/unit/import-tests.cxx
index 3b50bce311ad..779a6503577a 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -169,6 +169,7 @@ public:
     void testAoo124143();
     void testTdf103567();
     void testTdf103792();
+    void testTdf118776();
     void testTdf103876();
     void testTdf79007();
     void testTdf104015();
@@ -271,6 +272,7 @@ public:
     CPPUNIT_TEST(testAoo124143);
     CPPUNIT_TEST(testTdf103567);
     CPPUNIT_TEST(testTdf103792);
+    CPPUNIT_TEST(testTdf118776);
     CPPUNIT_TEST(testTdf103876);
     CPPUNIT_TEST(testTdf79007);
     CPPUNIT_TEST(testTdf104015);
@@ -1760,6 +1762,26 @@ void SdImportTest::testTdf103792()
     xDocShRef->DoClose();
 }
 
+void SdImportTest::testTdf118776()
+{
+    sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("/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 SdImportTest::testTdf103876()
 {
     // Title text shape's placeholder text did not inherit the corresponding text properties


More information about the Libreoffice-commits mailing list