diff options
author | Noel Grandin <noel@peralex.com> | 2013-05-27 14:52:39 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-05-28 08:10:23 +0200 |
commit | 8f3cec9d7a50f33c7be5191656720e463712dd83 (patch) | |
tree | ffc45e8944ff407fef79f6997ea610877d7f2e2c | |
parent | aff5c4d76b7a876e9ce9e0b70bb52864dd65be24 (diff) |
fdo#46808, Convert ui:*AcceleratorConfiguration to new style
The services already existed, they just needed IDL files.
API CHANGE:
The return type of XUIConfigurationManager#getShortcutManager()
is now XAcceleratorConfiguration instead of XInterface.
This should not be a problem because XUIConfigurationManager is
unpublished and the client code was relying on the service
returning that type.
Change-Id: I399fe35de3394b02a4166b75eb7ff93b28be8bef
21 files changed, 150 insertions, 83 deletions
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx index 77ec9c30d87f..ddb681f24677 100644 --- a/cui/source/customize/acccfg.cxx +++ b/cui/source/customize/acccfg.cxx @@ -856,7 +856,7 @@ void SfxAcceleratorConfigPage::InitAccCfg() css::uno::Reference< css::ui::XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier( css::ui::ModuleUIConfigurationManagerSupplier::create(m_xContext) ); css::uno::Reference< css::ui::XUIConfigurationManager > xUICfgManager = xModuleCfgSupplier->getUIConfigurationManager(m_sModuleLongName); - m_xModule = css::uno::Reference< css::ui::XAcceleratorConfiguration >(xUICfgManager->getShortCutManager(), css::uno::UNO_QUERY_THROW); + m_xModule = xUICfgManager->getShortCutManager(); } catch(const css::uno::RuntimeException&) { throw; } diff --git a/framework/inc/services.h b/framework/inc/services.h index 7fc18f6cb3e4..8a761e0b5f9d 100644 --- a/framework/inc/services.h +++ b/framework/inc/services.h @@ -42,8 +42,6 @@ namespace framework{ #define SERVICENAME_MODULEUICONFIGURATIONMANAGER DECLARE_ASCII("com.sun.star.ui.ModuleUIConfigurationManager" ) #define SERVICENAME_MENUBARFACTORY DECLARE_ASCII("com.sun.star.ui.UIElementFactory" ) #define SERVICENAME_FRAMECONTROLLER DECLARE_ASCII("com.sun.star.frame.Controller" ) -#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_LICENSE SERVICENAME_JOB @@ -91,9 +89,6 @@ namespace framework{ #define IMPLEMENTATIONNAME_MODULEUICONFIGURATIONMANAGER DECLARE_ASCII("com.sun.star.comp.framework.ModuleUIConfigurationManager" ) #define IMPLEMENTATIONNAME_MENUBARFACTORY DECLARE_ASCII("com.sun.star.comp.framework.MenuBarFactory" ) #define IMPLEMENTATIONNAME_STARTMODULE DECLARE_ASCII("com.sun.star.comp.framework.BackingComp" ) -#define IMPLEMENTATIONNAME_GLOBALACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.comp.framework.GlobalAcceleratorConfiguration") -#define IMPLEMENTATIONNAME_MODULEACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.comp.framework.ModuleAcceleratorConfiguration") -#define IMPLEMENTATIONNAME_DOCUMENTACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.comp.framework.DocumentAcceleratorConfiguration") #define IMPLEMENTATIONNAME_WINDOWSTATECONFIGURATION DECLARE_ASCII("com.sun.star.comp.framework.WindowStateConfiguration" ) #define IMPLEMENTATIONNAME_TOOLBARFACTORY DECLARE_ASCII("com.sun.star.comp.framework.ToolBarFactory" ) #define IMPLEMENTATIONNAME_ADDONSTOOLBARFACTORY DECLARE_ASCII("com.sun.star.comp.framework.AddonsToolBarFactory" ) diff --git a/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx b/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx index a41438673e21..25894ce5ecff 100644 --- a/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx +++ b/framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx @@ -99,7 +99,7 @@ namespace framework virtual void SAL_CALL removeSettings( const OUString& ResourceURL ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL insertSettings( const OUString& NewResourceURL, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& aNewData ) throw (::com::sun::star::container::ElementExistException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getImageManager() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getShortCutManager() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > SAL_CALL getShortCutManager() throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getEventsManager() throw (::com::sun::star::uno::RuntimeException); // XModuleUIConfigurationManager @@ -202,7 +202,7 @@ namespace framework com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xModuleImageManager; - com::sun::star::uno::Reference< com::sun::star::uno::XInterface > m_xModuleAcceleratorManager; + com::sun::star::uno::Reference< com::sun::star::ui::XAcceleratorConfiguration > m_xModuleAcceleratorManager; }; } diff --git a/framework/inc/uiconfiguration/uiconfigurationmanager.hxx b/framework/inc/uiconfiguration/uiconfigurationmanager.hxx index 6e3ec29a0fc7..887e749f6af8 100644 --- a/framework/inc/uiconfiguration/uiconfigurationmanager.hxx +++ b/framework/inc/uiconfiguration/uiconfigurationmanager.hxx @@ -36,13 +36,14 @@ #include <stdtypes.h> #include <uiconfiguration/imagemanager.hxx> +#include <com/sun/star/container/XIndexContainer.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XTypeProvider.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/ui/XUIConfigurationManager2.hpp> #include <com/sun/star/ui/ConfigurationEvent.hpp> #include <com/sun/star/ui/UIElementType.hpp> -#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/ui/XAcceleratorConfiguration.hpp> #include <cppuhelper/weak.hxx> #include <cppuhelper/interfacecontainer.hxx> @@ -85,7 +86,7 @@ namespace framework virtual void SAL_CALL removeSettings( const OUString& ResourceURL ) throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException); virtual void SAL_CALL insertSettings( const OUString& NewResourceURL, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& aNewData ) throw (::com::sun::star::container::ElementExistException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getImageManager() throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getShortCutManager() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XAcceleratorConfiguration > SAL_CALL getShortCutManager() throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getEventsManager() throw (::com::sun::star::uno::RuntimeException); // XUIConfigurationPersistence @@ -175,7 +176,7 @@ namespace framework com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext; ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener com::sun::star::uno::Reference< com::sun::star::lang::XComponent > m_xImageManager; - com::sun::star::uno::Reference< com::sun::star::uno::XInterface > m_xAccConfig; + com::sun::star::uno::Reference< com::sun::star::ui::XAcceleratorConfiguration > m_xAccConfig; }; } diff --git a/framework/source/accelerators/documentacceleratorconfiguration.cxx b/framework/source/accelerators/documentacceleratorconfiguration.cxx index 53897e7e674b..b28c47893cfc 100644 --- a/framework/source/accelerators/documentacceleratorconfiguration.cxx +++ b/framework/source/accelerators/documentacceleratorconfiguration.cxx @@ -46,6 +46,8 @@ #include <comphelper/sequenceashashmap.hxx> #include <i18nlangtag/languagetag.hxx> +#define SERVICENAME_DOCUMENTACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.ui.DocumentAcceleratorConfiguration") +#define IMPLEMENTATIONNAME_DOCUMENTACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.comp.framework.DocumentAcceleratorConfiguration") namespace framework { @@ -99,10 +101,18 @@ void SAL_CALL DocumentAcceleratorConfiguration::initialize(const css::uno::Seque // SAFE -> ---------------------------------- WriteGuard aWriteLock(m_aLock); - ::comphelper::SequenceAsHashMap lArgs(lArguments); - m_xDocumentRoot = lArgs.getUnpackedValueOrDefault( - OUString("DocumentRoot"), - css::uno::Reference< css::embed::XStorage >()); + css::uno::Reference<css::embed::XStorage> xRoot; + if (lArguments.getLength() == 1 && (lArguments[0] >>= xRoot)) + { + m_xDocumentRoot = xRoot; + } + else + { + ::comphelper::SequenceAsHashMap lArgs(lArguments); + m_xDocumentRoot = lArgs.getUnpackedValueOrDefault( + OUString("DocumentRoot"), + css::uno::Reference< css::embed::XStorage >()); + } aWriteLock.unlock(); // <- SAFE ---------------------------------- diff --git a/framework/source/accelerators/globalacceleratorconfiguration.cxx b/framework/source/accelerators/globalacceleratorconfiguration.cxx index f69825f21a68..cc9a36ff2af8 100644 --- a/framework/source/accelerators/globalacceleratorconfiguration.cxx +++ b/framework/source/accelerators/globalacceleratorconfiguration.cxx @@ -36,6 +36,7 @@ #include <i18nlangtag/languagetag.hxx> #include <comphelper/configurationhelper.hxx> +#define IMPLEMENTATIONNAME_GLOBALACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.comp.framework.GlobalAcceleratorConfiguration") namespace framework { diff --git a/framework/source/accelerators/moduleacceleratorconfiguration.cxx b/framework/source/accelerators/moduleacceleratorconfiguration.cxx index 382df163b2b5..45305ed0bb4c 100644 --- a/framework/source/accelerators/moduleacceleratorconfiguration.cxx +++ b/framework/source/accelerators/moduleacceleratorconfiguration.cxx @@ -41,6 +41,8 @@ #include <rtl/logfile.h> +#define SERVICENAME_MODULEACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.ui.ModuleAcceleratorConfiguration") +#define IMPLEMENTATIONNAME_MODULEACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.comp.framework.ModuleAcceleratorConfiguration") namespace framework { @@ -93,9 +95,16 @@ void SAL_CALL ModuleAcceleratorConfiguration::initialize(const css::uno::Sequenc // SAFE -> ---------------------------------- WriteGuard aWriteLock(m_aLock); - ::comphelper::SequenceAsHashMap lArgs(lArguments); - m_sModule = lArgs.getUnpackedValueOrDefault(OUString("ModuleIdentifier"), OUString()); - m_sLocale = lArgs.getUnpackedValueOrDefault(OUString("Locale") , OUString("x-default")); + OUString sModule; + if (lArguments.getLength() == 1 && (lArguments[0] >>= sModule)) + { + m_sModule = sModule; + } else + { + ::comphelper::SequenceAsHashMap lArgs(lArguments); + m_sModule = lArgs.getUnpackedValueOrDefault(OUString("ModuleIdentifier"), OUString()); + m_sLocale = lArgs.getUnpackedValueOrDefault(OUString("Locale") , OUString("x-default")); + } if (m_sModule.isEmpty()) throw css::uno::RuntimeException( diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index 5cf8482ced7e..40b02ec97416 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/ui/UIElementType.hpp> #include <com/sun/star/ui/ConfigurationEvent.hpp> +#include <com/sun/star/ui/ModuleAcceleratorConfiguration.hpp> #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/embed/ElementModes.hpp> @@ -1346,7 +1347,7 @@ Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getImageManager() return Reference< XInterface >( m_xModuleImageManager, UNO_QUERY ); } -Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getShortCutManager() throw (::com::sun::star::uno::RuntimeException) +Reference< XAcceleratorConfiguration > SAL_CALL ModuleUIConfigurationManager::getShortCutManager() throw (::com::sun::star::uno::RuntimeException) { ResetableGuard aGuard( m_aLock ); @@ -1358,17 +1359,7 @@ Reference< XInterface > SAL_CALL ModuleUIConfigurationManager::getShortCutManage if ( !m_xModuleAcceleratorManager.is() ) { - Reference< XInterface > xManager = xSMGR->createInstance(SERVICENAME_MODULEACCELERATORCONFIGURATION); - Reference< XInitialization > xInit (xManager, UNO_QUERY_THROW); - - PropertyValue aProp; - aProp.Name = OUString("ModuleIdentifier"); - aProp.Value <<= aModule; - - Sequence< Any > lArgs(1); - lArgs[0] <<= aProp; - - xInit->initialize(lArgs); + Reference< XAcceleratorConfiguration > xManager = ModuleAcceleratorConfiguration::createWithModuleIdentifier(comphelper::getComponentContext(xSMGR), aModule); m_xModuleAcceleratorManager = xManager; } diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx index a448d8945579..3ded374a2d74 100644 --- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx @@ -38,6 +38,7 @@ #include <com/sun/star/ui/UIElementType.hpp> #include <com/sun/star/ui/ConfigurationEvent.hpp> #include <com/sun/star/ui/ConfigurationEvent.hpp> +#include <com/sun/star/ui/DocumentAcceleratorConfiguration.hpp> #include <comphelper/componentcontext.hxx> #include <vcl/svapp.hxx> @@ -1062,7 +1063,7 @@ Reference< XInterface > SAL_CALL UIConfigurationManager::getImageManager() throw return Reference< XInterface >( m_xImageManager, UNO_QUERY ); } -Reference< XInterface > SAL_CALL UIConfigurationManager::getShortCutManager() throw (::com::sun::star::uno::RuntimeException) +Reference< XAcceleratorConfiguration > SAL_CALL UIConfigurationManager::getShortCutManager() throw (::com::sun::star::uno::RuntimeException) { // SAFE -> ResetableGuard aGuard( m_aLock ); @@ -1070,23 +1071,13 @@ Reference< XInterface > SAL_CALL UIConfigurationManager::getShortCutManager() th if (m_xAccConfig.is()) return m_xAccConfig; - Reference<XMultiServiceFactory> xSMGR(m_xContext->getServiceManager(), UNO_QUERY_THROW); + Reference< XComponentContext > xContext = m_xContext; Reference< XStorage > xDocumentRoot = m_xDocConfigStorage; aGuard.unlock(); // <- SAFE - Reference< XInterface > xAccConfig = xSMGR->createInstance(SERVICENAME_DOCUMENTACCELERATORCONFIGURATION); - Reference< XInitialization > xInit (xAccConfig, UNO_QUERY_THROW); - - PropertyValue aProp; - aProp.Name = OUString("DocumentRoot"); - aProp.Value <<= xDocumentRoot; - - Sequence< Any > lArgs(1); - lArgs[0] <<= aProp; - - xInit->initialize(lArgs); + Reference< XAcceleratorConfiguration > xAccConfig = DocumentAcceleratorConfiguration::createWithDocumentRoot(xContext, xDocumentRoot); // SAFE -> aGuard.lock(); diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index f8a330b9590a..7393306510ec 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -1553,7 +1553,7 @@ void MenuBarManager::RetrieveShortcuts( std::vector< MenuItemHandler* >& aMenuSh Reference< XUIConfigurationManager > xDocUICfgMgr( xSupplier->getUIConfigurationManager(), UNO_QUERY ); if ( xDocUICfgMgr.is() ) { - xDocAccelCfg = Reference< XAcceleratorConfiguration >( xDocUICfgMgr->getShortCutManager(), UNO_QUERY ); + xDocAccelCfg = xDocUICfgMgr->getShortCutManager(); m_xDocAcceleratorManager = xDocAccelCfg; } } @@ -1570,7 +1570,7 @@ void MenuBarManager::RetrieveShortcuts( std::vector< MenuItemHandler* >& aMenuSh Reference< XUIConfigurationManager > xUICfgMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( m_aModuleIdentifier ); if ( xUICfgMgr.is() ) { - xModuleAccelCfg = Reference< XAcceleratorConfiguration >( xUICfgMgr->getShortCutManager(), UNO_QUERY ); + xModuleAccelCfg = xUICfgMgr->getShortCutManager(); m_xModuleAcceleratorManager = xModuleAccelCfg; } } diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx index 15c749548ef0..29ef5e1efb23 100644 --- a/framework/source/uielement/newmenucontroller.cxx +++ b/framework/source/uielement/newmenucontroller.cxx @@ -193,7 +193,7 @@ void NewMenuController::setAccelerators( PopupMenu* pPopupMenu ) Reference< XUIConfigurationManager > xDocUICfgMgr( xSupplier->getUIConfigurationManager(), UNO_QUERY ); if ( xDocUICfgMgr.is() ) { - xDocAccelCfg = Reference< XAcceleratorConfiguration >( xDocUICfgMgr->getShortCutManager(), UNO_QUERY ); + xDocAccelCfg = xDocUICfgMgr->getShortCutManager(); m_xDocAcceleratorManager = xDocAccelCfg; } } @@ -208,7 +208,7 @@ void NewMenuController::setAccelerators( PopupMenu* pPopupMenu ) Reference< XUIConfigurationManager > xUICfgMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( m_aModuleIdentifier ); if ( xUICfgMgr.is() ) { - xModuleAccelCfg = Reference< XAcceleratorConfiguration >( xUICfgMgr->getShortCutManager(), UNO_QUERY ); + xModuleAccelCfg = xUICfgMgr->getShortCutManager(); m_xModuleAcceleratorManager = xModuleAccelCfg; } } diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index 675e83954a3d..841ebbcac67c 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -2227,7 +2227,7 @@ bool ToolBarManager::RetrieveShortcut( const OUString& rCommandURL, OUString& rS Reference< XUIConfigurationManager > xDocUICfgMgr( xSupplier->getUIConfigurationManager(), UNO_QUERY ); if ( xDocUICfgMgr.is() ) { - xDocAccelCfg = Reference< XAcceleratorConfiguration >( xDocUICfgMgr->getShortCutManager(), UNO_QUERY ); + xDocAccelCfg = xDocUICfgMgr->getShortCutManager(); m_xDocAcceleratorManager = xDocAccelCfg; } } @@ -2244,7 +2244,7 @@ bool ToolBarManager::RetrieveShortcut( const OUString& rCommandURL, OUString& rS Reference< XUIConfigurationManager > xUICfgMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( m_aModuleIdentifier ); if ( xUICfgMgr.is() ) { - xModuleAccelCfg = Reference< XAcceleratorConfiguration >( xUICfgMgr->getShortCutManager(), UNO_QUERY ); + xModuleAccelCfg = xUICfgMgr->getShortCutManager(); m_xModuleAcceleratorManager = xModuleAccelCfg; } } diff --git a/include/sfx2/sidebar/CommandInfoProvider.hxx b/include/sfx2/sidebar/CommandInfoProvider.hxx index ba3db4be69ff..96ee6d121c84 100644 --- a/include/sfx2/sidebar/CommandInfoProvider.hxx +++ b/include/sfx2/sidebar/CommandInfoProvider.hxx @@ -21,7 +21,7 @@ #include "sfx2/dllapi.h" #include <com/sun/star/frame/XFrame.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/ui/XAcceleratorConfiguration.hpp> @@ -65,7 +65,7 @@ public: void SetFrame (const cssu::Reference<css::frame::XFrame>& rxFrame); private: - cssu::Reference<css::lang::XMultiServiceFactory> mxServiceFactory; + cssu::Reference<css::uno::XComponentContext> mxContext; cssu::Reference<css::frame::XFrame> mxCachedDataFrame; cssu::Reference<css::ui::XAcceleratorConfiguration> mxCachedDocumentAcceleratorConfiguration; cssu::Reference<css::ui::XAcceleratorConfiguration> mxCachedModuleAcceleratorConfiguration; diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 12ee8f17da27..5b03b7684014 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -412,7 +412,9 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/ucb,\ )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/ui,\ AddressBookSourceDialog \ + DocumentAcceleratorConfiguration \ GlobalAcceleratorConfiguration \ + ModuleAcceleratorConfiguration \ ModuleUIConfigurationManagerSupplier \ UICategoryDescription \ UIConfigurationManager \ diff --git a/offapi/com/sun/star/ui/DocumentAcceleratorConfiguration.idl b/offapi/com/sun/star/ui/DocumentAcceleratorConfiguration.idl new file mode 100644 index 000000000000..45d85b7d62b0 --- /dev/null +++ b/offapi/com/sun/star/ui/DocumentAcceleratorConfiguration.idl @@ -0,0 +1,40 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_ui_DocumentAcceleratorConfiguration_idl__ +#define __com_sun_star_ui_DocumentAcceleratorConfiguration_idl__ + +#include <com/sun/star/ui/XAcceleratorConfiguration.idl> +#include <com/sun/star/embed/XStorage.idl> + +module com { module sun { module star { module ui { + +/** + + @since LibreOffice 4.2 +*/ +service DocumentAcceleratorConfiguration : XAcceleratorConfiguration +{ + createWithDocumentRoot([in] com::sun::star::embed::XStorage DocumentRoot); +}; + +}; }; }; }; // com.sun.star + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/ui/ModuleAcceleratorConfiguration.idl b/offapi/com/sun/star/ui/ModuleAcceleratorConfiguration.idl new file mode 100644 index 000000000000..532e93fb0c5c --- /dev/null +++ b/offapi/com/sun/star/ui/ModuleAcceleratorConfiguration.idl @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef __com_sun_star_ui_ModuleAcceleratorConfiguration_idl__ +#define __com_sun_star_ui_ModuleAcceleratorConfiguration_idl__ + +#include <com/sun/star/ui/XAcceleratorConfiguration.idl> + +module com { module sun { module star { module ui { + +/** + + @since LibreOffice 4.2 +*/ +service ModuleAcceleratorConfiguration : XAcceleratorConfiguration +{ + createWithModuleIdentifier([in] string ModuleIdentifier); +}; + +}; }; }; }; // com.sun.star + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/ui/XUIConfigurationManager.idl b/offapi/com/sun/star/ui/XUIConfigurationManager.idl index 45b906f11779..6d58c0eab9bd 100644 --- a/offapi/com/sun/star/ui/XUIConfigurationManager.idl +++ b/offapi/com/sun/star/ui/XUIConfigurationManager.idl @@ -25,6 +25,7 @@ #include <com/sun/star/beans/XPropertySet.idl> #include <com/sun/star/beans/PropertyValue.idl> #include <com/sun/star/ui/XUIConfigurationListener.idl> +#include <com/sun/star/ui/XAcceleratorConfiguration.idl> #include <com/sun/star/container/ElementExistException.idl> #include <com/sun/star/container/NoSuchElementException.idl> #include <com/sun/star/lang/IllegalArgumentException.idl> @@ -216,7 +217,7 @@ interface XUIConfigurationManager : ::com::sun::star::uno::XInterface @return the short cut manager of the user interface configuration manager. */ - com::sun::star::uno::XInterface getShortCutManager(); + com::sun::star::ui::XAcceleratorConfiguration getShortCutManager(); /** retrieves the events manager from the user interface configuration manager. diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index da59b28504cc..11c54390e412 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -2952,8 +2952,7 @@ void ScDocShell::ResetKeyBindings( ScOptionsUtil::KeyBindingType eType ) return; // shortcut manager - Reference<XAcceleratorConfiguration> xScAccel( - xConfigMgr->getShortCutManager(), UNO_QUERY); + Reference<XAcceleratorConfiguration> xScAccel = xConfigMgr->getShortCutManager(); if (!xScAccel.is()) return; diff --git a/sfx2/source/sidebar/CommandInfoProvider.cxx b/sfx2/source/sidebar/CommandInfoProvider.cxx index a924a24efba2..9019e963f6ad 100644 --- a/sfx2/source/sidebar/CommandInfoProvider.cxx +++ b/sfx2/source/sidebar/CommandInfoProvider.cxx @@ -23,9 +23,11 @@ #include <cppuhelper/compbase1.hxx> #include <cppuhelper/basemutex.hxx> -#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/ModuleManager.hpp> +#include <com/sun/star/frame/UICommandDescription.hpp> +#include <com/sun/star/ui/GlobalAcceleratorConfiguration.hpp> #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> -#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> +#include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp> using namespace css; using namespace cssu; @@ -89,7 +91,7 @@ CommandInfoProvider& CommandInfoProvider::Instance (void) CommandInfoProvider::CommandInfoProvider (void) - : mxServiceFactory(comphelper::getProcessServiceFactory()), + : mxContext(comphelper::getProcessComponentContext()), mxCachedDataFrame(), mxCachedDocumentAcceleratorConfiguration(), mxCachedModuleAcceleratorConfiguration(), @@ -178,9 +180,7 @@ Reference<ui::XAcceleratorConfiguration> CommandInfoProvider::GetDocumentAcceler UNO_QUERY); if (xConfigurationManager.is()) { - mxCachedDocumentAcceleratorConfiguration = Reference<ui::XAcceleratorConfiguration>( - xConfigurationManager->getShortCutManager(), - UNO_QUERY); + mxCachedDocumentAcceleratorConfiguration = xConfigurationManager->getShortCutManager(); } } } @@ -199,16 +199,12 @@ Reference<ui::XAcceleratorConfiguration> CommandInfoProvider::GetModuleAccelerat { try { - Reference<ui::XModuleUIConfigurationManagerSupplier> xSupplier ( - mxServiceFactory->createInstance(A2S("com.sun.star.ui.ModuleUIConfigurationManagerSupplier")), - UNO_QUERY); + Reference<ui::XModuleUIConfigurationManagerSupplier> xSupplier = ui::ModuleUIConfigurationManagerSupplier::create(mxContext); Reference<ui::XUIConfigurationManager> xManager ( xSupplier->getUIConfigurationManager(GetModuleIdentifier())); if (xManager.is()) { - mxCachedModuleAcceleratorConfiguration = Reference<ui::XAcceleratorConfiguration>( - xManager->getShortCutManager(), - UNO_QUERY); + mxCachedModuleAcceleratorConfiguration = xManager->getShortCutManager(); } } catch (Exception&) @@ -226,9 +222,7 @@ Reference<ui::XAcceleratorConfiguration> CommandInfoProvider::GetGlobalAccelerat // Get the global accelerator configuration. if ( ! mxCachedGlobalAcceleratorConfiguration.is()) { - mxCachedGlobalAcceleratorConfiguration = Reference<ui::XAcceleratorConfiguration>( - mxServiceFactory->createInstance(A2S("com.sun.star.ui.GlobalAcceleratorConfiguration")), - UNO_QUERY); + mxCachedGlobalAcceleratorConfiguration = ui::GlobalAcceleratorConfiguration::create(mxContext); } return mxCachedGlobalAcceleratorConfiguration; @@ -241,11 +235,8 @@ OUString CommandInfoProvider::GetModuleIdentifier (void) { if (msCachedModuleIdentifier.getLength() == 0) { - Reference<frame::XModuleManager> xModuleManager ( - mxServiceFactory->createInstance(A2S("com.sun.star.frame.ModuleManager")), - UNO_QUERY); - if (xModuleManager.is()) - msCachedModuleIdentifier = xModuleManager->identify(mxCachedDataFrame); + Reference<frame::XModuleManager2> xModuleManager = frame::ModuleManager::create(mxContext); + msCachedModuleIdentifier = xModuleManager->identify(mxCachedDataFrame); } return msCachedModuleIdentifier; } @@ -315,14 +306,10 @@ Sequence<beans::PropertyValue> CommandInfoProvider::GetCommandProperties (const const OUString sModuleIdentifier (GetModuleIdentifier()); if (sModuleIdentifier.getLength() > 0) { - Reference<container::XNameAccess> xNameAccess ( - mxServiceFactory->createInstance( - OUString::createFromAscii("com.sun.star.frame.UICommandDescription")), - UNO_QUERY); + Reference<container::XNameAccess> xNameAccess = frame::UICommandDescription::create(mxContext); Reference<container::XNameAccess> xUICommandLabels; - if (xNameAccess.is()) - if (xNameAccess->getByName(sModuleIdentifier) >>= xUICommandLabels) - xUICommandLabels->getByName(rsCommandName) >>= aProperties; + if (xNameAccess->getByName(sModuleIdentifier) >>= xUICommandLabels) + xUICommandLabels->getByName(rsCommandName) >>= aProperties; } } catch (Exception&) diff --git a/sfx2/source/sidebar/ControllerFactory.cxx b/sfx2/source/sidebar/ControllerFactory.cxx index 79196391b74c..4702c898fb9e 100644 --- a/sfx2/source/sidebar/ControllerFactory.cxx +++ b/sfx2/source/sidebar/ControllerFactory.cxx @@ -23,6 +23,7 @@ #include <com/sun/star/frame/XToolbarController.hpp> #include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XUIControllerFactory.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <framework/sfxhelperfunctions.hxx> #include <svtools/generictoolboxcontroller.hxx> diff --git a/svtools/source/misc/acceleratorexecute.cxx b/svtools/source/misc/acceleratorexecute.cxx index b86d31aed27c..3d83a9b958fa 100644 --- a/svtools/source/misc/acceleratorexecute.cxx +++ b/svtools/source/misc/acceleratorexecute.cxx @@ -387,7 +387,7 @@ css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::st try { css::uno::Reference< css::ui::XUIConfigurationManager > xUIManager = xUISupplier->getUIConfigurationManager(sModule); - xAccCfg = css::uno::Reference< css::ui::XAcceleratorConfiguration >(xUIManager->getShortCutManager(), css::uno::UNO_QUERY_THROW); + xAccCfg = xUIManager->getShortCutManager(); } catch(const css::container::NoSuchElementException&) {} @@ -402,7 +402,7 @@ css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::st if (xUISupplier.is()) { css::uno::Reference< css::ui::XUIConfigurationManager > xUIManager = xUISupplier->getUIConfigurationManager(); - xAccCfg.set(xUIManager->getShortCutManager(), css::uno::UNO_QUERY_THROW); + xAccCfg = xUIManager->getShortCutManager(); } return xAccCfg; } |