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

Balazs Varga (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 28 11:52:27 UTC 2019


 chart2/qa/extras/chart2export.cxx         |   18 ++++++++++++++++++
 chart2/qa/extras/data/xlsx/tdf126115.xlsx |binary
 include/oox/export/chartexport.hxx        |    2 +-
 oox/source/export/chartexport.cxx         |   25 ++++++++++++++++---------
 4 files changed, 35 insertions(+), 10 deletions(-)

New commits:
commit 0970a47ae926bb47458b846e9dc8ff6f3607250c
Author:     Balazs Varga <balazs.varga991 at gmail.com>
AuthorDate: Fri Jun 28 12:30:19 2019 +0200
Commit:     László Németh <nemeth at numbertext.org>
CommitDate: Fri Jun 28 13:51:43 2019 +0200

    tdf#126115 Chart OOXML Export: fix individual marker
    
    Export linechart custom (individual) datapoint marker
    settings into a <dPt> tag, as the OOXML Standard requires.
    
    Change-Id: I939196c9ea6e091ac9dadb4d62dd85d5408d599c
    Reviewed-on: https://gerrit.libreoffice.org/74837
    Tested-by: Jenkins
    Reviewed-by: László Németh <nemeth at numbertext.org>

diff --git a/chart2/qa/extras/chart2export.cxx b/chart2/qa/extras/chart2export.cxx
index 7a0abcf0bc02..f00959bdbfeb 100644
--- a/chart2/qa/extras/chart2export.cxx
+++ b/chart2/qa/extras/chart2export.cxx
@@ -73,6 +73,7 @@ public:
     void testFdo78290LineChartMarkerX();
     void testFdo78290ScatterChartMarkerX();
     void testFdo78290CombinationChartMarkerX();
+    void testTdf126115IndividualMarker();
     void testAxisNumberFormatODS();
     void testAxisNumberFormatXLS();
     void testDataLabelBordersDOCX();
@@ -170,6 +171,7 @@ public:
     CPPUNIT_TEST(testFdo78290LineChartMarkerX);
     CPPUNIT_TEST(testFdo78290ScatterChartMarkerX);
     CPPUNIT_TEST(testFdo78290CombinationChartMarkerX);
+    CPPUNIT_TEST(testTdf126115IndividualMarker);
     CPPUNIT_TEST(testAxisNumberFormatODS);
     CPPUNIT_TEST(testAxisNumberFormatXLS);
     CPPUNIT_TEST(testDataLabelBordersDOCX);
@@ -801,6 +803,22 @@ void Chart2ExportTest::testFdo78290CombinationChartMarkerX()
     assertXPath(pXmlDoc, "/c:chartSpace[1]/c:chart[1]/c:plotArea[1]/c:lineChart[1]/c:ser[1]/c:marker[1]/c:size[1]","val","7");
 }
 
+void Chart2ExportTest::testTdf126115IndividualMarker()
+{
+    // Check individual marker properties.
+    load("/chart2/qa/extras/data/xlsx/", "tdf126115.xlsx");
+    xmlDocPtr pXmlDoc = parseExport("xl/charts/chart", "Calc Office Open XML");
+    CPPUNIT_ASSERT(pXmlDoc);
+    // 1. series
+    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser[1]/c:dPt/c:marker/c:symbol", "val", "square");
+    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser[1]/c:dPt/c:marker/c:size", "val", "8");
+    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser[1]/c:dPt/c:marker/c:spPr/a:solidFill/a:srgbClr", "val", "ff0000");
+    // 2. series
+    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser[2]/c:dPt/c:marker/c:symbol", "val", "x");
+    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser[2]/c:dPt/c:marker/c:size", "val", "15");
+    assertXPath(pXmlDoc, "/c:chartSpace/c:chart/c:plotArea/c:scatterChart/c:ser[2]/c:dPt/c:marker/c:spPr/a:solidFill/a:srgbClr", "val", "7030a0");
+}
+
 void Chart2ExportTest::testAxisNumberFormatODS()
 {
     struct
diff --git a/chart2/qa/extras/data/xlsx/tdf126115.xlsx b/chart2/qa/extras/data/xlsx/tdf126115.xlsx
new file mode 100644
index 000000000000..f845c06e3142
Binary files /dev/null and b/chart2/qa/extras/data/xlsx/tdf126115.xlsx differ
diff --git a/include/oox/export/chartexport.hxx b/include/oox/export/chartexport.hxx
index b39b3f52b455..4716099dd8df 100644
--- a/include/oox/export/chartexport.hxx
+++ b/include/oox/export/chartexport.hxx
@@ -182,7 +182,7 @@ private:
     void exportDataLabels( const css::uno::Reference<css::chart2::XDataSeries>& xSeries, sal_Int32 nSeriesLength, sal_Int32 eChartType );
     void exportGrouping( bool isBar = false );
     void exportTrendlines( const css::uno::Reference< css::chart2::XDataSeries >& xSeries );
-    void exportMarker( const css::uno::Reference< css::chart2::XDataSeries >& xSeries );
+    void exportMarker( const css::uno::Reference< css::beans::XPropertySet >& xPropSet );
     void exportSmooth();
     void exportFirstSliceAng();
 
diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx
index 65b7bd3c3e23..b6c764ddbd8c 100644
--- a/oox/source/export/chartexport.cxx
+++ b/oox/source/export/chartexport.cxx
@@ -1930,7 +1930,7 @@ void ChartExport::exportSeries( const Reference<chart2::XChartType>& xChartType,
                         break;
                         case chart::TYPEID_LINE:
                         {
-                            exportMarker(xDataSeries);
+                            exportMarker(xOldPropSet);
                             break;
                         }
                         case chart::TYPEID_PIE:
@@ -1947,12 +1947,12 @@ void ChartExport::exportSeries( const Reference<chart2::XChartType>& xChartType,
                         }
                         case chart::TYPEID_SCATTER:
                         {
-                            exportMarker(xDataSeries);
+                            exportMarker(xOldPropSet);
                             break;
                         }
                         case chart::TYPEID_RADARLINE:
                         {
-                            exportMarker(xDataSeries);
+                            exportMarker(xOldPropSet);
                             break;
                         }
                     }
@@ -3222,12 +3222,20 @@ void ChartExport::exportDataPoints(
                     case chart::TYPEID_BUBBLE:
                     case chart::TYPEID_HORBAR:
                     case chart::TYPEID_BAR:
-                    {
                         pFS->singleElement(FSNS(XML_c, XML_invertIfNegative), XML_val, "0");
-                    }
-                    break;
+                        exportShapeProps(xPropSet);
+                        break;
+
+                    case chart::TYPEID_LINE:
+                    case chart::TYPEID_SCATTER:
+                    case chart::TYPEID_RADARLINE:
+                        exportMarker(xPropSet);
+                        break;
+
+                    default:
+                        exportShapeProps(xPropSet);
+                        break;
                 }
-                exportShapeProps( xPropSet );
 
                 pFS->endElement( FSNS( XML_c, XML_dPt ) );
             }
@@ -3433,9 +3441,8 @@ void ChartExport::exportTrendlines( const Reference< chart2::XDataSeries >& xSer
     }
 }
 
-void ChartExport::exportMarker(const Reference< chart2::XDataSeries >& xSeries)
+void ChartExport::exportMarker(const Reference< XPropertySet >& xPropSet)
 {
-    Reference< XPropertySet > xPropSet( xSeries, uno::UNO_QUERY );
     chart2::Symbol aSymbol;
     if( GetProperty( xPropSet, "Symbol" ) )
         mAny >>= aSymbol;


More information about the Libreoffice-commits mailing list