[Libreoffice-commits] core.git: framework/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Aug 9 14:41:41 UTC 2018


 framework/source/uielement/resourcemenucontroller.cxx |   61 ------------------
 1 file changed, 1 insertion(+), 60 deletions(-)

New commits:
commit f25c985b768059ac11b1c73ef6116e767bc409c7
Author:     Maxim Monastirsky <momonasmon at gmail.com>
AuthorDate: Sun Jul 8 23:17:22 2018 +0300
Commit:     Maxim Monastirsky <momonasmon at gmail.com>
CommitDate: Thu Aug 9 16:39:21 2018 +0200

    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 at gmail.com>

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.


More information about the Libreoffice-commits mailing list