chart2/source/controller/dialogs/DataBrowserModel.cxx |    6 +---
 chart2/source/controller/dialogs/DataBrowserModel.hxx |    2 -
 chart2/source/controller/main/ObjectHierarchy.cxx     |    9 +++----
 chart2/source/controller/sidebar/ChartSeriesPanel.cxx |    2 -
 chart2/source/inc/StatisticsHelper.hxx                |   12 +++++----
 chart2/source/tools/StatisticsHelper.cxx              |   23 ++++++++----------
 6 files changed, 27 insertions(+), 27 deletions(-)

New commits:
commit f6da444a9e2b239d8905d6cdb845c7be8d8ce66f
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Mar 22 11:04:36 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Mar 22 19:58:26 2023 +0000

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

diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx 
b/chart2/source/controller/dialogs/DataBrowserModel.cxx
index f406935b1f21..ffddcacf5d8f 100644
--- a/chart2/source/controller/dialogs/DataBrowserModel.cxx
+++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx
@@ -888,7 +888,7 @@ void DataBrowserModel::updateFromModel()
 }
 
 void DataBrowserModel::addErrorBarRanges(
-    const Reference< chart2::XDataSeries > & xDataSeries,
+    const rtl::Reference< DataSeries > & xDataSeries,
     sal_Int32 nNumberFormatKey,
     sal_Int32 & rInOutSequenceIndex,
     sal_Int32 & rInOutHeaderEnd, bool bYError )
