[Libreoffice-commits] core.git: chart2/source
Julien Nabet
serval2412 at yahoo.fr
Sat Mar 3 23:38:38 UTC 2018
chart2/source/tools/InternalDataProvider.cxx | 24 ++---
chart2/source/tools/NameContainer.cxx | 6 -
chart2/source/tools/ReferenceSizeProvider.cxx | 14 +--
chart2/source/tools/RegressionCurveHelper.cxx | 10 --
chart2/source/tools/RelativeSizeHelper.cxx | 7 -
chart2/source/tools/WrappedPropertySet.cxx | 18 +---
chart2/source/view/axes/MinimumAndMaximumSupplier.cxx | 52 +++++------
chart2/source/view/axes/Tickmarks.cxx | 13 --
chart2/source/view/axes/VAxisBase.cxx | 15 +--
chart2/source/view/axes/VCartesianAxis.cxx | 46 ++++------
chart2/source/view/axes/VCartesianCoordinateSystem.cxx | 20 +---
chart2/source/view/axes/VCartesianGrid.cxx | 27 +++---
chart2/source/view/axes/VCoordinateSystem.cxx | 40 +++------
chart2/source/view/axes/VPolarCoordinateSystem.cxx | 20 +---
chart2/source/view/axes/VPolarGrid.cxx | 19 +---
chart2/source/view/charttypes/GL3DBarChart.cxx | 24 ++---
chart2/source/view/charttypes/PieChart.cxx | 37 +++-----
chart2/source/view/charttypes/VSeriesPlotter.cxx | 75 +++++------------
chart2/source/view/inc/MinimumAndMaximumSupplier.hxx | 3
chart2/source/view/main/ChartView.cxx | 49 ++++-------
chart2/source/view/main/DummyXShape.cxx | 33 +++----
chart2/source/view/main/PropertyMapper.cxx | 36 +++-----
22 files changed, 235 insertions(+), 353 deletions(-)
New commits:
commit e108a31a8fee09c2fa4031e45e45ed73bbdb7c6f
Author: Julien Nabet <serval2412 at yahoo.fr>
Date: Sat Mar 3 23:26:43 2018 +0100
Modernize a bit chart2
mainly by using for range loops
+ by using empty() instead of comparing begin and iterator
or use size to test that a container has at least 2 elements
Change-Id: I81f168d8c36a8b4195fbb0c1aee4983dab25d22c
Reviewed-on: https://gerrit.libreoffice.org/50705
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx
index f272c9feb9ce..7338822ff17b 100644
--- a/chart2/source/tools/InternalDataProvider.cxx
+++ b/chart2/source/tools/InternalDataProvider.cxx
@@ -661,12 +661,9 @@ namespace
sal_Int32 lcl_getInnerLevelCount( const vector< vector< uno::Any > >& rLabels )
{
sal_Int32 nCount = 1;//minimum is 1!
- vector< vector< uno::Any > >::const_iterator aLevelIt( rLabels.begin() );
- vector< vector< uno::Any > >::const_iterator aLevelEnd( rLabels.end() );
- for( ;aLevelIt!=aLevelEnd; ++aLevelIt )
+ for (auto const& elemLabel : rLabels)
{
- const vector< uno::Any >& rCurrentLevelLabels = *aLevelIt;
- nCount = std::max<sal_Int32>( rCurrentLevelLabels.size(), nCount );
+ nCount = std::max<sal_Int32>( elemLabel.size(), nCount );
}
return nCount;
}
@@ -751,12 +748,10 @@ Reference< chart2::data::XDataSource > SAL_CALL InternalDataProvider::createData
}
//add left over data sequences to result
- std::vector< Reference< chart2::data::XLabeledDataSequence > >::iterator aIt(aDataVec.begin());
- const std::vector< Reference< chart2::data::XLabeledDataSequence > >::const_iterator aEndIt(aDataVec.end());
- for( ;aIt!=aEndIt; ++aIt)
+ for (auto const& elem : aDataVec)
{
- if( aIt->is() )
- aResultLSeqVec.push_back( *aIt );
+ if( elem.is() )
+ aResultLSeqVec.push_back(elem);
}
return new DataSource( comphelper::containerToSequence(aResultLSeqVec) );
@@ -1355,13 +1350,12 @@ Sequence< double > SAL_CALL InternalDataProvider::getDateCategories()
vector< vector< uno::Any > > aCategories( m_bDataInColumns ? m_aInternalData.getComplexRowLabels() : m_aInternalData.getComplexColumnLabels());
sal_Int32 nCount = aCategories.size();
Sequence< double > aDoubles( nCount );
- vector< vector< uno::Any > >::iterator aIt( aCategories.begin() );
- vector< vector< uno::Any > >::const_iterator aEnd( aCategories.end() );
- for(sal_Int32 nN=0; nN<nCount && aIt!=aEnd; ++nN, ++aIt )
+ sal_Int32 nN=0;
+ for (auto const& category : aCategories)
{
- if( !( !aIt->empty() && ((*aIt)[0]>>=fValue) ) )
+ if( !( !category.empty() && (category[0]>>=fValue) ) )
fValue = fNan;
- aDoubles[nN]=fValue;
+ aDoubles[nN++]=fValue;
}
return aDoubles;
}
diff --git a/chart2/source/tools/NameContainer.cxx b/chart2/source/tools/NameContainer.cxx
index 3f08fa0a9fb3..cbf128cd4f23 100644
--- a/chart2/source/tools/NameContainer.cxx
+++ b/chart2/source/tools/NameContainer.cxx
@@ -112,8 +112,10 @@ Sequence< OUString > SAL_CALL NameContainer::getElementNames()
sal_Int32 nCount = m_aMap.size();
Sequence< OUString > aSeq(nCount);
sal_Int32 nN = 0;
- for( tContentMap::iterator aIter = m_aMap.begin(); aIter != m_aMap.end() && nN < nCount; ++aIter, ++nN )
- aSeq[nN]=aIter->first;
+ for (auto const& elem : m_aMap)
+ {
+ aSeq[nN++]=elem.first;
+ }
return aSeq;
}
diff --git a/chart2/source/tools/ReferenceSizeProvider.cxx b/chart2/source/tools/ReferenceSizeProvider.cxx
index b083f1e09323..37bbb1c441ae 100644
--- a/chart2/source/tools/ReferenceSizeProvider.cxx
+++ b/chart2/source/tools/ReferenceSizeProvider.cxx
@@ -97,10 +97,9 @@ void ReferenceSizeProvider::setValuesAtAllDataSeries()
std::vector< Reference< XDataSeries > > aSeries(
DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
- for( std::vector< Reference< XDataSeries > >::const_iterator aIt( aSeries.begin());
- aIt != aSeries.end(); ++aIt )
+ for (auto const& elem : aSeries)
{
- Reference< beans::XPropertySet > xSeriesProp( *aIt, uno::UNO_QUERY );
+ Reference< beans::XPropertySet > xSeriesProp(elem, uno::UNO_QUERY );
if( xSeriesProp.is())
{
// data points
@@ -111,7 +110,7 @@ void ReferenceSizeProvider::setValuesAtAllDataSeries()
{
for( sal_Int32 i=0; i< aPointIndexes.getLength(); ++i )
setValuesAtPropertySet(
- (*aIt)->getDataPointByIndex( aPointIndexes[i] ) );
+ elem->getDataPointByIndex( aPointIndexes[i] ) );
}
}
catch (const uno::Exception& ex)
@@ -268,10 +267,9 @@ ReferenceSizeProvider::AutoResizeState ReferenceSizeProvider::getAutoResizeState
std::vector< Reference< XDataSeries > > aSeries(
DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
- for( std::vector< Reference< XDataSeries > >::const_iterator aIt( aSeries.begin());
- aIt != aSeries.end(); ++aIt )
+ for (auto const& elem : aSeries)
{
- Reference< beans::XPropertySet > xSeriesProp( *aIt, uno::UNO_QUERY );
+ Reference< beans::XPropertySet > xSeriesProp(elem, uno::UNO_QUERY);
if( xSeriesProp.is())
{
getAutoResizeFromPropSet( xSeriesProp, eResult );
@@ -287,7 +285,7 @@ ReferenceSizeProvider::AutoResizeState ReferenceSizeProvider::getAutoResizeState
for( sal_Int32 i=0; i< aPointIndexes.getLength(); ++i )
{
getAutoResizeFromPropSet(
- (*aIt)->getDataPointByIndex( aPointIndexes[i] ), eResult );
+ elem->getDataPointByIndex( aPointIndexes[i] ), eResult );
if( eResult == AUTO_RESIZE_AMBIGUOUS )
return eResult;
}
diff --git a/chart2/source/tools/RegressionCurveHelper.cxx b/chart2/source/tools/RegressionCurveHelper.cxx
index 53b12b6397e9..6d397b1449bb 100644
--- a/chart2/source/tools/RegressionCurveHelper.cxx
+++ b/chart2/source/tools/RegressionCurveHelper.cxx
@@ -412,10 +412,9 @@ bool RegressionCurveHelper::removeAllExceptMeanValueLine(
}
}
- for( std::vector< uno::Reference< chart2::XRegressionCurve > >::const_iterator aIt = aCurvesToDelete.begin();
- aIt != aCurvesToDelete.end(); ++aIt )
+ for (auto const& curveToDelete : aCurvesToDelete)
{
- xRegCnt->removeRegressionCurve( *aIt );
+ xRegCnt->removeRegressionCurve(curveToDelete);
bRemovedSomething = true;
}
}
@@ -686,10 +685,9 @@ std::vector< Reference< chart2::XRegressionCurve > >
{
std::vector< Reference< chart2::XRegressionCurve > > aResult;
std::vector< Reference< chart2::XDataSeries > > aSeries( DiagramHelper::getDataSeriesFromDiagram( xDiagram ));
- for( std::vector< Reference< chart2::XDataSeries > >::iterator aIt( aSeries.begin());
- aIt != aSeries.end(); ++aIt )
+ for (auto const& elem : aSeries)
{
- Reference< chart2::XRegressionCurveContainer > xContainer( *aIt, uno::UNO_QUERY );
+ Reference< chart2::XRegressionCurveContainer > xContainer(elem, uno::UNO_QUERY);
if(xContainer.is())
{
uno::Sequence< uno::Reference< chart2::XRegressionCurve > > aCurves(xContainer->getRegressionCurves());
diff --git a/chart2/source/tools/RelativeSizeHelper.cxx b/chart2/source/tools/RelativeSizeHelper.cxx
index 7f9c63e94e86..1f155cb383df 100644
--- a/chart2/source/tools/RelativeSizeHelper.cxx
+++ b/chart2/source/tools/RelativeSizeHelper.cxx
@@ -63,15 +63,14 @@ void RelativeSizeHelper::adaptFontSizes(
aProperties.emplace_back("CharHeightAsian" );
aProperties.emplace_back("CharHeightComplex" );
- for( vector< OUString >::const_iterator aIt = aProperties.begin();
- aIt != aProperties.end(); ++aIt )
+ for (auto const& property : aProperties)
{
try
{
- if( xTargetProperties->getPropertyValue( *aIt ) >>= fFontHeight )
+ if( xTargetProperties->getPropertyValue(property) >>= fFontHeight )
{
xTargetProperties->setPropertyValue(
- *aIt,
+ property,
Any( static_cast< float >(
calculate( fFontHeight, rOldReferenceSize, rNewReferenceSize ))));
}
diff --git a/chart2/source/tools/WrappedPropertySet.cxx b/chart2/source/tools/WrappedPropertySet.cxx
index f7855233c5a7..a3a52817070c 100644
--- a/chart2/source/tools/WrappedPropertySet.cxx
+++ b/chart2/source/tools/WrappedPropertySet.cxx
@@ -53,10 +53,9 @@ void WrappedPropertySet::clearWrappedPropertySet()
//delete all wrapped properties
if(m_pWrappedPropertyMap)
{
- for( tWrappedPropertyMap::iterator aIt = m_pWrappedPropertyMap->begin()
- ; aIt!= m_pWrappedPropertyMap->end(); ++aIt )
+ for (auto const& elem : *m_pWrappedPropertyMap)
{
- const WrappedProperty* pWrappedProperty = (*aIt).second;
+ const WrappedProperty* pWrappedProperty = elem.second;
DELETEZ(pWrappedProperty);
}
}
@@ -426,26 +425,25 @@ tWrappedPropertyMap& WrappedPropertySet::getWrappedPropertyMap()
std::vector< WrappedProperty* > aPropList( createWrappedProperties() );
p = new tWrappedPropertyMap;
- for( std::vector< WrappedProperty* >::const_iterator aIt = aPropList.begin(); aIt!=aPropList.end(); ++aIt )
+ for (auto const& elem : aPropList)
{
- WrappedProperty* pProperty = *aIt;
- if(pProperty)
+ if(elem)
{
- sal_Int32 nHandle = getInfoHelper().getHandleByName( pProperty->getOuterName() );
+ sal_Int32 nHandle = getInfoHelper().getHandleByName( elem->getOuterName() );
if( nHandle == -1 )
{
OSL_FAIL( "missing property in property list" );
- delete pProperty;//we are owner or the created WrappedProperties
+ delete elem;//we are owner or the created WrappedProperties
}
else if( p->find( nHandle ) != p->end() )
{
//duplicate Wrapped property
OSL_FAIL( "duplicate Wrapped property" );
- delete pProperty;//we are owner or the created WrappedProperties
+ delete elem;//we are owner or the created WrappedProperties
}
else
- (*p)[ nHandle ] = pProperty;
+ (*p)[ nHandle ] = elem;
}
}
diff --git a/chart2/source/view/axes/MinimumAndMaximumSupplier.cxx b/chart2/source/view/axes/MinimumAndMaximumSupplier.cxx
index 7edca0d166b4..861407840db1 100644
--- a/chart2/source/view/axes/MinimumAndMaximumSupplier.cxx
+++ b/chart2/source/view/axes/MinimumAndMaximumSupplier.cxx
@@ -50,9 +50,9 @@ double MergedMinimumAndMaximumSupplier::getMinimumX()
{
double fGlobalExtremum;
::rtl::math::setInf(&fGlobalExtremum, false);
- for( MinimumAndMaximumSupplierSet::iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
+ for (auto const& elem : m_aMinimumAndMaximumSupplierList)
{
- double fLocalExtremum = (*aIt)->getMinimumX();
+ double fLocalExtremum = elem->getMinimumX();
if(fLocalExtremum<fGlobalExtremum)
fGlobalExtremum=fLocalExtremum;
}
@@ -65,9 +65,9 @@ double MergedMinimumAndMaximumSupplier::getMaximumX()
{
double fGlobalExtremum;
::rtl::math::setInf(&fGlobalExtremum, true);
- for( MinimumAndMaximumSupplierSet::iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
+ for (auto const& elem : m_aMinimumAndMaximumSupplierList)
{
- double fLocalExtremum = (*aIt)->getMaximumX();
+ double fLocalExtremum = elem->getMaximumX();
if(fLocalExtremum>fGlobalExtremum)
fGlobalExtremum=fLocalExtremum;
}
@@ -80,9 +80,9 @@ double MergedMinimumAndMaximumSupplier::getMinimumYInRange( double fMinimumX, do
{
double fGlobalExtremum;
::rtl::math::setInf(&fGlobalExtremum, false);
- for( MinimumAndMaximumSupplierSet::iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
+ for (auto const& elem : m_aMinimumAndMaximumSupplierList)
{
- double fLocalExtremum = (*aIt)->getMinimumYInRange( fMinimumX, fMaximumX, nAxisIndex );
+ double fLocalExtremum = elem->getMinimumYInRange( fMinimumX, fMaximumX, nAxisIndex );
if(fLocalExtremum<fGlobalExtremum)
fGlobalExtremum=fLocalExtremum;
}
@@ -95,9 +95,9 @@ double MergedMinimumAndMaximumSupplier::getMaximumYInRange( double fMinimumX, do
{
double fGlobalExtremum;
::rtl::math::setInf(&fGlobalExtremum, true);
- for( MinimumAndMaximumSupplierSet::iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
+ for (auto const& elem : m_aMinimumAndMaximumSupplierList)
{
- double fLocalExtremum = (*aIt)->getMaximumYInRange( fMinimumX, fMaximumX, nAxisIndex );
+ double fLocalExtremum = elem->getMaximumYInRange( fMinimumX, fMaximumX, nAxisIndex );
if(fLocalExtremum>fGlobalExtremum)
fGlobalExtremum=fLocalExtremum;
}
@@ -110,9 +110,9 @@ double MergedMinimumAndMaximumSupplier::getMinimumZ()
{
double fGlobalExtremum;
::rtl::math::setInf(&fGlobalExtremum, false);
- for( MinimumAndMaximumSupplierSet::iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
+ for (auto const& elem : m_aMinimumAndMaximumSupplierList)
{
- double fLocalExtremum = (*aIt)->getMinimumZ();
+ double fLocalExtremum = elem->getMinimumZ();
if(fLocalExtremum<fGlobalExtremum)
fGlobalExtremum=fLocalExtremum;
}
@@ -125,9 +125,9 @@ double MergedMinimumAndMaximumSupplier::getMaximumZ()
{
double fGlobalExtremum;
::rtl::math::setInf(&fGlobalExtremum, true);
- for( MinimumAndMaximumSupplierSet::iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
+ for (auto const& elem : m_aMinimumAndMaximumSupplierList)
{
- double fLocalExtremum = (*aIt)->getMaximumZ();
+ double fLocalExtremum = elem->getMaximumZ();
if(fLocalExtremum>fGlobalExtremum)
fGlobalExtremum=fLocalExtremum;
}
@@ -139,8 +139,8 @@ double MergedMinimumAndMaximumSupplier::getMaximumZ()
bool MergedMinimumAndMaximumSupplier::isExpandBorderToIncrementRhythm( sal_Int32 nDimensionIndex )
{
// only return true, if *all* suppliers want to scale to the main tick marks
- for( MinimumAndMaximumSupplierSet::iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
- if( !(*aIt)->isExpandBorderToIncrementRhythm( nDimensionIndex ) )
+ for (auto const& elem : m_aMinimumAndMaximumSupplierList)
+ if( !elem->isExpandBorderToIncrementRhythm( nDimensionIndex ) )
return false;
return true;
}
@@ -148,8 +148,8 @@ bool MergedMinimumAndMaximumSupplier::isExpandBorderToIncrementRhythm( sal_Int32
bool MergedMinimumAndMaximumSupplier::isExpandIfValuesCloseToBorder( sal_Int32 nDimensionIndex )
{
// only return true, if *all* suppliers want to expand the range
- for( MinimumAndMaximumSupplierSet::iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
- if( !(*aIt)->isExpandIfValuesCloseToBorder( nDimensionIndex ) )
+ for (auto const& elem : m_aMinimumAndMaximumSupplierList)
+ if( !elem->isExpandIfValuesCloseToBorder( nDimensionIndex ) )
return false;
return true;
}
@@ -157,8 +157,8 @@ bool MergedMinimumAndMaximumSupplier::isExpandIfValuesCloseToBorder( sal_Int32 n
bool MergedMinimumAndMaximumSupplier::isExpandWideValuesToZero( sal_Int32 nDimensionIndex )
{
// already return true, if at least one supplier wants to expand the range
- for( MinimumAndMaximumSupplierSet::iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
- if( (*aIt)->isExpandWideValuesToZero( nDimensionIndex ) )
+ for (auto const& elem : m_aMinimumAndMaximumSupplierList)
+ if( elem->isExpandWideValuesToZero( nDimensionIndex ) )
return true;
return false;
}
@@ -166,8 +166,8 @@ bool MergedMinimumAndMaximumSupplier::isExpandWideValuesToZero( sal_Int32 nDimen
bool MergedMinimumAndMaximumSupplier::isExpandNarrowValuesTowardZero( sal_Int32 nDimensionIndex )
{
// already return true, if at least one supplier wants to expand the range
- for( MinimumAndMaximumSupplierSet::iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
- if( (*aIt)->isExpandNarrowValuesTowardZero( nDimensionIndex ) )
+ for (auto const& elem : m_aMinimumAndMaximumSupplierList)
+ if( elem->isExpandNarrowValuesTowardZero( nDimensionIndex ) )
return true;
return false;
}
@@ -175,8 +175,8 @@ bool MergedMinimumAndMaximumSupplier::isExpandNarrowValuesTowardZero( sal_Int32
bool MergedMinimumAndMaximumSupplier::isSeparateStackingForDifferentSigns( sal_Int32 nDimensionIndex )
{
// should not be called
- for( MinimumAndMaximumSupplierSet::iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
- if( (*aIt)->isSeparateStackingForDifferentSigns( nDimensionIndex ) )
+ for (auto const& elem : m_aMinimumAndMaximumSupplierList)
+ if( elem->isSeparateStackingForDifferentSigns( nDimensionIndex ) )
return true;
return false;
}
@@ -189,9 +189,9 @@ void MergedMinimumAndMaximumSupplier::clearMinimumAndMaximumSupplierList()
long MergedMinimumAndMaximumSupplier::calculateTimeResolutionOnXAxis()
{
long nRet = css::chart::TimeUnit::YEAR;
- for( MinimumAndMaximumSupplierSet::iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
+ for (auto const& elem : m_aMinimumAndMaximumSupplierList)
{
- long nCurrent = (*aIt)->calculateTimeResolutionOnXAxis();
+ long nCurrent = elem->calculateTimeResolutionOnXAxis();
if(nRet>nCurrent)
nRet=nCurrent;
}
@@ -200,8 +200,8 @@ long MergedMinimumAndMaximumSupplier::calculateTimeResolutionOnXAxis()
void MergedMinimumAndMaximumSupplier::setTimeResolutionOnXAxis( long nTimeResolution, const Date& rNullDate )
{
- for( MinimumAndMaximumSupplierSet::iterator aIt = begin(), aEnd = end(); aIt != aEnd; ++aIt )
- (*aIt)->setTimeResolutionOnXAxis( nTimeResolution, rNullDate );
+ for (auto const& elem : m_aMinimumAndMaximumSupplierList)
+ elem->setTimeResolutionOnXAxis( nTimeResolution, rNullDate );
}
} //namespace chart
diff --git a/chart2/source/view/axes/Tickmarks.cxx b/chart2/source/view/axes/Tickmarks.cxx
index 3d6d25a044bf..05dfe08520d0 100644
--- a/chart2/source/view/axes/Tickmarks.cxx
+++ b/chart2/source/view/axes/Tickmarks.cxx
@@ -310,17 +310,12 @@ void TickFactory2D::createPointSequenceForAxisMainLine( drawing::PointSequenceSe
void TickFactory2D::updateScreenValues( TickInfoArraysType& rAllTickInfos ) const
{
//get the transformed screen values for all tickmarks in rAllTickInfos
- TickInfoArraysType::iterator aDepthIter = rAllTickInfos.begin();
- const TickInfoArraysType::const_iterator aDepthEnd = rAllTickInfos.end();
- for( ; aDepthIter != aDepthEnd; ++aDepthIter )
+ for (auto & tickInfos : rAllTickInfos)
{
- TickInfoArrayType::iterator aTickIter = (*aDepthIter).begin();
- const TickInfoArrayType::const_iterator aTickEnd = (*aDepthIter).end();
- for( ; aTickIter != aTickEnd; ++aTickIter )
+ for (auto & tickInfo : tickInfos)
{
- TickInfo& rTickInfo = (*aTickIter);
- rTickInfo.aTickScreenPosition =
- getTickScreenPosition2D( rTickInfo.fScaledTickValue );
+ tickInfo.aTickScreenPosition =
+ getTickScreenPosition2D(tickInfo.fScaledTickValue);
}
}
}
diff --git a/chart2/source/view/axes/VAxisBase.cxx b/chart2/source/view/axes/VAxisBase.cxx
index bfda7c01277f..288db6f92860 100644
--- a/chart2/source/view/axes/VAxisBase.cxx
+++ b/chart2/source/view/axes/VAxisBase.cxx
@@ -208,19 +208,14 @@ void VAxisBase::removeTextShapesFromTicks()
{
if( m_xTextTarget.is() )
{
- TickInfoArraysType::iterator aDepthIter = m_aAllTickInfos.begin();
- const TickInfoArraysType::const_iterator aDepthEnd = m_aAllTickInfos.end();
- for( ; aDepthIter != aDepthEnd; ++aDepthIter )
+ for (auto & tickInfos : m_aAllTickInfos)
{
- TickInfoArrayType::iterator aTickIter = (*aDepthIter).begin();
- const TickInfoArrayType::const_iterator aTickEnd = (*aDepthIter).end();
- for( ; aTickIter != aTickEnd; ++aTickIter )
+ for (auto & tickInfo : tickInfos)
{
- TickInfo& rTickInfo = (*aTickIter);
- if(rTickInfo.xTextShape.is())
+ if(tickInfo.xTextShape.is())
{
- m_xTextTarget->remove(rTickInfo.xTextShape);
- rTickInfo.xTextShape = nullptr;
+ m_xTextTarget->remove(tickInfo.xTextShape);
+ tickInfo.xTextShape = nullptr;
}
}
}
diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx
index adaa91b83bf3..9dab35cc16ed 100644
--- a/chart2/source/view/axes/VCartesianAxis.cxx
+++ b/chart2/source/view/axes/VCartesianAxis.cxx
@@ -532,14 +532,11 @@ void VCartesianAxis::createAllTickInfosFromComplexCategories( TickInfoArraysType
continue;
sal_Int32 nCatIndex = 0;
- std::vector<ComplexCategory>::const_iterator aIt = pComplexCategories->begin();
- std::vector<ComplexCategory>::const_iterator aEnd = pComplexCategories->end();
- for(;aIt!=aEnd;++aIt)
+ for (auto const& complexCategory : *pComplexCategories)
{
TickInfo aTickInfo(nullptr);
- ComplexCategory aCat(*aIt);
- sal_Int32 nCount = aCat.Count;
+ sal_Int32 nCount = complexCategory.Count;
if( nCatIndex + 1.0 + nCount >= m_aScale.Maximum )
{
nCount = static_cast<sal_Int32>(m_aScale.Maximum - 1.0 - nCatIndex);
@@ -548,7 +545,7 @@ void VCartesianAxis::createAllTickInfosFromComplexCategories( TickInfoArraysType
}
aTickInfo.fScaledTickValue = nCatIndex + 1.0 + nCount/2.0;
aTickInfo.nFactorForLimitedTextWidth = nCount;
- aTickInfo.aText = aCat.Text;
+ aTickInfo.aText = complexCategory.Text;
aTickInfoVector.push_back(aTickInfo);
nCatIndex += nCount;
if( nCatIndex + 1.0 >= m_aScale.Maximum )
@@ -570,15 +567,12 @@ void VCartesianAxis::createAllTickInfosFromComplexCategories( TickInfoArraysType
sal_Int32 nCatIndex = 0;
if (pComplexCategories)
{
- std::vector<ComplexCategory>::const_iterator aIt = pComplexCategories->begin();
- std::vector<ComplexCategory>::const_iterator aEnd = pComplexCategories->end();
- for(;aIt!=aEnd;++aIt)
+ for (auto const& complexCategory : *pComplexCategories)
{
TickInfo aTickInfo(nullptr);
- ComplexCategory aCat(*aIt);
aTickInfo.fScaledTickValue = nCatIndex + 1.0;
aTickInfoVector.push_back(aTickInfo);
- nCatIndex += aCat.Count;
+ nCatIndex += complexCategory.Count;
if( nCatIndex + 1.0 > m_aScale.Maximum )
break;
}
@@ -1642,20 +1636,16 @@ void VCartesianAxis::updatePositions()
//update positions of all existing text shapes
pTickFactory2D->updateScreenValues( m_aAllTickInfos );
- TickInfoArraysType::iterator aDepthIter = m_aAllTickInfos.begin();
- const TickInfoArraysType::const_iterator aDepthEnd = m_aAllTickInfos.end();
- for( sal_Int32 nDepth=0; aDepthIter != aDepthEnd; ++aDepthIter, nDepth++ )
+ sal_Int32 nDepth=0;
+ for (auto const& tickInfos : m_aAllTickInfos)
{
- TickInfoArrayType::iterator aTickIter = aDepthIter->begin();
- const TickInfoArrayType::const_iterator aTickEnd = aDepthIter->end();
- for( ; aTickIter != aTickEnd; ++aTickIter )
+ for (auto const& tickInfo : tickInfos)
{
- TickInfo& rTickInfo = (*aTickIter);
- Reference< drawing::XShape > xShape2DText( rTickInfo.xTextShape );
+ Reference< drawing::XShape > xShape2DText(tickInfo.xTextShape);
if( xShape2DText.is() )
{
B2DVector aTextToTickDistance( pTickFactory2D->getDistanceAxisTickToText( m_aAxisProperties, true ) );
- B2DVector aTickScreenPos2D( rTickInfo.aTickScreenPosition );
+ B2DVector aTickScreenPos2D(tickInfo.aTickScreenPosition);
aTickScreenPos2D += aTextToTickDistance;
awt::Point aAnchorScreenPosition2D(
static_cast<sal_Int32>(aTickScreenPos2D.getX())
@@ -1694,6 +1684,7 @@ void VCartesianAxis::updatePositions()
, m_aAxisProperties.maLabelAlignment.meAlignment, fRotationAngleDegree, m_aAxisProperties.m_bComplexCategories );
}
}
+ ++nDepth;
}
doStaggeringOfLabels( m_aAxisLabelProperties, pTickFactory2D );
@@ -1704,12 +1695,10 @@ void VCartesianAxis::createTickMarkLineShapes( TickInfoArrayType& rTickInfos, co
sal_Int32 nPointCount = rTickInfos.size();
drawing::PointSequenceSequence aPoints(2*nPointCount);
- TickInfoArrayType::const_iterator aTickIter = rTickInfos.begin();
- const TickInfoArrayType::const_iterator aTickEnd = rTickInfos.end();
sal_Int32 nN = 0;
- for( ; aTickIter != aTickEnd; ++aTickIter )
+ for (auto const& tickInfo : rTickInfos)
{
- if( !(*aTickIter).bPaintIt )
+ if( !tickInfo.bPaintIt )
continue;
bool bTicksAtLabels = ( m_aAxisProperties.m_eTickmarkPos != css::chart::ChartAxisMarkPosition_AT_AXIS );
@@ -1718,11 +1707,11 @@ void VCartesianAxis::createTickMarkLineShapes( TickInfoArrayType& rTickInfos, co
fInnerDirectionSign *= -1.0;
bTicksAtLabels = bTicksAtLabels || bOnlyAtLabels;
//add ticks at labels:
- rTickFactory2D.addPointSequenceForTickLine( aPoints, nN++, (*aTickIter).fScaledTickValue
+ rTickFactory2D.addPointSequenceForTickLine( aPoints, nN++, tickInfo.fScaledTickValue
, fInnerDirectionSign , rTickmarkProperties, bTicksAtLabels );
//add ticks at axis (without labels):
if( !bOnlyAtLabels && m_aAxisProperties.m_eTickmarkPos == css::chart::ChartAxisMarkPosition_AT_LABELS_AND_AXIS )
- rTickFactory2D.addPointSequenceForTickLine( aPoints, nN++, (*aTickIter).fScaledTickValue
+ rTickFactory2D.addPointSequenceForTickLine( aPoints, nN++, tickInfo.fScaledTickValue
, m_aAxisProperties.maLabelAlignment.mfInnerTickDirection, rTickmarkProperties, !bTicksAtLabels );
}
aPoints.realloc(nN);
@@ -1789,10 +1778,11 @@ void VCartesianAxis::createShapes()
}
TickInfoArraysType& rAllTickInfos = m_aScale.ShiftedCategoryPosition ? aUnshiftedTickInfos : m_aAllTickInfos;
+ if (rAllTickInfos.empty())
+ return;
+
TickInfoArraysType::iterator aDepthIter = rAllTickInfos.begin();
const TickInfoArraysType::const_iterator aDepthEnd = rAllTickInfos.end();
- if(aDepthIter == aDepthEnd)//no tickmarks at all
- return;
sal_Int32 nTickmarkPropertiesCount = m_aAxisProperties.m_aTickmarkPropertiesList.size();
for( sal_Int32 nDepth=0; aDepthIter != aDepthEnd && nDepth < nTickmarkPropertiesCount; ++aDepthIter, nDepth++ )
diff --git a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx
index 8e777f351bf1..dbfbe9c9c046 100644
--- a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx
+++ b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx
@@ -165,15 +165,13 @@ void VCartesianCoordinateSystem::initVAxisInList()
sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
bool bSwapXAndY = getPropertySwapXAndYAxis();
- tVAxisMap::iterator aIt( m_aAxisMap.begin() );
- tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
- for( ; aIt != aEnd; ++aIt )
+ for (auto const& elem : m_aAxisMap)
{
- VAxisBase* pVAxis = aIt->second.get();
+ VAxisBase* pVAxis = elem.second.get();
if( pVAxis )
{
- sal_Int32 nDimensionIndex = aIt->first.first;
- sal_Int32 nAxisIndex = aIt->first.second;
+ sal_Int32 nDimensionIndex = elem.first.first;
+ sal_Int32 nAxisIndex = elem.first.second;
pVAxis->setExplicitScaleAndIncrement( getExplicitScale( nDimensionIndex, nAxisIndex ), getExplicitIncrement( nDimensionIndex, nAxisIndex ) );
pVAxis->initPlotter(m_xLogicTargetForAxes,m_xFinalTarget,m_xShapeFactory
, createCIDForAxis( nDimensionIndex, nAxisIndex ) );
@@ -192,15 +190,13 @@ void VCartesianCoordinateSystem::updateScalesAndIncrementsOnAxes()
sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
bool bSwapXAndY = getPropertySwapXAndYAxis();
- tVAxisMap::iterator aIt( m_aAxisMap.begin() );
- tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
- for( ; aIt != aEnd; ++aIt )
+ for (auto const& elem : m_aAxisMap)
{
- VAxisBase* pVAxis = aIt->second.get();
+ VAxisBase* pVAxis = elem.second.get();
if( pVAxis )
{
- sal_Int32 nDimensionIndex = aIt->first.first;
- sal_Int32 nAxisIndex = aIt->first.second;
+ sal_Int32 nDimensionIndex = elem.first.first;
+ sal_Int32 nAxisIndex = elem.first.second;
pVAxis->setExplicitScaleAndIncrement( getExplicitScale( nDimensionIndex, nAxisIndex ), getExplicitIncrement( nDimensionIndex, nAxisIndex ) );
if(nDimensionCount==2)
pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
diff --git a/chart2/source/view/axes/VCartesianGrid.cxx b/chart2/source/view/axes/VCartesianGrid.cxx
index 5bb47b0ac011..dcd679c814fd 100644
--- a/chart2/source/view/axes/VCartesianGrid.cxx
+++ b/chart2/source/view/axes/VCartesianGrid.cxx
@@ -214,12 +214,13 @@ void VCartesianGrid::createShapes()
aTickFactory.getAllTicks( aAllTickInfos );
//create tick mark line shapes
- TickInfoArraysType::iterator aDepthIter = aAllTickInfos.begin();
- const TickInfoArraysType::const_iterator aDepthEnd = aAllTickInfos.end();
- if(aDepthIter == aDepthEnd)//no tickmarks at all
+ if(aAllTickInfos.empty())//no tickmarks at all
return;
+ TickInfoArraysType::iterator aDepthIter = aAllTickInfos.begin();
+ const TickInfoArraysType::const_iterator aDepthEnd = aAllTickInfos.end();
+
sal_Int32 nLinePropertiesCount = aLinePropertiesList.size();
for( sal_Int32 nDepth=0
; aDepthIter != aDepthEnd && nDepth < nLinePropertiesCount
@@ -246,14 +247,12 @@ void VCartesianGrid::createShapes()
sal_Int32 nPointCount = (*aDepthIter).size();
drawing::PointSequenceSequence aPoints(nPointCount);
- TickInfoArrayType::const_iterator aTickIter = (*aDepthIter).begin();
- const TickInfoArrayType::const_iterator aTickEnd = (*aDepthIter).end();
sal_Int32 nRealPointCount = 0;
- for( ; aTickIter != aTickEnd; ++aTickIter )
+ for (auto const& tick : *aDepthIter)
{
- if( !(*aTickIter).bPaintIt )
+ if( !tick.bPaintIt )
continue;
- aGridLinePoints.update( (*aTickIter).fScaledTickValue );
+ aGridLinePoints.update( tick.fScaledTickValue );
addLine2D( aPoints, nRealPointCount, aGridLinePoints, m_pPosHelper->getTransformationScaledLogicToScene() );
nRealPointCount++;
}
@@ -284,18 +283,20 @@ void VCartesianGrid::createShapes()
aPoints.SequenceY.realloc(nPointCount);
aPoints.SequenceZ.realloc(nPointCount);
- TickInfoArrayType::const_iterator aTickIter = (*aDepthIter).begin();
- const TickInfoArrayType::const_iterator aTickEnd = (*aDepthIter).end();
sal_Int32 nRealPointCount = 0;
sal_Int32 nPolyIndex = 0;
- for( ; aTickIter != aTickEnd; ++aTickIter, ++nPolyIndex )
+ for (auto const& tick : *aDepthIter)
{
- if( !(*aTickIter).bPaintIt )
+ if( !tick.bPaintIt )
+ {
+ ++nPolyIndex;
continue;
+ }
- aGridLinePoints.update( (*aTickIter).fScaledTickValue );
+ aGridLinePoints.update( tick.fScaledTickValue );
addLine3D( aPoints, nPolyIndex, aGridLinePoints, m_pPosHelper->getTransformationScaledLogicToScene() );
nRealPointCount+=3;
+ ++nPolyIndex;
}
aPoints.SequenceX.realloc(nRealPointCount);
aPoints.SequenceY.realloc(nRealPointCount);
diff --git a/chart2/source/view/axes/VCoordinateSystem.cxx b/chart2/source/view/axes/VCoordinateSystem.cxx
index 2b0830d0dfee..0f103c5b4cfe 100644
--- a/chart2/source/view/axes/VCoordinateSystem.cxx
+++ b/chart2/source/view/axes/VCoordinateSystem.cxx
@@ -134,11 +134,9 @@ void VCoordinateSystem::setTransformationSceneToScreen(
m_aMatrixSceneToScreen = rMatrix;
//correct transformation for axis
- tVAxisMap::iterator aIt( m_aAxisMap.begin() );
- tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
- for( ; aIt != aEnd; ++aIt )
+ for (auto const& elem : m_aAxisMap)
{
- VAxisBase* pVAxis = aIt->second.get();
+ VAxisBase* pVAxis = elem.second.get();
if( pVAxis )
{
if(pVAxis->getDimensionCount()==2)
@@ -325,13 +323,11 @@ OUString VCoordinateSystem::createCIDForGrid( sal_Int32 nDimensionIndex, sal_Int
sal_Int32 VCoordinateSystem::getMaximumAxisIndexByDimension( sal_Int32 nDimensionIndex ) const
{
sal_Int32 nRet = 0;
- tFullExplicitScaleMap::const_iterator aIt = m_aSecondaryExplicitScales.begin();
- tFullExplicitScaleMap::const_iterator aEnd = m_aSecondaryExplicitScales.end();
- for(; aIt!=aEnd; ++aIt)
+ for (auto const& elem : m_aSecondaryExplicitScales)
{
- if(aIt->first.first==nDimensionIndex)
+ if(elem.first.first==nDimensionIndex)
{
- sal_Int32 nLocalIdx = aIt->first.second;
+ sal_Int32 nLocalIdx = elem.first.second;
if( nRet < nLocalIdx )
nRet = nLocalIdx;
}
@@ -449,11 +445,9 @@ void VCoordinateSystem::set3DWallPositions( CuboidPlanePosition eLeftWallPos, Cu
void VCoordinateSystem::createMaximumAxesLabels()
{
- tVAxisMap::iterator aIt( m_aAxisMap.begin() );
- tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
- for( ; aIt != aEnd; ++aIt )
+ for (auto const& elem : m_aAxisMap)
{
- VAxisBase* pVAxis = aIt->second.get();
+ VAxisBase* pVAxis = elem.second.get();
if( pVAxis )
{
if(pVAxis->getDimensionCount()==2)
@@ -464,11 +458,9 @@ void VCoordinateSystem::createMaximumAxesLabels()
}
void VCoordinateSystem::createAxesLabels()
{
- tVAxisMap::iterator aIt( m_aAxisMap.begin() );
- tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
- for( ; aIt != aEnd; ++aIt )
+ for (auto const& elem : m_aAxisMap)
{
- VAxisBase* pVAxis = aIt->second.get();
+ VAxisBase* pVAxis = elem.second.get();
if( pVAxis )
{
if(pVAxis->getDimensionCount()==2)
@@ -480,11 +472,9 @@ void VCoordinateSystem::createAxesLabels()
void VCoordinateSystem::updatePositions()
{
- tVAxisMap::iterator aIt( m_aAxisMap.begin() );
- tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
- for( ; aIt != aEnd; ++aIt )
+ for (auto const& elem : m_aAxisMap)
{
- VAxisBase* pVAxis = aIt->second.get();
+ VAxisBase* pVAxis = elem.second.get();
if( pVAxis )
{
if(pVAxis->getDimensionCount()==2)
@@ -496,17 +486,15 @@ void VCoordinateSystem::updatePositions()
void VCoordinateSystem::createAxesShapes()
{
- tVAxisMap::iterator aIt( m_aAxisMap.begin() );
- tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
- for( ; aIt != aEnd; ++aIt )
+ for (auto const& elem : m_aAxisMap)
{
- VAxisBase* pVAxis = aIt->second.get();
+ VAxisBase* pVAxis = elem.second.get();
if( pVAxis )
{
if(pVAxis->getDimensionCount()==2)
pVAxis->setTransformationSceneToScreen( m_aMatrixSceneToScreen );
- tFullAxisIndex aFullAxisIndex = aIt->first;
+ tFullAxisIndex aFullAxisIndex = elem.first;
if( aFullAxisIndex.second == 0 )
{
if( aFullAxisIndex.first == 0 )
diff --git a/chart2/source/view/axes/VPolarCoordinateSystem.cxx b/chart2/source/view/axes/VPolarCoordinateSystem.cxx
index 49eb8763cd12..823e591319fb 100644
--- a/chart2/source/view/axes/VPolarCoordinateSystem.cxx
+++ b/chart2/source/view/axes/VPolarCoordinateSystem.cxx
@@ -107,15 +107,13 @@ void VPolarCoordinateSystem::initVAxisInList()
sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
bool bSwapXAndY = getPropertySwapXAndYAxis();
- tVAxisMap::iterator aIt( m_aAxisMap.begin() );
- tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
- for( ; aIt != aEnd; ++aIt )
+ for (auto const& elem : m_aAxisMap)
{
- VAxisBase* pVAxis = aIt->second.get();
+ VAxisBase* pVAxis = elem.second.get();
if( pVAxis )
{
- sal_Int32 nDimensionIndex = aIt->first.first;
- sal_Int32 nAxisIndex = aIt->first.second;
+ sal_Int32 nDimensionIndex = elem.first.first;
+ sal_Int32 nAxisIndex = elem.first.second;
pVAxis->setExplicitScaleAndIncrement( getExplicitScale( nDimensionIndex, nAxisIndex ), getExplicitIncrement(nDimensionIndex, nAxisIndex) );
pVAxis->initPlotter(m_xLogicTargetForAxes,m_xFinalTarget,m_xShapeFactory
, createCIDForAxis( nDimensionIndex, nAxisIndex ) );
@@ -137,15 +135,13 @@ void VPolarCoordinateSystem::updateScalesAndIncrementsOnAxes()
sal_Int32 nDimensionCount = m_xCooSysModel->getDimension();
bool bSwapXAndY = getPropertySwapXAndYAxis();
- tVAxisMap::iterator aIt( m_aAxisMap.begin() );
- tVAxisMap::const_iterator aEnd( m_aAxisMap.end() );
- for( ; aIt != aEnd; ++aIt )
+ for (auto const& elem : m_aAxisMap)
{
- VAxisBase* pVAxis = aIt->second.get();
+ VAxisBase* pVAxis = elem.second.get();
if( pVAxis )
{
- sal_Int32 nDimensionIndex = aIt->first.first;
- sal_Int32 nAxisIndex = aIt->first.second;
+ sal_Int32 nDimensionIndex = elem.first.first;
+ sal_Int32 nAxisIndex = elem.first.second;
pVAxis->setExplicitScaleAndIncrement( getExplicitScale( nDimensionIndex, nAxisIndex ), getExplicitIncrement(nDimensionIndex, nAxisIndex) );
VPolarAxis* pVPolarAxis = dynamic_cast< VPolarAxis* >( pVAxis );
if( pVPolarAxis )
diff --git a/chart2/source/view/axes/VPolarGrid.cxx b/chart2/source/view/axes/VPolarGrid.cxx
index edf30d95b832..ac829ad92b0d 100644
--- a/chart2/source/view/axes/VPolarGrid.cxx
+++ b/chart2/source/view/axes/VPolarGrid.cxx
@@ -116,23 +116,19 @@ void VPolarGrid::create2DAngleGrid( const Reference< drawing::XShapes >& xLogicT
double fLogicOuterRadius = m_pPosHelper->getOuterLogicRadius();
sal_Int32 nLinePropertiesCount = rLinePropertiesList.size();
- TickInfoArraysType::iterator aDepthIter = rAngleTickInfos.begin();
if(nLinePropertiesCount)
{
double fLogicZ = 1.0;//as defined
sal_Int32 nDepth=0;
//create axis main lines
drawing::PointSequenceSequence aAllPoints;
- TickInfoArrayType::iterator aTickIter = (*aDepthIter).begin();
- const TickInfoArrayType::const_iterator aTickEnd = (*aDepthIter).end();
- for( ; aTickIter != aTickEnd; ++aTickIter )
+ for (auto const& tick : rAngleTickInfos[0])
{
- TickInfo& rTickInfo = *aTickIter;
- if( !rTickInfo.bPaintIt )
+ if( !tick.bPaintIt )
continue;
//xxxxx rTickInfo.updateUnscaledValue( xInverseScaling );
- double fLogicAngle = rTickInfo.getUnscaledTickValue();
+ double fLogicAngle = tick.getUnscaledTickValue();
drawing::PointSequenceSequence aPoints(1);
aPoints[0].realloc(2);
@@ -190,16 +186,13 @@ void VPolarGrid::create2DRadiusGrid( const Reference< drawing::XShapes >& xLogic
//create axis main lines
drawing::PointSequenceSequence aAllPoints;
- TickInfoArrayType::iterator aTickIter = (*aDepthIter).begin();
- const TickInfoArrayType::const_iterator aTickEnd = (*aDepthIter).end();
- for( ; aTickIter != aTickEnd; ++aTickIter )
+ for (auto const& tick : *aDepthIter)
{
- TickInfo& rTickInfo = *aTickIter;
- if( !rTickInfo.bPaintIt )
+ if( !tick.bPaintIt )
continue;
//xxxxx rTickInfo.updateUnscaledValue( xInverseRadiusScaling );
- double fLogicRadius = rTickInfo.getUnscaledTickValue();
+ double fLogicRadius = tick.getUnscaledTickValue();
double const fLogicZ = 1.0;//as defined
drawing::PointSequenceSequence aPoints(1);
diff --git a/chart2/source/view/charttypes/GL3DBarChart.cxx b/chart2/source/view/charttypes/GL3DBarChart.cxx
index 946b28d05261..bd34a611e75c 100644
--- a/chart2/source/view/charttypes/GL3DBarChart.cxx
+++ b/chart2/source/view/charttypes/GL3DBarChart.cxx
@@ -1283,7 +1283,7 @@ void GL3DBarChart::updateClickEvent()
nMaxXCoord = std::max(nMaxXCoord, 0.55f + nTextWidth);
}
getNeighborBarID(mnSelectBarId, nBarIdArray);
- for (std::deque<float>::iterator it = aList.begin();it != aList.end();++it)
+ for (auto const& elem : aList)
{
if (nIdex + 1 < aList.size())
{
@@ -1305,7 +1305,7 @@ void GL3DBarChart::updateClickEvent()
nMaxHight = std::max(nMaxHight, nYCoordStart + 0.07f);
nTextWidth = addScreenTextShape(aTitle, glm::vec2(nXCoordStart, 0.99f - nYCoordStart), 0.07f, false, glm::vec4(0.0f, 1.0f, 1.0f, 0.5f));
nMinXCoord = std::min(nMinXCoord, nXCoordStart - nTextWidth);
- aBarValue = OUString::number(*it);
+ aBarValue = OUString::number(elem);
nTextWidth = addScreenTextShape(aBarValue, glm::vec2(nXCoordStart, 0.99f - nYCoordStart), 0.07f, true, glm::vec4(0.0f, 1.0f, 1.0f, 0.5f));
nMaxXCoord = std::max(nMaxXCoord, nXCoordStart + nTextWidth);
}
@@ -1337,18 +1337,17 @@ void GL3DBarChart::calcDistance(std::vector<sal_uInt32> & rVectorNearest)
glm::mat4 aView = mpRenderer->GetViewMatrix();
glm::mat4 aScale = mpRenderer->GetGlobalScaleMatrix();
glm::mat4 aMVP = aProjection * aView * aScale;
- std::map<sal_uInt32, const BarInformation>::iterator it;
- for(it= maBarMap.begin(); it!= maBarMap.end(); ++it)
+ for (auto const& elem : maBarMap)
{
- sal_uInt32 nId = it->first;
+ sal_uInt32 nId = elem.first;
if(i < SHOW_VALUE_COUNT)
{
rVectorNearest.push_back(nId);
i++;
}
- maDistanceMap[nId] = calcScrollDistance(aMVP, glm::vec3(it->second.maPos.x + BAR_SIZE_X / 2.0f,
- it->second.maPos.y + BAR_SIZE_Y / 2.0f,
- it->second.maPos.z));
+ maDistanceMap[nId] = calcScrollDistance(aMVP, glm::vec3(elem.second.maPos.x + BAR_SIZE_X / 2.0f,
+ elem.second.maPos.y + BAR_SIZE_Y / 2.0f,
+ elem.second.maPos.z));
}
}
@@ -1403,18 +1402,17 @@ void GL3DBarChart::getNearestBars(std::vector<sal_uInt32> &rVectorNearest)
{
calcDistance(rVectorNearest);
initDistanceHeap(rVectorNearest);
- std::map<sal_uInt32, float>::iterator it;
int i = 0;
- for(it= maDistanceMap.begin(); it!= maDistanceMap.end(); ++it)
+ for (auto const& elem : maDistanceMap)
{
- i++;
+ ++i;
if(i <= SHOW_VALUE_COUNT)
continue;
- float nDistance = it->second;
+ float nDistance = elem.second;
float nHeaphead = maDistanceMap[rVectorNearest[0]];
if(nDistance < nHeaphead)
{
- rVectorNearest[0] = it->first;
+ rVectorNearest[0] = elem.first;
keepHeap(rVectorNearest, 0);
}
}
diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx
index 2d1ebd9fc634..f3f1ef3e1cf9 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -850,10 +850,8 @@ bool PieChart::PieLabelInfo::moveAwayFrom( const PieChart::PieLabelInfo* pFix, c
void PieChart::resetLabelPositionsToPreviousState()
{
- std::vector< PieLabelInfo >::iterator aIt = m_aLabelInfoList.begin();
- std::vector< PieLabelInfo >::const_iterator aEnd = m_aLabelInfoList.end();
- for( ;aIt!=aEnd; ++aIt )
- aIt->xLabelGroupShape->setPosition(aIt->aPreviousPosition);
+ for (auto const& labelInfo : m_aLabelInfoList)
+ labelInfo.xLabelGroupShape->setPosition(labelInfo.aPreviousPosition);
}
bool PieChart::detectLabelOverlapsAndMove( const awt::Size& rPageSize )
@@ -1107,15 +1105,15 @@ void PieChart::rearrangeLabelToAvoidOverlapIfRequested( const awt::Size& rPageSi
///pie and donut charts after text label creation;
///it tries to rearrange labels only when the label placement type is
///`AVOID_OVERLAP`.
-
+ // no need to do anything when we only have one label
+ if (m_aLabelInfoList.size() < 2)
+ return;
///check whether there are any labels that should be moved
- std::vector< PieLabelInfo >::iterator aIt1 = m_aLabelInfoList.begin();
- std::vector< PieLabelInfo >::const_iterator aEnd = m_aLabelInfoList.end();
bool bMoveableFound = false;
- for( ;aIt1!=aEnd; ++aIt1 )
+ for (auto const& labelInfo : m_aLabelInfoList)
{
- if(aIt1->bMovementAllowed)
+ if(labelInfo.bMovementAllowed)
{
bMoveableFound = true;
break;
@@ -1129,10 +1127,9 @@ void PieChart::rearrangeLabelToAvoidOverlapIfRequested( const awt::Size& rPageSi
return;
///initialize next and previous member of `PieLabelInfo` objects
- aIt1 = m_aLabelInfoList.begin();
+ auto aIt1 = m_aLabelInfoList.begin();
+ auto aEnd = m_aLabelInfoList.end();
std::vector< PieLabelInfo >::iterator aIt2 = aIt1;
- if( aIt1==aEnd )//no need to do anything when we only have one label
- return;
aIt1->pPrevious = &(*(m_aLabelInfoList.rbegin()));
++aIt2;
for( ;aIt2!=aEnd; ++aIt1, ++aIt2 )
@@ -1150,18 +1147,16 @@ void PieChart::rearrangeLabelToAvoidOverlapIfRequested( const awt::Size& rPageSi
nMaxIterations--;
///create connection lines for the moved labels
- aEnd = m_aLabelInfoList.end();
VLineProperties aVLineProperties;
- for( aIt1 = m_aLabelInfoList.begin(); aIt1!=aEnd; ++aIt1 )
+ for (auto const& labelInfo : m_aLabelInfoList)
{
- PieLabelInfo& rInfo( *aIt1 );
- if( rInfo.bMoved )
+ if( labelInfo.bMoved )
{
- sal_Int32 nX1 = rInfo.aFirstPosition.getX();
- sal_Int32 nY1 = rInfo.aFirstPosition.getY();
+ sal_Int32 nX1 = labelInfo.aFirstPosition.getX();
+ sal_Int32 nY1 = labelInfo.aFirstPosition.getY();
sal_Int32 nX2 = nX1;
sal_Int32 nY2 = nY1;
- ::basegfx::B2IRectangle aRect( lcl_getRect( rInfo.xLabelGroupShape ) );
+ ::basegfx::B2IRectangle aRect( lcl_getRect( labelInfo.xLabelGroupShape ) );
if( nX1 < aRect.getMinX() )
nX2 = aRect.getMinX();
else if( nX1 > aRect.getMaxX() )
@@ -1184,7 +1179,7 @@ void PieChart::rearrangeLabelToAvoidOverlapIfRequested( const awt::Size& rPageSi
aPoints[0][1].X = nX2;
aPoints[0][1].Y = nY2;
- uno::Reference< beans::XPropertySet > xProp( rInfo.xTextShape, uno::UNO_QUERY);
+ uno::Reference< beans::XPropertySet > xProp( labelInfo.xTextShape, uno::UNO_QUERY);
if( xProp.is() )
{
sal_Int32 nColor = 0;
@@ -1192,7 +1187,7 @@ void PieChart::rearrangeLabelToAvoidOverlapIfRequested( const awt::Size& rPageSi
if( nColor != -1 )//automatic font color does not work for lines -> fallback to black
aVLineProperties.Color <<= nColor;
}
- m_pShapeFactory->createLine2D( rInfo.xTextTarget, aPoints, &aVLineProperties );
+ m_pShapeFactory->createLine2D( labelInfo.xTextTarget, aPoints, &aVLineProperties );
}
}
}
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx
index 23cad6ada542..0ebb883ca9a0 100644
--- a/chart2/source/view/charttypes/VSeriesPlotter.cxx
+++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx
@@ -167,13 +167,10 @@ VSeriesPlotter::~VSeriesPlotter()
}
m_aZSlots.clear();
- tSecondaryPosHelperMap::iterator aPosIt = m_aSecondaryPosHelperMap.begin();
- while( aPosIt != m_aSecondaryPosHelperMap.end() )
+ for (auto const& elem : m_aSecondaryPosHelperMap)
{
- PlottingPositionHelper* pPosHelper = aPosIt->second;
+ PlottingPositionHelper* pPosHelper = elem.second;
delete pPosHelper;
-
- ++aPosIt;
}
m_aSecondaryPosHelperMap.clear();
@@ -1456,12 +1453,12 @@ long VSeriesPlotter::calculateTimeResolutionOnXAxis()
if( m_pExplicitCategoriesProvider )
{
const std::vector< double >& rDateCategories = m_pExplicitCategoriesProvider->getDateCategories();
- std::vector< double >::const_iterator aIt = rDateCategories.begin(), aEnd = rDateCategories.end();
Date aNullDate(30,12,1899);
if( m_apNumberFormatterWrapper.get() )
aNullDate = m_apNumberFormatterWrapper->getNullDate();
- if( aIt!=aEnd )
+ if( !rDateCategories.empty() )
{
+ std::vector< double >::const_iterator aIt = rDateCategories.begin(), aEnd = rDateCategories.end();
Date aPrevious(aNullDate); aPrevious.AddDays(rtl::math::approxFloor(*aIt));
++aIt;
for(;aIt!=aEnd;++aIt)
@@ -1621,16 +1618,12 @@ void VSeriesPlotter::getMinimumAndMaximiumX( double& rfMinimum, double& rfMaximu
::rtl::math::setInf(&rfMinimum, false);
::rtl::math::setInf(&rfMaximum, true);
- std::vector< std::vector< VDataSeriesGroup > >::const_iterator aZSlotIter = m_aZSlots.begin();
- const std::vector< std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
- for( ; aZSlotIter != aZSlotEnd; ++aZSlotIter )
+ for (auto const& ZSlot : m_aZSlots)
{
- std::vector< VDataSeriesGroup >::const_iterator aXSlotIter = aZSlotIter->begin();
- const std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
- for( ; aXSlotIter != aXSlotEnd; ++aXSlotIter )
+ for (auto const& XSlot : ZSlot)
{
double fLocalMinimum, fLocalMaximum;
- aXSlotIter->getMinimumAndMaximiumX( fLocalMinimum, fLocalMaximum );
+ XSlot.getMinimumAndMaximiumX( fLocalMinimum, fLocalMaximum );
if( !::rtl::math::isNan(fLocalMinimum) && fLocalMinimum< rfMinimum )
rfMinimum = fLocalMinimum;
if( !::rtl::math::isNan(fLocalMaximum) && fLocalMaximum> rfMaximum )
@@ -1648,16 +1641,12 @@ void VSeriesPlotter::getMinimumAndMaximiumYInContinuousXRange( double& rfMinY, d
::rtl::math::setInf(&rfMinY, false);
::rtl::math::setInf(&rfMaxY, true);
- std::vector< std::vector< VDataSeriesGroup > >::const_iterator aZSlotIter = m_aZSlots.begin();
- const std::vector< std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
- for( ; aZSlotIter != aZSlotEnd; ++aZSlotIter )
+ for (auto const& ZSlot : m_aZSlots)
{
- std::vector< VDataSeriesGroup >::const_iterator aXSlotIter = aZSlotIter->begin();
- const std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
- for( ; aXSlotIter != aXSlotEnd; ++aXSlotIter )
+ for (auto const& XSlot : ZSlot)
{
double fLocalMinimum, fLocalMaximum;
- aXSlotIter->getMinimumAndMaximiumYInContinuousXRange( fLocalMinimum, fLocalMaximum, fMinX, fMaxX, nAxisIndex );
+ XSlot.getMinimumAndMaximiumYInContinuousXRange( fLocalMinimum, fLocalMaximum, fMinX, fMaxX, nAxisIndex );
if( !::rtl::math::isNan(fLocalMinimum) && fLocalMinimum< rfMinY )
rfMinY = fLocalMinimum;
if( !::rtl::math::isNan(fLocalMaximum) && fLocalMaximum> rfMaxY )
@@ -1674,17 +1663,11 @@ sal_Int32 VSeriesPlotter::getPointCount() const
{
sal_Int32 nRet = 0;
- std::vector< std::vector< VDataSeriesGroup > >::const_iterator aZSlotIter = m_aZSlots.begin();
- const std::vector< std::vector< VDataSeriesGroup > >::const_iterator aZSlotEnd = m_aZSlots.end();
-
- for( ; aZSlotIter != aZSlotEnd; ++aZSlotIter )
+ for (auto const& ZSlot : m_aZSlots)
{
- std::vector< VDataSeriesGroup >::const_iterator aXSlotIter = aZSlotIter->begin();
- const std::vector< VDataSeriesGroup >::const_iterator aXSlotEnd = aZSlotIter->end();
-
- for( ; aXSlotIter != aXSlotEnd; ++aXSlotIter )
+ for (auto const& XSlot : ZSlot)
{
- sal_Int32 nPointCount = aXSlotIter->getPointCount();
+ sal_Int32 nPointCount = XSlot.getPointCount();
if( nPointCount>nRet )
nRet = nPointCount;
}
@@ -1732,10 +1715,8 @@ sal_Int32 VDataSeriesGroup::getAttachedAxisIndexForFirstSeries() const
{
sal_Int32 nRet = 0;
- std::vector<VDataSeries*>::const_iterator aSeriesIter = m_aSeriesVector.begin();
-
- if (aSeriesIter != m_aSeriesVector.end())
- nRet = (*aSeriesIter)->getAttachedAxisIndex();
+ if (!m_aSeriesVector.empty())
+ nRet = m_aSeriesVector[0]->getAttachedAxisIndex();
return nRet;
}
@@ -1858,10 +1839,9 @@ private:
double fX = it.first;
const SeriesMinMaxType& rSeries = *it.second;
- SeriesMinMaxType::const_iterator itSeries = rSeries.begin(), itSeriesEnd = rSeries.end();
- for (; itSeries != itSeriesEnd; ++itSeries)
+ for (auto const& series : rSeries)
{
- double fYMin = itSeries->second.first, fYMax = itSeries->second.second;
+ double fYMin = series.second.first, fYMax = series.second.second;
TotalStoreType::iterator itr = aStore.find(fX);
if (itr == aStore.end())
// New min-max pair for give X value.
@@ -2116,15 +2096,11 @@ VDataSeries* VSeriesPlotter::getFirstSeries() const
{
for (std::vector<VDataSeriesGroup> const & rGroup : m_aZSlots)
{
- std::vector<VDataSeriesGroup>::const_iterator aXSlotIter = rGroup.begin();
- const std::vector<VDataSeriesGroup>::const_iterator aXSlotEnd = rGroup.end();
-
- if (aXSlotIter != aXSlotEnd)
+ if (!rGroup.empty())
{
- VDataSeriesGroup aSeriesGroup(*aXSlotIter);
- if (aSeriesGroup.m_aSeriesVector.size())
+ if (!rGroup[0].m_aSeriesVector.empty())
{
- VDataSeries* pSeries = aSeriesGroup.m_aSeriesVector[0];
+ VDataSeries* pSeries = rGroup[0].m_aSeriesVector[0];
if (pSeries)
return pSeries;
}
@@ -2154,15 +2130,12 @@ uno::Sequence< OUString > VSeriesPlotter::getSeriesNames() const
if( m_xChartTypeModel.is() )
aRole = m_xChartTypeModel->getRoleOfSequenceForSeriesLabel();
- for (std::vector<VDataSeriesGroup> const & rGroup : m_aZSlots)
+ for (auto const& rGroup : m_aZSlots)
{
- std::vector<VDataSeriesGroup>::const_iterator aXSlotIter = rGroup.begin();
- const std::vector<VDataSeriesGroup>::const_iterator aXSlotEnd = rGroup.end();
-
- if (aXSlotIter != aXSlotEnd)
+ if (!rGroup.empty())
{
- VDataSeriesGroup aSeriesGroup(*aXSlotIter);
- if (aSeriesGroup.m_aSeriesVector.size())
+ VDataSeriesGroup aSeriesGroup(rGroup[0]);
+ if (!aSeriesGroup.m_aSeriesVector.empty())
{
VDataSeries* pSeries = aSeriesGroup.m_aSeriesVector[0];
uno::Reference< XDataSeries > xSeries( pSeries ? pSeries->getModel() : nullptr );
diff --git a/chart2/source/view/inc/MinimumAndMaximumSupplier.hxx b/chart2/source/view/inc/MinimumAndMaximumSupplier.hxx
index cfe78acfa329..b256f1b919fd 100644
--- a/chart2/source/view/inc/MinimumAndMaximumSupplier.hxx
+++ b/chart2/source/view/inc/MinimumAndMaximumSupplier.hxx
@@ -85,9 +85,6 @@ public:
private:
typedef std::set< MinimumAndMaximumSupplier* > MinimumAndMaximumSupplierSet;
MinimumAndMaximumSupplierSet m_aMinimumAndMaximumSupplierList;
-
- MinimumAndMaximumSupplierSet::iterator begin() { return m_aMinimumAndMaximumSupplierList.begin(); }
- MinimumAndMaximumSupplierSet::iterator end() { return m_aMinimumAndMaximumSupplierList.end(); }
};
} //namespace chart
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 80b728103902..e0cd2c6af05b 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -218,14 +218,13 @@ std::vector< VCoordinateSystem* > AxisUsage::getCoordinateSystems( sal_Int32 nDi
{
std::vector< VCoordinateSystem* > aRet;
- tCoordinateSystemMap::const_iterator aIter;
- for( aIter = aCoordinateSystems.begin(); aIter!=aCoordinateSystems.end();++aIter )
+ for (auto const& coordinateSystem : aCoordinateSystems)
{
- if( aIter->second.first != nDimensionIndex )
+ if( coordinateSystem.second.first != nDimensionIndex )
continue;
- if( aIter->second.second != nAxisIndex )
+ if( coordinateSystem.second.second != nAxisIndex )
continue;
- aRet.push_back( aIter->first );
+ aRet.push_back( coordinateSystem.first );
}
return aRet;
@@ -705,8 +704,6 @@ void SeriesPlotterContainer::initAxisUsageList(const Date& rNullDate)
}
// Determine the highest axis index of all dimensions.
- std::map< uno::Reference< XAxis >, AxisUsage >::iterator aAxisIter = m_aAxisUsageList.begin();
- const std::map< uno::Reference< XAxis >, AxisUsage >::const_iterator aAxisEndIter = m_aAxisUsageList.end();
m_nMaxAxisIndex = 0;
for (VCoordinateSystem* pVCooSys : m_rVCooSysList)
{
@@ -715,9 +712,9 @@ void SeriesPlotterContainer::initAxisUsageList(const Date& rNullDate)
for (sal_Int32 nDimIndex = 0; nDimIndex < nDimCount; ++nDimIndex)
{
- for (aAxisIter = m_aAxisUsageList.begin(); aAxisIter != aAxisEndIter; ++aAxisIter)
+ for (auto & axisUsage : m_aAxisUsageList)
{
- sal_Int32 nLocalMax = aAxisIter->second.getMaxAxisIndexForDimension(nDimIndex);
+ sal_Int32 nLocalMax = axisUsage.second.getMaxAxisIndexForDimension(nDimIndex);
if (m_nMaxAxisIndex < nLocalMax)
m_nMaxAxisIndex = nLocalMax;
}
@@ -799,16 +796,13 @@ void SeriesPlotterContainer::doAutoScaling( ChartModel& rChartModel )
// We need these two containers populated to do auto-scaling. Bail out.
return;
- std::map< uno::Reference< XAxis >, AxisUsage >::iterator aAxisIter = m_aAxisUsageList.begin();
- const std::map< uno::Reference< XAxis >, AxisUsage >::const_iterator aAxisEndIter = m_aAxisUsageList.end();
-
//iterate over the main scales first than secondary axis
for (sal_Int32 nAxisIndex = 0; nAxisIndex <= m_nMaxAxisIndex; ++nAxisIndex)
{
// - first do autoscale for all x and z scales (because they are treated independent)
- for( aAxisIter = m_aAxisUsageList.begin(); aAxisIter != aAxisEndIter; ++aAxisIter )
+ for (auto & axisUsage : m_aAxisUsageList)
{
- AxisUsage& rAxisUsage = (*aAxisIter).second;
+ AxisUsage& rAxisUsage = axisUsage.second;
rAxisUsage.prepareAutomaticAxisScaling(rAxisUsage.aAutoScaling, 0, nAxisIndex);
rAxisUsage.prepareAutomaticAxisScaling(rAxisUsage.aAutoScaling, 2, nAxisIndex);
@@ -822,9 +816,9 @@ void SeriesPlotterContainer::doAutoScaling( ChartModel& rChartModel )
}
// - second do autoscale for the dependent y scales (the coordinate systems are prepared with x and z scales already )
- for( aAxisIter = m_aAxisUsageList.begin(); aAxisIter != aAxisEndIter; ++aAxisIter )
+ for (auto & axisUsage : m_aAxisUsageList)
{
- AxisUsage& rAxisUsage = (*aAxisIter).second;
+ AxisUsage& rAxisUsage = axisUsage.second;
rAxisUsage.prepareAutomaticAxisScaling(rAxisUsage.aAutoScaling, 1, nAxisIndex);
@@ -843,15 +837,11 @@ void SeriesPlotterContainer::doAutoScaling( ChartModel& rChartModel )
void SeriesPlotterContainer::AdaptScaleOfYAxisWithoutAttachedSeries( ChartModel& rModel )
{
//issue #i80518#
-
- std::map< uno::Reference< XAxis >, AxisUsage >::iterator aAxisIter = m_aAxisUsageList.begin();
- const std::map< uno::Reference< XAxis >, AxisUsage >::const_iterator aAxisEndIter = m_aAxisUsageList.end();
-
for( sal_Int32 nAxisIndex=0; nAxisIndex<=m_nMaxAxisIndex; nAxisIndex++ )
{
- for( aAxisIter = m_aAxisUsageList.begin(); aAxisIter != aAxisEndIter; ++aAxisIter )
+ for (auto & axisUsage : m_aAxisUsageList)
{
- AxisUsage& rAxisUsage = (*aAxisIter).second;
+ AxisUsage& rAxisUsage = axisUsage.second;
std::vector< VCoordinateSystem* > aVCooSysList_Y = rAxisUsage.getCoordinateSystems( 1, nAxisIndex );
if( aVCooSysList_Y.empty() )
continue;
@@ -864,10 +854,9 @@ void SeriesPlotterContainer::AdaptScaleOfYAxisWithoutAttachedSeries( ChartModel&
sal_Int32 nAttachedAxisIndex = -1;
{
std::vector< Reference< XDataSeries > > aSeriesVector( DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
- std::vector< Reference< XDataSeries > >::const_iterator aIter = aSeriesVector.begin();
- for( ; aIter != aSeriesVector.end(); ++aIter )
+ for (auto const& series : aSeriesVector)
{
- sal_Int32 nCurrentIndex = DataSeriesHelper::getAttachedAxisIndex( *aIter );
+ sal_Int32 nCurrentIndex = DataSeriesHelper::getAttachedAxisIndex(series);
if( nAxisIndex == nCurrentIndex )
{
bSeriesAttachedToThisAxis = true;
@@ -945,9 +934,9 @@ void SeriesPlotterContainer::AdaptScaleOfYAxisWithoutAttachedSeries( ChartModel&
//correct origin for y main axis (the origin is where the other main axis crosses)
sal_Int32 nAxisIndex=0;
sal_Int32 nDimensionIndex=1;
- for( aAxisIter = m_aAxisUsageList.begin(); aAxisIter != aAxisEndIter; ++aAxisIter )
+ for (auto & axisUsage : m_aAxisUsageList)
{
- AxisUsage& rAxisUsage = (*aAxisIter).second;
+ AxisUsage& rAxisUsage = axisUsage.second;
std::vector< VCoordinateSystem* > aVCooSysList = rAxisUsage.getCoordinateSystems(nDimensionIndex,nAxisIndex);
size_t nC;
for( nC=0; nC < aVCooSysList.size(); nC++)
@@ -1247,11 +1236,9 @@ void ChartView::impl_deleteCoordinateSystems()
//delete all coordinate systems
std::vector< VCoordinateSystem* > aVectorToDeleteObjects;
std::swap( aVectorToDeleteObjects, m_aVCooSysList );//#i109770#
- std::vector< VCoordinateSystem* >::const_iterator aIter = aVectorToDeleteObjects.begin();
- const std::vector< VCoordinateSystem* >::const_iterator aEnd = aVectorToDeleteObjects.end();
- for( ; aIter != aEnd; ++aIter )
+ for (auto const& elem : aVectorToDeleteObjects)
{
- delete *aIter;
+ delete elem;
}
aVectorToDeleteObjects.clear();
}
diff --git a/chart2/source/view/main/DummyXShape.cxx b/chart2/source/view/main/DummyXShape.cxx
index 99752858c93d..c9f9ac6e0bd8 100644
--- a/chart2/source/view/main/DummyXShape.cxx
+++ b/chart2/source/view/main/DummyXShape.cxx
@@ -117,14 +117,13 @@ uno::Sequence< beans::Property > SAL_CALL DummyPropertySetInfo::getProperties()
uno::Sequence< beans::Property > aRet(mrProperties.size());
size_t i = 0;
- for(std::map<OUString, uno::Any>::const_iterator itr = mrProperties.begin(),
- itrEnd = mrProperties.end(); itr != itrEnd; ++itr, ++i)
+ for (auto const& property : mrProperties)
{
beans::Property aProp;
- aProp.Name = itr->first;
- aProp.Type = itr->second.getValueType();
- aRet[i] = aProp;
+ aProp.Name = property.first;
+ aProp.Type = property.second.getValueType();
+ aRet[i++] = aProp;
}
return aRet;
}
@@ -900,10 +899,9 @@ awt::Point SAL_CALL DummyGroup2D::getPosition()
{
long nTop = std::numeric_limits<long>::max();
long nLeft = std::numeric_limits<long>::max();
- for(std::vector<DummyXShape*>::iterator itr = maShapes.begin(),
- itrEnd = maShapes.end(); itr != itrEnd; ++itr)
+ for (auto const& shape : maShapes)
{
- awt::Point aPoint = (*itr)->getPosition();
+ awt::Point aPoint = shape->getPosition();
if(aPoint.X >= 0 && aPoint.Y >= 0)
{
nLeft = std::min<long>(nLeft, aPoint.X);
@@ -920,13 +918,12 @@ awt::Size SAL_CALL DummyGroup2D::getSize()
long nLeft = std::numeric_limits<long>::max();
long nBottom = 0;
long nRight = 0;
- for(std::vector<DummyXShape*>::iterator itr = maShapes.begin(),
- itrEnd = maShapes.end(); itr != itrEnd; ++itr)
+ for (auto const& shape : maShapes)
{
- awt::Point aPoint = (*itr)->getPosition();
+ awt::Point aPoint = shape->getPosition();
nLeft = std::min<long>(nLeft, aPoint.X);
nTop = std::min<long>(nTop, aPoint.Y);
- awt::Size aSize = (*itr)->getSize();
+ awt::Size aSize = shape->getSize();
nRight = std::max<long>(nRight, aPoint.X + aSize.Width);
nBottom = std::max<long>(nBottom, aPoint.Y + aSize.Height);
}
@@ -936,12 +933,11 @@ awt::Size SAL_CALL DummyGroup2D::getSize()
void SAL_CALL DummyGroup2D::setPosition( const awt::Point& rPos )
{
- for(std::vector<DummyXShape*>::const_iterator itr = maShapes.begin(),
- itrEnd = maShapes.end(); itr != itrEnd; ++itr)
+ for (auto const& shape : maShapes)
{
- const awt::Point& rOldPos = (*itr)->getPos();
+ const awt::Point& rOldPos = shape->getPos();
awt::Point aNewPos( rPos.X + rOldPos.X, rPos.Y + rOldPos.Y);
- (*itr)->setPosition(aNewPos);
+ shape->setPosition(aNewPos);
}
}
@@ -1044,10 +1040,9 @@ uno::Any SAL_CALL DummyXShapes::getByIndex(sal_Int32 nIndex)
void DummyXShapes::render()
{
SAL_INFO("chart2.opengl", "render DummyShapes");
- for(std::vector<DummyXShape*>::iterator itr = maShapes.begin(),
- itrEnd = maShapes.end(); itr != itrEnd; ++itr)
+ for (auto const& shape : maShapes)
{
- (*itr)->render();
+ shape->render();
}
}
diff --git a/chart2/source/view/main/PropertyMapper.cxx b/chart2/source/view/main/PropertyMapper.cxx
index 23593449a64f..6241563e82fa 100644
--- a/chart2/source/view/main/PropertyMapper.cxx
+++ b/chart2/source/view/main/PropertyMapper.cxx
@@ -37,11 +37,8 @@ namespace
void lcl_overwriteOrAppendValues(
tPropertyNameValueMap &rMap, const tPropertyNameValueMap& rOverwriteMap )
{
- tPropertyNameValueMap::const_iterator aIt( rOverwriteMap.begin() );
- tPropertyNameValueMap::const_iterator aEnd( rOverwriteMap.end() );
-
- for( ; aIt != aEnd; ++aIt )
- rMap[ aIt->first ] = aIt->second;
+ for (auto const& elem : rOverwriteMap)
+ rMap[ elem.first ] = elem.second;
}
} // anonymous namespace
@@ -77,23 +74,22 @@ void PropertyMapper::getValueMap(
, const uno::Reference< beans::XPropertySet >& xSourceProp
)
{
- tPropertyNameMap::const_iterator aIt( rNameMap.begin() );
- tPropertyNameMap::const_iterator aEnd( rNameMap.end() );
-
uno::Reference< beans::XMultiPropertySet > xMultiPropSet(xSourceProp, uno::UNO_QUERY);
if((false) && xMultiPropSet.is())
{
uno::Sequence< rtl::OUString > aPropSourceNames(rNameMap.size());
uno::Sequence< rtl::OUString > aPropTargetNames(rNameMap.size());
- for(sal_Int32 i = 0; aIt != aEnd; ++aIt, ++i)
+ sal_Int32 i = 0;
+ for (auto const& elem : rNameMap)
{
- aPropTargetNames[i] = aIt->first;
- aPropSourceNames[i] = aIt->second;
+ aPropTargetNames[i] = elem.first;
+ aPropSourceNames[i] = elem.second;
+ ++i;
}
uno::Sequence< uno::Any > xValues = xMultiPropSet->getPropertyValues(aPropSourceNames);
-
- for(sal_Int32 i = 0, n = rNameMap.size(); i < n; ++i)
+ sal_Int32 n = rNameMap.size();
+ for(i = 0;i < n; ++i)
{
if( xValues[i].hasValue() )
rValueMap.emplace( aPropTargetNames[i], xValues[i] );
@@ -101,10 +97,10 @@ void PropertyMapper::getValueMap(
}
else
{
- for( ; aIt != aEnd; ++aIt )
+ for (auto const& elem : rNameMap)
{
- OUString aTarget = aIt->first;
- OUString aSource = aIt->second;
+ OUString aTarget = elem.first;
+ OUString aSource = elem.second;
try
{
uno::Any aAny( xSourceProp->getPropertyValue(aSource) );
@@ -142,16 +138,14 @@ void PropertyMapper::getMultiPropertyListsFromValueMap(
rValues.realloc(nPropertyCount);
//fill sequences
- tPropertyNameValueMap::const_iterator aValueIt( rValueMap.begin() );
- tPropertyNameValueMap::const_iterator aValueEnd( rValueMap.end() );
sal_Int32 nN=0;
- for( ; aValueIt != aValueEnd; ++aValueIt )
+ for (auto const& elem : rValueMap)
{
- const uno::Any& rAny = aValueIt->second;
+ const uno::Any& rAny = elem.second;
if( rAny.hasValue() )
{
//do not set empty anys because of performance (otherwise SdrAttrObj::ItemChange will take much longer)
- rNames[nN] = aValueIt->first;
+ rNames[nN] = elem.first;
rValues[nN] = rAny;
++nN;
}
More information about the Libreoffice-commits
mailing list