diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-15 16:11:46 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-17 08:17:31 +0000 |
commit | 811e96ae89bf2172217b5cbfaa05f5ffd23b523f (patch) | |
tree | 831e482fc96865dffaea0d101f55d0f79b807537 /chart2 | |
parent | 5b3b1bb06b0802735d72d49f6a0088c107b90309 (diff) |
move isSupportingFloorAndWall inside chart2::Diagram
Change-Id: Ibc05961b60cabcd3d7421116245713c217b40999
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149037
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/controller/main/ChartController_Properties.cxx | 2 | ||||
-rw-r--r-- | chart2/source/controller/main/ControllerCommandDispatch.cxx | 4 | ||||
-rw-r--r-- | chart2/source/controller/main/ObjectHierarchy.cxx | 2 | ||||
-rw-r--r-- | chart2/source/inc/Diagram.hxx | 2 | ||||
-rw-r--r-- | chart2/source/inc/DiagramHelper.hxx | 2 | ||||
-rw-r--r-- | chart2/source/model/main/Diagram.cxx | 21 | ||||
-rw-r--r-- | chart2/source/tools/DiagramHelper.cxx | 20 | ||||
-rw-r--r-- | chart2/source/view/diagram/VDiagram.cxx | 4 |
8 files changed, 29 insertions, 28 deletions
diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index 427ea939bd58..209bbf0e0653 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -729,7 +729,7 @@ bool ChartController::executeDlg_ObjectProperties_withoutUndoGuard( } if( eObjectType==OBJECTTYPE_DIAGRAM_WALL || eObjectType==OBJECTTYPE_DIAGRAM_FLOOR ) { - if( !DiagramHelper::isSupportingFloorAndWall( getFirstDiagram() ) ) + if( !getFirstDiagram()->isSupportingFloorAndWall() ) return bRet; } diff --git a/chart2/source/controller/main/ControllerCommandDispatch.cxx b/chart2/source/controller/main/ControllerCommandDispatch.cxx index 99bfc8cb6232..6e90d50bf2e7 100644 --- a/chart2/source/controller/main/ControllerCommandDispatch.cxx +++ b/chart2/source/controller/main/ControllerCommandDispatch.cxx @@ -196,7 +196,7 @@ void ControllerState::update( rtl::Reference< Diagram > xDiagram = ChartModelHelper::findDiagram( xModel ); bIsFormateableObjectSelected = bHasSelectedObject && aSelOID.isAutoGeneratedObject(); if( aObjectType==OBJECTTYPE_DIAGRAM || aObjectType==OBJECTTYPE_DIAGRAM_WALL || aObjectType==OBJECTTYPE_DIAGRAM_FLOOR ) - bIsFormateableObjectSelected = DiagramHelper::isSupportingFloorAndWall( xDiagram ); + bIsFormateableObjectSelected = xDiagram->isSupportingFloorAndWall(); rtl::Reference< DataSeries > xGivenDataSeries = ObjectIdentifier::getDataSeriesForCID( @@ -440,7 +440,7 @@ void ModelState::update( const rtl::Reference<::chart::ChartModel> & xModel ) ReferenceSizeProvider::AUTO_RESIZE_YES); bHasLegend = LegendHelper::hasLegend( xDiagram ); - bHasWall = DiagramHelper::isSupportingFloorAndWall( xDiagram ); + bHasWall = xDiagram && xDiagram->isSupportingFloorAndWall(); bHasFloor = bHasWall && bIsThreeD; bDataTable = xDiagram.is() && xDiagram->getDataTable().is(); diff --git a/chart2/source/controller/main/ObjectHierarchy.cxx b/chart2/source/controller/main/ObjectHierarchy.cxx index a21d314a8b72..20607481f14e 100644 --- a/chart2/source/controller/main/ObjectHierarchy.cxx +++ b/chart2/source/controller/main/ObjectHierarchy.cxx @@ -284,7 +284,7 @@ void ObjectHierarchy::createWallAndFloor( { sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram ); bool bIsThreeD = ( nDimensionCount == 3 ); - bool bHasWall = DiagramHelper::isSupportingFloorAndWall( xDiagram ); + bool bHasWall = xDiagram->isSupportingFloorAndWall(); if( bHasWall && bIsThreeD ) { rContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifier( OBJECTTYPE_DIAGRAM_WALL, u"" ) ); diff --git a/chart2/source/inc/Diagram.hxx b/chart2/source/inc/Diagram.hxx index 087ba922dac4..c505d42824a1 100644 --- a/chart2/source/inc/Diagram.hxx +++ b/chart2/source/inc/Diagram.hxx @@ -178,6 +178,8 @@ public: bool isPieOrDonutChart(); + bool isSupportingFloorAndWall(); + private: // ____ XModifyListener ____ virtual void SAL_CALL modified( diff --git a/chart2/source/inc/DiagramHelper.hxx b/chart2/source/inc/DiagramHelper.hxx index 8244276f8e73..78133572d9cc 100644 --- a/chart2/source/inc/DiagramHelper.hxx +++ b/chart2/source/inc/DiagramHelper.hxx @@ -263,8 +263,6 @@ public: const css::uno::Reference< css::chart2::XDataSeries >& xGivenDataSeries, bool bForward ); - static bool isSupportingFloorAndWall( const rtl::Reference< ::chart::Diagram > & xDiagram ); - static bool setDiagramPositioning( const rtl::Reference<::chart::ChartModel>& xChartModel, const css::awt::Rectangle& rPosRect /*100th mm*/ ); diff --git a/chart2/source/model/main/Diagram.cxx b/chart2/source/model/main/Diagram.cxx index 1e755ef78194..ee0a55239567 100644 --- a/chart2/source/model/main/Diagram.cxx +++ b/chart2/source/model/main/Diagram.cxx @@ -820,6 +820,27 @@ bool Diagram::isPieOrDonutChart() return false; } +bool Diagram::isSupportingFloorAndWall() +{ + //pies and donuts currently do not support this because of wrong files from older versions + //todo: allow this in future again, if fileversion is available for OLE objects (metastream) + //thus the wrong bottom can be removed on import + + const std::vector< rtl::Reference< ChartType > > aTypes( + ::chart::DiagramHelper::getChartTypesFromDiagram( this ) ); + for( rtl::Reference< ChartType > const & xType : aTypes ) + { + OUString sChartType = xType->getChartType(); + if( sChartType.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) ) + return false; + if( sChartType.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) + return false; + if( sChartType.match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) ) + return false; + } + return true; +} + } // namespace chart diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index f363dfb73806..101ac972b33e 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -1320,26 +1320,6 @@ bool DiagramHelper::moveSeries( const rtl::Reference< Diagram >& xDiagram, const return bMoved; } -bool DiagramHelper::isSupportingFloorAndWall( const rtl::Reference< Diagram >& xDiagram ) -{ - //pies and donuts currently do not support this because of wrong files from older versions - //todo: allow this in future again, if fileversion is available for OLE objects (metastream) - //thus the wrong bottom can be removed on import - - const std::vector< rtl::Reference< ChartType > > aTypes( - ::chart::DiagramHelper::getChartTypesFromDiagram( xDiagram ) ); - for( rtl::Reference< ChartType > const & xType : aTypes ) - { - if( xType.is() && xType->getChartType().match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) ) - return false; - if( xType.is() && xType->getChartType().match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) - return false; - if( xType.is() && xType->getChartType().match(CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET) ) - return false; - } - return true; -} - static void lcl_ensureRange0to1( double& rValue ) { if(rValue<0.0) diff --git a/chart2/source/view/diagram/VDiagram.cxx b/chart2/source/view/diagram/VDiagram.cxx index bb52e968f804..bc41f117ef5c 100644 --- a/chart2/source/view/diagram/VDiagram.cxx +++ b/chart2/source/view/diagram/VDiagram.cxx @@ -143,7 +143,7 @@ void VDiagram::createShapes_2d() //create independent group shape as container for datapoints and such things m_xCoordinateRegionShape = ShapeFactory::createGroup2D(xOuterGroup_Shapes,"testonly;CooContainer=XXX_CID"); - bool bAddFloorAndWall = DiagramHelper::isSupportingFloorAndWall( m_xDiagram ); + bool bAddFloorAndWall = m_xDiagram->isSupportingFloorAndWall(); //add back wall { @@ -442,7 +442,7 @@ void VDiagram::createShapes_3d() m_xAspectRatio3D = xOuterGroup_Shapes; - bool bAddFloorAndWall = DiagramHelper::isSupportingFloorAndWall( m_xDiagram ); + bool bAddFloorAndWall = m_xDiagram->isSupportingFloorAndWall(); const bool bDoubleSided = false; |