@@ -918,9 +918,7 @@ void DataBrowserModel::addErrorBarRanges(
 
         for (uno::Reference<chart2::data::XLabeledDataSequence> const & 
rDataSequence : aSequences)
         {
-            rtl::Reference<DataSeries> pDataSeries = 
dynamic_cast<DataSeries*>(xDataSeries.get());
-            assert(pDataSeries || !xDataSeries);
-            m_aColumns.emplace_back(pDataSeries, 
lcl_getUIRoleName(rDataSequence),
+            m_aColumns.emplace_back(xDataSeries, 
lcl_getUIRoleName(rDataSequence),
                                              rDataSequence, NUMBER, 
nNumberFormatKey);
             ++rInOutSequenceIndex;
             ++rInOutHeaderEnd;
diff --git a/chart2/source/controller/dialogs/DataBrowserModel.hxx 
b/chart2/source/controller/dialogs/DataBrowserModel.hxx
index 7195363ff148..e3254851d002 100644
--- a/chart2/source/controller/dialogs/DataBrowserModel.hxx
+++ b/chart2/source/controller/dialogs/DataBrowserModel.hxx
@@ -146,7 +146,7 @@ private:
     void removeComplexCategoryLevel( sal_Int32 nAtColumnIndex );
 
     void addErrorBarRanges(
-        const css::uno::Reference<css::chart2::XDataSeries > & xDataSeries,
+        const rtl::Reference<::chart::DataSeries > & xDataSeries,
         sal_Int32 nNumberFormatKey,
         sal_Int32 & rInOutSequenceIndex,
         sal_Int32 & rInOutHeaderEnd, bool bYError );
diff --git a/chart2/source/inc/StatisticsHelper.hxx 
b/chart2/source/inc/StatisticsHelper.hxx
index d4a05daafd80..e7008020022c 100644
--- a/chart2/source/inc/StatisticsHelper.hxx
+++ b/chart2/source/inc/StatisticsHelper.hxx
@@ -20,6 +20,7 @@
 
 #include <com/sun/star/uno/Reference.h>
 #include <rtl/ustring.hxx>
+#include <rtl/ref.hxx>
 #include "charttoolsdllapi.hxx"
 
 namespace com::sun::star::beans { class XPropertySet; }
@@ -30,6 +31,7 @@ namespace com::sun::star::chart2::data { class XDataSource; }
 namespace com::sun::star::chart2::data { class XLabeledDataSequence; }
 namespace com::sun::star::uno { template <typename > class Sequence; }
 namespace chart { class LabeledDataSequence; }
+namespace chart { class DataSeries; }
 
 namespace chart::StatisticsHelper
 {
@@ -74,25 +76,25 @@ namespace chart::StatisticsHelper
     /// @return the newly created or existing error bar object
     OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::beans::XPropertySet >
         addErrorBars(
-            const css::uno::Reference< css::chart2::XDataSeries > & 
xDataSeries,
+            const rtl::Reference< ::chart::DataSeries > & xDataSeries,
             sal_Int32 nStyle,
             bool bYError = true );
 
     OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::beans::XPropertySet >
         getErrorBars(
-            const css::uno::Reference< css::chart2::XDataSeries > & 
xDataSeries,
+            const rtl::Reference< ::chart::DataSeries > & xDataSeries,
             bool bYError = true );
 
     OOO_DLLPUBLIC_CHARTTOOLS bool hasErrorBars(
-        const css::uno::Reference< css::chart2::XDataSeries > & xDataSeries,
+        const rtl::Reference< ::chart::DataSeries > & xDataSeries,
         bool bYError = true );
 
     OOO_DLLPUBLIC_CHARTTOOLS void removeErrorBars(
-        const css::uno::Reference< css::chart2::XDataSeries > & xDataSeries,
+        const rtl::Reference< ::chart::DataSeries > & xDataSeries,
         bool bYError = true );
 
     OOO_DLLPUBLIC_CHARTTOOLS bool usesErrorBarRanges(
-        const css::uno::Reference< css::chart2::XDataSeries > & xDataSeries,
+        const rtl::Reference< ::chart::DataSeries > & xDataSeries,
         bool bYError = true );
 
 } //  namespace chart
diff --git a/chart2/source/tools/StatisticsHelper.cxx 
b/chart2/source/tools/StatisticsHelper.cxx
index 13132856ef23..e97475915705 100644
--- a/chart2/source/tools/StatisticsHelper.cxx
+++ b/chart2/source/tools/StatisticsHelper.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <StatisticsHelper.hxx>
+#include <DataSeries.hxx>
 #include <DataSeriesHelper.hxx>
 #include <ErrorBar.hxx>
 #include <unonames.hxx>
@@ -281,18 +282,17 @@ void StatisticsHelper::setErrorDataSequence(
 }
 
 Reference< beans::XPropertySet > StatisticsHelper::addErrorBars(
-    const Reference< chart2::XDataSeries > & xDataSeries,
+    const rtl::Reference< DataSeries > & xDataSeries,
     sal_Int32 nStyle,
     bool bYError /* = true */ )
 {
     Reference< beans::XPropertySet > xErrorBar;
-    Reference< beans::XPropertySet > xSeriesProp( xDataSeries, uno::UNO_QUERY 
);
-    if( !xSeriesProp.is())
+    if( !xDataSeries.is())
         return xErrorBar;
 
     const OUString aPropName(
             bYError ? OUString(CHART_UNONAME_ERRORBAR_Y) : 
OUString(CHART_UNONAME_ERRORBAR_X));
-    if( !( xSeriesProp->getPropertyValue( aPropName ) >>= xErrorBar ) ||
+    if( !( xDataSeries->getPropertyValue( aPropName ) >>= xErrorBar ) ||
         !xErrorBar.is())
     {
         xErrorBar.set( new ErrorBar );
@@ -304,28 +304,27 @@ Reference< beans::XPropertySet > 
StatisticsHelper::addErrorBars(
         xErrorBar->setPropertyValue( "ErrorBarStyle", uno::Any( nStyle ));
     }
 
-    xSeriesProp->setPropertyValue( aPropName, uno::Any( xErrorBar ));
+    xDataSeries->setPropertyValue( aPropName, uno::Any( xErrorBar ));
 
     return xErrorBar;
 }
 
 Reference< beans::XPropertySet > StatisticsHelper::getErrorBars(
-    const Reference< chart2::XDataSeries > & xDataSeries,
+    const rtl::Reference< DataSeries > & xDataSeries,
     bool bYError /* = true */ )
 {
-    Reference< beans::XPropertySet > xSeriesProp( xDataSeries, uno::UNO_QUERY 
);
     Reference< beans::XPropertySet > xErrorBar;
     const OUString aPropName(
             bYError ? OUString(CHART_UNONAME_ERRORBAR_Y) : 
OUString(CHART_UNONAME_ERRORBAR_X));
 
-    if ( xSeriesProp.is())
-        xSeriesProp->getPropertyValue( aPropName ) >>= xErrorBar;
+    if ( xDataSeries.is())
+        xDataSeries->getPropertyValue( aPropName ) >>= xErrorBar;
 
     return xErrorBar;
 }
 
 bool StatisticsHelper::hasErrorBars(
-    const Reference< chart2::XDataSeries > & xDataSeries,
+    const rtl::Reference< DataSeries > & xDataSeries,
     bool bYError /* = true */ )
 {
     Reference< beans::XPropertySet > xErrorBar( getErrorBars( xDataSeries, 
bYError ));
@@ -337,7 +336,7 @@ bool StatisticsHelper::hasErrorBars(
 }
 
 void StatisticsHelper::removeErrorBars(
-    const Reference< chart2::XDataSeries > & xDataSeries,
+    const rtl::Reference< DataSeries > & xDataSeries,
     bool bYError /* = true  */ )
 {
     Reference< beans::XPropertySet > xErrorBar( getErrorBars( xDataSeries, 
bYError ));
@@ -347,7 +346,7 @@ void StatisticsHelper::removeErrorBars(
 }
 
 bool StatisticsHelper::usesErrorBarRanges(
-    const Reference< chart2::XDataSeries > & xDataSeries,
+    const rtl::Reference< DataSeries > & xDataSeries,
     bool bYError /* = true */ )
 {
     Reference< beans::XPropertySet > xErrorBar( getErrorBars( xDataSeries, 
bYError ));
commit f5b0bd23ff80f5229371c6e289480b347f168524
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Mar 22 10:48:27 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Mar 22 19:58:17 2023 +0000

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

diff --git a/chart2/source/controller/main/ObjectHierarchy.cxx 
b/chart2/source/controller/main/ObjectHierarchy.cxx
index 975cf145f56b..9e7c5577107c 100644
--- a/chart2/source/controller/main/ObjectHierarchy.cxx
+++ b/chart2/source/controller/main/ObjectHierarchy.cxx
@@ -23,6 +23,7 @@
 #include <DiagramHelper.hxx>
 #include <Diagram.hxx>
 #include <RegressionCurveHelper.hxx>
+#include <RegressionCurveModel.hxx>
 #include <Axis.hxx>
 #include <AxisHelper.hxx>
 #include <chartview/ExplicitValueProvider.hxx>
@@ -356,12 +357,12 @@ void ObjectHierarchy::createDataSeriesTree(
                     // Statistics
                     if( ChartTypeHelper::isSupportingStatisticProperties( 
xChartType, nDimensionCount ) )
                     {
-                        Sequence< Reference< chart2::XRegressionCurve > > 
aCurves( xSeries->getRegressionCurves());
-                        for( sal_Int32 nCurveIdx=0; 
nCurveIdx<aCurves.getLength(); ++nCurveIdx )
+                        const std::vector< rtl::Reference< 
RegressionCurveModel > > & rCurves( xSeries->getRegressionCurves2());
+                        for( size_t nCurveIdx=0; nCurveIdx<rCurves.size(); 
++nCurveIdx )
                         {
-                            bool bIsAverageLine = 
RegressionCurveHelper::isMeanValueLine( aCurves[nCurveIdx] );
+                            bool bIsAverageLine = 
RegressionCurveHelper::isMeanValueLine( rCurves[nCurveIdx] );
                             aSeriesSubContainer.emplace_back( 
ObjectIdentifier::createDataCurveCID( aSeriesParticle, nCurveIdx, 
bIsAverageLine ) );
-                            if( RegressionCurveHelper::hasEquation( 
aCurves[nCurveIdx] ) )
+                            if( RegressionCurveHelper::hasEquation( 
rCurves[nCurveIdx] ) )
                             {
                                 aSeriesSubContainer.emplace_back( 
ObjectIdentifier::createDataCurveEquationCID( aSeriesParticle, nCurveIdx ) );
                             }
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx 
b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
index 916cb030b5f3..8ec05b73d656 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
@@ -141,7 +141,7 @@ bool isTrendlineVisible(const 
rtl::Reference<::chart::ChartModel>& xModel,
     if (!xRegressionCurveContainer.is())
         return false;
 
-    return xRegressionCurveContainer->getRegressionCurves().hasElements();
+    return !xRegressionCurveContainer->getRegressionCurves2().empty();
 }
 
 void setTrendlineVisible(const rtl::Reference<::chart::ChartModel>&

Reply via email to