diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-16 09:20:17 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-20 17:54:39 +0000 |
commit | 70595c0291e4cc137158c77f6136025b10ce6728 (patch) | |
tree | c8c8c7df0c15f3e4db749774f37081613483a2d5 /chart2/source/tools/DiagramHelper.cxx | |
parent | e7d5e346677efeb7d7d14537a9151ea7a1a32809 (diff) |
move setDimension/getDimension inside chart2::Diagram
Change-Id: If52f92e152011ead81a1b25f30ba15124e6a8e75
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149151
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source/tools/DiagramHelper.cxx')
-rw-r--r-- | chart2/source/tools/DiagramHelper.cxx | 80 |
1 files changed, 0 insertions, 80 deletions
diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index f90da4a02428..15037d3c6038 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -389,86 +389,6 @@ StackMode DiagramHelper::getStackModeFromChartType( return eStackMode; } -sal_Int32 DiagramHelper::getDimension( const rtl::Reference< Diagram > & xDiagram ) -{ - // -1: not yet set - sal_Int32 nResult = -1; - if (!xDiagram) - return nResult; - - try - { - for( rtl::Reference< BaseCoordinateSystem > const & xCooSys : xDiagram->getBaseCoordinateSystems() ) - { - if(xCooSys.is()) - { - nResult = xCooSys->getDimension(); - break; - } - } - } - catch( const uno::Exception & ) - { - DBG_UNHANDLED_EXCEPTION("chart2"); - } - - return nResult; -} - -void DiagramHelper::setDimension( - const rtl::Reference< Diagram > & xDiagram, - sal_Int32 nNewDimensionCount ) -{ - if( ! xDiagram.is()) - return; - - if( DiagramHelper::getDimension( xDiagram ) == nNewDimensionCount ) - return; - - try - { - bool rbFound = false; - bool rbAmbiguous = true; - StackMode eStackMode = DiagramHelper::getStackMode( xDiagram, rbFound, rbAmbiguous ); - bool bIsSupportingOnlyDeepStackingFor3D=false; - - //change all coordinate systems: - auto aCoordSystems = xDiagram->getBaseCoordinateSystems(); - for( rtl::Reference<BaseCoordinateSystem> const & xOldCooSys : aCoordSystems ) - { - rtl::Reference< BaseCoordinateSystem > xNewCooSys; - - const std::vector< rtl::Reference< ChartType > > aChartTypeList( xOldCooSys->getChartTypes2() ); - for( rtl::Reference< ChartType > const & xChartType : aChartTypeList ) - { - bIsSupportingOnlyDeepStackingFor3D = ChartTypeHelper::isSupportingOnlyDeepStackingFor3D( xChartType ); - if(!xNewCooSys.is()) - { - xNewCooSys = dynamic_cast<BaseCoordinateSystem*>(xChartType->createCoordinateSystem( nNewDimensionCount ).get()); - assert(xNewCooSys); - break; - } - //@todo make sure that all following charttypes are also capable of the new dimension - //otherwise separate them in a different group - //BM: might be done in replaceCoordinateSystem() - } - - // replace the old coordinate system at all places where it was used - xDiagram->replaceCoordinateSystem( xOldCooSys, xNewCooSys ); - } - - //correct stack mode if necessary - if( nNewDimensionCount==3 && eStackMode != StackMode::ZStacked && bIsSupportingOnlyDeepStackingFor3D ) - DiagramHelper::setStackMode( xDiagram, StackMode::ZStacked ); - else if( nNewDimensionCount==2 && eStackMode == StackMode::ZStacked ) - DiagramHelper::setStackMode( xDiagram, StackMode::NONE ); - } - catch( const uno::Exception & ) - { - DBG_UNHANDLED_EXCEPTION("chart2"); - } -} - bool DiagramHelper::isSeriesAttachedToMainAxis( const uno::Reference< chart2::XDataSeries >& xDataSeries ) { |