chart2/source/controller/dialogs/DialogModel.cxx | 2 chart2/source/controller/main/ObjectHierarchy.cxx | 23 ++-- chart2/source/controller/sidebar/ChartElementsPanel.cxx | 13 +- chart2/source/inc/ChartTypeHelper.hxx | 65 +++++------ chart2/source/inc/ChartTypeTemplate.hxx | 5 chart2/source/inc/DiagramHelper.hxx | 10 - chart2/source/model/template/ChartTypeTemplate.cxx | 33 ------ chart2/source/tools/AxisHelper.cxx | 13 +- chart2/source/tools/ChartTypeHelper.cxx | 88 ++++++---------- chart2/source/tools/DiagramHelper.cxx | 83 ++++++--------- chart2/source/tools/SceneProperties.cxx | 1 chart2/source/tools/ThreeDHelper.cxx | 8 - 12 files changed, 141 insertions(+), 203 deletions(-)
New commits: commit 8a2da2585f2dc031235cda98ecd811683755474e Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Tue Jan 25 18:58:10 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Jan 25 19:15:00 2022 +0100 use more concrete types in chart2, ChartType Change-Id: I0f95c0a7be864ebde5f3234e77e4f915f57ffdcf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128939 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/chart2/source/inc/ChartTypeHelper.hxx b/chart2/source/inc/ChartTypeHelper.hxx index d2c52876a7ff..cd5985f9a51c 100644 --- a/chart2/source/inc/ChartTypeHelper.hxx +++ b/chart2/source/inc/ChartTypeHelper.hxx @@ -75,11 +75,11 @@ public: getAxisType( const rtl::Reference< ::chart::ChartType >& xChartType , sal_Int32 nDimensionIndex ); - static OUString getRoleOfSequenceForYAxisNumberFormatDetection( const css::uno::Reference< - css::chart2::XChartType >& xChartType ); + static OUString getRoleOfSequenceForYAxisNumberFormatDetection( const rtl::Reference< + ::chart::ChartType >& xChartType ); - static OUString getRoleOfSequenceForDataLabelNumberFormatDetection( const css::uno::Reference< - css::chart2::XChartType >& xChartType ); + static OUString getRoleOfSequenceForDataLabelNumberFormatDetection( const rtl::Reference< + ::chart::ChartType >& xChartType ); static bool isSupportingOnlyDeepStackingFor3D( const rtl::Reference< ::chart::ChartType >& xChartType ); }; diff --git a/chart2/source/inc/ChartTypeTemplate.hxx b/chart2/source/inc/ChartTypeTemplate.hxx index ce78429f0135..e5594c43bdc3 100644 --- a/chart2/source/inc/ChartTypeTemplate.hxx +++ b/chart2/source/inc/ChartTypeTemplate.hxx @@ -230,12 +230,9 @@ public: const css::uno::Reference< css::uno::XComponentContext >& GetComponentContext() const { return m_xContext;} - static void copyPropertiesFromOldToNewCoordinateSystem( - const css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > > & rOldChartTypesSeq, - const css::uno::Reference< css::chart2::XChartType > & xNewChartType ); static void copyPropertiesFromOldToNewCoordinateSystem( const std::vector< rtl::Reference< ChartType > > & rOldChartTypesSeq, - const css::uno::Reference< css::chart2::XChartType > & xNewChartType ); + const rtl::Reference< ChartType > & xNewChartType ); protected: css::uno::Reference< css::uno::XComponentContext > m_xContext; diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx index 28f0c7303efa..997de84ad302 100644 --- a/chart2/source/model/template/ChartTypeTemplate.cxx +++ b/chart2/source/model/template/ChartTypeTemplate.cxx @@ -802,36 +802,11 @@ void ChartTypeTemplate::createChartTypes( } } -void ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( - const Sequence< Reference< XChartType > > & rOldChartTypesSeq, - const Reference< XChartType > & xNewChartType ) -{ - Reference< beans::XPropertySet > xDestination( xNewChartType, uno::UNO_QUERY ); - if( !xDestination.is() ) - return; - - OUString aNewChartType( xNewChartType->getChartType() ); - - Reference< beans::XPropertySet > xSource; - for( Reference< XChartType > const & xOldType : rOldChartTypesSeq ) - { - if( xOldType.is() && xOldType->getChartType() == aNewChartType ) - { - xSource.set( Reference< beans::XPropertySet >(xOldType, uno::UNO_QUERY ) ); - if( xSource.is() ) - break; - } - } - if( xSource.is() ) - comphelper::copyProperties( xSource, xDestination ); -} - void ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( const std::vector< rtl::Reference< ChartType > > & rOldChartTypesSeq, - const Reference< XChartType > & xNewChartType ) + const rtl::Reference< ChartType > & xNewChartType ) { - Reference< beans::XPropertySet > xDestination( xNewChartType, uno::UNO_QUERY ); - if( !xDestination.is() ) + if( !xNewChartType.is() ) return; OUString aNewChartType( xNewChartType->getChartType() ); @@ -847,7 +822,7 @@ void ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( } } if( xSource.is() ) - comphelper::copyProperties( xSource, xDestination ); + comphelper::copyProperties( xSource, xNewChartType ); } } // namespace chart diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index 0b6521c5e6fd..03d15f47b921 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -148,6 +148,9 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( if (!xProp.is()) return 0; + auto pCorrespondingCoordinateSystem = dynamic_cast<BaseCoordinateSystem*>(xCorrespondingCoordinateSystem.get()); + assert(pCorrespondingCoordinateSystem); + bool bLinkToSource = true; xProp->getPropertyValue(CHART_UNONAME_LINK_TO_SRC_NUMFMT) >>= bLinkToSource; xProp->getPropertyValue(CHART_UNONAME_NUMFMT) >>= nNumberFormatKey; @@ -232,17 +235,15 @@ sal_Int32 AxisHelper::getExplicitNumberFormatKeyForAxis( try { - Reference< XChartTypeContainer > xCTCnt( xCorrespondingCoordinateSystem, uno::UNO_QUERY_THROW ); OUString aRoleToMatch; if( nDimensionIndex == 0 ) aRoleToMatch = "values-x"; - const Sequence< Reference< XChartType > > aChartTypes( xCTCnt->getChartTypes()); - for( Reference< XChartType > const & chartType : aChartTypes ) + const std::vector< rtl::Reference< ChartType > > & aChartTypes( pCorrespondingCoordinateSystem->getChartTypes2()); + for( rtl::Reference< ChartType > const & chartType : aChartTypes ) { if( nDimensionIndex != 0 ) aRoleToMatch = ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( chartType ); - Reference< XDataSeriesContainer > xDSCnt( chartType, uno::UNO_QUERY_THROW ); - const Sequence< Reference< XDataSeries > > aDataSeriesSeq( xDSCnt->getDataSeries()); + const Sequence< Reference< XDataSeries > > aDataSeriesSeq( chartType->getDataSeries()); for( Reference< chart2::XDataSeries > const & xDataSeries : aDataSeriesSeq ) { Reference< data::XDataSource > xSource( xDataSeries, uno::UNO_QUERY_THROW ); diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx index 975bfab60668..0942953be7ce 100644 --- a/chart2/source/tools/ChartTypeHelper.cxx +++ b/chart2/source/tools/ChartTypeHelper.cxx @@ -680,7 +680,7 @@ bool ChartTypeHelper::isSeriesInFrontOfAxisLine( const rtl::Reference< ChartType return true; } -OUString ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( const uno::Reference< XChartType >& xChartType ) +OUString ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( const rtl::Reference< ChartType >& xChartType ) { OUString aRet( "values-y" ); if( !xChartType.is() ) @@ -691,7 +691,7 @@ OUString ChartTypeHelper::getRoleOfSequenceForYAxisNumberFormatDetection( const return aRet; } -OUString ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( const uno::Reference< XChartType >& xChartType ) +OUString ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( const rtl::Reference< ChartType >& xChartType ) { OUString aRet( "values-y" ); if( !xChartType.is() ) commit 37d720b980c116a5b396b730d5850ebc6fc9d5a0 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Tue Jan 25 18:25:15 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Jan 25 19:14:46 2022 +0100 use more concrete types in chart2, ChartType Change-Id: Ife8d3f31d65e2911fa365a53f0defacde183f7b0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128936 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx index 431bc452e71e..165c4f39a654 100644 --- a/chart2/source/controller/dialogs/DialogModel.cxx +++ b/chart2/source/controller/dialogs/DialogModel.cxx @@ -637,7 +637,7 @@ void DialogModel::setCategories( const Reference< chart2::data::XLabeledDataSequ // categories bool bSupportsCategories = true; - Reference< XChartType > xFirstChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ); + rtl::Reference< ChartType > xFirstChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ); if( xFirstChartType.is() ) { sal_Int32 nAxisType = ChartTypeHelper::getAxisType( xFirstChartType, 0 ); // x-axis diff --git a/chart2/source/controller/main/ObjectHierarchy.cxx b/chart2/source/controller/main/ObjectHierarchy.cxx index 4649b422d79f..b15a90d79b4a 100644 --- a/chart2/source/controller/main/ObjectHierarchy.cxx +++ b/chart2/source/controller/main/ObjectHierarchy.cxx @@ -32,6 +32,7 @@ #include <LegendHelper.hxx> #include <chartview/DrawModelWrapper.hxx> #include <unonames.hxx> +#include <BaseCoordinateSystem.hxx> #include <map> #include <algorithm> @@ -315,22 +316,20 @@ void ObjectHierarchy::createDataSeriesTree( ObjectHierarchy::tChildContainer & rOutDiagramSubContainer, const Reference< XDiagram > & xDiagram ) { - Reference< XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW ); - + auto pDiagram = dynamic_cast<Diagram*>(xDiagram.get()); + assert(pDiagram); try { - sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram ); - Sequence< Reference< XCoordinateSystem > > aCooSysSeq( - xCooSysCnt->getCoordinateSystems()); - for( sal_Int32 nCooSysIdx=0; nCooSysIdx<aCooSysSeq.getLength(); ++nCooSysIdx ) + sal_Int32 nDimensionCount = DiagramHelper::getDimension( pDiagram ); + std::vector< rtl::Reference< BaseCoordinateSystem > > aCooSysSeq( + pDiagram->getBaseCoordinateSystems()); + for( sal_Int32 nCooSysIdx=0; nCooSysIdx<static_cast<sal_Int32>(aCooSysSeq.size()); ++nCooSysIdx ) { - Reference< XChartTypeContainer > xCTCnt( aCooSysSeq[nCooSysIdx], uno::UNO_QUERY_THROW ); - Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes()); - for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypeSeq.getLength(); ++nCTIdx ) + std::vector< rtl::Reference< ChartType > > aChartTypeSeq( aCooSysSeq[nCooSysIdx]->getChartTypes2()); + for( sal_Int32 nCTIdx=0; nCTIdx<static_cast<sal_Int32>(aChartTypeSeq.size()); ++nCTIdx ) { - Reference< XChartType > xChartType( aChartTypeSeq[nCTIdx] ); - Reference< XDataSeriesContainer > xDSCnt( xChartType, uno::UNO_QUERY_THROW ); - Sequence< Reference< XDataSeries > > aSeriesSeq( xDSCnt->getDataSeries() ); + rtl::Reference< ChartType > xChartType( aChartTypeSeq[nCTIdx] ); + Sequence< Reference< XDataSeries > > aSeriesSeq( xChartType->getDataSeries() ); const sal_Int32 nNumberOfSeries = ChartTypeHelper::getNumberOfDisplayedSeries( xChartType, aSeriesSeq.getLength()); diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx index 572ea7de4bd3..1d495dd209f5 100644 --- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx +++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx @@ -33,6 +33,7 @@ #include <AxisHelper.hxx> #include <DiagramHelper.hxx> #include <Diagram.hxx> +#include <ChartType.hxx> #include <ChartTypeHelper.hxx> #include <ChartModel.hxx> #include <BaseCoordinateSystem.hxx> @@ -406,21 +407,21 @@ void ChartElementsPanel::Initialize() namespace { -css::uno::Reference<css::chart2::XChartType> getChartType(const rtl::Reference<ChartModel>& xModel) +rtl::Reference<ChartType> getChartType(const rtl::Reference<ChartModel>& xModel) { rtl::Reference<Diagram > xDiagram = xModel->getFirstChartDiagram(); if (!xDiagram.is()) - return css::uno::Reference<css::chart2::XChartType>(); + return nullptr; const std::vector<rtl::Reference<BaseCoordinateSystem>> & xCooSysSequence(xDiagram->getBaseCoordinateSystems()); if (xCooSysSequence.empty()) - return css::uno::Reference<css::chart2::XChartType>(); + return nullptr; - css::uno::Sequence<css::uno::Reference<css::chart2::XChartType>> xChartTypeSequence(xCooSysSequence[0]->getChartTypes()); + const std::vector<rtl::Reference<ChartType>> & xChartTypeSequence(xCooSysSequence[0]->getChartTypes2()); - if (!xChartTypeSequence.hasElements()) - return css::uno::Reference<css::chart2::XChartType>(); + if (xChartTypeSequence.empty()) + return nullptr; return xChartTypeSequence[0]; } diff --git a/chart2/source/inc/ChartTypeHelper.hxx b/chart2/source/inc/ChartTypeHelper.hxx index 151df377f800..d2c52876a7ff 100644 --- a/chart2/source/inc/ChartTypeHelper.hxx +++ b/chart2/source/inc/ChartTypeHelper.hxx @@ -33,47 +33,46 @@ class ChartType; class OOO_DLLPUBLIC_CHARTTOOLS ChartTypeHelper { public: - static bool isSupportingGeometryProperties( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); - static bool isSupportingStatisticProperties( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); - static bool isSupportingRegressionProperties(const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); - static bool isSupportingMainAxis( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex ); - static bool isSupportingSecondaryAxis( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); - static bool isSupportingAreaProperties( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); - static bool isSupportingSymbolProperties( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); - static bool isSupportingOverlapAndGapWidthProperties( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); - static bool isSupportingBarConnectors( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); - static bool isSupportingRightAngledAxes( const css::uno::Reference< css::chart2::XChartType >& xChartType ); - static bool isSupportingAxisSideBySide( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); - static bool isSupportingStartingAngle( const css::uno::Reference< css::chart2::XChartType >& xChartType ); + static bool isSupportingGeometryProperties( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount ); + static bool isSupportingStatisticProperties( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount ); + static bool isSupportingRegressionProperties(const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount ); + static bool isSupportingMainAxis( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex ); + static bool isSupportingSecondaryAxis( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount ); + static bool isSupportingAreaProperties( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount ); + static bool isSupportingSymbolProperties( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount ); + static bool isSupportingOverlapAndGapWidthProperties( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount ); + static bool isSupportingBarConnectors( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount ); + static bool isSupportingRightAngledAxes( const rtl::Reference< ::chart::ChartType >& xChartType ); + static bool isSupportingAxisSideBySide( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount ); + static bool isSupportingStartingAngle( const rtl::Reference< ::chart::ChartType >& xChartType ); //starting value for bars or baseline for areas for example - static bool isSupportingBaseValue( const css::uno::Reference< css::chart2::XChartType >& xChartType ); - static bool isSupportingAxisPositioning( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex ); - static bool isSupportingDateAxis( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionIndex ); + static bool isSupportingBaseValue( const rtl::Reference< ::chart::ChartType >& xChartType ); + static bool isSupportingAxisPositioning( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex ); static bool isSupportingDateAxis( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionIndex ); - static bool isSupportingComplexCategory( const css::uno::Reference< css::chart2::XChartType >& xChartType ); - static bool isSupportingCategoryPositioning( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); - static bool shiftCategoryPosAtXAxisPerDefault( const css::uno::Reference< css::chart2::XChartType >& xChartType ); + static bool isSupportingComplexCategory( const rtl::Reference< ::chart::ChartType >& xChartType ); + static bool isSupportingCategoryPositioning( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount ); + static bool shiftCategoryPosAtXAxisPerDefault( const rtl::Reference< ::chart::ChartType >& xChartType ); //returns sequence of css::chart::DataLabelPlacement static css::uno::Sequence < sal_Int32 > getSupportedLabelPlacements( - const css::uno::Reference< css::chart2::XChartType >& xChartType, bool bSwapXAndY + const rtl::Reference< ::chart::ChartType >& xChartType, bool bSwapXAndY , const css::uno::Reference< css::chart2::XDataSeries >& xSeries ); //returns sequence of css::chart::MissingValueTreatment static css::uno::Sequence < sal_Int32 > getSupportedMissingValueTreatments( - const css::uno::Reference< css::chart2::XChartType >& xChartType ); + const rtl::Reference< ::chart::ChartType >& xChartType ); - SAL_DLLPRIVATE static css::drawing::Direction3D getDefaultSimpleLightDirection( const css::uno::Reference< css::chart2::XChartType >& xChartType ); - SAL_DLLPRIVATE static css::drawing::Direction3D getDefaultRealisticLightDirection( const css::uno::Reference< css::chart2::XChartType >& xChartType ); - SAL_DLLPRIVATE static sal_Int32 getDefaultDirectLightColor( bool bSimple, const css::uno::Reference< css::chart2::XChartType >& xChartType ); - SAL_DLLPRIVATE static sal_Int32 getDefaultAmbientLightColor( bool bSimple, const css::uno::Reference< css::chart2::XChartType >& xChartType ); - static sal_Int32 getNumberOfDisplayedSeries( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nNumberOfSeries ); - SAL_DLLPRIVATE static bool noBordersForSimpleScheme( const css::uno::Reference< css::chart2::XChartType >& xChartType ); + SAL_DLLPRIVATE static css::drawing::Direction3D getDefaultSimpleLightDirection( const rtl::Reference< ::chart::ChartType >& xChartType ); + SAL_DLLPRIVATE static css::drawing::Direction3D getDefaultRealisticLightDirection( const rtl::Reference< ::chart::ChartType >& xChartType ); + SAL_DLLPRIVATE static sal_Int32 getDefaultDirectLightColor( bool bSimple, const rtl::Reference< ::chart::ChartType >& xChartType ); + SAL_DLLPRIVATE static sal_Int32 getDefaultAmbientLightColor( bool bSimple, const rtl::Reference< ::chart::ChartType >& xChartType ); + static sal_Int32 getNumberOfDisplayedSeries( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nNumberOfSeries ); + SAL_DLLPRIVATE static bool noBordersForSimpleScheme( const rtl::Reference< ::chart::ChartType >& xChartType ); - static bool isSeriesInFrontOfAxisLine( const css::uno::Reference< css::chart2::XChartType >& xChartType ); + static bool isSeriesInFrontOfAxisLine( const rtl::Reference< ::chart::ChartType >& xChartType ); static sal_Int32 //one of css::chart2::AxisType - getAxisType( const css::uno::Reference< css::chart2::XChartType >& xChartType + getAxisType( const rtl::Reference< ::chart::ChartType >& xChartType , sal_Int32 nDimensionIndex ); static OUString getRoleOfSequenceForYAxisNumberFormatDetection( const css::uno::Reference< @@ -82,7 +81,7 @@ public: static OUString getRoleOfSequenceForDataLabelNumberFormatDetection( const css::uno::Reference< css::chart2::XChartType >& xChartType ); - static bool isSupportingOnlyDeepStackingFor3D( const css::uno::Reference< css::chart2::XChartType >& xChartType ); + static bool isSupportingOnlyDeepStackingFor3D( const rtl::Reference< ::chart::ChartType >& xChartType ); }; } //namespace chart diff --git a/chart2/source/inc/DiagramHelper.hxx b/chart2/source/inc/DiagramHelper.hxx index 3d0931d17f87..a05de767d38d 100644 --- a/chart2/source/inc/DiagramHelper.hxx +++ b/chart2/source/inc/DiagramHelper.hxx @@ -116,7 +116,7 @@ public: "ambiguous") */ static StackMode getStackModeFromChartType( - const css::uno::Reference< css::chart2::XChartType > & xChartType, + const rtl::Reference< ::chart::ChartType > & xChartType, bool& rbFound, bool& rbAmbiguous, const css::uno::Reference< css::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem ); @@ -217,9 +217,9 @@ public: getChartTypesFromDiagram( const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); - SAL_DLLPRIVATE static bool areChartTypesCompatible( const css::uno::Reference< - css::chart2::XChartType >& xFirstType, - const css::uno::Reference< css::chart2::XChartType >& xSecondType ); + SAL_DLLPRIVATE static bool areChartTypesCompatible( + const rtl::Reference< ::chart::ChartType >& xFirstType, + const rtl::Reference< ::chart::ChartType >& xSecondType ); /** * Test if a series can be moved. @@ -276,7 +276,7 @@ public: //returns integer from constant group css::chart::MissingValueTreatment static sal_Int32 getCorrectedMissingValueTreatment( const css::uno::Reference< css::chart2::XDiagram > & xDiagram, - const css::uno::Reference< css::chart2::XChartType >& xChartType ); + const rtl::Reference< ::chart::ChartType >& xChartType ); static DiagramPositioningMode getDiagramPositioningMode( const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); diff --git a/chart2/source/model/template/ChartTypeTemplate.cxx b/chart2/source/model/template/ChartTypeTemplate.cxx index af0a48ab6511..28f0c7303efa 100644 --- a/chart2/source/model/template/ChartTypeTemplate.cxx +++ b/chart2/source/model/template/ChartTypeTemplate.cxx @@ -107,7 +107,7 @@ void lcl_resetLabelPlacementIfDefault( const Reference< beans::XPropertySet >& x } } -void lcl_ensureCorrectMissingValueTreatment( const Reference< chart2::XDiagram >& xDiagram, const Reference< XChartType >& xChartType ) +void lcl_ensureCorrectMissingValueTreatment( const Reference< chart2::XDiagram >& xDiagram, const rtl::Reference< ::chart::ChartType >& xChartType ) { Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY ); if( xDiaProp.is() ) diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index 49cdeec144dd..0b6521c5e6fd 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -933,7 +933,7 @@ bool AxisHelper::shouldAxisBeDisplayed( const Reference< XAxis >& xAxis if( AxisHelper::getIndicesForAxis( xAxis, xCooSys, nDimensionIndex, nAxisIndex ) ) { sal_Int32 nDimensionCount = xCooSys->getDimension(); - Reference< XChartType > xChartType( AxisHelper::getChartTypeByIndex( xCooSys, 0 ) ); + rtl::Reference< ChartType > xChartType( AxisHelper::getChartTypeByIndex( xCooSys, 0 ) ); bool bMainAxis = (nAxisIndex==MAIN_AXIS_INDEX); if( bMainAxis ) diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx index 286e4ab5e307..975bfab60668 100644 --- a/chart2/source/tools/ChartTypeHelper.cxx +++ b/chart2/source/tools/ChartTypeHelper.cxx @@ -38,7 +38,7 @@ namespace chart { bool ChartTypeHelper::isSupportingAxisSideBySide( - const uno::Reference< chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ) + const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nDimensionCount ) { bool bResult = false; @@ -59,7 +59,7 @@ bool ChartTypeHelper::isSupportingAxisSideBySide( return bResult; } -bool ChartTypeHelper::isSupportingGeometryProperties( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount ) +bool ChartTypeHelper::isSupportingGeometryProperties( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount ) { //form tab only for 3D-bar and 3D-column charts. @@ -78,7 +78,7 @@ bool ChartTypeHelper::isSupportingGeometryProperties( const uno::Reference< XCha return false; } -bool ChartTypeHelper::isSupportingStatisticProperties( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount ) +bool ChartTypeHelper::isSupportingStatisticProperties( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount ) { //3D charts, pie, net and stock do not support statistic properties @@ -103,13 +103,13 @@ bool ChartTypeHelper::isSupportingStatisticProperties( const uno::Reference< XCh return true; } -bool ChartTypeHelper::isSupportingRegressionProperties( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount ) +bool ChartTypeHelper::isSupportingRegressionProperties( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount ) { // note: old chart: only scatter chart return isSupportingStatisticProperties( xChartType, nDimensionCount ); } -bool ChartTypeHelper::isSupportingAreaProperties( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount ) +bool ChartTypeHelper::isSupportingAreaProperties( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount ) { //2D line charts, net and stock do not support area properties @@ -132,7 +132,7 @@ bool ChartTypeHelper::isSupportingAreaProperties( const uno::Reference< XChartTy return true; } -bool ChartTypeHelper::isSupportingSymbolProperties( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount ) +bool ChartTypeHelper::isSupportingSymbolProperties( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount ) { //2D line charts, 2D scatter charts and 2D net charts do support symbols @@ -153,7 +153,7 @@ bool ChartTypeHelper::isSupportingSymbolProperties( const uno::Reference< XChart return false; } -bool ChartTypeHelper::isSupportingMainAxis( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex ) +bool ChartTypeHelper::isSupportingMainAxis( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex ) { //pie charts do not support axis at all //no 3rd axis for 2D charts @@ -171,7 +171,7 @@ bool ChartTypeHelper::isSupportingMainAxis( const uno::Reference< XChartType >& return true; } -bool ChartTypeHelper::isSupportingSecondaryAxis( const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount ) +bool ChartTypeHelper::isSupportingSecondaryAxis( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount ) { //3D, pie and net charts do not support a secondary axis at all @@ -193,7 +193,7 @@ bool ChartTypeHelper::isSupportingSecondaryAxis( const uno::Reference< XChartTyp } bool ChartTypeHelper::isSupportingOverlapAndGapWidthProperties( - const uno::Reference< XChartType >& xChartType, sal_Int32 nDimensionCount ) + const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount ) { //2D bar charts do support a this special properties @@ -213,7 +213,7 @@ bool ChartTypeHelper::isSupportingOverlapAndGapWidthProperties( } bool ChartTypeHelper::isSupportingBarConnectors( - const uno::Reference< chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ) + const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount ) { //2D bar charts with stacked series support this @@ -238,7 +238,7 @@ bool ChartTypeHelper::isSupportingBarConnectors( return false; } -uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedLabelPlacements( const uno::Reference< chart2::XChartType >& xChartType +uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedLabelPlacements( const rtl::Reference< ChartType >& xChartType , bool bSwapXAndY , const uno::Reference< chart2::XDataSeries >& xSeries ) { @@ -250,8 +250,7 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedLabelPlacements( const if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) ) { bool bDonut = false; - uno::Reference< beans::XPropertySet > xChartTypeProp( xChartType, uno::UNO_QUERY_THROW ); - xChartTypeProp->getPropertyValue( "UseRings") >>= bDonut; + xChartType->getPropertyValue( "UseRings") >>= bDonut; if(!bDonut) { @@ -370,7 +369,7 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedLabelPlacements( const return aRet; } -bool ChartTypeHelper::isSupportingRightAngledAxes( const uno::Reference< chart2::XChartType >& xChartType ) +bool ChartTypeHelper::isSupportingRightAngledAxes( const rtl::Reference< ChartType >& xChartType ) { if(xChartType.is()) { @@ -381,7 +380,7 @@ bool ChartTypeHelper::isSupportingRightAngledAxes( const uno::Reference< chart2: return true; } -bool ChartTypeHelper::isSupportingStartingAngle( const uno::Reference< chart2::XChartType >& xChartType ) +bool ChartTypeHelper::isSupportingStartingAngle( const rtl::Reference< ChartType >& xChartType ) { if(xChartType.is()) { @@ -391,7 +390,7 @@ bool ChartTypeHelper::isSupportingStartingAngle( const uno::Reference< chart2::X } return false; } -bool ChartTypeHelper::isSupportingBaseValue( const uno::Reference< chart2::XChartType >& xChartType ) +bool ChartTypeHelper::isSupportingBaseValue( const rtl::Reference< ChartType >& xChartType ) { if(xChartType.is()) { @@ -405,7 +404,7 @@ bool ChartTypeHelper::isSupportingBaseValue( const uno::Reference< chart2::XChar return false; } -bool ChartTypeHelper::isSupportingAxisPositioning( const uno::Reference< chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex ) +bool ChartTypeHelper::isSupportingAxisPositioning( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex ) { if(xChartType.is()) { @@ -420,26 +419,6 @@ bool ChartTypeHelper::isSupportingAxisPositioning( const uno::Reference< chart2: return true; } -bool ChartTypeHelper::isSupportingDateAxis( const uno::Reference< chart2::XChartType >& xChartType, sal_Int32 nDimensionIndex ) -{ - if( nDimensionIndex!=0 ) - return false; - if( xChartType.is() ) - { - sal_Int32 nType = ChartTypeHelper::getAxisType( xChartType, nDimensionIndex ); - if( nType != AxisType::CATEGORY ) - return false; - OUString aChartTypeName = xChartType->getChartType(); - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) ) - return false; - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) - return false; - if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) ) - return false; - } - return true; -} - bool ChartTypeHelper::isSupportingDateAxis( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionIndex ) { if( nDimensionIndex!=0 ) @@ -460,7 +439,7 @@ bool ChartTypeHelper::isSupportingDateAxis( const rtl::Reference< ChartType >& x return true; } -bool ChartTypeHelper::isSupportingComplexCategory( const uno::Reference< chart2::XChartType >& xChartType ) +bool ChartTypeHelper::isSupportingComplexCategory( const rtl::Reference< ChartType >& xChartType ) { if( xChartType.is() ) { @@ -471,7 +450,7 @@ bool ChartTypeHelper::isSupportingComplexCategory( const uno::Reference< chart2: return true; } -bool ChartTypeHelper::isSupportingCategoryPositioning( const uno::Reference< chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ) +bool ChartTypeHelper::isSupportingCategoryPositioning( const rtl::Reference< ChartType >& xChartType, sal_Int32 nDimensionCount ) { if( xChartType.is() ) { @@ -487,7 +466,7 @@ bool ChartTypeHelper::isSupportingCategoryPositioning( const uno::Reference< cha return false; } -bool ChartTypeHelper::shiftCategoryPosAtXAxisPerDefault( const uno::Reference< chart2::XChartType >& xChartType ) +bool ChartTypeHelper::shiftCategoryPosAtXAxisPerDefault( const rtl::Reference< ChartType >& xChartType ) { if(xChartType.is()) { @@ -500,7 +479,7 @@ bool ChartTypeHelper::shiftCategoryPosAtXAxisPerDefault( const uno::Reference< c return false; } -bool ChartTypeHelper::noBordersForSimpleScheme( const uno::Reference< chart2::XChartType >& xChartType ) +bool ChartTypeHelper::noBordersForSimpleScheme( const rtl::Reference< ChartType >& xChartType ) { if(xChartType.is()) { @@ -511,7 +490,7 @@ bool ChartTypeHelper::noBordersForSimpleScheme( const uno::Reference< chart2::XC return false; } -sal_Int32 ChartTypeHelper::getDefaultDirectLightColor( bool bSimple, const uno::Reference< chart2::XChartType >& xChartType ) +sal_Int32 ChartTypeHelper::getDefaultDirectLightColor( bool bSimple, const rtl::Reference< ChartType >& xChartType ) { sal_Int32 nRet = static_cast< sal_Int32 >( 0x808080 ); // grey if( xChartType .is() ) @@ -531,7 +510,7 @@ sal_Int32 ChartTypeHelper::getDefaultDirectLightColor( bool bSimple, const uno:: return nRet; } -sal_Int32 ChartTypeHelper::getDefaultAmbientLightColor( bool bSimple, const uno::Reference< chart2::XChartType >& xChartType ) +sal_Int32 ChartTypeHelper::getDefaultAmbientLightColor( bool bSimple, const rtl::Reference< ChartType >& xChartType ) { sal_Int32 nRet = static_cast< sal_Int32 >( 0x999999 ); // grey40 if( xChartType .is() ) @@ -548,7 +527,7 @@ sal_Int32 ChartTypeHelper::getDefaultAmbientLightColor( bool bSimple, const uno: return nRet; } -drawing::Direction3D ChartTypeHelper::getDefaultSimpleLightDirection( const uno::Reference< chart2::XChartType >& xChartType ) +drawing::Direction3D ChartTypeHelper::getDefaultSimpleLightDirection( const rtl::Reference< ChartType >& xChartType ) { drawing::Direction3D aRet(0.0, 0.0, 1.0); if( xChartType .is() ) @@ -563,7 +542,7 @@ drawing::Direction3D ChartTypeHelper::getDefaultSimpleLightDirection( const uno: return aRet; } -drawing::Direction3D ChartTypeHelper::getDefaultRealisticLightDirection( const uno::Reference< chart2::XChartType >& xChartType ) +drawing::Direction3D ChartTypeHelper::getDefaultRealisticLightDirection( const rtl::Reference< ChartType >& xChartType ) { drawing::Direction3D aRet(0.0, 0.0, 1.0); if( xChartType .is() ) @@ -578,8 +557,8 @@ drawing::Direction3D ChartTypeHelper::getDefaultRealisticLightDirection( const u return aRet; } -sal_Int32 ChartTypeHelper::getAxisType( const uno::Reference< - XChartType >& xChartType, sal_Int32 nDimensionIndex ) +sal_Int32 ChartTypeHelper::getAxisType( const rtl::Reference< + ChartType >& xChartType, sal_Int32 nDimensionIndex ) { //returned is a constant from constant group css::chart2::AxisType @@ -603,7 +582,7 @@ sal_Int32 ChartTypeHelper::getAxisType( const uno::Reference< } sal_Int32 ChartTypeHelper::getNumberOfDisplayedSeries( - const uno::Reference< XChartType >& xChartType, + const rtl::Reference< ChartType >& xChartType, sal_Int32 nNumberOfSeries ) { if( xChartType.is() ) @@ -613,9 +592,8 @@ sal_Int32 ChartTypeHelper::getNumberOfDisplayedSeries( OUString aChartTypeName = xChartType->getChartType(); if( aChartTypeName == CHART2_SERVICE_NAME_CHARTTYPE_PIE ) { - uno::Reference< beans::XPropertySet > xChartTypeProp( xChartType, uno::UNO_QUERY_THROW ); bool bDonut = false; - if( (xChartTypeProp->getPropertyValue( "UseRings") >>= bDonut) + if( (xChartType->getPropertyValue( "UseRings") >>= bDonut) && !bDonut ) { return nNumberOfSeries>0 ? 1 : 0; @@ -630,7 +608,7 @@ sal_Int32 ChartTypeHelper::getNumberOfDisplayedSeries( return nNumberOfSeries; } -uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedMissingValueTreatments( const uno::Reference< XChartType >& xChartType ) +uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedMissingValueTreatments( const rtl::Reference< ChartType >& xChartType ) { uno::Sequence < sal_Int32 > aRet; if( !xChartType.is() ) @@ -691,7 +669,7 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedMissingValueTreatments( return aRet; } -bool ChartTypeHelper::isSeriesInFrontOfAxisLine( const uno::Reference< XChartType >& xChartType ) +bool ChartTypeHelper::isSeriesInFrontOfAxisLine( const rtl::Reference< ChartType >& xChartType ) { if( xChartType.is() ) { @@ -725,7 +703,7 @@ OUString ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( co return aRet; } -bool ChartTypeHelper::isSupportingOnlyDeepStackingFor3D( const uno::Reference< XChartType >& xChartType ) +bool ChartTypeHelper::isSupportingOnlyDeepStackingFor3D( const rtl::Reference< ChartType >& xChartType ) { bool bRet = false; if( !xChartType.is() ) diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index ebbe3b528954..8a1a5350a227 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -313,10 +313,10 @@ StackMode DiagramHelper::getStackMode( const Reference< XDiagram > & xDiagram, b for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : pDiagram->getBaseCoordinateSystems() ) { //iterate through all chart types in the current coordinate system - uno::Sequence< uno::Reference< XChartType > > aChartTypeList( xCooSys->getChartTypes() ); - for( sal_Int32 nT = 0; nT < aChartTypeList.getLength(); ++nT ) + std::vector< rtl::Reference< ChartType > > aChartTypeList( xCooSys->getChartTypes2() ); + for( sal_Int32 nT = 0; nT < static_cast<sal_Int32>(aChartTypeList.size()); ++nT ) { - uno::Reference< XChartType > xChartType( aChartTypeList[nT] ); + rtl::Reference< ChartType > xChartType( aChartTypeList[nT] ); StackMode eLocalStackMode = DiagramHelper::getStackModeFromChartType( xChartType, rbFound, rbAmbiguous, xCooSys ); @@ -335,7 +335,7 @@ StackMode DiagramHelper::getStackMode( const Reference< XDiagram > & xDiagram, b } StackMode DiagramHelper::getStackModeFromChartType( - const Reference< XChartType > & xChartType, + const rtl::Reference< ChartType > & xChartType, bool& rbFound, bool& rbAmbiguous, const Reference< XCoordinateSystem > & xCorrespondingCoordinateSystem ) { @@ -345,8 +345,7 @@ StackMode DiagramHelper::getStackModeFromChartType( try { - Reference< XDataSeriesContainer > xDSCnt( xChartType, uno::UNO_QUERY_THROW ); - Sequence< Reference< chart2::XDataSeries > > aSeries( xDSCnt->getDataSeries()); + Sequence< Reference< chart2::XDataSeries > > aSeries( xChartType->getDataSeries()); chart2::StackingDirection eCommonDirection = chart2::StackingDirection_NO_STACKING; bool bDirectionInitialized = false; @@ -470,8 +469,8 @@ void DiagramHelper::setDimension( { rtl::Reference< BaseCoordinateSystem > xNewCooSys; - const Sequence< Reference< XChartType > > aChartTypeList( xOldCooSys->getChartTypes() ); - for( Reference< XChartType > const & xChartType : aChartTypeList ) + const std::vector< rtl::Reference< ChartType > > aChartTypeList( xOldCooSys->getChartTypes2() ); + for( rtl::Reference< ChartType > const & xChartType : aChartTypeList ) { bIsSupportingOnlyDeepStackingFor3D = ChartTypeHelper::isSupportingOnlyDeepStackingFor3D( xChartType ); if(!xNewCooSys.is()) @@ -1176,8 +1175,8 @@ std::vector< rtl::Reference< ChartType > > return aResult; } -bool DiagramHelper::areChartTypesCompatible( const Reference< ::chart2::XChartType >& xFirstType, - const Reference< ::chart2::XChartType >& xSecondType ) +bool DiagramHelper::areChartTypesCompatible( const rtl::Reference< ChartType >& xFirstType, + const rtl::Reference< ChartType >& xSecondType ) { if( !xFirstType.is() || !xSecondType.is() ) return false; @@ -1242,20 +1241,16 @@ bool lcl_moveSeriesOrCheckIfMoveIsAllowed( const rtl::Reference< BaseCoordinateSystem > & xCooSys( aCooSysList[nCS] ); //iterate through all chart types in the current coordinate system - uno::Sequence< uno::Reference< XChartType > > aChartTypeList( xCooSys->getChartTypes() ); - uno::Reference< XChartType > xFormerChartType; + std::vector< rtl::Reference< ChartType > > aChartTypeList( xCooSys->getChartTypes2() ); + rtl::Reference< ChartType > xFormerChartType; - for( sal_Int32 nT = 0; !bFound && nT < aChartTypeList.getLength(); ++nT ) + for( sal_Int32 nT = 0; !bFound && nT < static_cast<sal_Int32>(aChartTypeList.size()); ++nT ) { - uno::Reference< XChartType > xCurrentChartType( aChartTypeList[nT] ); + rtl::Reference< ChartType > xCurrentChartType( aChartTypeList[nT] ); //iterate through all series in this chart type - uno::Reference< XDataSeriesContainer > xDataSeriesContainer( xCurrentChartType, uno::UNO_QUERY ); - OSL_ASSERT( xDataSeriesContainer.is()); - if( !xDataSeriesContainer.is() ) - continue; - uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xDataSeriesContainer->getDataSeries() ); + uno::Sequence< uno::Reference< XDataSeries > > aSeriesList( xCurrentChartType->getDataSeries() ); auto aSeriesListRange = asNonConstRange(aSeriesList); for( sal_Int32 nS = 0; !bFound && nS < aSeriesList.getLength(); ++nS ) @@ -1285,7 +1280,7 @@ bool lcl_moveSeriesOrCheckIfMoveIsAllowed( { aSeriesListRange[ nOldSeriesIndex ] = aSeriesList[ nNewSeriesIndex ]; aSeriesListRange[ nNewSeriesIndex ] = xGivenDataSeries; - xDataSeriesContainer->setDataSeries( aSeriesList ); + xCurrentChartType->setDataSeries( aSeriesList ); } } else if( nNewSeriesIndex<0 ) @@ -1296,46 +1291,38 @@ bool lcl_moveSeriesOrCheckIfMoveIsAllowed( bMovedOrMoveAllowed = true; if( bDoMove ) { - uno::Reference< XDataSeriesContainer > xOtherDataSeriesContainer( xFormerChartType, uno::UNO_QUERY ); - if( xOtherDataSeriesContainer.is() ) + uno::Sequence< uno::Reference< XDataSeries > > aOtherSeriesList( xFormerChartType->getDataSeries() ); + sal_Int32 nOtherSeriesIndex = aOtherSeriesList.getLength()-1; + if( nOtherSeriesIndex >= 0 && nOtherSeriesIndex < aOtherSeriesList.getLength() ) { - uno::Sequence< uno::Reference< XDataSeries > > aOtherSeriesList( xOtherDataSeriesContainer->getDataSeries() ); - sal_Int32 nOtherSeriesIndex = aOtherSeriesList.getLength()-1; - if( nOtherSeriesIndex >= 0 && nOtherSeriesIndex < aOtherSeriesList.getLength() ) - { - uno::Reference< XDataSeries > xExchangeSeries( aOtherSeriesList[nOtherSeriesIndex] ); - aOtherSeriesList.getArray()[nOtherSeriesIndex] = xGivenDataSeries; - xOtherDataSeriesContainer->setDataSeries(aOtherSeriesList); - - aSeriesListRange[nOldSeriesIndex]=xExchangeSeries; - xDataSeriesContainer->setDataSeries(aSeriesList); - } + uno::Reference< XDataSeries > xExchangeSeries( aOtherSeriesList[nOtherSeriesIndex] ); + aOtherSeriesList.getArray()[nOtherSeriesIndex] = xGivenDataSeries; + xFormerChartType->setDataSeries(aOtherSeriesList); + + aSeriesListRange[nOldSeriesIndex]=xExchangeSeries; + xCurrentChartType->setDataSeries(aSeriesList); } } } } - else if( nT+1 < aChartTypeList.getLength() ) + else if( nT+1 < static_cast<sal_Int32>(aChartTypeList.size()) ) { //exchange series with next charttype - uno::Reference< XChartType > xOtherChartType( aChartTypeList[nT+1] ); + rtl::Reference< ChartType > xOtherChartType( aChartTypeList[nT+1] ); if( xOtherChartType.is() && DiagramHelper::areChartTypesCompatible( xOtherChartType, xCurrentChartType ) ) { bMovedOrMoveAllowed = true; if( bDoMove ) { - uno::Reference< XDataSeriesContainer > xOtherDataSeriesContainer( xOtherChartType, uno::UNO_QUERY ); - if( xOtherDataSeriesContainer.is() ) + uno::Sequence< uno::Reference< XDataSeries > > aOtherSeriesList( xOtherChartType->getDataSeries() ); + if( aOtherSeriesList.hasElements() ) { - uno::Sequence< uno::Reference< XDataSeries > > aOtherSeriesList( xOtherDataSeriesContainer->getDataSeries() ); - if( aOtherSeriesList.hasElements() ) - { - uno::Reference< XDataSeries > xExchangeSeries( aOtherSeriesList[0] ); - aOtherSeriesList.getArray()[0] = xGivenDataSeries; - xOtherDataSeriesContainer->setDataSeries(aOtherSeriesList); - - aSeriesListRange[nOldSeriesIndex]=xExchangeSeries; - xDataSeriesContainer->setDataSeries(aSeriesList); - } + uno::Reference< XDataSeries > xExchangeSeries( aOtherSeriesList[0] ); + aOtherSeriesList.getArray()[0] = xGivenDataSeries; + xOtherChartType->setDataSeries(aOtherSeriesList); + + aSeriesListRange[nOldSeriesIndex]=xExchangeSeries; + xCurrentChartType->setDataSeries(aSeriesList); } } } @@ -1487,7 +1474,7 @@ void DiagramHelper::setGeometry3D( sal_Int32 DiagramHelper::getCorrectedMissingValueTreatment( const Reference< chart2::XDiagram > & xDiagram, - const Reference< chart2::XChartType >& xChartType ) + const rtl::Reference< ChartType >& xChartType ) { sal_Int32 nResult = css::chart::MissingValueTreatment::LEAVE_GAP; const uno::Sequence < sal_Int32 > aAvailableMissingValueTreatments( diff --git a/chart2/source/tools/SceneProperties.cxx b/chart2/source/tools/SceneProperties.cxx index 9d5746ef649d..a98bfef2d04e 100644 --- a/chart2/source/tools/SceneProperties.cxx +++ b/chart2/source/tools/SceneProperties.cxx @@ -18,6 +18,7 @@ */ #include <SceneProperties.hxx> +#include <ChartType.hxx> #include <ChartTypeHelper.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/drawing/HomogenMatrix.hpp> diff --git a/chart2/source/tools/ThreeDHelper.cxx b/chart2/source/tools/ThreeDHelper.cxx index 33427cccf7dc..6ffa8be980d4 100644 --- a/chart2/source/tools/ThreeDHelper.cxx +++ b/chart2/source/tools/ThreeDHelper.cxx @@ -155,7 +155,7 @@ bool lcl_isLightScheme( const uno::Reference< beans::XPropertySet >& xDiagramPro return false; uno::Reference< chart2::XDiagram > xDiagram( xDiagramProps, uno::UNO_QUERY ); - uno::Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ); + rtl::Reference< ChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ); sal_Int32 nColor = 0; xDiagramProps->getPropertyValue( UNO_NAME_3D_SCENE_LIGHTCOLOR_2 ) >>= nColor; @@ -213,7 +213,7 @@ void lcl_setLightsForScheme( const uno::Reference< beans::XPropertySet >& xDiagr xDiagramProps->setPropertyValue( UNO_NAME_3D_SCENE_LIGHTON_2, uno::Any( true ) ); uno::Reference< chart2::XDiagram > xDiagram( xDiagramProps, uno::UNO_QUERY ); - uno::Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ); + rtl::Reference< ChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ); uno::Any aADirection( rScheme == ThreeDLookScheme::ThreeDLookScheme_Simple ? ChartTypeHelper::getDefaultSimpleLightDirection(xChartType) : ChartTypeHelper::getDefaultRealisticLightDirection(xChartType) ); @@ -267,7 +267,7 @@ bool lcl_isSimpleScheme( drawing::ShadeMode aShadeMode return false; if(nObjectLines==0) { - uno::Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ); + rtl::Reference< ChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ); return ChartTypeHelper::noBordersForSimpleScheme( xChartType ); } if(nObjectLines!=1) @@ -292,7 +292,7 @@ void lcl_setSimpleScheme( drawing::ShadeMode& rShadeMode rShadeMode = drawing::ShadeMode_FLAT; rnRoundedEdges = 0; - uno::Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ); + rtl::Reference< ChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ); rnObjectLines = ChartTypeHelper::noBordersForSimpleScheme( xChartType ) ? 0 : 1; }