diff options
author | Noel <noel.grandin@collabora.co.uk> | 2021-03-26 13:35:54 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-03-26 18:02:19 +0100 |
commit | b624b13b3d5a8e573c7de8158cadc66b1982d157 (patch) | |
tree | 56948e6a5e8d7f5a7cbde6328a27f13ecd8a72bc /framework/source | |
parent | 8136620ff432bf17815bef1f88c7531edb839d23 (diff) |
loplugin:flatten
Change-Id: Ib7a895fba66f8dc9b6501e61631c02694053b7fc
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113157
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework/source')
-rw-r--r-- | framework/source/uielement/resourcemenucontroller.cxx | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/framework/source/uielement/resourcemenucontroller.cxx b/framework/source/uielement/resourcemenucontroller.cxx index c56c91dc35e1..26198c0cf5f6 100644 --- a/framework/source/uielement/resourcemenucontroller.cxx +++ b/framework/source/uielement/resourcemenucontroller.cxx @@ -228,18 +228,18 @@ void ResourceMenuController::updatePopupMenu() framework::MenuBarManager::FillMenu( m_nNewMenuId, comphelper::getUnoTunnelImplementation<VCLXMenu>( m_xPopupMenu )->GetMenu(), m_aModuleName, m_xMenuContainer, m_xDispatchProvider ); // For context menus, add object verbs. - if ( m_bContextMenu ) + if ( !m_bContextMenu ) + return; + + css::util::URL aObjectMenuURL; + aObjectMenuURL.Complete = ".uno:ObjectMenue"; + m_xURLTransformer->parseStrict( aObjectMenuURL ); + css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( m_xFrame, css::uno::UNO_QUERY ); + css::uno::Reference< css::frame::XDispatch > xDispatch( xDispatchProvider->queryDispatch( aObjectMenuURL, OUString(), 0 ) ); + if ( xDispatch.is() ) { - css::util::URL aObjectMenuURL; - aObjectMenuURL.Complete = ".uno:ObjectMenue"; - m_xURLTransformer->parseStrict( aObjectMenuURL ); - css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( m_xFrame, css::uno::UNO_QUERY ); - css::uno::Reference< css::frame::XDispatch > xDispatch( xDispatchProvider->queryDispatch( aObjectMenuURL, OUString(), 0 ) ); - if ( xDispatch.is() ) - { - xDispatch->addStatusListener( this, aObjectMenuURL ); - xDispatch->removeStatusListener( this, aObjectMenuURL ); - } + xDispatch->addStatusListener( this, aObjectMenuURL ); + xDispatch->removeStatusListener( this, aObjectMenuURL ); } } @@ -503,29 +503,28 @@ void WindowListMenuController::itemActivated( const css::awt::MenuEvent& rEvent void WindowListMenuController::itemSelected( const css::awt::MenuEvent& rEvent ) { - if ( rEvent.MenuId >= START_ITEMID_WINDOWLIST && - rEvent.MenuId <= END_ITEMID_WINDOWLIST ) - { - // window list menu item selected - css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( m_xContext ); + if ( rEvent.MenuId < START_ITEMID_WINDOWLIST || rEvent.MenuId > END_ITEMID_WINDOWLIST ) + return; - sal_uInt16 nTaskId = START_ITEMID_WINDOWLIST; - css::uno::Reference< css::container::XIndexAccess > xList = xDesktop->getFrames(); - sal_Int32 nCount = xList->getCount(); - for ( sal_Int32 i=0; i<nCount; ++i ) - { - css::uno::Reference< css::frame::XFrame > xFrame; - xList->getByIndex(i) >>= xFrame; - if ( xFrame.is() && nTaskId == rEvent.MenuId ) - { - VclPtr<vcl::Window> pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); - pWin->GrabFocus(); - pWin->ToTop( ToTopFlags::RestoreWhenMin ); - break; - } + // window list menu item selected + css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create( m_xContext ); - nTaskId++; + sal_uInt16 nTaskId = START_ITEMID_WINDOWLIST; + css::uno::Reference< css::container::XIndexAccess > xList = xDesktop->getFrames(); + sal_Int32 nCount = xList->getCount(); + for ( sal_Int32 i=0; i<nCount; ++i ) + { + css::uno::Reference< css::frame::XFrame > xFrame; + xList->getByIndex(i) >>= xFrame; + if ( xFrame.is() && nTaskId == rEvent.MenuId ) + { + VclPtr<vcl::Window> pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); + pWin->GrabFocus(); + pWin->ToTop( ToTopFlags::RestoreWhenMin ); + break; } + + nTaskId++; } } |