framework/inc/uielement/newmenucontroller.hxx | 4 - framework/source/uielement/newmenucontroller.cxx | 39 +++++++++--------- framework/source/uielement/toolbarsmenucontroller.cxx | 11 ----- toolkit/source/awt/vclxmenu.cxx | 2 4 files changed, 23 insertions(+), 33 deletions(-)
New commits: commit 88b69059c34a6ff85f1e61d9bc8906bfd8e432aa Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Nov 29 11:57:55 2021 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Nov 29 21:21:12 2021 +0100 use more XPopupMenu methods over PopupMenu ones Change-Id: I54acdcb82b90d363e48543de99c75adea8fceb2a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126047 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/framework/inc/uielement/newmenucontroller.hxx b/framework/inc/uielement/newmenucontroller.hxx index 2c745cc2b64d..57e58239fc19 100644 --- a/framework/inc/uielement/newmenucontroller.hxx +++ b/framework/inc/uielement/newmenucontroller.hxx @@ -60,8 +60,8 @@ namespace framework void retrieveShortcutsFromConfiguration( const css::uno::Reference< css::ui::XAcceleratorConfiguration >& rAccelCfg, const css::uno::Sequence< OUString >& rCommands, std::vector< vcl::KeyCode >& aMenuShortCuts ); - void setAccelerators( PopupMenu* pPopupMenu ); - void determineAndSetNewDocAccel( PopupMenu* pPopupMenu, const vcl::KeyCode& rKeyCode ); + void setAccelerators(); + void determineAndSetNewDocAccel(const css::awt::KeyEvent& rKeyCode); void setMenuImages( PopupMenu* pPopupMenu, bool bSetImages ); private: diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx index 710f49c264d4..59e9160f8ced 100644 --- a/framework/source/uielement/newmenucontroller.cxx +++ b/framework/source/uielement/newmenucontroller.cxx @@ -22,6 +22,7 @@ #include <services.h> +#include <com/sun/star/awt/MenuItemType.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/ui/theModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> @@ -106,10 +107,10 @@ void NewMenuController::setMenuImages( PopupMenu* pPopupMenu, bool bSetImages ) } } -void NewMenuController::determineAndSetNewDocAccel( PopupMenu* pPopupMenu, const vcl::KeyCode& rKeyCode ) +void NewMenuController::determineAndSetNewDocAccel(const css::awt::KeyEvent& rKeyCode) { - sal_uInt16 nCount( pPopupMenu->GetItemCount() ); - sal_uInt16 nId( 0 ); + sal_uInt16 nCount(m_xPopupMenu->getItemCount()); + sal_uInt16 nId( 0 ); bool bFound( false ); OUString aCommand; @@ -119,13 +120,13 @@ void NewMenuController::determineAndSetNewDocAccel( PopupMenu* pPopupMenu, const for ( sal_uInt16 i = 0; i < nCount; i++ ) { - if ( pPopupMenu->GetItemType( i ) != MenuItemType::SEPARATOR ) + if (m_xPopupMenu->getItemType(i) != css::awt::MenuItemType_SEPARATOR) { - nId = pPopupMenu->GetItemId( i ); - aCommand = pPopupMenu->GetItemCommand( nId ); + nId = m_xPopupMenu->getItemId(i); + aCommand = m_xPopupMenu->getCommand(nId); if ( aCommand.startsWith( m_aEmptyDocURL ) ) { - pPopupMenu->SetAccelKey( nId, rKeyCode ); + m_xPopupMenu->setAcceleratorKeyEvent(nId, rKeyCode); bFound = true; break; } @@ -143,20 +144,20 @@ void NewMenuController::determineAndSetNewDocAccel( PopupMenu* pPopupMenu, const for ( sal_uInt16 i = 0; i < nCount; i++ ) { - if ( pPopupMenu->GetItemType( i ) != MenuItemType::SEPARATOR ) + if (m_xPopupMenu->getItemType(i) != css::awt::MenuItemType_SEPARATOR) { - nId = pPopupMenu->GetItemId( i ); - aCommand = pPopupMenu->GetItemCommand( nId ); + nId = m_xPopupMenu->getItemId(i); + aCommand = m_xPopupMenu->getCommand(nId); if ( aCommand.indexOf( aDefaultModuleName ) >= 0 ) { - pPopupMenu->SetAccelKey( nId, rKeyCode ); + m_xPopupMenu->setAcceleratorKeyEvent(nId, rKeyCode); break; } } } } -void NewMenuController::setAccelerators( PopupMenu* pPopupMenu ) +void NewMenuController::setAccelerators() { if ( !m_bModuleIdentified ) return; @@ -212,18 +213,18 @@ void NewMenuController::setAccelerators( PopupMenu* pPopupMenu ) } vcl::KeyCode aEmptyKeyCode; - sal_uInt16 nItemCount( pPopupMenu->GetItemCount() ); + sal_uInt16 nItemCount(m_xPopupMenu->getItemCount()); std::vector< vcl::KeyCode > aMenuShortCuts; std::vector< OUString > aCmds; std::vector< sal_uInt16 > aIds; for ( sal_uInt16 i = 0; i < nItemCount; i++ ) { - if ( pPopupMenu->GetItemType( i ) != MenuItemType::SEPARATOR ) + if (m_xPopupMenu->getItemType(i) != css::awt::MenuItemType_SEPARATOR) { - sal_uInt16 nId( pPopupMenu->GetItemId( i )); + sal_uInt16 nId(m_xPopupMenu->getItemId(i)); aIds.push_back( nId ); aMenuShortCuts.push_back( aEmptyKeyCode ); - aCmds.push_back( pPopupMenu->GetItemCommand( nId )); + aCmds.push_back(m_xPopupMenu->getCommand(nId)); } } @@ -255,14 +256,14 @@ void NewMenuController::setAccelerators( PopupMenu* pPopupMenu ) const sal_uInt32 nCount2 = aIds.size(); for ( sal_uInt32 i = 0; i < nCount2; i++ ) - pPopupMenu->SetAccelKey( aIds[i], aMenuShortCuts[i] ); + m_xPopupMenu->setAcceleratorKeyEvent(aIds[i], svt::AcceleratorExecute::st_VCLKey2AWTKey(aMenuShortCuts[i])); // Special handling for "New" menu short-cut should be set at the // document which will be opened using it. if ( m_bNewMenu ) { if ( aMenuShortCuts[nSeqCount-1] != aEmptyKeyCode ) - determineAndSetNewDocAccel( pPopupMenu, aMenuShortCuts[nSeqCount-1] ); + determineAndSetNewDocAccel(svt::AcceleratorExecute::st_VCLKey2AWTKey(aMenuShortCuts[nSeqCount-1])); } } @@ -436,7 +437,7 @@ void SAL_CALL NewMenuController::itemActivated( const css::awt::MenuEvent& ) setMenuImages( pVCLPopupMenu, m_bShowImages ); } - setAccelerators( pVCLPopupMenu ); + setAccelerators(); } // XPopupMenuController diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx index 31c0f7f08edf..56b0bb49a6ca 100644 --- a/toolkit/source/awt/vclxmenu.cxx +++ b/toolkit/source/awt/vclxmenu.cxx @@ -575,7 +575,7 @@ namespace return aImage; } - /** Copied from svtools/inc/acceleratorexecute.hxx */ + /** Copied from include/svtools/acceleratorexecute.hxx */ css::awt::KeyEvent lcl_VCLKey2AWTKey( const vcl::KeyCode& aVCLKey) { commit 67df0664609336faf205f80fdb5115d9edb985c3 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Nov 29 11:33:52 2021 +0000 Commit: Caolán McNamara <caol...@redhat.com> CommitDate: Mon Nov 29 21:20:58 2021 +0100 nothing consumes this value set with SetUserValue the GetUserValue was removed in... commit b90296a32bc97bd5038ee2dd262c1d1ee63f3c96 Date: Mon Jun 19 10:42:18 2006 +0000 INTEGRATION: CWS warnings01 (1.13.32); FILE MERGED 2006/05/29 07:55:08 sb 1.13.32.5: #i53898# Made code warning-free and/or compile at all after resync to SRC680m170. 2006/05/23 16:14:01 sb 1.13.32.4: RESYNC: (1.14-1.15); FILE MERGED 2006/01/25 17:36:29 sb 1.13.32.3: RESYNC: (1.13-1.14); FILE MERGED 2005/11/16 15:20:46 pl 1.13.32.2: #i55991# removed warnings 2005/10/28 14:48:46 cd 1.13.32.1: #i55991# Warning free code changes for gcc Change-Id: If2519a7826ab5fa9dd605218a51b2f7622231d1f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126046 Tested-by: Caolán McNamara <caol...@redhat.com> Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index fe0c684c51b6..b7096c075605 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -43,14 +43,12 @@ #include <comphelper/propertyvalue.hxx> #include <officecfg/Office/Common.hxx> -#include <vcl/menu.hxx> #include <vcl/svapp.hxx> #include <vcl/image.hxx> #include <vcl/settings.hxx> #include <vcl/commandinfoprovider.hxx> #include <rtl/ustrbuf.hxx> #include <sal/log.hxx> -#include <toolkit/awt/vclxmenu.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <vcl/window.hxx> #include <unotools/cmdoptions.hxx> @@ -397,15 +395,6 @@ void ToolbarsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > co if ( aSortedTbs[i].bVisible ) m_xPopupMenu->checkItem( nIndex, true ); - { - SolarMutexGuard aGuard; - VCLXPopupMenu* pXPopupMenu = static_cast<VCLXPopupMenu *>(comphelper::getFromUnoTunnel<VCLXMenu>( m_xPopupMenu )); - PopupMenu* pVCLPopupMenu = pXPopupMenu ? static_cast<PopupMenu *>(pXPopupMenu->GetMenu()) : nullptr; - assert(pVCLPopupMenu); - if (pVCLPopupMenu) - pVCLPopupMenu->SetUserValue( nIndex, reinterpret_cast<void*>( aSortedTbs[i].bContextSensitive ? 1 : 0 )); - } - // use VCL popup menu pointer to set vital information that are not part of the awt implementation OUStringBuffer aStrBuf( aStaticCmdPart );