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 /sfx2 | |
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
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/sidebar/CommandInfoProvider.cxx | 41 | ||||
-rw-r--r-- | sfx2/source/sidebar/ControllerFactory.cxx | 1 |
2 files changed, 15 insertions, 27 deletions
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> |