diff options
author | Maxim Monastirsky <momonasmon@gmail.com> | 2016-03-10 15:45:09 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-03-10 15:23:31 +0000 |
commit | 21b92f386c32defa498284df752d909c9555c4c1 (patch) | |
tree | ccd58c0489e199374249df7c93886da20f444535 /framework/inc | |
parent | 70c8d27892f811121a891ebd4742c97d19632f93 (diff) |
MenuDispatcher::m_pMenuManager is always nullptr
... as shown by 7da15debe39b50255cc08b3fef7ae38185a9174f.
Which means that MenuManager is unused, and MenuDispatcher
does nothing useful.
Change-Id: Ic85619531054a573d971d38b52609e1cbcaf780c
Reviewed-on: https://gerrit.libreoffice.org/23117
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'framework/inc')
-rw-r--r-- | framework/inc/classes/menumanager.hxx | 129 | ||||
-rw-r--r-- | framework/inc/dispatch/dispatchprovider.hxx | 3 | ||||
-rw-r--r-- | framework/inc/dispatch/menudispatcher.hxx | 189 | ||||
-rw-r--r-- | framework/inc/targets.h | 1 | ||||
-rw-r--r-- | framework/inc/uielement/menubarmanager.hxx | 2 |
5 files changed, 2 insertions, 322 deletions
diff --git a/framework/inc/classes/menumanager.hxx b/framework/inc/classes/menumanager.hxx deleted file mode 100644 index 9bd2a8ae92b7..000000000000 --- a/framework/inc/classes/menumanager.hxx +++ /dev/null @@ -1,129 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_FRAMEWORK_INC_CLASSES_MENUMANAGER_HXX -#define INCLUDED_FRAMEWORK_INC_CLASSES_MENUMANAGER_HXX - -#include <vector> - -#include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/frame/XDispatch.hpp> -#include <com/sun/star/frame/FeatureStateEvent.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/util/XURLTransformer.hpp> - -#include <rtl/ustring.hxx> -#include <vcl/menu.hxx> -#include <vcl/accel.hxx> -#include <cppuhelper/implbase.hxx> - -namespace com { namespace sun { namespace star { namespace uno { - class XComponentContext; -} } } } - -namespace framework -{ - -class BmkMenu; -class AddonMenu; -class AddonPopupMenu; -class MenuManager : public ::cppu::WeakImplHelper< css::frame::XStatusListener > -{ - public: - MenuManager( - const css::uno::Reference< css::uno::XComponentContext >& rxContext, - css::uno::Reference< css::frame::XFrame >& rFrame, - Menu* pMenu, - bool bDelete, - bool bDeleteChildren ); - - virtual ~MenuManager(); - - // XStatusListener - virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& Event ) throw ( css::uno::RuntimeException, std::exception ) override; - - // XEventListener - virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) throw ( css::uno::RuntimeException, std::exception ) override; - - DECL_LINK_TYPED( Select, Menu *, bool ); - - Menu* GetMenu() const { return m_pVCLMenu; } - - void RemoveListener(); - - static void UpdateSpecialWindowMenu( Menu* pMenu ,const css::uno::Reference< css::uno::XComponentContext >& xContext); - static void FillMenuImages( - css::uno::Reference< css::frame::XFrame >& xFrame, - Menu* _pMenu, - bool bShowMenuImages - ); - - protected: - DECL_LINK_TYPED(Highlight, Menu *, bool); - DECL_LINK_TYPED( Activate, Menu *, bool ); - DECL_LINK_TYPED( Deactivate, Menu *, bool ); - - private: - void UpdateSpecialFileMenu( Menu* pMenu ); - void ClearMenuDispatch(const css::lang::EventObject& Source = css::lang::EventObject(),bool _bRemoveOnly = true); - void SetHdl(); - void AddMenu(PopupMenu* _pPopupMenu,const OUString& _sItemCommand,sal_uInt16 _nItemId,bool _bDelete,bool _bDeleteChildren); - sal_uInt16 FillItemCommand(OUString& _rItemCommand, Menu* _pMenu,sal_uInt16 _nIndex) const; - - struct MenuItemHandler - { - MenuItemHandler( sal_uInt16 aItemId, MenuManager* pManager, css::uno::Reference< css::frame::XDispatch >& rDispatch ) : - nItemId( aItemId ), pSubMenuManager( pManager ), xMenuItemDispatch( rDispatch ) {} - - sal_uInt16 nItemId; - OUString aTargetFrame; - OUString aMenuItemURL; - OUString aFilter; - OUString aPassword; - OUString aTitle; - MenuManager* pSubMenuManager; - css::uno::Reference< css::frame::XDispatch > xMenuItemDispatch; - }; - - void CreatePicklistArguments( - css::uno::Sequence< css::beans::PropertyValue >& aArgsList, - const MenuItemHandler* ); - - MenuItemHandler* GetMenuItemHandler( sal_uInt16 nItemId ); - - bool m_bInitialized; - bool m_bDeleteMenu; - bool m_bDeleteChildren; - bool m_bActive; - bool m_bIsBookmarkMenu; - bool m_bShowMenuImages; - OUString m_aMenuItemCommand; - Menu* m_pVCLMenu; - css::uno::Reference< css::frame::XFrame > m_xFrame; - ::std::vector< MenuItemHandler* > m_aMenuItemHandlerVector; - - css::uno::Reference< css::uno::XComponentContext > m_xContext; - css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer; -}; - -} // namespace - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/dispatch/dispatchprovider.hxx b/framework/inc/dispatch/dispatchprovider.hxx index d5a20d2a5c93..bf44c6c66452 100644 --- a/framework/inc/dispatch/dispatchprovider.hxx +++ b/framework/inc/dispatch/dispatchprovider.hxx @@ -48,7 +48,6 @@ namespace framework{ enum EDispatchHelper { E_DEFAULTDISPATCHER , - E_MENUDISPATCHER , E_CREATEDISPATCHER , E_BLANKDISPATCHER , E_SELFDISPATCHER , @@ -83,8 +82,6 @@ class DispatchProvider : private TransactionBase , css::uno::Reference< css::uno::XComponentContext > m_xContext; /// weakreference to owner frame (Don't use a hard reference. Owner can't delete us then!) css::uno::WeakReference< css::frame::XFrame > m_xFrame; - /// different dispatcher to handle special dispatch calls, protocols or URLs (they will be created on demand.) - css::uno::Reference< css::frame::XDispatch > m_xMenuDispatcher; /// cache of some other dispatch provider which are registered inside configuration to handle special URL protocols HandlerCache m_aProtocolHandlerCache; diff --git a/framework/inc/dispatch/menudispatcher.hxx b/framework/inc/dispatch/menudispatcher.hxx deleted file mode 100644 index eab15e89618e..000000000000 --- a/framework/inc/dispatch/menudispatcher.hxx +++ /dev/null @@ -1,189 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_FRAMEWORK_INC_DISPATCH_MENUDISPATCHER_HXX -#define INCLUDED_FRAMEWORK_INC_DISPATCH_MENUDISPATCHER_HXX - -#include <classes/taskcreator.hxx> -#include <macros/xinterface.hxx> -#include <macros/xtypeprovider.hxx> -#include <classes/menumanager.hxx> -#include <general.h> -#include <stdtypes.h> - -#include <com/sun/star/lang/XTypeProvider.hpp> -#include <com/sun/star/frame/XDispatch.hpp> -#include <com/sun/star/util/URL.hpp> -#include <com/sun/star/frame/DispatchDescriptor.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/frame/XStatusListener.hpp> -#include <com/sun/star/frame/XFrameLoader.hpp> -#include <com/sun/star/frame/XLoadEventListener.hpp> -#include <com/sun/star/frame/XDesktop.hpp> -#include <com/sun/star/frame/FeatureStateEvent.hpp> -#include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/frame/XFrameActionListener.hpp> - -#include <cppuhelper/implbase.hxx> -#include <cppuhelper/weakref.hxx> -#include <cppuhelper/interfacecontainer.h> - -namespace framework{ - -typedef cppu::OMultiTypeInterfaceContainerHelperVar<OUString> - IMPL_ListenerHashContainer; - -/*-************************************************************************************************************ - @short helper for desktop only(!) to create new tasks on demand for dispatches - @descr Use this class as member only! Never use it as baseclass. - XInterface will be ambigous and we hold a weakcss::uno::Reference to our OWNER - not to our SUPERCLASS! - - @implements XInterface - XDispatch - XLoadEventListener - XFrameActionListener - XEventListener - @base OWeakObject - - @devstatus ready to use -*//*-*************************************************************************************************************/ -class MenuDispatcher : public ::cppu::WeakImplHelper< - css::frame::XDispatch , - css::frame::XFrameActionListener > -{ - - // public methods - - public: - - // constructor / destructor - - /*-**************************************************************************************************** - @short standard ctor - @descr This initializes a new instance of the class with needed information for work. - - @seealso using at owner - - @param "rxContext" , css::uno::Reference to servicemanager for creation of new services - @param "xOwner" , css::uno::Reference to our owner, the Desktop!!! - *//*-*****************************************************************************************************/ - - MenuDispatcher( const css::uno::Reference< css::uno::XComponentContext >& rxContext , - const css::uno::Reference< css::frame::XFrame >& xOwner ); - - // XDispatch - - /*-**************************************************************************************************** - @short dispatch URL with arguments - @descr Every dispatch create a new task. If load of URL failed task will deleted automatically! - @param "aURL" , URL to dispatch. - @param "seqArguments" , list of optional arguments. - *//*-*****************************************************************************************************/ - - virtual void SAL_CALL dispatch( const css::util::URL& aURL , - const css::uno::Sequence< css::beans::PropertyValue >& seqProperties ) throw( css::uno::RuntimeException, std::exception ) override; - - /*-**************************************************************************************************** - @short add listener for state events - @descr You can add a listener to get information about status of dispatch: OK or Failed. - - @seealso method loadFinished() - @seealso method loadCancelled() - - @param "xControl" , css::uno::Reference to a valid listener for state events. - @param "aURL" , URL about listener will be informed, if something occurred. - *//*-*****************************************************************************************************/ - - virtual void SAL_CALL addStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xControl, - const css::util::URL& aURL ) throw( css::uno::RuntimeException, std::exception ) override; - - /*-**************************************************************************************************** - @short remove listener for state events - @descr You can remove a listener if information of dispatch isn't important for you any longer. - - @seealso method loadFinished() - @seealso method loadCancelled() - - @param "xControl" , css::uno::Reference to a valid listener. - @param "aURL" , URL on which listener has registered. - *//*-*****************************************************************************************************/ - - virtual void SAL_CALL removeStatusListener( const css::uno::Reference< css::frame::XStatusListener >& xControl, - const css::util::URL& aURL ) throw( css::uno::RuntimeException, std::exception ) override; - - // XFrameActionListener - - virtual void SAL_CALL frameAction( const css::frame::FrameActionEvent& aEvent ) throw ( css::uno::RuntimeException, std::exception ) override; - - // XEventListener - - /*-**************************************************************************************************** - @short dispose current instance - @descr If service helper isn't required any longer call this method to release all used resources. - @param "aEvent", information about source of this event. - *//*-*****************************************************************************************************/ - - void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException, std::exception ) override; - - // protected methods - - protected: - - /*-**************************************************************************************************** - @short standard destructor - @descr This method destruct an instance of this class and clear some member. - This method is protected, because its not allowed to use an instance of this class as a member! - You MUST use a pointer. - *//*-*****************************************************************************************************/ - - virtual ~MenuDispatcher(); - - - private: - - /*-**************************************************************************************************** - *//*-*****************************************************************************************************/ - - bool impl_clearMenuBar(); - - /*-**************************************************************************************************** - *//*-*****************************************************************************************************/ - - void impl_setAccelerators( Menu* pMenu, const Accelerator& aAccel ); - - // variables - // (should be private everyway!) - - private: - - css::uno::WeakReference< css::frame::XFrame > m_xOwnerWeak; /// css::uno::WeakReference to owner (Don't use a hard css::uno::Reference. Owner can't delete us then!) - css::uno::Reference< css::uno::XComponentContext > m_xContext; /// factory shared with our owner to create new services! - osl::Mutex m_mutex; - IMPL_ListenerHashContainer m_aListenerContainer; /// hash table for listener at specified URLs - bool m_bAlreadyDisposed; /// Protection against multiple disposing calls. - bool m_bActivateListener; /// dispatcher is listener for frame activation - MenuManager* m_pMenuManager; /// menu manager controlling menu dispatches - -}; // class MenuDispatcher - -} // namespace framework - -#endif // INCLUDED_FRAMEWORK_INC_DISPATCH_MENUDISPATCHER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/targets.h b/framework/inc/targets.h index 09155f397ef8..a15db1e84851 100644 --- a/framework/inc/targets.h +++ b/framework/inc/targets.h @@ -30,7 +30,6 @@ namespace framework{ #define SPECIALTARGET_BLANK "_blank" // Create a new task. #define SPECIALTARGET_DEFAULT "_default" // Create a new task or recycle an existing one #define SPECIALTARGET_BEAMER "_beamer" // special frame in hierarchy -#define SPECIALTARGET_MENUBAR "_menubar" // special target for menubars #define SPECIALTARGET_HELPTASK "OFFICE_HELP_TASK" // special name for our help task } // namespace framework diff --git a/framework/inc/uielement/menubarmanager.hxx b/framework/inc/uielement/menubarmanager.hxx index 0374b3f26f2a..2a1a019fb8e3 100644 --- a/framework/inc/uielement/menubarmanager.hxx +++ b/framework/inc/uielement/menubarmanager.hxx @@ -188,6 +188,8 @@ class MenuBarManager : public css::frame::XStatusListener , void RetrieveShortcuts( std::vector< MenuItemHandler* >& aMenuShortCuts ); void CheckAndAddMenuExtension( Menu* pMenu ); + static void UpdateSpecialWindowMenu( Menu* pMenu, const css::uno::Reference< css::uno::XComponentContext >& xContext ); + static void FillMenuImages( css::uno::Reference< css::frame::XFrame >& xFrame, Menu* _pMenu, bool bShowMenuImages ); static void impl_RetrieveShortcutsFromConfiguration( const css::uno::Reference< css::ui::XAcceleratorConfiguration >& rAccelCfg, const css::uno::Sequence< OUString >& rCommands, std::vector< MenuItemHandler* >& aMenuShortCuts ); |