diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-29 10:13:33 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-03-29 16:20:42 +0000 |
commit | 98a23169bf761825d0e6ed432632d71dee5a691f (patch) | |
tree | f5abdcd417ffdddd99dc97119852ee8121042b07 /chart2 | |
parent | 2714b18cbaefb13131ae63396297cd57b564a3af (diff) |
use more concrete types in chart2
Change-Id: I932d8a45d525b1b629a0aaee96a1643b155069f6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149692
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/inc/ColorPerPointHelper.hxx | 6 | ||||
-rw-r--r-- | chart2/source/tools/ColorPerPointHelper.cxx | 24 |
2 files changed, 17 insertions, 13 deletions
diff --git a/chart2/source/inc/ColorPerPointHelper.hxx b/chart2/source/inc/ColorPerPointHelper.hxx index f1665123b800..43a8d56802ca 100644 --- a/chart2/source/inc/ColorPerPointHelper.hxx +++ b/chart2/source/inc/ColorPerPointHelper.hxx @@ -20,18 +20,20 @@ #pragma once #include "charttoolsdllapi.hxx" +#include <rtl/ref.hxx> namespace com::sun::star::beans { class XPropertySet; } namespace com::sun::star::uno { template <class interface_type> class Reference; } namespace chart { +class DataSeries; class OOO_DLLPUBLIC_CHARTTOOLS ColorPerPointHelper { public: static bool hasPointOwnColor( - const css::uno::Reference< css::beans::XPropertySet >& xDataSeriesProperties + const rtl::Reference< ::chart::DataSeries >& xDataSeries , sal_Int32 nPointIndex , const css::uno::Reference< css::beans::XPropertySet >& xDataPointProperties //may be NULL this is just for performance ); @@ -39,7 +41,7 @@ public: // returns true if AttributedDataPoints contains nPointIndex and the // property Color is DEFAULT SAL_DLLPRIVATE static bool hasPointOwnProperties( - const css::uno::Reference< css::beans::XPropertySet >& xSeriesProperties + const rtl::Reference< ::chart::DataSeries >& xDataSeries , sal_Int32 nPointIndex ); }; diff --git a/chart2/source/tools/ColorPerPointHelper.cxx b/chart2/source/tools/ColorPerPointHelper.cxx index 34aeb7866021..04cc09cb44ec 100644 --- a/chart2/source/tools/ColorPerPointHelper.cxx +++ b/chart2/source/tools/ColorPerPointHelper.cxx @@ -18,33 +18,35 @@ */ #include <ColorPerPointHelper.hxx> +#include <DataSeries.hxx> +#include <DataSeriesProperties.hxx> #include <com/sun/star/chart2/XDataSeries.hpp> #include <com/sun/star/beans/XPropertyState.hpp> #include <algorithm> -namespace chart -{ using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; +using namespace ::chart::DataSeriesProperties; + +namespace chart +{ bool ColorPerPointHelper::hasPointOwnColor( - const css::uno::Reference< css::beans::XPropertySet >& xDataSeriesProperties + const rtl::Reference< DataSeries >& xDataSeries , sal_Int32 nPointIndex , const css::uno::Reference< css::beans::XPropertySet >& xDataPointProperties //may be NULL this is just for performance ) { - if( !xDataSeriesProperties.is() ) + if( !xDataSeries.is() ) return false; - if( hasPointOwnProperties( xDataSeriesProperties, nPointIndex )) + if( hasPointOwnProperties( xDataSeries, nPointIndex )) { uno::Reference< beans::XPropertyState > xPointState( xDataPointProperties, uno::UNO_QUERY ); if( !xPointState.is() ) { - uno::Reference< XDataSeries > xSeries( xDataSeriesProperties, uno::UNO_QUERY ); - if(xSeries.is()) - xPointState.set( xSeries->getDataPointByIndex( nPointIndex ), uno::UNO_QUERY ); + xPointState.set( xDataSeries->getDataPointByIndex( nPointIndex ), uno::UNO_QUERY ); } if( !xPointState.is() ) return false; @@ -56,13 +58,13 @@ bool ColorPerPointHelper::hasPointOwnColor( } bool ColorPerPointHelper::hasPointOwnProperties( - const css::uno::Reference< css::beans::XPropertySet >& xSeriesProperties + const rtl::Reference< ::chart::DataSeries >& xDataSeries , sal_Int32 nPointIndex ) { - if( xSeriesProperties.is() ) + if( xDataSeries.is() ) { uno::Sequence< sal_Int32 > aIndexList; - if( xSeriesProperties->getPropertyValue( "AttributedDataPoints" ) >>= aIndexList ) + if( xDataSeries->getFastPropertyValue( PROP_DATASERIES_ATTRIBUTED_DATA_POINTS ) >>= aIndexList ) // "AttributedDataPoints" { const sal_Int32 * pBegIt = aIndexList.getConstArray(); const sal_Int32 * pEndIt = pBegIt + aIndexList.getLength(); |