From 8a8a946c88a01a4fdbfe64bb03fa713fba5c2776 Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Thu, 26 Jan 2017 10:30:49 +0100 Subject: chart2: some more for-loop changes in VLegend Change-Id: I3c0c0b7463a45917c98f8dc766c781acf62da963 --- chart2/source/view/main/VLegend.cxx | 48 ++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 27 deletions(-) (limited to 'chart2/source') diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx index e756155ff1fb..c96cbd4024a7 100644 --- a/chart2/source/view/main/VLegend.cxx +++ b/chart2/source/view/main/VLegend.cxx @@ -153,13 +153,12 @@ awt::Size lcl_createTextShapes( awt::Size aResult; AbstractShapeFactory* pShapeFactory = AbstractShapeFactory::getOrCreateShapeFactory(xShapeFactory); - for( std::vector::const_iterator aIt( rEntries.begin()); - aIt != rEntries.end(); ++aIt ) + for (ViewLegendEntry const & rEntry : rEntries) { try { OUString aLabelString; - Sequence< Reference< XFormattedString2 > > aLabelSeq = (*aIt).aLabel; + Sequence< Reference< XFormattedString2 > > aLabelSeq = rEntry.aLabel; for( sal_Int32 i = 0; i < aLabelSeq.getLength(); ++i ) { // todo: support more than one text range @@ -196,12 +195,10 @@ void lcl_collectColumnWidths( std::vector< sal_Int32 >& rColumnWidths, const sal const ::std::vector< Reference< drawing::XShape > >& rTextShapes, sal_Int32 nSymbolPlusDistanceWidth ) { rColumnWidths.clear(); - sal_Int32 nRow = 0; - sal_Int32 nColumn = 0; sal_Int32 nNumberOfEntries = rTextShapes.size(); - for( ; nRow < nNumberOfRows; ++nRow ) + for (sal_Int32 nRow = 0; nRow < nNumberOfRows; ++nRow ) { - for( nColumn = 0; nColumn < nNumberOfColumns; ++nColumn ) + for (sal_Int32 nColumn = 0; nColumn < nNumberOfColumns; ++nColumn ) { sal_Int32 nEntry = (nColumn + nRow * nNumberOfColumns); if( nEntry < nNumberOfEntries ) @@ -223,13 +220,11 @@ void lcl_collectRowHeighs( std::vector< sal_Int32 >& rRowHeights, const sal_Int3 // calculate maximum height for each row // and collect column widths rRowHeights.clear(); - sal_Int32 nRow = 0; - sal_Int32 nColumn = 0; sal_Int32 nNumberOfEntries = rTextShapes.size(); - for( ; nRow < nNumberOfRows; ++nRow ) + for (sal_Int32 nRow = 0; nRow < nNumberOfRows; ++nRow) { sal_Int32 nCurrentRowHeight = 0; - for( nColumn = 0; nColumn < nNumberOfColumns; ++nColumn ) + for (sal_Int32 nColumn = 0; nColumn < nNumberOfColumns; ++nColumn) { sal_Int32 nEntry = (nColumn + nRow * nNumberOfColumns); if( nEntry < nNumberOfEntries ) @@ -246,9 +241,9 @@ sal_Int32 lcl_getTextLineHeight( const std::vector< sal_Int32 >& aRowHeights, co { const sal_Int32 nFontHeight = static_cast< sal_Int32 >( fViewFontSize ); sal_Int32 nTextLineHeight = nFontHeight; - for( sal_Int32 nR=0; nR have real text height @@ -347,8 +342,8 @@ awt::Size lcl_placeLegendEntries( //do the columns still fit into the given size? nCurrentColumnCount = aColumnWidths.size();//update count sal_Int32 nSumWidth = 0; - for( sal_Int32 nC=0; nC(aTextShapes.size()) ) { DrawModelWrapper::removeShape( aTextShapes[nEntry] ); @@ -405,7 +400,7 @@ awt::Size lcl_placeLegendEntries( nNumberOfEntries--; } } - nSumHeight -= aRowHeights[nR]; + nSumHeight -= aRowHeights[nRow]; aRowHeights.pop_back(); nRemainingSpace = rAvailableSpace.Height - nSumHeight; if( nRemainingSpace>=0 ) @@ -432,8 +427,8 @@ awt::Size lcl_placeLegendEntries( //check spacing between columns sal_Int32 nSumWidth = 0; - for( sal_Int32 nC=0; nC=0 ) { @@ -515,12 +510,11 @@ awt::Size lcl_placeLegendEntries( // place entries into column and rows sal_Int32 nMaxYPos = 0; - sal_Int32 nRow = 0; - sal_Int32 nColumn = 0; - for( nColumn = 0; nColumn < nNumberOfColumns; ++nColumn ) + + for (sal_Int32 nColumn = 0; nColumn < nNumberOfColumns; ++nColumn) { sal_Int32 nCurrentYPos = nYPadding; - for( nRow = 0; nRow < nNumberOfRows; ++nRow ) + for (sal_Int32 nRow = 0; nRow < nNumberOfRows; ++nRow) { sal_Int32 nEntry = (nColumn + nRow * nNumberOfColumns); if( nEntry >= nNumberOfEntries ) -- cgit