From 8b6d5901d8476e8a3ff72c8d50d53f961849111a Mon Sep 17 00:00:00 2001 From: Ariel Constenla-Haile Date: Fri, 26 Apr 2013 21:55:57 +0000 Subject: 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 (cherry picked from commit acc7fed28f54f836b0923180431a0c180f91e98c) Conflicts: framework/inc/pch/precompiled_framework.hxx framework/inc/uielement/toolbarmanager.hxx framework/inc/uifactory/popupmenucontrollerfactory.hxx framework/inc/uifactory/statusbarcontrollerfactory.hxx framework/inc/uifactory/uicontrollerfactory.hxx framework/source/uielement/addonstoolbarmanager.cxx framework/source/uielement/menubarmanager.cxx framework/source/uielement/popupmenucontroller.cxx framework/source/uielement/statusbarmanager.cxx framework/source/uielement/toolbarmanager.cxx framework/source/uifactory/popupmenucontrollerfactory.cxx framework/source/uifactory/statusbarcontrollerfactory.cxx framework/source/uifactory/uicontrollerfactory.cxx framework/source/unotypes/fwk.xml offapi/com/sun/star/frame/PopupMenuControllerFactory.idl offapi/com/sun/star/frame/StatusbarControllerFactory.idl offapi/com/sun/star/frame/makefile.mk svtools/source/uno/toolboxcontroller.cxx Change-Id: Ia8580539badf650a84bc6e57a6b832071e011f0a (cherry picked from commit 8b050d1e91a6623fb2770421e564a74d6259d816) --- desktop/source/app/app.cxx | 26 +-- framework/Library_fwk.mk | 4 +- framework/inc/services.h | 2 +- framework/inc/uielement/menubarmanager.hxx | 4 +- framework/inc/uielement/statusbarmanager.hxx | 4 +- framework/inc/uielement/toolbarmanager.hxx | 4 +- framework/inc/uifactory/factoryconfiguration.hxx | 1 - .../inc/uifactory/popupmenucontrollerfactory.hxx | 50 ----- .../inc/uifactory/statusbarcontrollerfactory.hxx | 44 ---- .../inc/uifactory/toolbarcontrollerfactory.hxx | 75 ------- framework/source/layoutmanager/layoutmanager.cxx | 1 - framework/source/register/registerservices.cxx | 4 +- .../source/uielement/addonstoolbarmanager.cxx | 65 +++--- framework/source/uielement/menubarmanager.cxx | 82 ++++--- framework/source/uielement/popupmenucontroller.cxx | 10 +- framework/source/uielement/statusbarmanager.cxx | 86 ++++---- framework/source/uielement/toolbarmanager.cxx | 65 +++--- .../source/uifactory/factoryconfiguration.cxx | 1 - .../uifactory/popupmenucontrollerfactory.cxx | 73 ------- .../uifactory/statusbarcontrollerfactory.cxx | 71 ------ .../source/uifactory/toolbarcontrollerfactory.cxx | 242 --------------------- framework/util/fwk.component | 2 +- offapi/UnoApi_offapi.mk | 3 +- .../sun/star/frame/PopupMenuControllerFactory.idl | 33 +-- .../sun/star/frame/StatusbarControllerFactory.idl | 36 +-- .../sun/star/frame/ToolbarControllerFactory.idl | 43 ++++ offapi/com/sun/star/frame/XUIControllerFactory.idl | 72 ++++++ svtools/source/uno/toolboxcontroller.cxx | 2 +- 28 files changed, 293 insertions(+), 812 deletions(-) delete mode 100644 framework/inc/uifactory/popupmenucontrollerfactory.hxx delete mode 100644 framework/inc/uifactory/statusbarcontrollerfactory.hxx delete mode 100644 framework/inc/uifactory/toolbarcontrollerfactory.hxx delete mode 100644 framework/source/uifactory/popupmenucontrollerfactory.cxx delete mode 100644 framework/source/uifactory/statusbarcontrollerfactory.cxx delete mode 100644 framework/source/uifactory/toolbarcontrollerfactory.cxx create mode 100644 offapi/com/sun/star/frame/ToolbarControllerFactory.idl create mode 100644 offapi/com/sun/star/frame/XUIControllerFactory.idl diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 0b05fab5e916..195776f3e49f 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -69,6 +69,8 @@ #include #include #include +#include +#include #include #include @@ -2214,21 +2216,17 @@ void Desktop::PreloadConfigurationData() // preload popup menu controller factories. As all controllers are in the same // configuration file they also get preloaded! - Reference< ::com::sun::star::frame::XUIControllerRegistration > xPopupMenuControllerFactory( - rFactory->createInstance( - rtl::OUString( "com.sun.star.frame.PopupMenuControllerFactory" )), - UNO_QUERY ); - if ( xPopupMenuControllerFactory.is() ) + + Reference< css::frame::XUIControllerRegistration > xPopupMenuControllerFactory = + css::frame::PopupMenuControllerFactory::create( xContext ); + try + { + xPopupMenuControllerFactory->hasController( + OUString( ".uno:CharFontName" ), + OUString() ); + } + catch ( const ::com::sun::star::uno::Exception& ) { - try - { - xPopupMenuControllerFactory->hasController( - rtl::OUString( ".uno:CharFontName" ), - OUString() ); - } - catch ( const ::com::sun::star::uno::Exception& ) - { - } } // preload filter configuration diff --git a/framework/Library_fwk.mk b/framework/Library_fwk.mk index 2a53057dd86a..bc9b711f2f4d 100644 --- a/framework/Library_fwk.mk +++ b/framework/Library_fwk.mk @@ -160,10 +160,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/services.h b/framework/inc/services.h index d57af352065f..16a9443f2771 100644 --- a/framework/inc/services.h +++ b/framework/inc/services.h @@ -46,7 +46,7 @@ namespace framework{ #define SERVICENAME_MODULEACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.ui.ModuleAcceleratorConfiguration") #define SERVICENAME_DOCUMENTACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.ui.DocumentAcceleratorConfiguration") #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_STATUSBARFACTORY DECLARE_ASCII("com.sun.star.ui.StatusBarFactory" ) #define SERVICENAME_STATUSBARCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.frame.StatusbarControllerFactory" ) diff --git a/framework/inc/uielement/menubarmanager.hxx b/framework/inc/uielement/menubarmanager.hxx index 1e9e38626ed6..50e27d663bf1 100644 --- a/framework/inc/uielement/menubarmanager.hxx +++ b/framework/inc/uielement/menubarmanager.hxx @@ -41,7 +41,7 @@ #include #include #include -#include +#include #include #include #include @@ -235,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::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 26cc183dfddd..c855b129e680 100644 --- a/framework/inc/uielement/statusbarmanager.hxx +++ b/framework/inc/uielement/statusbarmanager.hxx @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include @@ -118,7 +118,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 3e058689df7e..1b26588cdfbd 100644 --- a/framework/inc/uielement/toolbarmanager.hxx +++ b/framework/inc/uielement/toolbarmanager.hxx @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include @@ -202,7 +202,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::uno::XComponentContext > m_xContext; - ::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 82a9943b6926..eacb8da5bc6d 100644 --- a/framework/inc/uifactory/factoryconfiguration.hxx +++ b/framework/inc/uifactory/factoryconfiguration.hxx @@ -31,7 +31,6 @@ #include #include #include -#include #include #include diff --git a/framework/inc/uifactory/popupmenucontrollerfactory.hxx b/framework/inc/uifactory/popupmenucontrollerfactory.hxx deleted file mode 100644 index 749bd5178b7a..000000000000 --- a/framework/inc/uifactory/popupmenucontrollerfactory.hxx +++ /dev/null @@ -1,50 +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 __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 -#include - -#include -#include -#include - -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_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uifactory/statusbarcontrollerfactory.hxx b/framework/inc/uifactory/statusbarcontrollerfactory.hxx deleted file mode 100644 index 979639f61683..000000000000 --- a/framework/inc/uifactory/statusbarcontrollerfactory.hxx +++ /dev/null @@ -1,44 +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 __FRAMEWORK_UIFACTORY_STATUSBARCONTROLLERFACTORY_HXX_ -#define __FRAMEWORK_UIFACTORY_STATUSBARCONTROLLERFACTORY_HXX_ - -#include -#include -#include - -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_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/uifactory/toolbarcontrollerfactory.hxx b/framework/inc/uifactory/toolbarcontrollerfactory.hxx deleted file mode 100644 index 7534e6ce7a8e..000000000000 --- a/framework/inc/uifactory/toolbarcontrollerfactory.hxx +++ /dev/null @@ -1,75 +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 __FRAMEWORK_UIFACTORY_TOOLBARCONTROLLERFACTORY_HXX_ -#define __FRAMEWORK_UIFACTORY_TOOLBARCONTROLLERFACTORY_HXX_ - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -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> -{ - public: - ToolbarControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); - virtual ~ToolbarControllerFactory(); - - // XInterface, XTypeProvider, XServiceInfo - DECLARE_XSERVICEINFO - - // XMultiComponentFactory - virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithContext( const 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); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceWithArgumentsAndContext( const OUString& ServiceSpecifier, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Arguments, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& Context ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames() throw (::com::sun::star::uno::RuntimeException); - - // XUIControllerRegistration - virtual sal_Bool SAL_CALL hasController( const OUString& aCommandURL, const OUString& aModuleName ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL registerController( const OUString& aCommandURL, const OUString& aModuleName, const OUString& aControllerImplementationName ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL deregisterController( const OUString& aCommandURL, const OUString& aModuleName ) throw (::com::sun::star::uno::RuntimeException); - - protected: - ToolbarControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager,bool ); - sal_Bool m_bConfigRead; - ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; - ConfigurationAccess_ControllerFactory* m_pConfigAccess; -}; - -} // namespace framework - -#endif // __FRAMEWORK_SERVICES_TOOLBARCONTROLLERFACTORY_HXX_ - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 173a0fe730df..0c75daad2c5a 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include diff --git a/framework/source/register/registerservices.cxx b/framework/source/register/registerservices.cxx index 8d9c058165d2..984ad9d51d10 100644 --- a/framework/source/register/registerservices.cxx +++ b/framework/source/register/registerservices.cxx @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #include #include @@ -57,8 +57,6 @@ #include #include #include "uiconfiguration/windowstateconfiguration.hxx" -#include "uifactory/toolbarcontrollerfactory.hxx" -#include "uifactory/statusbarcontrollerfactory.hxx" #include #include #include diff --git a/framework/source/uielement/addonstoolbarmanager.cxx b/framework/source/uielement/addonstoolbarmanager.cxx index b0992eeac48d..0bde95d0ccae 100644 --- a/framework/source/uielement/addonstoolbarmanager.cxx +++ b/framework/source/uielement/addonstoolbarmanager.cxx @@ -221,8 +221,6 @@ void AddonsToolBarManager::FillToolbar( const Sequence< Sequence< PropertyValue { } - Reference< XMultiComponentFactory > xToolbarControllerFactory( m_xToolbarControllerRegistration, UNO_QUERY ); - sal_uInt32 nElements( 0 ); sal_Bool bAppendSeparator( sal_False ); Reference< XWindow > xToolbarWindow = VCLUnoHelper::GetInterface( m_pToolBar ); @@ -279,42 +277,39 @@ 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 = OUString( "ModuleIdentifier" ); + aPropValue.Value <<= m_aModuleIdentifier; + aArgs[0] <<= aPropValue; + aPropValue.Name = OUString( "Frame" ); + aPropValue.Value <<= m_xFrame; + aArgs[1] <<= aPropValue; + aPropValue.Name = OUString( "ServiceManager" ); + Reference xMSF(m_xContext->getServiceManager(), UNO_QUERY_THROW); + aPropValue.Value <<= xMSF; + aArgs[2] <<= aPropValue; + aPropValue.Name = OUString( "ParentWindow" ); + aPropValue.Value <<= xToolbarWindow; + aArgs[3] <<= aPropValue; + aPropValue.Name = OUString( "ItemId" ); + aPropValue.Value = makeAny( sal_Int32( nId )); + aArgs[4] <<= aPropValue; + + try + { + xController = Reference< XStatusListener >( m_xToolbarControllerFactory->createInstanceWithArgumentsAndContext( + aURL, aArgs, m_xContext ), + UNO_QUERY ); + } + catch ( uno::Exception& ) { - Sequence< Any > aArgs(5); - PropertyValue aPropValue; - - aPropValue.Name = OUString( "ModuleName" ); - aPropValue.Value <<= m_aModuleIdentifier; - aArgs[0] <<= aPropValue; - aPropValue.Name = OUString( "Frame" ); - aPropValue.Value <<= m_xFrame; - aArgs[1] <<= aPropValue; - aPropValue.Name = OUString( "ServiceManager" ); - Reference xMSF(m_xContext->getServiceManager(), UNO_QUERY_THROW); - aPropValue.Value <<= xMSF; - aArgs[2] <<= aPropValue; - aPropValue.Name = OUString( "ParentWindow" ); - aPropValue.Value <<= xToolbarWindow; - aArgs[3] <<= aPropValue; - aPropValue.Name = OUString( "ItemId" ); - aPropValue.Value = makeAny( sal_Int32( nId )); - aArgs[4] <<= aPropValue; - - try - { - xController = Reference< XStatusListener >( xToolbarControllerFactory->createInstanceWithArgumentsAndContext( - aURL, aArgs, m_xContext ), - UNO_QUERY ); - } - catch ( const 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 91e7df87f2df..f8a330b9590a 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -42,7 +43,7 @@ #include #include #include -#include +#include #include #include #include @@ -182,9 +183,7 @@ 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( OUString( "com.sun.star.frame.PopupMenuControllerFactory" )), - UNO_QUERY ); + m_xPopupMenuControllerFactory = frame::PopupMenuControllerFactory::create(m_xContext); FillMenuManager( pMenu, rFrame, rDispatchProvider, rModuleIdentifier, bDelete, bDeleteChildren ); } @@ -387,7 +386,7 @@ void SAL_CALL MenuBarManager::dispose() throw( RuntimeException ) m_xModuleAcceleratorManager.clear(); m_xDocAcceleratorManager.clear(); m_xUICommandLabels.clear(); - m_xPopupMenuControllerRegistration.clear(); + m_xPopupMenuControllerFactory.clear(); m_xContext.clear(); } } @@ -953,7 +952,7 @@ IMPL_LINK( MenuBarManager, Activate, Menu *, pMenu ) sal_Bool bPopupMenu( sal_False ); if ( !pMenuItemHandler->xPopupMenuController.is() && - m_xPopupMenuControllerRegistration->hasController( aItemCommand, OUString() )) + m_xPopupMenuControllerFactory->hasController( aItemCommand, OUString() )) { bPopupMenu = CreatePopupMenuController( pMenuItemHandler ); } @@ -1188,36 +1187,32 @@ sal_Bool MenuBarManager::CreatePopupMenuController( MenuItemHandler* pMenuItemHa 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 = OUString( "ModuleIdentifier" ); + aPropValue.Value <<= m_aModuleIdentifier; + aSeq[0] <<= aPropValue; + aPropValue.Name = OUString( "Frame" ); + aPropValue.Value <<= m_xFrame; + aSeq[1] <<= aPropValue; + + Reference< XPopupMenuController > xPopupMenuController( + m_xPopupMenuControllerFactory->createInstanceWithArgumentsAndContext( + aItemCommand, + aSeq, + m_xContext ), + UNO_QUERY ); + + if ( xPopupMenuController.is() ) { - 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; - } + // Provide our awt popup menu to the popup menu controller + pMenuItemHandler->xPopupMenuController = xPopupMenuController; + xPopupMenuController->setPopupMenu( pMenuItemHandler->xPopupMenu ); + return sal_True; } return sal_False; @@ -1311,9 +1306,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, OUString() ) + m_xPopupMenuControllerFactory->hasController( aItemCommand, OUString() ) ) { // Check if we have to create a popup menu for a uno based popup menu controller. @@ -1446,8 +1441,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, OUString() )) + if ( m_xPopupMenuControllerFactory.is() && + m_xPopupMenuControllerFactory->hasController( aItemCommand, 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 @@ -2020,9 +2015,8 @@ void MenuBarManager::Init(const Reference< XFrame >& rFrame,AddonMenu* pAddonMen m_bIsBookmarkMenu = sal_True; OUString aModuleIdentifier; - m_xPopupMenuControllerRegistration = Reference< ::com::sun::star::frame::XUIControllerRegistration >( - getServiceFactory()->createInstance( OUString( "com.sun.star.frame.PopupMenuControllerFactory" )), - UNO_QUERY ); + m_xPopupMenuControllerFactory = frame::PopupMenuControllerFactory::create( + ::comphelper::getProcessComponentContext()); Reference< XStatusListener > xStatusListener; Reference< XDispatch > xDispatch; @@ -2069,8 +2063,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, OUString() )) + if ( m_xPopupMenuControllerFactory.is() && + m_xPopupMenuControllerFactory->hasController( aItemCommand, 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 571b5cb03dfc..76e89490a7c8 100644 --- a/framework/source/uielement/popupmenucontroller.cxx +++ b/framework/source/uielement/popupmenucontroller.cxx @@ -19,6 +19,7 @@ #include +#include #include #include @@ -155,22 +156,19 @@ void SAL_CALL PopupMenuController::doubleClick() throw (RuntimeException) bool PopupMenuController::CreatePopupMenuController() throw (Exception) { - Reference< XMultiComponentFactory > xPopupMenuControllerRegistration( getServiceManager()->createInstance( SERVICENAME_POPUPMENUCONTROLLERFACTORY ), UNO_QUERY_THROW ); + Reference< XMultiComponentFactory > xPopupMenuControllerRegistration = PopupMenuControllerFactory::create( m_xContext ); Sequence< Any > aSeq( 2 ); PropertyValue aPropValue; - aPropValue.Name = OUString( "ModuleName" ); + aPropValue.Name = OUString( "ModuleIdentifier" ); aPropValue.Value <<= getModuleName(); aSeq[0] <<= aPropValue; aPropValue.Name = OUString( "Frame" ); aPropValue.Value <<= m_xFrame; aSeq[1] <<= aPropValue; - Reference< XComponentContext > xComponentContext( - comphelper::getComponentContext( getServiceManager() ) ); - - Reference< XPopupMenuController > xPopupMenuController( xPopupMenuControllerRegistration->createInstanceWithArgumentsAndContext( getCommandURL(), aSeq, xComponentContext ), UNO_QUERY ); + Reference< XPopupMenuController > xPopupMenuController( xPopupMenuControllerRegistration->createInstanceWithArgumentsAndContext( getCommandURL(), aSeq, m_xContext ), UNO_QUERY ); if ( xPopupMenuController.is() ) { mxPopupMenuController = xPopupMenuController; diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx index 35f8930b5cd2..fb8ce454c3f3 100644 --- a/framework/source/uielement/statusbarmanager.cxx +++ b/framework/source/uielement/statusbarmanager.cxx @@ -38,6 +38,7 @@ #include #include +#include #include #include #include @@ -49,6 +50,7 @@ #include #include #include +#include #include #include @@ -172,10 +174,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 ) ); @@ -353,7 +353,6 @@ OUString StatusBarManager::RetrieveLabelFromCommand( const OUString& aCmdURL ) 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( comphelper::getComponentContext( m_xServiceManager ) ); uno::Reference< awt::XWindow > xStatusbarWindow = VCLUnoHelper::GetInterface( m_pStatusBar ); @@ -375,47 +374,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 = OUString( "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 = OUString( "ModuleIdentifier" ); + aPropValue.Value = uno::makeAny( m_aModuleIdentifier ); + aPropVector.push_back( uno::makeAny( aPropValue ) ); + + aPropValue.Name = OUString( "Frame" ); + aPropValue.Value = uno::makeAny( m_xFrame ); + aPropVector.push_back( uno::makeAny( aPropValue ) ); + + // TODO remove this + aPropValue.Name = OUString( "ServiceManager" ); + aPropValue.Value = uno::makeAny( m_xServiceManager ); + aPropVector.push_back( uno::makeAny( aPropValue ) ); + + aPropValue.Name = OUString( "ParentWindow" ); + aPropValue.Value = uno::makeAny( xStatusbarWindow ); + aPropVector.push_back( uno::makeAny( aPropValue ) ); + + // TODO still needing with the css::ui::XStatusbarItem? + aPropValue.Name = OUString( "Identifier" ); + aPropValue.Value = uno::makeAny( nId ); + aPropVector.push_back( uno::makeAny( aPropValue ) ); + + aPropValue.Name = OUString( "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 ca4e2cfc3a99..05f15ba3fb2c 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -41,6 +41,7 @@ #include #include #include +#include #include #include #include @@ -229,7 +230,7 @@ ToolBarManager::ToolBarManager( const Reference< XComponentContext >& rxContext, if ( pWindow ) ((SystemWindow *)pWindow)->GetTaskPaneList()->AddWindow( m_pToolBar ); - m_xToolbarControllerRegistration = frame::ToolBarControllerFactory::create( m_xContext ); + m_xToolbarControllerFactory = frame::ToolbarControllerFactory::create( m_xContext ); m_xURLTransformer = URLTransformer::create( m_xContext ); m_pToolBar->SetSelectHdl( LINK( this, ToolBarManager, Select) ); @@ -873,7 +874,6 @@ void ToolBarManager::CreateControllers() { RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::ToolBarManager::CreateControllers" ); - Reference< XMultiComponentFactory > xToolbarControllerFactory( m_xToolbarControllerRegistration, UNO_QUERY ); Reference< XWindow > xToolbarWindow = VCLUnoHelper::GetInterface( m_pToolBar ); css::util::URL aURL; @@ -908,41 +908,38 @@ 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 = OUString( "ModuleIdentifier" ); + aPropValue.Value <<= m_aModuleIdentifier; + aPropertyVector.push_back( makeAny( aPropValue )); + aPropValue.Name = OUString( "Frame" ); + aPropValue.Value <<= m_xFrame; + aPropertyVector.push_back( makeAny( aPropValue )); + aPropValue.Name = OUString( "ServiceManager" ); + Reference xMSF(m_xContext->getServiceManager(), UNO_QUERY_THROW); + aPropValue.Value <<= xMSF; + aPropertyVector.push_back( makeAny( aPropValue )); + aPropValue.Name = OUString( "ParentWindow" ); + aPropValue.Value <<= xToolbarWindow; + aPropertyVector.push_back( makeAny( aPropValue )); + + if ( nWidth > 0 ) { - PropertyValue aPropValue; - std::vector< Any > aPropertyVector; - - aPropValue.Name = OUString( "ModuleName" ); - aPropValue.Value <<= m_aModuleIdentifier; + aPropValue.Name = OUString( "Width" ); + aPropValue.Value <<= nWidth; aPropertyVector.push_back( makeAny( aPropValue )); - aPropValue.Name = OUString( "Frame" ); - aPropValue.Value <<= m_xFrame; - aPropertyVector.push_back( makeAny( aPropValue )); - aPropValue.Name = OUString( "ServiceManager" ); - Reference xMSF(m_xContext->getServiceManager(), UNO_QUERY_THROW); - aPropValue.Value <<= xMSF; - aPropertyVector.push_back( makeAny( aPropValue )); - aPropValue.Name = OUString( "ParentWindow" ); - aPropValue.Value <<= xToolbarWindow; - aPropertyVector.push_back( makeAny( aPropValue )); - - if ( nWidth > 0 ) - { - aPropValue.Name = OUString( "Width" ); - aPropValue.Value <<= nWidth; - aPropertyVector.push_back( makeAny( aPropValue )); - } - - Sequence< Any > aArgs( comphelper::containerToSequence( aPropertyVector )); - xController = Reference< XStatusListener >( xToolbarControllerFactory->createInstanceWithArgumentsAndContext( - aCommandURL, aArgs, m_xContext ), - 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, m_xContext ), + UNO_QUERY ); + bInit = sal_False; // Initialization is done through the factory service } if (( aCommandURL == aLoadURL ) && ( !m_pToolBar->IsItemVisible(nId))) @@ -1040,7 +1037,7 @@ void ToolBarManager::CreateControllers() aPropValue.Name = OUString( "ParentWindow" ); aPropValue.Value <<= xToolbarWindow; aPropertyVector.push_back( makeAny( aPropValue )); - aPropValue.Name = OUString( "ModuleName" ); + aPropValue.Name = OUString( "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 759de8d5c68e..73fa872259ed 100644 --- a/framework/source/uifactory/factoryconfiguration.cxx +++ b/framework/source/uifactory/factoryconfiguration.cxx @@ -42,7 +42,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 2b47fd3d1951..000000000000 --- a/framework/source/uifactory/popupmenucontrollerfactory.cxx +++ /dev/null @@ -1,73 +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 . - */ - -#include "uifactory/popupmenucontrollerfactory.hxx" -#include -#include "services.h" -#include "uifactory/factoryconfiguration.hxx" - -#include -#include -#include -#include -#include - -#include -#include -#include - -//_________________________________________________________________________________________________________________ -// 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( comphelper::getComponentContext(m_xServiceManager), OUString( "/org.openoffice.Office.UI.Controller/Registered/PopupMenu" ) ); - m_pConfigAccess->acquire(); -} - -} // namespace framework - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/uifactory/statusbarcontrollerfactory.cxx b/framework/source/uifactory/statusbarcontrollerfactory.cxx deleted file mode 100644 index 3496d170577e..000000000000 --- a/framework/source/uifactory/statusbarcontrollerfactory.cxx +++ /dev/null @@ -1,71 +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 . - */ - -#include "uifactory/statusbarcontrollerfactory.hxx" -#include "uifactory/factoryconfiguration.hxx" -#include -#include "services.h" - -#include -#include -#include -#include -#include - -#include -#include - -//_________________________________________________________________________________________________________________ -// 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( comphelper::getComponentContext(m_xServiceManager), OUString( "/org.openoffice.Office.UI.Controller/Registered/StatusBar" ),true ); - m_pConfigAccess->acquire(); -} - - -} // namespace framework - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/uifactory/toolbarcontrollerfactory.cxx b/framework/source/uifactory/toolbarcontrollerfactory.cxx deleted file mode 100644 index 592b89c1f07e..000000000000 --- a/framework/source/uifactory/toolbarcontrollerfactory.cxx +++ /dev/null @@ -1,242 +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 . - */ - -#include "uifactory/toolbarcontrollerfactory.hxx" -#include "uifactory/factoryconfiguration.hxx" -#include -#include "services.h" - -#include -#include -#include -#include -#include - -#include -#include - -//_________________________________________________________________________________________________________________ -// 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 ) -{ - m_pConfigAccess = new ConfigurationAccess_ControllerFactory( comphelper::getComponentContext(m_xServiceManager), OUString( "/org.openoffice.Office.UI.Controller/Registered/ToolBar" ) ); - m_pConfigAccess->acquire(); -} - -ToolbarControllerFactory::ToolbarControllerFactory( const Reference< XMultiServiceFactory >& xServiceManager,bool ) : - ThreadHelpBase(), - m_bConfigRead( sal_False ), - m_xServiceManager( xServiceManager ) -{ - m_pConfigAccess = NULL; -} - -ToolbarControllerFactory::~ToolbarControllerFactory() -{ - ResetableGuard aLock( m_aLock ); - - // reduce reference count - m_pConfigAccess->release(); -} - -// XMultiComponentFactory -Reference< XInterface > SAL_CALL ToolbarControllerFactory::createInstanceWithContext( - const OUString& aServiceSpecifier, - const Reference< XComponentContext >& ) -throw (Exception, RuntimeException) -{ - // SAFE - ResetableGuard aLock( m_aLock ); - - if ( !m_bConfigRead ) - { - m_bConfigRead = sal_True; - m_pConfigAccess->readConfigurationData(); - } - - OUString aServiceName = m_pConfigAccess->getServiceFromCommandModule( aServiceSpecifier, OUString() ); - if ( !aServiceName.isEmpty() ) - return m_xServiceManager->createInstance( aServiceName ); - else - return Reference< XInterface >(); - // SAFE -} - -Reference< XInterface > SAL_CALL ToolbarControllerFactory::createInstanceWithArgumentsAndContext( - const OUString& ServiceSpecifier, - const Sequence< Any >& Arguments, - const Reference< XComponentContext >& ) -throw (Exception, RuntimeException) -{ - const OUString aPropModuleName( "ModuleName" ); - const OUString aPropValueName( "Value" ); - - OUString aPropName; - PropertyValue aPropValue; - - // Retrieve the optional module name form the Arguments sequence. It is used as a part of - // the hash map key to support different controller implementation for the same URL but different - // module!! - for ( int i = 0; i < Arguments.getLength(); i++ ) - { - if (( Arguments[i] >>= aPropValue ) && ( aPropValue.Name.equals( aPropModuleName ))) - { - aPropValue.Value >>= aPropName; - break; - } - } - - Sequence< Any > aNewArgs( Arguments ); - - sal_Int32 nAppendIndex = aNewArgs.getLength(); - bool bHasValue = m_pConfigAccess->hasValue(); - aNewArgs.realloc( aNewArgs.getLength() + (bHasValue ? 2 : 1) ); - - // Append the command URL to the Arguments sequence so that one controller can be - // used for more than one command URL. - aPropValue.Name = OUString( "CommandURL" ); - aPropValue.Value <<= ServiceSpecifier; - aNewArgs[nAppendIndex] <<= aPropValue; - - if ( bHasValue ) - { - // Append the optional value argument. It's an empty string if no additional info - // is provided to the controller. - OUString aValue = m_pConfigAccess->getValueFromCommandModule( ServiceSpecifier, aPropName ); - aPropValue.Name = aPropValueName; - aPropValue.Value <<= aValue; - aNewArgs[nAppendIndex+1] <<= aPropValue; - } - - { - // SAFE - ResetableGuard aLock( m_aLock ); - - if ( !m_bConfigRead ) - { - m_bConfigRead = sal_True; - m_pConfigAccess->readConfigurationData(); - } - - OUString aServiceName = m_pConfigAccess->getServiceFromCommandModule( ServiceSpecifier, aPropName ); - Reference< XMultiServiceFactory > xServiceManager( m_xServiceManager ); - - aLock.unlock(); - // SAFE - - - if ( !aServiceName.isEmpty() ) - return xServiceManager->createInstanceWithArguments( aServiceName, aNewArgs ); - else - return Reference< XInterface >(); - } -} - -Sequence< OUString > SAL_CALL ToolbarControllerFactory::getAvailableServiceNames() -throw (RuntimeException) -{ - return Sequence< OUString >(); -} - -// XUIControllerRegistration -sal_Bool SAL_CALL ToolbarControllerFactory::hasController( - const OUString& aCommandURL, - const OUString& aModuleName ) -throw (::com::sun::star::uno::RuntimeException) -{ - ResetableGuard aLock( m_aLock ); - - if ( !m_bConfigRead ) - { - m_bConfigRead = sal_True; - m_pConfigAccess->readConfigurationData(); - } - - return ( !m_pConfigAccess->getServiceFromCommandModule( aCommandURL, aModuleName ).isEmpty() ); -} - -void SAL_CALL ToolbarControllerFactory::registerController( - const OUString& aCommandURL, - const OUString& aModuleName, - const OUString& aControllerImplementationName ) -throw (RuntimeException) -{ - // SAFE - ResetableGuard aLock( m_aLock ); - - if ( !m_bConfigRead ) - { - m_bConfigRead = sal_True; - m_pConfigAccess->readConfigurationData(); - } - - m_pConfigAccess->addServiceToCommandModule( aCommandURL, aModuleName, aControllerImplementationName ); - // SAFE -} - -void SAL_CALL ToolbarControllerFactory::deregisterController( - const OUString& aCommandURL, - const OUString& aModuleName ) -throw (RuntimeException) -{ - // SAFE - ResetableGuard aLock( m_aLock ); - - if ( !m_bConfigRead ) - { - m_bConfigRead = sal_True; - m_pConfigAccess->readConfigurationData(); - } - - m_pConfigAccess->removeServiceFromCommandModule( aCommandURL, aModuleName ); - // SAFE -} - -} // namespace framework - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/util/fwk.component b/framework/util/fwk.component index 9d604c51db9d..2e0c265ba704 100644 --- a/framework/util/fwk.component +++ b/framework/util/fwk.component @@ -105,7 +105,7 @@ - + diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 76fda9543306..8845d9fc7921 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -943,6 +943,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/frame,\ Task \ TemplateAccess \ ToolbarController \ + ToolbarControllerFactory \ TransientDocumentsDocumentContentFactory \ )) $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/gallery,\ @@ -2624,7 +2625,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/frame,\ XToolbarController \ XToolbarControllerListener \ XTransientDocumentsDocumentContentFactory \ - XUIControllerRegistration \ + XUIControllerFactory \ XUntitledNumbers \ XUrlList \ XWindowArranger \ diff --git a/offapi/com/sun/star/frame/PopupMenuControllerFactory.idl b/offapi/com/sun/star/frame/PopupMenuControllerFactory.idl index 03e0fd8098a6..d873e3da0caf 100644 --- a/offapi/com/sun/star/frame/PopupMenuControllerFactory.idl +++ b/offapi/com/sun/star/frame/PopupMenuControllerFactory.idl @@ -20,14 +20,11 @@ #ifndef __com_sun_star_frame_PopupMenuControllerFactory_idl__ #define __com_sun_star_frame_PopupMenuControllerFactory_idl__ -#include -#include - +#include module com { module sun { module star { module frame { - -/** specifies a factory that creates instances of registered pop-up menu controller. +/** specifies a factory that creates instances of registered popup menu controller.

