[Libreoffice-commits] core.git: scripting/source shell/source slideshow/source sot/source starmath/source stoc/source svl/source svtools/source

Noel Grandin noel at peralex.com
Wed May 11 06:55:07 UTC 2016


 scripting/source/provider/BrowseNodeFactoryImpl.cxx                  |   12 +--
 shell/source/unix/sysshell/recently_used_file_handler.cxx            |    6 -
 slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx |    4 -
 slideshow/source/engine/animationnodes/basecontainernode.cxx         |    4 -
 sot/source/base/filelist.cxx                                         |    4 -
 sot/source/sdstor/stgelem.cxx                                        |   16 ++---
 sot/source/sdstor/ucbstorage.cxx                                     |   19 ++---
 starmath/source/ElementsDockingWindow.cxx                            |   23 +++----
 starmath/source/cfgitem.cxx                                          |   12 +--
 starmath/source/dialog.cxx                                           |    8 +-
 starmath/source/document.cxx                                         |    3 
 starmath/source/ooxmlexport.cxx                                      |    4 -
 starmath/source/rtfexport.cxx                                        |    4 -
 starmath/source/symbol.cxx                                           |    6 -
 starmath/source/unomodel.cxx                                         |    3 
 starmath/source/utility.cxx                                          |   10 +--
 stoc/source/security/access_controller.cxx                           |    9 --
 svl/source/items/aeitem.cxx                                          |    4 -
 svl/source/items/itempool.cxx                                        |    3 
 svl/source/items/poolcach.cxx                                        |    9 +-
 svl/source/items/poolio.cxx                                          |    6 -
 svl/source/misc/sharecontrolfile.cxx                                 |   32 +++++-----
 svl/source/numbers/zforlist.cxx                                      |   12 +--
 svl/source/numbers/zformat.cxx                                       |   14 ++--
 svtools/source/brwbox/brwbox1.cxx                                    |    4 -
 svtools/source/brwbox/brwbox2.cxx                                    |   12 +--
 svtools/source/brwbox/datwin.cxx                                     |   14 ++--
 svtools/source/contnr/fileview.cxx                                   |    4 -
 svtools/source/contnr/foldertree.cxx                                 |    8 +-
 svtools/source/contnr/imivctl1.cxx                                   |    3 
 svtools/source/contnr/treelist.cxx                                   |    4 -
 svtools/source/contnr/treelistbox.cxx                                |    4 -
 svtools/source/control/autocmpledit.cxx                              |    6 -
 svtools/source/control/ctrlbox.cxx                                   |   15 +---
 svtools/source/control/headbar.cxx                                   |   11 +--
 svtools/source/control/ruler.cxx                                     |   12 +--
 svtools/source/control/tabbar.cxx                                    |   27 +++-----
 svtools/source/control/valueset.cxx                                  |    3 
 svtools/source/dialogs/insdlg.cxx                                    |   12 +--
 svtools/source/graphic/grfmgr2.cxx                                   |    4 -
 svtools/source/hatchwindow/ipwin.cxx                                 |    8 +-
 svtools/source/misc/imap.cxx                                         |   10 +--
 svtools/source/misc/transfer.cxx                                     |    4 -
 svtools/source/uno/framestatuslistener.cxx                           |    3 
 svtools/source/uno/statusbarcontroller.cxx                           |    3 
 svtools/source/uno/toolboxcontroller.cxx                             |    3 
 46 files changed, 186 insertions(+), 215 deletions(-)

New commits:
commit 265068d65b39688b8a4756dfbcd46453dd1f9b70
Author: Noel Grandin <noel at peralex.com>
Date:   Tue May 10 14:39:07 2016 +0200

    clang-tidy modernize-loop-convert in scripting to svtools
    
    Change-Id: I98229d14109cf243839d632feabde1391ea9bad5
    Reviewed-on: https://gerrit.libreoffice.org/24847
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
index cc63505..863860e 100644
--- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx
+++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
@@ -91,12 +91,12 @@ public:
 
         sal_Int32 numChildren = 0;
 
