framework/source/uielement/popuptoolbarcontroller.cxx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
New commits: commit 64ed0dcf6dbd9567ec33cd07ca8a15c63e86b9df Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Nov 29 21:19:06 2021 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Tue Nov 30 11:16:47 2021 +0100 use more XPopupMenu methods over PopupMenu ones Change-Id: Ib60ae5db7097cd92cc7971fd8227b8753391da26 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126073 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx index 078022c6ac85..a061d6d60754 100644 --- a/framework/source/uielement/popuptoolbarcontroller.cxx +++ b/framework/source/uielement/popuptoolbarcontroller.cxx @@ -693,11 +693,11 @@ void SAL_CALL NewToolbarController::execute( sal_Int16 /*KeyModifier*/ ) OUString aURL, aTarget; if ( m_xPopupMenu.is() && m_nMenuId ) { - // TODO investigate how to wrap Get/SetUserValue in css::awt::XMenu SolarMutexGuard aSolarMutexGuard; - Menu* pVclMenu = comphelper::getFromUnoTunnel<VCLXMenu>( m_xPopupMenu )->GetMenu(); - aURL = pVclMenu->GetItemCommand( m_nMenuId ); + aURL = m_xPopupMenu->getCommand(m_nMenuId); + // TODO investigate how to wrap Get/SetUserValue in css::awt::XMenu + Menu* pVclMenu = comphelper::getFromUnoTunnel<VCLXMenu>( m_xPopupMenu )->GetMenu(); MenuAttributes* pMenuAttributes( static_cast<MenuAttributes*>( pVclMenu->GetUserValue( m_nMenuId ) ) ); if ( pMenuAttributes ) aTarget = pMenuAttributes->aTargetFrame; @@ -723,12 +723,11 @@ sal_uInt16 NewToolbarController::getMenuIdForCommand( std::u16string_view rComma { if ( m_xPopupMenu.is() && !rCommand.empty() ) { - Menu* pVclMenu( comphelper::getFromUnoTunnel<VCLXMenu>( m_xPopupMenu )->GetMenu() ); - sal_uInt16 nCount = pVclMenu->GetItemCount(); + sal_uInt16 nCount = m_xPopupMenu->getItemCount(); for ( sal_uInt16 n = 0; n < nCount; ++n ) { - sal_uInt16 nId = pVclMenu->GetItemId( n ); - OUString aCmd( pVclMenu->GetItemCommand( nId ) ); + sal_uInt16 nId = m_xPopupMenu->getItemId(n); + OUString aCmd(m_xPopupMenu->getCommand(nId)); // match even if the menu command is more detailed // (maybe an additional query) #i28667# @@ -750,9 +749,8 @@ void SAL_CALL NewToolbarController::updateImage() OUString aURL, aImageId; if ( m_xPopupMenu.is() && m_nMenuId ) { + aURL = m_xPopupMenu->getCommand(m_nMenuId); Menu* pVclMenu = comphelper::getFromUnoTunnel<VCLXMenu>( m_xPopupMenu )->GetMenu(); - aURL = pVclMenu->GetItemCommand( m_nMenuId ); - MenuAttributes* pMenuAttributes( static_cast<MenuAttributes*>( pVclMenu->GetUserValue( m_nMenuId ) ) ); if ( pMenuAttributes ) aImageId = pMenuAttributes->aImageId;