summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-09-04 14:56:48 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-09-05 14:56:19 +0200
commit1c7a54e3a14ad932e68b9281420e6c469e5dd2e5 (patch)
tree8d2d64a9536e738cc6cda4f0690993c98b658bdd /cui
parent55aa40bcd6ae3116c63a0eac18056bcfd011f43a (diff)
fdo#46808, Adapt frame::ModuleManager UNO service to new style
Create a merged XModuleManager2 interface for this service to implement. Which is backwards-compatible, but does not require creating a new service. Explicitly document the XNameReplace interface in the IDL, which is already implemented by the service, since there is code currently using it. Change-Id: Ib46349174b1ce495c240031e93c9427fc33d9853
Diffstat (limited to 'cui')
-rw-r--r--cui/source/customize/acccfg.cxx7
-rw-r--r--cui/source/customize/cfg.cxx21
-rw-r--r--cui/source/customize/cfgutil.cxx11
-rw-r--r--cui/source/customize/selector.cxx17
-rw-r--r--cui/source/dialogs/scriptdlg.cxx7
-rw-r--r--cui/source/options/treeopt.cxx11
6 files changed, 26 insertions, 48 deletions
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx
index 84e0eeaac69d..c12a91a21ae5 100644
--- a/cui/source/customize/acccfg.cxx
+++ b/cui/source/customize/acccfg.cxx
@@ -55,7 +55,7 @@
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/form/XReset.hpp>
#include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp>
-#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/ui/UICommandDescription.hpp>
#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
#include <com/sun/star/ui/XUIConfigurationManager.hpp>
@@ -92,7 +92,6 @@ using namespace com::sun::star;
static ::rtl::OUString SERVICE_STORAGEFACTORY (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.StorageFactory" ));
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_MODULEMANAGER (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.ModuleManager" ));
static ::rtl::OUString SERVICE_GLOBALACCCFG (RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.GlobalAcceleratorConfiguration" ));
static ::rtl::OUString MODULEPROP_SHORTNAME (RTL_CONSTASCII_USTRINGPARAM("ooSetupFactoryShortName" ));
@@ -865,7 +864,9 @@ void SfxAcceleratorConfigPage::InitAccCfg()
}
// identify module
- css::uno::Reference< css::frame::XModuleManager > xModuleManager (m_xSMGR->createInstance(SERVICE_MODULEMANAGER), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::frame::XModuleManager > xModuleManager(
+ css::frame::ModuleManager::create(comphelper::ComponentContext(m_xSMGR).getUNOContext()),
+ css::uno::UNO_QUERY_THROW);
css::uno::Reference< css::container::XNameAccess > xModuleManagerCont(xModuleManager , css::uno::UNO_QUERY_THROW);
m_sModuleLongName = xModuleManager->identify(m_xFrame);
::comphelper::SequenceAsHashMap lModuleProps(xModuleManagerCont->getByName(m_sModuleLongName));
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index e3b896aec6ee..4340091b642c 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -69,6 +69,7 @@
#include <com/sun/star/ui/ItemType.hpp>
#include <com/sun/star/ui/ItemStyle.hpp>
#include <com/sun/star/ui/ModuleUIConfigurationManagerSupplier.hpp>
+#include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/frame/XController.hpp>
#include <com/sun/star/frame/XDesktop.hpp>
#include <com/sun/star/ui/UICommandDescription.hpp>
@@ -768,17 +769,17 @@ SfxTabPage *CreateSvxEventConfigPage( Window *pParent, const SfxItemSet& rSet )
sal_Bool impl_showKeyConfigTabPage( const css::uno::Reference< css::frame::XFrame >& xFrame )
{
- static ::rtl::OUString SERVICENAME_MODULEMANAGER ("com.sun.star.frame.ModuleManager" );
static ::rtl::OUString SERVICENAME_DESKTOP ("com.sun.star.frame.Desktop" );
static ::rtl::OUString MODULEID_STARTMODULE ("com.sun.star.frame.StartModule" );
try
{
css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
+ css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
css::uno::Reference< css::frame::XFramesSupplier > xDesktop(xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW);
- css::uno::Reference< css::frame::XModuleManager > xMM (xSMGR->createInstance(SERVICENAME_MODULEMANAGER), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::frame::XModuleManager > xMM (css::frame::ModuleManager::create(xContext), css::uno::UNO_QUERY_THROW);
- if (xMM.is() && xFrame.is())
+ if (xFrame.is())
{
::rtl::OUString sModuleId = xMM->identify(xFrame);
if (
@@ -1664,15 +1665,15 @@ void SvxConfigPage::Reset( const SfxItemSet& )
uno::Reference< lang::XMultiServiceFactory > xServiceManager(
::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
+ uno::Reference< uno::XComponentContext > xContext(
+ ::comphelper::getProcessComponentContext(), uno::UNO_QUERY_THROW );
m_xFrame = GetFrame();
OUString aModuleId = GetFrameWithDefaultAndIdentify( m_xFrame );
// replace %MODULENAME in the label with the correct module name
uno::Reference< css::frame::XModuleManager > xModuleManager(
- xServiceManager->createInstance(
- OUString( "com.sun.star.frame.ModuleManager" ) ),
- uno::UNO_QUERY_THROW );
+ css::frame::ModuleManager::create( xContext ), uno::UNO_QUERY_THROW);
OUString aModuleName = GetUIModuleName( aModuleId, xModuleManager );
OUString title = aTopLevelSeparator.GetText();
@@ -1687,7 +1688,7 @@ void SvxConfigPage::Reset( const SfxItemSet& )
}
uno::Reference< css::ui::XModuleUIConfigurationManagerSupplier >
- xModuleCfgSupplier( css::ui::ModuleUIConfigurationManagerSupplier::create(comphelper::ComponentContext(xServiceManager).getUNOContext()) );
+ xModuleCfgSupplier( css::ui::ModuleUIConfigurationManagerSupplier::create(xContext) );
// Set up data for module specific menus
SaveInData* pModuleData = NULL;
@@ -1914,10 +1915,8 @@ void SvxConfigPage::Reset( const SfxItemSet& )
return sModuleID;
}
- uno::Reference< css::frame::XModuleManager > xModuleManager(
- xServiceManager->createInstance(
- OUString( "com.sun.star.frame.ModuleManager" ) ),
- uno::UNO_QUERY_THROW );
+ uno::Reference< css::frame::XModuleManager2 > xModuleManager(
+ css::frame::ModuleManager::create( comphelper::ComponentContext(xServiceManager).getUNOContext() ) );
try
{
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index 86be792d8a39..4b12b50b30eb 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -38,7 +38,7 @@
#include <com/sun/star/script/browse/XBrowseNodeFactory.hpp>
#include <com/sun/star/script/browse/BrowseNodeFactoryViewTypes.hpp>
-#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/frame/XDesktop.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/container/XEnumeration.hpp>
@@ -766,14 +766,7 @@ Image SfxConfigGroupListBox_Impl::GetImage(
Reference<XInterface> xDocumentModel = getDocumentModel(xCtx, nodeName );
if ( xDocumentModel.is() )
{
- Reference< ::com::sun::star::frame::XModuleManager >
- xModuleManager(
- xCtx->getServiceManager()
- ->createInstanceWithContext(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("" // xxx todo
- "com.sun.star.frame.ModuleManager") ),
- xCtx ),
- UNO_QUERY_THROW );
+ Reference< frame::XModuleManager2 > xModuleManager( frame::ModuleManager::create(xCtx) );
Reference<container::XNameAccess> xModuleConfig(
xModuleManager, UNO_QUERY_THROW );
// get the long name of the document:
diff --git a/cui/source/customize/selector.cxx b/cui/source/customize/selector.cxx
index 1da7e337b0bf..67bc1bfaa947 100644
--- a/cui/source/customize/selector.cxx
+++ b/cui/source/customize/selector.cxx
@@ -53,7 +53,7 @@
#include <com/sun/star/script/browse/BrowseNodeTypes.hpp>
#include <com/sun/star/script/browse/XBrowseNodeFactory.hpp>
#include <com/sun/star/script/browse/BrowseNodeFactoryViewTypes.hpp>
-#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/frame/XDesktop.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/container/XEnumeration.hpp>
@@ -417,12 +417,7 @@ void SvxConfigGroupListBox_Impl::Init()
Reference< frame::XDispatchInformationProvider > xDIP(
m_xFrame, UNO_QUERY );
- Reference< ::com::sun::star::frame::XModuleManager >
- xModuleManager( xMCF->createInstanceWithContext(
- OUString(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.frame.ModuleManager" )),
- xContext ),
- UNO_QUERY );
+ Reference< frame::XModuleManager2 > xModuleManager( frame::ModuleManager::create(xContext) );
OUString aModuleId;
try{
@@ -571,13 +566,7 @@ Image SvxConfigGroupListBox_Impl::GetImage(
Reference<XInterface> xDocumentModel = getDocumentModel(xCtx, nodeName );
if ( xDocumentModel.is() )
{
- Reference< ::com::sun::star::frame::XModuleManager >
- xModuleManager(
- xCtx->getServiceManager()
- ->createInstanceWithContext(
- OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.ModuleManager")),
- xCtx ),
- UNO_QUERY_THROW );
+ Reference< frame::XModuleManager2 > xModuleManager( frame::ModuleManager::create(xCtx) );
Reference<container::XNameAccess> xModuleConfig(
xModuleManager, UNO_QUERY_THROW );
// get the long name of the document:
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index 3a71808b7254..ebd3676a4f7d 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -49,7 +49,7 @@
#include <com/sun/star/script/provider/ScriptErrorRaisedException.hpp>
#include <com/sun/star/script/provider/ScriptExceptionRaisedException.hpp>
#include <com/sun/star/script/provider/ScriptFrameworkErrorType.hpp>
-#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/script/XInvocation.hpp>
#include <com/sun/star/document/XEmbeddedScripts.hpp>
@@ -224,10 +224,7 @@ void SFTreeListBox::Init( const ::rtl::OUString& language )
if ( xDocumentModel.is() )
{
- Reference< ::com::sun::star::frame::XModuleManager >
- xModuleManager( xCtx->getServiceManager()->createInstanceWithContext(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.ModuleManager") ), xCtx ),
- UNO_QUERY_THROW );
+ Reference< frame::XModuleManager2 > xModuleManager( frame::ModuleManager::create(xCtx) );
Reference<container::XNameAccess> xModuleConfig(
xModuleManager, UNO_QUERY_THROW );
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index 9100312ce566..16bfa7f434d2 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -64,9 +64,10 @@
#include <com/sun/star/awt/XControl.hpp>
#include <com/sun/star/awt/PosSize.hpp>
#include <com/sun/star/frame/XDesktop.hpp>
-#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/frame/ModuleManager.hpp>
#include <com/sun/star/loader/CannotActivateFactoryException.hpp>
#include <com/sun/star/util/XMacroExpander.hpp>
+#include <comphelper/componentcontext.hxx>
#include <comphelper/processfactory.hxx>
#include <editeng/optitems.hxx>
#include <editeng/unolingu.hxx>
@@ -1492,8 +1493,7 @@ rtl::OUString getCurrentFactory_Impl( const Reference< XFrame >& _xFrame )
{
rtl::OUString sIdentifier;
Reference < XFrame > xCurrentFrame( _xFrame );
- Reference < XModuleManager > xModuleManager( ::comphelper::getProcessServiceFactory()->createInstance(
- DEFINE_CONST_UNICODE("com.sun.star.frame.ModuleManager") ), UNO_QUERY );
+ Reference < XModuleManager2 > xModuleManager( ModuleManager::create(::comphelper::getProcessComponentContext()) );
if ( !xCurrentFrame.is() )
{
Reference< XDesktop > xDesktop( ::comphelper::getProcessServiceFactory()->createInstance(
@@ -1502,7 +1502,7 @@ rtl::OUString getCurrentFactory_Impl( const Reference< XFrame >& _xFrame )
xCurrentFrame = xDesktop->getCurrentFrame();
}
- if ( xCurrentFrame.is() && xModuleManager.is() )
+ if ( xCurrentFrame.is() )
{
try
{
@@ -1945,8 +1945,7 @@ rtl::OUString OfaTreeOptionsDialog::GetModuleIdentifier(
{
rtl::OUString sModule;
Reference < XFrame > xCurrentFrame( rFrame );
- Reference < XModuleManager > xModuleManager( xMFac->createInstance(
- C2U("com.sun.star.frame.ModuleManager") ), UNO_QUERY );
+ Reference < XModuleManager2 > xModuleManager( ModuleManager::create(comphelper::ComponentContext(xMFac).getUNOContext()) );
if ( !xCurrentFrame.is() )
{