diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-29 09:04:29 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-29 13:00:17 +0000 |
commit | 23c2fb9dbfa5b3eca64ba8aef1a82f9c60d39397 (patch) | |
tree | 8fc69f70502f62f6c7135afb2a3538ba501f1e18 /chart2 | |
parent | 856e6627c21b84a0b9ab2e3cb95a5a57864854e8 (diff) |
use more get/setFastPropertyValue in pie charts
Change-Id: I17bf8631b5934d6d112f17e4a05025802dcde2f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149685
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/inc/ChartType.hxx | 8 | ||||
-rw-r--r-- | chart2/source/inc/OPropertySet.hxx | 6 | ||||
-rw-r--r-- | chart2/source/model/template/PieChartType.cxx | 15 | ||||
-rw-r--r-- | chart2/source/model/template/PieChartTypeTemplate.cxx | 17 | ||||
-rw-r--r-- | chart2/source/tools/ChartTypeHelper.cxx | 4 | ||||
-rw-r--r-- | chart2/source/view/charttypes/PieChart.cxx | 4 | ||||
-rw-r--r-- | chart2/source/view/charttypes/VSeriesPlotter.cxx | 3 | ||||
-rw-r--r-- | chart2/source/view/main/SeriesPlotterContainer.cxx | 8 |
8 files changed, 34 insertions, 31 deletions
diff --git a/chart2/source/inc/ChartType.hxx b/chart2/source/inc/ChartType.hxx index 5849f611a3c8..267d06f406de 100644 --- a/chart2/source/inc/ChartType.hxx +++ b/chart2/source/inc/ChartType.hxx @@ -38,6 +38,14 @@ class BaseCoordinateSystem; class DataSeries; class ModifyEventForwarder; +enum +{ + PROP_PIECHARTTYPE_USE_RINGS, + PROP_PIECHARTTYPE_3DRELATIVEHEIGHT +}; + + + namespace impl { typedef ::cppu::WeakImplHelper< diff --git a/chart2/source/inc/OPropertySet.hxx b/chart2/source/inc/OPropertySet.hxx index f851c8c365f1..d78312878798 100644 --- a/chart2/source/inc/OPropertySet.hxx +++ b/chart2/source/inc/OPropertySet.hxx @@ -138,15 +138,15 @@ protected: ( css::uno::Any& rValue, sal_Int32 nHandle ) const override; - /// make original interface function visible again - using ::com::sun::star::beans::XFastPropertySet::getFastPropertyValue; - /** implement this method in derived classes to get called when properties change. */ virtual void firePropertyChangeEvent(); public: + /// make original interface function visible again + using ::com::sun::star::beans::XFastPropertySet::getFastPropertyValue; + // Interfaces // ____ XInterface ____ diff --git a/chart2/source/model/template/PieChartType.cxx b/chart2/source/model/template/PieChartType.cxx index fdbfc7cedb5e..dc45c24b1af4 100644 --- a/chart2/source/model/template/PieChartType.cxx +++ b/chart2/source/model/template/PieChartType.cxx @@ -37,21 +37,14 @@ using ::com::sun::star::uno::Reference; namespace { -enum -{ - PROP_PIECHARTTYPE_USE_RINGS, - PROP_PIECHARTTYPE_3DRELATIVEHEIGHT -}; - - ::chart::tPropertyValueMap& StaticPieChartTypeDefaults() { static ::chart::tPropertyValueMap aStaticDefaults = []() { ::chart::tPropertyValueMap aOutMap; - ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, PROP_PIECHARTTYPE_USE_RINGS, false ); - ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, PROP_PIECHARTTYPE_3DRELATIVEHEIGHT, 100 ); + ::chart::PropertyHelper::setPropertyValueDefault( aOutMap, ::chart::PROP_PIECHARTTYPE_USE_RINGS, false ); + ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( aOutMap, ::chart::PROP_PIECHARTTYPE_3DRELATIVEHEIGHT, 100 ); return aOutMap; }(); return aStaticDefaults; @@ -64,12 +57,12 @@ enum { std::vector< css::beans::Property > aProperties { { "UseRings", - PROP_PIECHARTTYPE_USE_RINGS, + ::chart::PROP_PIECHARTTYPE_USE_RINGS, cppu::UnoType<bool>::get(), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT }, { "3DRelativeHeight", - PROP_PIECHARTTYPE_3DRELATIVEHEIGHT, + ::chart::PROP_PIECHARTTYPE_3DRELATIVEHEIGHT, cppu::UnoType<sal_Int32>::get(), beans::PropertyAttribute::MAYBEVOID } }; diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx b/chart2/source/model/template/PieChartTypeTemplate.cxx index c14458870d58..021b3ab6c8f2 100644 --- a/chart2/source/model/template/PieChartTypeTemplate.cxx +++ b/chart2/source/model/template/PieChartTypeTemplate.cxx @@ -251,8 +251,8 @@ void PieChartTypeTemplate::createChartTypes( try { rtl::Reference< ChartType > xCT = new PieChartType(); - xCT->setPropertyValue( - "UseRings", getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS )); + xCT->setFastPropertyValue( + PROP_PIECHARTTYPE_USE_RINGS, getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS )); // "UseRings" rCoordSys[0]->setChartTypes( std::vector{xCT} ); if( !aSeriesSeq.empty() ) @@ -348,10 +348,9 @@ bool PieChartTypeTemplate::matchesTemplate2( //check UseRings if( bResult ) { - rtl::Reference< ChartType > xCTProp = - xDiagram->getChartTypeByIndex( 0 ); + rtl::Reference< ChartType > xCTProp = xDiagram->getChartTypeByIndex( 0 ); bool bUseRings = false; - if( xCTProp->getPropertyValue( "UseRings") >>= bUseRings ) + if( xCTProp->getFastPropertyValue( PROP_PIECHARTTYPE_USE_RINGS ) >>= bUseRings ) // "UseRings" { bResult = ( bTemplateUsesRings == bUseRings ); } @@ -367,8 +366,8 @@ rtl::Reference< ChartType > PieChartTypeTemplate::getChartTypeForIndex( sal_Int3 try { xResult = new PieChartType(); - xResult->setPropertyValue( - "UseRings", getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS )); + xResult->setFastPropertyValue( + PROP_PIECHARTTYPE_USE_RINGS, getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS )); // "UseRings" } catch( const uno::Exception & ) { @@ -387,8 +386,8 @@ rtl::Reference< ChartType > PieChartTypeTemplate::getChartTypeForNewSeries2( { xResult = new PieChartType(); ChartTypeTemplate::copyPropertiesFromOldToNewCoordinateSystem( aFormerlyUsedChartTypes, xResult ); - xResult->setPropertyValue( - "UseRings", getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS )); + xResult->setFastPropertyValue( + PROP_PIECHARTTYPE_USE_RINGS, getFastPropertyValue( PROP_PIE_TEMPLATE_USE_RINGS )); // "UseRings" } catch( const uno::Exception & ) { diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx index b393b344fb0d..15f00eac6fa9 100644 --- a/chart2/source/tools/ChartTypeHelper.cxx +++ b/chart2/source/tools/ChartTypeHelper.cxx @@ -252,7 +252,7 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedLabelPlacements( const if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_PIE) ) { bool bDonut = false; - xChartType->getPropertyValue( "UseRings") >>= bDonut; + xChartType->getFastPropertyValue( PROP_PIECHARTTYPE_USE_RINGS ) >>= bDonut; // "UseRings" if(!bDonut) { @@ -593,7 +593,7 @@ sal_Int32 ChartTypeHelper::getNumberOfDisplayedSeries( if( aChartTypeName == CHART2_SERVICE_NAME_CHARTTYPE_PIE ) { bool bDonut = false; - if( (xChartType->getPropertyValue( "UseRings") >>= bDonut) + if( (xChartType->getFastPropertyValue( PROP_PIECHARTTYPE_USE_RINGS ) >>= bDonut) // "UseRings" && !bDonut ) { return nNumberOfSeries>0 ? 1 : 0; diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index d98fd62e771f..5e8cb88bc910 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -207,7 +207,7 @@ PieChart::PieChart( const rtl::Reference<ChartType>& xChartTypeModel try { - xChartTypeModel->getPropertyValue( "UseRings") >>= m_bUseRings; + xChartTypeModel->getFastPropertyValue(PROP_PIECHARTTYPE_USE_RINGS) >>= m_bUseRings; // "UseRings" if( m_bUseRings ) { m_pPosHelper->m_fRadiusOffset = 1.0; @@ -730,7 +730,7 @@ void PieChart::createShapes() { try { - uno::Any aAny = m_xChartTypeModel->getPropertyValue( "3DRelativeHeight" ); + uno::Any aAny = m_xChartTypeModel->getFastPropertyValue( PROP_PIECHARTTYPE_3DRELATIVEHEIGHT ); // "3DRelativeHeight" aAny >>= n3DRelativeHeight; } catch (const uno::Exception&) { } diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 2b3cebbd59ce..35f13c7d3184 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -2731,7 +2731,8 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries( if (bIsPie) { bool bDonut = false; - if ((m_xChartTypeModel->getPropertyValue("UseRings") >>= bDonut) && bDonut) + // "UseRings" + if ((m_xChartTypeModel->getFastPropertyValue(PROP_PIECHARTTYPE_USE_RINGS) >>= bDonut) && bDonut) bIsPie = false; } } diff --git a/chart2/source/view/main/SeriesPlotterContainer.cxx b/chart2/source/view/main/SeriesPlotterContainer.cxx index 30b2ba8edcb5..de8c2c78cd4f 100644 --- a/chart2/source/view/main/SeriesPlotterContainer.cxx +++ b/chart2/source/view/main/SeriesPlotterContainer.cxx @@ -212,11 +212,13 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(ChartModel& rChart try { sal_Int32 n3DRelativeHeightOldValue(100); - uno::Any aAny = xChartType->getPropertyValue("3DRelativeHeight"); + uno::Any aAny = xChartType->getFastPropertyValue( + PROP_PIECHARTTYPE_3DRELATIVEHEIGHT); // "3DRelativeHeight" aAny >>= n3DRelativeHeightOldValue; if (n3DRelativeHeightOldValue != n3DRelativeHeight) - xChartType->setPropertyValue("3DRelativeHeight", - uno::Any(n3DRelativeHeight)); + xChartType->setFastPropertyValue( + PROP_PIECHARTTYPE_3DRELATIVEHEIGHT, // "3DRelativeHeight" + uno::Any(n3DRelativeHeight)); } catch (const uno::Exception&) { |