diff options
Diffstat (limited to 'chart2/source/controller/chartapiwrapper')
7 files changed, 64 insertions, 89 deletions
diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx index e49239935c6d..e7f4129df17b 100644 --- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx @@ -19,6 +19,7 @@ #include "DataSeriesPointWrapper.hxx" #include "Chart2ModelContact.hxx" +#include <ChartType.hxx> #include <ChartTypeHelper.hxx> #include <DiagramHelper.hxx> #include <LinePropertiesHelper.hxx> diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx index d9deba9857d4..cb28be651c19 100644 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx @@ -28,6 +28,7 @@ #include <DiagramHelper.hxx> #include <DataSourceHelper.hxx> #include <ChartModelHelper.hxx> +#include <ChartType.hxx> #include <WrappedIgnoreProperty.hxx> #include "WrappedAxisAndGridExistenceProperties.hxx" #include "WrappedStatisticProperties.hxx" @@ -438,7 +439,7 @@ struct StaticDiagramWrapperPropertyArray : public rtl::StaticAggregate< Sequence bool lcl_isXYChart( const Reference< chart2::XDiagram >& rDiagram ) { bool bRet = false; - Reference< chart2::XChartType > xChartType( ::chart::DiagramHelper::getChartTypeByIndex( rDiagram, 0 ) ); + rtl::Reference< ::chart::ChartType > xChartType( ::chart::DiagramHelper::getChartTypeByIndex( rDiagram, 0 ) ); if( xChartType.is() ) { OUString aChartType( xChartType->getChartType() ); @@ -613,7 +614,7 @@ OUString SAL_CALL DiagramWrapper::getDiagramType() { // none of the standard templates matched // use first chart type - Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ); + rtl::Reference< ChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) ); if( xChartType.is() ) { aRet = xChartType->getChartType(); diff --git a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx index 516a96b2a042..e14993312dbb 100644 --- a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx @@ -19,6 +19,7 @@ #include "MinMaxLineWrapper.hxx" #include "Chart2ModelContact.hxx" +#include <ChartType.hxx> #include <DiagramHelper.hxx> #include <servicenames_charttypes.hxx> #include <cppuhelper/propshlp.hxx> @@ -157,31 +158,27 @@ void SAL_CALL MinMaxLineWrapper::setPropertyValue( const OUString& rPropertyName Reference< beans::XPropertySet > xPropSet; rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() ); - const Sequence< Reference< chart2::XChartType > > aTypes( + const std::vector< rtl::Reference< ChartType > > & aTypes( ::chart::DiagramHelper::getChartTypesFromDiagram( xDiagram ) ); - for( Reference< chart2::XChartType > const & xType : aTypes ) + for( rtl::Reference< ChartType > const & xType : aTypes ) { if( xType->getChartType() == CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ) { - Reference< chart2::XDataSeriesContainer > xSeriesContainer(xType,uno::UNO_QUERY); - if( xSeriesContainer.is() ) + Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xType->getDataSeries() ); + if(aSeriesSeq.hasElements()) { - Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xSeriesContainer->getDataSeries() ); - if(aSeriesSeq.hasElements()) + xPropSet.set(aSeriesSeq[0],uno::UNO_QUERY); + if(xPropSet.is()) { - xPropSet.set(aSeriesSeq[0],uno::UNO_QUERY); - if(xPropSet.is()) - { - if( rPropertyName == "LineColor" ) - xPropSet->setPropertyValue( "Color", rValue ); - else if( rPropertyName == "LineTransparence" ) - xPropSet->setPropertyValue( "Transparency", rValue ); - else if( rPropertyName == m_aWrappedLineJointProperty.getOuterName() ) - m_aWrappedLineJointProperty.setPropertyValue( rValue, xPropSet ); - else - xPropSet->setPropertyValue( rPropertyName, rValue ); - return; - } + if( rPropertyName == "LineColor" ) + xPropSet->setPropertyValue( "Color", rValue ); + else if( rPropertyName == "LineTransparence" ) + xPropSet->setPropertyValue( "Transparency", rValue ); + else if( rPropertyName == m_aWrappedLineJointProperty.getOuterName() ) + m_aWrappedLineJointProperty.setPropertyValue( rValue, xPropSet ); + else + xPropSet->setPropertyValue( rPropertyName, rValue ); + return; } } } @@ -194,21 +191,17 @@ uno::Any SAL_CALL MinMaxLineWrapper::getPropertyValue( const OUString& rProperty Reference< beans::XPropertySet > xPropSet; rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() ); - const Sequence< Reference< chart2::XChartType > > aTypes( + const std::vector< rtl::Reference< ChartType > > aTypes( ::chart::DiagramHelper::getChartTypesFromDiagram( xDiagram ) ); - for( Reference< chart2::XChartType > const & xType : aTypes ) + for( rtl::Reference< ChartType > const & xType : aTypes ) { if( xType->getChartType() == CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ) { - Reference< chart2::XDataSeriesContainer > xSeriesContainer(xType,uno::UNO_QUERY); - if( xSeriesContainer.is() ) + Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xType->getDataSeries() ); + if(aSeriesSeq.hasElements()) { - Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xSeriesContainer->getDataSeries() ); - if(aSeriesSeq.hasElements()) - { - xPropSet.set(aSeriesSeq[0],uno::UNO_QUERY); - break; - } + xPropSet.set(aSeriesSeq[0],uno::UNO_QUERY); + break; } } } diff --git a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx index 2922f91c466b..6a80eae044bb 100644 --- a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx @@ -19,6 +19,7 @@ #include "UpDownBarWrapper.hxx" #include "Chart2ModelContact.hxx" +#include <ChartType.hxx> #include <DiagramHelper.hxx> #include <servicenames_charttypes.hxx> #include <cppuhelper/supportsservice.hxx> @@ -162,17 +163,13 @@ void SAL_CALL UpDownBarWrapper::setPropertyValue( const OUString& rPropertyName, { Reference< beans::XPropertySet > xPropSet; - const Sequence< Reference< chart2::XChartType > > aTypes( + const std::vector< rtl::Reference< ChartType > > aTypes( ::chart::DiagramHelper::getChartTypesFromDiagram( m_spChart2ModelContact->getDiagram() ) ); - for( Reference< chart2::XChartType > const & xType : aTypes ) + for( rtl::Reference< ChartType > const & xType : aTypes ) { if( xType->getChartType() == CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ) { - Reference< beans::XPropertySet > xTypeProps( xType, uno::UNO_QUERY ); - if(xTypeProps.is()) - { - xTypeProps->getPropertyValue( m_aPropertySetName ) >>= xPropSet; - } + xType->getPropertyValue( m_aPropertySetName ) >>= xPropSet; } } if(xPropSet.is()) @@ -184,17 +181,13 @@ uno::Any SAL_CALL UpDownBarWrapper::getPropertyValue( const OUString& rPropertyN Reference< beans::XPropertySet > xPropSet; - const Sequence< Reference< chart2::XChartType > > aTypes( + const std::vector< rtl::Reference< ChartType > > aTypes( ::chart::DiagramHelper::getChartTypesFromDiagram( m_spChart2ModelContact->getDiagram() ) ); - for( Reference< chart2::XChartType > const & xType : aTypes ) + for( rtl::Reference<ChartType > const & xType : aTypes ) { if( xType->getChartType() == CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ) { - Reference< beans::XPropertySet > xTypeProps( xType, uno::UNO_QUERY ); - if(xTypeProps.is()) - { - xTypeProps->getPropertyValue( m_aPropertySetName ) >>= xPropSet; - } + xType->getPropertyValue( m_aPropertySetName ) >>= xPropSet; } } if(xPropSet.is()) diff --git a/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx index c0f100d335a7..e613161bf10f 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx @@ -19,6 +19,7 @@ #include "WrappedGapwidthProperty.hxx" #include "Chart2ModelContact.hxx" +#include <ChartType.hxx> #include <DiagramHelper.hxx> #include <tools/long.hxx> @@ -72,29 +73,25 @@ void WrappedBarPositionProperty_Base::setPropertyValue( const Any& rOuterValue, if( m_nDimensionIndex!=1 ) return; - const Sequence< Reference< chart2::XChartType > > aChartTypeList( DiagramHelper::getChartTypesFromDiagram( xDiagram ) ); - for( Reference< chart2::XChartType > const & chartType : aChartTypeList ) + const std::vector< rtl::Reference< ChartType > > aChartTypeList( DiagramHelper::getChartTypesFromDiagram( xDiagram ) ); + for( rtl::Reference< ChartType > const & chartType : aChartTypeList ) { try { - Reference< beans::XPropertySet > xProp( chartType, uno::UNO_QUERY ); - if( xProp.is() ) + Sequence< sal_Int32 > aBarPositionSequence; + chartType->getPropertyValue( m_InnerSequencePropertyName ) >>= aBarPositionSequence; + + tools::Long nOldLength = aBarPositionSequence.getLength(); + if( nOldLength <= m_nAxisIndex ) + aBarPositionSequence.realloc( m_nAxisIndex+1 ); + auto pBarPositionSequence = aBarPositionSequence.getArray(); + for( sal_Int32 i=nOldLength; i<m_nAxisIndex; i++ ) { - Sequence< sal_Int32 > aBarPositionSequence; - xProp->getPropertyValue( m_InnerSequencePropertyName ) >>= aBarPositionSequence; - - tools::Long nOldLength = aBarPositionSequence.getLength(); - if( nOldLength <= m_nAxisIndex ) - aBarPositionSequence.realloc( m_nAxisIndex+1 ); - auto pBarPositionSequence = aBarPositionSequence.getArray(); - for( sal_Int32 i=nOldLength; i<m_nAxisIndex; i++ ) - { - pBarPositionSequence[i] = m_nDefaultValue; - } - pBarPositionSequence[m_nAxisIndex] = nNewValue; - - xProp->setPropertyValue( m_InnerSequencePropertyName, uno::Any( aBarPositionSequence ) ); + pBarPositionSequence[i] = m_nDefaultValue; } + pBarPositionSequence[m_nAxisIndex] = nNewValue; + + chartType->setPropertyValue( m_InnerSequencePropertyName, uno::Any( aBarPositionSequence ) ); } catch( uno::Exception& e ) { @@ -115,21 +112,17 @@ Any WrappedBarPositionProperty_Base::getPropertyValue( const Reference< beans::X if( m_nDimensionIndex==1 ) { - Sequence< Reference< chart2::XChartType > > aChartTypeList( DiagramHelper::getChartTypesFromDiagram( xDiagram ) ); - for( sal_Int32 nN = 0; nN < aChartTypeList.getLength() && !bInnerValueDetected; nN++ ) + std::vector< rtl::Reference< ChartType > > aChartTypeList( DiagramHelper::getChartTypesFromDiagram( xDiagram ) ); + for( sal_Int32 nN = 0; nN < static_cast<sal_Int32>(aChartTypeList.size()) && !bInnerValueDetected; nN++ ) { try { - Reference< beans::XPropertySet > xProp( aChartTypeList[nN], uno::UNO_QUERY ); - if( xProp.is() ) + Sequence< sal_Int32 > aBarPositionSequence; + aChartTypeList[nN]->getPropertyValue( m_InnerSequencePropertyName ) >>= aBarPositionSequence; + if( m_nAxisIndex < aBarPositionSequence.getLength() ) { - Sequence< sal_Int32 > aBarPositionSequence; - xProp->getPropertyValue( m_InnerSequencePropertyName ) >>= aBarPositionSequence; - if( m_nAxisIndex < aBarPositionSequence.getLength() ) - { - nInnerValue = aBarPositionSequence[m_nAxisIndex]; - bInnerValueDetected = true; - } + nInnerValue = aBarPositionSequence[m_nAxisIndex]; + bInnerValueDetected = true; } } catch( uno::Exception& e ) diff --git a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx index 6d088a50bd81..102acfb02ba2 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx @@ -20,6 +20,7 @@ #include "WrappedSplineProperties.hxx" #include "Chart2ModelContact.hxx" #include <FastPropertyIdRanges.hxx> +#include <ChartType.hxx> #include <DiagramHelper.hxx> #include <WrappedProperty.hxx> #include <unonames.hxx> @@ -62,17 +63,13 @@ public: { bool bHasDetectableInnerValue = false; rHasAmbiguousValue = false; - Sequence< css::uno::Reference< css::chart2::XChartType > > aChartTypes( + std::vector< rtl::Reference< ChartType > > aChartTypes( ::chart::DiagramHelper::getChartTypesFromDiagram( m_spChart2ModelContact->getDiagram() ) ); - for( sal_Int32 nN = aChartTypes.getLength(); nN--; ) + 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 +111,13 @@ public: if( !(bHasAmbiguousValue || aNewValue != aOldValue) ) return; - Sequence< css::uno::Reference< css::chart2::XChartType > > aChartTypes( + std::vector< rtl::Reference< ChartType > > aChartTypes( ::chart::DiagramHelper::getChartTypesFromDiagram( m_spChart2ModelContact->getDiagram() ) ); - for( sal_Int32 nN = aChartTypes.getLength(); nN--; ) + 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 ) { diff --git a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx index 484861b68338..7e29348728a8 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx @@ -20,6 +20,7 @@ #include "WrappedSymbolProperties.hxx" #include "WrappedSeriesOrDiagramProperty.hxx" #include <FastPropertyIdRanges.hxx> +#include <ChartType.hxx> #include <ChartTypeHelper.hxx> #include <com/sun/star/chart2/Symbol.hpp> #include <com/sun/star/chart2/SymbolStyle.hpp> @@ -286,7 +287,7 @@ beans::PropertyState WrappedSymbolTypeProperty::getPropertyState( const Referenc { rtl::Reference< ::chart::Diagram > xDiagram( m_spChart2ModelContact->getDiagram() ); Reference< chart2::XDataSeries > xSeries( xInnerPropertyState, uno::UNO_QUERY ); - Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ) ); + rtl::Reference< ChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ) ); if( ChartTypeHelper::isSupportingSymbolProperties( xChartType, 2 ) ) return beans::PropertyState_DIRECT_VALUE; } |