chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx |    4 -
 chart2/source/controller/main/ChartController_Properties.cxx      |    2 
 chart2/source/controller/main/ControllerCommandDispatch.cxx       |    4 -
 chart2/source/controller/main/ObjectHierarchy.cxx                 |    2 
 chart2/source/inc/Diagram.hxx                                     |    4 +
 chart2/source/inc/DiagramHelper.hxx                               |    4 -
 chart2/source/model/main/Diagram.cxx                              |   36 
++++++++++
 chart2/source/tools/DiagramHelper.cxx                             |   34 
---------
 chart2/source/tools/ThreeDHelper.cxx                              |    2 
 chart2/source/view/diagram/VDiagram.cxx                           |    4 -
 chart2/source/view/main/ChartView.cxx                             |    2 
 11 files changed, 50 insertions(+), 48 deletions(-)

New commits:
commit 811e96ae89bf2172217b5cbfaa05f5ffd23b523f
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Mar 15 16:11:46 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Mar 17 08:17:31 2023 +0000

    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.gran...@collabora.co.uk>

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;
 
commit 5b3b1bb06b0802735d72d49f6a0088c107b90309
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Wed Mar 15 16:07:10 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Mar 17 08:17:22 2023 +0000

    move isPieOrDonutChart inside chart2::Diagram
    
    Change-Id: Ib0d8c2674bfa4aa38cdf3a6449642407c2373093
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149036
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx 
b/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx
index 0514e94bdfc2..1c8e6dc73e59 100644
--- a/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx
+++ b/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx
@@ -49,7 +49,7 @@ 
WrappedD3DTransformMatrixProperty::~WrappedD3DTransformMatrixProperty()
 
 void WrappedD3DTransformMatrixProperty::setPropertyValue( const Any& 
rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
 {
-    if( DiagramHelper::isPieOrDonutChart( m_spChart2ModelContact->getDiagram() 
) )
+    if( m_spChart2ModelContact->getDiagram()->isPieOrDonutChart() )
     {
         drawing::HomogenMatrix aHM;
         if( rOuterValue >>= aHM )
@@ -74,7 +74,7 @@ void WrappedD3DTransformMatrixProperty::setPropertyValue( 
const Any& rOuterValue
 
 Any WrappedD3DTransformMatrixProperty::getPropertyValue( const Reference< 
beans::XPropertySet >& xInnerPropertySet ) const
 {
-    if( DiagramHelper::isPieOrDonutChart( m_spChart2ModelContact->getDiagram() 
) )
+    if( m_spChart2ModelContact->getDiagram()->isPieOrDonutChart() )
     {
         uno::Any aAMatrix( WrappedProperty::getPropertyValue( 
xInnerPropertySet ) );
         drawing::HomogenMatrix aHM;
diff --git a/chart2/source/inc/Diagram.hxx b/chart2/source/inc/Diagram.hxx
index 680c8f92fe30..087ba922dac4 100644
--- a/chart2/source/inc/Diagram.hxx
+++ b/chart2/source/inc/Diagram.hxx
@@ -176,6 +176,8 @@ public:
 
     sal_Int32 getGeometry3D( bool& rbFound, bool& rbAmbiguous );
 
+    bool isPieOrDonutChart();
+
 private:
     // ____ XModifyListener ____
     virtual void SAL_CALL modified(
diff --git a/chart2/source/inc/DiagramHelper.hxx 
b/chart2/source/inc/DiagramHelper.hxx
index e9b719f3abcb..8244276f8e73 100644
--- a/chart2/source/inc/DiagramHelper.hxx
+++ b/chart2/source/inc/DiagramHelper.hxx
@@ -265,8 +265,6 @@ public:
 
     static bool isSupportingFloorAndWall( const rtl::Reference< 
::chart::Diagram > & xDiagram );
 
-    static bool isPieOrDonutChart( 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 14f4de16404c..1e755ef78194 100644
--- a/chart2/source/model/main/Diagram.cxx
+++ b/chart2/source/model/main/Diagram.cxx
@@ -21,6 +21,7 @@
 #include <ChartTypeHelper.hxx>
 #include <ChartTypeManager.hxx>
 #include <ChartTypeTemplate.hxx>
+#include <ChartType.hxx>
 #include <DataSeriesHelper.hxx>
 #include <PropertyHelper.hxx>
 #include "Wall.hxx"
@@ -35,6 +36,7 @@
 #include <BaseCoordinateSystem.hxx>
 #include <Legend.hxx>
 #include <DataTable.hxx>
+#include <servicenames_charttypes.hxx>
 
 #include <basegfx/numeric/ftools.hxx>
 #include <com/sun/star/beans/PropertyAttribute.hpp>
@@ -804,6 +806,19 @@ sal_Int32 Diagram::getGeometry3D( bool& rbFound, bool& 
rbAmbiguous )
     return nCommonGeom;
 }
 
+bool Diagram::isPieOrDonutChart()
+{
+    rtl::Reference< ChartType > xChartType( DiagramHelper::getChartTypeByIndex(
+        this, 0 ) );
+
+    if( xChartType .is() )
+    {
+        OUString aChartType = xChartType->getChartType();
+        if( aChartType == CHART2_SERVICE_NAME_CHARTTYPE_PIE )
+            return true;
+    }
+    return false;
+}
 
 
 } //  namespace chart
diff --git a/chart2/source/tools/DiagramHelper.cxx 
b/chart2/source/tools/DiagramHelper.cxx
index 7442058f27b9..f363dfb73806 100644
--- a/chart2/source/tools/DiagramHelper.cxx
+++ b/chart2/source/tools/DiagramHelper.cxx
@@ -1340,20 +1340,6 @@ bool DiagramHelper::isSupportingFloorAndWall( const 
rtl::Reference< Diagram >& x
     return true;
 }
 
-bool DiagramHelper::isPieOrDonutChart( const rtl::Reference< Diagram >& 
xDiagram )
-{
-    rtl::Reference< ChartType > xChartType( DiagramHelper::getChartTypeByIndex(
-        xDiagram, 0 ) );
-
-    if( xChartType .is() )
-    {
-        OUString aChartType = xChartType->getChartType();
-        if( aChartType == CHART2_SERVICE_NAME_CHARTTYPE_PIE )
-            return true;
-    }
-    return false;
-}
-
 static void lcl_ensureRange0to1( double& rValue )
 {
     if(rValue<0.0)
diff --git a/chart2/source/tools/ThreeDHelper.cxx 
b/chart2/source/tools/ThreeDHelper.cxx
index 49fd192473b5..fc0fe221b584 100644
--- a/chart2/source/tools/ThreeDHelper.cxx
+++ b/chart2/source/tools/ThreeDHelper.cxx
@@ -1248,7 +1248,7 @@ void ThreeDHelper::setDefaultRotation( const 
uno::Reference< beans::XPropertySet
 
 void ThreeDHelper::setDefaultRotation( const rtl::Reference< Diagram >& 
xDiagram )
 {
-    bool bPieOrDonut( DiagramHelper::isPieOrDonutChart( xDiagram ) );
+    bool bPieOrDonut( xDiagram->isPieOrDonutChart() );
     ThreeDHelper::setDefaultRotation( xDiagram, bPieOrDonut );
 }
 
diff --git a/chart2/source/view/main/ChartView.cxx 
b/chart2/source/view/main/ChartView.cxx
index c7e3d6d092a2..e315b354136c 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -344,7 +344,7 @@ bool lcl_IsPieOrDonut( const rtl::Reference< Diagram >& 
xDiagram )
     //the size is checked after complete creation to get the datalabels into 
the given space
 
     //todo: this is just a workaround at the moment for pie and donut labels
-    return DiagramHelper::isPieOrDonutChart( xDiagram );
+    return xDiagram->isPieOrDonutChart();
 }
 
 void lcl_setDefaultWritingMode( const std::shared_ptr< DrawModelWrapper >& 
pDrawModelWrapper, ChartModel& rModel)

Reply via email to