chart2/source/controller/dialogs/DataBrowserModel.cxx   |   10 ++++------
 chart2/source/controller/dialogs/DialogModel.cxx        |   10 +++++-----
 chart2/source/controller/main/ChartController.cxx       |   13 +++++--------
 chart2/source/controller/sidebar/ChartElementsPanel.cxx |   13 +++++--------
 chart2/source/controller/sidebar/ChartSeriesPanel.cxx   |    6 +++---
 chart2/source/tools/ObjectIdentifier.cxx                |   10 +++-------
 chart2/source/view/charttypes/VSeriesPlotter.cxx        |    8 ++++----
 chart2/source/view/main/ChartView.cxx                   |    9 ++++-----
 8 files changed, 33 insertions(+), 46 deletions(-)

New commits:
commit 928cb2963844ffd07fdbda6ec55f8de0c51581ff
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Thu Jan 20 22:18:26 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Jan 21 13:45:14 2022 +0100

    use more concrete types in chart2, BaseCoordinateSystem
    
    Change-Id: I25fc26c9c3eb861d72c44ac04e502b2f002ef951
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128711
    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 ce5acd923c89..c73781770549 100644
--- a/chart2/source/controller/dialogs/DataBrowserModel.cxx
+++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx
@@ -803,11 +803,10 @@ void DataBrowserModel::updateFromModel()
 
     if( !xDiagram.is())
         return;
-    const Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( 
xDiagram->getCoordinateSystems());
-    for( Reference< chart2::XCoordinateSystem > const & coords : aCooSysSeq )
+    const std::vector< rtl::Reference< BaseCoordinateSystem > > aCooSysSeq( 
xDiagram->getBaseCoordinateSystems());
+    for( rtl::Reference< BaseCoordinateSystem > const & coords : aCooSysSeq )
     {
-        Reference< chart2::XChartTypeContainer > xCTCnt( coords, 
uno::UNO_QUERY_THROW );
-        const Sequence< Reference< chart2::XChartType > > aChartTypes( 
xCTCnt->getChartTypes());
+        const Sequence< Reference< chart2::XChartType > > aChartTypes( 
coords->getChartTypes());
         sal_Int32 nXAxisNumberFormat = 
DataSeriesHelper::getNumberFormatKeyFromAxis( nullptr, coords, 0, 0 );
 
         for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx )
@@ -880,8 +879,7 @@ void DataBrowserModel::updateFromModel()
                         bool bSwapXAndYAxis = false;
                         try
                         {
-                            Reference< beans::XPropertySet > xProp( coords, 
uno::UNO_QUERY );
-                            xProp->getPropertyValue( "SwapXAndYAxis" ) >>= 
bSwapXAndYAxis;
+                            coords->getPropertyValue( "SwapXAndYAxis" ) >>= 
bSwapXAndYAxis;
                         }
                         catch( const beans::UnknownPropertyException & ) {}
 
diff --git a/chart2/source/controller/dialogs/DialogModel.cxx 
b/chart2/source/controller/dialogs/DialogModel.cxx
index eed859f5d948..73b438acef92 100644
--- a/chart2/source/controller/dialogs/DialogModel.cxx
+++ b/chart2/source/controller/dialogs/DialogModel.cxx
@@ -30,6 +30,7 @@
 #include <ChartTypeTemplate.hxx>
 #include <ThreeDHelper.hxx>
 #include <ChartModel.hxx>
+#include <BaseCoordinateSystem.hxx>
 
 #include <com/sun/star/uno/XComponentContext.hpp>
 #include <com/sun/star/chart2/AxisType.hpp>
@@ -472,12 +473,11 @@ std::vector< Reference< XDataSeriesContainer > >
         rtl::Reference< Diagram > xDiagram = 
