diff options
author | Ariel Constenla-Haile <arielch@apache.org> | 2013-04-26 21:55:57 +0000 |
---|---|---|
committer | Ariel Constenla-Haile <arielch@apache.org> | 2013-04-26 21:55:57 +0000 |
commit | acc7fed28f54f836b0923180431a0c180f91e98c (patch) | |
tree | cae06645ca7668f01a794ee1b1287f71d776a385 /framework | |
parent | 95d7d94c77d26f751998b1c5020e8e5220218d21 (diff) |
UI Controller Factory fixes
- "ModuleName" --> "ModuleIdentifier": the IDL definition for
css::frame::PopupMenuControllerFactory and
css::frame::StatusbarControllerFactory tells to use a property named
"ModuleIdentifier", but in the code it is named "ModuleName"
- Undocumented css::frame::ToolbarControllerFactory
- Fix service name of ToolbarControllerFactory (ToolbarControllerFactory
instead of ToolBarControllerFactory)
- Convert the three service factories to new style, and use these
new-style services in the source code
- Implement multiple inheritance: added new css::frame::XUIControllerFactory
- Added a (true) base class and implemented the three factories in a
single file
Notes
Notes:
merged as: 8b050d1e91a6623fb2770421e564a74d6259d816
Diffstat (limited to 'framework')
23 files changed, 275 insertions, 564 deletions
diff --git a/framework/Library_fwk.mk b/framework/Library_fwk.mk index 31e32d67240c..db55c575540c 100644 --- a/framework/Library_fwk.mk +++ b/framework/Library_fwk.mk @@ -174,10 +174,8 @@ $(eval $(call gb_Library_add_exception_objects,fwk,\ framework/source/uifactory/addonstoolboxfactory \ framework/source/uifactory/factoryconfiguration \ framework/source/uifactory/menubarfactory \ - framework/source/uifactory/popupmenucontrollerfactory \ - framework/source/uifactory/statusbarcontrollerfactory \ framework/source/uifactory/statusbarfactory \ - framework/source/uifactory/toolbarcontrollerfactory \ + framework/source/uifactory/uicontrollerfactory \ framework/source/uifactory/toolboxfactory \ framework/source/uifactory/uielementfactorymanager \ framework/source/uifactory/windowcontentfactorymanager \ diff --git a/framework/inc/pch/precompiled_framework.hxx b/framework/inc/pch/precompiled_framework.hxx index 644cd2751978..ceac8cfe4c51 100644 --- a/framework/inc/pch/precompiled_framework.hxx +++ b/framework/inc/pch/precompiled_framework.hxx @@ -176,7 +176,7 @@ #include "com/sun/star/frame/XTasksSupplier.hpp" #include "com/sun/star/frame/XTerminateListener.hpp" #include "com/sun/star/frame/XToolbarController.hpp" -#include "com/sun/star/frame/XUIControllerRegistration.hpp" +#include "com/sun/star/frame/XUIControllerFactory.hpp" #include "com/sun/star/frame/XWindowArranger.hpp" #include "com/sun/star/frame/status/FontHeight.hpp" #include "com/sun/star/frame/status/ItemState.hpp" diff --git a/framework/inc/services.h b/framework/inc/services.h index 217edb738cb2..774122071188 100644 --- a/framework/inc/services.h +++ b/framework/inc/services.h @@ -102,7 +102,7 @@ namespace framework{ #define SERVICENAME_TEMPFILE DECLARE_ASCII("com.sun.star.io.TempFile" ) #define SERVICENAME_PACKAGESTRUCTURECREATOR DECLARE_ASCII("com.sun.star.embed.PackageStructureCreator" ) #define SERVICENAME_TOOLBARFACTORY DECLARE_ASCII("com.sun.star.ui.ToolBarFactory" ) -#define SERVICENAME_TOOLBARCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.frame.ToolBarControllerFactory" ) +#define SERVICENAME_TOOLBARCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.frame.ToolbarControllerFactory" ) #define SERVICENAME_LICENSE SERVICENAME_JOB #define SERVICENAME_AUTORECOVERY DECLARE_ASCII("com.sun.star.frame.AutoRecovery" ) #define SERVICENAME_GLOBALEVENTBROADCASTER DECLARE_ASCII("com.sun.star.frame.GlobalEventBroadcaster" ) diff --git a/framework/inc/uielement/menubarmanager.hxx b/framework/inc/uielement/menubarmanager.hxx index bef403d44e80..1d8ef3f37ff3 100644 --- a/framework/inc/uielement/menubarmanager.hxx +++ b/framework/inc/uielement/menubarmanager.hxx @@ -51,7 +51,7 @@ #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> -#include <com/sun/star/frame/XUIControllerRegistration.hpp> +#include <com/sun/star/frame/XUIControllerFactory.hpp> #include <com/sun/star/ui/XUIConfigurationListener.hpp> #include <com/sun/star/ui/XImageManager.hpp> #include <com/sun/star/ui/XAcceleratorConfiguration.hpp> @@ -253,7 +253,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::XUIControllerRegistration > m_xPopupMenuControllerRegistration; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XUIControllerFactory > m_xPopupMenuControllerFactory; ::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/uielement/statusbarmanager.hxx b/framework/inc/uielement/statusbarmanager.hxx index b579ba200a1d..471111155fd3 100644 --- a/framework/inc/uielement/statusbarmanager.hxx +++ b/framework/inc/uielement/statusbarmanager.hxx @@ -40,7 +40,7 @@ #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XStatusListener.hpp> #include <com/sun/star/frame/XStatusbarController.hpp> -#include <com/sun/star/frame/XUIControllerRegistration.hpp> +#include <com/sun/star/frame/XUIControllerFactory.hpp> #include <com/sun/star/ui/XUIConfiguration.hpp> #include <com/sun/star/frame/XModuleManager.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -132,7 +132,7 @@ class StatusBarManager : public ::com::sun::star::frame::XFrameActionListener StatusBarControllerMap m_aControllerMap; ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XUIControllerRegistration > m_xStatusbarControllerRegistration; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XUIControllerFactory > m_xStatusbarControllerFactory; }; } diff --git a/framework/inc/uielement/toolbarmanager.hxx b/framework/inc/uielement/toolbarmanager.hxx index 284c126eea2d..64edf018c199 100644 --- a/framework/inc/uielement/toolbarmanager.hxx +++ b/framework/inc/uielement/toolbarmanager.hxx @@ -46,7 +46,7 @@ #include <com/sun/star/container/XIndexContainer.hpp> #include <com/sun/star/frame/XModuleManager.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/frame/XUIControllerRegistration.hpp> +#include <com/sun/star/frame/XUIControllerFactory.hpp> #include <com/sun/star/ui/XImageManager.hpp> #include <com/sun/star/ui/XUIConfigurationManager.hpp> #include <com/sun/star/frame/XStatusListener.hpp> @@ -230,7 +230,7 @@ class ToolBarManager : public ::com::sun::star::frame::XFrameActionListener ToolBarControllerMap m_aControllerMap; ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XUIControllerRegistration > m_xToolbarControllerRegistration; + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XUIControllerFactory > m_xToolbarControllerFactory; ::com::sun::star::uno::Reference< ::com::sun::star::ui::XImageManager > m_xModuleImageManager; ::com::sun::star::uno::Reference< ::com::sun::star::ui::XImageManager > m_xDocImageManager; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > m_xImageOrientationListener; diff --git a/framework/inc/uifactory/factoryconfiguration.hxx b/framework/inc/uifactory/factoryconfiguration.hxx index a3d21b4cb323..4feb42958a96 100644 --- a/framework/inc/uifactory/factoryconfiguration.hxx +++ b/framework/inc/uifactory/factoryconfiguration.hxx @@ -38,7 +38,6 @@ #include <com/sun/star/container/XContainerListener.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> -#include <com/sun/star/frame/XUIControllerRegistration.hpp> //_________________________________________________________________________________________________________________ // other includes diff --git a/framework/inc/uifactory/popupmenucontrollerfactory.hxx b/framework/inc/uifactory/popupmenucontrollerfactory.hxx deleted file mode 100644 index c4bd8c653fa8..000000000000 --- a/framework/inc/uifactory/popupmenucontrollerfactory.hxx +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************** - * - * 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 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef __FRAMEWORK_UIFACTORY_POPUPMENUCONTROLLERFACTORY_HXX_ -#define __FRAMEWORK_UIFACTORY_POPUPMENUCONTROLLERFACTORY_HXX_ - -/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble - with solaris headers ... -*/ -#include <vector> -#include <list> - -//_________________________________________________________________________________________________________________ -// my own includes -//_________________________________________________________________________________________________________________ -#include <macros/xserviceinfo.hxx> -#include <stdtypes.h> -#include <uifactory/toolbarcontrollerfactory.hxx> - -//_________________________________________________________________________________________________________________ -// interface includes -//_________________________________________________________________________________________________________________ - -//_________________________________________________________________________________________________________________ -// other includes -//_________________________________________________________________________________________________________________ - -namespace framework -{ - -class ConfigurationAccess_ControllerFactory; -class PopupMenuControllerFactory : public ToolbarControllerFactory -{ - public: - PopupMenuControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); - - // XInterface, XTypeProvider, XServiceInfo - DECLARE_XSERVICEINFO -}; - -} // namespace framework - -#endif // __FRAMEWORK_SERVICES_POPUPMENUCONTROLLERFACTORY_HXX_ diff --git a/framework/inc/uifactory/statusbarcontrollerfactory.hxx b/framework/inc/uifactory/statusbarcontrollerfactory.hxx deleted file mode 100644 index b65f3dcfcfd2..000000000000 --- a/framework/inc/uifactory/statusbarcontrollerfactory.hxx +++ /dev/null @@ -1,58 +0,0 @@ -/************************************************************** - * - * 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 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef __FRAMEWORK_UIFACTORY_STATUSBARCONTROLLERFACTORY_HXX_ -#define __FRAMEWORK_UIFACTORY_STATUSBARCONTROLLERFACTORY_HXX_ - -//_________________________________________________________________________________________________________________ -// my own includes -//_________________________________________________________________________________________________________________ -#include <macros/xserviceinfo.hxx> -#include <uifactory/toolbarcontrollerfactory.hxx> -#include <stdtypes.h> - -//_________________________________________________________________________________________________________________ -// interface includes -//_________________________________________________________________________________________________________________ - -//_________________________________________________________________________________________________________________ -// other includes -//_________________________________________________________________________________________________________________ - - -namespace framework -{ - -class ConfigurationAccess_ControllerFactory; -class StatusbarControllerFactory : public ToolbarControllerFactory -{ - public: - StatusbarControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); - - // XInterface, XTypeProvider, XServiceInfo - DECLARE_XSERVICEINFO -}; - -} // namespace framework - -#endif // __FRAMEWORK_SERVICES_STATUSBARCONTROLLERFACTORY_HXX_ diff --git a/framework/inc/uifactory/toolbarcontrollerfactory.hxx b/framework/inc/uifactory/uicontrollerfactory.hxx index 076173788deb..c058f5a693b7 100644 --- a/framework/inc/uifactory/toolbarcontrollerfactory.hxx +++ b/framework/inc/uifactory/uicontrollerfactory.hxx @@ -19,14 +19,8 @@ * *************************************************************/ - - -#ifndef __FRAMEWORK_UIFACTORY_TOOLBARCONTROLLERFACTORY_HXX_ -#define __FRAMEWORK_UIFACTORY_TOOLBARCONTROLLERFACTORY_HXX_ - -//_________________________________________________________________________________________________________________ -// my own includes -//_________________________________________________________________________________________________________________ +#ifndef __FRAMEWORK_UICONTROLLERFACTORY_HXX_ +#define __FRAMEWORK_UICONTROLLERFACTORY_HXX_ #include <threadhelp/threadhelpbase.hxx> #include <macros/generic.hxx> @@ -35,35 +29,28 @@ #include <macros/xserviceinfo.hxx> #include <stdtypes.h> -//_________________________________________________________________________________________________________________ -// interface includes -//_________________________________________________________________________________________________________________ #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XTypeProvider.hpp> -#include <com/sun/star/lang/XMultiComponentFactory.hpp> -#include <com/sun/star/frame/XUIControllerRegistration.hpp> +#include <com/sun/star/frame/XUIControllerFactory.hpp> -//_________________________________________________________________________________________________________________ -// other includes -//_________________________________________________________________________________________________________________ -#include <cppuhelper/implbase3.hxx> -#include <rtl/ustring.hxx> +#include <cppuhelper/implbase2.hxx> namespace framework { class ConfigurationAccess_ControllerFactory; -class ToolbarControllerFactory : protected ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. - public ::cppu::WeakImplHelper3< com::sun::star::lang::XServiceInfo, - com::sun::star::lang::XMultiComponentFactory, - com::sun::star::frame::XUIControllerRegistration> +class UIControllerFactory : 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::XUIControllerFactory > { public: - ToolbarControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); - virtual ~ToolbarControllerFactory(); + virtual ~UIControllerFactory(); - // XInterface, XTypeProvider, XServiceInfo - DECLARE_XSERVICEINFO + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException) = 0; + virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException) = 0; + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException) = 0; // XMultiComponentFactory virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithContext( const ::rtl::OUString& aServiceSpecifier, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); @@ -76,12 +63,39 @@ class ToolbarControllerFactory : protected ThreadHelpBase virtual void SAL_CALL deregisterController( const ::rtl::OUString& aCommandURL, const rtl::OUString& aModuleName ) throw (::com::sun::star::uno::RuntimeException); protected: - ToolbarControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager,bool ); + UIControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager, const rtl::OUString &rUINode ); sal_Bool m_bConfigRead; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; ConfigurationAccess_ControllerFactory* m_pConfigAccess; }; -} // namespace framework +class PopupMenuControllerFactory : public UIControllerFactory +{ + public: + PopupMenuControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + + // XInterface, XTypeProvider, XServiceInfo + DECLARE_XSERVICEINFO +}; + +class ToolbarControllerFactory : public UIControllerFactory +{ + public: + ToolbarControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + + // XInterface, XTypeProvider, XServiceInfo + DECLARE_XSERVICEINFO +}; + +class StatusbarControllerFactory : public UIControllerFactory +{ + public: + StatusbarControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + + // XInterface, XTypeProvider, XServiceInfo + DECLARE_XSERVICEINFO +}; + +} -#endif // __FRAMEWORK_SERVICES_TOOLBARCONTROLLERFACTORY_HXX_ +#endif // __FRAMEWORK_UICONTROLLERFACTORY_HXX_ diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 03a8fdb8436d..20b18fc206ca 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -48,7 +48,6 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/frame/FrameAction.hpp> -#include <com/sun/star/frame/XUIControllerRegistration.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/awt/XTopWindow.hpp> #include <com/sun/star/awt/XSystemDependentMenuPeer.hpp> diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx index 813cf48981c6..f7ef1070eb6a 100644 --- a/framework/source/register/registerservices.cxx +++ b/framework/source/register/registerservices.cxx @@ -58,7 +58,7 @@ #include <services/backingcomp.hxx> #include <services/layoutmanager.hxx> #include <uifactory/uielementfactorymanager.hxx> -#include <uifactory/popupmenucontrollerfactory.hxx> +#include <uifactory/uicontrollerfactory.hxx> #include <uielement/objectmenucontroller.hxx> #include <uielement/controlmenucontroller.hxx> #include <uielement/uicommanddescription.hxx> @@ -72,8 +72,6 @@ #include <uifactory/toolboxfactory.hxx> #include <uifactory/addonstoolboxfactory.hxx> #include "uiconfiguration/windowstateconfiguration.hxx" -#include "uifactory/toolbarcontrollerfactory.hxx" -#include "uifactory/statusbarcontrollerfactory.hxx" #include <services/autorecovery.hxx> #include <helper/statusindicatorfactory.hxx> #include <uielement/recentfilesmenucontroller.hxx> diff --git a/framework/source/uielement/addonstoolbarmanager.cxx b/framework/source/uielement/addonstoolbarmanager.cxx index 9b2fd5eecbff..d7f7d19f4722 100644 --- a/framework/source/uielement/addonstoolbarmanager.cxx +++ b/framework/source/uielement/addonstoolbarmanager.cxx @@ -262,7 +262,6 @@ void AddonsToolBarManager::FillToolbar( const Sequence< Sequence< PropertyValue { } - Reference< XMultiComponentFactory > xToolbarControllerFactory( m_xToolbarControllerRegistration, UNO_QUERY ); Reference< XComponentContext > xComponentContext; Reference< XPropertySet > xProps( m_xServiceManager, UNO_QUERY ); @@ -327,41 +326,38 @@ void AddonsToolBarManager::FillToolbar( const Sequence< Sequence< PropertyValue sal_Bool bMustBeInit( sal_True ); // Support external toolbar controller for add-ons! - if ( m_xToolbarControllerRegistration.is() && - m_xToolbarControllerRegistration->hasController( aURL, m_aModuleIdentifier )) + if ( m_xToolbarControllerFactory.is() && + m_xToolbarControllerFactory->hasController( aURL, m_aModuleIdentifier )) { - if ( xToolbarControllerFactory.is() ) + Sequence< Any > aArgs(5); + PropertyValue aPropValue; + + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleIdentifier" )); + aPropValue.Value <<= m_aModuleIdentifier; + aArgs[0] <<= aPropValue; + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); + aPropValue.Value <<= m_xFrame; + aArgs[1] <<= aPropValue; + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" )); + aPropValue.Value <<= m_xServiceManager; + aArgs[2] <<= aPropValue; + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )); + aPropValue.Value <<= xToolbarWindow; + aArgs[3] <<= aPropValue; + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ItemId" )); + aPropValue.Value = makeAny( sal_Int32( nId )); + aArgs[4] <<= aPropValue; + + try + { + xController = Reference< XStatusListener >( m_xToolbarControllerFactory->createInstanceWithArgumentsAndContext( + aURL, aArgs, xComponentContext ), + UNO_QUERY ); + } + catch ( uno::Exception& ) { - Sequence< Any > aArgs(5); - PropertyValue aPropValue; - - aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleName" )); - aPropValue.Value <<= m_aModuleIdentifier; - aArgs[0] <<= aPropValue; - aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); - aPropValue.Value <<= m_xFrame; - aArgs[1] <<= aPropValue; - aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" )); - aPropValue.Value <<= m_xServiceManager; - aArgs[2] <<= aPropValue; - aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )); - aPropValue.Value <<= xToolbarWindow; - aArgs[3] <<= aPropValue; - aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ItemId" )); - aPropValue.Value = makeAny( sal_Int32( nId )); - aArgs[4] <<= aPropValue; - - try - { - xController = Reference< XStatusListener >( xToolbarControllerFactory->createInstanceWithArgumentsAndContext( - aURL, aArgs, xComponentContext ), - UNO_QUERY ); - } - catch ( uno::Exception& ) - { - } - bMustBeInit = sal_False; // factory called init already! } + bMustBeInit = sal_False; // factory called init already! } else { diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index 46863f06cb9f..759da39c4da3 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -57,7 +57,7 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/frame/XPopupMenuController.hpp> -#include <com/sun/star/frame/XUIControllerRegistration.hpp> +#include <com/sun/star/frame/PopupMenuControllerFactory.hpp> #ifndef _COM_SUN_STAR_LANG_XSYSTEMDEPENDENT_HPP_ #include <com/sun/star/lang/SystemDependent.hpp> #endif @@ -221,9 +221,8 @@ MenuBarManager::MenuBarManager( , m_nSymbolsStyle( SvtMiscOptions().GetCurrentSymbolsStyle() ) { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "MenuBarManager::MenuBarManager" ); - m_xPopupMenuControllerRegistration = Reference< ::com::sun::star::frame::XUIControllerRegistration >( - getServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.PopupMenuControllerFactory" ))), - UNO_QUERY ); + m_xPopupMenuControllerFactory = frame::PopupMenuControllerFactory::create( + ::comphelper::getProcessComponentContext() ); FillMenuManager( pMenu, rFrame, rDispatchProvider, rModuleIdentifier, bDelete, bDeleteChildren ); } @@ -429,7 +428,7 @@ void SAL_CALL MenuBarManager::dispose() throw( RuntimeException ) m_xModuleAcceleratorManager.clear(); m_xDocAcceleratorManager.clear(); m_xUICommandLabels.clear(); - m_xPopupMenuControllerRegistration.clear(); + m_xPopupMenuControllerFactory.clear(); mxServiceFactory.clear(); } } @@ -980,7 +979,7 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu ) sal_Bool bPopupMenu( sal_False ); if ( !pMenuItemHandler->xPopupMenuController.is() && - m_xPopupMenuControllerRegistration->hasController( aItemCommand, rtl::OUString() )) + m_xPopupMenuControllerFactory->hasController( aItemCommand, rtl::OUString() )) { bPopupMenu = CreatePopupMenuController( pMenuItemHandler ); } @@ -1222,39 +1221,38 @@ sal_Bool MenuBarManager::CreatePopupMenuController( MenuItemHandler* pMenuItemHa rtl::OUString aItemCommand( pMenuItemHandler->aMenuItemURL ); // Try instanciate a popup menu controller. It is stored in the menu item handler. - Reference< XMultiComponentFactory > xPopupMenuControllerFactory( m_xPopupMenuControllerRegistration, UNO_QUERY ); - if ( xPopupMenuControllerFactory.is() ) + if ( !m_xPopupMenuControllerFactory.is() ) + return sal_False; + + Sequence< Any > aSeq( 2 ); + PropertyValue aPropValue; + + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleIdentifier" )); + aPropValue.Value <<= m_aModuleIdentifier; + aSeq[0] <<= aPropValue; + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); + aPropValue.Value <<= m_xFrame; + aSeq[1] <<= aPropValue; + + Reference< XComponentContext > xComponentContext; + Reference< XPropertySet > xProps( getServiceFactory(), UNO_QUERY ); + + xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= + xComponentContext; + + Reference< XPopupMenuController > xPopupMenuController( + m_xPopupMenuControllerFactory->createInstanceWithArgumentsAndContext( + aItemCommand, + aSeq, + xComponentContext ), + UNO_QUERY ); + + if ( xPopupMenuController.is() ) { - Sequence< Any > aSeq( 2 ); - PropertyValue aPropValue; - - aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleName" )); - aPropValue.Value <<= m_aModuleIdentifier; - aSeq[0] <<= aPropValue; - aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); - aPropValue.Value <<= m_xFrame; - aSeq[1] <<= aPropValue; - - Reference< XComponentContext > xComponentContext; - Reference< XPropertySet > xProps( getServiceFactory(), UNO_QUERY ); - - xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>= - xComponentContext; - - 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; - } + // Provide our awt popup menu to the popup menu controller + pMenuItemHandler->xPopupMenuController = xPopupMenuController; + xPopupMenuController->setPopupMenu( pMenuItemHandler->xPopupMenu ); + return sal_True; } return sal_False; @@ -1348,9 +1346,9 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF pMenu->SetHelpCommand( nItemId, aEmpty ); } - if ( m_xPopupMenuControllerRegistration.is() && + if ( m_xPopupMenuControllerFactory.is() && pPopup->GetItemCount() == 0 && - m_xPopupMenuControllerRegistration->hasController( aItemCommand, rtl::OUString() ) + m_xPopupMenuControllerFactory->hasController( aItemCommand, rtl::OUString() ) ) { // Check if we have to create a popup menu for a uno based popup menu controller. @@ -1487,8 +1485,8 @@ void MenuBarManager::FillMenuManager( Menu* pMenu, const Reference< XFrame >& rF MenuItemHandler* pItemHandler = new MenuItemHandler( nItemId, xStatusListener, xDispatch ); pItemHandler->aMenuItemURL = aItemCommand; - if ( m_xPopupMenuControllerRegistration.is() && - m_xPopupMenuControllerRegistration->hasController( aItemCommand, rtl::OUString() )) + if ( m_xPopupMenuControllerFactory.is() && + m_xPopupMenuControllerFactory->hasController( aItemCommand, rtl::OUString() )) { // Check if we have to create a popup menu for a uno based popup menu controller. // We have to set an empty popup menu into our menu structure so the controller also @@ -2070,9 +2068,8 @@ void MenuBarManager::Init(const Reference< XFrame >& rFrame,AddonMenu* pAddonMen m_bIsBookmarkMenu = sal_True; rtl::OUString aModuleIdentifier; - m_xPopupMenuControllerRegistration = Reference< ::com::sun::star::frame::XUIControllerRegistration >( - getServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.PopupMenuControllerFactory" ))), - UNO_QUERY ); + m_xPopupMenuControllerFactory = frame::PopupMenuControllerFactory::create( + ::comphelper::getProcessComponentContext()); const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); m_bWasHiContrast = rSettings.GetHighContrastMode(); @@ -2123,8 +2120,8 @@ void MenuBarManager::Init(const Reference< XFrame >& rFrame,AddonMenu* pAddonMen // Check if we have to create a popup menu for a uno based popup menu controller. // We have to set an empty popup menu into our menu structure so the controller also // works with inplace OLE. - if ( m_xPopupMenuControllerRegistration.is() && - m_xPopupMenuControllerRegistration->hasController( aItemCommand, rtl::OUString() )) + if ( m_xPopupMenuControllerFactory.is() && + m_xPopupMenuControllerFactory->hasController( aItemCommand, rtl::OUString() )) { VCLXPopupMenu* pVCLXPopupMenu = new VCLXPopupMenu; PopupMenu* pCtlPopupMenu = (PopupMenu *)pVCLXPopupMenu->GetMenu(); diff --git a/framework/source/uielement/popupmenucontroller.cxx b/framework/source/uielement/popupmenucontroller.cxx index 4709a594d275..2b9e24a46a07 100644 --- a/framework/source/uielement/popupmenucontroller.cxx +++ b/framework/source/uielement/popupmenucontroller.cxx @@ -168,7 +168,7 @@ bool PopupMenuController::CreatePopupMenuController() throw (Exception) Sequence< Any > aSeq( 2 ); PropertyValue aPropValue; - aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleName" )); + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleIdentifier" )); aPropValue.Value <<= getModuleName(); aSeq[0] <<= aPropValue; aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx index 93079fac6e9a..060c10081aa5 100644 --- a/framework/source/uielement/statusbarmanager.cxx +++ b/framework/source/uielement/statusbarmanager.cxx @@ -44,6 +44,7 @@ #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/StatusbarControllerFactory.hpp> #include <com/sun/star/util/XUpdatable.hpp> #include <com/sun/star/ui/ItemStyle.hpp> #include <com/sun/star/ui/ItemType.hpp> @@ -56,6 +57,7 @@ #include <toolkit/helper/vclunohelper.hxx> #include <svtools/statusbarcontroller.hxx> +#include <comphelper/processfactory.hxx> #include <vcl/status.hxx> #include <vcl/svapp.hxx> @@ -188,10 +190,8 @@ StatusBarManager::StatusBarManager( { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::StatusBarManager" ); - if ( m_xServiceManager.is() ) - m_xStatusbarControllerRegistration = uno::Reference< css::frame::XUIControllerRegistration >( - m_xServiceManager->createInstance( SERVICENAME_STATUSBARCONTROLLERFACTORY ), - uno::UNO_QUERY ); + m_xStatusbarControllerFactory = frame::StatusbarControllerFactory::create( + ::comphelper::getProcessComponentContext()); m_pStatusBar->SetClickHdl( LINK( this, StatusBarManager, Click ) ); m_pStatusBar->SetDoubleClickHdl( LINK( this, StatusBarManager, DoubleClick ) ); @@ -369,7 +369,6 @@ rtl::OUString StatusBarManager::RetrieveLabelFromCommand( const rtl::OUString& a void StatusBarManager::CreateControllers() { RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "StatusBarManager::CreateControllers" ); - uno::Reference< lang::XMultiComponentFactory > xStatusbarControllerFactory( m_xStatusbarControllerRegistration, uno::UNO_QUERY ); uno::Reference< uno::XComponentContext > xComponentContext; uno::Reference< beans::XPropertySet > xProps( m_xServiceManager, uno::UNO_QUERY ); uno::Reference< awt::XWindow > xStatusbarWindow = VCLUnoHelper::GetInterface( m_pStatusBar ); @@ -394,47 +393,44 @@ void StatusBarManager::CreateControllers() svt::StatusbarController* pController( 0 ); // 1º) UNO Statusbar controllers, registered in Controllers.xcu - if ( m_xStatusbarControllerRegistration.is() && - m_xStatusbarControllerRegistration->hasController( aCommandURL, m_aModuleIdentifier )) + if ( m_xStatusbarControllerFactory.is() && + m_xStatusbarControllerFactory->hasController( aCommandURL, m_aModuleIdentifier )) { - if ( xStatusbarControllerFactory.is() ) - { - beans::PropertyValue aPropValue; - std::vector< uno::Any > aPropVector; - - aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleName" )); - aPropValue.Value = uno::makeAny( m_aModuleIdentifier ); - aPropVector.push_back( uno::makeAny( aPropValue ) ); - - aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); - aPropValue.Value = uno::makeAny( m_xFrame ); - aPropVector.push_back( uno::makeAny( aPropValue ) ); - - // TODO remove this - aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" )); - aPropValue.Value = uno::makeAny( m_xServiceManager ); - aPropVector.push_back( uno::makeAny( aPropValue ) ); - - aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )); - aPropValue.Value = uno::makeAny( xStatusbarWindow ); - aPropVector.push_back( uno::makeAny( aPropValue ) ); - - // TODO still needing with the css::ui::XStatusbarItem? - aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Identifier" )); - aPropValue.Value = uno::makeAny( nId ); - aPropVector.push_back( uno::makeAny( aPropValue ) ); - - aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StatusbarItem" )); - aPropValue.Value <<= xStatusbarItem; - aPropVector.push_back( uno::makeAny( aPropValue ) ); - - uno::Sequence< uno::Any > aArgs( comphelper::containerToSequence( aPropVector ) ); - xController = uno::Reference< frame::XStatusListener >( - xStatusbarControllerFactory->createInstanceWithArgumentsAndContext( - aCommandURL, aArgs, xComponentContext ), - uno::UNO_QUERY ); - bInit = sal_False; // Initialization is done through the factory service - } + beans::PropertyValue aPropValue; + std::vector< uno::Any > aPropVector; + + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleIdentifier" )); + aPropValue.Value = uno::makeAny( m_aModuleIdentifier ); + aPropVector.push_back( uno::makeAny( aPropValue ) ); + + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); + aPropValue.Value = uno::makeAny( m_xFrame ); + aPropVector.push_back( uno::makeAny( aPropValue ) ); + + // TODO remove this + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" )); + aPropValue.Value = uno::makeAny( m_xServiceManager ); + aPropVector.push_back( uno::makeAny( aPropValue ) ); + + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )); + aPropValue.Value = uno::makeAny( xStatusbarWindow ); + aPropVector.push_back( uno::makeAny( aPropValue ) ); + + // TODO still needing with the css::ui::XStatusbarItem? + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Identifier" )); + aPropValue.Value = uno::makeAny( nId ); + aPropVector.push_back( uno::makeAny( aPropValue ) ); + + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StatusbarItem" )); + aPropValue.Value <<= xStatusbarItem; + aPropVector.push_back( uno::makeAny( aPropValue ) ); + + uno::Sequence< uno::Any > aArgs( comphelper::containerToSequence( aPropVector ) ); + xController = uno::Reference< frame::XStatusListener >( + m_xStatusbarControllerFactory->createInstanceWithArgumentsAndContext( + aCommandURL, aArgs, xComponentContext ), + uno::UNO_QUERY ); + bInit = sal_False; // Initialization is done through the factory service } if ( !xController.is() ) diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 5919ce40ae28..c65e0e00b550 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -64,6 +64,7 @@ #include <com/sun/star/graphic/XGraphic.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ToolbarControllerFactory.hpp> #include <com/sun/star/ui/XUIElementSettings.hpp> #include <com/sun/star/ui/XUIConfigurationPersistence.hpp> #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> @@ -84,6 +85,7 @@ #include <toolkit/unohlp.hxx> #endif #include <comphelper/mediadescriptor.hxx> +#include <comphelper/processfactory.hxx> #include <svtools/miscopt.hxx> #include <svl/imageitm.hxx> #include <svtools/framestatuslistener.hxx> @@ -269,15 +271,13 @@ ToolBarManager::ToolBarManager( const Reference< XMultiServiceFactory >& rServic if ( pWindow ) ((SystemWindow *)pWindow)->GetTaskPaneList()->AddWindow( m_pToolBar ); - if ( m_xServiceManager.is() ) + Reference< XComponentContext > xContext(::comphelper::getProcessComponentContext()); + if ( xContext.is() ) { - m_xToolbarControllerRegistration = Reference< XUIControllerRegistration >( - m_xServiceManager->createInstance( SERVICENAME_TOOLBARCONTROLLERFACTORY ), - UNO_QUERY ); + m_xToolbarControllerFactory = frame::ToolbarControllerFactory::create( xContext ); - m_xURLTransformer.set( m_xServiceManager->createInstance( - SERVICENAME_URLTRANSFORMER), - UNO_QUERY ); + m_xURLTransformer.set( xContext->getServiceManager()->createInstanceWithContext( + SERVICENAME_URLTRANSFORMER, xContext), UNO_QUERY ); } m_pToolBar->SetSelectHdl( LINK( this, ToolBarManager, Select) ); @@ -928,7 +928,6 @@ void ToolBarManager::CreateControllers() { RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::ToolBarManager::CreateControllers" ); - Reference< XMultiComponentFactory > xToolbarControllerFactory( m_xToolbarControllerRegistration, UNO_QUERY ); Reference< XComponentContext > xComponentContext; Reference< XPropertySet > xProps( m_xServiceManager, UNO_QUERY ); Reference< XWindow > xToolbarWindow = VCLUnoHelper::GetInterface( m_pToolBar ); @@ -968,40 +967,37 @@ void ToolBarManager::CreateControllers() } } - if ( m_xToolbarControllerRegistration.is() && - m_xToolbarControllerRegistration->hasController( aCommandURL, m_aModuleIdentifier )) + if ( m_xToolbarControllerFactory.is() && + m_xToolbarControllerFactory->hasController( aCommandURL, m_aModuleIdentifier )) { - if ( xToolbarControllerFactory.is() ) + PropertyValue aPropValue; + std::vector< Any > aPropertyVector; + + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleIdentifier" )); + aPropValue.Value <<= m_aModuleIdentifier; + aPropertyVector.push_back( makeAny( aPropValue )); + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); + aPropValue.Value <<= m_xFrame; + aPropertyVector.push_back( makeAny( aPropValue )); + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" )); + aPropValue.Value <<= m_xServiceManager; + aPropertyVector.push_back( makeAny( aPropValue )); + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )); + aPropValue.Value <<= xToolbarWindow; + aPropertyVector.push_back( makeAny( aPropValue )); + + if ( nWidth > 0 ) { - PropertyValue aPropValue; - std::vector< Any > aPropertyVector; - - aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleName" )); - aPropValue.Value <<= m_aModuleIdentifier; - aPropertyVector.push_back( makeAny( aPropValue )); - aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); - aPropValue.Value <<= m_xFrame; + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" )); + aPropValue.Value <<= nWidth; aPropertyVector.push_back( makeAny( aPropValue )); - aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ServiceManager" )); - aPropValue.Value <<= m_xServiceManager; - aPropertyVector.push_back( makeAny( aPropValue )); - aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )); - aPropValue.Value <<= xToolbarWindow; - aPropertyVector.push_back( makeAny( aPropValue )); - - if ( nWidth > 0 ) - { - aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Width" )); - aPropValue.Value <<= nWidth; - aPropertyVector.push_back( makeAny( aPropValue )); - } - - Sequence< Any > aArgs( comphelper::containerToSequence( aPropertyVector )); - xController = Reference< XStatusListener >( xToolbarControllerFactory->createInstanceWithArgumentsAndContext( - aCommandURL, aArgs, xComponentContext ), - UNO_QUERY ); - bInit = sal_False; // Initialization is done through the factory service } + + Sequence< Any > aArgs( comphelper::containerToSequence( aPropertyVector )); + xController = Reference< XStatusListener >( m_xToolbarControllerFactory->createInstanceWithArgumentsAndContext( + aCommandURL, aArgs, xComponentContext ), + UNO_QUERY ); + bInit = sal_False; // Initialization is done through the factory service } if (( aCommandURL == aLoadURL ) && ( !m_pToolBar->IsItemVisible(nId))) @@ -1098,7 +1094,7 @@ void ToolBarManager::CreateControllers() aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ParentWindow" )); aPropValue.Value <<= xToolbarWindow; aPropertyVector.push_back( makeAny( aPropValue )); - aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleName" )); + aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ModuleIdentifier" )); aPropValue.Value <<= m_aModuleIdentifier; aPropertyVector.push_back( makeAny( aPropValue )); diff --git a/framework/source/uifactory/factoryconfiguration.cxx b/framework/source/uifactory/factoryconfiguration.cxx index 1a32d0f0b008..34954051d4d3 100644 --- a/framework/source/uifactory/factoryconfiguration.cxx +++ b/framework/source/uifactory/factoryconfiguration.cxx @@ -56,7 +56,6 @@ using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::container; -using namespace ::com::sun::star::frame; //_________________________________________________________________________________________________________________ // Namespace diff --git a/framework/source/uifactory/popupmenucontrollerfactory.cxx b/framework/source/uifactory/popupmenucontrollerfactory.cxx deleted file mode 100644 index 8533152263de..000000000000 --- a/framework/source/uifactory/popupmenucontrollerfactory.cxx +++ /dev/null @@ -1,89 +0,0 @@ -/************************************************************** - * - * 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 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_framework.hxx" - -//_________________________________________________________________________________________________________________ -// my own includes -//_________________________________________________________________________________________________________________ -#include "uifactory/popupmenucontrollerfactory.hxx" -#include <threadhelp/resetableguard.hxx> -#include "services.h" -#include "uifactory/factoryconfiguration.hxx" - -//_________________________________________________________________________________________________________________ -// interface includes -//_________________________________________________________________________________________________________________ -#include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/container/XNameContainer.hpp> -#include <com/sun/star/container/XContainer.hpp> - -//_________________________________________________________________________________________________________________ -// includes of other projects -//_________________________________________________________________________________________________________________ -#include <rtl/ustrbuf.hxx> -#include <cppuhelper/weak.hxx> -#include <rtl/logfile.hxx> - -//_________________________________________________________________________________________________________________ -// Defines -//_________________________________________________________________________________________________________________ -// - -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::beans; -using namespace com::sun::star::container; -using namespace ::com::sun::star::frame; - -//_________________________________________________________________________________________________________________ -// Namespace -//_________________________________________________________________________________________________________________ -// - -namespace framework -{ - -//***************************************************************************************************************** -// XInterface, XTypeProvider, XServiceInfo -//***************************************************************************************************************** -DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( PopupMenuControllerFactory , - ::cppu::OWeakObject , - SERVICENAME_POPUPMENUCONTROLLERFACTORY , - IMPLEMENTATIONNAME_POPUPMENUCONTROLLERFACTORY - ) - -DEFINE_INIT_SERVICE ( PopupMenuControllerFactory, {} ) - -PopupMenuControllerFactory::PopupMenuControllerFactory( const Reference< XMultiServiceFactory >& xServiceManager ) : - ToolbarControllerFactory(xServiceManager,true) -{ - RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "PopupMenuControllerFactory::PopupMenuControllerFactory" ); - m_pConfigAccess = new ConfigurationAccess_ControllerFactory( m_xServiceManager,rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Controller/Registered/PopupMenu" )) ); - m_pConfigAccess->acquire(); -} - -} // namespace framework diff --git a/framework/source/uifactory/statusbarcontrollerfactory.cxx b/framework/source/uifactory/statusbarcontrollerfactory.cxx deleted file mode 100644 index dcc3caf513af..000000000000 --- a/framework/source/uifactory/statusbarcontrollerfactory.cxx +++ /dev/null @@ -1,87 +0,0 @@ -/************************************************************** - * - * 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 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_framework.hxx" - -//_________________________________________________________________________________________________________________ -// my own includes -//_________________________________________________________________________________________________________________ -#include "uifactory/statusbarcontrollerfactory.hxx" -#include "uifactory/factoryconfiguration.hxx" -#include <threadhelp/resetableguard.hxx> -#include "services.h" - -//_________________________________________________________________________________________________________________ -// interface includes -//_________________________________________________________________________________________________________________ -#include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/container/XNameContainer.hpp> -#include <com/sun/star/container/XContainer.hpp> - -//_________________________________________________________________________________________________________________ -// includes of other projects -//_________________________________________________________________________________________________________________ -#include <rtl/ustrbuf.hxx> -#include <cppuhelper/weak.hxx> - -//_________________________________________________________________________________________________________________ -// Defines -//_________________________________________________________________________________________________________________ -// - -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::beans; -using namespace com::sun::star::container; -using namespace ::com::sun::star::frame; - -//_________________________________________________________________________________________________________________ -// Namespace -//_________________________________________________________________________________________________________________ -// - -namespace framework -{ -//***************************************************************************************************************** -// XInterface, XTypeProvider, XServiceInfo -//***************************************************************************************************************** -DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( StatusbarControllerFactory , - ::cppu::OWeakObject , - SERVICENAME_STATUSBARCONTROLLERFACTORY , - IMPLEMENTATIONNAME_STATUSBARCONTROLLERFACTORY - ) - -DEFINE_INIT_SERVICE ( StatusbarControllerFactory, {} ) - -StatusbarControllerFactory::StatusbarControllerFactory( const Reference< XMultiServiceFactory >& xServiceManager ) : - ToolbarControllerFactory(xServiceManager,true) -{ - m_pConfigAccess = new ConfigurationAccess_ControllerFactory( m_xServiceManager,rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Controller/Registered/StatusBar" )),true ); - m_pConfigAccess->acquire(); -} - - -} // namespace framework diff --git a/framework/source/uifactory/toolbarcontrollerfactory.cxx b/framework/source/uifactory/uicontrollerfactory.cxx index 0edd673bcda8..10791e3340d3 100644 --- a/framework/source/uifactory/toolbarcontrollerfactory.cxx +++ b/framework/source/uifactory/uicontrollerfactory.cxx @@ -24,77 +24,48 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_framework.hxx" -//_________________________________________________________________________________________________________________ -// my own includes -//_________________________________________________________________________________________________________________ -#include "uifactory/toolbarcontrollerfactory.hxx" -#include "uifactory/factoryconfiguration.hxx" +#include <uifactory/uicontrollerfactory.hxx> +#include <uifactory/factoryconfiguration.hxx> #include <threadhelp/resetableguard.hxx> #include "services.h" -//_________________________________________________________________________________________________________________ -// interface includes -//_________________________________________________________________________________________________________________ #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XContainer.hpp> -//_________________________________________________________________________________________________________________ -// includes of other projects -//_________________________________________________________________________________________________________________ #include <rtl/ustrbuf.hxx> #include <cppuhelper/weak.hxx> -//_________________________________________________________________________________________________________________ -// Defines -//_________________________________________________________________________________________________________________ -// - using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::beans; using namespace com::sun::star::container; using namespace ::com::sun::star::frame; -//_________________________________________________________________________________________________________________ -// Namespace -//_________________________________________________________________________________________________________________ -// - namespace framework { -//***************************************************************************************************************** -// XInterface, XTypeProvider, XServiceInfo -//***************************************************************************************************************** -DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( ToolbarControllerFactory , - ::cppu::OWeakObject , - SERVICENAME_TOOLBARCONTROLLERFACTORY , - IMPLEMENTATIONNAME_TOOLBARCONTROLLERFACTORY - ) - -DEFINE_INIT_SERVICE ( ToolbarControllerFactory, {} ) - -ToolbarControllerFactory::ToolbarControllerFactory( const Reference< XMultiServiceFactory >& xServiceManager ) : - ThreadHelpBase(), - m_bConfigRead( sal_False ), - m_xServiceManager( xServiceManager ) +UIControllerFactory::UIControllerFactory( + const Reference< XMultiServiceFactory >& xServiceManager, + const rtl::OUString &rConfigurationNode ) + : ThreadHelpBase() + , m_bConfigRead( sal_False ) + , m_xServiceManager( xServiceManager ) + , m_pConfigAccess() { - m_pConfigAccess = new ConfigurationAccess_ControllerFactory( m_xServiceManager,rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Controller/Registered/ToolBar" )) ); + rtl::OUStringBuffer aBuffer; + aBuffer.appendAscii( + RTL_CONSTASCII_STRINGPARAM( + "/org.openoffice.Office.UI.Controller/Registered/" ) ); + aBuffer.append( rConfigurationNode ); + m_pConfigAccess = new ConfigurationAccess_ControllerFactory( + m_xServiceManager, aBuffer.makeStringAndClear() ); m_pConfigAccess->acquire(); } -ToolbarControllerFactory::ToolbarControllerFactory( const Reference< XMultiServiceFactory >& xServiceManager,bool ) : - ThreadHelpBase(), - m_bConfigRead( sal_False ), - m_xServiceManager( xServiceManager ) -{ - m_pConfigAccess = NULL; -} - -ToolbarControllerFactory::~ToolbarControllerFactory() +UIControllerFactory::~UIControllerFactory() { ResetableGuard aLock( m_aLock ); @@ -103,7 +74,7 @@ ToolbarControllerFactory::~ToolbarControllerFactory() } // XMultiComponentFactory -Reference< XInterface > SAL_CALL ToolbarControllerFactory::createInstanceWithContext( +Reference< XInterface > SAL_CALL UIControllerFactory::createInstanceWithContext( const ::rtl::OUString& aServiceSpecifier, const Reference< XComponentContext >& ) throw (Exception, RuntimeException) @@ -125,13 +96,13 @@ throw (Exception, RuntimeException) // SAFE } -Reference< XInterface > SAL_CALL ToolbarControllerFactory::createInstanceWithArgumentsAndContext( +Reference< XInterface > SAL_CALL UIControllerFactory::createInstanceWithArgumentsAndContext( const ::rtl::OUString& ServiceSpecifier, const Sequence< Any >& Arguments, const Reference< XComponentContext >& ) throw (Exception, RuntimeException) { - const rtl::OUString aPropModuleName( RTL_CONSTASCII_USTRINGPARAM( "ModuleName" )); + const rtl::OUString aPropModuleName( RTL_CONSTASCII_USTRINGPARAM( "ModuleIdentifier" )); const rtl::OUString aPropValueName( RTL_CONSTASCII_USTRINGPARAM( "Value" )); rtl::OUString aPropName; @@ -187,7 +158,6 @@ throw (Exception, RuntimeException) aLock.unlock(); // SAFE - if ( aServiceName.getLength() > 0 ) return xServiceManager->createInstanceWithArguments( aServiceName, aNewArgs ); else @@ -195,14 +165,14 @@ throw (Exception, RuntimeException) } } -Sequence< ::rtl::OUString > SAL_CALL ToolbarControllerFactory::getAvailableServiceNames() +Sequence< ::rtl::OUString > SAL_CALL UIControllerFactory::getAvailableServiceNames() throw (RuntimeException) { return Sequence< ::rtl::OUString >(); } // XUIControllerRegistration -sal_Bool SAL_CALL ToolbarControllerFactory::hasController( +sal_Bool SAL_CALL UIControllerFactory::hasController( const ::rtl::OUString& aCommandURL, const rtl::OUString& aModuleName ) throw (::com::sun::star::uno::RuntimeException) @@ -218,7 +188,7 @@ throw (::com::sun::star::uno::RuntimeException) return ( m_pConfigAccess->getServiceFromCommandModule( aCommandURL, aModuleName ).getLength() > 0 ); } -void SAL_CALL ToolbarControllerFactory::registerController( +void SAL_CALL UIControllerFactory::registerController( const ::rtl::OUString& aCommandURL, const ::rtl::OUString& aModuleName, const ::rtl::OUString& aControllerImplementationName ) @@ -237,7 +207,7 @@ throw (RuntimeException) // SAFE } -void SAL_CALL ToolbarControllerFactory::deregisterController( +void SAL_CALL UIControllerFactory::deregisterController( const ::rtl::OUString& aCommandURL, const rtl::OUString& aModuleName ) throw (RuntimeException) @@ -255,4 +225,50 @@ throw (RuntimeException) // SAFE } + +DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( PopupMenuControllerFactory , + ::cppu::OWeakObject , + SERVICENAME_POPUPMENUCONTROLLERFACTORY , + IMPLEMENTATIONNAME_POPUPMENUCONTROLLERFACTORY + ) + +DEFINE_INIT_SERVICE ( PopupMenuControllerFactory, {} ) + +PopupMenuControllerFactory::PopupMenuControllerFactory( const Reference< XMultiServiceFactory >& xServiceManager ) : + UIControllerFactory( + xServiceManager, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PopupMenu" )) ) +{ +} + +DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( ToolbarControllerFactory , + ::cppu::OWeakObject , + SERVICENAME_TOOLBARCONTROLLERFACTORY , + IMPLEMENTATIONNAME_TOOLBARCONTROLLERFACTORY + ) + +DEFINE_INIT_SERVICE ( ToolbarControllerFactory, {} ) + +ToolbarControllerFactory::ToolbarControllerFactory( const Reference< XMultiServiceFactory >& xServiceManager ) : + UIControllerFactory( + xServiceManager, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ToolBar" ))) +{ +} + +DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( StatusbarControllerFactory , + ::cppu::OWeakObject , + SERVICENAME_STATUSBARCONTROLLERFACTORY , + IMPLEMENTATIONNAME_STATUSBARCONTROLLERFACTORY + ) + +DEFINE_INIT_SERVICE ( StatusbarControllerFactory, {} ) + +StatusbarControllerFactory::StatusbarControllerFactory( const Reference< XMultiServiceFactory >& xServiceManager ) : + UIControllerFactory( + xServiceManager, + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StatusBar" )) ) +{ +} + } // namespace framework diff --git a/framework/source/unotypes/fwk.xml b/framework/source/unotypes/fwk.xml index 46c56d01c929..7305212ab7f6 100644 --- a/framework/source/unotypes/fwk.xml +++ b/framework/source/unotypes/fwk.xml @@ -423,7 +423,7 @@ <loader-name> com.sun.star.loader.SharedLibrary </loader-name> <language> c++ </language> <status value="final"/> - <supported-service> com.sun.star.frame.ToolBarControllerFactory </supported-service> + <supported-service> com.sun.star.frame.ToolbarControllerFactory </supported-service> </component-description> <component-description> diff --git a/framework/util/fwk.component b/framework/util/fwk.component index adc60714edd1..c41c25b1b3ef 100644 --- a/framework/util/fwk.component +++ b/framework/util/fwk.component @@ -110,7 +110,7 @@ <service name="com.sun.star.frame.TaskCreator"/> </implementation> <implementation name="com.sun.star.comp.framework.ToolBarControllerFactory"> - <service name="com.sun.star.frame.ToolBarControllerFactory"/> + <service name="com.sun.star.frame.ToolbarControllerFactory"/> </implementation> <implementation name="com.sun.star.comp.framework.ToolBarFactory"> <service name="com.sun.star.ui.ToolBarFactory"/> |