summaryrefslogtreecommitdiff
path: root/sd/source/ui/view/ViewShellManager.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-02-14 09:10:23 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-02-15 07:48:14 +0100
commitc2429e3e95a4298f43c468f36a1a2832992dd40e (patch)
treef43bd173eabe863b896de6057b5aee2f92d808d5 /sd/source/ui/view/ViewShellManager.cxx
parentb89f239aa9d3d4660380bbd0c893aecde0986032 (diff)
loplugin:flatten in sd/source/ui/view
Change-Id: I28e75ec162cde89fe1aa7d85aecce7ce80878d88 Reviewed-on: https://gerrit.libreoffice.org/67828 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd/source/ui/view/ViewShellManager.cxx')
-rw-r--r--sd/source/ui/view/ViewShellManager.cxx120
1 files changed, 60 insertions, 60 deletions
diff --git a/sd/source/ui/view/ViewShellManager.cxx b/sd/source/ui/view/ViewShellManager.cxx
index d2c2975499c4..e562dfa93284 100644
--- a/sd/source/ui/view/ViewShellManager.cxx
+++ b/sd/source/ui/view/ViewShellManager.cxx
@@ -439,26 +439,26 @@ void ViewShellManager::Implementation::DeactivateViewShell (const ViewShell& rSh
maActiveViewShells.begin(),
maActiveViewShells.end(),
IsShell(&rShell)));
- if (iShell != maActiveViewShells.end())
- {
- UpdateLock aLocker (*this);
+ if (iShell == maActiveViewShells.end())
+ return;
- ShellDescriptor aDescriptor(*iShell);
- mrBase.GetDocShell()->Disconnect(dynamic_cast<ViewShell*>(aDescriptor.mpShell));
- maActiveViewShells.erase(iShell);
- TakeShellsFromStack(aDescriptor.mpShell);
+ UpdateLock aLocker (*this);
- // Deactivate sub shells.
- SubShellList::iterator iList (maActiveSubShells.find(&rShell));
- if (iList != maActiveSubShells.end())
- {
- SubShellSubList& rList (iList->second);
- while ( ! rList.empty())
- DeactivateSubShell(rShell, rList.front().mnId);
- }
+ ShellDescriptor aDescriptor(*iShell);
+ mrBase.GetDocShell()->Disconnect(dynamic_cast<ViewShell*>(aDescriptor.mpShell));
+ maActiveViewShells.erase(iShell);
+ TakeShellsFromStack(aDescriptor.mpShell);
- DestroyViewShell(aDescriptor);
+ // Deactivate sub shells.
+ SubShellList::iterator iList (maActiveSubShells.find(&rShell));
+ if (iList != maActiveSubShells.end())
+ {
+ SubShellSubList& rList (iList->second);
+ while ( ! rList.empty())
+ DeactivateSubShell(rShell, rList.front().mnId);
}
+
+ DestroyViewShell(aDescriptor);
}
void ViewShellManager::Implementation::ActivateShell (SfxShell& rShell)
@@ -489,26 +489,26 @@ void ViewShellManager::Implementation::DeactivateShell (const SfxShell& rShell)
maActiveViewShells.begin(),
maActiveViewShells.end(),
IsShell(&rShell)));
- if (iShell != maActiveViewShells.end())
- {
- UpdateLock aLocker (*this);
+ if (iShell == maActiveViewShells.end())
+ return;
- ShellDescriptor aDescriptor(*iShell);
- mrBase.GetDocShell()->Disconnect(dynamic_cast<ViewShell*>(aDescriptor.mpShell));
- maActiveViewShells.erase(iShell);
- TakeShellsFromStack(aDescriptor.mpShell);
+ UpdateLock aLocker (*this);
- // Deactivate sub shells.
- SubShellList::iterator iList (maActiveSubShells.find(&rShell));
- if (iList != maActiveSubShells.end())
- {
- SubShellSubList& rList (iList->second);
- while ( ! rList.empty())
- DeactivateSubShell(rShell, rList.front().mnId);
- }
+ ShellDescriptor aDescriptor(*iShell);
+ mrBase.GetDocShell()->Disconnect(dynamic_cast<ViewShell*>(aDescriptor.mpShell));
+ maActiveViewShells.erase(iShell);
+ TakeShellsFromStack(aDescriptor.mpShell);
- DestroyViewShell(aDescriptor);
+ // Deactivate sub shells.
+ SubShellList::iterator iList (maActiveSubShells.find(&rShell));
+ if (iList != maActiveSubShells.end())
+ {
+ SubShellSubList& rList (iList->second);
+ while ( ! rList.empty())
+ DeactivateSubShell(rShell, rList.front().mnId);
}
+
+ DestroyViewShell(aDescriptor);
}
void ViewShellManager::Implementation::ActivateSubShell (
@@ -817,38 +817,38 @@ void ViewShellManager::Implementation::TakeShellsFromStack (const SfxShell* pShe
break;
}
- if (pShell != nullptr)
+ if (pShell == nullptr)
+ return;
+
+ // 1. Deactivate our shells on the stack before they are removed so
+ // that during the Deactivation() calls the stack is still intact.
+ for (sal_uInt16 nIndex=0; true; nIndex++)
{
- // 1. Deactivate our shells on the stack before they are removed so
- // that during the Deactivation() calls the stack is still intact.
- for (sal_uInt16 nIndex=0; true; nIndex++)
- {
- SfxShell* pShellOnStack = mrBase.GetSubShell(nIndex);
- Deactivate(pShellOnStack);
- if (pShellOnStack == pShell)
- break;
- }
+ SfxShell* pShellOnStack = mrBase.GetSubShell(nIndex);
+ Deactivate(pShellOnStack);
+ if (pShellOnStack == pShell)
+ break;
+ }
- // 2. Remove the shells from the stack.
- while (true)
- {
- SfxShell* pShellOnStack = mrBase.GetSubShell(0);
- SAL_INFO("sd.view", OSL_THIS_FUNC << "removing shell " << pShellOnStack << " from stack");
- mrBase.RemoveSubShell(pShellOnStack);
- if (pShellOnStack == pShell)
- break;
- }
+ // 2. Remove the shells from the stack.
+ while (true)
+ {
+ SfxShell* pShellOnStack = mrBase.GetSubShell(0);
+ SAL_INFO("sd.view", OSL_THIS_FUNC << "removing shell " << pShellOnStack << " from stack");
+ mrBase.RemoveSubShell(pShellOnStack);
+ if (pShellOnStack == pShell)
+ break;
+ }
- // 3. Update the stack.
- if (mrBase.GetDispatcher() != nullptr)
- mrBase.GetDispatcher()->Flush();
+ // 3. Update the stack.
+ if (mrBase.GetDispatcher() != nullptr)
+ mrBase.GetDispatcher()->Flush();
- // Update the pointer to the top-most shell and set its undo manager
- // to the one of the previous top-most shell.
- mpTopShell = mrBase.GetSubShell(0);
- if (mpTopShell!=nullptr && pUndoManager!=nullptr && mpTopShell->GetUndoManager()==nullptr)
- mpTopShell->SetUndoManager(pUndoManager);
- }
+ // Update the pointer to the top-most shell and set its undo manager
+ // to the one of the previous top-most shell.
+ mpTopShell = mrBase.GetSubShell(0);
+ if (mpTopShell!=nullptr && pUndoManager!=nullptr && mpTopShell->GetUndoManager()==nullptr)
+ mpTopShell->SetUndoManager(pUndoManager);
#if OSL_DEBUG_LEVEL >= 2
SAL_INFO("sd.view", OSL_THIS_FUNC << "Sfx shell stack is:");