filter/source/graphicfilter/icgm/bundles.cxx | 7 filter/source/graphicfilter/icgm/cgm.cxx | 4 filter/source/graphicfilter/icgm/elements.cxx | 13 - filter/source/graphicfilter/ipict/ipict.cxx | 6 filter/source/graphicfilter/itiff/itiff.cxx | 6 filter/source/msfilter/escherex.cxx | 35 +-- filter/source/msfilter/msdffimp.cxx | 4 filter/source/msfilter/msoleexp.cxx | 3 filter/source/msfilter/msvbahelper.cxx | 4 filter/source/msfilter/svdfppt.cxx | 96 ++++------ filter/source/msfilter/util.cxx | 8 filter/source/svg/svgexport.cxx | 23 +- filter/source/svg/svgfilter.cxx | 4 filter/source/svg/svgreader.cxx | 12 - forms/source/richtext/richtextvclcontrol.cxx | 12 - formula/source/core/api/FormulaCompiler.cxx | 6 fpicker/source/office/RemoteFilesDialog.cxx | 8 framework/source/jobs/jobdispatch.cxx | 4 framework/source/uiconfiguration/imagemanagerimpl.cxx | 12 - framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx | 16 - framework/source/uiconfiguration/uiconfigurationmanager.cxx | 12 - framework/source/uielement/controlmenucontroller.cxx | 4 framework/source/xml/imagesdocumenthandler.cxx | 8 23 files changed, 143 insertions(+), 164 deletions(-)
New commits: commit 5e4fc9540993ee5e10f1986918acdd868a1fcf1b Author: Noel Grandin <n...@peralex.com> Date: Tue Apr 26 15:43:28 2016 +0200 clang-tidy modernize-loop-convert in f* Change-Id: Id866aa244378758e3bdb9e99d02cdd2ae6104e16 diff --git a/filter/source/graphicfilter/icgm/bundles.cxx b/filter/source/graphicfilter/icgm/bundles.cxx index df877fe..a81f6db 100644 --- a/filter/source/graphicfilter/icgm/bundles.cxx +++ b/filter/source/graphicfilter/icgm/bundles.cxx @@ -114,9 +114,8 @@ CGMFList& CGMFList::operator=( CGMFList& rSource ) nFontsAvailable = rSource.nFontsAvailable; nFontNameCount = rSource.nFontNameCount; nCharSetCount = rSource.nCharSetCount; - for ( size_t i = 0, n = rSource.aFontEntryList.size(); i < n; ++i ) + for (FontEntry* pPtr : rSource.aFontEntryList) { - FontEntry* pPtr = rSource.aFontEntryList[ i ]; FontEntry* pCFontEntry = new FontEntry; if ( pPtr->pFontName ) { @@ -248,8 +247,8 @@ void CGMFList::InsertCharSet( CharSetType eCharSetType, sal_uInt8* pSource, sal_ void CGMFList::ImplDeleteList() { - for ( size_t i = 0, n = aFontEntryList.size(); i < n; ++i ) - delete aFontEntryList[ i ]; + for (FontEntry* i : aFontEntryList) + delete i; aFontEntryList.clear(); } diff --git a/filter/source/graphicfilter/icgm/cgm.cxx b/filter/source/graphicfilter/icgm/cgm.cxx index b71aa03..30804b0 100644 --- a/filter/source/graphicfilter/icgm/cgm.cxx +++ b/filter/source/graphicfilter/icgm/cgm.cxx @@ -81,8 +81,8 @@ CGM::~CGM() mpGDIMetaFile->SetPrefSize( Size( static_cast< long >( mnOutdx ), static_cast< long >( mnOutdy ) ) ); *mpGraphic = Graphic( *mpGDIMetaFile ); } - for( size_t i = 0, n = maDefRepList.size(); i < n; ++i ) - delete [] maDefRepList[i]; + for(sal_uInt8* i : maDefRepList) + delete [] i; maDefRepList.clear(); maDefRepSizeList.clear(); delete mpBitmapInUse; diff --git a/filter/source/graphicfilter/icgm/elements.cxx b/filter/source/graphicfilter/icgm/elements.cxx index 60e4c0f..b548d93 100644 --- a/filter/source/graphicfilter/icgm/elements.cxx +++ b/filter/source/graphicfilter/icgm/elements.cxx @@ -292,8 +292,8 @@ void CGMElements::ImplInsertHatch( sal_Int32 nKey, int nStyle, long nDistance, l void CGMElements::DeleteAllBundles( BundleList& rList ) { - for ( size_t i = 0, n = rList.size(); i < n; ++i ) { - delete rList[ i ]; + for (Bundle* i : rList) { + delete i; } rList.clear(); }; @@ -303,9 +303,8 @@ void CGMElements::CopyAllBundles( BundleList& rSource, BundleList& rDest ) { DeleteAllBundles( rDest ); - for ( size_t i = 0, n = rSource.size(); i < n; ++i ) + for (Bundle* pPtr : rSource) { - Bundle* pPtr = rSource[ i ]; Bundle* pTempBundle = pPtr->Clone(); rDest.push_back( pTempBundle ); } @@ -324,9 +323,9 @@ Bundle* CGMElements::GetBundleIndex( long nIndex, BundleList& rList, Bundle& rBu Bundle* CGMElements::GetBundle( BundleList& rList, long nIndex ) { - for ( size_t i = 0, n = rList.size(); i < n; ++i ) { - if ( rList[ i ]->GetIndex() == nIndex ) { - return rList[ i ]; + for (Bundle* i : rList) { + if ( i->GetIndex() == nIndex ) { + return i; } } return nullptr; diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx index 223efb7..29298b2 100644 --- a/filter/source/graphicfilter/ipict/ipict.cxx +++ b/filter/source/graphicfilter/ipict/ipict.cxx @@ -90,10 +90,10 @@ namespace PictReaderInternal { // count the no of bits in pattern which are set to 1: nBitCount=0; - for (short ny=0; ny<8; ny++) { - stream.ReadChar( reinterpret_cast<char&>(nbyte[ny]) ); + for (unsigned char & ny : nbyte) { + stream.ReadChar( reinterpret_cast<char&>(ny) ); for (short nx=0; nx<8; nx++) { - if ( (nbyte[ny] & (1<<nx)) != 0 ) nBitCount++; + if ( (ny & (1<<nx)) != 0 ) nBitCount++; } } diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx index f4352df..c87e8f8 100644 --- a/filter/source/graphicfilter/itiff/itiff.cxx +++ b/filter/source/graphicfilter/itiff/itiff.cxx @@ -1369,15 +1369,15 @@ bool TIFFReader::ReadTIFF(SvStream & rTIFF, Graphic & rGraphic ) { nBytesPerRow = ( nImageWidth * nSamplesPerPixel / nPlanes * nBitsPerSample + 7 ) >> 3; - for ( sal_uLong j = 0; j < 4; j++ ) + for (sal_uInt8*& j : pMap) { try { - pMap[ j ] = new sal_uInt8[ nBytesPerRow ]; + j = new sal_uInt8[ nBytesPerRow ]; } catch (const std::bad_alloc &) { - pMap[ j ] = nullptr; + j = nullptr; bStatus = false; break; } diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index c56d27a..d675576 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -3854,15 +3854,14 @@ EscherPersistTable::EscherPersistTable() EscherPersistTable::~EscherPersistTable() { - for( size_t i = 0, n = maPersistTable.size(); i < n; ++i ) { - delete maPersistTable[ i ]; + for(EscherPersistEntry* i : maPersistTable) { + delete i; } } bool EscherPersistTable::PtIsID( sal_uInt32 nID ) { - for( size_t i = 0, n = maPersistTable.size(); i < n; ++i ) { - EscherPersistEntry* pPtr = maPersistTable[ i ]; + for(EscherPersistEntry* pPtr : maPersistTable) { if ( pPtr->mnID == nID ) { return true; } @@ -3890,8 +3889,7 @@ void EscherPersistTable::PtDelete( sal_uInt32 nID ) sal_uInt32 EscherPersistTable::PtGetOffsetByID( sal_uInt32 nID ) { - for( size_t i = 0, n = maPersistTable.size(); i < n; ++i ) { - EscherPersistEntry* pPtr = maPersistTable[ i ]; + for(EscherPersistEntry* pPtr : maPersistTable) { if ( pPtr->mnID == nID ) { return pPtr->mnOffset; } @@ -3901,8 +3899,7 @@ sal_uInt32 EscherPersistTable::PtGetOffsetByID( sal_uInt32 nID ) void EscherPersistTable::PtReplace( sal_uInt32 nID, sal_uInt32 nOfs ) { - for( size_t i = 0, n = maPersistTable.size(); i < n; ++i ) { - EscherPersistEntry* pPtr = maPersistTable[ i ]; + for(EscherPersistEntry* pPtr : maPersistTable) { if ( pPtr->mnID == nID ) { pPtr->mnOffset = nOfs; return; @@ -3912,8 +3909,7 @@ void EscherPersistTable::PtReplace( sal_uInt32 nID, sal_uInt32 nOfs ) void EscherPersistTable::PtReplaceOrInsert( sal_uInt32 nID, sal_uInt32 nOfs ) { - for( size_t i = 0, n = maPersistTable.size(); i < n; ++i ) { - EscherPersistEntry* pPtr = maPersistTable[ i ]; + for(EscherPersistEntry* pPtr : maPersistTable) { if ( pPtr->mnID == nID ) { pPtr->mnOffset = nOfs; return; @@ -4731,11 +4727,11 @@ sal_uInt32 EscherConnectorListEntry::GetConnectorRule( bool bFirst ) EscherSolverContainer::~EscherSolverContainer() { - for( size_t i = 0, n = maShapeList.size(); i < n; ++i ) { - delete maShapeList[ i ]; + for(EscherShapeListEntry* i : maShapeList) { + delete i; } - for( size_t i = 0, n = maConnectorList.size(); i < n; ++i ) { - delete maConnectorList[ i ]; + for(EscherConnectorListEntry* i : maConnectorList) { + delete i; } } @@ -4757,11 +4753,10 @@ void EscherSolverContainer::AddConnector( sal_uInt32 EscherSolverContainer::GetShapeId( const css::uno::Reference< css::drawing::XShape > & rXShape ) const { - for ( size_t i = 0, n = maShapeList.size(); i < n; ++i ) + for (EscherShapeListEntry* pPtr : maShapeList) { - EscherShapeListEntry* pPtr = maShapeList[ i ]; if ( rXShape == pPtr->aXShape ) - return ( pPtr->n_EscherId ); + return pPtr->n_EscherId; } return 0; } @@ -4780,9 +4775,8 @@ void EscherSolverContainer::WriteSolver( SvStream& rStrm ) EscherConnectorRule aConnectorRule; aConnectorRule.nRuleId = 2; - for ( size_t i = 0, n = maConnectorList.size(); i < n; ++i ) + for (EscherConnectorListEntry* pPtr : maConnectorList) { - EscherConnectorListEntry* pPtr = maConnectorList[ i ]; aConnectorRule.ncptiA = aConnectorRule.ncptiB = 0xffffffff; aConnectorRule.nShapeC = GetShapeId( pPtr->mXConnector ); aConnectorRule.nShapeA = GetShapeId( pPtr->mXConnectToA ); @@ -5025,8 +5019,7 @@ void EscherEx::InsertAtCurrentPos( sal_uInt32 nBytes, bool bExpandEndOfAtom ) sal_uInt32 nSize, nType, nSource, nBufSize, nToCopy, nCurPos = mpOutStrm->Tell(); // adjust persist table - for( size_t i = 0, n = maPersistTable.size(); i < n; ++i ) { - EscherPersistEntry* pPtr = maPersistTable[ i ]; + for(EscherPersistEntry* pPtr : maPersistTable) { sal_uInt32 nOfs = pPtr->mnOffset; if ( nOfs >= nCurPos ) { pPtr->mnOffset += nBytes; diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index c4b3670..3619210 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -398,8 +398,8 @@ SvxMSDffSolverContainer::SvxMSDffSolverContainer() SvxMSDffSolverContainer::~SvxMSDffSolverContainer() { - for( size_t i = 0, n = aCList.size(); i < n; ++i ) { - delete aCList[ i ]; + for(SvxMSDffConnectorRule* i : aCList) { + delete i; } aCList.clear(); } diff --git a/filter/source/msfilter/msoleexp.cxx b/filter/source/msfilter/msoleexp.cxx index 564058d9..6660d7c 100644 --- a/filter/source/msfilter/msoleexp.cxx +++ b/filter/source/msfilter/msoleexp.cxx @@ -161,9 +161,8 @@ void SvxMSExportOLEObjects::ExportOLEObject( svt::EmbeddedObjectRef& rObj, SotSt for( const ObjExpType* pArr = aArr; !pExpFilter && ( pArr->nFlag != 0xffff ); ++pArr ) { - for ( int n = 0; n < 4; ++n ) + for (const ObjExpType::GlobalNameIds& rId : pArr->aGlNmIds) { - const ObjExpType::GlobalNameIds& rId = pArr->aGlNmIds[ n ]; SvGlobalName aGlbNm( rId.n1, rId.n2, rId.n3, rId.b8, rId.b9, rId.b10, rId.b11, rId.b12, rId.b13, rId.b14, rId.b15 ); diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx index c43638a..3a5330d 100644 --- a/filter/source/msfilter/msvbahelper.cxx +++ b/filter/source/msfilter/msvbahelper.cxx @@ -695,9 +695,9 @@ awt::KeyEvent parseKeyEvent( const OUString& Key ) throw ( uno::RuntimeException static MSKeyCodeMap s_KeyCodes; if ( s_KeyCodes.empty() ) { - for ( unsigned int i = 0; i < SAL_N_ELEMENTS( aMSKeyCodesData ); ++i ) + for (KeyCodeEntry & i : aMSKeyCodesData) { - s_KeyCodes[ OUString::createFromAscii( aMSKeyCodesData[ i ].sName ) ] = aMSKeyCodesData[ i ].nCode; + s_KeyCodes[ OUString::createFromAscii( i.sName ) ] = i.nCode; } } OUString sKeyCode; diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index c9e44c6..437207f 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -298,8 +298,8 @@ SvStream& ReadPptDocumentAtom(SvStream& rIn, PptDocumentAtom& rAtom) void PptSlideLayoutAtom::Clear() { eLayout = PptSlideLayout::TITLESLIDE; - for ( sal_uInt16 i = 0; i < 8; i++ ) - aPlaceholderId[ i ] = PptPlaceholder::NONE; + for (PptPlaceholder & i : aPlaceholderId) + i = PptPlaceholder::NONE; } SvStream& ReadPptSlideLayoutAtom( SvStream& rIn, PptSlideLayoutAtom& rAtom ) @@ -529,8 +529,8 @@ SdrEscherImport::SdrEscherImport( PowerPointImportParam& rParam, const OUString& SdrEscherImport::~SdrEscherImport() { - for ( size_t i = 0, n = aOleObjectList.size(); i < n; ++i ) - delete aOleObjectList[ i ]; + for (PPTOleEntry* i : aOleObjectList) + delete i; aOleObjectList.clear(); delete m_pFonts; } @@ -1242,9 +1242,8 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi } if ( rPersistEntry.pSolverContainer ) { - for ( size_t i = 0; i < rPersistEntry.pSolverContainer->aCList.size(); ++i ) + for (SvxMSDffConnectorRule* pPtr : rPersistEntry.pSolverContainer->aCList) { - SvxMSDffConnectorRule* pPtr = rPersistEntry.pSolverContainer->aCList[ i ]; if ( rObjData.nShapeId == pPtr->nShapeC ) pPtr->pCObj = pRet; else @@ -1649,8 +1648,8 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O SdrPowerPointImport::~SdrPowerPointImport() { - for ( size_t i = 0, n = aHyperList.size(); i < n; ++i ) { - delete aHyperList[ i ]; + for (SdHyperlinkEntry* i : aHyperList) { + delete i; } aHyperList.clear(); delete m_pMasterPages; @@ -1813,10 +1812,8 @@ SdrObject* SdrPowerPointImport::ImportOLE( long nOLEId, } } - PPTOleEntry* pOe; - for ( size_t i = 0; i < const_cast<SdrPowerPointImport*>(this)->aOleObjectList.size(); ++i ) + for (PPTOleEntry* pOe : const_cast<SdrPowerPointImport*>(this)->aOleObjectList) { - pOe = const_cast<SdrPowerPointImport*>(this)->aOleObjectList[ i ]; if ( pOe->nId != (sal_uInt32)nOLEId ) continue; @@ -3168,9 +3165,9 @@ bool PPTExtParaProv::GetGraphic( sal_uInt32 nInstance, Graphic& rGraph ) const } if ( !bRetValue ) { - for (size_t i = 0; i < aBuGraList.size(); i++ ) + for (PPTBuGraEntry* i : aBuGraList) { - pPtr = aBuGraList[ i ]; + pPtr = i; if ( pPtr->nInstance == nInstance ) { bRetValue = true; @@ -3333,8 +3330,8 @@ PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const PPTExtParaProv::~PPTExtParaProv() { - for ( size_t i = 0, n = aBuGraList.size(); i < n; ++i ) - delete aBuGraList[ i ]; + for (PPTBuGraEntry* i : aBuGraList) + delete i; aBuGraList.clear(); } @@ -3766,15 +3763,15 @@ PPTCharSheet::PPTCharSheet( sal_uInt32 nInstance ) nFontHeight = 24; break; } - for ( sal_uInt32 nDepth = 0; nDepth < 5; nDepth++ ) + for (PPTCharLevel & nDepth : maCharLevel) { - maCharLevel[ nDepth ].mnFlags = 0; - maCharLevel[ nDepth ].mnFont = 0; - maCharLevel[ nDepth ].mnAsianOrComplexFont = 0xffff; - maCharLevel[ nDepth ].mnFontHeight = nFontHeight; - maCharLevel[ nDepth ].mnFontColor = nColor; - maCharLevel[ nDepth ].mnFontColorInStyleSheet = Color( (sal_uInt8)nColor, (sal_uInt8)( nColor >> 8 ), (sal_uInt8)( nColor >> 16 ) ); - maCharLevel[ nDepth ].mnEscapement = 0; + nDepth.mnFlags = 0; + nDepth.mnFont = 0; + nDepth.mnAsianOrComplexFont = 0xffff; + nDepth.mnFontHeight = nFontHeight; + nDepth.mnFontColor = nColor; + nDepth.mnFontColorInStyleSheet = Color( (sal_uInt8)nColor, (sal_uInt8)( nColor >> 8 ), (sal_uInt8)( nColor >> 16 ) ); + nDepth.mnEscapement = 0; } } @@ -3855,22 +3852,22 @@ PPTParaSheet::PPTParaSheet( sal_uInt32 nInstance ) nUpperDist = 0x1e; break; } - for ( sal_uInt32 i = 0; i < 5; i++ ) + for (PPTParaLevel & i : maParaLevel) { - maParaLevel[ i ].mnBuFlags = nBuFlags; - maParaLevel[ i ].mnBulletChar = 0x2022; - maParaLevel[ i ].mnBulletFont = 0; - maParaLevel[ i ].mnBulletHeight = 100; - maParaLevel[ i ].mnBulletColor = nBulletColor; - maParaLevel[ i ].mnAdjust = 0; - maParaLevel[ i ].mnLineFeed = 100; - maParaLevel[ i ].mnLowerDist = 0; - maParaLevel[ i ].mnUpperDist = nUpperDist; - maParaLevel[ i ].mnTextOfs = 0; - maParaLevel[ i ].mnBulletOfs = 0; - maParaLevel[ i ].mnDefaultTab = 0x240; - maParaLevel[ i ].mnAsianLineBreak = 0; - maParaLevel[ i ].mnBiDi = 0; + i.mnBuFlags = nBuFlags; + i.mnBulletChar = 0x2022; + i.mnBulletFont = 0; + i.mnBulletHeight = 100; + i.mnBulletColor = nBulletColor; + i.mnAdjust = 0; + i.mnLineFeed = 100; + i.mnLowerDist = 0; + i.mnUpperDist = nUpperDist; + i.mnTextOfs = 0; + i.mnBulletOfs = 0; + i.mnDefaultTab = 0x240; + i.mnAsianLineBreak = 0; + i.mnBiDi = 0; } } @@ -4831,8 +4828,8 @@ bool PPTTextSpecInfoAtomInterpreter::Read( SvStream& rIn, const DffRecordHeader& PPTTextSpecInfoAtomInterpreter::~PPTTextSpecInfoAtomInterpreter() { - for ( size_t i = 0, n = aList.size(); i < n; ++i ) { - delete aList[ i ]; + for (PPTTextSpecInfo* i : aList) { + delete i; } aList.clear(); } @@ -6382,9 +6379,9 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >& sal_uInt32 PPTParagraphObj::GetTextSize() { sal_uInt32 nCount, nRetValue = 0; - for (size_t i = 0; i < m_PortionList.size(); i++) + for (std::unique_ptr<PPTPortionObj> & i : m_PortionList) { - PPTPortionObj const& rPortionObj = *m_PortionList[i]; + PPTPortionObj const& rPortionObj = *i; nCount = rPortionObj.Count(); if ((!nCount) && rPortionObj.mpFieldItem) nCount++; @@ -6701,10 +6698,8 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport &(rSdrPowerPointImport.pPPTStyleSheet->maTxSI) ) ) { sal_uInt32 nI = 0; - PPTTextSpecInfo* pSpecInfo; - for ( size_t i = 0; i < aTextSpecInfoAtomInterpreter.aList.size(); ++i) + for (PPTTextSpecInfo* pSpecInfo : aTextSpecInfoAtomInterpreter.aList) { - pSpecInfo = aTextSpecInfoAtomInterpreter.aList[ i ]; sal_uInt32 nCharIdx = pSpecInfo->nCharIdx; // portions and text have to been splitted in some cases @@ -6884,9 +6879,8 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport { PptInteractiveInfoAtom aInteractiveInfoAtom; ReadPptInteractiveInfoAtom( rIn, aInteractiveInfoAtom ); - for ( size_t i = 0; i < rSdrPowerPointImport.aHyperList.size(); ++i ) + for (SdHyperlinkEntry* pHyperlink : rSdrPowerPointImport.aHyperList) { - SdHyperlinkEntry* pHyperlink = rSdrPowerPointImport.aHyperList[ i ]; if ( pHyperlink->nIndex == aInteractiveInfoAtom.nExHyperlinkId ) { aTextHd.SeekToEndOfRecord( rIn ); @@ -7092,8 +7086,8 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport } n--; } - for( size_t j = 0, n2 = FieldList.size(); j < n2; ++j ) { - delete FieldList[ j ]; + for(PPTFieldEntry* j : FieldList) { + delete j; } } mpImplTextObj->mpParagraphList = new PPTParagraphObj*[ nParagraphs ]; @@ -7696,10 +7690,8 @@ SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, sal_uInt32* pTab // possibly connections to the group object have to be removed. if ( pSolverContainer ) { - for ( size_t i = 0; i < pSolverContainer->aCList.size(); ++i ) + for (SvxMSDffConnectorRule* pPtr : pSolverContainer->aCList) { - SvxMSDffConnectorRule* pPtr = pSolverContainer->aCList[ i ]; - // check connections to the group object if ( pPtr->pAObj == pGroup ) pPtr->pAObj = nullptr; diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx index 89ab37a..36046fb 100644 --- a/filter/source/msfilter/util.cxx +++ b/filter/source/msfilter/util.cxx @@ -1184,9 +1184,9 @@ const char* GetOOXMLPresetGeometry( const char* sShapeType ) if( pCustomShapeTypeTranslationHashMap == nullptr ) { pCustomShapeTypeTranslationHashMap = new CustomShapeTypeTranslationHashMap (); - for( unsigned int i = 0; i < SAL_N_ELEMENTS(pCustomShapeTypeTranslationTable); ++i ) + for(const msfilter::util::CustomShapeTypeTranslationTable& i : pCustomShapeTypeTranslationTable) { - (*pCustomShapeTypeTranslationHashMap)[ pCustomShapeTypeTranslationTable[ i ].sOOo ] = pCustomShapeTypeTranslationTable[ i ].sMSO; + (*pCustomShapeTypeTranslationHashMap)[ i.sOOo ] = i.sMSO; } } CustomShapeTypeTranslationHashMap::iterator i( @@ -1204,8 +1204,8 @@ MSO_SPT GETVMLShapeType(const OString& aType) if (!pDMLToVMLMap) { pDMLToVMLMap = new DMLToVMLTranslationHashMap(); - for (size_t i = 0; i < SAL_N_ELEMENTS(pDMLToVMLTable); ++i) - (*pDMLToVMLMap)[pDMLToVMLTable[i].sDML] = pDMLToVMLTable[i].nVML; + for (auto& i : pDMLToVMLTable) + (*pDMLToVMLMap)[i.sDML] = i.nVML; } DMLToVMLTranslationHashMap::iterator i(pDMLToVMLMap->find(pDML)); diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx index 47f5a1d..18403f6 100644 --- a/filter/source/svg/svgexport.cxx +++ b/filter/source/svg/svgexport.cxx @@ -575,8 +575,8 @@ bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) implRegisterInterface( rPage ); // create an id for each master page - for( size_t i = 0; i < mMasterPageTargets.size(); ++i ) - implRegisterInterface( mMasterPageTargets[i] ); + for(uno::Reference<drawing::XDrawPage> & mMasterPageTarget : mMasterPageTargets) + implRegisterInterface( mMasterPageTarget ); try { @@ -1132,20 +1132,17 @@ void SVGFilter::implGenerateMetaData() } if( mpSVGExport->IsEmbedFonts() && mpSVGExport->IsUsePositionedCharacters() ) { - for( sal_Int32 i = 0, nSize = aFieldSet.size(); i < nSize; ++i ) + for(TextField* i : aFieldSet) { - aFieldSet[i]->growCharSet( mTextFieldCharSets ); + i->growCharSet( mTextFieldCharSets ); } } } // text fields are used only for generating meta info so we don't need them anymore - for( size_t i = 0; i < aFieldSet.size(); ++i ) + for(TextField* i : aFieldSet) { - if( aFieldSet[i] != nullptr ) - { - delete aFieldSet[i]; - } + delete i; } } } @@ -1157,9 +1154,9 @@ void SVGFilter::implExportAnimations() mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", "presentation-animations" ); SvXMLElementExport aDefsContainerElem( *mpSVGExport, XML_NAMESPACE_NONE, "defs", true, true ); - for( size_t i = 0; i < mSelectedPages.size(); ++i ) + for(uno::Reference<drawing::XDrawPage> & mSelectedPage : mSelectedPages) { - Reference< XPropertySet > xProps( mSelectedPages[i], UNO_QUERY ); + Reference< XPropertySet > xProps( mSelectedPage, UNO_QUERY ); if( xProps.is() && xProps->getPropertySetInfo()->hasPropertyByName( "TransitionType" ) ) { @@ -1168,7 +1165,7 @@ void SVGFilter::implExportAnimations() // we have a slide transition ? bool bHasEffects = ( nTransition != 0 ); - Reference< XAnimationNodeSupplier > xAnimNodeSupplier( mSelectedPages[i], UNO_QUERY ); + Reference< XAnimationNodeSupplier > xAnimNodeSupplier( mSelectedPage, UNO_QUERY ); if( xAnimNodeSupplier.is() ) { Reference< XAnimationNode > xRootNode = xAnimNodeSupplier->getAnimationNode(); @@ -1193,7 +1190,7 @@ void SVGFilter::implExportAnimations() } if( bHasEffects ) { - OUString sId = implGetValidIDFromInterface( mSelectedPages[i] ); + OUString sId = implGetValidIDFromInterface( mSelectedPage ); mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, aOOOAttrSlide, sId ); sId += "-animations"; mpSVGExport->AddAttribute( XML_NAMESPACE_NONE, "id", sId ); diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx index 2c5769e..7304a56 100644 --- a/filter/source/svg/svgfilter.cxx +++ b/filter/source/svg/svgfilter.cxx @@ -258,9 +258,9 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto * The master page are put in an unordered set. */ ObjectSet aMasterPageTargetSet; - for( size_t i = 0; i < mSelectedPages.size(); ++i ) + for(uno::Reference<drawing::XDrawPage> & mSelectedPage : mSelectedPages) { - uno::Reference< drawing::XMasterPageTarget > xMasterPageTarget( mSelectedPages[i], uno::UNO_QUERY ); + uno::Reference< drawing::XMasterPageTarget > xMasterPageTarget( mSelectedPage, uno::UNO_QUERY ); if( xMasterPageTarget.is() ) { aMasterPageTargetSet.insert( xMasterPageTarget->getMasterPage() ); diff --git a/filter/source/svg/svgreader.cxx b/filter/source/svg/svgreader.cxx index fe2912c..48ebaeb 100644 --- a/filter/source/svg/svgreader.cxx +++ b/filter/source/svg/svgreader.cxx @@ -1877,13 +1877,13 @@ struct ShapeWritingVisitor boost::bind(&basegfx::B2DPolyPolygon::transform, _1,boost::cref(aState.maCTM))); - for( size_t i=0; i<aPolys.size(); ++i ) + for(basegfx::B2DPolyPolygon & aPoly : aPolys) { const basegfx::B2DRange aBounds( - aPolys[i].areControlPointsUsed() ? + aPoly.areControlPointsUsed() ? basegfx::tools::getRange( - basegfx::tools::adaptiveSubdivideByAngle(aPolys[i])) : - basegfx::tools::getRange(aPolys[i])); + basegfx::tools::adaptiveSubdivideByAngle(aPoly)) : + basegfx::tools::getRange(aPoly)); fillShapeProperties(xAttrs, xElem, aBounds, @@ -1896,10 +1896,10 @@ struct ShapeWritingVisitor basegfx::B2DHomMatrix aNormalize; aNormalize.translate(-aBounds.getMinX(),-aBounds.getMinY()); aNormalize.scale(2540.0/72.0,2540.0/72.0); - aPolys[i].transform(aNormalize); + aPoly.transform(aNormalize); xAttrs->AddAttribute( "svg:d", basegfx::tools::exportToSvgD( - aPolys[i], + aPoly, false, // no relative coords. causes rounding errors false, // no quad bezier detection. crashes older versions. false )); diff --git a/forms/source/richtext/richtextvclcontrol.cxx b/forms/source/richtext/richtextvclcontrol.cxx index c502ccc..ca56651 100644 --- a/forms/source/richtext/richtextvclcontrol.cxx +++ b/forms/source/richtext/richtextvclcontrol.cxx @@ -237,11 +237,11 @@ namespace frm ::sfx2::FileDialogHelper aFP( bLoad ? css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE : css::ui::dialogs::TemplateDescription::FILESAVE_AUTOEXTENSION, 0, this ); - for ( size_t i = 0; i < SAL_N_ELEMENTS( aExportFormats ); ++i ) + for (auto & aExportFormat : aExportFormats) { aFP.AddFilter( - OUString::createFromAscii( aExportFormats[i].pDescription ), - OUString::createFromAscii( aExportFormats[i].pExtension ) ); + OUString::createFromAscii( aExportFormat.pDescription ), + OUString::createFromAscii( aExportFormat.pExtension ) ); } ErrCode nResult = aFP.Execute(); if ( nResult == 0 ) @@ -254,11 +254,11 @@ namespace frm { EETextFormat eFormat = EE_FORMAT_XML; OUString sFilter = aFP.GetCurrentFilter(); - for ( size_t i = 0; i < SAL_N_ELEMENTS( aExportFormats ); ++i ) + for (auto & aExportFormat : aExportFormats) { - if ( sFilter.equalsAscii( aExportFormats[i].pDescription ) ) + if ( sFilter.equalsAscii( aExportFormat.pDescription ) ) { - eFormat = aExportFormats[i].eFormat; + eFormat = aExportFormat.eFormat; break; } } diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index 08300f5..96bb268 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -475,9 +475,9 @@ uno::Sequence< sheet::FormulaOpCodeMapEntry > FormulaCompiler::OpCodeMap::create } // if (aVec.size() < nCount) FormulaOpCodeMapEntry aEntry; - for (size_t i=0; i < nCount; ++i) + for (auto& i : aMap) { - size_t nIndex = static_cast< size_t >( aMap[i].nOff ); + size_t nIndex = static_cast< size_t >( i.nOff ); if (aVec.size() <= nIndex) { // The offsets really should be aligned with the size, so if @@ -487,7 +487,7 @@ uno::Sequence< sheet::FormulaOpCodeMapEntry > FormulaCompiler::OpCodeMap::create aEntry.Token.OpCode = getOpCodeUnknown(); aVec.resize( nIndex + 1, aEntry ); } - aEntry.Token.OpCode = aMap[i].eOp; + aEntry.Token.OpCode = i.eOp; aVec[nIndex] = aEntry; } } diff --git a/fpicker/source/office/RemoteFilesDialog.cxx b/fpicker/source/office/RemoteFilesDialog.cxx index 1dc31d5..f6e0929 100644 --- a/fpicker/source/office/RemoteFilesDialog.cxx +++ b/fpicker/source/office/RemoteFilesDialog.cxx @@ -1345,11 +1345,11 @@ void RemoteFilesDialog::UpdateControls( const OUString& rURL ) m_pName_ed->ClearEntries(); - for( ::std::vector< SvtContentEntry >::size_type i = 0; i < rFolders.size(); i++ ) + for(const auto & rFolder : rFolders) { //WebDAV folders path ends in '/', so strip it - OUString aFolderName = rFolders[i].maURL; - if( rFolders[i].mbIsFolder && ( ( aFolderName.lastIndexOf( '/' ) + 1 ) == aFolderName.getLength() ) ) + OUString aFolderName = rFolder.maURL; + if( rFolder.mbIsFolder && ( ( aFolderName.lastIndexOf( '/' ) + 1 ) == aFolderName.getLength() ) ) aFolderName = aFolderName.copy( 0, aFolderName.getLength() - 1 ); int nTitleStart = aFolderName.lastIndexOf( '/' ); @@ -1359,7 +1359,7 @@ void RemoteFilesDialog::UpdateControls( const OUString& rURL ) aFolderName.copy( nTitleStart + 1 ), INetURLObject::DECODE_WITH_CHARSET ) ); - if( rFolders[i].mbIsFolder ) + if( rFolder.mbIsFolder ) { aFolders.push_back( std::pair< OUString, OUString > ( sTitle, aFolderName ) ); } diff --git a/framework/source/jobs/jobdispatch.cxx b/framework/source/jobs/jobdispatch.cxx index 78e014c..d85fb0e 100644 --- a/framework/source/jobs/jobdispatch.cxx +++ b/framework/source/jobs/jobdispatch.cxx @@ -323,13 +323,13 @@ void JobDispatch::impl_dispatchEvent( /*IN*/ const OUString& // It's not really an error, if no registered jobs could be located. // Step over all found jobs and execute it int nExecutedJobs=0; - for (size_t j=0; j<lJobs.size(); ++j) + for (OUString & lJob : lJobs) { /* SAFE { */ aReadLock.reset(); JobData aCfg(m_xContext); - aCfg.setEvent(sEvent, lJobs[j]); + aCfg.setEvent(sEvent, lJob); aCfg.setEnvironment(JobData::E_DISPATCH); const bool bIsEnabled=aCfg.hasCorrectContext(m_sModuleIdentifier); diff --git a/framework/source/uiconfiguration/imagemanagerimpl.cxx b/framework/source/uiconfiguration/imagemanagerimpl.cxx index 139e015..f833625 100644 --- a/framework/source/uiconfiguration/imagemanagerimpl.cxx +++ b/framework/source/uiconfiguration/imagemanagerimpl.cxx @@ -544,10 +544,10 @@ void ImageManagerImpl::dispose() m_bDisposed = true; // delete user and default image list on dispose - for ( sal_Int32 n=0; n < ImageType_COUNT; n++ ) + for (ImageList*& n : m_pUserImageList) { - delete m_pUserImageList[n]; - m_pUserImageList[n] = nullptr; + delete n; + n = nullptr; } delete m_pDefaultImageList; m_pDefaultImageList = nullptr; @@ -1253,10 +1253,10 @@ void ImageManagerImpl::clear() { SolarMutexGuard g; - for ( sal_Int32 n = 0; n < ImageType_COUNT; n++ ) + for (ImageList* & n : m_pUserImageList) { - delete m_pUserImageList[n]; - m_pUserImageList[n] = nullptr; + delete n; + n = nullptr; } } } // namespace framework diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index a3ca2fb..5f79341 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -860,8 +860,8 @@ ModuleUIConfigurationManager::ModuleUIConfigurationManager( , m_xContext( xContext ) , m_aListenerContainer( m_mutex ) { - for ( int i = 0; i < css::ui::UIElementType::COUNT; i++ ) - m_pStorageHandler[i] = nullptr; + for (PresetHandler* & i : m_pStorageHandler) + i = nullptr; // Make sure we have a default initialized entry for every layer and user interface element type! // The following code depends on this! @@ -926,8 +926,8 @@ ModuleUIConfigurationManager::ModuleUIConfigurationManager( ModuleUIConfigurationManager::~ModuleUIConfigurationManager() { - for ( int i = 0; i < css::ui::UIElementType::COUNT; i++ ) - delete m_pStorageHandler[i]; + for (PresetHandler* i : m_pStorageHandler) + delete i; } // XComponent @@ -1596,10 +1596,10 @@ void SAL_CALL ModuleUIConfigurationManager::reload() throw (css::uno::Exception, aGuard.clear(); // Notify our listeners - for ( size_t j = 0; j < aRemoveNotifyContainer.size(); j++ ) - implts_notifyContainerListener( aRemoveNotifyContainer[j], NotifyOp_Remove ); - for ( size_t k = 0; k < aReplaceNotifyContainer.size(); k++ ) - implts_notifyContainerListener( aReplaceNotifyContainer[k], NotifyOp_Replace ); + for (ui::ConfigurationEvent & j : aRemoveNotifyContainer) + implts_notifyContainerListener( j, NotifyOp_Remove ); + for (ui::ConfigurationEvent & k : aReplaceNotifyContainer) + implts_notifyContainerListener( k, NotifyOp_Replace ); } } diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx index f169282..ebe9192 100644 --- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx @@ -837,8 +837,8 @@ void SAL_CALL UIConfigurationManager::reset() throw (css::uno::RuntimeException, aGuard.clear(); // Notify our listeners - for ( size_t k = 0; k < aRemoveEventNotifyContainer.size(); k++ ) - implts_notifyContainerListener( aRemoveEventNotifyContainer[k], NotifyOp_Remove ); + for (ConfigurationEvent & k : aRemoveEventNotifyContainer) + implts_notifyContainerListener( k, NotifyOp_Remove ); } catch ( const css::lang::IllegalArgumentException& ) { @@ -1298,10 +1298,10 @@ void SAL_CALL UIConfigurationManager::reload() throw (css::uno::Exception, css:: aGuard.clear(); // Notify our listeners - for ( size_t j = 0; j < aRemoveNotifyContainer.size(); j++ ) - implts_notifyContainerListener( aRemoveNotifyContainer[j], NotifyOp_Remove ); - for ( size_t k = 0; k < aReplaceNotifyContainer.size(); k++ ) - implts_notifyContainerListener( aReplaceNotifyContainer[k], NotifyOp_Replace ); + for (ConfigurationEvent & j : aRemoveNotifyContainer) + implts_notifyContainerListener( j, NotifyOp_Remove ); + for (ConfigurationEvent & k : aReplaceNotifyContainer) + implts_notifyContainerListener( k, NotifyOp_Replace ); } } diff --git a/framework/source/uielement/controlmenucontroller.cxx b/framework/source/uielement/controlmenucontroller.cxx index 7fc5e5e..00e91ac 100644 --- a/framework/source/uielement/controlmenucontroller.cxx +++ b/framework/source/uielement/controlmenucontroller.cxx @@ -418,9 +418,9 @@ void SAL_CALL ControlMenuController::updatePopupMenu() throw (css::uno::RuntimeE fillPopupMenu( m_xPopupMenu ); m_aURLToDispatchMap.free(); - for (sal_uInt32 i=0; i<SAL_N_ELEMENTS(aCommands); ++i) + for (const char* aCommand : aCommands) { - aTargetURL.Complete = OUString::createFromAscii( aCommands[i] ); + aTargetURL.Complete = OUString::createFromAscii( aCommand ); m_xURLTransformer->parseStrict( aTargetURL ); Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); diff --git a/framework/source/xml/imagesdocumenthandler.cxx b/framework/source/xml/imagesdocumenthandler.cxx index 0ba98b3..79866fe 100644 --- a/framework/source/xml/imagesdocumenthandler.cxx +++ b/framework/source/xml/imagesdocumenthandler.cxx @@ -722,8 +722,8 @@ void OWriteImagesDocumentHandler::WriteImageList( const ImageListItemDescriptor* ImageItemListDescriptor* pImageItemList = pImageList->pImageItemList; if ( pImageItemList ) { - for ( size_t i = 0; i < pImageItemList->size(); i++ ) - WriteImage( (*pImageItemList)[i].get() ); + for (std::unique_ptr<ImageItemDescriptor> & i : *pImageItemList) + WriteImage( i.get() ); } m_xWriteDocumentHandler->endElement( ELEMENT_NS_IMAGES ); @@ -757,9 +757,9 @@ void OWriteImagesDocumentHandler::WriteExternalImageList( const ExternalImageIte m_xWriteDocumentHandler->startElement( ELEMENT_NS_EXTERNALIMAGES, m_xEmptyList ); m_xWriteDocumentHandler->ignorableWhitespace( OUString() ); - for ( size_t i = 0; i < pExternalImageList->size(); i++ ) + for (const auto & i : *pExternalImageList) { - const ExternalImageItemDescriptor* pItem = (*pExternalImageList)[i].get(); + const ExternalImageItemDescriptor* pItem = i.get(); WriteExternalImage( pItem ); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits