diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-05-20 17:18:56 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-05-21 16:29:33 +0100 |
commit | f4bccae9eb48d36de9edd1fa5551e5e8de85b17e (patch) | |
tree | de5ef8238a2bf77986e3fc9625772f8fa77b044e | |
parent | e9679a4a769e1edcc9c41c96de5739286323be79 (diff) |
Revert "fdo#46808, Adapt frame::PopupMenuControllerFactory UNO service"
This reverts commit e93a0018871ebea4da1959c72c06f3c7f4dc7b27.
Conflicts:
desktop/source/app/app.cxx
framework/source/uielement/menubarmanager.cxx
framework/source/uielement/popupmenucontroller.cxx
offapi/UnoApi_offapi.mk
Change-Id: I3d4d49f98603e75357fb315a603a10851b3a7090
-rw-r--r-- | desktop/source/app/app.cxx | 26 | ||||
-rw-r--r-- | framework/inc/services.h | 1 | ||||
-rw-r--r-- | framework/inc/uielement/menubarmanager.hxx | 3 | ||||
-rw-r--r-- | framework/inc/uifactory/toolbarcontrollerfactory.hxx | 10 | ||||
-rw-r--r-- | framework/source/uielement/menubarmanager.cxx | 62 | ||||
-rw-r--r-- | framework/source/uielement/popupmenucontroller.cxx | 8 | ||||
-rw-r--r-- | framework/source/uifactory/popupmenucontrollerfactory.cxx | 2 | ||||
-rw-r--r-- | offapi/UnoApi_offapi.mk | 3 | ||||
-rw-r--r-- | offapi/com/sun/star/frame/PopupMenuControllerFactory.idl | 28 | ||||
-rw-r--r-- | offapi/com/sun/star/frame/XToolbarControllerFactory.idl | 65 |
10 files changed, 93 insertions, 115 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index de0e7b544131..0b05fab5e916 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -41,7 +41,6 @@ #include <com/sun/star/frame/SessionListener.hpp> #include <com/sun/star/frame/XSessionManagerListener.hpp> #include <com/sun/star/frame/XSynchronousDispatch.hpp> -#include <com/sun/star/frame/PopupMenuControllerFactory.hpp> #include <com/sun/star/document/CorruptedFilterConfigurationException.hpp> #include <com/sun/star/configuration/CorruptedConfigurationException.hpp> #include <com/sun/star/configuration/theDefaultProvider.hpp> @@ -2215,16 +2214,21 @@ void Desktop::PreloadConfigurationData() // preload popup menu controller factories. As all controllers are in the same // configuration file they also get preloaded! - Reference< css::frame::XToolbarControllerFactory > xPopupMenuControllerFactory = - css::frame::PopupMenuControllerFactory::create( xContext ); - try - { - xPopupMenuControllerFactory->hasController( - OUString( ".uno:CharFontName" ), - OUString() ); - } - catch ( const ::com::sun::star::uno::Exception& ) + Reference< ::com::sun::star::frame::XUIControllerRegistration > xPopupMenuControllerFactory( + rFactory->createInstance( + rtl::OUString( "com.sun.star.frame.PopupMenuControllerFactory" )), + UNO_QUERY ); + if ( xPopupMenuControllerFactory.is() ) { + try + { + xPopupMenuControllerFactory->hasController( + rtl::OUString( ".uno:CharFontName" ), + OUString() ); + } + catch ( const ::com::sun::star::uno::Exception& ) + { + } } // preload filter configuration @@ -2269,6 +2273,8 @@ void Desktop::OpenClients() const CommandLineArgs& rArgs = GetCommandLineArgs(); + Reference<XMultiServiceFactory> rFactory = ::comphelper::getProcessServiceFactory(); + if (!rArgs.IsQuickstart()) { sal_Bool bShowHelp = sal_False; diff --git a/framework/inc/services.h b/framework/inc/services.h index a4bd093c6ee5..d57af352065f 100644 --- a/framework/inc/services.h +++ b/framework/inc/services.h @@ -38,6 +38,7 @@ namespace framework{ #define SERVICENAME_JOB DECLARE_ASCII("com.sun.star.task.Job" ) #define SERVICENAME_PROTOCOLHANDLER DECLARE_ASCII("com.sun.star.frame.ProtocolHandler" ) #define SERVICENAME_LAYOUTMANAGER DECLARE_ASCII("com.sun.star.frame.LayoutManager" ) +#define SERVICENAME_POPUPMENUCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.frame.PopupMenuControllerFactory" ) #define SERVICENAME_POPUPMENUCONTROLLER DECLARE_ASCII("com.sun.star.frame.PopupMenuController" ) #define SERVICENAME_MODULEUICONFIGURATIONMANAGER DECLARE_ASCII("com.sun.star.ui.ModuleUIConfigurationManager" ) #define SERVICENAME_MENUBARFACTORY DECLARE_ASCII("com.sun.star.ui.UIElementFactory" ) diff --git a/framework/inc/uielement/menubarmanager.hxx b/framework/inc/uielement/menubarmanager.hxx index 37d689382ab8..1e9e38626ed6 100644 --- a/framework/inc/uielement/menubarmanager.hxx +++ b/framework/inc/uielement/menubarmanager.hxx @@ -34,7 +34,6 @@ #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/FeatureStateEvent.hpp> #include <com/sun/star/frame/XFrameActionListener.hpp> -#include <com/sun/star/frame/XToolbarControllerFactory.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/frame/XPopupMenuController.hpp> #include <com/sun/star/awt/XSystemDependentMenuPeer.hpp> @@ -236,7 +235,7 @@ class MenuBarManager : public com::sun::star::frame::XStatusListener Menu* m_pVCLMenu; ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame; ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xUICommandLabels; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XToolbarControllerFactory > m_xPopupMenuControllerRegistration; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XUIControllerRegistration > m_xPopupMenuControllerRegistration; ::std::vector< MenuItemHandler* > m_aMenuItemHandlerVector; ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xDispatchProvider; diff --git a/framework/inc/uifactory/toolbarcontrollerfactory.hxx b/framework/inc/uifactory/toolbarcontrollerfactory.hxx index f72c6e6979fa..7534e6ce7a8e 100644 --- a/framework/inc/uifactory/toolbarcontrollerfactory.hxx +++ b/framework/inc/uifactory/toolbarcontrollerfactory.hxx @@ -29,9 +29,10 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XTypeProvider.hpp> -#include <com/sun/star/frame/XToolbarControllerFactory.hpp> +#include <com/sun/star/lang/XMultiComponentFactory.hpp> +#include <com/sun/star/frame/XUIControllerRegistration.hpp> -#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase3.hxx> #include <rtl/ustring.hxx> namespace framework @@ -39,8 +40,9 @@ namespace framework class ConfigurationAccess_ControllerFactory; class ToolbarControllerFactory : protected ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. - public ::cppu::WeakImplHelper2< com::sun::star::lang::XServiceInfo, - com::sun::star::frame::XToolbarControllerFactory> + public ::cppu::WeakImplHelper3< com::sun::star::lang::XServiceInfo, + com::sun::star::lang::XMultiComponentFactory, + com::sun::star::frame::XUIControllerRegistration> { public: ToolbarControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index b846039f6aca..91e7df87f2df 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -36,7 +36,6 @@ #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/frame/XFramesSupplier.hpp> #include <com/sun/star/frame/Desktop.hpp> -#include <com/sun/star/frame/PopupMenuControllerFactory.hpp> #include <com/sun/star/container/XEnumeration.hpp> #include <com/sun/star/util/XStringWidth.hpp> #include <com/sun/star/uno/XComponentContext.hpp> @@ -183,7 +182,9 @@ MenuBarManager::MenuBarManager( , m_nSymbolsStyle( SvtMiscOptions().GetCurrentSymbolsStyle() ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::MenuBarManager" ); - m_xPopupMenuControllerRegistration = PopupMenuControllerFactory::create( m_xContext ); + m_xPopupMenuControllerRegistration = Reference< ::com::sun::star::frame::XUIControllerRegistration >( + getServiceFactory()->createInstance( OUString( "com.sun.star.frame.PopupMenuControllerFactory" )), + UNO_QUERY ); FillMenuManager( pMenu, rFrame, rDispatchProvider, rModuleIdentifier, bDelete, bDeleteChildren ); } @@ -1186,30 +1187,37 @@ sal_Bool MenuBarManager::CreatePopupMenuController( MenuItemHandler* pMenuItemHa RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::CreatePopupMenuController" ); OUString aItemCommand( pMenuItemHandler->aMenuItemURL ); - // Try instantiate a popup menu controller. It is stored in the menu item handler. - Sequence< Any > aSeq( 2 ); - PropertyValue aPropValue; - - aPropValue.Name = OUString( "ModuleName" ); - aPropValue.Value <<= m_aModuleIdentifier; - aSeq[0] <<= aPropValue; - aPropValue.Name = OUString( "Frame" ); - aPropValue.Value <<= m_xFrame; - aSeq[1] <<= aPropValue; - - Reference< XPopupMenuController > xPopupMenuController( - m_xPopupMenuControllerRegistration->createInstanceWithArgumentsAndContext( - aItemCommand, - aSeq, - m_xContext ), - UNO_QUERY ); - - if ( xPopupMenuController.is() ) + // Try instanciate a popup menu controller. It is stored in the menu item handler. + Reference< XMultiComponentFactory > xPopupMenuControllerFactory( m_xPopupMenuControllerRegistration, UNO_QUERY ); + if ( xPopupMenuControllerFactory.is() ) { - // Provide our awt popup menu to the popup menu controller - pMenuItemHandler->xPopupMenuController = xPopupMenuController; - xPopupMenuController->setPopupMenu( pMenuItemHandler->xPopupMenu ); - return sal_True; + Sequence< Any > aSeq( 2 ); + PropertyValue aPropValue; + + aPropValue.Name = OUString( "ModuleName" ); + aPropValue.Value <<= m_aModuleIdentifier; + aSeq[0] <<= aPropValue; + aPropValue.Name = OUString( "Frame" ); + aPropValue.Value <<= m_xFrame; + aSeq[1] <<= aPropValue; + + Reference< XComponentContext > xComponentContext( + comphelper::getComponentContext( getServiceFactory() ) ); + + Reference< XPopupMenuController > xPopupMenuController( + xPopupMenuControllerFactory->createInstanceWithArgumentsAndContext( + aItemCommand, + aSeq, + xComponentContext ), + UNO_QUERY ); + + if ( xPopupMenuController.is() ) + { + // Provide our awt popup menu to the popup menu controller + pMenuItemHandler->xPopupMenuController = xPopupMenuController; + xPopupMenuController->setPopupMenu( pMenuItemHandler->xPopupMenu ); + return sal_True; + } } return sal_False; @@ -2012,7 +2020,9 @@ void MenuBarManager::Init(const Reference< XFrame >& rFrame,AddonMenu* pAddonMen m_bIsBookmarkMenu = sal_True; OUString aModuleIdentifier; - m_xPopupMenuControllerRegistration = PopupMenuControllerFactory::create( m_xContext ); + m_xPopupMenuControllerRegistration = Reference< ::com::sun::star::frame::XUIControllerRegistration >( + getServiceFactory()->createInstance( OUString( "com.sun.star.frame.PopupMenuControllerFactory" )), + UNO_QUERY ); Reference< XStatusListener > xStatusListener; Reference< XDispatch > xDispatch; diff --git a/framework/source/uielement/popupmenucontroller.cxx b/framework/source/uielement/popupmenucontroller.cxx index 80fbdc3a845e..571b5cb03dfc 100644 --- a/framework/source/uielement/popupmenucontroller.cxx +++ b/framework/source/uielement/popupmenucontroller.cxx @@ -20,7 +20,6 @@ #include <com/sun/star/awt/XPopupMenu.hpp> #include <com/sun/star/frame/XPopupMenuController.hpp> -#include <com/sun/star/frame/PopupMenuControllerFactory.hpp> #include <toolkit/helper/vclunohelper.hxx> @@ -156,7 +155,7 @@ void SAL_CALL PopupMenuController::doubleClick() throw (RuntimeException) bool PopupMenuController::CreatePopupMenuController() throw (Exception) { - Reference< XToolbarControllerFactory > xPopupMenuControllerRegistration = PopupMenuControllerFactory::create( m_xContext ); + Reference< XMultiComponentFactory > xPopupMenuControllerRegistration( getServiceManager()->createInstance( SERVICENAME_POPUPMENUCONTROLLERFACTORY ), UNO_QUERY_THROW ); Sequence< Any > aSeq( 2 ); PropertyValue aPropValue; @@ -168,7 +167,10 @@ bool PopupMenuController::CreatePopupMenuController() throw (Exception) aPropValue.Value <<= m_xFrame; aSeq[1] <<= aPropValue; - Reference< XPopupMenuController > xPopupMenuController( xPopupMenuControllerRegistration->createInstanceWithArgumentsAndContext( getCommandURL(), aSeq, m_xContext ), UNO_QUERY ); + Reference< XComponentContext > xComponentContext( + comphelper::getComponentContext( getServiceManager() ) ); + + Reference< XPopupMenuController > xPopupMenuController( xPopupMenuControllerRegistration->createInstanceWithArgumentsAndContext( getCommandURL(), aSeq, xComponentContext ), UNO_QUERY ); if ( xPopupMenuController.is() ) { mxPopupMenuController = xPopupMenuController; diff --git a/framework/source/uifactory/popupmenucontrollerfactory.cxx b/framework/source/uifactory/popupmenucontrollerfactory.cxx index e49e346a9507..2b47fd3d1951 100644 --- a/framework/source/uifactory/popupmenucontrollerfactory.cxx +++ b/framework/source/uifactory/popupmenucontrollerfactory.cxx @@ -54,7 +54,7 @@ namespace framework //***************************************************************************************************************** DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( PopupMenuControllerFactory , ::cppu::OWeakObject , - DECLARE_ASCII("com.sun.star.frame.PopupMenuControllerFactory"), + SERVICENAME_POPUPMENUCONTROLLERFACTORY , IMPLEMENTATIONNAME_POPUPMENUCONTROLLERFACTORY ) diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 91c31c42d9ca..395d5412073a 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -198,7 +198,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/frame,\ GlobalEventBroadcaster \ MediaTypeDetectionHelper \ ModuleManager \ - PopupMenuControllerFactory \ SessionListener \ StartModule \ TaskCreator \ @@ -942,6 +941,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/frame,\ FramesContainer \ LayoutManager \ PopupMenuController \ + PopupMenuControllerFactory \ ProtocolHandler \ SessionManager \ Settings \ @@ -2630,7 +2630,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/frame,\ XTitleChangeBroadcaster \ XTitleChangeListener \ XToolbarController \ - XToolbarControllerFactory \ XToolbarControllerListener \ XTransientDocumentsDocumentContentFactory \ XUIControllerRegistration \ diff --git a/offapi/com/sun/star/frame/PopupMenuControllerFactory.idl b/offapi/com/sun/star/frame/PopupMenuControllerFactory.idl index 674112b66cc7..03e0fd8098a6 100644 --- a/offapi/com/sun/star/frame/PopupMenuControllerFactory.idl +++ b/offapi/com/sun/star/frame/PopupMenuControllerFactory.idl @@ -20,7 +20,8 @@ #ifndef __com_sun_star_frame_PopupMenuControllerFactory_idl__ #define __com_sun_star_frame_PopupMenuControllerFactory_idl__ -#include <com/sun/star/frame/XToolbarControllerFactory.idl> +#include <com/sun/star/lang/XMultiComponentFactory.idl> +#include <com/sun/star/frame/XUIControllerRegistration.idl> module com { module sun { module star { module frame { @@ -37,7 +38,30 @@ module com { module sun { module star { module frame { @since OOo 2.0 */ -service PopupMenuControllerFactory : XToolbarControllerFactory; +service PopupMenuControllerFactory +{ + /** this interface provides functions to create new instances of a registered pop-up menu controller. + + <p> + Use <member scope="com.sun.star.lang">XMultiComponentFactory::createInstanceWithArguments()</member> to create + a new pop-up menu controller instance. Use the CommandURL as the service specifier. + + This call supports the following arguments provided as <type scope="com::sun::star::beans">PropertyValue</type>: + <ul> + <li><b>Frame</b><br>specifies the <type scope="com::sun::star::frame">XFrame</type> + instance to which the pop-up menu controller belongs to. This property must be provided to + the pop-up menu controller, otherwise it cannot dispatch its internal commands.</li> + <li><b>ModuleIdentifier</b><br>optional string that specifies in which module context the pop-up menu + controller should be created.</li> + </ul> + </p> + */ + interface com::sun::star::lang::XMultiComponentFactory; + + /** provides functions to query for, register and deregister a pop-up menu controller. + */ + interface com::sun::star::frame::XUIControllerRegistration; +}; }; }; }; }; diff --git a/offapi/com/sun/star/frame/XToolbarControllerFactory.idl b/offapi/com/sun/star/frame/XToolbarControllerFactory.idl deleted file mode 100644 index 8f3ac8ce0d4d..000000000000 --- a/offapi/com/sun/star/frame/XToolbarControllerFactory.idl +++ /dev/null @@ -1,65 +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 __com_sun_star_frame_XToolbarControllerFactory_idl__ -#define __com_sun_star_frame_XToolbarControllerFactory_idl__ - -#include <com/sun/star/lang/XMultiComponentFactory.idl> -#include <com/sun/star/frame/XUIControllerRegistration.idl> - - -module com { module sun { module star { module frame { - - -/** Provides a unified interface for the new-style PopupMenuControllerFactory service to implement. - - @since LibreOffice 4.1 -*/ - -interface XToolbarControllerFactory -{ - /** this interface provides functions to create new instances of a registered pop-up menu controller. - - <p> - Use <member scope="com.sun.star.lang">XMultiComponentFactory::createInstanceWithArguments()</member> to create - a new pop-up menu controller instance. Use the CommandURL as the service specifier. - - This call supports the following arguments provided as <type scope="com::sun::star::beans">PropertyValue</type>: - <ul> - <li><b>Frame</b><br>specifies the <type scope="com::sun::star::frame">XFrame</type> - instance to which the pop-up menu controller belongs to. This property must be provided to - the pop-up menu controller, otherwise it cannot dispatch its internal commands.</li> - <li><b>ModuleIdentifier</b><br>optional string that specifies in which module context the pop-up menu - controller should be created.</li> - </ul> - </p> - */ - interface com::sun::star::lang::XMultiComponentFactory; - - /** provides functions to query for, register and deregister a pop-up menu controller. - */ - interface com::sun::star::frame::XUIControllerRegistration; -}; - -}; }; }; }; - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |