chart2/source/controller/inc/RegressionCurveItemConverter.hxx            |    
6 
 chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx |    
3 
 chart2/source/controller/main/ChartController_Insert.cxx                 |   
10 -
 chart2/source/controller/main/ChartController_Properties.cxx             |   
15 +-
 chart2/source/controller/main/ObjectHierarchy.cxx                        |   
64 ++++------
 5 files changed, 45 insertions(+), 53 deletions(-)

New commits:
commit 9f36eba17042d14519de2409f7e3e581806b4ae6
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sun Jan 30 22:02:34 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Jan 31 14:50:19 2022 +0100

    use more concrete types in chart2, DataSeries
    
    Change-Id: I561d3d04cd534a30e774b0ed3fe1fb927a40c8df
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129184
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/chart2/source/controller/inc/RegressionCurveItemConverter.hxx 
b/chart2/source/controller/inc/RegressionCurveItemConverter.hxx
index 63c296a3e3b1..2701a7695c8c 100644
--- a/chart2/source/controller/inc/RegressionCurveItemConverter.hxx
+++ b/chart2/source/controller/inc/RegressionCurveItemConverter.hxx
@@ -22,7 +22,7 @@
 
 namespace com::sun::star::chart2 { class XRegressionCurveContainer; }
 namespace com::sun::star::lang { class XMultiServiceFactory; }
-
+namespace chart { class DataSeries; }
 class SdrModel;
 
 namespace chart::wrapper
@@ -33,7 +33,7 @@ class RegressionCurveItemConverter final : public 
ItemConverter
 public:
     RegressionCurveItemConverter(
         const css::uno::Reference< css::beans::XPropertySet > & rPropertySet,
-        const css::uno::Reference< css::chart2::XRegressionCurveContainer > & 
xRegCurveCnt,
+        const rtl::Reference< ::chart::DataSeries > & xRegCurveCnt,
         SfxItemPool& rItemPool,
         SdrModel& rDrawModel,
         const css::uno::Reference< css::lang::XMultiServiceFactory > & 
xNamedPropertyContainerFactory );
@@ -51,7 +51,7 @@ protected:
 
 private:
     std::shared_ptr< ItemConverter >  m_spGraphicConverter;
-    css::uno::Reference< css::chart2::XRegressionCurveContainer >  
m_xCurveContainer;
+    rtl::Reference< ::chart::DataSeries >  m_xCurveContainer;
 };
 
 } //  namespace chart::wrapper
diff --git 
a/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx 
b/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx
index a999d30b6414..c932278d5dfb 100644
--- a/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx
+++ b/chart2/source/controller/itemsetwrapper/RegressionCurveItemConverter.cxx
@@ -21,6 +21,7 @@
 #include <RegressionCurveItemConverter.hxx>
 #include "SchWhichPairs.hxx"
 #include <GraphicPropertyItemConverter.hxx>
+#include <DataSeries.hxx>
 
 #include <com/sun/star/chart2/XRegressionCurve.hpp>
 #include <osl/diagnose.h>
@@ -85,7 +86,7 @@ namespace chart::wrapper
 
 RegressionCurveItemConverter::RegressionCurveItemConverter(
     const uno::Reference< beans::XPropertySet >& rPropertySet,
-    const uno::Reference< chart2::XRegressionCurveContainer >& xContainer,
+    const rtl::Reference< DataSeries >& xContainer,
     SfxItemPool& rItemPool,
     SdrModel& rDrawModel,
     const uno::Reference< lang::XMultiServiceFactory > & 
xNamedPropertyContainerFactory ) :
diff --git a/chart2/source/controller/main/ChartController_Insert.cxx 
b/chart2/source/controller/main/ChartController_Insert.cxx
index e25dab50fd0c..51bc99bab708 100644
--- a/chart2/source/controller/main/ChartController_Insert.cxx
+++ b/chart2/source/controller/main/ChartController_Insert.cxx
@@ -72,14 +72,12 @@ using ::com::sun::star::uno::Sequence;
 namespace
 {
 
-void lcl_InsertMeanValueLine( const uno::Reference< chart2::XDataSeries > & 
xSeries )
+void lcl_InsertMeanValueLine( const rtl::Reference< ::chart::DataSeries > & 
xSeries )
 {
-    uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt(
-        xSeries, uno::UNO_QUERY );
-    if( xRegCurveCnt.is())
+    if( xSeries.is())
     {
         ::chart::RegressionCurveHelper::addMeanValueLine(
-            xRegCurveCnt, uno::Reference< beans::XPropertySet >( xSeries, 
uno::UNO_QUERY ));
+            xSeries, xSeries);
     }
 }
 
