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

Julien Nabet serval2412 at yahoo.fr
Fri Dec 1 06:11:34 UTC 2017


 sd/source/ui/view/ViewShellManager.cxx |   37 ++++++++++++---------------------
 1 file changed, 14 insertions(+), 23 deletions(-)

New commits:
commit 689d98f2bb51f16e1dfa8e35c0b1c0354a5a739a
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Thu Nov 30 21:36:34 2017 +0100

    Use for-range loops in ViewShellManager (sd)
    
    Change-Id: I753e3536b18bae5a162f78a8e30dc3bd89fa80a3
    Reviewed-on: https://gerrit.libreoffice.org/45620
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
    Tested-by: Julien Nabet <serval2412 at yahoo.fr>

diff --git a/sd/source/ui/view/ViewShellManager.cxx b/sd/source/ui/view/ViewShellManager.cxx
index 6938dce54226..463487eee215 100644
--- a/sd/source/ui/view/ViewShellManager.cxx
+++ b/sd/source/ui/view/ViewShellManager.cxx
@@ -644,10 +644,9 @@ SfxShell* ViewShellManager::Implementation::GetShell (ShellId nId) const
     else
     {
         // Now search the active sub shells of every active view shell.
-        SubShellList::const_iterator iList;
-        for (iList=maActiveSubShells.begin(); iList!=maActiveSubShells.end(); ++iList)
+        for (auto const& activeSubShell : maActiveSubShells)
         {
-            const SubShellSubList& rList (iList->second);
+            const SubShellSubList& rList (activeSubShell.second);
             SubShellSubList::const_iterator iSubShell(
                 ::std::find_if(rList.begin(),rList.end(), IsId(nId)));
             if (iSubShell != rList.end())
@@ -880,12 +879,11 @@ void ViewShellManager::Implementation::CreateShells()
             SubShellSubList& rList (iList->second);
 
             // Iterate over all sub shells of the current view shell.
-            SubShellSubList::iterator iSubShell;
-            for (iSubShell=rList.begin(); iSubShell!=rList.end(); ++iSubShell)
+            for (auto & subShell : rList)
             {
-                if (iSubShell->mpShell == nullptr)
+                if (subShell.mpShell == nullptr)
                 {
-                    *iSubShell = CreateSubShell(iShell->mpShell,iSubShell->mnId);
+                    subShell = CreateSubShell(iShell->mpShell,subShell.mnId);
                 }
             }
         }
@@ -941,13 +939,11 @@ IMPL_LINK(ViewShellManager::Implementation, WindowEventHandler, VclWindowEvent&,
         {
             case VclEventId::WindowGetFocus:
             {
-                for (ActiveShellList::iterator aI(maActiveViewShells.begin());
-                     aI!=maActiveViewShells.end();
-                     ++aI)
+                for (auto const& activeShell : maActiveViewShells)
                 {
-                    if (pEventWindow == aI->GetWindow())
+                    if (pEventWindow == activeShell.GetWindow())
                     {
-                        MoveToTop(*aI->mpShell);
+                        MoveToTop(*activeShell.mpShell);
                         break;
                     }
                 }
@@ -960,15 +956,11 @@ IMPL_LINK(ViewShellManager::Implementation, WindowEventHandler, VclWindowEvent&,
             case VclEventId::ObjectDying:
                 // Remember that we do not have to remove the window
                 // listener for this window.
-                for (ActiveShellList::iterator
-                         iShell(maActiveViewShells.begin()),
-                         iEnd(maActiveViewShells.end());
-                     iShell!=iEnd;
-                     ++iShell)
+                for (auto & activeViewShell : maActiveViewShells)
                 {
-                    if (iShell->GetWindow() == pEventWindow)
+                    if (activeViewShell.GetWindow() == pEventWindow)
                     {
-                        iShell->mbIsListenerAddedToWindow = false;
+                        activeViewShell.mbIsListenerAddedToWindow = false;
                         break;
                     }
                 }
@@ -1050,10 +1042,9 @@ void ViewShellManager::Implementation::InvalidateAllSubShells (const SfxShell* p
     if (iList != maActiveSubShells.end())
     {
         SubShellSubList& rList (iList->second);
-        SubShellSubList::iterator iShell;
-        for (iShell=rList.begin(); iShell!=rList.end(); ++iShell)
-            if (iShell->mpShell != nullptr)
-                iShell->mpShell->Invalidate();
+        for (auto const& shell : rList)
+            if (shell.mpShell != nullptr)
+                shell.mpShell->Invalidate();
     }
 }
 


More information about the Libreoffice-commits mailing list