diff options
Diffstat (limited to 'chart2/source/controller')
14 files changed, 103 insertions, 114 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; diff --git a/chart2/source/controller/dialogs/DataBrowserModel.cxx b/chart2/source/controller/dialogs/DataBrowserModel.cxx index 0fad7561bdc1..c8359f74ab23 100644 --- a/chart2/source/controller/dialogs/DataBrowserModel.cxx +++ b/chart2/source/controller/dialogs/DataBrowserModel.cxx @@ -107,12 +107,12 @@ bool lcl_SequenceOfSeriesIsShared( OUString aValuesRole( lcl_getRole( xValues )); OUString aValuesRep( xValues->getSourceRangeRepresentation()); Reference< chart2::data::XDataSource > xSource( xSeries, uno::UNO_QUERY_THROW ); - Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSeq( xSource->getDataSequences()); - for( sal_Int32 i=0; i<aLSeq.getLength(); ++i ) - if (aLSeq[i].is() && DataSeriesHelper::getRole(aLSeq[i]) == aValuesRole) + const Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSeq( xSource->getDataSequences()); + for( Reference< chart2::data::XLabeledDataSequence > const & labeledDataSeq : aLSeq ) + if (labeledDataSeq.is() && DataSeriesHelper::getRole(labeledDataSeq) == aValuesRole) { // getValues().is(), because lcl_getRole checked that already - bResult = (aValuesRep == aLSeq[i]->getValues()->getSourceRangeRepresentation()); + bResult = (aValuesRep == labeledDataSeq->getValues()->getSourceRangeRepresentation()); // assumption: a role appears only once in a series break; } @@ -136,10 +136,10 @@ lcl_tSharedSeqVec lcl_getSharedSequences( const Sequence< Reference< chart2::XDa return aResult; Reference< chart2::data::XDataSource > xSource( rSeries[0], uno::UNO_QUERY ); - Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSeq( xSource->getDataSequences()); - for( sal_Int32 nIdx=0; nIdx<aLSeq.getLength(); ++nIdx ) + const Sequence< Reference< chart2::data::XLabeledDataSequence > > aLSeq( xSource->getDataSequences()); + for( Reference< chart2::data::XLabeledDataSequence > const & labeledDataSeq : aLSeq ) { - Reference< chart2::data::XDataSequence > xValues( aLSeq[nIdx]->getValues()); + Reference< chart2::data::XDataSequence > xValues( labeledDataSeq->getValues()); bool bShared = true; for( sal_Int32 nSeriesIdx=1; nSeriesIdx<rSeries.getLength(); ++nSeriesIdx ) { @@ -148,7 +148,7 @@ lcl_tSharedSeqVec lcl_getSharedSequences( const Sequence< Reference< chart2::XDa break; } if( bShared ) - aResult.push_back( aLSeq[nIdx] ); + aResult.push_back( labeledDataSeq ); } return aResult; @@ -480,13 +480,13 @@ void DataBrowserModel::removeDataSeriesOrComplexCategoryLevel( sal_Int32 nAtColu // Check if the sequences to be deleted are still referenced by any of // the other data series. If not, mark them for deletion. std::vector<sal_Int32> aSequenceIndexesToDelete; - Sequence<Reference<chart2::data::XLabeledDataSequence> > aSequencesOfDeleted = xSourceOfDeleted->getDataSequences(); - for (sal_Int32 i = 0; i < aSequencesOfDeleted.getLength(); ++i) + const Sequence<Reference<chart2::data::XLabeledDataSequence> > aSequencesOfDeleted = xSourceOfDeleted->getDataSequences(); + for (auto const & labeledDataSeq : aSequencesOfDeleted) { // if not used by the remaining series this sequence can be deleted if( std::none_of( aAllDataSeqs.begin(), aAllDataSeqs.end(), - lcl_RepresentationsOfLSeqMatch( aSequencesOfDeleted[i] )) ) - aSequenceIndexesToDelete.push_back( lcl_getValuesRepresentationIndex( aSequencesOfDeleted[i] ) ); + lcl_RepresentationsOfLSeqMatch( labeledDataSeq )) ) + aSequenceIndexesToDelete.push_back( lcl_getValuesRepresentationIndex( labeledDataSeq ) ); } // delete unnecessary sequences of the internal data @@ -809,12 +809,12 @@ void DataBrowserModel::updateFromModel() Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY ); if( !xCooSysCnt.is()) return; - Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems()); - for( sal_Int32 nCooSysIdx=0; nCooSysIdx<aCooSysSeq.getLength(); ++nCooSysIdx ) + const Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems()); + for( Reference< chart2::XCoordinateSystem > const & coords : aCooSysSeq ) { - Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[nCooSysIdx], uno::UNO_QUERY_THROW ); - Sequence< Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes()); - sal_Int32 nXAxisNumberFormat = DataSeriesHelper::getNumberFormatKeyFromAxis( nullptr, aCooSysSeq[nCooSysIdx], 0, 0 ); + Reference< chart2::XChartTypeContainer > xCTCnt( coords, uno::UNO_QUERY_THROW ); + const Sequence< Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes()); + sal_Int32 nXAxisNumberFormat = DataSeriesHelper::getNumberFormatKeyFromAxis( nullptr, coords, 0, 0 ); for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx ) { @@ -823,7 +823,7 @@ void DataBrowserModel::updateFromModel() { OUString aRoleForDataLabelNumberFormat = ChartTypeHelper::getRoleOfSequenceForDataLabelNumberFormatDetection( aChartTypes[nCTIdx] ); - Sequence< Reference< chart2::XDataSeries > > aSeries( xSeriesCnt->getDataSeries()); + const Sequence< Reference< chart2::XDataSeries > > aSeries( xSeriesCnt->getDataSeries()); lcl_tSharedSeqVec aSharedSequences( lcl_getSharedSequences( aSeries )); for (auto const& sharedSequence : aSharedSequences) { @@ -838,10 +838,10 @@ void DataBrowserModel::updateFromModel() m_aColumns.push_back( aSharedSequence ); ++nHeaderStart; } - for( sal_Int32 nSeriesIdx=0; nSeriesIdx<aSeries.getLength(); ++nSeriesIdx ) + for( Reference< chart2::XDataSeries > const & dataSeries : aSeries ) { tDataColumnVector::size_type nStartColIndex = m_aColumns.size(); - Reference< chart2::XDataSeries > xSeries( aSeries[nSeriesIdx] ); + Reference< chart2::XDataSeries > xSeries( dataSeries ); Reference< chart2::data::XDataSource > xSource( xSeries, uno::UNO_QUERY ); if( xSource.is()) { @@ -853,7 +853,7 @@ void DataBrowserModel::updateFromModel() // @todo: dimension index 1 for y-values used here. This is just a guess sal_Int32 nYAxisNumberFormatKey = DataSeriesHelper::getNumberFormatKeyFromAxis( - aSeries[nSeriesIdx], aCooSysSeq[nCooSysIdx], 1 ); + dataSeries, coords, 1 ); sal_Int32 nSeqIdx=0; for( ; nSeqIdx<aLSeqs.getLength(); ++nSeqIdx ) @@ -874,7 +874,7 @@ void DataBrowserModel::updateFromModel() { // no shared sequence m_aColumns.emplace_back( - aSeries[nSeriesIdx], + dataSeries, lcl_getUIRoleName( aLSeqs[nSeqIdx] ), aLSeqs[nSeqIdx], NUMBER, @@ -886,20 +886,20 @@ void DataBrowserModel::updateFromModel() bool bSwapXAndYAxis = false; try { - Reference< beans::XPropertySet > xProp( aCooSysSeq[nCooSysIdx], uno::UNO_QUERY ); + Reference< beans::XPropertySet > xProp( coords, uno::UNO_QUERY ); xProp->getPropertyValue( "SwapXAndYAxis" ) >>= bSwapXAndYAxis; } catch( const beans::UnknownPropertyException & ) {} // add ranges for error bars if present for a series - if( StatisticsHelper::usesErrorBarRanges( aSeries[nSeriesIdx] )) - addErrorBarRanges( aSeries[nSeriesIdx], nYAxisNumberFormatKey, nSeqIdx, nHeaderEnd, true ); + if( StatisticsHelper::usesErrorBarRanges( dataSeries )) + addErrorBarRanges( dataSeries, nYAxisNumberFormatKey, nSeqIdx, nHeaderEnd, true ); - if( StatisticsHelper::usesErrorBarRanges( aSeries[nSeriesIdx], /* bYError = */ false )) - addErrorBarRanges( aSeries[nSeriesIdx], nYAxisNumberFormatKey, nSeqIdx, nHeaderEnd, false ); + if( StatisticsHelper::usesErrorBarRanges( dataSeries, /* bYError = */ false )) + addErrorBarRanges( dataSeries, nYAxisNumberFormatKey, nSeqIdx, nHeaderEnd, false ); m_aHeaders.emplace_back( - aSeries[nSeriesIdx], + dataSeries, aChartTypes[nCTIdx], bSwapXAndYAxis, nHeaderStart, diff --git a/chart2/source/controller/dialogs/DialogModel.cxx b/chart2/source/controller/dialogs/DialogModel.cxx index db50eab8b9ed..5c8678bc9f5b 100644 --- a/chart2/source/controller/dialogs/DialogModel.cxx +++ b/chart2/source/controller/dialogs/DialogModel.cxx @@ -140,17 +140,17 @@ struct lcl_DataSeriesContainerAppend { if( xVal.is()) { - Sequence< Reference< XDataSeries > > aSeq( xVal->getDataSeries()); + const Sequence< Reference< XDataSeries > > aSeq( xVal->getDataSeries()); OUString aRole( "values-y" ); Reference< XChartType > xCT( xVal, uno::UNO_QUERY ); if( xCT.is()) aRole = xCT->getRoleOfSequenceForSeriesLabel(); - for( sal_Int32 nI = 0; nI < aSeq.getLength(); ++ nI ) + for( Reference< XDataSeries > const & dataSeries : aSeq ) { m_rDestCnt->push_back( ::chart::DialogModel::tSeriesWithChartTypeByName( - ::chart::DataSeriesHelper::getDataSeriesLabel( aSeq[nI], aRole ), - std::make_pair( aSeq[nI], xCT ))); + ::chart::DataSeriesHelper::getDataSeriesLabel( dataSeries, aRole ), + std::make_pair( dataSeries, xCT ))); } } } @@ -311,16 +311,15 @@ Reference< XDataSeries > lcl_CreateNewSeries( const OUString aLabel(::chart::SchResId(STR_DATA_UNNAMED_SERIES)); const Sequence< OUString > aRoles( xChartType->getSupportedMandatoryRoles()); const Sequence< OUString > aOptRoles( xChartType->getSupportedOptionalRoles()); - sal_Int32 nI = 0; - for(nI=0; nI<aRoles.getLength(); ++nI) + for(OUString const & role : aRoles) { - if( aRoles[nI] == lcl_aLabelRole ) + if( role == lcl_aLabelRole ) continue; Reference< data::XDataSequence > xSeq( ::chart::DataSourceHelper::createCachedDataSequence() ); - lcl_SetSequenceRole( xSeq, aRoles[nI] ); + lcl_SetSequenceRole( xSeq, role ); // assert that aRoleOfSeqForSeriesLabel is part of the mandatory roles - if( aRoles[nI] == aRoleOfSeqForSeriesLabel ) + if( role == aRoleOfSeqForSeriesLabel ) { Reference< data::XDataSequence > xLabel( ::chart::DataSourceHelper::createCachedDataSequence( aLabel )); lcl_SetSequenceRole( xLabel, lcl_aLabelRole ); @@ -330,12 +329,12 @@ Reference< XDataSeries > lcl_CreateNewSeries( aNewSequences.push_back( ::chart::DataSourceHelper::createLabeledDataSequence( xSeq )); } - for(nI=0; nI<aOptRoles.getLength(); ++nI) + for(OUString const & role : aOptRoles) { - if( aOptRoles[nI] == lcl_aLabelRole ) + if( role == lcl_aLabelRole ) continue; Reference< data::XDataSequence > xSeq( ::chart::DataSourceHelper::createCachedDataSequence()); - lcl_SetSequenceRole( xSeq, aOptRoles[nI] ); + lcl_SetSequenceRole( xSeq, role ); aNewSequences.push_back( ::chart::DataSourceHelper::createLabeledDataSequence( xSeq )); } @@ -428,11 +427,11 @@ std::vector< Reference< XDataSeriesContainer > > { Reference< XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW ); - Sequence< Reference< XCoordinateSystem > > aCooSysSeq( + const Sequence< Reference< XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems()); - for( sal_Int32 i=0; i<aCooSysSeq.getLength(); ++i ) + for( Reference< XCoordinateSystem > const & coords : aCooSysSeq ) { - Reference< XChartTypeContainer > xCTCnt( aCooSysSeq[i], uno::UNO_QUERY_THROW ); + Reference< XChartTypeContainer > xCTCnt( coords, uno::UNO_QUERY_THROW ); Sequence< Reference< XChartType > > aChartTypeSeq( xCTCnt->getChartTypes()); std::transform( aChartTypeSeq.begin(), aChartTypeSeq.end(), @@ -465,10 +464,10 @@ namespace { void addMissingRoles(DialogModel::tRolesWithRanges& rResult, const uno::Sequence<OUString>& rRoles) { - for(sal_Int32 i = 0, n = rRoles.getLength(); i < n; ++i) + for(OUString const & role : rRoles) { - if(rResult.find(rRoles[i]) == rResult.end()) - rResult.emplace(rRoles[i], OUString()); + if(rResult.find(role) == rResult.end()) + rResult.emplace(role, OUString()); } } diff --git a/chart2/source/controller/dialogs/tp_AxisPositions.cxx b/chart2/source/controller/dialogs/tp_AxisPositions.cxx index eeb8e19a96be..89b8c3899881 100644 --- a/chart2/source/controller/dialogs/tp_AxisPositions.cxx +++ b/chart2/source/controller/dialogs/tp_AxisPositions.cxx @@ -126,8 +126,8 @@ void AxisPositionsTabPage::Reset(const SfxItemSet* rInAttrs) m_xED_CrossesAtCategory->set_visible( m_bCrossingAxisIsCategoryAxis ); if (m_bCrossingAxisIsCategoryAxis) { - for( sal_Int32 nN=0; nN<m_aCategories.getLength(); nN++ ) - m_xED_CrossesAtCategory->append_text(m_aCategories[nN]); + for( auto const & cat : std::as_const(m_aCategories) ) + m_xED_CrossesAtCategory->append_text(cat); } if( m_xLB_CrossesAt->get_count() > 3 ) diff --git a/chart2/source/controller/dialogs/tp_DataSource.cxx b/chart2/source/controller/dialogs/tp_DataSource.cxx index d09fcf81ff87..b6ebe98d08d8 100644 --- a/chart2/source/controller/dialogs/tp_DataSource.cxx +++ b/chart2/source/controller/dialogs/tp_DataSource.cxx @@ -140,15 +140,15 @@ Reference< chart2::data::XLabeledDataSequence > lcl_findLSequenceWithOnlyLabel( const Reference< chart2::data::XDataSource > & xDataSource ) { Reference< chart2::data::XLabeledDataSequence > xResult; - Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences( xDataSource->getDataSequences()); + const Sequence< Reference< chart2::data::XLabeledDataSequence > > aSequences( xDataSource->getDataSequences()); - for( sal_Int32 i=0; i<aSequences.getLength(); ++i ) + for( Reference< chart2::data::XLabeledDataSequence > const & labeledDataSeq : aSequences ) { // no values are set but a label exists - if( ! aSequences[i]->getValues().is() && - aSequences[i]->getLabel().is()) + if( ! labeledDataSeq->getValues().is() && + labeledDataSeq->getLabel().is()) { - xResult.set( aSequences[i] ); + xResult.set( labeledDataSeq ); break; } } diff --git a/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx index 244cbf9a23bb..8351e5bf02ab 100644 --- a/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx +++ b/chart2/source/controller/itemsetwrapper/MultipleChartConverters.cxx @@ -50,10 +50,10 @@ AllAxisItemConverter::AllAxisItemConverter( : MultipleItemConverter( rItemPool ) { Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) ); - Sequence< Reference< XAxis > > aElementList( AxisHelper::getAllAxesOfDiagram( xDiagram ) ); - for( sal_Int32 nA = 0; nA < aElementList.getLength(); nA++ ) + const Sequence< Reference< XAxis > > aElementList( AxisHelper::getAllAxesOfDiagram( xDiagram ) ); + for( Reference< XAxis > const & axis : aElementList ) { - uno::Reference< beans::XPropertySet > xObjectProperties(aElementList[nA], uno::UNO_QUERY); + uno::Reference< beans::XPropertySet > xObjectProperties(axis, uno::UNO_QUERY); m_aConverters.emplace_back( new ::chart::wrapper::AxisItemConverter( xObjectProperties, rItemPool, rDrawModel, uno::Reference< chart2::XChartDocument >( xChartModel, uno::UNO_QUERY ), nullptr, nullptr, @@ -79,10 +79,9 @@ AllGridItemConverter::AllGridItemConverter( : MultipleItemConverter( rItemPool ) { Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) ); - Sequence< Reference< beans::XPropertySet > > aElementList( AxisHelper::getAllGrids( xDiagram ) ); - for( sal_Int32 nA = 0; nA < aElementList.getLength(); nA++ ) + const Sequence< Reference< beans::XPropertySet > > aElementList( AxisHelper::getAllGrids( xDiagram ) ); + for( Reference< beans::XPropertySet > const & xObjectProperties : aElementList ) { - Reference< beans::XPropertySet > xObjectProperties(aElementList[nA]); m_aConverters.emplace_back( new ::chart::wrapper::GraphicPropertyItemConverter( xObjectProperties, rItemPool, rDrawModel, xNamedPropertyContainerFactory, ::chart::wrapper::GraphicObjectType::LineProperties ) ); diff --git a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx index e4952bbc0329..d50f39abc3bb 100644 --- a/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/SeriesOptionsItemConverter.cxx @@ -219,8 +219,8 @@ bool SeriesOptionsItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const Sf if(!bGroupBarsPerAxis) { //set the same value for all axes - for( sal_Int32 nN = 0; nN < aBarPositionSequence.getLength(); nN++ ) - aBarPositionSequence[nN] = rBarPosition; + for( auto & pos : aBarPositionSequence ) + pos = rBarPosition; } else if( nAxisIndex >= 0 && nAxisIndex < aBarPositionSequence.getLength() ) aBarPositionSequence[nAxisIndex] = rBarPosition; diff --git a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx index 75638edfed22..dfc57623bf2d 100644 --- a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx @@ -67,9 +67,9 @@ FormattedStringsConverter::FormattedStringsConverter( MultipleItemConverter( rItemPool ) { bool bHasRefSize = (pRefSize && xParentProp.is()); - for( sal_Int32 i = 0; i < aStrings.getLength(); ++i ) + for( uno::Reference< chart2::XFormattedString > const & formattedStr : aStrings ) { - uno::Reference< beans::XPropertySet > xProp( aStrings[ i ], uno::UNO_QUERY ); + uno::Reference< beans::XPropertySet > xProp( formattedStr, uno::UNO_QUERY ); if( xProp.is()) { if( bHasRefSize ) diff --git a/chart2/source/controller/main/ChartController_Insert.cxx b/chart2/source/controller/main/ChartController_Insert.cxx index 611cd3dbd613..85f7ea5c345e 100644 --- a/chart2/source/controller/main/ChartController_Insert.cxx +++ b/chart2/source/controller/main/ChartController_Insert.cxx @@ -836,9 +836,9 @@ void ChartController::executeDispatch_InsertMinorGrid() Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() ); if( xAxis.is() ) { - Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() ); - for( sal_Int32 nN=0; nN<aSubGrids.getLength(); nN++) - AxisHelper::makeGridVisible( aSubGrids[nN] ); + const Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() ); + for( Reference< beans::XPropertySet > const & props : aSubGrids) + AxisHelper::makeGridVisible( props ); aUndoGuard.commit(); } } @@ -860,9 +860,9 @@ void ChartController::executeDispatch_DeleteMinorGrid() Reference< XAxis > xAxis = ObjectIdentifier::getAxisForCID( m_aSelection.getSelectedCID(), getModel() ); if( xAxis.is() ) { - Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() ); - for( sal_Int32 nN=0; nN<aSubGrids.getLength(); nN++) - AxisHelper::makeGridInvisible( aSubGrids[nN] ); + const Sequence< Reference< beans::XPropertySet > > aSubGrids( xAxis->getSubGridProperties() ); + for( Reference< beans::XPropertySet > const & props : aSubGrids) + AxisHelper::makeGridInvisible( props ); aUndoGuard.commit(); } } diff --git a/chart2/source/controller/main/ChartModelClone.cxx b/chart2/source/controller/main/ChartModelClone.cxx index 456bd178c81b..6348aee6e6f9 100644 --- a/chart2/source/controller/main/ChartModelClone.cxx +++ b/chart2/source/controller/main/ChartModelClone.cxx @@ -220,11 +220,11 @@ namespace chart Reference< XDataSource > xUsedData( DataSourceHelper::getUsedData( i_model ) ); if ( xUsedData.is() && xNewDataProvider.is() ) { - Sequence< Reference< XLabeledDataSequence > > aData( xUsedData->getDataSequences() ); - for( sal_Int32 i=0; i<aData.getLength(); ++i ) + const Sequence< Reference< XLabeledDataSequence > > aData( xUsedData->getDataSequences() ); + for( Reference< XLabeledDataSequence > const & labeledDataSeq : aData ) { - xNewDataProvider->registerDataSequenceForChanges( aData[i]->getValues() ); - xNewDataProvider->registerDataSequenceForChanges( aData[i]->getLabel() ); + xNewDataProvider->registerDataSequenceForChanges( labeledDataSeq->getValues() ); + xNewDataProvider->registerDataSequenceForChanges( labeledDataSeq->getLabel() ); } } } diff --git a/chart2/source/controller/main/ObjectHierarchy.cxx b/chart2/source/controller/main/ObjectHierarchy.cxx index 15b5392153b3..32762762e827 100644 --- a/chart2/source/controller/main/ObjectHierarchy.cxx +++ b/chart2/source/controller/main/ObjectHierarchy.cxx @@ -238,9 +238,9 @@ void ImplObjectHierarchy::createTree( const Reference< XChartDocument >& xChartD if( !m_bOrderingForElementSelector ) { // Axis Titles. Note: These are interpreted of being top level - Sequence< Reference< XAxis > > aAxes( AxisHelper::getAllAxesOfDiagram( xDiagram ) ); - for( sal_Int32 i=0; i<aAxes.getLength(); ++i ) - lcl_addAxisTitle( aAxes[i], aTopLevelContainer, xModel ); + const Sequence< Reference< XAxis > > aAxes( AxisHelper::getAllAxesOfDiagram( xDiagram ) ); + for( Reference< XAxis > const & axis : aAxes ) + lcl_addAxisTitle( axis, aTopLevelContainer, xModel ); // Diagram aTopLevelContainer.push_back( aDiaOID ); @@ -319,9 +319,8 @@ void ImplObjectHierarchy::createAxesTree( aAxes = AxisHelper::getAllAxesOfDiagram( xDiagram ); // Grids Reference< frame::XModel > xChartModel = xChartDoc; - for( sal_Int32 nA=0; nA<aAxes.getLength(); ++nA ) + for( Reference< XAxis > const & xAxis : std::as_const(aAxes) ) { - Reference< XAxis > xAxis( aAxes[nA] ); if(!xAxis.is()) continue; @@ -339,7 +338,7 @@ void ImplObjectHierarchy::createAxesTree( rContainer.emplace_back( ObjectIdentifier::createClassifiedIdentifierForObject( xAxis, xChartModel ) ); // axis title - lcl_addAxisTitle( aAxes[nA], rContainer, xChartModel ); + lcl_addAxisTitle( xAxis, rContainer, xChartModel ); } Reference< beans::XPropertySet > xGridProperties( xAxis->getGridProperties() ); |