summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2018-07-08 23:17:22 +0300
committerMaxim Monastirsky <momonasmon@gmail.com>2018-08-09 16:39:21 +0200
commitf25c985b768059ac11b1c73ef6116e767bc409c7 (patch)
treeb65775163af5fa5a0f7ea8717ebeba22c4449780 /framework
parent6d0ea082889c89eb8b408779f2de08da7441ff54 (diff)
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 <momonasmon@gmail.com>
Diffstat (limited to 'framework')
-rw-r--r--framework/source/uielement/resourcemenucontroller.cxx61
1 files changed, 1 insertions, 60 deletions
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 <com/sun/star/embed/VerbDescriptor.hpp>
#include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/frame/XStorable.hpp>
-#include <com/sun/star/ui/ItemType.hpp>
#include <com/sun/star/ui/theModuleUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/util/URL.hpp>
@@ -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.