m_xChartDocument->getFirstChartDiagram();
         if( xDiagram.is())
         {
-            const Sequence< Reference< XCoordinateSystem > > aCooSysSeq(
-                xDiagram->getCoordinateSystems());
-            for( Reference< XCoordinateSystem > const & coords : aCooSysSeq )
+            const std::vector< rtl::Reference< BaseCoordinateSystem > > & 
aCooSysSeq(
+                xDiagram->getBaseCoordinateSystems());
+            for( rtl::Reference< BaseCoordinateSystem > const & coords : 
aCooSysSeq )
             {
-                Reference< XChartTypeContainer > xCTCnt( coords, 
uno::UNO_QUERY_THROW );
-                const Sequence< Reference< XChartType > > aChartTypeSeq( 
xCTCnt->getChartTypes());
+                const Sequence< Reference< XChartType > > aChartTypeSeq( 
coords->getChartTypes());
                 std::transform(
                     aChartTypeSeq.begin(), aChartTypeSeq.end(),
                     std::back_inserter( aResult ),
diff --git a/chart2/source/controller/main/ChartController.cxx 
b/chart2/source/controller/main/ChartController.cxx
index aaa8636e470e..5be9cc3fe0c3 100644
--- a/chart2/source/controller/main/ChartController.cxx
+++ b/chart2/source/controller/main/ChartController.cxx
@@ -53,6 +53,7 @@
 
 #include <cppuhelper/supportsservice.hxx>
 #include <comphelper/servicehelper.hxx>
+#include <BaseCoordinateSystem.hxx>
 
 #include <com/sun/star/awt/XWindowPeer.hpp>
 #include <com/sun/star/chart2/XChartDocument.hpp>
@@ -234,18 +235,14 @@ css::uno::Reference<css::chart2::XChartType> getChartType(
         const rtl::Reference<ChartModel>& xChartDoc)
 {
     rtl::Reference<Diagram > xDiagram = xChartDoc->getFirstChartDiagram();
-    if (!xDiagram.is()) {
+    if (!xDiagram.is())
         return css::uno::Reference<css::chart2::XChartType>();
-    }
 
-    Sequence< Reference< chart2::XCoordinateSystem > > xCooSysSequence( 
xDiagram->getCoordinateSystems());
-    if (!xCooSysSequence.hasElements()) {
+    const std::vector< rtl::Reference< BaseCoordinateSystem > > 
xCooSysSequence( xDiagram->getBaseCoordinateSystems());
+    if (xCooSysSequence.empty())
         return css::uno::Reference<css::chart2::XChartType>();
-    }
-
-    Reference< chart2::XChartTypeContainer > xChartTypeContainer( 
xCooSysSequence[0], uno::UNO_QUERY_THROW );
 
-    Sequence< Reference< chart2::XChartType > > xChartTypeSequence( 
xChartTypeContainer->getChartTypes() );
+    Sequence< Reference< chart2::XChartType > > xChartTypeSequence( 
xCooSysSequence[0]->getChartTypes() );
 
     return xChartTypeSequence[0];
 }
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx 
b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index 69931ff17303..572ea7de4bd3 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -34,8 +34,8 @@
 #include <DiagramHelper.hxx>
 #include <Diagram.hxx>
 #include <ChartTypeHelper.hxx>
-
 #include <ChartModel.hxx>
+#include <BaseCoordinateSystem.hxx>
 
 
 using namespace css;
@@ -409,18 +409,15 @@ namespace {
 css::uno::Reference<css::chart2::XChartType> getChartType(const 
rtl::Reference<ChartModel>& xModel)
 {
     rtl::Reference<Diagram > xDiagram = xModel->getFirstChartDiagram();
-    if (!xDiagram.is()) {
+    if (!xDiagram.is())
         return css::uno::Reference<css::chart2::XChartType>();
-    }
 
-    css::uno::Sequence<css::uno::Reference<css::chart2::XCoordinateSystem>> 
xCooSysSequence(xDiagram->getCoordinateSystems());
+    const std::vector<rtl::Reference<BaseCoordinateSystem>> & 
xCooSysSequence(xDiagram->getBaseCoordinateSystems());
 
-    if (!xCooSysSequence.hasElements())
+    if (xCooSysSequence.empty())
         return css::uno::Reference<css::chart2::XChartType>();
 
-    css::uno::Reference<css::chart2::XChartTypeContainer> 
xChartTypeContainer(xCooSysSequence[0], css::uno::UNO_QUERY_THROW);
-
-    css::uno::Sequence<css::uno::Reference<css::chart2::XChartType>> 
xChartTypeSequence(xChartTypeContainer->getChartTypes());
+    css::uno::Sequence<css::uno::Reference<css::chart2::XChartType>> 
xChartTypeSequence(xCooSysSequence[0]->getChartTypes());
 
     if (!xChartTypeSequence.hasElements())
         return css::uno::Reference<css::chart2::XChartType>();
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx 
b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
index dd3189350789..27878f8926cc 100644
--- a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx
@@ -38,6 +38,7 @@
 #include <Diagram.hxx>
 #include <RegressionCurveHelper.hxx>
 #include <StatisticsHelper.hxx>
+#include <BaseCoordinateSystem.hxx>
 
 #include <comphelper/processfactory.hxx>
 
@@ -229,9 +230,8 @@ css::uno::Reference<css::chart2::XChartType> getChartType(
         const rtl::Reference<::chart::ChartModel>& xModel)
 {
     rtl::Reference<Diagram> xDiagram = xModel->getFirstChartDiagram();
-    css::uno::Sequence< css::uno::Reference< css::chart2::XCoordinateSystem > 
> xCooSysSequence( xDiagram->getCoordinateSystems());
-    css::uno::Reference< css::chart2::XChartTypeContainer > 
xChartTypeContainer( xCooSysSequence[0], UNO_QUERY_THROW );
-    css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > > 
xChartTypeSequence( xChartTypeContainer->getChartTypes() );
+    const std::vector< rtl::Reference< BaseCoordinateSystem > > 
xCooSysSequence( xDiagram->getBaseCoordinateSystems());
+    css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > > 
xChartTypeSequence( xCooSysSequence[0]->getChartTypes() );
     return xChartTypeSequence[0];
 }
 
diff --git a/chart2/source/tools/ObjectIdentifier.cxx 
b/chart2/source/tools/ObjectIdentifier.cxx
index fa538c81670d..f95022510203 100644
--- a/chart2/source/tools/ObjectIdentifier.cxx
+++ b/chart2/source/tools/ObjectIdentifier.cxx
@@ -136,15 +136,11 @@ Reference<XChartType> lcl_getFirstStockChartType( const 
Reference< frame::XModel
 
     //iterate through all coordinate systems
 
-    const uno::Sequence< Reference< XCoordinateSystem > > aCooSysList( 
xDiagram->getCoordinateSystems() );
-    for( Reference< XCoordinateSystem > const & coords : aCooSysList )
+    const std::vector< rtl::Reference< BaseCoordinateSystem > > & aCooSysList( 
xDiagram->getBaseCoordinateSystems() );
+    for( rtl::Reference< BaseCoordinateSystem > const & coords : aCooSysList )
     {
         //iterate through all chart types in the current coordinate system
-        Reference< XChartTypeContainer > xChartTypeContainer( coords, 
uno::UNO_QUERY );
-        if( !xChartTypeContainer.is() )
-            continue;
-
-        const uno::Sequence< Reference< XChartType > > aChartTypeList( 
xChartTypeContainer->getChartTypes() );
+        const uno::Sequence< Reference< XChartType > > aChartTypeList( 
coords->getChartTypes() );
         for( Reference< XChartType > const & xChartType : aChartTypeList )
         {
             if(!xChartType.is())
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx 
b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 5ffeb320478f..af54871ff49d 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -24,6 +24,7 @@
 #include <VLineProperties.hxx>
 #include <ShapeFactory.hxx>
 #include <Diagram.hxx>
+#include <BaseCoordinateSystem.hxx>
 
 #include <CommonConverters.hxx>
 #include <ExplicitCategoriesProvider.hxx>
@@ -2362,13 +2363,12 @@ std::vector< ViewLegendEntry > 
VSeriesPlotter::createLegendEntries(
     if( xTarget.is() )
     {
         rtl::Reference< Diagram > xDiagram = rModel.getFirstChartDiagram();
-        Reference< chart2::XCoordinateSystem > 
xCooSys(xDiagram->getCoordinateSystems()[0]);
-        Reference< beans::XPropertySet > xProp( xCooSys, uno::UNO_QUERY );
+        rtl::Reference< BaseCoordinateSystem > 
xCooSys(xDiagram->getBaseCoordinateSystems()[0]);
         bool bSwapXAndY = false;
 
-        if( xProp.is()) try
+        try
         {
-            xProp->getPropertyValue( "SwapXAndYAxis" ) >>= bSwapXAndY;
+            xCooSys->getPropertyValue( "SwapXAndYAxis" ) >>= bSwapXAndY;
         }
         catch( const uno::Exception& )
         {
diff --git a/chart2/source/view/main/ChartView.cxx 
b/chart2/source/view/main/ChartView.cxx
index fff8c6ea08d3..d1ec2a672571 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -1796,13 +1796,12 @@ bool lcl_getPropertySwapXAndYAxis( const 
rtl::Reference< Diagram >& xDiagram )
 
     if( xDiagram.is() )
     {
-        uno::Sequence< uno::Reference< XCoordinateSystem > > aCooSysList( 
xDiagram->getCoordinateSystems() );
-        if( aCooSysList.hasElements() )
+        const std::vector< rtl::Reference< BaseCoordinateSystem > > & 
aCooSysList( xDiagram->getBaseCoordinateSystems() );
+        if( !aCooSysList.empty() )
         {
-            uno::Reference<beans::XPropertySet> xProp(aCooSysList[0], 
uno::UNO_QUERY );
-            if( xProp.is()) try
+            try
             {
-                xProp->getPropertyValue( "SwapXAndYAxis" ) >>= bSwapXAndY;
+                aCooSysList[0]->getPropertyValue( "SwapXAndYAxis" ) >>= 
bSwapXAndY;
             }
             catch( const uno::Exception& )
             {

Reply via email to