diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-05-18 09:17:04 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-05-18 11:28:50 +0200 |
commit | 337a9a454c1bc95214111578d3f9c0622c55c509 (patch) | |
tree | 4eda99edf46e45ce804fcde98197cf0d96b7ac3d /chart2/source/controller/chartapiwrapper | |
parent | 6089755d197528d071906846c58a397add0876a5 (diff) |
use for-range on Sequence in chart2
Change-Id: Ief02e5d5284b0cbad26b04c0a282dccfee577b90
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94398
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2/source/controller/chartapiwrapper')
4 files changed, 27 insertions, 35 deletions
diff --git a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx index 8b6d614be1dd..a0f39774b5f1 100644 --- a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx @@ -157,11 +157,10 @@ void SAL_CALL MinMaxLineWrapper::setPropertyValue( const OUString& rPropertyName Reference< beans::XPropertySet > xPropSet; Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); - Sequence< Reference< chart2::XChartType > > aTypes( + const Sequence< Reference< chart2::XChartType > > aTypes( ::chart::DiagramHelper::getChartTypesFromDiagram( xDiagram ) ); - for( sal_Int32 nN = 0; nN < aTypes.getLength(); nN++ ) + for( Reference< chart2::XChartType > const & xType : aTypes ) { - Reference< chart2::XChartType > xType( aTypes[nN] ); if( xType->getChartType() == CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ) { Reference< chart2::XDataSeriesContainer > xSeriesContainer(xType,uno::UNO_QUERY); @@ -195,11 +194,10 @@ uno::Any SAL_CALL MinMaxLineWrapper::getPropertyValue( const OUString& rProperty Reference< beans::XPropertySet > xPropSet; Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() ); - Sequence< Reference< chart2::XChartType > > aTypes( + const Sequence< Reference< chart2::XChartType > > aTypes( ::chart::DiagramHelper::getChartTypesFromDiagram( xDiagram ) ); - for( sal_Int32 nN = 0; nN < aTypes.getLength(); nN++ ) + for( Reference< chart2::XChartType > const & xType : aTypes ) { - Reference< chart2::XChartType > xType( aTypes[nN] ); if( xType->getChartType() == CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ) { Reference< chart2::XDataSeriesContainer > xSeriesContainer(xType,uno::UNO_QUERY); @@ -344,18 +342,16 @@ uno::Any SAL_CALL MinMaxLineWrapper::getPropertyDefault( const OUString& rProper void SAL_CALL MinMaxLineWrapper::setAllPropertiesToDefault( ) { const Sequence< beans::Property >& rPropSeq = *StaticMinMaxLineWrapperPropertyArray::get(); - for(sal_Int32 nN=0; nN<rPropSeq.getLength(); nN++) + for(beans::Property const & prop : rPropSeq) { - OUString aPropertyName( rPropSeq[nN].Name ); - setPropertyToDefault( aPropertyName ); + setPropertyToDefault( prop.Name ); } } void SAL_CALL MinMaxLineWrapper::setPropertiesToDefault( const uno::Sequence< OUString >& rNameSeq ) { - for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) + for(OUString const & s : rNameSeq) { - OUString aPropertyName( rNameSeq[nN] ); - setPropertyToDefault( aPropertyName ); + setPropertyToDefault( s ); } } uno::Sequence< uno::Any > SAL_CALL MinMaxLineWrapper::getPropertyDefaults( const uno::Sequence< OUString >& rNameSeq ) diff --git a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx index 5355c72150c5..7de1b376b3ef 100644 --- a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx @@ -90,12 +90,12 @@ Any WrappedTitleStringProperty::getPropertyValue( const Reference< beans::XPrope Reference< chart2::XTitle > xTitle(xInnerPropertySet,uno::UNO_QUERY); if(xTitle.is()) { - Sequence< Reference< chart2::XFormattedString > > aStrings( xTitle->getText()); + const Sequence< Reference< chart2::XFormattedString > > aStrings( xTitle->getText()); OUStringBuffer aBuf; - for( sal_Int32 i = 0; i < aStrings.getLength(); ++i ) + for( Reference< chart2::XFormattedString > const & formattedStr : aStrings ) { - aBuf.append( aStrings[ i ]->getString()); + aBuf.append( formattedStr->getString()); } aRet <<= aBuf.makeStringAndClear(); } @@ -311,12 +311,12 @@ void TitleWrapper::setFastCharacterPropertyValue( if( !xTitle.is()) return; - Sequence< Reference< chart2::XFormattedString > > aStrings( xTitle->getText()); + const Sequence< Reference< chart2::XFormattedString > > aStrings( xTitle->getText()); const WrappedProperty* pWrappedProperty = getWrappedProperty( nHandle ); - for( sal_Int32 i = 0; i < aStrings.getLength(); ++i ) + for( Reference< chart2::XFormattedString > const & formattedStr : aStrings ) { - Reference< beans::XFastPropertySet > xFastPropertySet( aStrings[ i ], uno::UNO_QUERY ); + Reference< beans::XFastPropertySet > xFastPropertySet( formattedStr, uno::UNO_QUERY ); Reference< beans::XPropertySet > xPropSet( xFastPropertySet, uno::UNO_QUERY ); if( pWrappedProperty ) diff --git a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx index 29c81bec0b23..ab7e5b333a2c 100644 --- a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx @@ -162,14 +162,13 @@ void SAL_CALL UpDownBarWrapper::setPropertyValue( const OUString& rPropertyName, { Reference< beans::XPropertySet > xPropSet; - Sequence< Reference< chart2::XChartType > > aTypes( + const Sequence< Reference< chart2::XChartType > > aTypes( ::chart::DiagramHelper::getChartTypesFromDiagram( m_spChart2ModelContact->getChart2Diagram() ) ); - for( sal_Int32 nN = 0; nN < aTypes.getLength(); nN++ ) + for( Reference< chart2::XChartType > const & xType : aTypes ) { - Reference< chart2::XChartType > xType( aTypes[nN] ); if( xType->getChartType() == CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ) { - Reference< beans::XPropertySet > xTypeProps( aTypes[nN], uno::UNO_QUERY ); + Reference< beans::XPropertySet > xTypeProps( xType, uno::UNO_QUERY ); if(xTypeProps.is()) { xTypeProps->getPropertyValue( m_aPropertySetName ) >>= xPropSet; @@ -185,14 +184,13 @@ uno::Any SAL_CALL UpDownBarWrapper::getPropertyValue( const OUString& rPropertyN Reference< beans::XPropertySet > xPropSet; - Sequence< Reference< chart2::XChartType > > aTypes( + const Sequence< Reference< chart2::XChartType > > aTypes( ::chart::DiagramHelper::getChartTypesFromDiagram( m_spChart2ModelContact->getChart2Diagram() ) ); - for( sal_Int32 nN = 0; nN < aTypes.getLength(); nN++ ) + for( Reference< chart2::XChartType > const & xType : aTypes ) { - Reference< chart2::XChartType > xType( aTypes[nN] ); if( xType->getChartType() == CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ) { - Reference< beans::XPropertySet > xTypeProps( aTypes[nN], uno::UNO_QUERY ); + Reference< beans::XPropertySet > xTypeProps( xType, uno::UNO_QUERY ); if(xTypeProps.is()) { xTypeProps->getPropertyValue( m_aPropertySetName ) >>= xPropSet; @@ -311,18 +309,16 @@ uno::Any SAL_CALL UpDownBarWrapper::getPropertyDefault( const OUString& rPropert void SAL_CALL UpDownBarWrapper::setAllPropertiesToDefault( ) { const Sequence< beans::Property >& rPropSeq = *StaticUpDownBarWrapperPropertyArray::get(); - for(sal_Int32 nN=0; nN<rPropSeq.getLength(); nN++) + for(beans::Property const & prop : rPropSeq) { - OUString aPropertyName( rPropSeq[nN].Name ); - setPropertyToDefault( aPropertyName ); + setPropertyToDefault( prop.Name ); } } void SAL_CALL UpDownBarWrapper::setPropertiesToDefault( const uno::Sequence< OUString >& rNameSeq ) { - for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++) + for(OUString const & s : rNameSeq) { - OUString aPropertyName( rNameSeq[nN] ); - setPropertyToDefault( aPropertyName ); + setPropertyToDefault( s ); } } uno::Sequence< uno::Any > SAL_CALL UpDownBarWrapper::getPropertyDefaults( const uno::Sequence< OUString >& rNameSeq ) diff --git a/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx index 044dcf28fd5b..63abadee1b85 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx @@ -71,12 +71,12 @@ void WrappedBarPositionProperty_Base::setPropertyValue( const Any& rOuterValue, if( m_nDimensionIndex!=1 ) return; - Sequence< Reference< chart2::XChartType > > aChartTypeList( DiagramHelper::getChartTypesFromDiagram( xDiagram ) ); - for( sal_Int32 nN = 0; nN < aChartTypeList.getLength(); nN++ ) + const Sequence< Reference< chart2::XChartType > > aChartTypeList( DiagramHelper::getChartTypesFromDiagram( xDiagram ) ); + for( Reference< chart2::XChartType > const & chartType : aChartTypeList ) { try { - Reference< beans::XPropertySet > xProp( aChartTypeList[nN], uno::UNO_QUERY ); + Reference< beans::XPropertySet > xProp( chartType, uno::UNO_QUERY ); if( xProp.is() ) { Sequence< sal_Int32 > aBarPositionSequence; |