@@ -319,7 +317,7 @@ void 
ChartController::executeDispatch_InsertMenu_MeanValues()
             ActionDescriptionProvider::ActionType::Insert, SchResId( 
STR_OBJECT_AVERAGE_LINE )),
         m_xUndoManager );
 
-    uno::Reference< chart2::XDataSeries > xSeries =
+    rtl::Reference< DataSeries > xSeries =
         ObjectIdentifier::getDataSeriesForCID( m_aSelection.getSelectedCID(), 
getChartModel() );
     if( xSeries.is() )
     {
diff --git a/chart2/source/controller/main/ChartController_Properties.cxx 
b/chart2/source/controller/main/ChartController_Properties.cxx
index ae6a6a54f4d5..c96abe74ce3e 100644
--- a/chart2/source/controller/main/ChartController_Properties.cxx
+++ b/chart2/source/controller/main/ChartController_Properties.cxx
@@ -438,8 +438,7 @@ OUString lcl_getObjectCIDForCommand( std::string_view 
rDispatchCommand, const rt
     ObjectType eObjectType = OBJECTTYPE_UNKNOWN;
 
     const ObjectType eSelectedType = ObjectIdentifier::getObjectType( 
rSelectedCID );
-    uno::Reference< XDataSeries > xSeries = 
ObjectIdentifier::getDataSeriesForCID( rSelectedCID, xChartDocument );
-    uno::Reference< chart2::XRegressionCurveContainer > xRegCurveCnt( xSeries, 
uno::UNO_QUERY );
+    rtl::Reference< DataSeries > xSeries = 
ObjectIdentifier::getDataSeriesForCID( rSelectedCID, xChartDocument );
 
     //legend
     if( rDispatchCommand == "Legend" || rDispatchCommand == "FormatLegend" )
@@ -550,8 +549,8 @@ OUString lcl_getObjectCIDForCommand( std::string_view 
rDispatchCommand, const rt
         else
             return ObjectIdentifier::createDataCurveCID(
                 ObjectIdentifier::getSeriesParticleFromCID( rSelectedCID ),
-                    RegressionCurveHelper::getRegressionCurveIndex( 
xRegCurveCnt,
-                        RegressionCurveHelper::getMeanValueLine( xRegCurveCnt 
) ), true );
+                    RegressionCurveHelper::getRegressionCurveIndex( xSeries,
+                        RegressionCurveHelper::getMeanValueLine( xSeries ) ), 
true );
     }
     //trend line
     else if( rDispatchCommand == "FormatTrendline" )
@@ -561,8 +560,8 @@ OUString lcl_getObjectCIDForCommand( std::string_view 
rDispatchCommand, const rt
         else
             return ObjectIdentifier::createDataCurveCID(
                 ObjectIdentifier::getSeriesParticleFromCID( rSelectedCID ),
-                    RegressionCurveHelper::getRegressionCurveIndex( 
xRegCurveCnt,
-                        RegressionCurveHelper::getFirstCurveNotMeanValueLine( 
xRegCurveCnt ) ), false );
+                    RegressionCurveHelper::getRegressionCurveIndex( xSeries,
+                        RegressionCurveHelper::getFirstCurveNotMeanValueLine( 
xSeries ) ), false );
     }
     //trend line equation
     else if( rDispatchCommand == "FormatTrendlineEquation" )
