summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2013-05-27 14:52:39 +0200
committerNoel Grandin <noel@peralex.com>2013-05-28 08:10:23 +0200
commit8f3cec9d7a50f33c7be5191656720e463712dd83 (patch)
treeffc45e8944ff407fef79f6997ea610877d7f2e2c /framework
parentaff5c4d76b7a876e9ce9e0b70bb52864dd65be24 (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
Diffstat (limited to 'framework')
-rw-r--r--framework/inc/services.h5
-rw-r--r--framework/inc/uiconfiguration/moduleuiconfigurationmanager.hxx4
-rw-r--r--framework/inc/uiconfiguration/uiconfigurationmanager.hxx7
-rw-r--r--framework/source/accelerators/documentacceleratorconfiguration.cxx18
-rw-r--r--framework/source/accelerators/globalacceleratorconfiguration.cxx1
-rw-r--r--framework/source/accelerators/moduleacceleratorconfiguration.cxx15
-rw-r--r--framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx15
-rw-r--r--framework/source/uiconfiguration/uiconfigurationmanager.cxx17
-rw-r--r--framework/source/uielement/menubarmanager.cxx4
-rw-r--r--framework/source/uielement/newmenucontroller.cxx4
-rw-r--r--framework/source/uielement/toolbarmanager.cxx4
11 files changed, 46 insertions, 48 deletions
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;
}
}