diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-07 20:32:26 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-04-08 11:01:31 +0200 |
commit | ff25a4a6f4b9763b09abbbd6a711fa4d18f40ade (patch) | |
tree | ded29238e8fb782c20b429f6d5df6c40a3bb2604 /framework/source/uielement/toolbarmodemenucontroller.cxx | |
parent | 32343bcbb786168df62f85a57e30c620c3d3bdb4 (diff) |
loplugin:flatten in framework
Change-Id: I2a74a7543b5edd853396efa31a3e2568e6607778
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91848
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework/source/uielement/toolbarmodemenucontroller.cxx')
-rw-r--r-- | framework/source/uielement/toolbarmodemenucontroller.cxx | 150 |
1 files changed, 75 insertions, 75 deletions
diff --git a/framework/source/uielement/toolbarmodemenucontroller.cxx b/framework/source/uielement/toolbarmodemenucontroller.cxx index 15596a091335..2cc438ebb9e9 100644 --- a/framework/source/uielement/toolbarmodemenucontroller.cxx +++ b/framework/source/uielement/toolbarmodemenucontroller.cxx @@ -168,43 +168,43 @@ void SAL_CALL ToolbarModeMenuController::statusChanged( const FeatureStateEvent& Reference< css::awt::XPopupMenu > xPopupMenu( m_xPopupMenu ); aLock.clear(); - if ( xPopupMenu.is() ) - { - SolarMutexGuard aGuard; - VCLXPopupMenu* pXPopupMenu = static_cast<VCLXPopupMenu *>(comphelper::getUnoTunnelImplementation<VCLXMenu>( xPopupMenu )); - PopupMenu* pVCLPopupMenu = pXPopupMenu ? static_cast<PopupMenu *>(pXPopupMenu->GetMenu()) : nullptr; + if ( !xPopupMenu.is() ) + return; - SAL_WARN_IF(!pVCLPopupMenu, "fwk.uielement", "worrying lack of popup menu"); - if (!pVCLPopupMenu) - return; + SolarMutexGuard aGuard; + VCLXPopupMenu* pXPopupMenu = static_cast<VCLXPopupMenu *>(comphelper::getUnoTunnelImplementation<VCLXMenu>( xPopupMenu )); + PopupMenu* pVCLPopupMenu = pXPopupMenu ? static_cast<PopupMenu *>(pXPopupMenu->GetMenu()) : nullptr; + + SAL_WARN_IF(!pVCLPopupMenu, "fwk.uielement", "worrying lack of popup menu"); + if (!pVCLPopupMenu) + return; + + bool bSetCheckmark = false; + bool bCheckmark = false; + for ( sal_uInt16 i = 0; i < pVCLPopupMenu->GetItemCount(); i++ ) + { + sal_uInt16 nId = pVCLPopupMenu->GetItemId( i ); + if ( nId == 0 ) + continue; - bool bSetCheckmark = false; - bool bCheckmark = false; - for ( sal_uInt16 i = 0; i < pVCLPopupMenu->GetItemCount(); i++ ) + OUString aCmd = pVCLPopupMenu->GetItemCommand( nId ); + if ( aCmd == aFeatureURL ) { - sal_uInt16 nId = pVCLPopupMenu->GetItemId( i ); - if ( nId == 0 ) - continue; + // Enable/disable item + pVCLPopupMenu->EnableItem( nId, Event.IsEnabled ); - OUString aCmd = pVCLPopupMenu->GetItemCommand( nId ); - if ( aCmd == aFeatureURL ) + // Checkmark + if ( Event.State >>= bCheckmark ) + bSetCheckmark = true; + + if ( bSetCheckmark ) + pVCLPopupMenu->CheckItem( nId, bCheckmark ); + else { - // Enable/disable item - pVCLPopupMenu->EnableItem( nId, Event.IsEnabled ); - - // Checkmark - if ( Event.State >>= bCheckmark ) - bSetCheckmark = true; - - if ( bSetCheckmark ) - pVCLPopupMenu->CheckItem( nId, bCheckmark ); - else - { - OUString aItemText; - - if ( Event.State >>= aItemText ) - pVCLPopupMenu->SetItemText( nId, aItemText ); - } + OUString aItemText; + + if ( Event.State >>= aItemText ) + pVCLPopupMenu->SetItemText( nId, aItemText ); } } } @@ -224,54 +224,54 @@ void SAL_CALL ToolbarModeMenuController::itemSelected( const css::awt::MenuEvent xFrame = m_xFrame; } - if ( xPopupMenu.is() ) - { - VCLXPopupMenu* pPopupMenu = static_cast<VCLXPopupMenu *>(comphelper::getUnoTunnelImplementation<VCLXMenu>( xPopupMenu )); - if ( pPopupMenu ) - { - SolarMutexGuard aSolarMutexGuard; - PopupMenu* pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu()); - OUString aCmd( pVCLPopupMenu->GetItemCommand( rEvent.MenuId )); + if ( !xPopupMenu.is() ) + return; - { - URL aTargetURL; - Sequence<PropertyValue> aArgs; - - aTargetURL.Complete = ".uno:Notebookbar?File:string=" + aCmd; - xURLTransformer->parseStrict( aTargetURL ); - Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); - if ( xDispatchProvider.is() ) - { - Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch( - aTargetURL, OUString(), 0 ); - - ExecuteInfo* pExecuteInfo = new ExecuteInfo; - pExecuteInfo->xDispatch = xDispatch; - pExecuteInfo->aTargetURL = aTargetURL; - pExecuteInfo->aArgs = aArgs; - Application::PostUserEvent( LINK(nullptr,ToolbarModeMenuController, ExecuteHdl_Impl), pExecuteInfo ); - } - } + VCLXPopupMenu* pPopupMenu = static_cast<VCLXPopupMenu *>(comphelper::getUnoTunnelImplementation<VCLXMenu>( xPopupMenu )); + if ( !pPopupMenu ) + return; - URL aTargetURL; - Sequence<PropertyValue> aArgs; + SolarMutexGuard aSolarMutexGuard; + PopupMenu* pVCLPopupMenu = static_cast<PopupMenu *>(pPopupMenu->GetMenu()); + OUString aCmd( pVCLPopupMenu->GetItemCommand( rEvent.MenuId )); - aTargetURL.Complete = ".uno:ToolbarMode?Mode:string=" + aCmd; - xURLTransformer->parseStrict( aTargetURL ); - Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); - if ( xDispatchProvider.is() ) - { - Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch( - aTargetURL, OUString(), 0 ); - - ExecuteInfo* pExecuteInfo = new ExecuteInfo; - pExecuteInfo->xDispatch = xDispatch; - pExecuteInfo->aTargetURL = aTargetURL; - pExecuteInfo->aArgs = aArgs; - Application::PostUserEvent( LINK(nullptr, ToolbarModeMenuController, ExecuteHdl_Impl), pExecuteInfo ); - } + { + URL aTargetURL; + Sequence<PropertyValue> aArgs; + + aTargetURL.Complete = ".uno:Notebookbar?File:string=" + aCmd; + xURLTransformer->parseStrict( aTargetURL ); + Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); + if ( xDispatchProvider.is() ) + { + Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch( + aTargetURL, OUString(), 0 ); + + ExecuteInfo* pExecuteInfo = new ExecuteInfo; + pExecuteInfo->xDispatch = xDispatch; + pExecuteInfo->aTargetURL = aTargetURL; + pExecuteInfo->aArgs = aArgs; + Application::PostUserEvent( LINK(nullptr,ToolbarModeMenuController, ExecuteHdl_Impl), pExecuteInfo ); } } + + URL aTargetURL; + Sequence<PropertyValue> aArgs; + + aTargetURL.Complete = ".uno:ToolbarMode?Mode:string=" + aCmd; + xURLTransformer->parseStrict( aTargetURL ); + Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); + if ( xDispatchProvider.is() ) + { + Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch( + aTargetURL, OUString(), 0 ); + + ExecuteInfo* pExecuteInfo = new ExecuteInfo; + pExecuteInfo->xDispatch = xDispatch; + pExecuteInfo->aTargetURL = aTargetURL; + pExecuteInfo->aArgs = aArgs; + Application::PostUserEvent( LINK(nullptr, ToolbarModeMenuController, ExecuteHdl_Impl), pExecuteInfo ); + } } void SAL_CALL ToolbarModeMenuController::itemActivated( const css::awt::MenuEvent& ) |