-        for ( size_t i = 0; i < m_Nodes.size(); i++ )
+        for (Reference<XBrowseNode> & xNode : m_Nodes)
         {
             Sequence< Reference < browse::XBrowseNode > > children;
             try
             {
-                children = m_Nodes[ i ]->getChildNodes();
+                children = xNode->getChildNodes();
                 seqs.push_back( children );
                 numChildren += children.getLength();
             }
@@ -128,11 +128,11 @@ public:
     {
         if ( !m_Nodes.empty() )
         {
-            for ( size_t i = 0 ; i < m_Nodes.size(); i++ )
+            for (Reference<XBrowseNode> & xNode : m_Nodes)
             {
                 try
                 {
-                    if ( m_Nodes[ i ]->hasChildNodes() )
+                    if ( xNode->hasChildNodes() )
                     {
                         return true;
                     }
@@ -538,9 +538,9 @@ public:
         std::vector< Reference< browse::XBrowseNode > > nodes =
             getAllBrowseNodes( xCtx );
 
-        for ( size_t i=0; i<nodes.size(); i++ )
+        for (Reference< browse::XBrowseNode > & xNode : nodes)
         {
-            m_vNodes.push_back( new DefaultBrowseNode( xCtx, nodes[ i ] ) );
+            m_vNodes.push_back( new DefaultBrowseNode( xCtx, xNode ) );
         }
         m_Name = "Root";
     }
diff --git a/shell/source/unix/sysshell/recently_used_file_handler.cxx b/shell/source/unix/sysshell/recently_used_file_handler.cxx
index ee9e697..cf399b1 100644
--- a/shell/source/unix/sysshell/recently_used_file_handler.cxx
+++ b/shell/source/unix/sysshell/recently_used_file_handler.cxx
@@ -150,16 +150,16 @@ namespace /* private */ {
         static OString escape_content(const string_t &text)
         {
             OStringBuffer aBuf;
-            for (size_t i = 0; i < text.length(); i++)
+            for (auto i : text)
             {
-                switch (text[i])
+                switch (i)
                 {
                     case '&':  aBuf.append("&");  break;
                     case '<':  aBuf.append("<");   break;
                     case '>':  aBuf.append(">");   break;
                     case '\'': aBuf.append("'"); break;
                     case '"':  aBuf.append("""); break;
-                    default:   aBuf.append(text[i]);  break;
+                    default:   aBuf.append(i);  break;
                 }
             }
             return aBuf.makeStringAndClear();
diff --git a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
index f629258..6b7cd60 100644
--- a/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
+++ b/slideshow/source/engine/OGLTrans/generic/OGLTrans_TransitionImpl.cxx
@@ -341,8 +341,8 @@ void Primitive::display(GLint primitiveTransformLocation, double nTime, double W
 
 void Primitive::applyOperations(glm::mat4& matrix, double nTime, double WidthScale, double HeightScale) const
 {
-    for(size_t i(0); i < Operations.size(); ++i)
-        Operations[i]->interpolate(matrix, nTime, WidthScale, HeightScale);
+    for(const auto & rOperation : Operations)
+        rOperation->interpolate(matrix, nTime, WidthScale, HeightScale);
     matrix = glm::scale(matrix, glm::vec3(WidthScale, HeightScale, 1));
 }
 
diff --git a/slideshow/source/engine/animationnodes/basecontainernode.cxx b/slideshow/source/engine/animationnodes/basecontainernode.cxx
index 5953346..df4b097 100644
--- a/slideshow/source/engine/animationnodes/basecontainernode.cxx
+++ b/slideshow/source/engine/animationnodes/basecontainernode.cxx
@@ -174,10 +174,10 @@ void BaseContainerNode::repeat()
 #if defined(DBG_UTIL)
 void BaseContainerNode::showState() const
 {
-    for( std::size_t i=0; i<maChildren.size(); ++i )
+    for(const auto & i : maChildren)
     {
         BaseNodeSharedPtr pNode =
-            std::dynamic_pointer_cast<BaseNode>(maChildren[i]);
+            std::dynamic_pointer_cast<BaseNode>(i);
         SAL_INFO("slideshow.verbose",
                  "Node connection: n" <<
                  debugGetNodeName(this) <<
diff --git a/sot/source/base/filelist.cxx b/sot/source/base/filelist.cxx
index 4934644..b22e2c6 100644
--- a/sot/source/base/filelist.cxx
+++ b/sot/source/base/filelist.cxx
@@ -48,8 +48,8 @@ void FileList::ClearAll()
 
 FileList& FileList::operator=( const FileList& rFileList )
 {
-    for ( size_t i = 0, n = rFileList.aStrList.size(); i < n; ++i )
-        aStrList.push_back( rFileList.aStrList[ i ] );
+    for (const auto & i : rFileList.aStrList)
+        aStrList.push_back( i );
     return *this;
 }
 
diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx
index 7e2c5fb..fc26900 100644
--- a/sot/source/sdstor/stgelem.cxx
+++ b/sot/source/sdstor/stgelem.cxx
@@ -145,8 +145,8 @@ bool StgHeader::Load( SvStream& r )
      .ReadInt32( m_nDataFATSize )               // 40 # of data FATpages
      .ReadInt32( m_nMasterChain )               // 44 chain to the next master block
      .ReadInt32( m_nMaster );                   // 48 # of additional master blocks
-    for( short i = 0; i < cFATPagesInHeader; i++ )
-        r.ReadInt32( m_nMasterFAT[ i ] );
+    for(sal_Int32 & i : m_nMasterFAT)
+        r.ReadInt32( i );
 
     return (r.GetErrorCode() == ERRCODE_NONE) && Check();
 }
@@ -173,8 +173,8 @@ bool StgHeader::Store( StgIo& rIo )
      .WriteInt32( m_nDataFATSize )               // 40 # of data FAT pages
      .WriteInt32( m_nMasterChain )               // 44 chain to the next master block
      .WriteInt32( m_nMaster );                   // 48 # of additional master blocks
-    for( short i = 0; i < cFATPagesInHeader; i++ )
-        r.WriteInt32( m_nMasterFAT[ i ] );
+    for(sal_Int32 i : m_nMasterFAT)
+        r.WriteInt32( i );
     m_bDirty = sal_uInt8(!rIo.Good());
     return !m_bDirty;
 }
@@ -392,8 +392,8 @@ bool StgEntry::Load(const void* pFrom, sal_uInt32 nBufSize, sal_uInt64 nUnderlyi
         return false;
 
     SvMemoryStream r( const_cast<void *>(pFrom), nBufSize, StreamMode::READ );
-    for( short i = 0; i < 32; i++ )
-        r.ReadUtf16( m_nName[ i ] );             // 00 name as WCHAR
+    for(sal_Unicode & i : m_nName)
+        r.ReadUtf16( i );             // 00 name as WCHAR
     r.ReadUInt16( m_nNameLen )                   // 40 size of name in bytes including 00H
      .ReadUChar( m_cType )                      // 42 entry type
      .ReadUChar( m_cFlags )                     // 43 0 or 1 (tree balance?)
@@ -453,8 +453,8 @@ bool StgEntry::Load(const void* pFrom, sal_uInt32 nBufSize, sal_uInt64 nUnderlyi
 void StgEntry::Store( void* pTo )
 {
     SvMemoryStream r( pTo, 128, StreamMode::WRITE );
-    for( short i = 0; i < 32; i++ )
-        r.WriteUInt16( m_nName[ i ] );            // 00 name as WCHAR
+    for(sal_Unicode i : m_nName)
+        r.WriteUInt16( i );            // 00 name as WCHAR
     r.WriteUInt16( m_nNameLen )                   // 40 size of name in bytes including 00H
      .WriteUChar( m_cType )                      // 42 entry type
      .WriteUChar( m_cFlags )                     // 43 0 or 1 (tree balance?)
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index 8aa42b0..0d2ef5d 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -1871,9 +1871,8 @@ void UCBStorage_Impl::SetError( ErrCode nError )
 sal_Int32 UCBStorage_Impl::GetObjectCount()
 {
     sal_Int32 nCount = m_aChildrenList.size();
-    for ( size_t i = 0; i < m_aChildrenList.size(); ++i )
+    for (UCBStorageElement_Impl* pElement : m_aChildrenList)
     {
-        UCBStorageElement_Impl* pElement = m_aChildrenList[ i ];
         DBG_ASSERT( !pElement->m_bIsFolder || pElement->m_xStorage.Is(), "Storage should be open!" );
         if ( pElement->m_bIsFolder && pElement->m_xStorage.Is() )
             nCount += pElement->m_xStorage->GetObjectCount();
@@ -1928,9 +1927,8 @@ void UCBStorage_Impl::SetProps( const Sequence < Sequence < PropertyValue > >& r
         // the "FullPath" of a child always starts without '/'
         aPath.clear();
 
-    for ( size_t i = 0; i < m_aChildrenList.size(); ++i )
+    for (UCBStorageElement_Impl* pElement : m_aChildrenList)
     {
-        UCBStorageElement_Impl* pElement = m_aChildrenList[ i ];
         DBG_ASSERT( !pElement->m_bIsFolder || pElement->m_xStorage.Is(), "Storage should be open!" );
         if ( pElement->m_bIsFolder && pElement->m_xStorage.Is() )
             pElement->m_xStorage->SetProps( rSequence, aPath );
@@ -1980,9 +1978,8 @@ void UCBStorage_Impl::GetProps( sal_Int32& nProps, Sequence < Sequence < Propert
         aPath.clear();
 
     // now the properties of my elements
-    for ( size_t i = 0; i < m_aChildrenList.size(); ++i )
+    for (UCBStorageElement_Impl* pElement : m_aChildrenList)
     {
-        UCBStorageElement_Impl* pElement = m_aChildrenList[ i ];
         DBG_ASSERT( !pElement->m_bIsFolder || pElement->m_xStorage.Is(), "Storage should be open!" );
         if ( pElement->m_bIsFolder && pElement->m_xStorage.Is() )
             // storages add there properties by themselves ( see above )
@@ -2004,8 +2001,8 @@ void UCBStorage_Impl::GetProps( sal_Int32& nProps, Sequence < Sequence < Propert
 UCBStorage_Impl::~UCBStorage_Impl()
 {
     // first delete elements!
-    for ( size_t i = 0, n = m_aChildrenList.size(); i < n; ++i )
-        delete m_aChildrenList[ i ];
+    for (UCBStorageElement_Impl* i : m_aChildrenList)
+        delete i;
     m_aChildrenList.clear();
 
     delete m_pContent;
@@ -2444,9 +2441,8 @@ OUString UCBStorage::GetUserName()
 void UCBStorage::FillInfoList( SvStorageInfoList* pList ) const
 {
     // put information in childrenlist into StorageInfoList
-    for ( size_t i = 0; i < pImp->GetChildrenList().size(); ++i )
+    for (UCBStorageElement_Impl* pElement : pImp->GetChildrenList())
     {
-        UCBStorageElement_Impl* pElement = pImp->GetChildrenList()[ i ];
         if ( !pElement->m_bIsRemoved )
         {
             // problem: what about the size of a substorage ?!
@@ -2540,9 +2536,8 @@ bool UCBStorage::CopyStorageElement_Impl( UCBStorageElement_Impl& rElement, Base
 UCBStorageElement_Impl* UCBStorage::FindElement_Impl( const OUString& rName ) const
 {
     DBG_ASSERT( !rName.isEmpty(), "Name is empty!" );
-    for ( size_t i = 0, n = pImp->GetChildrenList().size(); i < n; ++i )
+    for (UCBStorageElement_Impl* pElement : pImp->GetChildrenList())
     {
-        UCBStorageElement_Impl* pElement = pImp->GetChildrenList()[ i ];
         if ( pElement->m_aName == rName && !pElement->m_bIsRemoved )
             return pElement;
     }
diff --git a/starmath/source/ElementsDockingWindow.cxx b/starmath/source/ElementsDockingWindow.cxx
index cd7d2c4..3dcfb70 100644
--- a/starmath/source/ElementsDockingWindow.cxx
+++ b/starmath/source/ElementsDockingWindow.cxx
@@ -285,9 +285,9 @@ void SmElementsControl::LayoutOrPaintContents(vcl::RenderContext *pContext)
     else
         boxX = nControlWidth / perLine;
 
-    for (size_t i = 0; i < maElementList.size() ; i++)
+    for (std::unique_ptr<SmElement> & i : maElementList)
     {
-        SmElement* element = maElementList[i].get();
+        SmElement* element = i.get();
         if (element->isSeparator())
         {
             if (mbVerticalMode)
@@ -397,9 +397,9 @@ void SmElementsControl::RequestHelp(const HelpEvent& rHEvt)
         if (!rHEvt.KeyboardActivated())
         {
             Point aHelpEventPos(ScreenToOutputPixel(rHEvt.GetMousePosPixel()));
-            for (size_t i = 0; i < maElementList.size() ; i++)
+            for (std::unique_ptr<SmElement> & i : maElementList)
             {
-                SmElement* pElement = maElementList[i].get();
+                SmElement* pElement = i.get();
                 Rectangle aRect(pElement->mBoxLocation, pElement->mBoxSize);
                 if (aRect.IsInside(aHelpEventPos))
                 {
@@ -439,9 +439,9 @@ void SmElementsControl::MouseMove( const MouseEvent& rMouseEvent )
     mpCurrentElement = nullptr;
     if (Rectangle(Point(0, 0), GetOutputSizePixel()).IsInside(rMouseEvent.GetPosPixel()))
     {
-        for (size_t i = 0; i < maElementList.size() ; i++)
+        for (std::unique_ptr<SmElement> & i : maElementList)
         {
-            SmElement* element = maElementList[i].get();
+            SmElement* element = i.get();
             Rectangle rect(element->mBoxLocation, element->mBoxSize);
             if (rect.IsInside(rMouseEvent.GetPosPixel()))
             {
@@ -465,9 +465,9 @@ void SmElementsControl::MouseButtonDown(const MouseEvent& rMouseEvent)
 
     if (rMouseEvent.IsLeft() && Rectangle(Point(0, 0), GetOutputSizePixel()).IsInside(rMouseEvent.GetPosPixel()) && maSelectHdlLink.IsSet())
     {
-        for (size_t i = 0; i < maElementList.size() ; i++)
+        for (std::unique_ptr<SmElement> & i : maElementList)
         {
-            SmElement* element = maElementList[i].get();
+            SmElement* element = i.get();
             Rectangle rect(element->mBoxLocation, element->mBoxSize);
             if (rect.IsInside(rMouseEvent.GetPosPixel()))
             {
@@ -709,9 +709,9 @@ SmElementsDockingWindow::SmElementsDockingWindow(SfxBindings* pInputBindings, Sf
 
     mpElementListBox->SetDropDownLineCount( SAL_N_ELEMENTS(aCategories) );
 
-    for (sal_uInt16 i = 0; i < SAL_N_ELEMENTS(aCategories) ; i++)
+    for (sal_uInt16 nCategory : aCategories)
     {
-        mpElementListBox->InsertEntry(SM_RESSTR(aCategories[i]));
+        mpElementListBox->InsertEntry(SM_RESSTR(nCategory));
     }
 
     mpElementListBox->SetSelectHdl(LINK(this, SmElementsDockingWindow, ElementSelectedHandle));
@@ -766,9 +766,8 @@ IMPL_LINK_TYPED(SmElementsDockingWindow, SelectClickHandler, SmElement&, rElemen
 
 IMPL_LINK_TYPED( SmElementsDockingWindow, ElementSelectedHandle, ListBox&, rList, void)
 {
-    for (sal_uInt16 i = 0; i < SAL_N_ELEMENTS(aCategories) ; i++)
+    for (sal_uInt16 aCurrentCategory : aCategories)
     {
-        sal_uInt16 aCurrentCategory = aCategories[i];
         OUString aCurrentCategoryString = SM_RESSTR(aCurrentCategory);
         if (aCurrentCategoryString == rList.GetSelectEntry())
         {
diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx
index 263f2da..5cf8817 100644
--- a/starmath/source/cfgitem.cxx
+++ b/starmath/source/cfgitem.cxx
@@ -253,11 +253,11 @@ const SmFontFormat * SmFontFormatList::GetFontFormat( const OUString &rFntFmtId
 {
     const SmFontFormat *pRes = nullptr;
 
-    for (size_t i = 0;  i < aEntries.size();  ++i)
+    for (const auto & rEntry : aEntries)
     {
-        if (aEntries[i].aId == rFntFmtId)
+        if (rEntry.aId == rFntFmtId)
         {
-            pRes = &aEntries[i].aFntFmt;
+            pRes = &rEntry.aFntFmt;
             break;
         }
     }
@@ -279,11 +279,11 @@ const OUString SmFontFormatList::GetFontFormatId( const SmFontFormat &rFntFmt )
 {
     OUString aRes;
 
-    for (size_t i = 0;  i < aEntries.size();  ++i)
+    for (const auto & rEntry : aEntries)
     {
-        if (aEntries[i].aFntFmt == rFntFmt)
+        if (rEntry.aFntFmt == rFntFmt)
         {
-            aRes = aEntries[i].aId;
+            aRes = rEntry.aId;
             break;
         }
     }
diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx
index d3dbffd..ccccfea 100644
--- a/starmath/source/dialog.cxx
+++ b/starmath/source/dialog.cxx
@@ -923,8 +923,8 @@ SmDistanceDialog::~SmDistanceDialog()
 
 void SmDistanceDialog::dispose()
 {
-    for (int i = 0; i < NOCATEGORIES; i++)
-        DELETEZ(Categories[i]);
+    for (SmCategoryDesc* & rpDesc : Categories)
+        DELETEZ(rpDesc);
     m_pFrame.clear();
     m_pFixedText1.clear();
     m_pMetricField1.clear();
@@ -1709,8 +1709,8 @@ void SmSymDefineDialog::FillSymbols(ComboBox &rComboBox, bool bDeleteText)
 
     ComboBox &rBox = &rComboBox == pOldSymbols ? *pOldSymbolSets : *pSymbolSets;
     SymbolPtrVec_t aSymSet( aSymbolMgrCopy.GetSymbolSet( rBox.GetText() ) );
-    for (size_t i = 0;  i < aSymSet.size();  ++i)
-        rComboBox.InsertEntry( aSymSet[i]->GetName() );
+    for (const SmSym* i : aSymSet)
+        rComboBox.InsertEntry( i->GetName() );
 }
 
 
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index ebe552a..8028a02 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -320,9 +320,8 @@ void SetEditEngineDefaultFonts(SfxItemPool &rEditEngineItemPool)
         aTable[1].nLang = aOpt.nDefaultLanguage_CJK;
         aTable[2].nLang = aOpt.nDefaultLanguage_CTL;
 
-        for (int i = 0;  i < 3;  ++i)
+        for (FontDta & rFntDta : aTable)
         {
-            const FontDta &rFntDta = aTable[i];
             LanguageType nLang = (LANGUAGE_NONE == rFntDta.nLang) ?
                     rFntDta.nFallbackLang : rFntDta.nLang;
             vcl::Font aFont = OutputDevice::GetDefaultFont(
diff --git a/starmath/source/ooxmlexport.cxx b/starmath/source/ooxmlexport.cxx
index 911ab81..1e79e68 100644
--- a/starmath/source/ooxmlexport.cxx
+++ b/starmath/source/ooxmlexport.cxx
@@ -498,10 +498,10 @@ void SmOoxmlExport::HandleBrace( const SmBraceNode* pNode, int nLevel )
             FSNS( XML_m, XML_val ), mathSymbolToString( pNode->ClosingBrace()).getStr(), FSEND );
 
     m_pSerializer->endElementNS( XML_m, XML_dPr );
-    for( size_t i = 0; i < subnodes.size(); ++i )
+    for(const SmNode* subnode : subnodes)
     {
         m_pSerializer->startElementNS( XML_m, XML_e, FSEND );
-        HandleNode( subnodes[ i ], nLevel + 1 );
+        HandleNode( subnode, nLevel + 1 );
         m_pSerializer->endElementNS( XML_m, XML_e );
     }
     m_pSerializer->endElementNS( XML_m, XML_d );
diff --git a/starmath/source/rtfexport.cxx b/starmath/source/rtfexport.cxx
index 0d50829..d8f9428 100644
--- a/starmath/source/rtfexport.cxx
+++ b/starmath/source/rtfexport.cxx
@@ -432,10 +432,10 @@ void SmRtfExport::HandleBrace(const SmBraceNode* pNode, int nLevel)
     m_pBuffer->append(mathSymbolToString(pNode->ClosingBrace(), m_nEncoding));
     m_pBuffer->append("}"); // mendChr
     m_pBuffer->append("}"); // mdPr
-    for (std::size_t i = 0; i < subnodes.size(); ++i)
+    for (const SmNode* subnode : subnodes)
     {
         m_pBuffer->append("{" LO_STRING_SVTOOLS_RTF_ME " ");
-        HandleNode(subnodes[ i ], nLevel + 1);
+        HandleNode(subnode, nLevel + 1);
         m_pBuffer->append("}"); // me
     }
     m_pBuffer->append("}"); // md
diff --git a/starmath/source/symbol.cxx b/starmath/source/symbol.cxx
index 0b3b54e..3e6442c 100644
--- a/starmath/source/symbol.cxx
+++ b/starmath/source/symbol.cxx
@@ -288,12 +288,12 @@ void SmSymbolManager::Save()
 
         SymbolPtrVec_t aTmp( GetSymbols() );
         std::vector< SmSym > aSymbols;
-        for (size_t i = 0; i < aTmp.size(); ++i)
+        for (const SmSym* i : aTmp)
         {
             // skip symbols from iGreek set since those symbols always get added
             // by computational means in SmSymbolManager::Load
-            if (aTmp[i]->GetSymbolSetName() != aSymbolSetName)
-                aSymbols.push_back( *aTmp[i] );
+            if (i->GetSymbolSetName() != aSymbolSetName)
+                aSymbols.push_back( *i );
         }
         rCfg.SetSymbols( aSymbols );
 
diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx
index cda93d4..6343bba 100644
--- a/starmath/source/unomodel.cxx
+++ b/starmath/source/unomodel.cxx
@@ -845,9 +845,8 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu
                 vector < const SmSym * > aVector;
 
                 const SymbolPtrVec_t aSymbols( rManager.GetSymbols() );
-                for (size_t i = 0; i < aSymbols.size(); ++i)
+                for (const SmSym* pSymbol : aSymbols)
                 {
-                    const SmSym * pSymbol = aSymbols[ i ];
                     if (pSymbol && !pSymbol->IsPredefined() &&
                         (!bUsedSymbolsOnly ||
                          rUsedSymbols.find( pSymbol->GetName() ) != rUsedSymbols.end()))
diff --git a/starmath/source/utility.cxx b/starmath/source/utility.cxx
index 00de175..0a1b61b 100644
--- a/starmath/source/utility.cxx
+++ b/starmath/source/utility.cxx
@@ -55,8 +55,8 @@ SmFontPickList& SmFontPickList::operator = (const SmFontPickList& rList)
 {
     Clear();
     nMaxItems = rList.nMaxItems;
-    for (size_t nPos = 0; nPos < rList.aFontVec.size(); nPos++)
-        aFontVec.push_back( rList.aFontVec[nPos] );
+    for (const auto & nPos : rList.aFontVec)
+        aFontVec.push_back( nPos );
 
     return *this;
 }
@@ -106,10 +106,10 @@ void SmFontPickList::Insert(const vcl::Font &rFont)
 
 void SmFontPickList::Update(const vcl::Font &rFont, const vcl::Font &rNewFont)
 {
-    for (size_t nPos = 0; nPos < aFontVec.size(); nPos++)
-        if (CompareItem( aFontVec[nPos], rFont ))
+    for (vcl::Font & rPos : aFontVec)
+        if (CompareItem( rPos, rFont ))
         {
-            aFontVec[nPos] = rNewFont;
+            rPos = rNewFont;
             break;
         }
 }
diff --git a/stoc/source/security/access_controller.cxx b/stoc/source/security/access_controller.cxx
index 13b5f3b..51094ed 100644
--- a/stoc/source/security/access_controller.cxx
+++ b/stoc/source/security/access_controller.cxx
@@ -541,9 +541,8 @@ void AccessController::checkAndClearPostPoned()
         case SINGLE_USER:
         {
             OSL_ASSERT( m_singleUser_init );
-            for ( size_t nPos = 0; nPos < vec.size(); ++nPos )
+            for (const auto & p : vec)
             {
-                pair< OUString, Any > const & p = vec[ nPos ];
                 OSL_ASSERT( m_singleUserId.equals( p.first ) );
                 m_singleUserPermissions.checkPermission( p.second );
             }
@@ -552,9 +551,8 @@ void AccessController::checkAndClearPostPoned()
         case SINGLE_DEFAULT_USER:
         {
             OSL_ASSERT( m_defaultPerm_init );
-            for ( size_t nPos = 0; nPos < vec.size(); ++nPos )
+            for (const auto & p : vec)
             {
-                pair< OUString, Any > const & p = vec[ nPos ];
                 OSL_ASSERT( p.first.isEmpty() ); // default-user
                 m_defaultPermissions.checkPermission( p.second );
             }
@@ -562,9 +560,8 @@ void AccessController::checkAndClearPostPoned()
         }
         case ON:
         {
-            for ( size_t nPos = 0; nPos < vec.size(); ++nPos )
+            for (const auto & p : vec)
             {
-                pair< OUString, Any > const & p = vec[ nPos ];
                 PermissionCollection const * pPermissions;
                 // lookup policy for user
                 {
diff --git a/svl/source/items/aeitem.cxx b/svl/source/items/aeitem.cxx
index 730aa17..c4f9f11 100644
--- a/svl/source/items/aeitem.cxx
+++ b/svl/source/items/aeitem.cxx
@@ -180,8 +180,8 @@ bool SfxAllEnumItem::IsEnabled( sal_uInt16 nValue ) const
 {
     if ( pDisabledValues )
     {
-        for ( size_t i=0; i<pDisabledValues->size(); i++ )
-            if ( (*pDisabledValues)[i] == nValue )
+        for (sal_uInt16 nDisabledValue : *pDisabledValues)
+            if ( nDisabledValue == nValue )
                 return false;
     }
 
diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx
index dda54dd..d0d1cee 100644
--- a/svl/source/items/itempool.cxx
+++ b/svl/source/items/itempool.cxx
@@ -245,9 +245,8 @@ SfxItemPool::SfxItemPool
         }
 
     // Copy Version map
-    for ( size_t nVer = 0; nVer < rPool.pImp->aVersions.size(); ++nVer )
+    for (std::shared_ptr<SfxPoolVersion_Impl>& pOld : rPool.pImp->aVersions)
     {
-        const SfxPoolVersion_ImplPtr pOld = rPool.pImp->aVersions[nVer];
         SfxPoolVersion_ImplPtr pNew = SfxPoolVersion_ImplPtr( new SfxPoolVersion_Impl( *pOld ) );
         pImp->aVersions.push_back( pNew );
     }
diff --git a/svl/source/items/poolcach.cxx b/svl/source/items/poolcach.cxx
index 994884b..947aee32 100644
--- a/svl/source/items/poolcach.cxx
+++ b/svl/source/items/poolcach.cxx
@@ -48,9 +48,9 @@ SfxItemPoolCache::SfxItemPoolCache( SfxItemPool *pItemPool,
 
 SfxItemPoolCache::~SfxItemPoolCache()
 {
-    for ( size_t nPos = 0; nPos < pCache->size(); ++nPos ) {
-        pPool->Remove( *(*pCache)[nPos].pPoolItem );
-        pPool->Remove( *(*pCache)[nPos].pOrigItem );
+    for (SfxItemModifyImpl & rImpl : *pCache) {
+        pPool->Remove( *rImpl.pPoolItem );
+        pPool->Remove( *rImpl.pOrigItem );
     }
     delete pCache; pCache = nullptr;
 
@@ -66,9 +66,8 @@ const SfxSetItem& SfxItemPoolCache::ApplyTo( const SfxSetItem &rOrigItem )
                 "original not in pool" );
 
     // Find whether this Transformations ever occurred
-    for ( size_t nPos = 0; nPos < pCache->size(); ++nPos )
+    for (SfxItemModifyImpl & rMapEntry : *pCache)
     {
-        SfxItemModifyImpl &rMapEntry = (*pCache)[nPos];
         if ( rMapEntry.pOrigItem == &rOrigItem )
         {
             // Did anything change at all?
diff --git a/svl/source/items/poolio.cxx b/svl/source/items/poolio.cxx
index 46c1c6a..d3837e9 100644
--- a/svl/source/items/poolio.cxx
+++ b/svl/source/items/poolio.cxx
@@ -155,10 +155,9 @@ SvStream &SfxItemPool::Store(SvStream &rStream) const
     // VersionMaps
     {
         SfxMultiVarRecordWriter aVerRec( &rStream, SFX_ITEMPOOL_REC_VERSIONMAP );
-        for ( size_t nVerNo = 0; nVerNo < pImp->aVersions.size(); ++nVerNo )
+        for (std::shared_ptr<SfxPoolVersion_Impl>& pVer : pImp->aVersions)
         {
             aVerRec.NewContent();
-            SfxPoolVersion_ImplPtr pVer = pImp->aVersions[nVerNo];
             rStream.WriteUInt16( pVer->_nVer ).WriteUInt16( pVer->_nStart ).WriteUInt16( pVer->_nEnd );
             sal_uInt16 nCount = pVer->_nEnd - pVer->_nStart + 1;
             sal_uInt16 nNewWhich = 0;
@@ -1078,9 +1077,8 @@ sal_uInt16 SfxItemPool::GetNewWhich
     else if ( nDiff < 0 )
     {
         // Map step by step from the top version down to the file version
-        for ( size_t nMap = 0; nMap < pImp->aVersions.size(); ++nMap )
+        for (std::shared_ptr<SfxPoolVersion_Impl>& pVerInfo : pImp->aVersions)
         {
-            SfxPoolVersion_ImplPtr pVerInfo = pImp->aVersions[nMap];
             if ( pVerInfo->_nVer > pImp->nLoadingVersion )
             {
                 if (nFileWhich >= pVerInfo->_nStart &&
diff --git a/svl/source/misc/sharecontrolfile.cxx b/svl/source/misc/sharecontrolfile.cxx
index 1630dd2..ca95115 100644
--- a/svl/source/misc/sharecontrolfile.cxx
+++ b/svl/source/misc/sharecontrolfile.cxx
@@ -205,11 +205,11 @@ void ShareControlFile::SetUsersDataAndStore( const std::vector< LockFileEntry >&
     m_xSeekable->seek( 0 );
 
     OUStringBuffer aBuffer;
-    for ( size_t nInd = 0; nInd < aUsersData.size(); nInd++ )
+    for (const auto & rData : aUsersData)
     {
         for ( LockFileComponent nEntryInd : o3tl::enumrange<LockFileComponent>() )
         {
-            aBuffer.append( EscapeCharacters( aUsersData[nInd][nEntryInd] ) );
+            aBuffer.append( EscapeCharacters( rData[nEntryInd] ) );
             if ( nEntryInd < LockFileComponent::LAST )
                 aBuffer.append( ',' );
             else
@@ -237,11 +237,11 @@ LockFileEntry ShareControlFile::InsertOwnEntry()
 
     bool bExists = false;
     sal_Int32 nNewInd = 0;
-    for ( size_t nInd = 0; nInd < m_aUsersData.size(); nInd++ )
+    for (LockFileEntry & rEntry : m_aUsersData)
     {
-        if ( m_aUsersData[nInd][LockFileComponent::LOCALHOST] == aNewEntry[LockFileComponent::LOCALHOST]
-             && m_aUsersData[nInd][LockFileComponent::SYSUSERNAME] == aNewEntry[LockFileComponent::SYSUSERNAME]
-             && m_aUsersData[nInd][LockFileComponent::USERURL] == aNewEntry[LockFileComponent::USERURL] )
+        if ( rEntry[LockFileComponent::LOCALHOST] == aNewEntry[LockFileComponent::LOCALHOST]
+             && rEntry[LockFileComponent::SYSUSERNAME] == aNewEntry[LockFileComponent::SYSUSERNAME]
+             && rEntry[LockFileComponent::USERURL] == aNewEntry[LockFileComponent::USERURL] )
         {
             if ( !bExists )
             {
@@ -251,7 +251,7 @@ LockFileEntry ShareControlFile::InsertOwnEntry()
         }
         else
         {
-            aNewData[nNewInd] = m_aUsersData[nInd];
+            aNewData[nNewInd] = rEntry;
         }
 
         nNewInd++;
@@ -278,11 +278,11 @@ bool ShareControlFile::HasOwnEntry()
     GetUsersData();
     LockFileEntry aEntry = GenerateOwnEntry();
 
-    for ( size_t nInd = 0; nInd < m_aUsersData.size(); ++nInd )
+    for (LockFileEntry & rEntry : m_aUsersData)
     {
-        if ( m_aUsersData[nInd][LockFileComponent::LOCALHOST] == aEntry[LockFileComponent::LOCALHOST] &&
-             m_aUsersData[nInd][LockFileComponent::SYSUSERNAME] == aEntry[LockFileComponent::SYSUSERNAME] &&
-             m_aUsersData[nInd][LockFileComponent::USERURL] == aEntry[LockFileComponent::USERURL] )
+        if ( rEntry[LockFileComponent::LOCALHOST] == aEntry[LockFileComponent::LOCALHOST] &&
+             rEntry[LockFileComponent::SYSUSERNAME] == aEntry[LockFileComponent::SYSUSERNAME] &&
+             rEntry[LockFileComponent::USERURL] == aEntry[LockFileComponent::USERURL] )
         {
             return true;
         }
@@ -308,13 +308,13 @@ void ShareControlFile::RemoveEntry( const LockFileEntry& aEntry )
 
     std::vector< LockFileEntry > aNewData;
 
-    for ( size_t nInd = 0; nInd < m_aUsersData.size(); nInd++ )
+    for (LockFileEntry & rEntry : m_aUsersData)
     {
-        if ( m_aUsersData[nInd][LockFileComponent::LOCALHOST] != aEntry[LockFileComponent::LOCALHOST]
-             || m_aUsersData[nInd][LockFileComponent::SYSUSERNAME] != aEntry[LockFileComponent::SYSUSERNAME]
-             || m_aUsersData[nInd][LockFileComponent::USERURL] != aEntry[LockFileComponent::USERURL] )
+        if ( rEntry[LockFileComponent::LOCALHOST] != aEntry[LockFileComponent::LOCALHOST]
+             || rEntry[LockFileComponent::SYSUSERNAME] != aEntry[LockFileComponent::SYSUSERNAME]
+             || rEntry[LockFileComponent::USERURL] != aEntry[LockFileComponent::USERURL] )
         {
-            aNewData.push_back( m_aUsersData[nInd] );
+            aNewData.push_back( rEntry );
         }
     }
 
diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx
index 3d00f07..91037ff 100644
--- a/svl/source/numbers/zforlist.cxx
+++ b/svl/source/numbers/zforlist.cxx
@@ -207,19 +207,19 @@ void SvNumberFormatterRegistry_Impl::ConfigurationChanged( utl::ConfigurationBro
 
     if ( nHint & SYSLOCALEOPTIONS_HINT_LOCALE )
     {
-        for( size_t i = 0, n = aFormatters.size(); i < n; ++i )
-            aFormatters[ i ]->ReplaceSystemCL( eSysLanguage );
+        for(SvNumberFormatter* pFormatter : aFormatters)
+            pFormatter->ReplaceSystemCL( eSysLanguage );
         eSysLanguage = MsLangId::getRealLanguage( LANGUAGE_SYSTEM );
     }
     if ( nHint & SYSLOCALEOPTIONS_HINT_CURRENCY )
     {
-        for( size_t i = 0, n = aFormatters.size(); i < n; ++i )
-            aFormatters[ i ]->ResetDefaultSystemCurrency();
+        for(SvNumberFormatter* pFormatter : aFormatters)
+            pFormatter->ResetDefaultSystemCurrency();
     }
     if ( nHint & SYSLOCALEOPTIONS_HINT_DATEPATTERNS )
     {
-        for( size_t i = 0, n = aFormatters.size(); i < n; ++i )
-            aFormatters[ i ]->InvalidateDateAcceptancePatterns();
+        for(SvNumberFormatter* pFormatter : aFormatters)
+            pFormatter->InvalidateDateAcceptancePatterns();
     }
 }
 
diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx
index bd1e21e..0529f27 100644
--- a/svl/source/numbers/zformat.cxx
+++ b/svl/source/numbers/zformat.cxx
@@ -1635,20 +1635,20 @@ void SvNumberformat::ConvertLanguage( SvNumberFormatter& rConverter,
         ImpCopyNumberformat( *pFormat );
         // Reset values taken over from Formatter/Scanner
         // pColor still points to table in temporary Formatter/Scanner
-        for ( sal_uInt16 i = 0; i < 4; i++ )
+        for (ImpSvNumFor & rFormatter : NumFor)
         {
-            OUString aColorName = NumFor[i].GetColorName();
+            OUString aColorName = rFormatter.GetColorName();
             Color* pColor = rScan.GetColor( aColorName );
-            NumFor[i].SetColor( pColor, aColorName );
+            rFormatter.SetColor( pColor, aColorName );
         }
     }
 }
 
 bool SvNumberformat::HasNewCurrency() const
 {
-    for ( sal_uInt16 j=0; j<4; j++ )
+    for (const auto & j : NumFor)
     {
-        if ( NumFor[j].HasNewCurrency() )
+        if ( j.HasNewCurrency() )
         {
             return true;
         }
@@ -1659,9 +1659,9 @@ bool SvNumberformat::HasNewCurrency() const
 bool SvNumberformat::GetNewCurrencySymbol( OUString& rSymbol,
                                            OUString& rExtension ) const
 {
-    for ( sal_uInt16 j=0; j<4; j++ )
+    for (const auto & j : NumFor)
     {
-        if ( NumFor[j].GetNewCurrencySymbol( rSymbol, rExtension ) )
+        if ( j.GetNewCurrencySymbol( rSymbol, rExtension ) )
         {
             return true;
         }
diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx
index 5b6229d..16cbb63 100644
--- a/svtools/source/brwbox/brwbox1.cxx
+++ b/svtools/source/brwbox/brwbox1.cxx
@@ -155,8 +155,8 @@ void BrowseBox::dispose()
     aHScroll.disposeAndClear();
 
     // free columns-space
-    for ( size_t i = 0, n = pCols->size(); i < n; ++i )
-        delete (*pCols)[ i ];
+    for (BrowserColumn* pCol : *pCols)
+        delete pCol;
     pCols->clear();
     delete pCols;
     delete pColSel;
diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx
index 32ed136..3625d24 100644
--- a/svtools/source/brwbox/brwbox2.cxx
+++ b/svtools/source/brwbox/brwbox2.cxx
@@ -141,11 +141,11 @@ void BrowseBox::StateChanged( StateChangedType nStateChange )
             pHeaderBar->SetZoom(GetZoom());
 
         // let the columns calculate their new widths and adjust the header bar
-        for ( size_t nPos = 0; nPos < pCols->size(); ++nPos )
+        for (BrowserColumn* pCol : *pCols)
         {
-            (*pCols)[ nPos ]->ZoomChanged(GetZoom());
+            pCol->ZoomChanged(GetZoom());
             if ( pHeaderBar )
-                pHeaderBar->SetItemSize( (*pCols)[ nPos ]->GetId(), (*pCols)[ nPos ]->Width() );
+                pHeaderBar->SetItemSize( pCol->GetId(), pCol->Width() );
         }
 
         // all our controls have to be repositioned
@@ -409,9 +409,9 @@ sal_uInt16 BrowseBox::GetColumnPos( sal_uInt16 nId ) const
 bool BrowseBox::IsFrozen( sal_uInt16 nColumnId ) const
 {
 
-    for ( size_t nPos = 0; nPos < pCols->size(); ++nPos )
-        if ( (*pCols)[ nPos ]->GetId() == nColumnId )
-            return (*pCols)[ nPos ]->IsFrozen();
+    for (BrowserColumn* pCol : *pCols)
+        if ( pCol->GetId() == nColumnId )
+            return pCol->IsFrozen();
     return false;
 }
 
diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx
index df66e02..11b43f6 100644
--- a/svtools/source/brwbox/datwin.cxx
+++ b/svtools/source/brwbox/datwin.cxx
@@ -223,8 +223,8 @@ void BrowserDataWin::dispose()
 {
     bInDtor = true;
 
-    for ( size_t i = 0, n = aInvalidRegion.size(); i < n; ++i )
-        delete aInvalidRegion[ i ];
+    for (Rectangle* i : aInvalidRegion)
+        delete i;
     aInvalidRegion.clear();
     pHeaderBar.clear();
     pEventWin.clear();
@@ -650,9 +650,9 @@ void BrowserDataWin::SetUpdateMode( bool bMode )
 
 void BrowserDataWin::DoOutstandingInvalidations()
 {
-    for ( size_t i = 0, n = aInvalidRegion.size(); i < n; ++i ) {
-        Control::Invalidate( *aInvalidRegion[ i ] );
-        delete aInvalidRegion[ i ];
+    for (Rectangle* i : aInvalidRegion) {
+        Control::Invalidate( *i );
+        delete i;
     }
     aInvalidRegion.clear();
 }
@@ -662,8 +662,8 @@ void BrowserDataWin::Invalidate( InvalidateFlags nFlags )
 {
     if ( !GetUpdateMode() )
     {
-        for ( size_t i = 0, n = aInvalidRegion.size(); i < n; ++i )
-            delete aInvalidRegion[ i ];
+        for (Rectangle* i : aInvalidRegion)
+            delete i;
         aInvalidRegion.clear();
         aInvalidRegion.push_back( new Rectangle( Point( 0, 0 ), GetOutputSizePixel() ) );
     }
diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx
index 7e338be..cd4d624 100644
--- a/svtools/source/contnr/fileview.cxx
+++ b/svtools/source/contnr/fileview.cxx
@@ -1356,9 +1356,9 @@ OUString SvtFileView::GetConfigString() const
 {
     ::std::vector< SvtContentEntry > aContent;
 
-    for( ::std::vector< SortingData_Impl* >::size_type i = 0; i < mpImp->maContent.size(); i++ )
+    for(SortingData_Impl* i : mpImp->maContent)
     {
-        SvtContentEntry aEntry( mpImp->maContent[i]->maTargetURL, mpImp->maContent[i]->mbIsFolder );
+        SvtContentEntry aEntry( i->maTargetURL, i->mbIsFolder );
         aContent.push_back( aEntry );
     }
 
diff --git a/svtools/source/contnr/foldertree.cxx b/svtools/source/contnr/foldertree.cxx
index d5732e2..40ed9d5 100644
--- a/svtools/source/contnr/foldertree.cxx
+++ b/svtools/source/contnr/foldertree.cxx
@@ -63,13 +63,13 @@ void FolderTree::FillTreeEntry( SvTreeListEntry* pEntry )
 
             if ( SUCCESS == eResult )
             {
-                for( std::vector<SortingData_Impl *>::size_type i = 0; i < aContent.size(); i++ )
+                for(SortingData_Impl* i : aContent)
                 {
-                    if( aContent[i]->mbIsFolder )
+                    if( i->mbIsFolder )
                     {
-                        SvTreeListEntry* pNewEntry = InsertEntry( aContent[i]->GetTitle(), pEntry, true );
+                        SvTreeListEntry* pNewEntry = InsertEntry( i->GetTitle(), pEntry, true );
 
-                        OUString* sData = new OUString( aContent[i]->maTargetURL );
+                        OUString* sData = new OUString( i->maTargetURL );
                         pNewEntry->SetUserData( static_cast< void* >( sData ) );
                     }
                 }
diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx
index 0629b61..05c2aa4 100644
--- a/svtools/source/contnr/imivctl1.cxx
+++ b/svtools/source/contnr/imivctl1.cxx
@@ -2739,9 +2739,8 @@ void SvxIconChoiceCtrl_Impl::AdjustAtGrid( const SvxIconChoiceCtrlEntryPtrVec& r
         bGo = false;
 
     long nCurRight = 0;
-    for( size_t nCur = 0; nCur < rRow.size(); nCur++ )
+    for(SvxIconChoiceCtrlEntry* pCur : rRow)
     {
-        SvxIconChoiceCtrlEntry* pCur = rRow[ nCur ];
         if( !bGo && pCur == pStart )
             bGo = true;
 
diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx
index 8f723f4..f7d9128 100644
--- a/svtools/source/contnr/treelist.cxx
+++ b/svtools/source/contnr/treelist.cxx
@@ -93,8 +93,8 @@ void SvTreeList::Broadcast(
 
 void SvTreeList::InsertView( SvListView* pView )
 {
-    for ( sal_uLong i = 0, n = aViewList.size(); i < n; ++i ) {
-        if ( aViewList[ i ] == pView ) {
+    for (SvListView* i : aViewList) {
+        if ( i == pView ) {
             return;
         }
     }
diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx
index 7a7e5a2..a7e291d 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -3277,8 +3277,8 @@ Size SvTreeListBox::GetOptimalSize() const
 {
     std::vector<long> aWidths;
     Size aRet(0, getPreferredDimensions(aWidths));
-    for (size_t i = 0; i < aWidths.size(); ++i)
-        aRet.Width() += aWidths[i];
+    for (long aWidth : aWidths)
+        aRet.Width() += aWidth;
     if (GetStyle() & WB_BORDER)
     {
         const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
diff --git a/svtools/source/control/autocmpledit.cxx b/svtools/source/control/autocmpledit.cxx
index 737f140..9443aeb 100644
--- a/svtools/source/control/autocmpledit.cxx
+++ b/svtools/source/control/autocmpledit.cxx
@@ -67,11 +67,11 @@ bool AutocompleteEdit::Match( const OUString& rText )
 
     m_aMatching.clear();
 
-    for( std::vector< OUString >::size_type i = 0; i < m_aEntries.size(); ++i )
+    for(const OUString & rEntry : m_aEntries)
     {
-        if( m_aEntries[i].startsWithIgnoreAsciiCase( rText ) )
+        if( rEntry.startsWithIgnoreAsciiCase( rText ) )
         {
-            m_aMatching.push_back( m_aEntries[i] );
+            m_aMatching.push_back( rEntry );
             bRet = true;
         }
     }
diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx
index e9810ad..e64b0a5 100644
--- a/svtools/source/control/ctrlbox.cxx
+++ b/svtools/source/control/ctrlbox.cxx
@@ -751,11 +751,8 @@ LineListBox::~LineListBox()
 
 void LineListBox::dispose()
 {
-    for ( size_t i = 0, n = pLineList->size(); i < n; ++i ) {
-        if ( (*pLineList)[ i ] ) {
-            delete (*pLineList)[ i ];
-        }
-    }
+    for (ImpLineListData* p : *pLineList)
+        delete p;
     pLineList->clear();
     delete pLineList;
     ListBox::dispose();
@@ -1217,9 +1214,9 @@ void FontNameBox::UserDraw( const UserDrawEvent& rUDEvt )
                 USCRIPT_GREEK
             };
 
-            for (size_t i = 0; i < SAL_N_ELEMENTS(aScripts); ++i)
+            for (const UScriptCode& rScript : aScripts)
             {
-                OUString sText = makeShortRepresentativeTextForScript(aScripts[i]);
+                OUString sText = makeShortRepresentativeTextForScript(rScript);
                 if (!sText.isEmpty())
                 {
                     bool bHasSampleTextGlyphs = (-1 == pRenderContext->HasGlyphs(aFont, sText));
@@ -1237,9 +1234,9 @@ void FontNameBox::UserDraw( const UserDrawEvent& rUDEvt )
                 USCRIPT_GREEK
             };
 
-            for (size_t i = 0; i < SAL_N_ELEMENTS(aMinimalScripts); ++i)
+            for (const UScriptCode& rMinimalScript : aMinimalScripts)
             {
-                OUString sText = makeShortMinimalTextForScript(aMinimalScripts[i]);
+                OUString sText = makeShortMinimalTextForScript(rMinimalScript);
                 if (!sText.isEmpty())
                 {
                     bool bHasSampleTextGlyphs = (-1 == pRenderContext->HasGlyphs(aFont, sText));
diff --git a/svtools/source/control/headbar.cxx b/svtools/source/control/headbar.cxx
index caa6bb0..b328124 100644
--- a/svtools/source/control/headbar.cxx
+++ b/svtools/source/control/headbar.cxx
@@ -113,8 +113,8 @@ void HeaderBar::dispose()
 {
     if (mpItemList)
     {
-        for ( size_t i = 0, n = mpItemList->size(); i < n; ++i )
-            delete (*mpItemList)[ i ];
+        for (ImplHeadItem* i : *mpItemList)
+            delete i;
         delete mpItemList;
         mpItemList = nullptr;
     }
@@ -1192,8 +1192,8 @@ void HeaderBar::MoveItem( sal_uInt16 nItemId, sal_uInt16 nNewPos )
 void HeaderBar::Clear()
 {
     // delete all items
-    for ( size_t i = 0, n = mpItemList->size(); i < n; ++i ) {
-        delete (*mpItemList)[ i ];
+    for (ImplHeadItem* i : *mpItemList) {
+        delete i;
     }
     mpItemList->clear();
 
@@ -1349,9 +1349,8 @@ Size HeaderBar::CalcWindowSizePixel() const
     long nMaxImageSize = 0;
     Size aSize( 0, GetTextHeight() );
 
-    for ( size_t i = 0, n = mpItemList->size(); i < n; ++i )
+    for (ImplHeadItem* pItem : *mpItemList)
     {
-        ImplHeadItem* pItem = (*mpItemList)[ i ];
         // take image size into account
         long nImageHeight = pItem->maImage.GetSizePixel().Height();
         if ( !(pItem->mnBits & (HeaderBarItemBits::LEFTIMAGE | HeaderBarItemBits::RIGHTIMAGE)) && !pItem->maText.isEmpty() )
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index 7127357..81c551d 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -421,9 +421,9 @@ void Ruler::ImplInvertLines(vcl::RenderContext& rRenderContext)
             aRect.Right() = nY;
 
         // Draw lines
-        for (size_t i = 0; i < mpData->pLines.size(); i++)
+        for (RulerLine & rLine : mpData->pLines)
         {
-            const long n = mpData->pLines[i].nPos + nNullWinOff;
+            const long n = rLine.nPos + nNullWinOff;
             if ((n >= nRulX1) && (n < nRulX2))
             {
                 if (mnWinStyle & WB_HORZ )
@@ -1020,17 +1020,17 @@ void Ruler::ImplDrawTab(vcl::RenderContext& rRenderContext, const Point& rPos, s
 
 void Ruler::ImplDrawTabs(vcl::RenderContext& rRenderContext, long nMin, long nMax, long nVirTop, long nVirBottom)
 {
-    for (size_t i = 0; i < mpData->pTabs.size(); i++)
+    for (RulerTab & rTab : mpData->pTabs)
     {
-        if (mpData->pTabs[i].nStyle & RULER_STYLE_INVISIBLE)
+        if (rTab.nStyle & RULER_STYLE_INVISIBLE)
             continue;
 
         long aPosition;
-        aPosition = mpData->pTabs[i].nPos;
+        aPosition = rTab.nPos;
         aPosition += +mpData->nNullVirOff;
         long nTopBottom = (GetStyle() & WB_RIGHT_ALIGNED) ? nVirTop : nVirBottom;
         if (nMin <= aPosition && aPosition <= nMax)
-            ImplDrawTab(rRenderContext, Point( aPosition, nTopBottom ), mpData->pTabs[i].nStyle);
+            ImplDrawTab(rRenderContext, Point( aPosition, nTopBottom ), rTab.nStyle);
     }
 }
 
diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx
index 9405c56..faa4ebf 100644
--- a/svtools/source/control/tabbar.cxx
+++ b/svtools/source/control/tabbar.cxx
@@ -506,9 +506,9 @@ struct TabBar_Impl
 
     ~TabBar_Impl()
     {
-        for (size_t i = 0; i < mpItemList.size(); ++i)
+        for (ImplTabBarItem* i : mpItemList)
         {
-            delete mpItemList[i];
+            delete i;
         }
         mpItemList.clear();
     }
@@ -708,9 +708,8 @@ bool TabBar::ImplCalcWidth()
         mnCurMaxWidth = 0;
 
     bool bChanged = false;
-    for (size_t i = 0; i < mpImpl->mpItemList.size(); ++i)
+    for (ImplTabBarItem* pItem : mpImpl->mpItemList)
     {
-        ImplTabBarItem* pItem = mpImpl->mpItemList[i];
         long nNewWidth = GetTextWidth(pItem->maText);
         if (mnCurMaxWidth && (nNewWidth > mnCurMaxWidth))
         {
@@ -747,9 +746,8 @@ void TabBar::ImplFormat()
 
     sal_uInt16 n = 0;
     long x = mnOffX;
-    for (size_t i = 0; i < mpImpl->mpItemList.size(); ++i)
+    for (ImplTabBarItem* pItem : mpImpl->mpItemList)
     {
-        ImplTabBarItem* pItem = mpImpl->mpItemList[i];
         // At all non-visible tabs an empty rectangle is set
         if ((n + 1 < mnFirstPos) || (x > mnLastOffX))
             pItem->maRect.SetEmpty();
@@ -1149,9 +1147,9 @@ void TabBar::MouseButtonDown(const MouseEvent& rMEvt)
                             bUpdate = true;
 
                         // deselect all selected items
-                        for (size_t i = 0; i < mpImpl->mpItemList.size(); ++i)
+                        for (ImplTabBarItem* i : mpImpl->mpItemList)
                         {
-                            pItem = mpImpl->mpItemList[i];
+                            pItem = i;
                             if (pItem->mbSelect || (pItem->mnId == mnCurPageId))
                             {
                                 pItem->mbSelect = false;
@@ -1800,9 +1798,9 @@ void TabBar::MovePage(sal_uInt16 nPageId, sal_uInt16 nNewPos)
 void TabBar::Clear()
 {
     // delete all items
-    for (size_t i = 0; i < mpImpl->mpItemList.size(); ++i)
+    for (ImplTabBarItem* i : mpImpl->mpItemList)
     {
-        delete mpImpl->mpItemList[i];
+        delete i;
     }
     mpImpl->mpItemList.clear();
 
@@ -1882,9 +1880,8 @@ sal_uInt16 TabBar::GetPagePos(sal_uInt16 nPageId) const
 
 sal_uInt16 TabBar::GetPageId(const Point& rPos) const
 {
-    for (size_t i = 0; i < mpImpl->mpItemList.size(); ++i)
+    for (ImplTabBarItem* pItem : mpImpl->mpItemList)
     {
-        ImplTabBarItem* pItem = mpImpl->mpItemList[i];
         if (pItem->maRect.IsInside(rPos))
             return pItem->mnId;
     }
@@ -2084,9 +2081,8 @@ void TabBar::SelectPage(sal_uInt16 nPageId, bool bSelect)
 sal_uInt16 TabBar::GetSelectPageCount() const
 {
     sal_uInt16 nSelected = 0;
-    for (size_t i = 0; i < mpImpl->mpItemList.size();  ++i)
+    for (ImplTabBarItem* pItem : mpImpl->mpItemList)
     {
-        ImplTabBarItem* pItem = mpImpl->mpItemList[i];
         if (pItem->mbSelect)
             nSelected++;
     }
@@ -2566,9 +2562,8 @@ Size TabBar::CalcWindowSizePixel() const
     if (mpImpl->mpItemList.size() > 0)
     {
         const_cast<TabBar*>(this)->ImplCalcWidth();
-        for (size_t i = 0; i < mpImpl->mpItemList.size(); ++i)
+        for (ImplTabBarItem* pItem : mpImpl->mpItemList)
         {
-            ImplTabBarItem* pItem = mpImpl->mpItemList[i];
             nWidth += pItem->mnWidth;
         }
     }
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index b2f58c2..e3bdbeb 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -2318,9 +2318,8 @@ Size ValueSet::GetLargestItemSize()
 {
     Size aLargestItem;
 
-    for (size_t i = 0, n = mItemList.size(); i < n; ++i)
+    for (ValueSetItem* pItem : mItemList)
     {
-        const ValueSetItem* pItem = mItemList[i];
         if (!pItem->mbVisible)
             continue;
 
diff --git a/svtools/source/dialogs/insdlg.cxx b/svtools/source/dialogs/insdlg.cxx
index 6033a74..b9a6f53 100644
--- a/svtools/source/dialogs/insdlg.cxx
+++ b/svtools/source/dialogs/insdlg.cxx
@@ -57,20 +57,20 @@ struct OleObjectDescriptor
 
 const SvObjectServer * SvObjectServerList::Get( const OUString & rHumanName ) const
 {
-    for( size_t i = 0; i < aObjectServerList.size(); i++ )
+    for(const auto & i : aObjectServerList)
     {
-        if( rHumanName == aObjectServerList[ i ].GetHumanName() )
-            return &aObjectServerList[ i ];
+        if( rHumanName == i.GetHumanName() )
+            return &i;
     }
     return nullptr;
 }
 
 const SvObjectServer * SvObjectServerList::Get( const SvGlobalName & rName ) const
 {
-    for( size_t i = 0; i < aObjectServerList.size(); i++ )
+    for(const auto & i : aObjectServerList)
     {
-        if( rName == aObjectServerList[ i ].GetClassName() )
-            return &aObjectServerList[ i ];
+        if( rName == i.GetClassName() )
+            return &i;
     }
     return nullptr;
 }
diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx
index 145f0fa..079dc93 100644
--- a/svtools/source/graphic/grfmgr2.cxx
+++ b/svtools/source/graphic/grfmgr2.cxx
@@ -49,8 +49,8 @@ GraphicManager::GraphicManager( sal_uLong nCacheSize, sal_uLong nMaxObjCacheSize
 
 GraphicManager::~GraphicManager()
 {
-    for( size_t i = 0, n = maObjList.size(); i < n; ++i )
-        maObjList[ i ]->GraphicManagerDestroyed();
+    for(GraphicObject* i : maObjList)
+        i->GraphicManagerDestroyed();
 
     delete mpCache;
 }
diff --git a/svtools/source/hatchwindow/ipwin.cxx b/svtools/source/hatchwindow/ipwin.cxx
index 786119b0..adb8df1 100644
--- a/svtools/source/hatchwindow/ipwin.cxx
+++ b/svtools/source/hatchwindow/ipwin.cxx
@@ -142,8 +142,8 @@ void SvResizeHelper::InvalidateBorder( vcl::Window * pWin )
 {
     Rectangle   aMoveRects[ 4 ];
     FillMoveRectsPixel( aMoveRects );
-    for( sal_uInt16 i = 0; i < 4; i++ )
-        pWin->Invalidate( aMoveRects[ i ] );
+    for(const auto & rMoveRect : aMoveRects)
+        pWin->Invalidate( rMoveRect );
 }
 
 /*************************************************************************
@@ -186,8 +186,8 @@ short SvResizeHelper::SelectMove( vcl::Window * pWin, const Point & rPos )
         // Move-Rect overlaps Handles
         Rectangle aMoveRects[ 4 ];
         FillMoveRectsPixel( aMoveRects );
-        for( sal_uInt16 i = 0; i < 4; i++ )
-            if( aMoveRects[ i ].IsInside( rPos ) )
+        for(const auto & rMoveRect : aMoveRects)
+            if( rMoveRect.IsInside( rPos ) )
                 return 8;
     }
     else
diff --git a/svtools/source/misc/imap.cxx b/svtools/source/misc/imap.cxx
index e1e5c59..544a5ee 100644
--- a/svtools/source/misc/imap.cxx
+++ b/svtools/source/misc/imap.cxx
@@ -611,8 +611,8 @@ ImageMap::~ImageMap()
 
 void ImageMap::ClearImageMap()
 {
-    for( size_t i = 0, n = maList.size(); i < n; ++i )
-        delete maList[ i ];
+    for(IMapObject* i : maList)
+        delete i;
     maList.clear();
 
     aName.clear();
@@ -788,9 +788,9 @@ IMapObject* ImageMap::GetHitIMapObject( const Size& rTotalSize,
 
     // walk over all objects and execute HitTest
     IMapObject* pObj = nullptr;
-    for( size_t i = 0, n = maList.size(); i < n; ++i ) {
-        if ( maList[ i ]->IsHit( aRelPoint ) ) {
-            pObj = maList[ i ];
+    for(IMapObject* i : maList) {
+        if ( i->IsHit( aRelPoint ) ) {
+            pObj = i;
             break;
         }
     }
diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
index dc77cf5..b00facb 100644
--- a/svtools/source/misc/transfer.cxx
+++ b/svtools/source/misc/transfer.cxx
@@ -126,8 +126,8 @@ static OUString ImplGetParameterString( const TransferableObjectDescriptor& rObj
         // the display name might contain unacceptable characters, encode all of them
         // this seems to be the only parameter currently that might contain such characters
         sal_Bool pToAccept[128];
-        for ( sal_Int32 nBInd = 0; nBInd < 128; nBInd++ )
-            pToAccept[nBInd] = false;
+        for (sal_Bool & rb : pToAccept)
+            rb = 0;
 
         const char aQuotedParamChars[] =
             "()<>@,;:/[]?=!#$&'*+-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`abcdefghijklmnopqrstuvwxyz{|}~. ";
diff --git a/svtools/source/uno/framestatuslistener.cxx b/svtools/source/uno/framestatuslistener.cxx
index aed1113..314934c 100644
--- a/svtools/source/uno/framestatuslistener.cxx
+++ b/svtools/source/uno/framestatuslistener.cxx
@@ -283,9 +283,8 @@ void FrameStatusListener::bindListener()
     {
         try
         {
-            for ( size_t i = 0; i < aDispatchVector.size(); i++ )
+            for (Listener & rListener : aDispatchVector)
             {
-                Listener& rListener = aDispatchVector[i];
                 if ( rListener.xDispatch.is() )
                     rListener.xDispatch->addStatusListener( xStatusListener, rListener.aURL );
             }
diff --git a/svtools/source/uno/statusbarcontroller.cxx b/svtools/source/uno/statusbarcontroller.cxx
index 430e22a..619e175 100644
--- a/svtools/source/uno/statusbarcontroller.cxx
+++ b/svtools/source/uno/statusbarcontroller.cxx
@@ -482,11 +482,10 @@ void StatusbarController::bindListener()
     if ( !xStatusListener.is() )
         return;
 
-    for ( size_t i = 0; i < aDispatchVector.size(); i++ )
+    for (Listener & rListener : aDispatchVector)
     {
         try
         {
-            Listener& rListener = aDispatchVector[i];
             if ( rListener.xDispatch.is() )
                 rListener.xDispatch->addStatusListener( xStatusListener, rListener.aURL );
             else if ( rListener.aURL.Complete == m_aCommandURL )
diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx
index ef779f3..eb455e5 100644
--- a/svtools/source/uno/toolboxcontroller.cxx
+++ b/svtools/source/uno/toolboxcontroller.cxx
@@ -545,9 +545,8 @@ void ToolboxController::bindListener()
     {
         try
         {
-            for ( size_t i = 0; i < aDispatchVector.size(); i++ )
+            for (Listener & rListener : aDispatchVector)
             {
-                Listener& rListener = aDispatchVector[i];
                 if ( rListener.xDispatch.is() )
                     rListener.xDispatch->addStatusListener( xStatusListener, rListener.aURL );
                 else if ( rListener.aURL.Complete == m_aCommandURL )


More information about the Libreoffice-commits mailing list