A pop-up menu controller can be registered for a command URL and a model service name. @@ -37,35 +34,15 @@ module com { module sun { module star { module frame { @since OOo 2.0 */ - -service PopupMenuControllerFactory +service PopupMenuControllerFactory : XUIControllerFactory { - /** this interface provides functions to create new instances of a registered pop-up menu controller. - -

- Use XMultiComponentFactory::createInstanceWithArguments() to create - a new pop-up menu controller instance. Use the CommandURL as the service specifier. - - This call supports the following arguments provided as PropertyValue: -

    -
  • Frame
    specifies the XFrame - 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.
  • -
  • ModuleIdentifier
    optional string that specifies in which module context the pop-up menu - controller should be created.
  • -
-

- */ - interface com::sun::star::lang::XMultiComponentFactory; - - /** provides functions to query for, register and deregister a pop-up menu controller. + /** service constructor */ - interface com::sun::star::frame::XUIControllerRegistration; + create(); }; }; }; }; }; - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/frame/StatusbarControllerFactory.idl b/offapi/com/sun/star/frame/StatusbarControllerFactory.idl index 173ef5d28912..7572c6cbe419 100644 --- a/offapi/com/sun/star/frame/StatusbarControllerFactory.idl +++ b/offapi/com/sun/star/frame/StatusbarControllerFactory.idl @@ -20,13 +20,10 @@ #ifndef __com_sun_star_frame_StatusbarControllerFactory_idl__ #define __com_sun_star_frame_StatusbarControllerFactory_idl__ -#include -#include - +#include module com { module sun { module star { module frame { - /** specifies a factory that creates instances of registered status bar controller. @@ -38,40 +35,15 @@ module com { module sun { module star { module frame { @since OOo 2.0 */ - -service StatusbarControllerFactory +service StatusbarControllerFactory : XUIControllerFactory { - /** this interface provides functions to create new instances of a registered - status bar controller. - -

