diff options
-rw-r--r-- | desktop/source/app/app.cxx | 20 | ||||
-rw-r--r-- | framework/inc/services.h | 1 | ||||
-rw-r--r-- | framework/inc/services/layoutmanager.hxx | 3 | ||||
-rw-r--r-- | framework/inc/uifactory/uielementfactorymanager.hxx | 10 | ||||
-rw-r--r-- | framework/source/layoutmanager/layoutmanager.cxx | 6 | ||||
-rw-r--r-- | framework/source/uifactory/uielementfactorymanager.cxx | 2 | ||||
-rw-r--r-- | offapi/UnoApi_offapi.mk | 3 | ||||
-rw-r--r-- | offapi/com/sun/star/ui/UIElementFactoryManager.idl | 26 | ||||
-rw-r--r-- | offapi/com/sun/star/ui/XUIElementFactoryManager.idl | 57 | ||||
-rw-r--r-- | sfx2/source/dialog/taskpane.cxx | 6 | ||||
-rw-r--r-- | sfx2/source/toolbox/tbxitem.cxx | 18 |
11 files changed, 92 insertions, 60 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index c78c76b2214d..26d79eccfcfb 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -62,7 +62,7 @@ #include <com/sun/star/task/XRestartManager.hpp> #include <com/sun/star/document/XEventListener.hpp> #include <com/sun/star/frame/UICommandDescription.hpp> -#include <com/sun/star/ui/XUIElementFactoryRegistration.hpp> +#include <com/sun/star/ui/UIElementFactoryManager.hpp> #include <com/sun/star/ui/WindowStateConfiguration.hpp> #include <com/sun/star/frame/XUIControllerRegistration.hpp> @@ -2137,19 +2137,13 @@ void Desktop::PreloadConfigurationData() // preload user interface element factories Sequence< Sequence< css::beans::PropertyValue > > aSeqSeqPropValue; - Reference< ::com::sun::star::ui::XUIElementFactoryRegistration > xUIElementFactory( - rFactory->createInstance( - rtl::OUString( "com.sun.star.ui.UIElementFactoryManager" )), - UNO_QUERY ); - if ( xUIElementFactory.is() ) + Reference< XUIElementFactoryManager > xUIElementFactory = UIElementFactoryManager::create( xContext ); + try + { + aSeqSeqPropValue = xUIElementFactory->getRegisteredFactories(); + } + catch ( const ::com::sun::star::uno::Exception& ) { - try - { - aSeqSeqPropValue = xUIElementFactory->getRegisteredFactories(); - } - catch ( const ::com::sun::star::uno::Exception& ) - { - } } // preload popup menu controller factories. As all controllers are in the same diff --git a/framework/inc/services.h b/framework/inc/services.h index e606390c8664..7ab2c837895a 100644 --- a/framework/inc/services.h +++ b/framework/inc/services.h @@ -57,7 +57,6 @@ namespace framework{ #define SERVICENAME_POPUPMENUCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.frame.PopupMenuControllerFactory" ) #define SERVICENAME_POPUPMENUCONTROLLER DECLARE_ASCII("com.sun.star.frame.PopupMenuController" ) #define SERVICENAME_UICOMMANDDESCRIPTION DECLARE_ASCII("com.sun.star.frame.UICommandDescription" ) -#define SERVICENAME_UIELEMENTFACTORYMANAGER DECLARE_ASCII("com.sun.star.ui.UIElementFactoryManager" ) #define SERVICENAME_UICONFIGURATIONMANAGER DECLARE_ASCII("com.sun.star.ui.UIConfigurationManager" ) #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/services/layoutmanager.hxx b/framework/inc/services/layoutmanager.hxx index 79477b248eeb..9e813a73cfc8 100644 --- a/framework/inc/services/layoutmanager.hxx +++ b/framework/inc/services/layoutmanager.hxx @@ -52,6 +52,7 @@ #include <com/sun/star/awt/XWindowListener.hpp> #include <com/sun/star/util/XURLTransformer.hpp> #include <com/sun/star/ui/XUIElementFactory.hpp> +#include <com/sun/star/ui/XUIElementFactoryManager.hpp> #include <com/sun/star/ui/DockingArea.hpp> #include <com/sun/star/awt/XTopWindow2.hpp> #include <com/sun/star/awt/XDockableWindow.hpp> @@ -317,7 +318,7 @@ namespace framework UIElement m_aProgressBarElement; com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > m_xProgressBarBackup; css::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleManager; - css::uno::Reference< ::com::sun::star::ui::XUIElementFactory > m_xUIElementFactoryManager; + css::uno::Reference< ::com::sun::star::ui::XUIElementFactoryManager > m_xUIElementFactoryManager; css::uno::Reference< ::com::sun::star::container::XNameAccess > m_xPersistentWindowState; css::uno::Reference< ::com::sun::star::container::XNameAccess > m_xPersistentWindowStateSupplier; GlobalSettings* m_pGlobalSettings; diff --git a/framework/inc/uifactory/uielementfactorymanager.hxx b/framework/inc/uifactory/uielementfactorymanager.hxx index e9bbfcff16cc..266111813de8 100644 --- a/framework/inc/uifactory/uielementfactorymanager.hxx +++ b/framework/inc/uifactory/uielementfactorymanager.hxx @@ -34,14 +34,13 @@ #include <stdtypes.h> #include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/ui/XUIElementFactory.hpp> -#include <com/sun/star/ui/XUIElementFactoryRegistration.hpp> +#include <com/sun/star/ui/XUIElementFactoryManager.hpp> #include <com/sun/star/container/XContainerListener.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include "com/sun/star/frame/XModuleManager2.hpp" #include <cppuhelper/implbase1.hxx> -#include <cppuhelper/implbase3.hxx> +#include <cppuhelper/implbase2.hxx> #include <rtl/ustring.hxx> namespace framework @@ -100,9 +99,8 @@ namespace framework class UIElementFactoryManager : private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. - public ::cppu::WeakImplHelper3< ::com::sun::star::lang::XServiceInfo, - ::com::sun::star::ui::XUIElementFactory, - ::com::sun::star::ui::XUIElementFactoryRegistration> + public ::cppu::WeakImplHelper2< ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::ui::XUIElementFactoryManager> { public: UIElementFactoryManager( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ); diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 18f1f81ec386..a91642888977 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -51,6 +51,7 @@ #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/UIElementType.hpp> #include <com/sun/star/ui/WindowStateConfiguration.hpp> +#include <com/sun/star/ui/UIElementFactoryManager.hpp> #include <com/sun/star/container/XNameReplace.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/frame/LayoutManagerEvents.hpp> @@ -131,8 +132,7 @@ LayoutManager::LayoutManager( const Reference< XMultiServiceFactory >& xServiceM , m_bMenuBarCloser( false ) , m_pInplaceMenuBar( NULL ) , m_xModuleManager( ModuleManager::create( comphelper::getComponentContext(xServiceManager) )) - , m_xUIElementFactoryManager( Reference< ui::XUIElementFactory >( - xServiceManager->createInstance( SERVICENAME_UIELEMENTFACTORYMANAGER ), UNO_QUERY )) + , m_xUIElementFactoryManager( ui::UIElementFactoryManager::create(comphelper::getComponentContext(xServiceManager)) ) , m_xPersistentWindowStateSupplier( ui::WindowStateConfiguration::create( comphelper::getComponentContext(xServiceManager) ) ) , m_pGlobalSettings( 0 ) , m_aStatusBarAlias( "private:resource/statusbar/statusbar" ) @@ -155,7 +155,7 @@ LayoutManager::LayoutManager( const Reference< XMultiServiceFactory >& xServiceM m_aStatusBarElement.m_aType = rtl::OUString( "statusbar" ); m_aStatusBarElement.m_aName = m_aStatusBarAlias; - m_pToolbarManager = new ToolbarLayoutManager( comphelper::getComponentContext(xServiceManager), m_xUIElementFactoryManager, this ); + m_pToolbarManager = new ToolbarLayoutManager( comphelper::getComponentContext(xServiceManager), Reference<XUIElementFactory>(m_xUIElementFactoryManager, UNO_QUERY_THROW), this ); m_xToolbarManager = uno::Reference< ui::XUIConfigurationListener >( static_cast< OWeakObject* >( m_pToolbarManager ), uno::UNO_QUERY ); Application::AddEventListener( LINK( this, LayoutManager, SettingsChanged ) ); diff --git a/framework/source/uifactory/uielementfactorymanager.cxx b/framework/source/uifactory/uielementfactorymanager.cxx index 8e465c4cd3ac..dd366b7ca760 100644 --- a/framework/source/uifactory/uielementfactorymanager.cxx +++ b/framework/source/uifactory/uielementfactorymanager.cxx @@ -373,7 +373,7 @@ sal_Bool ConfigurationAccess_FactoryManager::impl_getElementProps( const Any& aE //***************************************************************************************************************** DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2 ( UIElementFactoryManager , ::cppu::OWeakObject , - SERVICENAME_UIELEMENTFACTORYMANAGER , + DECLARE_ASCII("com.sun.star.ui.UIElementFactoryManager"), IMPLEMENTATIONNAME_UIELEMENTFACTORYMANAGER ) diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index b2bcb4a7bbb3..29f07f54cb96 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -304,6 +304,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/ucb,\ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/ui,\ GlobalAcceleratorConfiguration \ ModuleUIConfigurationManagerSupplier \ + UIElementFactoryManager \ WindowContentFactory \ WindowContentFactoryManager \ WindowStateConfiguration \ @@ -1448,7 +1449,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/ui,\ UIConfigurationManager \ UIElement \ UIElementFactory \ - UIElementFactoryManager \ UIElementSettings \ )) $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/ui/dialogs,\ @@ -3870,6 +3870,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/ui,\ XUIConfigurationStorage \ XUIElement \ XUIElementFactory \ + XUIElementFactoryManager \ XUIElementFactoryRegistration \ XUIElementSettings \ XUIFunctionListener \ diff --git a/offapi/com/sun/star/ui/UIElementFactoryManager.idl b/offapi/com/sun/star/ui/UIElementFactoryManager.idl index cf19f6c00c37..7ff3746f584a 100644 --- a/offapi/com/sun/star/ui/UIElementFactoryManager.idl +++ b/offapi/com/sun/star/ui/UIElementFactoryManager.idl @@ -17,11 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef __com_sun_star_ui_UIElementFactory_idl__ -#define __com_sun_star_ui_UIElementFactory_idl__ +#ifndef __com_sun_star_ui_UIElementFactoryManager_idl__ +#define __com_sun_star_ui_UIElementFactoryManager_idl__ -#include <com/sun/star/lang/XMultiComponentFactory.idl> -#include <com/sun/star/ui/XUIElementFactoryRegistration.idl> +#include <com/sun/star/ui/XUIElementFactoryManager.idl> module com { module sun { module star { module ui { @@ -37,24 +36,7 @@ module com { module sun { module star { module ui { @since OOo 2.0 */ -service UIElementFactoryManager -{ - /** provides a function to create new instances of user interface elements. - - <p> - A user interface element factory manager is also a user interface element factory. It - retrieves the responsible user interface element factory from the provided arguments and passes - the arguments to it. - - see @XUIElementFactory - </p> - */ - interface XUIElementFactory; - - /** provides functions to query, retrieve, register and deregister user interface element factories. - */ - interface XUIElementFactoryRegistration; -}; +service UIElementFactoryManager : XUIElementFactoryManager; }; }; }; }; diff --git a/offapi/com/sun/star/ui/XUIElementFactoryManager.idl b/offapi/com/sun/star/ui/XUIElementFactoryManager.idl new file mode 100644 index 000000000000..15ec523d3c51 --- /dev/null +++ b/offapi/com/sun/star/ui/XUIElementFactoryManager.idl @@ -0,0 +1,57 @@ +/* -*- 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_ui_XUIElementFactoryManager_idl__ +#define __com_sun_star_ui_XUIElementFactoryManager_idl__ + +#include <com/sun/star/lang/XMultiComponentFactory.idl> +#include <com/sun/star/ui/XUIElementFactoryRegistration.idl> + + +module com { module sun { module star { module ui { + + +/** Provides a unified interface for the new-style service XUIElementFactoryManager. + + @since LibreOffice 4.1 +*/ +interface XUIElementFactoryManager +{ + /** provides a function to create new instances of user interface elements. + + <p> + A user interface element factory manager is also a user interface element factory. It + retrieves the responsible user interface element factory from the provided arguments and passes + the arguments to it. + + see @XUIElementFactory + </p> + */ + interface XUIElementFactory; + + /** provides functions to query, retrieve, register and deregister user interface element factories. + */ + interface XUIElementFactoryRegistration; +}; + +}; }; }; }; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index fa73b7523b2e..a92d27e0330d 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -37,6 +37,7 @@ #include <com/sun/star/graphic/XGraphicProvider.hpp> #include <com/sun/star/accessibility/XAccessible.hpp> #include <com/sun/star/awt/XControl.hpp> +#include <com/sun/star/ui/UIElementFactoryManager.hpp> #include <comphelper/componentcontext.hxx> #include <comphelper/namedvaluecollection.hxx> @@ -76,6 +77,8 @@ namespace sfx2 using ::com::sun::star::container::XNameAccess; using ::com::sun::star::ui::XToolPanel; using ::com::sun::star::ui::XUIElementFactory; + using ::com::sun::star::ui::XUIElementFactoryManager; + using ::com::sun::star::ui::UIElementFactoryManager; using ::com::sun::star::ui::XUIElement; using ::com::sun::star::awt::XWindow; using ::com::sun::star::frame::XFrame; @@ -357,8 +360,7 @@ namespace sfx2 m_bAttemptedCreation = true; try { - const ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() ); - const Reference< XUIElementFactory > xFactory( aContext.createComponent( "com.sun.star.ui.UIElementFactoryManager" ), UNO_QUERY_THROW ); + const Reference< XUIElementFactoryManager > xFactory = UIElementFactoryManager::create( ::comphelper::getProcessComponentContext() ); ::comphelper::NamedValueCollection aCreationArgs; aCreationArgs.put( "Frame", makeAny( m_xFrame ) ); diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index d67b789a6053..340924714d38 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/frame/XModuleManager.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/ui/XUIFunctionListener.hpp> +#include <com/sun/star/ui/UIElementFactoryManager.hpp> #include <com/sun/star/frame/status/Visibility.hpp> #include <svl/eitem.hxx> #include <svl/stritem.hxx> @@ -774,7 +775,7 @@ void SfxToolBoxControl::createAndPositionSubToolBar( const ::rtl::OUString& rSub if ( pImpl->pBox ) { - static WeakReference< XUIElementFactory > xWeakUIElementFactory; + static WeakReference< XUIElementFactoryManager > xWeakUIElementFactory; sal_uInt16 nItemId = pImpl->pBox->GetDownItemId(); @@ -785,16 +786,13 @@ void SfxToolBoxControl::createAndPositionSubToolBar( const ::rtl::OUString& rSub Reference< XMultiServiceFactory > xServiceManager = getServiceManager(); Reference< XFrame > xFrame = getFrameInterface(); Reference< XUIElement > xUIElement; - Reference< XUIElementFactory > xUIEementFactory; + Reference< XUIElementFactoryManager > xUIElementFactory; - xUIEementFactory = xWeakUIElementFactory; - if ( !xUIEementFactory.is() ) + xUIElementFactory = xWeakUIElementFactory; + if ( !xUIElementFactory.is() ) { - xUIEementFactory = Reference< XUIElementFactory >( - xServiceManager->createInstance( - rtl::OUString( "com.sun.star.ui.UIElementFactoryManager" )), - UNO_QUERY ); - xWeakUIElementFactory = xUIEementFactory; + xUIElementFactory = UIElementFactoryManager::create( comphelper::getComponentContext(xServiceManager) ); + xWeakUIElementFactory = xUIElementFactory; } Sequence< PropertyValue > aPropSeq( 3 ); @@ -807,7 +805,7 @@ void SfxToolBoxControl::createAndPositionSubToolBar( const ::rtl::OUString& rSub try { - xUIElement = xUIEementFactory->createUIElement( rSubToolBarResName, aPropSeq ); + xUIElement = xUIElementFactory->createUIElement( rSubToolBarResName, aPropSeq ); } catch ( ::com::sun::star::container::NoSuchElementException& ) { |