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/controller | |
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/controller')
10 files changed, 28 insertions, 18 deletions
diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx index 6edc2732f2b3..8961c2731f71 100644 --- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx @@ -548,7 +548,7 @@ bool DataSeriesPointWrapper::isSupportingAreaProperties() rtl::Reference< DataSeries > xSeries( getDataSeries() ); rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() ); rtl::Reference< ::chart::ChartType > xChartType( xDiagram->getChartTypeOfSeries( xSeries ) ); - sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram ); + sal_Int32 nDimensionCount = xDiagram->getDimension(); return ChartTypeHelper::isSupportingAreaProperties( xChartType, nDimensionCount ); } diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx index 2de5055c41aa..29127127da6f 100644 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx @@ -1320,9 +1320,9 @@ void WrappedDim3DProperty::setPropertyValue( const Any& rOuterValue, const Refer if( !xDiagram.is() ) return; - bool bOld3D = DiagramHelper::getDimension( xDiagram ) == 3; + bool bOld3D = xDiagram->getDimension() == 3; if( bOld3D != bNew3D ) - DiagramHelper::setDimension( xDiagram, bNew3D ? 3 : 2 ); + xDiagram->setDimension( bNew3D ? 3 : 2 ); } Any WrappedDim3DProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const @@ -1330,7 +1330,7 @@ Any WrappedDim3DProperty::getPropertyValue( const Reference< beans::XPropertySet rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() ); if( xDiagram.is() ) { - bool b3D = DiagramHelper::getDimension( xDiagram ) == 3; + bool b3D = xDiagram->getDimension() == 3; m_aOuterValue <<= b3D; } return m_aOuterValue; @@ -1487,8 +1487,10 @@ void WrappedNumberOfLinesProperty::setPropertyValue( const Any& rOuterValue, con rtl::Reference< ChartModel > xChartDoc( m_spChart2ModelContact->getDocumentModel() ); rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() ); - sal_Int32 nDimension = ::chart::DiagramHelper::getDimension( xDiagram ); - if( !(xChartDoc.is() && xDiagram.is() && nDimension == 2) ) + if( !xChartDoc || !xDiagram ) + return; + sal_Int32 nDimension = xDiagram->getDimension(); + if( nDimension != 2 ) return; rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = xChartDoc->getTypeManager(); diff --git a/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx index 31ae76810df8..83566cf89230 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx @@ -79,8 +79,10 @@ void WrappedStockProperty::setPropertyValue( const css::uno::Any& rOuterValue, c rtl::Reference< ChartModel > xChartDoc( m_spChart2ModelContact->getDocumentModel() ); rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() ); - sal_Int32 nDimension = ::chart::DiagramHelper::getDimension( xDiagram ); - if( !(xChartDoc.is() && xDiagram.is() && nDimension==2) ) + if( !xChartDoc || !xDiagram ) + return; + sal_Int32 nDimension = xDiagram->getDimension(); + if( nDimension != 2 ) return; rtl::Reference< ::chart::ChartTypeManager > xChartTypeManager = xChartDoc->getTypeManager(); diff --git a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx index a838f784d1a4..eac12af2971e 100644 --- a/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx +++ b/chart2/source/controller/dialogs/dlg_ObjectProperties.cxx @@ -125,7 +125,9 @@ void ObjectPropertiesDialogParameter::init( const rtl::Reference<::chart::ChartM rtl::Reference< Diagram > xDiagram = ChartModelHelper::findDiagram( xChartModel ); rtl::Reference< DataSeries > xSeries = ObjectIdentifier::getDataSeriesForCID( m_aObjectCID, xChartModel ); rtl::Reference< ChartType > xChartType = ChartModelHelper::getChartTypeOfSeries( xChartModel, xSeries ); - sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram ); + sal_Int32 nDimensionCount = 0; + if (xDiagram) + nDimensionCount = xDiagram->getDimension(); bool bHasSeriesProperties = (m_eObjectType==OBJECTTYPE_DATA_SERIES); bool bHasDataPointproperties = (m_eObjectType==OBJECTTYPE_DATA_POINT); diff --git a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx index 3823d1577ed9..946647cdf2bd 100644 --- a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx @@ -87,7 +87,7 @@ SeriesOptionsItemConverter::SeriesOptionsItemConverter( m_bClockwise = (aScale.Orientation == chart2::AxisOrientation_REVERSE); } - sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram ); + sal_Int32 nDimensionCount = xDiagram->getDimension(); m_bSupportingOverlapAndGapWidthProperties = ChartTypeHelper::isSupportingOverlapAndGapWidthProperties( xChartType, nDimensionCount ); if( m_bSupportingOverlapAndGapWidthProperties ) diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index 209bbf0e0653..7f20576ab756 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -205,7 +205,7 @@ wrapper::ItemConverter* createItemConverter( rtl::Reference< ChartType > xChartType = ChartModelHelper::getChartTypeOfSeries( xChartModel, xSeries ); rtl::Reference< Diagram > xDiagram = ChartModelHelper::findDiagram( xChartModel ); - sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram ); + sal_Int32 nDimensionCount = xDiagram->getDimension(); if( !ChartTypeHelper::isSupportingAreaProperties( xChartType, nDimensionCount ) ) eMapTo = wrapper::GraphicObjectType::LineDataPoint; diff --git a/chart2/source/controller/main/ControllerCommandDispatch.cxx b/chart2/source/controller/main/ControllerCommandDispatch.cxx index af0dd5f9f0f2..4feb43e7c845 100644 --- a/chart2/source/controller/main/ControllerCommandDispatch.cxx +++ b/chart2/source/controller/main/ControllerCommandDispatch.cxx @@ -236,7 +236,7 @@ void ControllerState::update( if( xGivenDataSeries.is()) { bMayAddMenuTrendline = true; - sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram ); + sal_Int32 nDimensionCount = xDiagram->getDimension(); rtl::Reference< ::chart::ChartType > xFirstChartType( DataSeriesHelper::getChartTypeOfSeries( xGivenDataSeries, xDiagram )); @@ -399,7 +399,9 @@ void ModelState::update( const rtl::Reference<::chart::ChartModel> & xModel ) bIsReadOnly = xModel->isReadonly(); - sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram ); + sal_Int32 nDimensionCount = 0; + if (xDiagram) + nDimensionCount = xDiagram->getDimension(); rtl::Reference< ChartType > xFirstChartType; if (xDiagram) diff --git a/chart2/source/controller/main/ObjectHierarchy.cxx b/chart2/source/controller/main/ObjectHierarchy.cxx index fd9ee04c7374..975cf145f56b 100644 --- a/chart2/source/controller/main/ObjectHierarchy.cxx +++ b/chart2/source/controller/main/ObjectHierarchy.cxx @@ -211,7 +211,7 @@ void ObjectHierarchy::createAxesTree( const rtl::Reference<::chart::ChartModel> & xChartDoc, const rtl::Reference< Diagram > & xDiagram ) { - sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram ); + sal_Int32 nDimensionCount = xDiagram->getDimension(); rtl::Reference< ChartType > xChartType( xDiagram->getChartTypeByIndex( 0 ) ); bool bSupportsAxesGrids = ChartTypeHelper::isSupportingMainAxis( xChartType, nDimensionCount, 0 ); if( !bSupportsAxesGrids ) @@ -282,7 +282,7 @@ void ObjectHierarchy::createWallAndFloor( tChildContainer & rContainer, const rtl::Reference< Diagram > & xDiagram ) { - sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram ); + sal_Int32 nDimensionCount = xDiagram->getDimension(); bool bIsThreeD = ( nDimensionCount == 3 ); bool bHasWall = xDiagram->isSupportingFloorAndWall(); if( bHasWall && bIsThreeD ) @@ -320,7 +320,7 @@ void ObjectHierarchy::createDataSeriesTree( { try { - sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram ); + sal_Int32 nDimensionCount = xDiagram->getDimension(); std::vector< rtl::Reference< BaseCoordinateSystem > > aCooSysSeq( xDiagram->getBaseCoordinateSystems()); for( std::size_t nCooSysIdx=0; nCooSysIdx<aCooSysSeq.size(); ++nCooSysIdx ) diff --git a/chart2/source/controller/main/SelectionHelper.cxx b/chart2/source/controller/main/SelectionHelper.cxx index 46f648399980..4ece0245f8b7 100644 --- a/chart2/source/controller/main/SelectionHelper.cxx +++ b/chart2/source/controller/main/SelectionHelper.cxx @@ -448,7 +448,7 @@ bool SelectionHelper::isRotateableObject( std::u16string_view rCID if( !ObjectIdentifier::isRotateableObject( rCID ) ) return false; - sal_Int32 nDimensionCount = DiagramHelper::getDimension( ChartModelHelper::findDiagram( xChartModel ) ); + sal_Int32 nDimensionCount = ChartModelHelper::findDiagram( xChartModel )->getDimension(); return nDimensionCount == 3; } diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx index 75dc7ed962c2..3b9bac2cbfb9 100644 --- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx +++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx @@ -433,7 +433,9 @@ void ChartElementsPanel::updateData() return; rtl::Reference< Diagram > xDiagram(ChartModelHelper::findDiagram(mxModel)); - sal_Int32 nDimension = DiagramHelper::getDimension(xDiagram); + sal_Int32 nDimension = 0; + if (xDiagram) + nDimension = xDiagram->getDimension(); SolarMutexGuard aGuard; mxCBLegend->set_active(isLegendVisible(mxModel)); |