summaryrefslogtreecommitdiff
path: root/chart2/source/model/template
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2018-03-03 12:54:07 +0100
committerJulien Nabet <serval2412@yahoo.fr>2018-03-03 19:20:53 +0100
commitba7191ed0d4da2f5a2ebd2ef40387b26145860f1 (patch)
treee019dbd2dcc947c155e63841c2ec3a53eca427fb /chart2/source/model/template
parent301514183d471cfeb085673eb4563f8c310162b7 (diff)
Use for-range loops in chart2 (part1)
Change-Id: I9310a6dc79d47f9058df8a3b463667389af1b2cb Reviewed-on: https://gerrit.libreoffice.org/50672 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'chart2/source/model/template')
-rw-r--r--chart2/source/model/template/AreaChartTypeTemplate.cxx7
-rw-r--r--chart2/source/model/template/BarChartTypeTemplate.cxx5
-rw-r--r--chart2/source/model/template/DataInterpreter.cxx8
-rw-r--r--chart2/source/model/template/LineChartTypeTemplate.cxx5
-rw-r--r--chart2/source/model/template/NetChartTypeTemplate.cxx5
-rw-r--r--chart2/source/model/template/PieChartTypeTemplate.cxx5
-rw-r--r--chart2/source/model/template/ScatterChartTypeTemplate.cxx5
-rw-r--r--chart2/source/model/template/StockChartTypeTemplate.cxx5
-rw-r--r--chart2/source/model/template/XYDataInterpreter.cxx12
9 files changed, 23 insertions, 34 deletions
diff --git a/chart2/source/model/template/AreaChartTypeTemplate.cxx b/chart2/source/model/template/AreaChartTypeTemplate.cxx
index 6e443c948fe4..131202e082fb 100644
--- a/chart2/source/model/template/AreaChartTypeTemplate.cxx
+++ b/chart2/source/model/template/AreaChartTypeTemplate.cxx
@@ -186,11 +186,10 @@ void SAL_CALL AreaChartTypeTemplate::resetStyles( const Reference< chart2::XDiag
std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
uno::Any aLineStyleAny( drawing::LineStyle_NONE );
- for( std::vector< Reference< chart2::XDataSeries > >::iterator aIt( aSeriesVec.begin());
- aIt != aSeriesVec.end(); ++aIt )
+ for (auto const& series : aSeriesVec)
{
- Reference< beans::XPropertyState > xState( *aIt, uno::UNO_QUERY );
- Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY );
+ Reference< beans::XPropertyState > xState(series, uno::UNO_QUERY);
+ Reference< beans::XPropertySet > xProp(series, uno::UNO_QUERY);
if( xState.is() &&
xProp.is() &&
xProp->getPropertyValue( "BorderStyle") == aLineStyleAny )
diff --git a/chart2/source/model/template/BarChartTypeTemplate.cxx b/chart2/source/model/template/BarChartTypeTemplate.cxx
index 3845ae98d039..226bb6b509b5 100644
--- a/chart2/source/model/template/BarChartTypeTemplate.cxx
+++ b/chart2/source/model/template/BarChartTypeTemplate.cxx
@@ -271,10 +271,9 @@ void SAL_CALL BarChartTypeTemplate::resetStyles(
std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
uno::Any aLineStyleAny( drawing::LineStyle_NONE );
- for( std::vector< Reference< chart2::XDataSeries > >::iterator aIt( aSeriesVec.begin());
- aIt != aSeriesVec.end(); ++aIt )
+ for (auto const& series : aSeriesVec)
{
- Reference< beans::XPropertyState > xState( *aIt, uno::UNO_QUERY );
+ Reference< beans::XPropertyState > xState(series, uno::UNO_QUERY);
if( xState.is())
{
if( getDimension() == 3 )
diff --git a/chart2/source/model/template/DataInterpreter.cxx b/chart2/source/model/template/DataInterpreter.cxx
index 445bc3598df7..a29d49afd2c0 100644
--- a/chart2/source/model/template/DataInterpreter.cxx
+++ b/chart2/source/model/template/DataInterpreter.cxx
@@ -102,16 +102,13 @@ InterpretedData SAL_CALL DataInterpreter::interpretDataSource(
}
// create DataSeries
- vector< Reference< data::XLabeledDataSequence > >::const_iterator
- aSequencesVecIt = aSequencesVec.begin();
-
sal_Int32 nSeriesIndex = 0;
vector< Reference< XDataSeries > > aSeriesVec;
aSeriesVec.reserve( aSequencesVec.size());
- for( ;aSequencesVecIt != aSequencesVec.end(); ++aSequencesVecIt, ++nSeriesIndex )
+ for (auto const& elem : aSequencesVec)
{
- Sequence< Reference< data::XLabeledDataSequence > > aNewData( & (*aSequencesVecIt), 1 );
+ Sequence< Reference< data::XLabeledDataSequence > > aNewData( &elem, 1 );
Reference< XDataSeries > xSeries;
if( nSeriesIndex < aSeriesToReUse.getLength())
xSeries.set( aSeriesToReUse[nSeriesIndex] );
@@ -123,6 +120,7 @@ InterpretedData SAL_CALL DataInterpreter::interpretDataSource(
xSink->setData( aNewData );
aSeriesVec.push_back( xSeries );
+ ++nSeriesIndex;
}
Sequence< Sequence< Reference< XDataSeries > > > aSeries(1);
diff --git a/chart2/source/model/template/LineChartTypeTemplate.cxx b/chart2/source/model/template/LineChartTypeTemplate.cxx
index 58adeffc6659..f6b76550b9cc 100644
--- a/chart2/source/model/template/LineChartTypeTemplate.cxx
+++ b/chart2/source/model/template/LineChartTypeTemplate.cxx
@@ -207,14 +207,13 @@ sal_Bool SAL_CALL LineChartTypeTemplate::matchesTemplate(
std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
- for( std::vector< Reference< chart2::XDataSeries > >::const_iterator aIt =
- aSeriesVec.begin(); aIt != aSeriesVec.end(); ++aIt )
+ for (auto const& series : aSeriesVec)
{
try
{
chart2::Symbol aSymbProp;
drawing::LineStyle eLineStyle;
- Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY_THROW );
+ Reference< beans::XPropertySet > xProp(series, uno::UNO_QUERY_THROW);
bool bCurrentHasSymbol = (xProp->getPropertyValue( "Symbol") >>= aSymbProp) &&
(aSymbProp.Style != chart2::SymbolStyle_NONE);
diff --git a/chart2/source/model/template/NetChartTypeTemplate.cxx b/chart2/source/model/template/NetChartTypeTemplate.cxx
index 9cea513a8f8d..b10f0f64299c 100644
--- a/chart2/source/model/template/NetChartTypeTemplate.cxx
+++ b/chart2/source/model/template/NetChartTypeTemplate.cxx
@@ -103,14 +103,13 @@ sal_Bool SAL_CALL NetChartTypeTemplate::matchesTemplate(
std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
- for( std::vector< Reference< chart2::XDataSeries > >::const_iterator aIt =
- aSeriesVec.begin(); aIt != aSeriesVec.end(); ++aIt )
+ for (auto const& series : aSeriesVec)
{
try
{
chart2::Symbol aSymbProp;
drawing::LineStyle eLineStyle;
- Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY_THROW );
+ Reference< beans::XPropertySet > xProp(series, uno::UNO_QUERY_THROW);
bool bCurrentHasSymbol = (xProp->getPropertyValue( "Symbol") >>= aSymbProp) &&
(aSymbProp.Style != chart2::SymbolStyle_NONE);
diff --git a/chart2/source/model/template/PieChartTypeTemplate.cxx b/chart2/source/model/template/PieChartTypeTemplate.cxx
index b7b9f109df0c..2ce05a6fa941 100644
--- a/chart2/source/model/template/PieChartTypeTemplate.cxx
+++ b/chart2/source/model/template/PieChartTypeTemplate.cxx
@@ -569,10 +569,9 @@ void SAL_CALL PieChartTypeTemplate::resetStyles( const Reference< chart2::XDiagr
std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
uno::Any aLineStyleAny( drawing::LineStyle_NONE );
- for( std::vector< Reference< chart2::XDataSeries > >::iterator aIt( aSeriesVec.begin());
- aIt != aSeriesVec.end(); ++aIt )
+ for (auto const& series : aSeriesVec)
{
- Reference< beans::XPropertyState > xState( *aIt, uno::UNO_QUERY );
+ Reference< beans::XPropertyState > xState(series, uno::UNO_QUERY);
if( xState.is())
{
xState->setPropertyToDefault( "VaryColorsByPoint");
diff --git a/chart2/source/model/template/ScatterChartTypeTemplate.cxx b/chart2/source/model/template/ScatterChartTypeTemplate.cxx
index 9e1874d82801..d64cbc368e25 100644
--- a/chart2/source/model/template/ScatterChartTypeTemplate.cxx
+++ b/chart2/source/model/template/ScatterChartTypeTemplate.cxx
@@ -239,14 +239,13 @@ sal_Bool SAL_CALL ScatterChartTypeTemplate::matchesTemplate(
std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
- for( std::vector< Reference< chart2::XDataSeries > >::const_iterator aIt =
- aSeriesVec.begin(); aIt != aSeriesVec.end(); ++aIt )
+ for (auto const& series : aSeriesVec)
{
try
{
chart2::Symbol aSymbProp;
drawing::LineStyle eLineStyle;
- Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY_THROW );
+ Reference< beans::XPropertySet > xProp(series, uno::UNO_QUERY_THROW);
bool bCurrentHasSymbol = (xProp->getPropertyValue( "Symbol") >>= aSymbProp) &&
(aSymbProp.Style != chart2::SymbolStyle_NONE);
diff --git a/chart2/source/model/template/StockChartTypeTemplate.cxx b/chart2/source/model/template/StockChartTypeTemplate.cxx
index e53f285c472f..ae65ce7a0f40 100644
--- a/chart2/source/model/template/StockChartTypeTemplate.cxx
+++ b/chart2/source/model/template/StockChartTypeTemplate.cxx
@@ -263,10 +263,9 @@ void SAL_CALL StockChartTypeTemplate::resetStyles(
{
std::vector< Reference< chart2::XDataSeries > > aSeriesVec(
DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
- for( std::vector< Reference< chart2::XDataSeries > >::iterator aIt( aSeriesVec.begin());
- aIt != aSeriesVec.end(); ++aIt )
+ for (auto const& series : aSeriesVec)
{
- Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY );
+ Reference< beans::XPropertySet > xProp(series, uno::UNO_QUERY);
if( xProp.is() )
xProp->setPropertyValue( "AttachedAxisIndex", uno::Any( sal_Int32(0) ) );
}
diff --git a/chart2/source/model/template/XYDataInterpreter.cxx b/chart2/source/model/template/XYDataInterpreter.cxx
index f7d1ec1ca2de..896b9898ebcb 100644
--- a/chart2/source/model/template/XYDataInterpreter.cxx
+++ b/chart2/source/model/template/XYDataInterpreter.cxx
@@ -100,26 +100,23 @@ chart2::InterpretedData SAL_CALL XYDataInterpreter::interpretDataSource(
}
// create DataSeries
- vector< Reference< data::XLabeledDataSequence > >::const_iterator
- aSequencesVecIt = aSequencesVec.begin();
-
- sal_Int32 nSeriesIndex = 0;
vector< Reference< XDataSeries > > aSeriesVec;
aSeriesVec.reserve( aSequencesVec.size());
Reference< data::XLabeledDataSequence > xClonedXValues = xValuesX;
Reference< util::XCloneable > xCloneable( xValuesX, uno::UNO_QUERY );
- for( ;aSequencesVecIt != aSequencesVec.end(); ++aSequencesVecIt, ++nSeriesIndex )
+ sal_Int32 nSeriesIndex = 0;
+ for (auto const& elem : aSequencesVec)
{
vector< Reference< data::XLabeledDataSequence > > aNewData;
- if( aSequencesVecIt != aSequencesVec.begin() && xCloneable.is() )
+ if( nSeriesIndex && xCloneable.is() )
xClonedXValues.set( xCloneable->createClone(), uno::UNO_QUERY );
if( xValuesX.is() )
aNewData.push_back( xClonedXValues );
- aNewData.push_back( *aSequencesVecIt );
+ aNewData.push_back(elem);
Reference< XDataSeries > xSeries;
if( nSeriesIndex < aSeriesToReUse.getLength())
@@ -132,6 +129,7 @@ chart2::InterpretedData SAL_CALL XYDataInterpreter::interpretDataSource(
xSink->setData( comphelper::containerToSequence( aNewData ) );
aSeriesVec.push_back( xSeries );
+ ++nSeriesIndex;
}
Sequence< Sequence< Reference< XDataSeries > > > aSeries(1);