diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2022-02-08 19:56:39 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-02-09 07:32:09 +0100 |
commit | 6e800111d6daa927564e5f4dba8937bbf56e7b8f (patch) | |
tree | 033ce484665e4c88cc345131e16fab60d7d3f6d2 | |
parent | 425ff2e7911436cf2a20d5640d87274d2467b7c0 (diff) |
use more concrete types in chart2, DataSource
Change-Id: I513491e8d39ee79edf8521d279bd32031cf22a93
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/129687
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | chart2/source/controller/main/ChartDropTargetHelper.cxx | 12 | ||||
-rw-r--r-- | chart2/source/controller/main/ChartModelClone.cxx | 3 | ||||
-rw-r--r-- | chart2/source/inc/DataSource.hxx | 4 | ||||
-rw-r--r-- | chart2/source/inc/DataSourceHelper.hxx | 10 | ||||
-rw-r--r-- | chart2/source/model/main/ChartModel.cxx | 4 | ||||
-rw-r--r-- | chart2/source/model/template/DataInterpreter.cxx | 2 | ||||
-rw-r--r-- | chart2/source/tools/AxisHelper.cxx | 3 | ||||
-rw-r--r-- | chart2/source/tools/ChartModelHelper.cxx | 3 | ||||
-rw-r--r-- | chart2/source/tools/DataSourceHelper.cxx | 14 |
9 files changed, 25 insertions, 30 deletions
diff --git a/chart2/source/controller/main/ChartDropTargetHelper.cxx b/chart2/source/controller/main/ChartDropTargetHelper.cxx index dd53e2cf73ea..e4ffd2a29568 100644 --- a/chart2/source/controller/main/ChartDropTargetHelper.cxx +++ b/chart2/source/controller/main/ChartDropTargetHelper.cxx @@ -18,6 +18,7 @@ */ #include "ChartDropTargetHelper.hxx" +#include <DataSource.hxx> #include <DataSourceHelper.hxx> #include <ChartModel.hxx> #include <Diagram.hxx> @@ -125,10 +126,10 @@ sal_Int8 ChartDropTargetHelper::ExecuteDrop( const ExecuteDropEvent& rEvt ) if( xDataProvider.is() && xDiagram.is() && DataSourceHelper::allArgumentsForRectRangeDetected( m_xChartDocument )) { - Reference< chart2::data::XDataSource > xDataSource( - DataSourceHelper::pressUsedDataIntoRectangularFormat( m_xChartDocument )); + rtl::Reference< DataSource > xDataSource1 = + DataSourceHelper::pressUsedDataIntoRectangularFormat( m_xChartDocument ); Sequence< beans::PropertyValue > aArguments( - xDataProvider->detectArguments( xDataSource )); + xDataProvider->detectArguments( xDataSource1 )); OUString aOldRange; beans::PropertyValue * pCellRange = nullptr; @@ -156,8 +157,9 @@ sal_Int8 ChartDropTargetHelper::ExecuteDrop( const ExecuteDropEvent& rEvt ) pCellRange->Value <<= aRangeString; } - xDataSource.set( xDataProvider->createDataSource( aArguments )); - xDiagram->setDiagramData( xDataSource, aArguments ); + Reference< chart2::data::XDataSource > xDataSource2 = + xDataProvider->createDataSource( aArguments ); + xDiagram->setDiagramData( xDataSource2, aArguments ); // always return copy state to avoid deletion of the dragged range nResult = DND_ACTION_COPY; diff --git a/chart2/source/controller/main/ChartModelClone.cxx b/chart2/source/controller/main/ChartModelClone.cxx index dfb089d566e8..d4cae52d0ff6 100644 --- a/chart2/source/controller/main/ChartModelClone.cxx +++ b/chart2/source/controller/main/ChartModelClone.cxx @@ -21,6 +21,7 @@ #include <ChartModel.hxx> #include <ChartModelHelper.hxx> #include <ControllerLockGuard.hxx> +#include <DataSource.hxx> #include <DataSourceHelper.hxx> #include <com/sun/star/chart2/XAnyDescriptionAccess.hpp> @@ -201,7 +202,7 @@ namespace chart if ( i_model->hasInternalDataProvider() ) { Reference< XInternalDataProvider > xNewDataProvider( i_model->getDataProvider(), UNO_QUERY ); - Reference< XDataSource > xUsedData( DataSourceHelper::getUsedData( *i_model ) ); + rtl::Reference< DataSource > xUsedData = DataSourceHelper::getUsedData( *i_model ); if ( xUsedData.is() && xNewDataProvider.is() ) { const Sequence< Reference< XLabeledDataSequence > > aData( xUsedData->getDataSequences() ); diff --git a/chart2/source/inc/DataSource.hxx b/chart2/source/inc/DataSource.hxx index e1346fa27e92..1f9478d85653 100644 --- a/chart2/source/inc/DataSource.hxx +++ b/chart2/source/inc/DataSource.hxx @@ -24,12 +24,13 @@ #include <cppuhelper/implbase.hxx> #include <rtl/ref.hxx> #include <vector> +#include "charttoolsdllapi.hxx" namespace chart { class LabeledDataSequence; -class DataSource final : public +class OOO_DLLPUBLIC_CHARTTOOLS DataSource final : public ::cppu::WeakImplHelper< css::lang::XServiceInfo, css::chart2::data::XDataSource, @@ -49,7 +50,6 @@ public: virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; -protected: // ____ XDataSource ____ virtual css::uno::Sequence< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > SAL_CALL getDataSequences() override; diff --git a/chart2/source/inc/DataSourceHelper.hxx b/chart2/source/inc/DataSourceHelper.hxx index 561fb5644428..ff64d356e6d0 100644 --- a/chart2/source/inc/DataSourceHelper.hxx +++ b/chart2/source/inc/DataSourceHelper.hxx @@ -42,10 +42,6 @@ class LabeledDataSequence; class OOO_DLLPUBLIC_CHARTTOOLS DataSourceHelper { public: - static rtl::Reference< ::chart::DataSource > - createDataSource( const css::uno::Sequence< - css::uno::Reference< css::chart2::data::XLabeledDataSequence > > & rSequences ); - static css::uno::Reference< css::chart2::data::XDataSequence > createCachedDataSequence(); @@ -78,7 +74,7 @@ public: , OUString & rRangeRepresentation, css::uno::Sequence< sal_Int32 >& rSequenceMapping , bool& bUseColumns, bool& bFirstCellAsLabel, bool& bHasCategories ); - static css::uno::Reference< css::chart2::data::XDataSource > + static rtl::Reference< ::chart::DataSource > pressUsedDataIntoRectangularFormat( const rtl::Reference< ::chart::ChartModel >& xChartDoc ); SAL_DLLPRIVATE static css::uno::Sequence< OUString > getUsedDataRanges( @@ -87,10 +83,10 @@ public: static css::uno::Sequence< OUString > getUsedDataRanges( const rtl::Reference<::chart::ChartModel> & xChartModel ); - static css::uno::Reference< css::chart2::data::XDataSource > getUsedData( + static rtl::Reference< ::chart::DataSource > getUsedData( ChartModel& rModel ); - static css::uno::Reference< css::chart2::data::XDataSource > getUsedData( + static rtl::Reference< ::chart::DataSource > getUsedData( const rtl::Reference<::chart::ChartModel>& xChartModel ); static bool detectRangeSegmentation( diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index 9f22619448f2..78ed71f1830e 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -21,6 +21,7 @@ #include <ChartTypeManager.hxx> #include <ChartTypeTemplate.hxx> #include <servicenames.hxx> +#include <DataSource.hxx> #include <DataSourceHelper.hxx> #include <ChartModelHelper.hxx> #include <DisposeHelper.hxx> @@ -1246,8 +1247,7 @@ void SAL_CALL ChartModel::setParent( const Reference< uno::XInterface >& Parent // ____ XDataSource ____ uno::Sequence< Reference< chart2::data::XLabeledDataSequence > > SAL_CALL ChartModel::getDataSequences() { - Reference< chart2::data::XDataSource > xSource( - DataSourceHelper::getUsedData( *this ) ); + rtl::Reference< DataSource > xSource = DataSourceHelper::getUsedData( *this ); if( xSource.is()) return xSource->getDataSequences(); diff --git a/chart2/source/model/template/DataInterpreter.cxx b/chart2/source/model/template/DataInterpreter.cxx index b374cae93cc6..4d45d2a58278 100644 --- a/chart2/source/model/template/DataInterpreter.cxx +++ b/chart2/source/model/template/DataInterpreter.cxx @@ -285,7 +285,7 @@ rtl::Reference< DataSource > DataInterpreter::mergeInterpretedData( } } - return DataSourceHelper::createDataSource( comphelper::containerToSequence( aResultVec ) ); + return new DataSource(aResultVec); } uno::Any DataInterpreter::getChartTypeSpecificData( diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index 258f8d384dc2..2418ca2097b0 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -24,6 +24,7 @@ #include <ChartType.hxx> #include <Axis.hxx> #include <AxisIndexDefines.hxx> +#include <DataSource.hxx> #include <LabeledDataSequence.hxx> #include <LinePropertiesHelper.hxx> #include <servicenames_coosystems.hxx> @@ -209,7 +210,7 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( } else { - Reference< data::XDataSource > xSource( DataSourceHelper::getUsedData( *xChartDoc ) ); + rtl::Reference< DataSource > xSource = DataSourceHelper::getUsedData( *xChartDoc ); if( xSource.is() ) { std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aXValues( diff --git a/chart2/source/tools/ChartModelHelper.cxx b/chart2/source/tools/ChartModelHelper.cxx index fbce1d27f149..e13ce8497b03 100644 --- a/chart2/source/tools/ChartModelHelper.cxx +++ b/chart2/source/tools/ChartModelHelper.cxx @@ -20,6 +20,7 @@ #include <ChartModelHelper.hxx> #include <DiagramHelper.hxx> #include <Diagram.hxx> +#include <DataSource.hxx> #include <DataSourceHelper.hxx> #include <ControllerLockGuard.hxx> #include <RangeHighlighter.hxx> @@ -217,7 +218,7 @@ bool ChartModelHelper::setIncludeHiddenCells( bool bIncludeHiddenCells, ChartMod try { - uno::Reference< chart2::data::XDataSource > xUsedData( DataSourceHelper::getUsedData( rModel ) ); + rtl::Reference< DataSource > xUsedData = DataSourceHelper::getUsedData( rModel ); if( xUsedData.is() ) { uno::Reference< beans::XPropertySet > xProp; diff --git a/chart2/source/tools/DataSourceHelper.cxx b/chart2/source/tools/DataSourceHelper.cxx index dc13e7f8e29d..f3146961b4c9 100644 --- a/chart2/source/tools/DataSourceHelper.cxx +++ b/chart2/source/tools/DataSourceHelper.cxx @@ -117,12 +117,6 @@ void lcl_addErrorBarRanges( } // anonymous namespace -rtl::Reference< ::chart::DataSource > DataSourceHelper::createDataSource( - const Sequence< Reference< chart2::data::XLabeledDataSequence > >& rSequences ) -{ - return new DataSource(rSequences); -} - Reference< chart2::data::XDataSequence > DataSourceHelper::createCachedDataSequence() { return new ::chart::CachedDataSequence(); @@ -219,7 +213,7 @@ void DataSourceHelper::readArguments( const uno::Sequence< beans::PropertyValue } } -uno::Reference< chart2::data::XDataSource > DataSourceHelper::pressUsedDataIntoRectangularFormat( +rtl::Reference< DataSource > DataSourceHelper::pressUsedDataIntoRectangularFormat( const rtl::Reference< ChartModel >& xChartDoc ) { std::vector< Reference< chart2::data::XLabeledDataSequence > > aResultVector; @@ -250,7 +244,7 @@ uno::Reference< chart2::data::XDataSource > DataSourceHelper::pressUsedDataIntoR aResultVector.push_back( labeledData ); } - return new DataSource( comphelper::containerToSequence(aResultVector) ); + return new DataSource( aResultVector ); } uno::Sequence< OUString > DataSourceHelper::getUsedDataRanges( @@ -281,13 +275,13 @@ uno::Sequence< OUString > DataSourceHelper::getUsedDataRanges( const rtl::Refere return getUsedDataRanges( xDiagram ); } -uno::Reference< chart2::data::XDataSource > DataSourceHelper::getUsedData( +rtl::Reference< DataSource > DataSourceHelper::getUsedData( const rtl::Reference<::chart::ChartModel>& xChartDoc ) { return pressUsedDataIntoRectangularFormat( xChartDoc ); } -uno::Reference< chart2::data::XDataSource > DataSourceHelper::getUsedData( +rtl::Reference< DataSource > DataSourceHelper::getUsedData( ChartModel& rModel ) { std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > aResult; |