@@ -572,8 +571,8 @@ OUString lcl_getObjectCIDForCommand( std::string_view 
rDispatchCommand, const rt
         else
             return ObjectIdentifier::createDataCurveEquationCID(
                 ObjectIdentifier::getSeriesParticleFromCID( rSelectedCID ),
-                    RegressionCurveHelper::getRegressionCurveIndex( 
xRegCurveCnt,
-                        RegressionCurveHelper::getFirstCurveNotMeanValueLine( 
xRegCurveCnt ) ) );
+                    RegressionCurveHelper::getRegressionCurveIndex( xSeries,
+                        RegressionCurveHelper::getFirstCurveNotMeanValueLine( 
xSeries ) ) );
     }
     // y error bars
     else if( rDispatchCommand == "FormatXErrorBars" )
diff --git a/chart2/source/controller/main/ObjectHierarchy.cxx 
b/chart2/source/controller/main/ObjectHierarchy.cxx
index f509b639bd96..58f17fb7f279 100644
--- a/chart2/source/controller/main/ObjectHierarchy.cxx
+++ b/chart2/source/controller/main/ObjectHierarchy.cxx
@@ -28,6 +28,7 @@
 #include <ChartType.hxx>
 #include <ChartTypeHelper.hxx>
 #include <ChartModel.hxx>
+#include <DataSeries.hxx>
 #include <DataSeriesHelper.hxx>
 #include <LegendHelper.hxx>
 #include <chartview/DrawModelWrapper.hxx>
