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

Balazs Varga (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 26 06:27:15 UTC 2019


 chart2/qa/extras/chart2import.cxx                 |   32 ++++++++++++++++++++++
 chart2/qa/extras/data/xlsx/tdf124817.xlsx         |binary
 oox/source/drawingml/chart/typegroupconverter.cxx |   10 ++++++
 3 files changed, 41 insertions(+), 1 deletion(-)

New commits:
commit ca19c39695558092e943d2db7aec3d39bdfe17e1
Author:     Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Tue Jun 18 15:53:11 2019 +0200
Commit:     Xisco Faulí <xiscofauli at libreoffice.org>
CommitDate: Wed Jun 26 08:26:38 2019 +0200

    tdf#124817 OOXML chart import: fix missing symbols
    
    OOXML chart symbols with undefined fill color attribute were imported
    as invisible white symbols. Fixed by using line color of these symbols.
    
    Change-Id: Ie4314ed56b63daa82fe30b111aeae9e358ff2b4b
    Reviewed-on: https://gerrit.libreoffice.org/74286
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>
    (cherry picked from commit e98f19e598951a54561a7f414a209260b5e79a39)
    Reviewed-on: https://gerrit.libreoffice.org/74708
    Reviewed-by: Xisco Faulí <xiscofauli at libreoffice.org>

diff --git a/chart2/qa/extras/chart2import.cxx b/chart2/qa/extras/chart2import.cxx
index 5c7255a0e632..fa673ccbfde1 100644
--- a/chart2/qa/extras/chart2import.cxx
+++ b/chart2/qa/extras/chart2import.cxx
@@ -23,6 +23,8 @@
 #include <com/sun/star/chart/XAxisXSupplier.hpp>
 #include <com/sun/star/chart/MissingValueTreatment.hpp>
 #include <com/sun/star/chart2/TickmarkStyle.hpp>
+#include <com/sun/star/chart2/SymbolStyle.hpp>
+#include <com/sun/star/chart2/Symbol.hpp>
 #include <com/sun/star/container/XNamed.hpp>
 #include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
 #include <com/sun/star/chart/DataLabelPlacement.hpp>
@@ -71,6 +73,7 @@ public:
     void testTdf106217();
     void testTdf108021();
     void testTdf100084();
+    void testTdf124817();
     void testAutoBackgroundXLSX();
     void testAutoChartAreaBorderPropXLSX();
     void testChartAreaStyleBackgroundXLSX();
@@ -161,6 +164,7 @@ public:
     CPPUNIT_TEST(testTdf106217);
     CPPUNIT_TEST(testTdf108021);
     CPPUNIT_TEST(testTdf100084);
+    CPPUNIT_TEST(testTdf124817);
     CPPUNIT_TEST(testAutoBackgroundXLSX);
     CPPUNIT_TEST(testAutoChartAreaBorderPropXLSX);
     CPPUNIT_TEST(testChartAreaStyleBackgroundXLSX);
@@ -897,6 +901,34 @@ void Chart2ImportTest::testTdf100084()
     CPPUNIT_ASSERT_MESSAGE("There should be a Diagram.", xDiagram.is());
 }
 
+void Chart2ImportTest::testTdf124817()
+{
+    load("/chart2/qa/extras/data/xlsx/", "tdf124817.xlsx");
+    Reference<chart2::XChartDocument> xChartDoc = getChartDocFromSheet(0, mxComponent);
+    CPPUNIT_ASSERT_MESSAGE("failed to load chart", xChartDoc.is());
+
+    uno::Reference<chart2::XDataSeries> xDataSeries;
+    chart2::Symbol aSymblProp;
+
+    // Check the symbol of data series 1 (marker style none)
+    xDataSeries = getDataSeriesFromDoc(xChartDoc, 0);
+    CPPUNIT_ASSERT(xDataSeries.is());
+    uno::Reference<beans::XPropertySet> xPropSet_0(xDataSeries, uno::UNO_QUERY_THROW);
+    CPPUNIT_ASSERT((xPropSet_0->getPropertyValue("Symbol") >>= aSymblProp) && (aSymblProp.Style == chart2::SymbolStyle_NONE));
+
+    // Check the symbol of data series 2 (marker style square)
+    xDataSeries = getDataSeriesFromDoc(xChartDoc, 1);
+    CPPUNIT_ASSERT(xDataSeries.is());
+    uno::Reference<beans::XPropertySet> xPropSet_1(xDataSeries, uno::UNO_QUERY_THROW);
+    CPPUNIT_ASSERT((xPropSet_1->getPropertyValue("Symbol") >>= aSymblProp) && (aSymblProp.FillColor == static_cast<sal_Int32>(0xED7D31)));
+
+    // Check the symbol of data series 3 (marker style diagonal cross)
+    xDataSeries = getDataSeriesFromDoc(xChartDoc, 2);
+    CPPUNIT_ASSERT(xDataSeries.is());
+    uno::Reference<beans::XPropertySet> xPropSet_2(xDataSeries, uno::UNO_QUERY_THROW);
+    CPPUNIT_ASSERT((xPropSet_2->getPropertyValue("Symbol") >>= aSymblProp) && (aSymblProp.BorderColor == static_cast<sal_Int32>(0xFF0000)));
+}
+
 void Chart2ImportTest::testTransparentBackground(OUString const & filename)
 {
     load("/chart2/qa/extras/data/xlsx/", filename);
diff --git a/chart2/qa/extras/data/xlsx/tdf124817.xlsx b/chart2/qa/extras/data/xlsx/tdf124817.xlsx
new file mode 100644
index 000000000000..d9b09644e47e
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf124817.xlsx differ
diff --git a/oox/source/drawingml/chart/typegroupconverter.cxx b/oox/source/drawingml/chart/typegroupconverter.cxx
index bd592e6adbc5..35bb23a2ccf0 100644
--- a/oox/source/drawingml/chart/typegroupconverter.cxx
+++ b/oox/source/drawingml/chart/typegroupconverter.cxx
@@ -500,7 +500,15 @@ void TypeGroupConverter::convertMarker( PropertySet& rPropSet, sal_Int32 nOoxSym
         {
             Color aFillColor = xShapeProps->getFillProperties().maFillColor;
             aSymbol.FillColor = sal_Int32(aFillColor.getColor(getFilter().getGraphicHelper()));
-            rPropSet.setProperty(PROP_Color, aSymbol.FillColor);
+            // tdf#124817: if there is no fill color, use line color of the symbol
+            if( aSymbol.FillColor < 0 )
+            {
+                Color aLineColor = xShapeProps->getLineProperties().maLineFill.maFillColor;
+                aSymbol.BorderColor = sal_Int32(aLineColor.getColor(getFilter().getGraphicHelper()));
+                rPropSet.setProperty(PROP_Color, aSymbol.BorderColor);
+            }
+            else
+                rPropSet.setProperty(PROP_Color, aSymbol.FillColor);
         }
 
         // set the property


More information about the Libreoffice-commits mailing list