chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx | 4 - chart2/source/inc/Diagram.hxx | 2 chart2/source/inc/DiagramHelper.hxx | 4 - chart2/source/model/main/Diagram.cxx | 44 ++++++++++++ chart2/source/model/template/BarChartTypeTemplate.cxx | 2 chart2/source/tools/DiagramHelper.cxx | 44 ------------ 6 files changed, 49 insertions(+), 51 deletions(-)
New commits: commit dfcca2ff48384de1fb36c376a06decea97a1441e Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Mar 15 16:03:49 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Mar 17 06:15:47 2023 +0000 move getGeometry3D inside chart2::Diagram Change-Id: I71f557016c0e107b97ad839b0514efbae4f3665b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148977 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx index b778e49af878..f0d85a4bcc1f 100644 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx @@ -1691,7 +1691,7 @@ void WrappedSolidTypeProperty::setPropertyValue( const Any& rOuterValue, const R bool bFound = false; bool bAmbiguous = false; - sal_Int32 nOldSolidType = DiagramHelper::getGeometry3D( xDiagram, bFound, bAmbiguous ); + sal_Int32 nOldSolidType = xDiagram->getGeometry3D( bFound, bAmbiguous ); if( bFound && ( nOldSolidType != nNewSolidType || bAmbiguous ) ) xDiagram->setGeometry3D( nNewSolidType ); } @@ -1703,7 +1703,7 @@ Any WrappedSolidTypeProperty::getPropertyValue( const Reference< beans::XPropert { bool bFound = false; bool bAmbiguous = false; - sal_Int32 nGeometry = DiagramHelper::getGeometry3D( xDiagram, bFound, bAmbiguous ); + sal_Int32 nGeometry = xDiagram->getGeometry3D( bFound, bAmbiguous ); if( bFound ) m_aOuterValue <<= nGeometry; } diff --git a/chart2/source/inc/Diagram.hxx b/chart2/source/inc/Diagram.hxx index a63afad3786d..680c8f92fe30 100644 --- a/chart2/source/inc/Diagram.hxx +++ b/chart2/source/inc/Diagram.hxx @@ -174,6 +174,8 @@ public: void setGeometry3D( sal_Int32 nNewGeometry ); + sal_Int32 getGeometry3D( bool& rbFound, bool& rbAmbiguous ); + private: // ____ XModifyListener ____ virtual void SAL_CALL modified( diff --git a/chart2/source/inc/DiagramHelper.hxx b/chart2/source/inc/DiagramHelper.hxx index 254c27387bd6..e9b719f3abcb 100644 --- a/chart2/source/inc/DiagramHelper.hxx +++ b/chart2/source/inc/DiagramHelper.hxx @@ -267,10 +267,6 @@ public: static bool isPieOrDonutChart( const rtl::Reference< ::chart::Diagram >& xDiagram ); - static sal_Int32 getGeometry3D( - const rtl::Reference< ::chart::Diagram > & xDiagram, - bool& rbFound, bool& rbAmbiguous ); - 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 ec7272a28da8..14f4de16404c 100644 --- a/chart2/source/model/main/Diagram.cxx +++ b/chart2/source/model/main/Diagram.cxx @@ -38,6 +38,7 @@ #include <basegfx/numeric/ftools.hxx> #include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/chart2/DataPointGeometry3D.hpp> #include <com/sun/star/chart2/RelativePosition.hpp> #include <com/sun/star/chart2/RelativeSize.hpp> #include <com/sun/star/chart/MissingValueTreatment.hpp> @@ -761,6 +762,49 @@ void Diagram::setGeometry3D( sal_Int32 nNewGeometry ) } } +sal_Int32 Diagram::getGeometry3D( bool& rbFound, bool& rbAmbiguous ) +{ + sal_Int32 nCommonGeom( css::chart2::DataPointGeometry3D::CUBOID ); + rbFound = false; + rbAmbiguous = false; + + std::vector< rtl::Reference< DataSeries > > aSeriesVec = + DiagramHelper::getDataSeriesFromDiagram( this ); + + if( aSeriesVec.empty()) + rbAmbiguous = true; + + for (auto const& series : aSeriesVec) + { + try + { + sal_Int32 nGeom = 0; + if( series->getPropertyValue( "Geometry3D") >>= nGeom ) + { + if( ! rbFound ) + { + // first series + nCommonGeom = nGeom; + rbFound = true; + } + // further series: compare for uniqueness + else if( nCommonGeom != nGeom ) + { + rbAmbiguous = true; + break; + } + } + } + catch( const uno::Exception & ) + { + DBG_UNHANDLED_EXCEPTION("chart2"); + } + } + + return nCommonGeom; +} + + } // namespace chart diff --git a/chart2/source/model/template/BarChartTypeTemplate.cxx b/chart2/source/model/template/BarChartTypeTemplate.cxx index 58a3196df3bd..51f01db94f0b 100644 --- a/chart2/source/model/template/BarChartTypeTemplate.cxx +++ b/chart2/source/model/template/BarChartTypeTemplate.cxx @@ -184,7 +184,7 @@ bool BarChartTypeTemplate::matchesTemplate2( { bool bGeomFound = false, bGeomAmbiguous = false; - sal_Int32 aCommonGeom = DiagramHelper::getGeometry3D( xDiagram, bGeomFound, bGeomAmbiguous ); + sal_Int32 aCommonGeom = xDiagram->getGeometry3D( bGeomFound, bGeomAmbiguous ); if( !bGeomAmbiguous ) { diff --git a/chart2/source/tools/DiagramHelper.cxx b/chart2/source/tools/DiagramHelper.cxx index ec11f8c8799e..7442058f27b9 100644 --- a/chart2/source/tools/DiagramHelper.cxx +++ b/chart2/source/tools/DiagramHelper.cxx @@ -1354,50 +1354,6 @@ bool DiagramHelper::isPieOrDonutChart( const rtl::Reference< Diagram >& xDiagram return false; } -sal_Int32 DiagramHelper::getGeometry3D( - const rtl::Reference< Diagram > & xDiagram, - bool& rbFound, bool& rbAmbiguous ) -{ - sal_Int32 nCommonGeom( DataPointGeometry3D::CUBOID ); - rbFound = false; - rbAmbiguous = false; - - std::vector< rtl::Reference< DataSeries > > aSeriesVec = - DiagramHelper::getDataSeriesFromDiagram( xDiagram ); - - if( aSeriesVec.empty()) - rbAmbiguous = true; - - for (auto const& series : aSeriesVec) - { - try - { - sal_Int32 nGeom = 0; - if( series->getPropertyValue( "Geometry3D") >>= nGeom ) - { - if( ! rbFound ) - { - // first series - nCommonGeom = nGeom; - rbFound = true; - } - // further series: compare for uniqueness - else if( nCommonGeom != nGeom ) - { - rbAmbiguous = true; - break; - } - } - } - catch( const uno::Exception & ) - { - DBG_UNHANDLED_EXCEPTION("chart2"); - } - } - - return nCommonGeom; -} - static void lcl_ensureRange0to1( double& rValue ) { if(rValue<0.0)