- Use XMultiComponentFactory::createInstanceWithArguments() - to create a new status bar controller instance. Use the CommandURL as the - service specifier. - - This call supports the following arguments provided as - PropertyValue: -

    -
  • Frame
    specifies the XFrame - instance to which the status bar controller belongs to. This - property must be provided to the status bar controller, otherwise it - cannot dispatch its internal commands.
  • -
  • ModuleIdentifier
    optional string that specifies in which module - context the status bar controller should be created.
  • -
-

- */ - interface com::sun::star::lang::XMultiComponentFactory; - - /** provides functions to query for, register and deregister a status bar - controller. + /** service constructor */ - interface com::sun::star::frame::XUIControllerRegistration; + create(); }; }; }; }; }; - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/frame/ToolbarControllerFactory.idl b/offapi/com/sun/star/frame/ToolbarControllerFactory.idl new file mode 100644 index 000000000000..220046e52afc --- /dev/null +++ b/offapi/com/sun/star/frame/ToolbarControllerFactory.idl @@ -0,0 +1,43 @@ +/* + * 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_ToolbarControllerFactory_idl__ +#define __com_sun_star_frame_ToolbarControllerFactory_idl__ + +#include + +module com { module sun { module star { module frame { + +/** specifies a factory that creates instances of registered toolbar controller. + +

+ A toolbar controller can be registered for a command URL and a model service name. +

+ + @since OOo 2.0 +*/ + +service ToolbarControllerFactory : XUIControllerFactory +{ + /** service constructor + */ + create(); +}; + +}; }; }; }; + +#endif diff --git a/offapi/com/sun/star/frame/XUIControllerFactory.idl b/offapi/com/sun/star/frame/XUIControllerFactory.idl new file mode 100644 index 000000000000..ff352f50c2d4 --- /dev/null +++ b/offapi/com/sun/star/frame/XUIControllerFactory.idl @@ -0,0 +1,72 @@ +/* + * 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_XUIControllerFactory_idl__ +#define __com_sun_star_frame_XUIControllerFactory_idl__ + +#include +#include + +module com { module sun { module star { module frame { + +/** a factory to create User Interface controllers. + +

