Kaydet (Commit) e52a5e29 authored tarafından Noel Grandin's avatar Noel Grandin

fdo#46808, use service constructor for ui::GlobalAcceleratorConfiguration

Change-Id: Icab69ba138b28c3baed4352da86a1b3b0c0cc195
üst 2f998bdf
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <svl/stritem.hxx> #include <svl/stritem.hxx>
#include "svtools/treelistentry.hxx" #include "svtools/treelistentry.hxx"
#include <com/sun/star/embed/StorageFactory.hpp> #include <com/sun/star/embed/StorageFactory.hpp>
#include <com/sun/star/ui/GlobalAcceleratorConfiguration.hpp>
#include <sal/macros.h> #include <sal/macros.h>
...@@ -77,7 +78,6 @@ using namespace com::sun::star; ...@@ -77,7 +78,6 @@ using namespace com::sun::star;
//----------------------------------------------- //-----------------------------------------------
static ::rtl::OUString SERVICE_UICONFIGMGR (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.UIConfigurationManager" )); static ::rtl::OUString SERVICE_UICONFIGMGR (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.UIConfigurationManager" ));
static ::rtl::OUString SERVICE_DESKTOP (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop" )); static ::rtl::OUString SERVICE_DESKTOP (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop" ));
static ::rtl::OUString SERVICE_GLOBALACCCFG (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.GlobalAcceleratorConfiguration" ));
static ::rtl::OUString MODULEPROP_SHORTNAME (RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryShortName" )); static ::rtl::OUString MODULEPROP_SHORTNAME (RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryShortName" ));
static ::rtl::OUString MODULEPROP_UINAME (RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryUIName" )); static ::rtl::OUString MODULEPROP_UINAME (RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryUIName" ));
...@@ -852,7 +852,7 @@ void SfxAcceleratorConfigPage::InitAccCfg() ...@@ -852,7 +852,7 @@ void SfxAcceleratorConfigPage::InitAccCfg()
m_sModuleUIName = lModuleProps.getUnpackedValueOrDefault(MODULEPROP_UINAME , ::rtl::OUString()); m_sModuleUIName = lModuleProps.getUnpackedValueOrDefault(MODULEPROP_UINAME , ::rtl::OUString());
// get global accelerator configuration // get global accelerator configuration
m_xGlobal = css::uno::Reference< css::ui::XAcceleratorConfiguration >(m_xSMGR->createInstance(SERVICE_GLOBALACCCFG), css::uno::UNO_QUERY_THROW); m_xGlobal = css::ui::GlobalAcceleratorConfiguration::create(comphelper::getComponentContext(m_xSMGR));
// get module accelerator configuration // get module accelerator configuration
......
...@@ -65,7 +65,6 @@ namespace framework{ ...@@ -65,7 +65,6 @@ namespace framework{
#define SERVICENAME_WINDOWSTATECONFIGURATION DECLARE_ASCII("com.sun.star.ui.WindowStateConfiguration" ) #define SERVICENAME_WINDOWSTATECONFIGURATION DECLARE_ASCII("com.sun.star.ui.WindowStateConfiguration" )
#define SERVICENAME_STARTMODULE DECLARE_ASCII("com.sun.star.frame.StartModule" ) #define SERVICENAME_STARTMODULE DECLARE_ASCII("com.sun.star.frame.StartModule" )
#define SERVICENAME_FRAMECONTROLLER DECLARE_ASCII("com.sun.star.frame.Controller" ) #define SERVICENAME_FRAMECONTROLLER DECLARE_ASCII("com.sun.star.frame.Controller" )
#define SERVICENAME_GLOBALACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.ui.GlobalAcceleratorConfiguration")
#define SERVICENAME_MODULEACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.ui.ModuleAcceleratorConfiguration") #define SERVICENAME_MODULEACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.ui.ModuleAcceleratorConfiguration")
#define SERVICENAME_DOCUMENTACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.ui.DocumentAcceleratorConfiguration") #define SERVICENAME_DOCUMENTACCELERATORCONFIGURATION DECLARE_ASCII("com.sun.star.ui.DocumentAcceleratorConfiguration")
#define SERVICENAME_PACKAGESTRUCTURECREATOR DECLARE_ASCII("com.sun.star.embed.PackageStructureCreator" ) #define SERVICENAME_PACKAGESTRUCTURECREATOR DECLARE_ASCII("com.sun.star.embed.PackageStructureCreator" )
......
...@@ -53,7 +53,7 @@ DEFINE_XTYPEPROVIDER_2_WITH_BASECLASS(GlobalAcceleratorConfiguration, ...@@ -53,7 +53,7 @@ DEFINE_XTYPEPROVIDER_2_WITH_BASECLASS(GlobalAcceleratorConfiguration,
DEFINE_XSERVICEINFO_MULTISERVICE(GlobalAcceleratorConfiguration , DEFINE_XSERVICEINFO_MULTISERVICE(GlobalAcceleratorConfiguration ,
::cppu::OWeakObject , ::cppu::OWeakObject ,
SERVICENAME_GLOBALACCELERATORCONFIGURATION , DECLARE_ASCII("com.sun.star.ui.GlobalAcceleratorConfiguration"),
IMPLEMENTATIONNAME_GLOBALACCELERATORCONFIGURATION) IMPLEMENTATIONNAME_GLOBALACCELERATORCONFIGURATION)
DEFINE_INIT_SERVICE(GlobalAcceleratorConfiguration, DEFINE_INIT_SERVICE(GlobalAcceleratorConfiguration,
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include <com/sun/star/frame/XPopupMenuController.hpp> #include <com/sun/star/frame/XPopupMenuController.hpp>
#include <com/sun/star/frame/XUIControllerRegistration.hpp> #include <com/sun/star/frame/XUIControllerRegistration.hpp>
#include <com/sun/star/lang/SystemDependent.hpp> #include <com/sun/star/lang/SystemDependent.hpp>
#include <com/sun/star/ui/GlobalAcceleratorConfiguration.hpp>
#include <com/sun/star/ui/ItemType.hpp> #include <com/sun/star/ui/ItemType.hpp>
#include <com/sun/star/ui/ImageType.hpp> #include <com/sun/star/ui/ImageType.hpp>
#include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameAccess.hpp>
...@@ -1598,9 +1599,7 @@ void MenuBarManager::RetrieveShortcuts( std::vector< MenuItemHandler* >& aMenuSh ...@@ -1598,9 +1599,7 @@ void MenuBarManager::RetrieveShortcuts( std::vector< MenuItemHandler* >& aMenuSh
if ( !xGlobalAccelCfg.is() ) if ( !xGlobalAccelCfg.is() )
{ {
xGlobalAccelCfg = Reference< XAcceleratorConfiguration >( getServiceFactory()->createInstance( xGlobalAccelCfg = GlobalAcceleratorConfiguration::create( comphelper::getComponentContext(getServiceFactory()) );
SERVICENAME_GLOBALACCELERATORCONFIGURATION ),
UNO_QUERY );
m_xGlobalAcceleratorManager = xGlobalAccelCfg; m_xGlobalAcceleratorManager = xGlobalAccelCfg;
} }
} }
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <com/sun/star/awt/MenuItemStyle.hpp> #include <com/sun/star/awt/MenuItemStyle.hpp>
#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/ui/GlobalAcceleratorConfiguration.hpp>
#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/ModuleManager.hpp>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
...@@ -215,9 +216,7 @@ void NewMenuController::setAccelerators( PopupMenu* pPopupMenu ) ...@@ -215,9 +216,7 @@ void NewMenuController::setAccelerators( PopupMenu* pPopupMenu )
if ( !xGlobalAccelCfg.is() ) if ( !xGlobalAccelCfg.is() )
{ {
xGlobalAccelCfg = Reference< XAcceleratorConfiguration >( m_xServiceManager->createInstance( xGlobalAccelCfg = GlobalAcceleratorConfiguration::create( comphelper::getComponentContext(m_xServiceManager) );
SERVICENAME_GLOBALACCELERATORCONFIGURATION ),
UNO_QUERY );
m_xGlobalAcceleratorManager = xGlobalAccelCfg; m_xGlobalAcceleratorManager = xGlobalAccelCfg;
} }
} }
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <com/sun/star/graphic/XGraphic.hpp> #include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp> #include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/ui/GlobalAcceleratorConfiguration.hpp>
#include <com/sun/star/ui/XUIElementSettings.hpp> #include <com/sun/star/ui/XUIElementSettings.hpp>
#include <com/sun/star/ui/XUIConfigurationPersistence.hpp> #include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
...@@ -2267,9 +2268,7 @@ bool ToolBarManager::RetrieveShortcut( const rtl::OUString& rCommandURL, rtl::OU ...@@ -2267,9 +2268,7 @@ bool ToolBarManager::RetrieveShortcut( const rtl::OUString& rCommandURL, rtl::OU
if ( !xGlobalAccelCfg.is() ) if ( !xGlobalAccelCfg.is() )
{ {
xGlobalAccelCfg = Reference< XAcceleratorConfiguration >( m_xServiceManager->createInstance( xGlobalAccelCfg = GlobalAcceleratorConfiguration::create( comphelper::getComponentContext(m_xServiceManager) );
SERVICENAME_GLOBALACCELERATORCONFIGURATION ),
UNO_QUERY );
m_xGlobalAcceleratorManager = xGlobalAccelCfg; m_xGlobalAcceleratorManager = xGlobalAccelCfg;
} }
} }
......
...@@ -27,8 +27,7 @@ module com { module sun { module star { module ui { ...@@ -27,8 +27,7 @@ module com { module sun { module star { module ui {
@since OOo 2.0 @since OOo 2.0
*/ */
service GlobalAcceleratorConfiguration : XAcceleratorConfiguration service GlobalAcceleratorConfiguration : XAcceleratorConfiguration;
{};
}; }; }; }; // com.sun.star }; }; }; }; // com.sun.star
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <vector> #include <vector>
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/frame/XFrame.hpp> #include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/ui/XAcceleratorConfiguration.hpp> #include <com/sun/star/ui/XAcceleratorConfiguration.hpp>
...@@ -201,11 +202,11 @@ class SVT_DLLPUBLIC AcceleratorExecute : private TMutexInit ...@@ -201,11 +202,11 @@ class SVT_DLLPUBLIC AcceleratorExecute : private TMutexInit
//--------------------------------------- //---------------------------------------
/** TODO document me */ /** TODO document me */
static css::uno::Reference< css::ui::XAcceleratorConfiguration > st_openGlobalConfig(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); static css::uno::Reference< css::ui::XAcceleratorConfiguration > st_openGlobalConfig(const css::uno::Reference< css::uno::XComponentContext >& rxContext);
//--------------------------------------- //---------------------------------------
/** TODO document me */ /** TODO document me */
static css::uno::Reference< css::ui::XAcceleratorConfiguration > st_openModuleConfig(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , static css::uno::Reference< css::ui::XAcceleratorConfiguration > st_openModuleConfig(const css::uno::Reference< css::uno::XComponentContext >& rxContext ,
const css::uno::Reference< css::frame::XFrame >& xFrame); const css::uno::Reference< css::frame::XFrame >& xFrame);
//--------------------------------------- //---------------------------------------
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <com/sun/star/frame/ModuleManager.hpp> #include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/frame/XDesktop.hpp> #include <com/sun/star/frame/XDesktop.hpp>
#include <com/sun/star/ui/GlobalAcceleratorConfiguration.hpp>
#include <com/sun/star/ui/XUIConfigurationManager.hpp> #include <com/sun/star/ui/XUIConfigurationManager.hpp>
#include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
...@@ -142,11 +143,11 @@ void AcceleratorExecute::init(const css::uno::Reference< css::lang::XMultiServic ...@@ -142,11 +143,11 @@ void AcceleratorExecute::init(const css::uno::Reference< css::lang::XMultiServic
css::uno::Reference< css::ui::XAcceleratorConfiguration > xDocCfg ; css::uno::Reference< css::ui::XAcceleratorConfiguration > xDocCfg ;
// global cfg // global cfg
xGlobalCfg = AcceleratorExecute::st_openGlobalConfig(xSMGR); xGlobalCfg = css::ui::GlobalAcceleratorConfiguration::create(comphelper::getComponentContext(xSMGR));
if (!bDesktopIsUsed) if (!bDesktopIsUsed)
{ {
// module cfg // module cfg
xModuleCfg = AcceleratorExecute::st_openModuleConfig(xSMGR, xEnv); xModuleCfg = AcceleratorExecute::st_openModuleConfig(comphelper::getComponentContext(xSMGR), xEnv);
// doc cfg // doc cfg
css::uno::Reference< css::frame::XController > xController; css::uno::Reference< css::frame::XController > xController;
...@@ -365,20 +366,11 @@ KeyCode AcceleratorExecute::st_AWTKey2VCLKey(const css::awt::KeyEvent& aAWTKey) ...@@ -365,20 +366,11 @@ KeyCode AcceleratorExecute::st_AWTKey2VCLKey(const css::awt::KeyEvent& aAWTKey)
} }
//----------------------------------------------- //-----------------------------------------------
css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::st_openGlobalConfig(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::st_openModuleConfig(const css::uno::Reference< css::uno::XComponentContext >& rxContext,
{
css::uno::Reference< css::ui::XAcceleratorConfiguration > xAccCfg(
xSMGR->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.GlobalAcceleratorConfiguration" ))),
css::uno::UNO_QUERY_THROW);
return xAccCfg;
}
//-----------------------------------------------
css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::st_openModuleConfig(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
const css::uno::Reference< css::frame::XFrame >& xFrame) const css::uno::Reference< css::frame::XFrame >& xFrame)
{ {
css::uno::Reference< css::frame::XModuleManager2 > xModuleDetection( css::uno::Reference< css::frame::XModuleManager2 > xModuleDetection(
css::frame::ModuleManager::create(comphelper::getComponentContext(xSMGR))); css::frame::ModuleManager::create(rxContext));
::rtl::OUString sModule; ::rtl::OUString sModule;
try try
...@@ -391,7 +383,7 @@ css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::st ...@@ -391,7 +383,7 @@ css::uno::Reference< css::ui::XAcceleratorConfiguration > AcceleratorExecute::st
{ return css::uno::Reference< css::ui::XAcceleratorConfiguration >(); } { return css::uno::Reference< css::ui::XAcceleratorConfiguration >(); }
css::uno::Reference< css::ui::XModuleUIConfigurationManagerSupplier > xUISupplier( css::uno::Reference< css::ui::XModuleUIConfigurationManagerSupplier > xUISupplier(
css::ui::ModuleUIConfigurationManagerSupplier::create(comphelper::getComponentContext(xSMGR)) ); css::ui::ModuleUIConfigurationManagerSupplier::create(rxContext) );
css::uno::Reference< css::ui::XAcceleratorConfiguration > xAccCfg; css::uno::Reference< css::ui::XAcceleratorConfiguration > xAccCfg;
try try
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment