diff options
Diffstat (limited to 'chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx')
-rw-r--r-- | chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx index d9ad4a3e6bb4..0edbf16bc9fb 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx @@ -20,11 +20,13 @@ #include "WrappedScaleProperty.hxx" #include "Chart2ModelContact.hxx" #include <CommonConverters.hxx> +#include <Axis.hxx> #include <AxisHelper.hxx> #include <com/sun/star/chart2/AxisType.hpp> #include <com/sun/star/chart2/XAxis.hpp> #include <com/sun/star/chart/ChartAxisType.hpp> #include <chartview/ExplicitScaleValues.hxx> +#include <utility> #include <osl/diagnose.h> using namespace ::com::sun::star; @@ -38,9 +40,9 @@ namespace chart::wrapper { WrappedScaleProperty::WrappedScaleProperty(tScaleProperty eScaleProperty - , const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) + , std::shared_ptr<Chart2ModelContact> spChart2ModelContact) : WrappedProperty(OUString(),OUString()) - , m_spChart2ModelContact( spChart2ModelContact ) + , m_spChart2ModelContact(std::move( spChart2ModelContact )) , m_eScaleProperty( eScaleProperty ) { switch( m_eScaleProperty ) @@ -173,6 +175,7 @@ void WrappedScaleProperty::setPropertyValue( tScaleProperty eScaleProperty, cons Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements ); if( !rSubIncrements.hasElements() ) rSubIncrements.realloc( 1 ); + auto pSubIncrements = rSubIncrements.getArray(); double fStepHelp = 0; if( rOuterValue >>= fStepHelp ) @@ -181,14 +184,14 @@ void WrappedScaleProperty::setPropertyValue( tScaleProperty eScaleProperty, cons if( AxisHelper::isLogarithmic(aScaleData.Scaling) ) { sal_Int32 nIntervalCount = static_cast< sal_Int32 >(fStepHelp); - rSubIncrements[ 0 ].IntervalCount <<= nIntervalCount; + pSubIncrements[ 0 ].IntervalCount <<= nIntervalCount; } else if( (fStepHelp != 0.0) && (aScaleData.IncrementData.Distance >>= fStepMain) ) { // approximate interval count sal_Int32 nIntervalCount = static_cast< sal_Int32 >(fStepMain / fStepHelp);//cppcheck-suppress zerodiv - rSubIncrements[ 0 ].IntervalCount <<= nIntervalCount; + pSubIncrements[ 0 ].IntervalCount <<= nIntervalCount; } } bSetScaleData = true; @@ -199,11 +202,12 @@ void WrappedScaleProperty::setPropertyValue( tScaleProperty eScaleProperty, cons Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements ); if( !rSubIncrements.hasElements() ) rSubIncrements.realloc( 1 ); + auto pSubIncrements = rSubIncrements.getArray(); sal_Int32 nIntervalCount=0; if( rOuterValue>>=nIntervalCount ) - rSubIncrements[ 0 ].IntervalCount <<= nIntervalCount; + pSubIncrements[ 0 ].IntervalCount <<= nIntervalCount; else - rSubIncrements[ 0 ].IntervalCount = Any(); + pSubIncrements[ 0 ].IntervalCount = Any(); bSetScaleData = true; break; } @@ -239,11 +243,12 @@ void WrappedScaleProperty::setPropertyValue( tScaleProperty eScaleProperty, cons Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements ); if( !rSubIncrements.hasElements() ) rSubIncrements.realloc( 1 ); + auto pSubIncrements = rSubIncrements.getArray(); if( (rOuterValue >>= bBool) && bBool ) - rSubIncrements[ 0 ].IntervalCount = Any(); + pSubIncrements[ 0 ].IntervalCount = Any(); else - rSubIncrements[ 0 ].IntervalCount = getPropertyValue( SCALE_PROP_STEPHELP_COUNT, xInnerPropertySet ); + pSubIncrements[ 0 ].IntervalCount = getPropertyValue( SCALE_PROP_STEPHELP_COUNT, xInnerPropertySet ); bSetScaleData = true; break; } @@ -345,7 +350,7 @@ Any WrappedScaleProperty::getPropertyValue( tScaleProperty eScaleProperty, const { Any aRet( m_aOuterValue ); - Reference< chart2::XAxis > xAxis( xInnerPropertySet, uno::UNO_QUERY ); + rtl::Reference< Axis > xAxis = dynamic_cast<Axis*>(xInnerPropertySet.get()); OSL_ENSURE(xAxis.is(),"need an XAxis"); if(!xAxis.is()) return aRet; |