+ A user interface controller can be registered for a command URL. A certain user + interface controller will be created when a user interface element contains a + registered command URL. + + @see PopupMenuControllerFactory + @see StatusbarControllerFactory + @see ToolbarControllerFactory +

+ + @since LibreOffice 4.1 + */ +interface XUIControllerFactory +{ + /** this interface provides functions to create new instances of a registered UI controller. + +

+ Use XMultiComponentFactory::createInstanceWithArgumentsAndContext() to create + a new UI controller instance. Use the CommandURL as the service specifier. + + This call supports the following arguments provided as PropertyValue: +

    +
  • + Frame
    specifies the XFrame + instance to which the UI controller belongs to. This property must be provided to + the UI controller, otherwise it cannot dispatch its internal commands. +
  • +
  • + ModuleIdentifier
    optional string that specifies in which module context the UI + controller should be created.
    The module identifier can be retrieved using the + ModuleManager. +
  • +
+

+ */ + interface com::sun::star::lang::XMultiComponentFactory; + + /** provides functions to query for, register and deregister a popup menu controller. + */ + interface XUIControllerRegistration; +}; + +}; }; }; }; + +#endif diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx index 25e519b7e8d5..d077b2482a8b 100644 --- a/svtools/source/uno/toolboxcontroller.cxx +++ b/svtools/source/uno/toolboxcontroller.cxx @@ -231,7 +231,7 @@ throw ( Exception, RuntimeException ) } else if ( aPropValue.Name == "ParentWindow" ) m_pImpl->m_xParentWindow.set(aPropValue.Value,UNO_QUERY); - else if ( aPropValue.Name == "ModuleName" ) + else if ( aPropValue.Name == "ModuleIdentifier" ) aPropValue.Value >>= m_pImpl->m_sModuleName; } } -- cgit v1.2.3