diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-06 10:09:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-02-07 08:19:14 +0100 |
commit | 536a6d6ca67d01c8470c242c6f1fd0750496eed4 (patch) | |
tree | cc2aed75621456aaeb31d26e910cc61baf3bfdd7 /sfx2/source/control/dispatch.cxx | |
parent | 53a318196859140deb4b3c317db583a90cfd604c (diff) |
loplugin:flatten in sfx2
Change-Id: If4e07d497ead58a2ff58b5fdedd282b8784be421
Reviewed-on: https://gerrit.libreoffice.org/67435
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/source/control/dispatch.cxx')
-rw-r--r-- | sfx2/source/control/dispatch.cxx | 214 |
1 files changed, 107 insertions, 107 deletions
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index b505412d3b4f..06c04362f763 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -314,72 +314,72 @@ void SfxDispatcher::Call_Impl(SfxShell& rShell, const SfxSlot &rSlot, SfxRequest SFX_STACK(SfxDispatcher::Call_Impl); // The slot may be called (meaning enabled) - if ( rSlot.IsMode(SfxSlotMode::FASTCALL) || rShell.CanExecuteSlot_Impl(rSlot) || rShell.IsConditionalFastCall(rReq)) + if ( !rSlot.IsMode(SfxSlotMode::FASTCALL) && !rShell.CanExecuteSlot_Impl(rSlot) && !rShell.IsConditionalFastCall(rReq) ) + return; + + if ( GetFrame() ) { - if ( GetFrame() ) - { - // Recording may start - css::uno::Reference< css::frame::XFrame > xFrame( - GetFrame()->GetFrame().GetFrameInterface(), - css::uno::UNO_QUERY); + // Recording may start + css::uno::Reference< css::frame::XFrame > xFrame( + GetFrame()->GetFrame().GetFrameInterface(), + css::uno::UNO_QUERY); - css::uno::Reference< css::beans::XPropertySet > xSet( - xFrame, - css::uno::UNO_QUERY); + css::uno::Reference< css::beans::XPropertySet > xSet( + xFrame, + css::uno::UNO_QUERY); - if ( xSet.is() ) - { - css::uno::Any aProp = xSet->getPropertyValue("DispatchRecorderSupplier"); - css::uno::Reference< css::frame::XDispatchRecorderSupplier > xSupplier; - css::uno::Reference< css::frame::XDispatchRecorder > xRecorder; - aProp >>= xSupplier; - if(xSupplier.is()) - xRecorder = xSupplier->getDispatchRecorder(); - - if ( bRecord && xRecorder.is() && !rSlot.IsMode(SfxSlotMode::NORECORD) ) - rReq.Record_Impl( rShell, rSlot, xRecorder, GetFrame() ); - } + if ( xSet.is() ) + { + css::uno::Any aProp = xSet->getPropertyValue("DispatchRecorderSupplier"); + css::uno::Reference< css::frame::XDispatchRecorderSupplier > xSupplier; + css::uno::Reference< css::frame::XDispatchRecorder > xRecorder; + aProp >>= xSupplier; + if(xSupplier.is()) + xRecorder = xSupplier->getDispatchRecorder(); + + if ( bRecord && xRecorder.is() && !rSlot.IsMode(SfxSlotMode::NORECORD) ) + rReq.Record_Impl( rShell, rSlot, xRecorder, GetFrame() ); } - // Get all that is needed, because the slot may not have survived the - // Execute if it is a 'pseudo slot' for macros or verbs. - bool bAutoUpdate = rSlot.IsMode(SfxSlotMode::AUTOUPDATE); + } + // Get all that is needed, because the slot may not have survived the + // Execute if it is a 'pseudo slot' for macros or verbs. + bool bAutoUpdate = rSlot.IsMode(SfxSlotMode::AUTOUPDATE); - // API-call parentheses and document-lock during the calls - { - // 'this' must respond in the Destructor - bool bThisDispatcherAlive = true; - bool *pOldInCallAliveFlag = xImp->pInCallAliveFlag; - xImp->pInCallAliveFlag = &bThisDispatcherAlive; + // API-call parentheses and document-lock during the calls + { + // 'this' must respond in the Destructor + bool bThisDispatcherAlive = true; + bool *pOldInCallAliveFlag = xImp->pInCallAliveFlag; + xImp->pInCallAliveFlag = &bThisDispatcherAlive; - SfxExecFunc pFunc = rSlot.GetExecFnc(); - rShell.CallExec( pFunc, rReq ); + SfxExecFunc pFunc = rSlot.GetExecFnc(); + rShell.CallExec( pFunc, rReq ); - // If 'this' is still alive - if ( bThisDispatcherAlive ) - xImp->pInCallAliveFlag = pOldInCallAliveFlag; - else + // If 'this' is still alive + if ( bThisDispatcherAlive ) + xImp->pInCallAliveFlag = pOldInCallAliveFlag; + else + { + if ( pOldInCallAliveFlag ) { - if ( pOldInCallAliveFlag ) - { - // also protect nested stack frames - *pOldInCallAliveFlag = false; - } - - // do nothing after this object is dead - return; + // also protect nested stack frames + *pOldInCallAliveFlag = false; } + + // do nothing after this object is dead + return; } + } - if ( rReq.IsDone() ) - { - SfxBindings *pBindings = GetBindings(); + if ( rReq.IsDone() ) + { + SfxBindings *pBindings = GetBindings(); - // When AutoUpdate update immediately - if ( bAutoUpdate && pBindings ) - { - pBindings->Invalidate(rSlot.GetSlotId()); - pBindings->Update(rSlot.GetSlotId()); - } + // When AutoUpdate update immediately + if ( bAutoUpdate && pBindings ) + { + pBindings->Invalidate(rSlot.GetSlotId()); + pBindings->Update(rSlot.GetSlotId()); } } } @@ -1075,58 +1075,58 @@ void SfxDispatcher::PostMsgHandler(std::unique_ptr<SfxRequest> pReq) SFX_STACK(SfxDispatcher::PostMsgHandler); // Has also the Pool not yet died? - if ( !pReq->IsCancelled() ) + if ( pReq->IsCancelled() ) + return; + + if ( !IsLocked() ) { - if ( !IsLocked() ) + Flush(); + SfxSlotServer aSvr; + if ( FindServer_(pReq->GetSlot(), aSvr ) ) // HACK(x), whatever that was supposed to mean { - Flush(); - SfxSlotServer aSvr; - if ( FindServer_(pReq->GetSlot(), aSvr ) ) // HACK(x), whatever that was supposed to mean - { - const SfxSlot *pSlot = aSvr.GetSlot(); - SfxShell *pSh = GetShell(aSvr.GetShellLevel()); + const SfxSlot *pSlot = aSvr.GetSlot(); + SfxShell *pSh = GetShell(aSvr.GetShellLevel()); - // When the pSlot is a "Pseudoslot" for macros or Verbs, it can - // be destroyed in the Call_Impl, thus do not use it anymore! - pReq->SetSynchronCall( false ); - Call_Impl( *pSh, *pSlot, *pReq, pReq->AllowsRecording() ); //! why bRecord? - } + // When the pSlot is a "Pseudoslot" for macros or Verbs, it can + // be destroyed in the Call_Impl, thus do not use it anymore! + pReq->SetSynchronCall( false ); + Call_Impl( *pSh, *pSlot, *pReq, pReq->AllowsRecording() ); //! why bRecord? } + } + else + { + if ( xImp->bLocked ) + xImp->aReqArr.emplace_back(std::move(pReq)); else - { - if ( xImp->bLocked ) - xImp->aReqArr.emplace_back(std::move(pReq)); - else - xImp->xPoster->Post(std::move(pReq)); - } + xImp->xPoster->Post(std::move(pReq)); } } void SfxDispatcher::SetMenu_Impl() { #if HAVE_FEATURE_DESKTOP - if ( xImp->pFrame ) + if ( !xImp->pFrame ) + return; + + SfxViewFrame* pTop = xImp->pFrame->GetTopViewFrame(); + if ( !pTop || pTop->GetBindings().GetDispatcher() != this ) + return; + + SfxFrame& rFrame = pTop->GetFrame(); + if ( !rFrame.IsMenuBarOn_Impl() ) + return; + + css::uno::Reference < css::beans::XPropertySet > xPropSet( rFrame.GetFrameInterface(), css::uno::UNO_QUERY ); + if ( xPropSet.is() ) { - SfxViewFrame* pTop = xImp->pFrame->GetTopViewFrame(); - if ( pTop && pTop->GetBindings().GetDispatcher() == this ) + css::uno::Reference< css::frame::XLayoutManager > xLayoutManager; + css::uno::Any aValue = xPropSet->getPropertyValue("LayoutManager"); + aValue >>= xLayoutManager; + if ( xLayoutManager.is() ) { - SfxFrame& rFrame = pTop->GetFrame(); - if ( rFrame.IsMenuBarOn_Impl() ) - { - css::uno::Reference < css::beans::XPropertySet > xPropSet( rFrame.GetFrameInterface(), css::uno::UNO_QUERY ); - if ( xPropSet.is() ) - { - css::uno::Reference< css::frame::XLayoutManager > xLayoutManager; - css::uno::Any aValue = xPropSet->getPropertyValue("LayoutManager"); - aValue >>= xLayoutManager; - if ( xLayoutManager.is() ) - { - OUString aMenuBarURL( "private:resource/menubar/menubar" ); - if ( !xLayoutManager->isElementVisible( aMenuBarURL ) ) - xLayoutManager->createElement( aMenuBarURL ); - } - } - } + OUString aMenuBarURL( "private:resource/menubar/menubar" ); + if ( !xLayoutManager->isElementVisible( aMenuBarURL ) ) + xLayoutManager->createElement( aMenuBarURL ); } } #endif @@ -1360,22 +1360,22 @@ void SfxDispatcher::Update_Impl_( bool bUIActive, bool bIsMDIApp, bool bIsIPOwne } } - if ( pTaskWin && ( bIsMDIApp || bIsIPOwner ) ) - { - bool bIsTaskActive = false; + if ( !pTaskWin || ( !bIsMDIApp && !bIsIPOwner ) ) + return; - SfxDispatcher *pActDispatcher = pTaskWin->GetBindings().GetDispatcher_Impl(); - if ( pActDispatcher && !bIsTaskActive ) - { - if ( this == pActDispatcher ) - bIsTaskActive = true; - } + bool bIsTaskActive = false; - if (bIsTaskActive && eStatBarId != StatusBarId::None && xImp->pFrame) - { - // internal frames also may control statusbar - xImp->pFrame->GetFrame().GetWorkWindow_Impl()->SetStatusBar_Impl(eStatBarId); - } + SfxDispatcher *pActDispatcher = pTaskWin->GetBindings().GetDispatcher_Impl(); + if ( pActDispatcher && !bIsTaskActive ) + { + if ( this == pActDispatcher ) + bIsTaskActive = true; + } + + if (bIsTaskActive && eStatBarId != StatusBarId::None && xImp->pFrame) + { + // internal frames also may control statusbar + xImp->pFrame->GetFrame().GetWorkWindow_Impl()->SetStatusBar_Impl(eStatBarId); } } |