summaryrefslogtreecommitdiff
path: root/framework/source
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/source
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/source')
-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
8 files changed, 40 insertions, 38 deletions
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;
}
}