@@ -326,9 +327,9 @@ void ObjectHierarchy::createDataSeriesTree(
             for( sal_Int32 nCTIdx=0; 
nCTIdx<static_cast<sal_Int32>(aChartTypeSeq.size()); ++nCTIdx )
             {
                 rtl::Reference< ChartType > xChartType( aChartTypeSeq[nCTIdx] 
);
-                Sequence< Reference< XDataSeries > > aSeriesSeq( 
xChartType->getDataSeries() );
+                std::vector< rtl::Reference< DataSeries > > aSeriesSeq( 
xChartType->getDataSeries2() );
                 const sal_Int32 nNumberOfSeries =
-                    ChartTypeHelper::getNumberOfDisplayedSeries( xChartType, 
aSeriesSeq.getLength());
+                    ChartTypeHelper::getNumberOfDisplayedSeries( xChartType, 
aSeriesSeq.size());
 
                 for( sal_Int32 nSeriesIdx=0; nSeriesIdx<nNumberOfSeries; 
++nSeriesIdx )
                 {
@@ -341,7 +342,7 @@ void ObjectHierarchy::createDataSeriesTree(
 
                     ObjectHierarchy::tChildContainer aSeriesSubContainer;
 
-                    Reference< chart2::XDataSeries > const & xSeries = 
aSeriesSeq[nSeriesIdx];
+                    rtl::Reference< DataSeries > const & xSeries = 
aSeriesSeq[nSeriesIdx];
 
                     // data labels
                     if( DataSeriesHelper::hasDataLabelsAtSeries( xSeries ) )
@@ -353,45 +354,38 @@ void ObjectHierarchy::createDataSeriesTree(
                     // Statistics
                     if( ChartTypeHelper::isSupportingStatisticProperties( 
xChartType, nDimensionCount ) )
                     {
-                        Reference< chart2::XRegressionCurveContainer > 
xCurveCnt( xSeries, uno::UNO_QUERY );
-                        if( xCurveCnt.is())
+                        Sequence< Reference< chart2::XRegressionCurve > > 
aCurves( xSeries->getRegressionCurves());
+                        for( sal_Int32 nCurveIdx=0; 
nCurveIdx<aCurves.getLength(); ++nCurveIdx )
                         {
-                            Sequence< Reference< chart2::XRegressionCurve > > 
aCurves( xCurveCnt->getRegressionCurves());
-                            for( sal_Int32 nCurveIdx=0; 
nCurveIdx<aCurves.getLength(); ++nCurveIdx )
+                            bool bIsAverageLine = 
RegressionCurveHelper::isMeanValueLine( aCurves[nCurveIdx] );
+                            aSeriesSubContainer.emplace_back( 
ObjectIdentifier::createDataCurveCID( aSeriesParticle, nCurveIdx, 
bIsAverageLine ) );
+                            if( RegressionCurveHelper::hasEquation( 
aCurves[nCurveIdx] ) )
                             {
-                                bool bIsAverageLine = 
RegressionCurveHelper::isMeanValueLine( aCurves[nCurveIdx] );
-                                aSeriesSubContainer.emplace_back( 
ObjectIdentifier::createDataCurveCID( aSeriesParticle, nCurveIdx, 
bIsAverageLine ) );
-                                if( RegressionCurveHelper::hasEquation( 
aCurves[nCurveIdx] ) )
-                                {
-                                    aSeriesSubContainer.emplace_back( 
ObjectIdentifier::createDataCurveEquationCID( aSeriesParticle, nCurveIdx ) );
-                                }
+                                aSeriesSubContainer.emplace_back( 
ObjectIdentifier::createDataCurveEquationCID( aSeriesParticle, nCurveIdx ) );
                             }
-                            Reference< beans::XPropertySet > xSeriesProp( 
xSeries, uno::UNO_QUERY );
-                            Reference< beans::XPropertySet > xErrorBarProp;
-                            if( xSeriesProp.is() &&
-                                (xSeriesProp->getPropertyValue( 
CHART_UNONAME_ERRORBAR_Y) >>= xErrorBarProp) &&
-                                xErrorBarProp.is())
+                        }
+                        Reference< beans::XPropertySet > xErrorBarProp;
+                        if( (xSeries->getPropertyValue( 
CHART_UNONAME_ERRORBAR_Y) >>= xErrorBarProp) &&
+                            xErrorBarProp.is())
+                        {
+                            sal_Int32 nStyle = css::chart::ErrorBarStyle::NONE;
+                            if( ( xErrorBarProp->getPropertyValue( 
"ErrorBarStyle") >>= nStyle ) &&
+                                ( nStyle != css::chart::ErrorBarStyle::NONE ) )
                             {
-                                sal_Int32 nStyle = 
css::chart::ErrorBarStyle::NONE;
-                                if( ( xErrorBarProp->getPropertyValue( 
"ErrorBarStyle") >>= nStyle ) &&
-                                    ( nStyle != 
css::chart::ErrorBarStyle::NONE ) )
-                                {
-                                    aSeriesSubContainer.emplace_back( 
ObjectIdentifier::createClassifiedIdentifierWithParent(
-                                            OBJECTTYPE_DATA_ERRORS_Y, u"", 
aSeriesParticle ) );
-                                }
+                                aSeriesSubContainer.emplace_back( 
ObjectIdentifier::createClassifiedIdentifierWithParent(
+                                        OBJECTTYPE_DATA_ERRORS_Y, u"", 
aSeriesParticle ) );
                             }
+                        }
 
-                            if( xSeriesProp.is() &&
-                                
(xSeriesProp->getPropertyValue(CHART_UNONAME_ERRORBAR_X) >>= xErrorBarProp) &&
-                                xErrorBarProp.is())
+                        if( 
(xSeries->getPropertyValue(CHART_UNONAME_ERRORBAR_X) >>= xErrorBarProp) &&
+                            xErrorBarProp.is())
+                        {
+                            sal_Int32 nStyle = css::chart::ErrorBarStyle::NONE;
+                            if( ( xErrorBarProp->getPropertyValue( 
"ErrorBarStyle") >>= nStyle ) &&
+                                ( nStyle != css::chart::ErrorBarStyle::NONE ) )
                             {
-                                sal_Int32 nStyle = 
css::chart::ErrorBarStyle::NONE;
-                                if( ( xErrorBarProp->getPropertyValue( 
"ErrorBarStyle") >>= nStyle ) &&
-                                    ( nStyle != 
css::chart::ErrorBarStyle::NONE ) )
-                                {
-                                    aSeriesSubContainer.emplace_back( 
ObjectIdentifier::createClassifiedIdentifierWithParent(
-                                            OBJECTTYPE_DATA_ERRORS_X, u"", 
aSeriesParticle ) );
-                                }
+                                aSeriesSubContainer.emplace_back( 
ObjectIdentifier::createClassifiedIdentifierWithParent(
+                                        OBJECTTYPE_DATA_ERRORS_X, u"", 
aSeriesParticle ) );
                             }
                         }
                     }

Reply via email to