diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-29 11:31:40 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-29 19:02:34 +0000 |
commit | 67cf6e0463c7538ebdd1ea7ba1b98c5e8cf8b7f9 (patch) | |
tree | 15c1070a9c1ac0bb88c6967656e4e16bd196f999 | |
parent | 99463a6f7f25d53e806fb475a6d5e2ced13b10e6 (diff) |
use more get/setFastPropertyValue in chart2
Change-Id: I4979cf5dab8b35ba35a46808cef76dc3f81c59b2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149725
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
7 files changed, 41 insertions, 21 deletions
diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx index 12449763df19..ed742df89d88 100644 --- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx @@ -23,6 +23,7 @@ #include <ChartTypeHelper.hxx> #include <DiagramHelper.hxx> #include <DataSeries.hxx> +#include <DataSeriesProperties.hxx> #include <LinePropertiesHelper.hxx> #include <FillProperties.hxx> #include <CharacterProperties.hxx> @@ -59,6 +60,7 @@ using namespace ::com::sun::star; using namespace ::chart::wrapper; +using namespace ::chart::DataSeriesProperties; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; @@ -617,9 +619,10 @@ beans::PropertyState SAL_CALL DataSeriesPointWrapper::getPropertyState( const OU { if( rPropertyName == "FillColor") { - rtl::Reference< DataSeries > xSeriesProp = getDataSeries(); + rtl::Reference< DataSeries > xSeries = getDataSeries(); bool bVaryColorsByPoint = false; - if( xSeriesProp.is() && (xSeriesProp->getPropertyValue("VaryColorsByPoint") >>= bVaryColorsByPoint) + // "VaryColorsByPoint" + if( xSeries.is() && (xSeries->getFastPropertyValue(PROP_DATASERIES_VARY_COLORS_BY_POINT) >>= bVaryColorsByPoint) && bVaryColorsByPoint ) return beans::PropertyState_DIRECT_VALUE; } @@ -836,9 +839,10 @@ Any SAL_CALL DataSeriesPointWrapper::getPropertyValue( const OUString& rProperty { if( rPropertyName == "FillColor" ) { - rtl::Reference< DataSeries > xSeriesProp = getDataSeries(); + rtl::Reference< DataSeries > xSeries = getDataSeries(); bool bVaryColorsByPoint = false; - if( xSeriesProp.is() && (xSeriesProp->getPropertyValue("VaryColorsByPoint") >>= bVaryColorsByPoint) + // "VaryColorsByPoint" + if( xSeries.is() && (xSeries->getFastPropertyValue(PROP_DATASERIES_VARY_COLORS_BY_POINT) >>= bVaryColorsByPoint) && bVaryColorsByPoint ) { uno::Reference< beans::XPropertyState > xPointState( DataSeriesPointWrapper::getDataPointProperties(), uno::UNO_QUERY ); diff --git a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx index 314778deac4f..458c35830db0 100644 --- a/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/DataPointItemConverter.cxx @@ -27,6 +27,7 @@ #include <SeriesOptionsItemConverter.hxx> #include <DataSeries.hxx> #include <DataSeriesHelper.hxx> +#include <DataSeriesProperties.hxx> #include <DiagramHelper.hxx> #include <Diagram.hxx> #include <ChartModel.hxx> @@ -62,6 +63,7 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; +using namespace ::chart::DataSeriesProperties; using ::com::sun::star::uno::Reference; namespace chart::wrapper { @@ -253,7 +255,8 @@ DataPointItemConverter::DataPointItemConverter( return; uno::Sequence<sal_Int32> deletedLegendEntriesSeq; - xSeries->getPropertyValue("DeletedLegendEntries") >>= deletedLegendEntriesSeq; + // "DeletedLegendEntries" + xSeries->getFastPropertyValue(PROP_DATASERIES_DELETED_LEGEND_ENTRIES) >>= deletedLegendEntriesSeq; for (const auto& deletedLegendEntry : std::as_const(deletedLegendEntriesSeq)) { if (nPointIndex == deletedLegendEntry) @@ -574,7 +577,8 @@ bool DataPointItemConverter::ApplySpecialItem( if (bHideLegendEntry != m_bHideLegendEntry) { uno::Sequence<sal_Int32> deletedLegendEntriesSeq; - m_xSeries->getPropertyValue("DeletedLegendEntries") >>= deletedLegendEntriesSeq; + // "DeletedLegendEntries" + m_xSeries->getFastPropertyValue(PROP_DATASERIES_DELETED_LEGEND_ENTRIES) >>= deletedLegendEntriesSeq; std::vector<sal_Int32> deletedLegendEntries; for (const auto& deletedLegendEntry : std::as_const(deletedLegendEntriesSeq)) { @@ -583,7 +587,8 @@ bool DataPointItemConverter::ApplySpecialItem( } if (bHideLegendEntry) deletedLegendEntries.push_back(m_nPointIndex); - m_xSeries->setPropertyValue("DeletedLegendEntries", uno::Any(comphelper::containerToSequence(deletedLegendEntries))); + // "DeletedLegendEntries" + m_xSeries->setFastPropertyValue(PROP_DATASERIES_DELETED_LEGEND_ENTRIES, uno::Any(comphelper::containerToSequence(deletedLegendEntries))); } } break; diff --git a/chart2/source/controller/main/ChartController_Properties.cxx b/chart2/source/controller/main/ChartController_Properties.cxx index b310178635b9..11d12bc77dbf 100644 --- a/chart2/source/controller/main/ChartController_Properties.cxx +++ b/chart2/source/controller/main/ChartController_Properties.cxx @@ -47,6 +47,7 @@ #include <ChartModel.hxx> #include <ColorPerPointHelper.hxx> #include <DataSeries.hxx> +#include <DataSeriesProperties.hxx> #include <DiagramHelper.hxx> #include <Diagram.hxx> #include <ControllerLockGuard.hxx> @@ -71,6 +72,7 @@ namespace chart { using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; +using namespace ::chart::DataSeriesProperties; using ::com::sun::star::uno::Reference; namespace @@ -220,7 +222,8 @@ wrapper::ItemConverter* createItemConverter( nPointIndex = o3tl::toInt32(aParticleID); bool bVaryColorsByPoint = false; if( xSeries.is() && - (xSeries->getPropertyValue("VaryColorsByPoint") >>= bVaryColorsByPoint) && + // "VaryColorsByPoint" + (xSeries->getFastPropertyValue(PROP_DATASERIES_VARY_COLORS_BY_POINT) >>= bVaryColorsByPoint) && bVaryColorsByPoint ) { if( !ColorPerPointHelper::hasPointOwnColor( xSeries, nPointIndex, xObjectProperties ) ) diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx b/chart2/source/model/template/PieChartTypeTemplate.cxx index 88e9ab645f91..166245168d0b 100644 --- a/chart2/source/model/template/PieChartTypeTemplate.cxx +++ b/chart2/source/model/template/PieChartTypeTemplate.cxx @@ -485,7 +485,7 @@ void PieChartTypeTemplate::applyStyle2( DataSeriesHelper::setPropertyAlsoToAllAttributedDataPoints( xSeries, "BorderStyle", uno::Any( drawing::LineStyle_NONE ) ); // vary colors by point - xSeries->setPropertyValue( "VaryColorsByPoint", uno::Any( true )); + xSeries->setFastPropertyValue( PROP_DATASERIES_VARY_COLORS_BY_POINT, uno::Any( true )); // "VaryColorsByPoint" } catch( const uno::Exception & ) { diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx index 5e8cb88bc910..1c5f15d7ec00 100644 --- a/chart2/source/view/charttypes/PieChart.cxx +++ b/chart2/source/view/charttypes/PieChart.cxx @@ -26,6 +26,8 @@ #include <CommonConverters.hxx> #include <ObjectIdentifier.hxx> #include <ChartType.hxx> +#include <DataSeries.hxx> +#include <DataSeriesProperties.hxx> #include <com/sun/star/chart/DataLabelPlacement.hpp> #include <com/sun/star/chart2/XColorScheme.hpp> @@ -41,6 +43,7 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; +using namespace ::chart::DataSeriesProperties; namespace chart { @@ -490,8 +493,8 @@ void PieChart::createTextLabelShape( } } - bool bShowLeaderLine = rSeries.getPropertiesOfSeries() - ->getPropertyValue("ShowCustomLeaderLines") + bool bShowLeaderLine = rSeries.getModel() + ->getFastPropertyValue(PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES) // "ShowCustomLeaderLines" .get<sal_Bool>(); if (m_bPieLabelsAllowToMove) { @@ -593,19 +596,20 @@ double PieChart::getMaxOffset() return m_fMaxOffset; VDataSeries* pSeries = rSeriesList.front().get(); - uno::Reference< beans::XPropertySet > xSeriesProp( pSeries->getPropertiesOfSeries() ); - if( !xSeriesProp.is() ) + rtl::Reference< DataSeries > xSeries( pSeries->getModel() ); + if( !xSeries.is() ) return m_fMaxOffset; double fExplodePercentage=0.0; - xSeriesProp->getPropertyValue( "Offset") >>= fExplodePercentage; + xSeries->getPropertyValue( "Offset") >>= fExplodePercentage; if(fExplodePercentage>m_fMaxOffset) m_fMaxOffset=fExplodePercentage; if(!m_bSizeExcludesLabelsAndExplodedSegments) { uno::Sequence< sal_Int32 > aAttributedDataPointIndexList; - if( xSeriesProp->getPropertyValue( "AttributedDataPoints" ) >>= aAttributedDataPointIndexList ) + // "AttributedDataPoints" + if( xSeries->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS ) >>= aAttributedDataPointIndexList ) { for(sal_Int32 nN=aAttributedDataPointIndexList.getLength();nN--;) { diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 35f13c7d3184..f9fa8fe0fea9 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -27,6 +27,7 @@ #include <Diagram.hxx> #include <BaseCoordinateSystem.hxx> #include <DataSeries.hxx> +#include <DataSeriesProperties.hxx> #include <CommonConverters.hxx> #include <ExplicitCategoriesProvider.hxx> @@ -95,6 +96,7 @@ namespace chart { using namespace ::com::sun::star; using namespace ::com::sun::star::chart; using namespace ::com::sun::star::chart2; +using namespace ::chart::DataSeriesProperties; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; @@ -702,7 +704,8 @@ rtl::Reference<SvxShapeText> VSeriesPlotter::createDataLabel( const rtl::Referen { xTextShape->setPosition(aRelPos); if( !m_xChartTypeModel->getChartType().equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_PIE) && - rDataSeries.getPropertiesOfSeries()->getPropertyValue( "ShowCustomLeaderLines" ).get<sal_Bool>()) + // "ShowCustomLeaderLines" + rDataSeries.getModel()->getFastPropertyValue( PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES ).get<sal_Bool>()) { sal_Int32 nX1 = rScreenPosition2D.X; sal_Int32 nY1 = rScreenPosition2D.Y; @@ -2451,7 +2454,8 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries( if (!pSeries) continue; - if (!pSeries->getPropertiesOfSeries()->getPropertyValue("ShowLegendEntry").get<sal_Bool>()) + // "ShowLegendEntry" + if (!pSeries->getModel()->getFastPropertyValue(PROP_DATASERIES_SHOW_LEGEND_ENTRY).get<sal_Bool>()) { continue; } @@ -2748,7 +2752,8 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntriesForSeries( Sequence<sal_Int32> deletedLegendEntries; try { - rSeries.getPropertiesOfSeries()->getPropertyValue("DeletedLegendEntries") >>= deletedLegendEntries; + // "DeletedLegendEntries" + rSeries.getModel()->getFastPropertyValue(PROP_DATASERIES_DELETED_LEGEND_ENTRIES) >>= deletedLegendEntries; } catch (const uno::Exception&) { diff --git a/chart2/source/view/main/VDataSeries.cxx b/chart2/source/view/main/VDataSeries.cxx index feac68042af5..0ff045b5fde9 100644 --- a/chart2/source/view/main/VDataSeries.cxx +++ b/chart2/source/view/main/VDataSeries.cxx @@ -896,9 +896,8 @@ bool VDataSeries::isAttributedDataPoint( sal_Int32 index ) const bool VDataSeries::isVaryColorsByPoint() const { bool bVaryColorsByPoint = false; - Reference< beans::XPropertySet > xSeriesProp( getPropertiesOfSeries() ); - if( xSeriesProp.is() ) - xSeriesProp->getPropertyValue("VaryColorsByPoint") >>= bVaryColorsByPoint; + if( m_xDataSeries ) + m_xDataSeries->getFastPropertyValue(PROP_DATASERIES_VARY_COLORS_BY_POINT) >>= bVaryColorsByPoint; // "VaryColorsByPoint" return bVaryColorsByPoint; } |