[Libreoffice-commits] core.git: Branch 'libreoffice-6-3' - oox/source sd/qa

Xisco Fauli (via logerrit) logerrit at kemper.freedesktop.org
Fri Oct 18 09:15:18 UTC 2019


 oox/source/export/drawingml.cxx    |   18 ++++++++++++++++++
 sd/qa/unit/data/odp/tdf127901.odp  |binary
 sd/qa/unit/export-tests-ooxml2.cxx |   21 +++++++++++++++++++++
 3 files changed, 39 insertions(+)

New commits:
commit ff2f0e839f7b7ef5e79b8ec4311c971c0e8053f9
Author:     Xisco Fauli <xiscofauli at libreoffice.org>
AuthorDate: Tue Oct 1 21:05:10 2019 +0200
Commit:     Michael Stahl <michael.stahl at cib.de>
CommitDate: Fri Oct 18 11:14:26 2019 +0200

    tdf#127901: pptx export image greyscale, watermark, black/white
    
    Similar to 0db96caf0fcce09b87621c11b584a6d81cc7df86
    
    Change-Id: I5c3ec17c7a3472629ba8a63ab500175add36ee8e
    Reviewed-on: https://gerrit.libreoffice.org/79994
    Tested-by: Jenkins
    Reviewed-by: Xisco FaulĂ­ <xiscofauli at libreoffice.org>
    (cherry picked from commit cb5eaa791739865d54b381c16c60224c432171dc)
    Reviewed-on: https://gerrit.libreoffice.org/80014
    Reviewed-by: Michael Stahl <michael.stahl at cib.de>

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 2d7b300e51e3..60b674287a43 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -54,6 +54,7 @@
 #include <com/sun/star/container/XIndexAccess.hpp>
 #include <com/sun/star/document/XStorageBasedDocument.hpp>
 #include <com/sun/star/drawing/BitmapMode.hpp>
+#include <com/sun/star/drawing/ColorMode.hpp>
 #include <com/sun/star/drawing/EnhancedCustomShapeAdjustmentValue.hpp>
 #include <com/sun/star/drawing/EnhancedCustomShapeParameterType.hpp>
 #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
@@ -1285,6 +1286,23 @@ void DrawingML::WriteImageBrightnessContrastTransparence(uno::Reference<beans::X
     if (nTransparence == 0 && GetProperty(rXPropSet, "Transparency"))
         nTransparence = static_cast<sal_Int32>(mAny.get<sal_Int16>());
 
+    if (GetProperty(rXPropSet, "GraphicColorMode"))
+    {
+        drawing::ColorMode aColorMode;
+        mAny >>= aColorMode;
+        if (aColorMode == drawing::ColorMode_GREYS)
+            mpFS->singleElementNS(XML_a, XML_grayscl);
+        else if (aColorMode == drawing::ColorMode_MONO)
+            //black/white has a 0,5 threshold in LibreOffice
+            mpFS->singleElementNS(XML_a, XML_biLevel, XML_thresh, OString::number(50000));
+        else if (aColorMode == drawing::ColorMode_WATERMARK)
+        {
+            //map watermark with mso washout
+            nBright = 70;
+            nContrast = -70;
+        }
+    }
+
 
     if (nBright || nContrast)
     {
diff --git a/sd/qa/unit/data/odp/tdf127901.odp b/sd/qa/unit/data/odp/tdf127901.odp
new file mode 100644
index 000000000000..e1c5dfad3fae
Binary files /dev/null and b/sd/qa/unit/data/odp/tdf127901.odp differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 239a362514d9..f820160837e2 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -170,6 +170,7 @@ public:
     void testThemeColors();
     void testTdf114848();
     void testTdf68759();
+    void testTdf127901();
     void testTdf90626();
     void testTdf107608();
     void testTdf111786();
@@ -264,6 +265,7 @@ public:
     CPPUNIT_TEST(testThemeColors);
     CPPUNIT_TEST(testTdf114848);
     CPPUNIT_TEST(testTdf68759);
+    CPPUNIT_TEST(testTdf127901);
     CPPUNIT_TEST(testTdf90626);
     CPPUNIT_TEST(testTdf107608);
     CPPUNIT_TEST(testTdf111786);
@@ -1560,6 +1562,25 @@ void SdOOXMLExportTest2::testTdf68759()
 
 }
 
+void SdOOXMLExportTest2::testTdf127901()
+{
+    ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf127901.odp"), ODP);
+    utl::TempFile tempFile;
+    xDocShRef = saveAndReload(xDocShRef.get(), PPTX, &tempFile);
+    xDocShRef->DoClose();
+
+    xmlDocPtr pXmlDocContent1 = parseExport(tempFile, "ppt/slides/slide1.xml");
+    assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:lum", "bright", "70000");
+    assertXPath(pXmlDocContent1, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:lum", "contrast", "-70000");
+
+    xmlDocPtr pXmlDocContent2 = parseExport(tempFile, "ppt/slides/slide2.xml");
+    assertXPath(pXmlDocContent2, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:grayscl", 1);
+
+    xmlDocPtr pXmlDocContent3 = parseExport(tempFile, "ppt/slides/slide3.xml");
+    assertXPath(pXmlDocContent3, "/p:sld/p:cSld/p:spTree/p:pic/p:blipFill/a:blip/a:biLevel", "thresh", "50000");
+
+}
+
 void SdOOXMLExportTest2::testTdf90626()
 {
     ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/odp/tdf90626.odp"), ODP);


More information about the Libreoffice-commits mailing list