diff options
Diffstat (limited to 'chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx')
-rw-r--r-- | chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx index 6d088a50bd81..53ce90fa24f9 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx @@ -20,7 +20,7 @@ #include "WrappedSplineProperties.hxx" #include "Chart2ModelContact.hxx" #include <FastPropertyIdRanges.hxx> -#include <DiagramHelper.hxx> +#include <ChartType.hxx> #include <WrappedProperty.hxx> #include <unonames.hxx> @@ -29,10 +29,10 @@ #include <com/sun/star/chart2/CurveStyle.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/beans/XPropertySet.hpp> +#include <utility> using namespace ::com::sun::star; using ::com::sun::star::uno::Any; -using ::com::sun::star::uno::Sequence; using ::com::sun::star::beans::Property; namespace chart::wrapper @@ -47,32 +47,30 @@ template< typename PROPERTYTYPE > class WrappedSplineProperty : public WrappedProperty { public: - explicit WrappedSplineProperty( const OUString& rOuterName, const OUString& rInnerName + explicit WrappedSplineProperty( const OUString& rOuterName, OUString aInnerName , const css::uno::Any& rDefaulValue - , const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact ) + , std::shared_ptr<Chart2ModelContact> spChart2ModelContact ) : WrappedProperty(rOuterName,OUString()) - , m_spChart2ModelContact(spChart2ModelContact) + , m_spChart2ModelContact(std::move(spChart2ModelContact)) , m_aOuterValue(rDefaulValue) , m_aDefaultValue(rDefaulValue) - , m_aOwnInnerName(rInnerName) + , m_aOwnInnerName(std::move(aInnerName)) { } bool detectInnerValue( PROPERTYTYPE& rValue, bool& rHasAmbiguousValue ) const { - bool bHasDetectableInnerValue = false; rHasAmbiguousValue = false; - Sequence< css::uno::Reference< css::chart2::XChartType > > aChartTypes( - ::chart::DiagramHelper::getChartTypesFromDiagram( m_spChart2ModelContact->getDiagram() ) ); - for( sal_Int32 nN = aChartTypes.getLength(); nN--; ) + rtl::Reference<Diagram> xDiagram = m_spChart2ModelContact->getDiagram(); + if (!xDiagram) + return false; + bool bHasDetectableInnerValue = false; + std::vector< rtl::Reference< ChartType > > aChartTypes = xDiagram->getChartTypes(); + for( sal_Int32 nN = aChartTypes.size(); nN--; ) { try { - uno::Reference<beans::XPropertySet> xChartTypePropertySet(aChartTypes[nN], uno::UNO_QUERY); - if (!xChartTypePropertySet.is()) - continue; - - Any aSingleValue = convertInnerToOuterValue( xChartTypePropertySet->getPropertyValue(m_aOwnInnerName) ); + Any aSingleValue = convertInnerToOuterValue( aChartTypes[nN]->getPropertyValue(m_aOwnInnerName) ); PROPERTYTYPE aCurValue = PROPERTYTYPE(); aSingleValue >>= aCurValue; if( !bHasDetectableInnerValue ) @@ -114,17 +112,13 @@ public: if( !(bHasAmbiguousValue || aNewValue != aOldValue) ) return; - Sequence< css::uno::Reference< css::chart2::XChartType > > aChartTypes( - ::chart::DiagramHelper::getChartTypesFromDiagram( m_spChart2ModelContact->getDiagram() ) ); - for( sal_Int32 nN = aChartTypes.getLength(); nN--; ) + std::vector< rtl::Reference< ChartType > > aChartTypes = + m_spChart2ModelContact->getDiagram()->getChartTypes(); + for( sal_Int32 nN = aChartTypes.size(); nN--; ) { try { - css::uno::Reference< css::beans::XPropertySet > xChartTypePropertySet( aChartTypes[nN], css::uno::UNO_QUERY ); - if( xChartTypePropertySet.is() ) - { - xChartTypePropertySet->setPropertyValue(m_aOwnInnerName,convertOuterToInnerValue(uno::Any(aNewValue))); - } + aChartTypes[nN]->setPropertyValue(m_aOwnInnerName,convertOuterToInnerValue(uno::Any(aNewValue))); } catch( uno::Exception & ex ) { |