[Libreoffice-commits] core.git: sfx2/source

Julien Nabet serval2412 at yahoo.fr
Wed Feb 7 05:30:55 UTC 2018


 sfx2/source/appl/appopen.cxx              |    4 +--
 sfx2/source/appl/linksrc.cxx              |    4 +--
 sfx2/source/appl/lnkbase2.cxx             |   14 ++++-------
 sfx2/source/control/bindings.cxx          |   13 +++-------
 sfx2/source/control/dispatch.cxx          |   14 ++++-------
 sfx2/source/control/emojiview.cxx         |   16 +++++-------
 sfx2/source/control/objface.cxx           |    8 +++---
 sfx2/source/control/templatelocalview.cxx |   35 +++++++++++----------------
 sfx2/source/control/thumbnailviewacc.cxx  |   38 ++++++++++++------------------
 sfx2/source/control/unoctitm.cxx          |    4 +--
 sfx2/source/dialog/dialoghelper.cxx       |    7 ++---
 sfx2/source/dialog/filedlghelper.cxx      |   16 ++++++------
 sfx2/source/dialog/infobar.cxx            |   22 ++++++++---------
 13 files changed, 87 insertions(+), 108 deletions(-)

New commits:
commit 9751a273747a2a6ba80c8b2e6012d788eee7c461
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Tue Feb 6 19:25:01 2018 +0100

    Use for-range loops in sfx2 (part1)
    
    Change-Id: I1a06e105ca9f1151afca236c83e3e0c9d2679c6f
    Reviewed-on: https://gerrit.libreoffice.org/49318
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index cba90f661a86..c9a4d8ace070 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -703,10 +703,10 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
                 rReq.AppendItem(SfxStringItem(SID_DOC_SERVICE, aDocService));
             }
 
-            for(std::vector<OUString>::const_iterator i = aURLList.begin(); i != aURLList.end(); ++i)
+            for (auto const& url : aURLList)
             {
                 rReq.RemoveItem( SID_FILE_NAME );
-                rReq.AppendItem( SfxStringItem( SID_FILE_NAME, *i ) );
+                rReq.AppendItem( SfxStringItem( SID_FILE_NAME, url ) );
 
                 // Run synchronous, so that not the next document is loaded
                 // when rescheduling
diff --git a/sfx2/source/appl/linksrc.cxx b/sfx2/source/appl/linksrc.cxx
index dff4a7f9619f..f55bb31bab9d 100644
--- a/sfx2/source/appl/linksrc.cxx
+++ b/sfx2/source/appl/linksrc.cxx
@@ -111,8 +111,8 @@ public:
 
     ~SvLinkSource_Array_Impl()
     {
-        for(std::vector<SvLinkSource_Entry_Impl*>::const_iterator it = mvData.begin(); it != mvData.end(); ++it)
-            delete *it;
+        for (auto const& elem : mvData)
+            delete elem;
     }
 };
 
diff --git a/sfx2/source/appl/lnkbase2.cxx b/sfx2/source/appl/lnkbase2.cxx
index 5d6ae348cd76..cf59639cde9e 100644
--- a/sfx2/source/appl/lnkbase2.cxx
+++ b/sfx2/source/appl/lnkbase2.cxx
@@ -158,22 +158,20 @@ static DdeTopic* FindTopic( const OUString & rLinkName, sal_uInt16* pItemStt )
     OUString sService( sNm.getToken( 0, cTokenSeparator, nTokenPos ) );
 
     DdeServices& rSvc = DdeService::GetServices();
-    for (DdeServices::iterator aI = rSvc.begin(); aI != rSvc.end(); ++aI)
+    for (auto const& elem : rSvc)
     {
-        DdeService* pService = *aI;
-        if( pService->GetName() == sService )
+        if(elem->GetName() == sService)
         {
             // then we search for the Topic
             OUString sTopic( sNm.getToken( 0, cTokenSeparator, nTokenPos ) );
             if( pItemStt )
                 *pItemStt = nTokenPos;
 
-            std::vector<DdeTopic*>& rTopics = pService->GetTopics();
+            std::vector<DdeTopic*>& rTopics = elem->GetTopics();
 
-            for( std::vector<DdeTopic*>::iterator iterTopic = rTopics.begin();
-                 iterTopic != rTopics.end(); ++iterTopic )
-                if( (*iterTopic)->GetName() == sTopic )
-                    return *iterTopic;
+            for (auto const& topic : rTopics)
+                if( topic->GetName() == sTopic )
+                    return topic;
             break;
         }
     }
diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx
index c2511e29b541..87197d045ea5 100644
--- a/sfx2/source/control/bindings.cxx
+++ b/sfx2/source/control/bindings.cxx
@@ -184,8 +184,8 @@ SfxBindings::~SfxBindings()
     DeleteControllers_Impl();
 
     // Delete Caches
-    for(auto it = pImpl->pCaches.begin(); it != pImpl->pCaches.end(); ++it)
-        delete *it;
+    for (auto const& cache : pImpl->pCaches)
+        delete cache;
 
     DELETEZ( pImpl->pWorkWin );
 }
@@ -298,12 +298,9 @@ void SfxBindings::Update_Impl(SfxStateCache& rCache /*The up to date SfxStatusCa
 
 void SfxBindings::InvalidateSlotsInMap_Impl()
 {
-    InvalidateSlotMap::const_iterator pIter = pImpl->m_aInvalidateSlots.begin();
-    while ( pIter != pImpl->m_aInvalidateSlots.end() )
-    {
-        Invalidate( pIter->first );
-        ++pIter;
-    }
+    for (auto const& slot : pImpl->m_aInvalidateSlots)
+        Invalidate( slot.first );
+
     pImpl->m_aInvalidateSlots.clear();
 }
 
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index 5834d8923d11..b05bffb1030c 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -113,8 +113,8 @@ struct SfxDispatcher_Impl
     SfxRequestPtrArray aReqArr;
     ~SfxDispatcher_Impl()
     {
-        for (SfxRequestPtrArray::iterator aI = aReqArr.begin(), aEnd = aReqArr.end(); aI != aEnd; ++aI)
-            delete *aI;
+        for (auto const& req : aReqArr)
+            delete req;
     }
     SfxShellStack_Impl   aStack;        // active functionality
     Idle                 aIdle;        // for Flush
@@ -1549,14 +1549,12 @@ void SfxDispatcher::FlushImpl()
             {
                 //fdo#70703 if there is an outer FlushImpl then inform it that
                 //we have deleted this cluster
-                for (std::deque< std::deque<SfxToDo_Impl> >::iterator aI = xImp->aToDoCopyStack.begin();
-                    aI != xImp->aToDoCopyStack.end(); ++aI)
+                for (auto & elem : xImp->aToDoCopyStack)
                 {
-                    std::deque<SfxToDo_Impl> &v = *aI;
-                    for(std::deque<SfxToDo_Impl>::iterator aJ = v.begin(); aJ != v.end(); ++aJ)
+                    for (auto & subelem : elem)
                     {
-                        if (aJ->pCluster == i->pCluster)
-                            aJ->bDeleted = true;
+                        if (subelem.pCluster == i->pCluster)
+                            subelem.bDeleted = true;
                     }
                 }
             }
diff --git a/sfx2/source/control/emojiview.cxx b/sfx2/source/control/emojiview.cxx
index 0a572449c61d..a5e002a608e1 100644
--- a/sfx2/source/control/emojiview.cxx
+++ b/sfx2/source/control/emojiview.cxx
@@ -117,9 +117,8 @@ void EmojiView::Populate()
     node root = aEmojiInfo.get_document_root();
     std::vector<orcus::pstring> keys = root.keys();
 
-    for (auto it = keys.begin(), ite = keys.end(); it != ite; ++it)
+    for (auto const& key : keys)
     {
-        orcus::pstring key = *it;
         node value = root.child(key);
 
         if(value.type() == orcus::json::node_t::object)
@@ -129,25 +128,24 @@ void EmojiView::Populate()
             OUString sTitle, sCategory, sName;
             bool bDuplicate = false;
 
-            for (auto paramIter = aEmojiParams.begin(); paramIter != aEmojiParams.end(); ++paramIter)
+            for (auto const& emojiParam : aEmojiParams)
             {
-                orcus::pstring paramVal = *paramIter;
-                node prop = value.child(paramVal);
+                node prop = value.child(emojiParam);
 
                 // get values of parameters in AppendItem() function
-                if(paramVal == "unicode")
+                if(emojiParam == "unicode")
                 {
                     sTitle = rtl::OStringToOUString(OString( prop.string_value().get(), prop.string_value().size() ), RTL_TEXTENCODING_UTF8);
                 }
-                else if(paramVal == "category")
+                else if(emojiParam == "category")
                 {
                     sCategory = rtl::OStringToOUString(OString( prop.string_value().get(), prop.string_value().size() ), RTL_TEXTENCODING_UTF8);
                 }
-                else if(paramVal == "name")
+                else if(emojiParam == "name")
                 {
                     sName = rtl::OStringToOUString(OString( prop.string_value().get(), prop.string_value().size() ), RTL_TEXTENCODING_UTF8);
                 }
-                else if(paramVal == "duplicate")
+                else if(emojiParam == "duplicate")
                 {
                     bDuplicate = true;
                 }
diff --git a/sfx2/source/control/objface.cxx b/sfx2/source/control/objface.cxx
index d6af5c21d0b7..244c8781fee5 100644
--- a/sfx2/source/control/objface.cxx
+++ b/sfx2/source/control/objface.cxx
@@ -89,11 +89,11 @@ struct SfxInterface_Impl
 
     ~SfxInterface_Impl()
     {
-        for (SfxObjectUIArr_Impl::const_iterator it = aObjectBars.begin(); it != aObjectBars.end(); ++it)
-            delete *it;
+        for (auto const& objectBar : aObjectBars)
+            delete objectBar;
 
-        for (SfxObjectUIArr_Impl::const_iterator it = aChildWindows.begin(); it != aChildWindows.end(); ++it)
-            delete *it;
+        for (auto const& childWindow : aChildWindows)
+            delete childWindow;
     }
 };
 
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index ca96ca0ec8eb..76a44a02d65b 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -409,8 +409,7 @@ bool TemplateLocalView::removeRegion(const sal_uInt16 nItemId)
     sal_uInt16 nRegionId = USHRT_MAX;
 
     // Remove from the region cache list
-    std::vector<TemplateContainerItem*>::iterator pRegionIt;
-    for ( pRegionIt = maRegions.begin(); pRegionIt != maRegions.end();)
+    for (std::vector<TemplateContainerItem*>::iterator pRegionIt = maRegions.begin(); pRegionIt != maRegions.end();)
     {
         if ( (*pRegionIt)->mnId == nItemId )
         {
@@ -436,11 +435,10 @@ bool TemplateLocalView::removeRegion(const sal_uInt16 nItemId)
         return false;
 
     // Synchronize view regions ids with SfxDocumentTemplates
-    std::vector<TemplateContainerItem*>::iterator pRegionIter = maRegions.begin();
-    for ( ; pRegionIter != maRegions.end(); ++pRegionIter)
+    for (auto const& region : maRegions)
     {
-        if ((*pRegionIter)->mnRegionId > nRegionId)
-            --(*pRegionIter)->mnRegionId;
+        if (region->mnRegionId > nRegionId)
+            --region->mnRegionId;
     }
 
     return true;
@@ -555,11 +553,10 @@ bool TemplateLocalView::moveTemplate (const ThumbnailViewItem *pItem, const sal_
             }
 
             // Keep view document id synchronized with SfxDocumentTemplates
-            std::vector<ThumbnailViewItem*>::iterator pItemIter = mItemList.begin();
-            for (; pItemIter != mItemList.end(); ++pItemIter)
+            for (auto const& item : mItemList)
             {
-                if (static_cast<TemplateViewItem*>(*pItemIter)->mnDocId > pViewItem->mnDocId)
-                    --static_cast<TemplateViewItem*>(*pItemIter)->mnDocId;
+                if (static_cast<TemplateViewItem*>(item)->mnDocId > pViewItem->mnDocId)
+                    --static_cast<TemplateViewItem*>(item)->mnDocId;
             }
         }
 
@@ -665,11 +662,10 @@ void TemplateLocalView::moveTemplates(const std::set<const ThumbnailViewItem*, s
                     }
 
                     // Keep view document id synchronized with SfxDocumentTemplates
-                    std::vector<ThumbnailViewItem*>::iterator pItemIter = mItemList.begin();
-                    for (; pItemIter != mItemList.end(); ++pItemIter)
+                    for (auto const& item : mItemList)
                     {
-                        if (static_cast<TemplateViewItem*>(*pItemIter)->mnDocId > pViewItem->mnDocId)
-                            --static_cast<TemplateViewItem*>(*pItemIter)->mnDocId;
+                        if (static_cast<TemplateViewItem*>(item)->mnDocId > pViewItem->mnDocId)
+                            --static_cast<TemplateViewItem*>(item)->mnDocId;
                     }
                 }
             }
@@ -678,8 +674,8 @@ void TemplateLocalView::moveTemplates(const std::set<const ThumbnailViewItem*, s
         }
 
         // Remove items from the current view
-        for (std::vector<sal_uInt16>::iterator it = aItemIds.begin(); it != aItemIds.end(); ++it)
-            RemoveItem(*it);
+        for (auto const& itemId : aItemIds)
+            RemoveItem(itemId);
 
         if (refresh)
         {
@@ -731,12 +727,11 @@ bool TemplateLocalView::exportTo(const sal_uInt16 nItemId, const sal_uInt16 nReg
     {
         if (pRegItem->mnId == nRegionItemId)
         {
-            std::vector<TemplateItemProperties>::iterator aIter;
-            for (aIter = pRegItem->maTemplates.begin(); aIter != pRegItem->maTemplates.end(); ++aIter)
+            for (auto const& elem : pRegItem->maTemplates)
             {
-                if (aIter->nId == nItemId)
+                if (elem.nId == nItemId)
                 {
-                    return mpDocTemplates->CopyTo(pRegItem->mnRegionId,aIter->nDocId,rName);
+                    return mpDocTemplates->CopyTo(pRegItem->mnRegionId,elem.nDocId,rName);
                 }
             }
 
diff --git a/sfx2/source/control/thumbnailviewacc.cxx b/sfx2/source/control/thumbnailviewacc.cxx
index 4c03b46b6b11..4029b6792ce0 100644
--- a/sfx2/source/control/thumbnailviewacc.cxx
+++ b/sfx2/source/control/thumbnailviewacc.cxx
@@ -57,12 +57,11 @@ void ThumbnailViewAcc::FireAccessibleEvent( short nEventId, const uno::Any& rOld
         aEvtObject.NewValue = rNewValue;
         aEvtObject.OldValue = rOldValue;
 
-        for (::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator aIter( aTmpListeners.begin() ), aEnd( aTmpListeners.end() );
-            aIter != aEnd ; ++aIter)
+        for (auto const& tmpListener : aTmpListeners)
         {
             try
             {
-                (*aIter)->notifyEvent( aEvtObject );
+                tmpListener->notifyEvent( aEvtObject );
             }
             catch(const uno::Exception&)
             {
@@ -270,15 +269,15 @@ void SAL_CALL ThumbnailViewAcc::addAccessibleEventListener( const uno::Reference
 
     if( rxListener.is() )
     {
-        std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator aIter = mxEventListeners.begin();
         bool bFound = false;
 
-        while( !bFound && ( aIter != mxEventListeners.end() ) )
+        for (auto const& eventListener : mxEventListeners)
         {
-            if( *aIter == rxListener )
+            if( eventListener == rxListener )
+            {
                 bFound = true;
-            else
-                ++aIter;
+                break;
+            }
         }
 
         if (!bFound)
@@ -514,21 +513,17 @@ void SAL_CALL ThumbnailViewAcc::disposing()
     }
 
     // Inform all listeners that this objects is disposing.
-    ::std::vector<uno::Reference<accessibility::XAccessibleEventListener> >::const_iterator
-          aListenerIterator (aListenerListCopy.begin());
     lang::EventObject aEvent (static_cast<accessibility::XAccessible*>(this));
-    while (aListenerIterator != aListenerListCopy.end())
+    for (auto const& listener : aListenerListCopy)
     {
         try
         {
-            (*aListenerIterator)->disposing (aEvent);
+            listener->disposing (aEvent);
         }
         catch(const uno::Exception&)
         {
             // Ignore exceptions.
         }
-
-        ++aListenerIterator;
     }
 }
 
@@ -579,12 +574,11 @@ void ThumbnailViewItemAcc::FireAccessibleEvent( short nEventId, const uno::Any&
         aEvtObject.NewValue = rNewValue;
         aEvtObject.OldValue = rOldValue;
 
-        for (::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator aIter( aTmpListeners.begin() ), aEnd( aTmpListeners.end() );
-            aIter != aEnd ; ++aIter)
+        for (auto const& tmpListener : aTmpListeners)
         {
             try
             {
-                (*aIter)->notifyEvent( aEvtObject );
+                tmpListener->notifyEvent( aEvtObject );
             }
             catch(const uno::Exception&)
             {
@@ -778,15 +772,15 @@ void SAL_CALL ThumbnailViewItemAcc::addAccessibleEventListener( const uno::Refer
 
     if( rxListener.is() )
     {
-           ::std::vector< uno::Reference< accessibility::XAccessibleEventListener > >::const_iterator aIter = mxEventListeners.begin();
         bool bFound = false;
 
-        while( !bFound && ( aIter != mxEventListeners.end() ) )
+        for (auto const& eventListener : mxEventListeners)
         {
-            if( *aIter == rxListener )
+            if( eventListener == rxListener )
+            {
                 bFound = true;
-            else
-                ++aIter;
+                break;
+            }
         }
 
         if (!bFound)
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index 894b88f79dbd..1ebb919fbab7 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -538,8 +538,8 @@ void UsageInfo::save()
     {
         OString aUsageInfoMsg = "Document Type;Command;Count";
 
-        for (UsageMap::const_iterator it = maUsage.begin(); it != maUsage.end(); ++it)
-            aUsageInfoMsg += "\n" + it->first.toUtf8() + ";" + OString::number(it->second);
+        for (auto const& elem : maUsage)
+            aUsageInfoMsg += "\n" + elem.first.toUtf8() + ";" + OString::number(elem.second);
 
         sal_uInt64 written = 0;
         file.write(aUsageInfoMsg.pData->buffer, aUsageInfoMsg.getLength(), written);
diff --git a/sfx2/source/dialog/dialoghelper.cxx b/sfx2/source/dialog/dialoghelper.cxx
index 89f5124d9c97..035f8f5271cb 100644
--- a/sfx2/source/dialog/dialoghelper.cxx
+++ b/sfx2/source/dialog/dialoghelper.cxx
@@ -44,11 +44,10 @@ void setPreviewsToSamePlace(vcl::Window const *pParent, VclBuilderContainer *pPa
     if (aGrids.size() > 1)
     {
         std::shared_ptr<VclSizeGroup> xGroup(std::make_shared<VclSizeGroup>());
-        for (std::vector<vcl::Window*>::iterator aI = aGrids.begin(); aI != aGrids.end(); ++aI)
+        for (auto const& grid : aGrids)
         {
-            vcl::Window *pWindow = *aI;
-            pWindow->remove_from_all_size_groups();
-            pWindow->add_to_size_group(xGroup);
+            grid->remove_from_all_size_groups();
+            grid->add_to_size_group(xGroup);
         }
     }
 }
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 1ae72bddd3dc..12efb69e5645 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -1319,8 +1319,8 @@ void lcl_saveLastURLs(std::vector<OUString>& rpURLList,
                       ::std::vector< OUString >& lLastURLs )
 {
     lLastURLs.clear();
-    for(std::vector<OUString>::iterator i = rpURLList.begin(); i != rpURLList.end(); ++i)
-        lLastURLs.push_back(*i);
+    for (auto const& url : rpURLList)
+        lLastURLs.push_back(url);
 }
 
 void FileDialogHelper_Impl::implGetAndCacheFiles(const uno::Reference< XInterface >& xPicker, std::vector<OUString>& rpURLList, const std::shared_ptr<const SfxFilter>& pFilter)
@@ -2225,11 +2225,11 @@ void FileDialogHelper_Impl::addFilterPair( const OUString& rFilter,
 OUString FileDialogHelper_Impl::getFilterName( const OUString& rFilterWithExtension ) const
 {
     OUString sRet;
-    for( ::std::vector< css::beans::StringPair >::const_iterator pIter = maFilters.begin(); pIter != maFilters.end(); ++pIter )
+    for (auto const& filter : maFilters)
     {
-        if ( (*pIter).Second == rFilterWithExtension )
+        if (filter.Second == rFilterWithExtension)
         {
-            sRet = (*pIter).First;
+            sRet = filter.First;
             break;
         }
     }
@@ -2239,11 +2239,11 @@ OUString FileDialogHelper_Impl::getFilterName( const OUString& rFilterWithExtens
 OUString FileDialogHelper_Impl::getFilterWithExtension( const OUString& rFilter ) const
 {
     OUString sRet;
-    for( ::std::vector< css::beans::StringPair >::const_iterator pIter = maFilters.begin(); pIter != maFilters.end(); ++pIter )
+    for (auto const& filter : maFilters)
     {
-        if ( (*pIter).First == rFilter )
+        if ( filter.First == rFilter )
         {
-            sRet = (*pIter).Second;
+            sRet = filter.Second;
             break;
         }
     }
diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx
index 67c24f3e41b3..2946a5da5aac 100644
--- a/sfx2/source/dialog/infobar.cxx
+++ b/sfx2/source/dialog/infobar.cxx
@@ -278,11 +278,11 @@ void SfxInfoBarWindow::Resize()
     long nX = m_pCloseBtn->GetPosPixel().getX() - 15 * fScaleFactor;
     long nButtonGap = 5 * fScaleFactor;
 
-    for (auto it = m_aActionBtns.begin(); it != m_aActionBtns.end(); ++it)
+    for (auto const& actionBtn : m_aActionBtns)
     {
-        long nButtonWidth = (*it)->GetSizePixel().getWidth();
+        long nButtonWidth = actionBtn->GetSizePixel().getWidth();
         nX -= nButtonWidth;
-        (*it)->SetPosSizePixel(Point(nX, 5 * fScaleFactor), Size(nButtonWidth, 30 * fScaleFactor));
+        actionBtn->SetPosSizePixel(Point(nX, 5 * fScaleFactor), Size(nButtonWidth, 30 * fScaleFactor));
         nX -= nButtonGap;
     }
 
@@ -314,8 +314,8 @@ SfxInfoBarContainerWindow::~SfxInfoBarContainerWindow()
 
 void SfxInfoBarContainerWindow::dispose()
 {
-    for ( auto it = m_pInfoBars.begin( ); it != m_pInfoBars.end( ); ++it )
-        it->disposeAndClear();
+    for (auto & infoBar : m_pInfoBars)
+        infoBar.disposeAndClear();
     m_pInfoBars.clear( );
     Window::dispose();
 }
@@ -348,10 +348,10 @@ VclPtr<SfxInfoBarWindow> SfxInfoBarContainerWindow::appendInfoBar(const OUString
 
 VclPtr<SfxInfoBarWindow> SfxInfoBarContainerWindow::getInfoBar(const OUString& sId)
 {
-    for (auto it = m_pInfoBars.begin(); it != m_pInfoBars.end(); ++it)
+    for (auto const& infoBar : m_pInfoBars)
     {
-        if ((*it)->getId() == sId)
-            return *it;
+        if (infoBar->getId() == sId)
+            return infoBar;
     }
     return nullptr;
 }
@@ -376,10 +376,10 @@ void SfxInfoBarContainerWindow::removeInfoBar(VclPtr<SfxInfoBarWindow> const & p
 
     // Resize
     long nY = 0;
-    for (auto it = m_pInfoBars.begin(); it != m_pInfoBars.end(); ++it)
+    for (auto const& infoBar : m_pInfoBars)
     {
-        (*it)->SetPosPixel(Point(0, nY));
-        nY += (*it)->GetSizePixel().getHeight();
+        infoBar->SetPosPixel(Point(0, nY));
+        nY += infoBar->GetSizePixel().getHeight();
     }
 
     Size aSize = GetSizePixel();


More information about the Libreoffice-commits mailing list