summaryrefslogtreecommitdiff
path: root/chart2/source/controller/dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source/controller/dialogs')
-rw-r--r--chart2/source/controller/dialogs/DataBrowserModel.cxx56
-rw-r--r--chart2/source/controller/dialogs/DialogModel.cxx35
-rw-r--r--chart2/source/controller/dialogs/tp_AxisPositions.cxx4
-rw-r--r--chart2/source/controller/dialogs/tp_DataSource.cxx10
4 files changed, 52 insertions, 53 deletions
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;
}
}