From 37d720b980c116a5b396b730d5850ebc6fc9d5a0 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 25 Jan 2022 18:25:15 +0200 Subject: 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 --- chart2/source/tools/AxisHelper.cxx | 2 +- chart2/source/tools/ChartTypeHelper.cxx | 84 ++++++++++++--------------------- chart2/source/tools/DiagramHelper.cxx | 83 ++++++++++++++------------------ chart2/source/tools/SceneProperties.cxx | 1 + chart2/source/tools/ThreeDHelper.cxx | 8 ++-- 5 files changed, 72 insertions(+), 106 deletions(-) (limited to 'chart2/source/tools') 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(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(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(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 +#include #include #include #include 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; } -- cgit