chart2/source/inc/Diagram.hxx                      |    7 +++++++
 chart2/source/inc/DiagramHelper.hxx                |    8 --------
 chart2/source/model/main/Diagram.cxx               |   16 ++++++++++++++++
 chart2/source/model/template/ChartTypeTemplate.cxx |    4 ++--
 chart2/source/tools/DiagramHelper.cxx              |   20 --------------------
 5 files changed, 25 insertions(+), 30 deletions(-)

New commits:
commit 61e6afb4d556f95d3cb7dc64262d834c627518f1
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Mar 15 16:50:12 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sat Mar 18 19:27:29 2023 +0000

    move getDataSeriesGroups inside chart2::Diagram
    
    Change-Id: I776e07ad6dce63df9891ab6823811ad20a37e77c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149084
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/chart2/source/inc/Diagram.hxx b/chart2/source/inc/Diagram.hxx
index 44bca5c24a8c..b370d38057c4 100644
--- a/chart2/source/inc/Diagram.hxx
+++ b/chart2/source/inc/Diagram.hxx
@@ -236,6 +236,13 @@ public:
 
     bool isCategory();
 
+    /** return all data series in this diagram grouped by chart-types
+     */
+    std::vector<
+           std::vector<
+               rtl::Reference< ::chart::DataSeries > > >
+        getDataSeriesGroups();
+
 private:
     // ____ XModifyListener ____
     virtual void SAL_CALL modified(
diff --git a/chart2/source/inc/DiagramHelper.hxx 
b/chart2/source/inc/DiagramHelper.hxx
index e018a1817ed4..ab88483664cb 100644
--- a/chart2/source/inc/DiagramHelper.hxx
+++ b/chart2/source/inc/DiagramHelper.hxx
@@ -170,14 +170,6 @@ public:
         getDataSeriesFromDiagram(
             const rtl::Reference< ::chart::Diagram > & xDiagram );
 
-    /** return all data series in this diagram grouped by chart-types
-     */
-    static std::vector<
-               std::vector<
-                   rtl::Reference< ::chart::DataSeries > > >
-        getDataSeriesGroups(
-            const rtl::Reference< ::chart::Diagram > & xDiagram );
-
     static css::uno::Sequence< OUString >
         getExplicitSimpleCategories( ChartModel& rModel );
 
diff --git a/chart2/source/model/main/Diagram.cxx 
b/chart2/source/model/main/Diagram.cxx
index 92b443b744f9..2005eb90feda 100644
--- a/chart2/source/model/main/Diagram.cxx
+++ b/chart2/source/model/main/Diagram.cxx
@@ -1210,6 +1210,22 @@ bool Diagram::isCategory()
     return false;
 }
 
+std::vector< std::vector< rtl::Reference< DataSeries > > >
+Diagram::getDataSeriesGroups()
+{
+    std::vector< std::vector< rtl::Reference< DataSeries > > > aResult;
+
+    //iterate through all coordinate systems
+    for( rtl::Reference< BaseCoordinateSystem > const & coords : 
getBaseCoordinateSystems() )
+    {
+        //iterate through all chart types in the current coordinate system
+        for( rtl::Reference< ChartType >  const & chartType : 
coords->getChartTypes2() )
+        {
+            aResult.push_back( chartType->getDataSeries2() );
+        }
+    }
+    return aResult;
+}
 
 } //  namespace chart
 
diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx 
b/chart2/source/model/template/ChartTypeTemplate.cxx
index a23b74af57e8..383fcac73163 100644
--- a/chart2/source/model/template/ChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ChartTypeTemplate.cxx
@@ -183,7 +183,7 @@ void ChartTypeTemplate::changeDiagram( const 
rtl::Reference< Diagram >& xDiagram
     try
     {
         std::vector< std::vector< rtl::Reference< DataSeries > > > aSeriesSeq =
-            DiagramHelper::getDataSeriesGroups( xDiagram );
+            xDiagram->getDataSeriesGroups();
         std::vector< rtl::Reference< DataSeries > > aFlatSeriesSeq( 
FlattenSequence( aSeriesSeq ));
         const sal_Int32 nFormerSeriesCount = aFlatSeriesSeq.size();
 
@@ -394,7 +394,7 @@ void ChartTypeTemplate::applyStyles( const rtl::Reference< 
::chart::Diagram >& x
 {
     // apply chart-type specific styles, like "symbols on" for example
     std::vector< std::vector< rtl::Reference< DataSeries > > > aNewSeriesSeq(
-        DiagramHelper::getDataSeriesGroups( xDiagram ));
+        xDiagram->getDataSeriesGroups());
     for( std::size_t i=0; i<aNewSeriesSeq.size(); ++i )
     {
         const sal_Int32 nNumSeries = aNewSeriesSeq[i].size();
diff --git a/chart2/source/tools/DiagramHelper.cxx 
b/chart2/source/tools/DiagramHelper.cxx
index bf7b9f3ee537..4dc6c40c184c 100644
--- a/chart2/source/tools/DiagramHelper.cxx
+++ b/chart2/source/tools/DiagramHelper.cxx
@@ -623,26 +623,6 @@ std::vector< rtl::Reference< ::chart::DataSeries > >
     return aResult;
 }
 
-std::vector< std::vector< rtl::Reference< DataSeries > > >
-        DiagramHelper::getDataSeriesGroups( const rtl::Reference< Diagram > & 
xDiagram )
-{
-    if (!xDiagram)
-        return {};
-
-    std::vector< std::vector< rtl::Reference< DataSeries > > > aResult;
-
-    //iterate through all coordinate systems
-    for( rtl::Reference< BaseCoordinateSystem > const & coords : 
xDiagram->getBaseCoordinateSystems() )
-    {
-        //iterate through all chart types in the current coordinate system
-        for( rtl::Reference< ChartType >  const & chartType : 
coords->getChartTypes2() )
-        {
-            aResult.push_back( chartType->getDataSeries2() );
-        }
-    }
-    return aResult;
-}
-
 static void lcl_generateAutomaticCategoriesFromChartType(
             Sequence< OUString >& rRet,
             const rtl::Reference< ChartType >& xChartType )

Reply via email to