From f25c985b768059ac11b1c73ef6116e767bc409c7 Mon Sep 17 00:00:00 2001 From: Maxim Monastirsky Date: Sun, 8 Jul 2018 23:17:22 +0300 Subject: Toolbar and menu containers are similar enough ... to be handled by the same code. Change-Id: I96fae066ccf2bef474fe4faf8068b7290eea8d8b Reviewed-on: https://gerrit.libreoffice.org/58766 Tested-by: Jenkins Reviewed-by: Maxim Monastirsky --- .../source/uielement/resourcemenucontroller.cxx | 61 +--------------------- 1 file changed, 1 insertion(+), 60 deletions(-) (limited to 'framework/source') diff --git a/framework/source/uielement/resourcemenucontroller.cxx b/framework/source/uielement/resourcemenucontroller.cxx index d50f667adf3a..72513cf7fe32 100644 --- a/framework/source/uielement/resourcemenucontroller.cxx +++ b/framework/source/uielement/resourcemenucontroller.cxx @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -63,7 +62,6 @@ private: css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::Reference< css::ui::XUIConfigurationManager > m_xConfigManager, m_xModuleConfigManager; void addVerbs( const css::uno::Sequence< css::embed::VerbDescriptor >& rVerbs ); - void fillToolbarData(); virtual void SAL_CALL disposing() override; }; @@ -206,10 +204,7 @@ void ResourceMenuController::updatePopupMenu() // Now fill the menu with the configuration data. css::uno::Reference< css::frame::XDispatchProvider > xDispatchProvider( m_xFrame, css::uno::UNO_QUERY ); - if ( m_bToolbarContainer ) - fillToolbarData(); - else - framework::MenuBarManager::FillMenu( m_nNewMenuId, VCLXMenu::GetImplementation( m_xPopupMenu )->GetMenu(), m_aModuleName, m_xMenuContainer, xDispatchProvider ); + framework::MenuBarManager::FillMenu( m_nNewMenuId, VCLXMenu::GetImplementation( m_xPopupMenu )->GetMenu(), m_aModuleName, m_xMenuContainer, xDispatchProvider ); // For context menus, add object verbs. if ( m_bContextMenu ) @@ -257,60 +252,6 @@ void ResourceMenuController::addVerbs( const css::uno::Sequence< css::embed::Ver } } -void ResourceMenuController::fillToolbarData() -{ - VCLXMenu* pAwtMenu = VCLXMenu::GetImplementation( m_xPopupMenu ); - Menu* pVCLMenu = pAwtMenu->GetMenu(); - - css::uno::Sequence< css::beans::PropertyValue > aPropSequence; - for ( sal_Int32 i = 0; i < m_xMenuContainer->getCount(); ++i ) - { - try - { - if ( m_xMenuContainer->getByIndex( i ) >>= aPropSequence ) - { - OUString aCommandURL; - OUString aLabel; - sal_uInt16 nType = css::ui::ItemType::DEFAULT; - bool bVisible = true; - - for ( const auto& aProp: aPropSequence ) - { - if ( aProp.Name == "CommandURL" ) - aProp.Value >>= aCommandURL; - else if ( aProp.Name == "Label" ) - aProp.Value >>= aLabel; - else if ( aProp.Name == "Type" ) - aProp.Value >>= nType; - else if ( aProp.Name == "IsVisible" ) - aProp.Value >>= bVisible; - } - - switch ( nType ) - { - case css::ui::ItemType::DEFAULT: - if ( bVisible ) - { - pVCLMenu->InsertItem( m_nNewMenuId, aLabel ); - pVCLMenu->SetItemCommand( m_nNewMenuId++, aCommandURL ); - } - break; - case css::ui::ItemType::SEPARATOR_LINE: - case css::ui::ItemType::SEPARATOR_LINEBREAK: - if ( bVisible && pVCLMenu->GetItemId( pVCLMenu->GetItemCount() - 1 ) != 0 ) - pVCLMenu->InsertSeparator(); - break; - default: ; - } - } - } - catch ( const css::uno::Exception& ) - { - break; - } - } -} - void ResourceMenuController::itemActivated( const css::awt::MenuEvent& /*rEvent*/ ) { // Must initialize MenuBarManager here, because we want to let the app do context menu interception before. -- cgit