summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-10-30 14:02:56 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-10-31 15:31:36 +0100
commit0ac9a10d312dc8f12a74720ce211823ce4addf7b (patch)
tree2c812432eca9315170af8b5b6b7ae5bcbf828d5b
parentd27c92961b78da138d3563ab596cca416af9eb38 (diff)
fdo#46808, Deprecate configuration::ConfigurationProvider old-style service
...in favor of existing new-style configuration::theDefaultProvider singleton. Theoretically, ConfigurationProvider instances can be created with specific Locale and EnableAsync arguments, but this is hardly used in practice, and thus effectively all uses of the ConfigurationProvider service use the theDefaultProvider instance, anyway. theDefaultProvider is restricted to the XMultiServiceFactory interface, while ConfigurationProvider also makes available XComponent. However, dispose must not be called manually on theDefaultProvider singleton anyway, and calls to add-/removeEventListener are so few (and in dubious code that should better be cleaned up) that requiring an explicit queryInterface does not really hurt there. This commit originated as a patch by Noel Grandin to "Adapt configuration::ConfigurationProvider UNO service to new style [by creating] a merged XConfigurationProvider interface for this service to implement." It was then modified by Stephan Bergmann by deprecating ConfigurationProvider instead of adding XConfigurationProvider and by replacing calls to ConfigurationProvider::create with calls to theDefaultProvider::get. Change-Id: I9c16700afe0faff1ef6f20338a66bd7a9af990bd
-rw-r--r--framework/inc/jobs/configaccess.hxx7
-rw-r--r--framework/inc/jobs/jobdata.hxx11
-rw-r--r--framework/inc/macros/xserviceinfo.hxx4
-rw-r--r--framework/inc/services.h1
-rw-r--r--framework/inc/services/license.hxx4
-rw-r--r--framework/inc/uiconfiguration/globalsettings.hxx4
-rw-r--r--framework/inc/uiconfiguration/uicategorydescription.hxx2
-rw-r--r--framework/inc/uiconfiguration/windowstateconfiguration.hxx4
-rw-r--r--framework/inc/uielement/uicommanddescription.hxx7
-rw-r--r--framework/inc/uifactory/factoryconfiguration.hxx3
-rw-r--r--framework/inc/uifactory/uielementfactorymanager.hxx7
-rw-r--r--framework/inc/uifactory/windowcontentfactorymanager.hxx3
-rw-r--r--framework/source/accelerators/acceleratorconfiguration.cxx4
-rw-r--r--framework/source/fwi/jobs/configaccess.cxx58
-rw-r--r--framework/source/inc/pattern/configuration.hxx9
-rw-r--r--framework/source/jobs/job.cxx5
-rw-r--r--framework/source/jobs/jobdata.cxx22
-rw-r--r--framework/source/jobs/jobdispatch.cxx8
-rw-r--r--framework/source/jobs/jobexecutor.cxx14
-rw-r--r--framework/source/layoutmanager/layoutmanager.cxx4
-rw-r--r--framework/source/layoutmanager/toolbarlayoutmanager.cxx16
-rw-r--r--framework/source/layoutmanager/toolbarlayoutmanager.hxx4
-rw-r--r--framework/source/services/backingwindow.cxx73
-rw-r--r--framework/source/services/license.cxx12
-rw-r--r--framework/source/uiconfiguration/globalsettings.cxx37
-rw-r--r--framework/source/uiconfiguration/uicategorydescription.cxx20
-rw-r--r--framework/source/uiconfiguration/windowstateconfiguration.cxx20
-rw-r--r--framework/source/uielement/uicommanddescription.cxx30
-rw-r--r--framework/source/uifactory/factoryconfiguration.cxx6
-rw-r--r--framework/source/uifactory/popupmenucontrollerfactory.cxx2
-rw-r--r--framework/source/uifactory/statusbarcontrollerfactory.cxx2
-rw-r--r--framework/source/uifactory/toolbarcontrollerfactory.cxx2
-rw-r--r--framework/source/uifactory/uielementfactorymanager.cxx21
-rw-r--r--framework/source/uifactory/windowcontentfactorymanager.cxx11
-rw-r--r--i18npool/inc/defaultnumberingprovider.hxx4
-rw-r--r--i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx12
-rw-r--r--i18npool/source/registerservices/registerservices.cxx2
-rw-r--r--linguistic/source/gciterator.cxx12
-rw-r--r--offapi/com/sun/star/configuration/ConfigurationProvider.idl2
-rw-r--r--padmin/source/helper.cxx2
-rw-r--r--sd/source/core/CustomAnimationPreset.cxx21
-rw-r--r--sd/source/core/TransitionPreset.cxx7
-rw-r--r--sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx10
-rw-r--r--sd/source/ui/tools/ConfigurationAccess.cxx24
-rw-r--r--sdext/source/minimizer/configurationaccess.cxx49
-rw-r--r--sdext/source/presenter/PresenterConfigurationAccess.cxx11
-rw-r--r--sfx2/source/appl/appdata.cxx2
-rw-r--r--sfx2/source/appl/imestatuswindow.cxx22
-rw-r--r--sfx2/source/appl/imestatuswindow.hxx6
-rw-r--r--sfx2/source/doc/doctemplates.cxx7
-rw-r--r--shell/source/cmdmail/cmdmailsuppl.cxx11
-rw-r--r--svl/source/config/itemholder2.cxx10
-rw-r--r--svtools/source/config/itemholder2.cxx10
-rw-r--r--svtools/source/dialogs/insdlg.cxx123
-rw-r--r--svtools/source/filter/FilterConfigCache.cxx42
-rw-r--r--svtools/source/filter/FilterConfigItem.cxx76
-rw-r--r--svx/source/dialog/srchdlg.cxx6
-rw-r--r--svx/source/smarttags/SmartTagMgr.cxx6
-rw-r--r--ucb/source/core/ucb.cxx9
-rw-r--r--ucb/source/ucp/ftp/ftpcontentprovider.cxx2
-rw-r--r--ucb/source/ucp/hierarchy/hierarchydatasource.cxx20
-rw-r--r--ucb/source/ucp/hierarchy/hierarchydatasource.hxx7
-rw-r--r--ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx16
-rw-r--r--ucb/source/ucp/webdav-neon/DAVResourceAccess.hxx4
-rw-r--r--ucb/source/ucp/webdav-neon/DAVSessionFactory.cxx6
-rw-r--r--ucb/source/ucp/webdav-neon/DAVSessionFactory.hxx10
-rw-r--r--ucb/source/ucp/webdav-neon/NeonSession.cxx6
-rw-r--r--ucb/source/ucp/webdav-neon/NeonSession.hxx4
-rw-r--r--ucb/source/ucp/webdav-neon/webdavcontent.cxx6
-rw-r--r--ucbhelper/inc/ucbhelper/macros.hxx21
-rw-r--r--ucbhelper/inc/ucbhelper/proxydecider.hxx3
-rw-r--r--ucbhelper/source/client/proxydecider.cxx16
-rw-r--r--unotools/inc/unotools/confignode.hxx3
-rw-r--r--unotools/source/config/configmgr.cxx10
-rw-r--r--unotools/source/config/confignode.cxx28
-rw-r--r--unotools/source/config/fontcfg.cxx178
-rw-r--r--unotools/source/config/itemholder1.cxx10
-rw-r--r--unotools/source/config/lingucfg.cxx13
-rw-r--r--uui/source/iahndl.cxx15
-rw-r--r--vcl/source/app/settings.cxx2
-rw-r--r--vcl/source/gdi/print.cxx104
-rw-r--r--vcl/source/window/toolbox2.cxx4
-rw-r--r--vcl/source/window/window.cxx2
-rw-r--r--xmlhelp/source/cxxhelp/provider/databases.cxx5
-rw-r--r--xmlhelp/source/cxxhelp/provider/provider.cxx19
-rw-r--r--xmlhelp/source/treeview/tvread.cxx24
-rw-r--r--xmlhelp/source/treeview/tvread.hxx4
87 files changed, 674 insertions, 791 deletions
diff --git a/framework/inc/jobs/configaccess.hxx b/framework/inc/jobs/configaccess.hxx
index 30ef4f2a47d8..dd9386a19630 100644
--- a/framework/inc/jobs/configaccess.hxx
+++ b/framework/inc/jobs/configaccess.hxx
@@ -25,6 +25,7 @@
#include <general.h>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <rtl/ustring.hxx>
#include <fwidllapi.h>
@@ -65,7 +66,7 @@ class FWI_DLLPUBLIC ConfigAccess : public ThreadHelpBase
reference to the uno service manager
It's neccessary to instanciate own needed services.
*/
- css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
/** hold an opened configuration alive */
css::uno::Reference< css::uno::XInterface > m_xConfig;
@@ -81,8 +82,8 @@ class FWI_DLLPUBLIC ConfigAccess : public ThreadHelpBase
public:
- ConfigAccess( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
- const ::rtl::OUString& sRoot );
+ ConfigAccess( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const ::rtl::OUString& sRoot );
virtual ~ConfigAccess();
virtual void open ( EOpenMode eMode );
diff --git a/framework/inc/jobs/jobdata.hxx b/framework/inc/jobs/jobdata.hxx
index acb107d9d8ac..5ca4691abb12 100644
--- a/framework/inc/jobs/jobdata.hxx
+++ b/framework/inc/jobs/jobdata.hxx
@@ -28,6 +28,7 @@
#include <general.h>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/frame/DispatchResultEvent.hpp>
@@ -152,7 +153,7 @@ class JobData : private ThreadHelpBase
We need it for creating of own uno services ... e.g. for
opening the configuration.
*/
- css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
/**
An instance of this class can be used in two different modes:
@@ -224,7 +225,7 @@ class JobData : private ThreadHelpBase
public:
- JobData( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR );
+ JobData( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
JobData( const JobData& rCopy );
virtual ~JobData( );
@@ -250,10 +251,10 @@ class JobData : private ThreadHelpBase
void setResult ( const JobResult& aResult );
void disableJob ( );
- static css::uno::Sequence< ::rtl::OUString > getEnabledJobsForEvent( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
- const ::rtl::OUString& sEvent );
+ static css::uno::Sequence< ::rtl::OUString > getEnabledJobsForEvent( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const ::rtl::OUString& sEvent );
- static void appendEnabledJobsForEvent( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
+ static void appendEnabledJobsForEvent( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
const ::rtl::OUString& sEvent ,
::comphelper::SequenceAsVector< JobData::TJob2DocEventBinding >& lJobs );
diff --git a/framework/inc/macros/xserviceinfo.hxx b/framework/inc/macros/xserviceinfo.hxx
index bcca5c25f6a0..6197bd3cec98 100644
--- a/framework/inc/macros/xserviceinfo.hxx
+++ b/framework/inc/macros/xserviceinfo.hxx
@@ -225,6 +225,10 @@ ________________________________________________________________________________
PRIVATE_DEFINE_XSERVICEINFO_NEWSTYLE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \
PRIVATE_DEFINE_SINGLEFACTORY( CLASS )
+#define DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \
+ PRIVATE_DEFINE_XSERVICEINFO_NEWSTYLE( CLASS, XINTERFACECAST, SERVICENAME, IMPLEMENTATIONNAME ) \
+ PRIVATE_DEFINE_ONEINSTANCEFACTORY( CLASS )
+
//*****************************************************************************************************************
// public
// implementation of service initialize!
diff --git a/framework/inc/services.h b/framework/inc/services.h
index ccb8bfb0e2b1..e32de32c1ed3 100644
--- a/framework/inc/services.h
+++ b/framework/inc/services.h
@@ -41,7 +41,6 @@ namespace framework{
#define SERVICENAME_GENERICFRAMELOADER DECLARE_ASCII("com.sun.star.comp.office.FilterDetect" )
#define SERVICENAME_TYPEDETECTION DECLARE_ASCII("com.sun.star.document.TypeDetection" )
#define SERVICENAME_CFGREGISTRY DECLARE_ASCII("com.sun.star.configuration.ConfigurationRegistry" ) // describe simple registry service for read access to configuration
-#define SERVICENAME_CFGPROVIDER DECLARE_ASCII("com.sun.star.configuration.ConfigurationProvider" ) // describe cfg-provider service for fatoffice, network installation
#define SERVICENAME_ADMINPROVIDER DECLARE_ASCII("com.sun.star.configuration.AdministrationProvider" ) // describe cfg-provider service for sun webtop
#define SERVICENAME_CFGUPDATEACCESS DECLARE_ASCII("com.sun.star.configuration.ConfigurationUpdateAccess") // provides read/write access to the configuration
#define SERVICENAME_CFGREADACCESS DECLARE_ASCII("com.sun.star.configuration.ConfigurationAccess" ) // provides readonly access to the configuration
diff --git a/framework/inc/services/license.hxx b/framework/inc/services/license.hxx
index b0bb81f11f06..399b07ce6e24 100644
--- a/framework/inc/services/license.hxx
+++ b/framework/inc/services/license.hxx
@@ -69,10 +69,10 @@ namespace framework
public ::cppu::OWeakObject // => XWeak, XInterface
{
private:
- css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
sal_Bool m_bTerminate;
public:
- License( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rSMGR );
+ License( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext );
virtual ~License();
/** declaration of XInterface, XTypeProvider, XServiceInfo */
diff --git a/framework/inc/uiconfiguration/globalsettings.hxx b/framework/inc/uiconfiguration/globalsettings.hxx
index 49f39b1f3ca7..3b253d8100f0 100644
--- a/framework/inc/uiconfiguration/globalsettings.hxx
+++ b/framework/inc/uiconfiguration/globalsettings.hxx
@@ -47,7 +47,7 @@ namespace framework
class GlobalSettings
{
public:
- GlobalSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSrvMgr );
+ GlobalSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
~GlobalSettings();
enum UIElementType
@@ -72,7 +72,7 @@ class GlobalSettings
GlobalSettings(const GlobalSettings&);
GlobalSettings& operator=(const GlobalSettings& );
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xSrvMgr;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
};
} // namespace framework
diff --git a/framework/inc/uiconfiguration/uicategorydescription.hxx b/framework/inc/uiconfiguration/uicategorydescription.hxx
index 028452fb300b..bb3e73660f5b 100644
--- a/framework/inc/uiconfiguration/uicategorydescription.hxx
+++ b/framework/inc/uiconfiguration/uicategorydescription.hxx
@@ -43,7 +43,7 @@ namespace framework
class UICategoryDescription : public UICommandDescription
{
public:
- UICategoryDescription( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
+ UICategoryDescription( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
virtual ~UICategoryDescription();
DECLARE_XSERVICEINFO
diff --git a/framework/inc/uiconfiguration/windowstateconfiguration.hxx b/framework/inc/uiconfiguration/windowstateconfiguration.hxx
index 61cc1c3cf169..d254d8d4005d 100644
--- a/framework/inc/uiconfiguration/windowstateconfiguration.hxx
+++ b/framework/inc/uiconfiguration/windowstateconfiguration.hxx
@@ -75,7 +75,7 @@ class WindowStateConfiguration : private ThreadHelpBase
public ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameAccess, css::lang::XServiceInfo>
{
public:
- WindowStateConfiguration( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
+ WindowStateConfiguration( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
virtual ~WindowStateConfiguration();
// XInterface, XTypeProvider, XServiceInfo
@@ -110,7 +110,7 @@ class WindowStateConfiguration : private ThreadHelpBase
::std::equal_to< ::rtl::OUString > > ModuleToWindowStateConfigHashMap;
private:
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xContext;
ModuleToWindowStateFileMap m_aModuleToFileHashMap;
ModuleToWindowStateConfigHashMap m_aModuleToWindowStateHashMap;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleManager;
diff --git a/framework/inc/uielement/uicommanddescription.hxx b/framework/inc/uielement/uicommanddescription.hxx
index 601b1c3e7531..9f14a97c1875 100644
--- a/framework/inc/uielement/uicommanddescription.hxx
+++ b/framework/inc/uielement/uicommanddescription.hxx
@@ -45,6 +45,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/frame/XModuleManager2.hpp>
@@ -58,7 +59,7 @@ class UICommandDescription : private ThreadHelpBase ,
com::sun::star::container::XNameAccess >
{
public:
- UICommandDescription( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
+ UICommandDescription( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
virtual ~UICommandDescription();
// XInterface, XTypeProvider, XServiceInfo
@@ -92,12 +93,12 @@ public:
::std::equal_to< ::rtl::OUString > > UICommandsHashMap;
protected:
- UICommandDescription( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager,bool );
+ UICommandDescription( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& rxContext, bool );
virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > impl_createConfigAccess(const ::rtl::OUString& _sName);
void impl_fillElements(const sal_Char* _pName);
sal_Bool m_bConfigRead;
rtl::OUString m_aPrivateResourceURL;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
ModuleToCommandFileMap m_aModuleToCommandFileMap;
UICommandsHashMap m_aUICommandsHashMap;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xGenericUICommands;
diff --git a/framework/inc/uifactory/factoryconfiguration.hxx b/framework/inc/uifactory/factoryconfiguration.hxx
index d055fd6ee87e..9a2658c93cde 100644
--- a/framework/inc/uifactory/factoryconfiguration.hxx
+++ b/framework/inc/uifactory/factoryconfiguration.hxx
@@ -60,7 +60,7 @@ class ConfigurationAccess_ControllerFactory : // interfaces
public ::cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener>
{
public:
- ConfigurationAccess_ControllerFactory( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager,const ::rtl::OUString& _sRoot,bool _bAskValue = false );
+ ConfigurationAccess_ControllerFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::rtl::OUString& _sRoot,bool _bAskValue = false );
virtual ~ConfigurationAccess_ControllerFactory();
void readConfigurationData();
@@ -107,7 +107,6 @@ private:
rtl::OUString m_aPropValue;
rtl::OUString m_sRoot;
MenuControllerMap m_aMenuControllerMap;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xConfigProvider;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xConfigAccess;
::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener > m_xConfigAccessListener;
diff --git a/framework/inc/uifactory/uielementfactorymanager.hxx b/framework/inc/uifactory/uielementfactorymanager.hxx
index 16672532b473..1f403e88e8b2 100644
--- a/framework/inc/uifactory/uielementfactorymanager.hxx
+++ b/framework/inc/uifactory/uielementfactorymanager.hxx
@@ -63,7 +63,7 @@ namespace framework
public ::cppu::WeakImplHelper1< ::com::sun::star::container::XContainerListener>
{
public:
- ConfigurationAccess_FactoryManager( ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager,const ::rtl::OUString& _sRoot );
+ ConfigurationAccess_FactoryManager( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& rxContext, const ::rtl::OUString& _sRoot );
virtual ~ConfigurationAccess_FactoryManager();
void readConfigurationData();
@@ -101,7 +101,6 @@ namespace framework
rtl::OUString m_aPropFactory;
::rtl::OUString m_sRoot;
FactoryManagerMap m_aFactoryManagerMap;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xConfigProvider;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xConfigAccess;
::com::sun::star::uno::Reference< ::com::sun::star::container::XContainerListener > m_xConfigListener;
@@ -115,7 +114,7 @@ class UIElementFactoryManager : private ThreadHelpBase
::com::sun::star::ui::XUIElementFactoryRegistration>
{
public:
- UIElementFactoryManager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
+ UIElementFactoryManager( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
virtual ~UIElementFactoryManager();
// XInterface, XTypeProvider, XServiceInfo
@@ -133,7 +132,7 @@ class UIElementFactoryManager : private ThreadHelpBase
private:
sal_Bool m_bConfigRead;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleManager;
ConfigurationAccess_FactoryManager* m_pConfigAccess;
};
diff --git a/framework/inc/uifactory/windowcontentfactorymanager.hxx b/framework/inc/uifactory/windowcontentfactorymanager.hxx
index 5facbbd73608..c189218a32a3 100644
--- a/framework/inc/uifactory/windowcontentfactorymanager.hxx
+++ b/framework/inc/uifactory/windowcontentfactorymanager.hxx
@@ -49,7 +49,7 @@ class WindowContentFactoryManager : private ThreadHelpBase
com::sun::star::lang::XSingleComponentFactory>
{
public:
- WindowContentFactoryManager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
+ WindowContentFactoryManager( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext>& rxContext );
virtual ~WindowContentFactoryManager();
// XInterface, XTypeProvider, XServiceInfo
@@ -63,7 +63,6 @@ class WindowContentFactoryManager : private ThreadHelpBase
private:
sal_Bool m_bConfigRead;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModuleManager2 > m_xModuleManager;
ConfigurationAccess_FactoryManager* m_pConfigAccess;
};
diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx
index eef8c1dd94cc..7ed41e9fd57e 100644
--- a/framework/source/accelerators/acceleratorconfiguration.cxx
+++ b/framework/source/accelerators/acceleratorconfiguration.cxx
@@ -624,7 +624,7 @@ AcceleratorCache& XMLBasedAcceleratorConfiguration::impl_getCFG(sal_Bool bWriteA
aReadLock.unlock();
// <- SAFE ----------------------------------
- css::uno::Reference< css::uno::XInterface > xCFG = fpc::ConfigurationHelper::openConfig(xSMGR,
+ css::uno::Reference< css::uno::XInterface > xCFG = fpc::ConfigurationHelper::openConfig( comphelper::getComponentContext(xSMGR),
"/org.openoffice.Setup", "L10N", fpc::ConfigurationHelper::E_READONLY);
css::uno::Reference< css::beans::XPropertySet > xProp (xCFG, css::uno::UNO_QUERY_THROW);
::rtl::OUString sISOLocale;
@@ -1663,7 +1663,7 @@ AcceleratorCache& XCUBasedAcceleratorConfiguration::impl_getCFG(sal_Bool bPrefer
aReadLock.unlock();
// <- SAFE ----------------------------------
- css::uno::Reference< css::uno::XInterface > xCFG = fpc::ConfigurationHelper::openConfig(xSMGR,
+ css::uno::Reference< css::uno::XInterface > xCFG = fpc::ConfigurationHelper::openConfig( comphelper::getComponentContext(xSMGR),
"/org.openoffice.Setup", "L10N", fpc::ConfigurationHelper::E_READONLY);
css::uno::Reference< css::beans::XPropertySet > xProp (xCFG, css::uno::UNO_QUERY_THROW);
::rtl::OUString sISOLocale;
diff --git a/framework/source/fwi/jobs/configaccess.cxx b/framework/source/fwi/jobs/configaccess.cxx
index 1e23ed32e243..14d6e762b64c 100644
--- a/framework/source/fwi/jobs/configaccess.cxx
+++ b/framework/source/fwi/jobs/configaccess.cxx
@@ -35,6 +35,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XMultiHierarchicalPropertySet.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/util/XChangesBatch.hpp>
@@ -55,10 +56,10 @@ namespace framework{
@param eMode
force opening of the configuration access in readonly or in read/write mode
*/
-ConfigAccess::ConfigAccess( /*IN*/ const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
- /*IN*/ const ::rtl::OUString& sRoot )
+ConfigAccess::ConfigAccess( /*IN*/ const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ /*IN*/ const ::rtl::OUString& sRoot )
: ThreadHelpBase( )
- , m_xSMGR ( xSMGR )
+ , m_xContext ( rxContext)
, m_sRoot ( sRoot )
, m_eMode ( E_CLOSED )
{
@@ -129,35 +130,32 @@ void ConfigAccess::open( /*IN*/ EOpenMode eMode )
close();
// create the configuration provider, which provides sub access points
- css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider(m_xSMGR->createInstance(SERVICENAME_CFGPROVIDER), css::uno::UNO_QUERY);
- if (xConfigProvider.is())
+ css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider = css::configuration::theDefaultProvider::get(m_xContext);
+ css::beans::PropertyValue aParam;
+ aParam.Name = DECLARE_ASCII("nodepath");
+ aParam.Value <<= m_sRoot;
+
+ css::uno::Sequence< css::uno::Any > lParams(1);
+ lParams[0] <<= aParam;
+
+ // open it
+ try
{
- css::beans::PropertyValue aParam;
- aParam.Name = DECLARE_ASCII("nodepath");
- aParam.Value <<= m_sRoot;
-
- css::uno::Sequence< css::uno::Any > lParams(1);
- lParams[0] <<= aParam;
-
- // open it
- try
- {
- if (eMode==E_READONLY)
- m_xConfig = xConfigProvider->createInstanceWithArguments(SERVICENAME_CFGREADACCESS , lParams);
- else
- if (eMode==E_READWRITE)
- m_xConfig = xConfigProvider->createInstanceWithArguments(SERVICENAME_CFGUPDATEACCESS, lParams);
- }
- catch(const css::uno::Exception& ex)
- {
- (void) ex; // avoid warning
- LOG_WARNING("open config ...", U2B(ex.Message))
- }
-
- m_eMode = E_CLOSED;
- if (m_xConfig.is())
- m_eMode = eMode;
+ if (eMode==E_READONLY)
+ m_xConfig = xConfigProvider->createInstanceWithArguments(SERVICENAME_CFGREADACCESS , lParams);
+ else
+ if (eMode==E_READWRITE)
+ m_xConfig = xConfigProvider->createInstanceWithArguments(SERVICENAME_CFGUPDATEACCESS, lParams);
}
+ catch(const css::uno::Exception& ex)
+ {
+ (void) ex; // avoid warning
+ LOG_WARNING("open config ...", U2B(ex.Message))
+ }
+
+ m_eMode = E_CLOSED;
+ if (m_xConfig.is())
+ m_eMode = eMode;
}
aWriteLock.unlock();
diff --git a/framework/source/inc/pattern/configuration.hxx b/framework/source/inc/pattern/configuration.hxx
index f39d5922328b..3b346a3693f3 100644
--- a/framework/source/inc/pattern/configuration.hxx
+++ b/framework/source/inc/pattern/configuration.hxx
@@ -36,6 +36,7 @@
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -80,7 +81,7 @@ class ConfigurationHelper
@descr TODO
- @param xSMGR
+ @param rxContext
this method need an uno service manager for internal work.
@param sPackage
@@ -100,7 +101,7 @@ class ConfigurationHelper
force opening of the configuration access in special mode.
see enum EOpenMode for further informations.
*/
- static css::uno::Reference< css::uno::XInterface > openConfig(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
+ static css::uno::Reference< css::uno::XInterface > openConfig(const css::uno::Reference< css::uno::XComponentContext >& rxContext,
const ::rtl::OUString& sPackage ,
const ::rtl::OUString& sRelPath ,
sal_Int32 nOpenFlags)
@@ -109,8 +110,8 @@ class ConfigurationHelper
try
{
- css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider(
- xSMGR->createInstance(SERVICENAME_CFGPROVIDER), css::uno::UNO_QUERY_THROW);
+ css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider =
+ css::configuration::theDefaultProvider::get( rxContext );
::rtl::OUStringBuffer sPath(1024);
sPath.append(sPackage );
diff --git a/framework/source/jobs/job.cxx b/framework/source/jobs/job.cxx
index cc881a4d424d..4c6bfee6f01f 100644
--- a/framework/source/jobs/job.cxx
+++ b/framework/source/jobs/job.cxx
@@ -38,6 +38,7 @@
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
+#include <comphelper/processfactory.hxx>
#include <rtl/ustrbuf.hxx>
#include <vcl/svapp.hxx>
@@ -76,7 +77,7 @@ Job::Job( /*IN*/ const css::uno::Reference< css::lang::XMultiServiceFactory >& x
/*IN*/ const css::uno::Reference< css::frame::XFrame >& xFrame )
: ThreadHelpBase (&Application::GetSolarMutex())
, ::cppu::OWeakObject ( )
- , m_aJobCfg (xSMGR )
+ , m_aJobCfg (comphelper::getComponentContext(xSMGR))
, m_xSMGR (xSMGR )
, m_xFrame (xFrame )
, m_bListenOnDesktop (sal_False )
@@ -106,7 +107,7 @@ Job::Job( /*IN*/ const css::uno::Reference< css::lang::XMultiServiceFactory >& x
/*IN*/ const css::uno::Reference< css::frame::XModel >& xModel )
: ThreadHelpBase (&Application::GetSolarMutex())
, ::cppu::OWeakObject ( )
- , m_aJobCfg (xSMGR )
+ , m_aJobCfg (comphelper::getComponentContext(xSMGR))
, m_xSMGR (xSMGR )
, m_xModel (xModel )
, m_bListenOnDesktop (sal_False )
diff --git a/framework/source/jobs/jobdata.cxx b/framework/source/jobs/jobdata.cxx
index 6195d0c18b31..fe1b1bd4e895 100644
--- a/framework/source/jobs/jobdata.cxx
+++ b/framework/source/jobs/jobdata.cxx
@@ -79,12 +79,12 @@ const sal_Char* JobData::PROP_CONTEXT = "Context"
But for real working it's neccessary to call setAlias() or setService() later.
Because we need the job data ...
- @param xSMGR
+ @param rxContext
reference to the uno service manager
*/
-JobData::JobData( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR )
+JobData::JobData( const css::uno::Reference< css::uno::XComponentContext >& rxContext )
: ThreadHelpBase(&Application::GetSolarMutex())
- , m_xSMGR (xSMGR )
+ , m_xContext (rxContext )
{
// share code for member initialization with defaults!
impl_reset();
@@ -170,7 +170,7 @@ void JobData::setAlias( const ::rtl::OUString& sAlias )
::rtl::OUString sKey(::rtl::OUString::createFromAscii(JOBCFG_ROOT));
sKey += ::utl::wrapConfigurationElementName(m_sAlias);
- ConfigAccess aConfig(m_xSMGR, sKey);
+ ConfigAccess aConfig(m_xContext, sKey);
aConfig.open(ConfigAccess::E_READONLY);
if (aConfig.getMode()==ConfigAccess::E_CLOSED)
{
@@ -304,7 +304,7 @@ void JobData::setJobConfig( const css::uno::Sequence< css::beans::NamedValue >&
::rtl::OUString sKey(::rtl::OUString::createFromAscii(JOBCFG_ROOT));
sKey += ::utl::wrapConfigurationElementName(m_sAlias);
- ConfigAccess aConfig(m_xSMGR, sKey);
+ ConfigAccess aConfig(m_xContext, sKey);
aConfig.open(ConfigAccess::E_READWRITE);
if (aConfig.getMode()==ConfigAccess::E_CLOSED)
return;
@@ -537,7 +537,7 @@ void JobData::disableJob()
sKey.appendAscii("/" );
sKey.append (::utl::wrapConfigurationElementName(m_sAlias));
- ConfigAccess aConfig(m_xSMGR, sKey.makeStringAndClear());
+ ConfigAccess aConfig(m_xContext, sKey.makeStringAndClear());
aConfig.open(ConfigAccess::E_READWRITE);
if (aConfig.getMode()==ConfigAccess::E_CLOSED)
return;
@@ -585,11 +585,11 @@ sal_Bool isEnabled( const ::rtl::OUString& sAdminTime ,
//________________________________
/**
*/
-void JobData::appendEnabledJobsForEvent( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
+void JobData::appendEnabledJobsForEvent( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
const ::rtl::OUString& sEvent ,
::comphelper::SequenceAsVector< JobData::TJob2DocEventBinding >& lJobs )
{
- css::uno::Sequence< ::rtl::OUString > lAdditionalJobs = JobData::getEnabledJobsForEvent(xSMGR, sEvent);
+ css::uno::Sequence< ::rtl::OUString > lAdditionalJobs = JobData::getEnabledJobsForEvent(rxContext, sEvent);
sal_Int32 c = lAdditionalJobs.getLength();
sal_Int32 i = 0;
@@ -627,8 +627,8 @@ sal_Bool JobData::hasCorrectContext(const ::rtl::OUString& rModuleIdent) const
//________________________________
/**
*/
-css::uno::Sequence< ::rtl::OUString > JobData::getEnabledJobsForEvent( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
- const ::rtl::OUString& sEvent )
+css::uno::Sequence< ::rtl::OUString > JobData::getEnabledJobsForEvent( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
+ const ::rtl::OUString& sEvent )
{
// these static values may perform following loop for reading time stamp values ...
static ::rtl::OUString ADMINTIME = ::rtl::OUString::createFromAscii(JobData::EVENTCFG_PROP_ADMINTIME);
@@ -637,7 +637,7 @@ css::uno::Sequence< ::rtl::OUString > JobData::getEnabledJobsForEvent( const css
static ::rtl::OUString JOBLIST = ::rtl::OUString::createFromAscii(JobData::EVENTCFG_PATH_JOBLIST );
// create a config access to "/org.openoffice.Office.Jobs/Events"
- ConfigAccess aConfig(xSMGR,ROOT);
+ ConfigAccess aConfig(rxContext,ROOT);
aConfig.open(ConfigAccess::E_READONLY);
if (aConfig.getMode()==ConfigAccess::E_CLOSED)
return css::uno::Sequence< ::rtl::OUString >();
diff --git a/framework/source/jobs/jobdispatch.cxx b/framework/source/jobs/jobdispatch.cxx
index 8672062f1cd7..03aeca373d91 100644
--- a/framework/source/jobs/jobdispatch.cxx
+++ b/framework/source/jobs/jobdispatch.cxx
@@ -271,7 +271,7 @@ void JobDispatch::impl_dispatchEvent( /*IN*/ const ::rtl::OUString&
// filter disabled jobs using it's time stamp values.
/* SAFE { */
ReadGuard aReadLock(m_aLock);
- css::uno::Sequence< ::rtl::OUString > lJobs = JobData::getEnabledJobsForEvent(m_xSMGR, sEvent);
+ css::uno::Sequence< ::rtl::OUString > lJobs = JobData::getEnabledJobsForEvent(comphelper::getComponentContext(m_xSMGR), sEvent);
aReadLock.unlock();
/* } SAFE */
@@ -288,7 +288,7 @@ void JobDispatch::impl_dispatchEvent( /*IN*/ const ::rtl::OUString&
/* SAFE { */
aReadLock.lock();
- JobData aCfg(m_xSMGR);
+ JobData aCfg(comphelper::getComponentContext(m_xSMGR));
aCfg.setEvent(sEvent, lJobs[j]);
aCfg.setEnvironment(JobData::E_DISPATCH);
const bool bIsEnabled=aCfg.hasCorrectContext(m_sModuleIdentifier);
@@ -352,7 +352,7 @@ void JobDispatch::impl_dispatchService( /*IN*/ const ::rtl::OUString&
/* SAFE { */
ReadGuard aReadLock(m_aLock);
- JobData aCfg(m_xSMGR);
+ JobData aCfg(comphelper::getComponentContext(m_xSMGR));
aCfg.setService(sService);
aCfg.setEnvironment(JobData::E_DISPATCH);
@@ -403,7 +403,7 @@ void JobDispatch::impl_dispatchAlias( /*IN*/ const ::rtl::OUString&
/* SAFE { */
ReadGuard aReadLock(m_aLock);
- JobData aCfg(m_xSMGR);
+ JobData aCfg(comphelper::getComponentContext(m_xSMGR));
aCfg.setAlias(sAlias);
aCfg.setEnvironment(JobData::E_DISPATCH);
diff --git a/framework/source/jobs/jobexecutor.cxx b/framework/source/jobs/jobexecutor.cxx
index 5df32396eded..e3e6c58c800b 100644
--- a/framework/source/jobs/jobexecutor.cxx
+++ b/framework/source/jobs/jobexecutor.cxx
@@ -126,7 +126,7 @@ JobExecutor::JobExecutor( /*IN*/ const css::uno::Reference< css::lang::XMultiSer
, ::cppu::OWeakObject ( )
, m_xSMGR (xSMGR )
, m_xModuleManager ( )
- , m_aConfig (xSMGR, ::rtl::OUString::createFromAscii(JobData::EVENTCFG_ROOT) )
+ , m_aConfig (comphelper::getComponentContext(xSMGR), ::rtl::OUString::createFromAscii(JobData::EVENTCFG_ROOT) )
{
// Don't do any reference related code here! Do it inside special
// impl_ method() ... see DEFINE_INIT_SERVICE() macro for further informations.
@@ -166,7 +166,7 @@ void SAL_CALL JobExecutor::trigger( const ::rtl::OUString& sEvent ) throw(css::u
// get list of all enabled jobs
// The called static helper methods read it from the configuration and
// filter disabled jobs using it's time stamp values.
- css::uno::Sequence< ::rtl::OUString > lJobs = JobData::getEnabledJobsForEvent(m_xSMGR, sEvent);
+ css::uno::Sequence< ::rtl::OUString > lJobs = JobData::getEnabledJobsForEvent(comphelper::getComponentContext(m_xSMGR), sEvent);
aReadLock.unlock();
/* } SAFE */
@@ -178,7 +178,7 @@ void SAL_CALL JobExecutor::trigger( const ::rtl::OUString& sEvent ) throw(css::u
/* SAFE { */
aReadLock.lock();
- JobData aCfg(m_xSMGR);
+ JobData aCfg(comphelper::getComponentContext(m_xSMGR));
aCfg.setEvent(sEvent, lJobs[j]);
aCfg.setEnvironment(JobData::E_EXECUTION);
@@ -235,7 +235,7 @@ void SAL_CALL JobExecutor::notifyEvent( const css::document::EventObject& aEvent
)
{
if (m_lEvents.find(EVENT_ON_DOCUMENT_OPENED) != m_lEvents.end())
- JobData::appendEnabledJobsForEvent(m_xSMGR, EVENT_ON_DOCUMENT_OPENED, lJobs);
+ JobData::appendEnabledJobsForEvent(comphelper::getComponentContext(m_xSMGR), EVENT_ON_DOCUMENT_OPENED, lJobs);
}
// Special feature: If the events "OnCreate" or "OnLoadFinished" occures - we generate our own event "onDocumentAdded".
@@ -245,12 +245,12 @@ void SAL_CALL JobExecutor::notifyEvent( const css::document::EventObject& aEvent
)
{
if (m_lEvents.find(EVENT_ON_DOCUMENT_ADDED) != m_lEvents.end())
- JobData::appendEnabledJobsForEvent(m_xSMGR, EVENT_ON_DOCUMENT_ADDED, lJobs);
+ JobData::appendEnabledJobsForEvent(comphelper::getComponentContext(m_xSMGR), EVENT_ON_DOCUMENT_ADDED, lJobs);
}
// Add all jobs for "real" notified event too .-)
if (m_lEvents.find(aEvent.EventName) != m_lEvents.end())
- JobData::appendEnabledJobsForEvent(m_xSMGR, aEvent.EventName, lJobs);
+ JobData::appendEnabledJobsForEvent(comphelper::getComponentContext(m_xSMGR), aEvent.EventName, lJobs);
aReadLock.unlock();
/* } SAFE */
@@ -266,7 +266,7 @@ void SAL_CALL JobExecutor::notifyEvent( const css::document::EventObject& aEvent
const JobData::TJob2DocEventBinding& rBinding = *pIt;
- JobData aCfg(m_xSMGR);
+ JobData aCfg(comphelper::getComponentContext(m_xSMGR));
aCfg.setEvent(rBinding.m_sDocEvent, rBinding.m_sJobName);
aCfg.setEnvironment(JobData::E_DOCUMENTEVENT);
diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx
index 37e08e6f5e79..b29960cca32d 100644
--- a/framework/source/layoutmanager/layoutmanager.cxx
+++ b/framework/source/layoutmanager/layoutmanager.cxx
@@ -164,7 +164,7 @@ LayoutManager::LayoutManager( const Reference< XMultiServiceFactory >& xServiceM
m_aStatusBarElement.m_aType = rtl::OUString( "statusbar" );
m_aStatusBarElement.m_aName = m_aStatusBarAlias;
- m_pToolbarManager = new ToolbarLayoutManager( xServiceManager, m_xUIElementFactoryManager, this );
+ m_pToolbarManager = new ToolbarLayoutManager( comphelper::getComponentContext(xServiceManager), m_xUIElementFactoryManager, this );
m_xToolbarManager = uno::Reference< ui::XUIConfigurationListener >( static_cast< OWeakObject* >( m_pToolbarManager ), uno::UNO_QUERY );
Application::AddEventListener( LINK( this, LayoutManager, SettingsChanged ) );
@@ -517,7 +517,7 @@ sal_Bool LayoutManager::implts_readWindowStateData( const rtl::OUString& aName,
GlobalSettings* pGlobalSettings( 0 );
if ( m_pGlobalSettings == 0 )
{
- m_pGlobalSettings = new GlobalSettings( m_xSMGR );
+ m_pGlobalSettings = new GlobalSettings( comphelper::getComponentContext(m_xSMGR) );
bGetSettingsState = sal_True;
}
pGlobalSettings = m_pGlobalSettings;
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index 0a67895c9b42..2bb41fe93235 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -56,11 +56,11 @@ namespace framework
{
ToolbarLayoutManager::ToolbarLayoutManager(
- const uno::Reference< lang::XMultiServiceFactory >& xSMGR,
+ const uno::Reference< uno::XComponentContext >& rxContext,
const uno::Reference< ui::XUIElementFactory >& xUIElementFactory,
ILayoutNotifications* pParentLayouter )
: ThreadHelpBase( &Application::GetSolarMutex() ),
- m_xSMGR( xSMGR ),
+ m_xContext( rxContext),
m_xUIElementFactoryManager( xUIElementFactory ),
m_pParentLayouter( pParentLayouter ),
m_eDockOperation( DOCKOP_ON_COLROW ),
@@ -83,7 +83,7 @@ ToolbarLayoutManager::ToolbarLayoutManager(
setZeroRectangle( m_aDockingArea );
// create toolkit object
- m_xToolkit = awt::Toolkit::create( comphelper::getComponentContext(m_xSMGR) );
+ m_xToolkit = awt::Toolkit::create( m_xContext );
}
ToolbarLayoutManager::~ToolbarLayoutManager()
@@ -913,10 +913,10 @@ void ToolbarLayoutManager::setParentWindow(
{
static const char DOCKINGAREASTRING[] = "dockingarea";
- uno::Reference< awt::XWindow > xTopDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( comphelper::getComponentContext(m_xSMGR), xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
- uno::Reference< awt::XWindow > xLeftDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( comphelper::getComponentContext(m_xSMGR), xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
- uno::Reference< awt::XWindow > xRightDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( comphelper::getComponentContext(m_xSMGR), xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
- uno::Reference< awt::XWindow > xBottomDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( comphelper::getComponentContext(m_xSMGR), xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
+ uno::Reference< awt::XWindow > xTopDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xContext, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
+ uno::Reference< awt::XWindow > xLeftDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xContext, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
+ uno::Reference< awt::XWindow > xRightDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xContext, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
+ uno::Reference< awt::XWindow > xBottomDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xContext, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY );
WriteGuard aWriteLock( m_aLock );
m_xContainerWindow = uno::Reference< awt::XWindow2 >( xParentWindow, uno::UNO_QUERY );
@@ -1582,7 +1582,7 @@ sal_Bool ToolbarLayoutManager::implts_readWindowStateData( const rtl::OUString&
GlobalSettings* pGlobalSettings( 0 );
if ( m_pGlobalSettings.get() == 0 )
{
- m_pGlobalSettings.reset( new GlobalSettings( m_xSMGR ) );
+ m_pGlobalSettings.reset( new GlobalSettings( m_xContext ) );
bGetSettingsState = true;
}
pGlobalSettings = m_pGlobalSettings.get();
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.hxx b/framework/source/layoutmanager/toolbarlayoutmanager.hxx
index 2d4389428ea2..1237c147de4b 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.hxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.hxx
@@ -90,7 +90,7 @@ class ToolbarLayoutManager : public ::cppu::WeakImplHelper3< ::com::sun::star::a
PREVIEWFRAME_YES
};
- ToolbarLayoutManager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSMGR,
+ ToolbarLayoutManager( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElementFactory >& xUIElementFactory,
ILayoutNotifications* pParentLayouter );
virtual ~ToolbarLayoutManager();
@@ -299,7 +299,7 @@ class ToolbarLayoutManager : public ::cppu::WeakImplHelper3< ::com::sun::star::a
//---------------------------------------------------------------------------------------------------------
// members
//---------------------------------------------------------------------------------------------------------
- css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
css::uno::Reference< css::frame::XFrame > m_xFrame;
css::uno::Reference< css::awt::XWindow2 > m_xContainerWindow;
css::uno::Reference< css::awt::XWindow > m_xDockAreaWindows[DOCKINGAREAS_COUNT];
diff --git a/framework/source/services/backingwindow.cxx b/framework/source/services/backingwindow.cxx
index 34c2585e22f9..765c46575c3b 100644
--- a/framework/source/services/backingwindow.cxx
+++ b/framework/source/services/backingwindow.cxx
@@ -62,6 +62,7 @@
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
#include "com/sun/star/container/XNameAccess.hpp"
+#include "com/sun/star/configuration/theDefaultProvider.hpp"
#include "com/sun/star/system/SystemShellExecute.hpp"
#include "com/sun/star/system/SystemShellExecuteFlags.hpp"
#include "com/sun/star/task/XJobExecutor.hpp"
@@ -163,23 +164,20 @@ BackingWindow::BackingWindow( Window* i_pParent ) :
try
{
- Reference<lang::XMultiServiceFactory> xConfig( comphelper::getProcessServiceFactory()->createInstance(SERVICENAME_CFGPROVIDER),UNO_QUERY);
- if( xConfig.is() )
+ Reference<lang::XMultiServiceFactory> xConfig = configuration::theDefaultProvider::get( comphelper::getProcessComponentContext() );
+ Sequence<Any> args(1);
+ PropertyValue val(
+ rtl::OUString( "nodepath" ),
+ 0,
+ Any(rtl::OUString( "/org.openoffice.Office.Common/Help/StartCenter")),
+ PropertyState_DIRECT_VALUE);
+ args.getArray()[0] <<= val;
+ Reference<container::XNameAccess> xNameAccess(xConfig->createInstanceWithArguments(SERVICENAME_CFGREADACCESS,args), UNO_QUERY);
+ if( xNameAccess.is() )
{
- Sequence<Any> args(1);
- PropertyValue val(
- rtl::OUString( "nodepath" ),
- 0,
- Any(rtl::OUString( "/org.openoffice.Office.Common/Help/StartCenter")),
- PropertyState_DIRECT_VALUE);
- args.getArray()[0] <<= val;
- Reference<container::XNameAccess> xNameAccess(xConfig->createInstanceWithArguments(SERVICENAME_CFGREADACCESS,args), UNO_QUERY);
- if( xNameAccess.is() )
- {
- //throws css::container::NoSuchElementException, css::lang::WrappedTargetException
- Any value( xNameAccess->getByName(rtl::OUString("StartCenterHideExternalLinks")) );
- mnHideExternalLinks = value.get<sal_Int32>();
- }
+ //throws css::container::NoSuchElementException, css::lang::WrappedTargetException
+ Any value( xNameAccess->getByName(rtl::OUString("StartCenterHideExternalLinks")) );
+ mnHideExternalLinks = value.get<sal_Int32>();
}
}
catch (const Exception&)
@@ -886,30 +884,27 @@ IMPL_LINK_NOARG(BackingWindow, ToolboxHdl)
{
try
{
- Reference<lang::XMultiServiceFactory> xConfig( comphelper::getProcessServiceFactory()->createInstance(SERVICENAME_CFGPROVIDER),UNO_QUERY);
- if( xConfig.is() )
+ Reference<lang::XMultiServiceFactory> xConfig = configuration::theDefaultProvider::get( comphelper::getProcessComponentContext() );
+ Sequence<Any> args(1);
+ PropertyValue val(
+ rtl::OUString( "nodepath" ),
+ 0,
+ Any(rtl::OUString::createFromAscii(pNodePath)),
+ PropertyState_DIRECT_VALUE);
+ args.getArray()[0] <<= val;
+ Reference<container::XNameAccess> xNameAccess(xConfig->createInstanceWithArguments(SERVICENAME_CFGREADACCESS,args), UNO_QUERY);
+ if( xNameAccess.is() )
{
- Sequence<Any> args(1);
- PropertyValue val(
- rtl::OUString( "nodepath" ),
- 0,
- Any(rtl::OUString::createFromAscii(pNodePath)),
- PropertyState_DIRECT_VALUE);
- args.getArray()[0] <<= val;
- Reference<container::XNameAccess> xNameAccess(xConfig->createInstanceWithArguments(SERVICENAME_CFGREADACCESS,args), UNO_QUERY);
- if( xNameAccess.is() )
- {
- rtl::OUString sURL;
- //throws css::container::NoSuchElementException, css::lang::WrappedTargetException
- Any value( xNameAccess->getByName(rtl::OUString::createFromAscii(pNode)) );
- sURL = value.get<rtl::OUString> ();
- localizeWebserviceURI(sURL);
-
- Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute(
- com::sun::star::system::SystemShellExecute::create(comphelper::getProcessComponentContext()));
- //throws css::lang::IllegalArgumentException, css::system::SystemShellExecuteException
- xSystemShellExecute->execute( sURL, rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY);
- }
+ rtl::OUString sURL;
+ //throws css::container::NoSuchElementException, css::lang::WrappedTargetException
+ Any value( xNameAccess->getByName(rtl::OUString::createFromAscii(pNode)) );
+ sURL = value.get<rtl::OUString> ();
+ localizeWebserviceURI(sURL);
+
+ Reference< com::sun::star::system::XSystemShellExecute > xSystemShellExecute(
+ com::sun::star::system::SystemShellExecute::create(comphelper::getProcessComponentContext()));
+ //throws css::lang::IllegalArgumentException, css::system::SystemShellExecuteException
+ xSystemShellExecute->execute( sURL, rtl::OUString(), com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY);
}
}
catch (const Exception&)
diff --git a/framework/source/services/license.cxx b/framework/source/services/license.cxx
index 6dff1bf129e3..a7f435fffb63 100644
--- a/framework/source/services/license.cxx
+++ b/framework/source/services/license.cxx
@@ -38,6 +38,7 @@
#include <com/sun/star/frame/XDesktop.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/util/XChangesBatch.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
@@ -64,6 +65,7 @@ using namespace ::osl ;
using namespace ::cppu ;
using namespace ::com::sun::star::uno ;
using namespace ::com::sun::star::beans ;
+using namespace ::com::sun::star::configuration ;
using namespace ::com::sun::star::lang ;
using namespace ::com::sun::star::util ;
using namespace ::com::sun::star::frame ;
@@ -81,7 +83,7 @@ static const char *szWNTLicenseExt = ".txt";
//*****************************************************************************************************************
// constructor
//*****************************************************************************************************************
-License::License( const Reference< XMultiServiceFactory >& xFactory )
+License::License( const Reference< XComponentContext >& rxContext )
// Init baseclasses first
// Attention:
// Don't change order of initialization!
@@ -91,7 +93,7 @@ License::License( const Reference< XMultiServiceFactory >& xFactory )
: ThreadHelpBase ( &Application::GetSolarMutex() )
, OWeakObject ( )
// Init member
- , m_xFactory ( xFactory )
+ , m_xContext ( rxContext )
, m_bTerminate ( sal_False )
{
}
@@ -122,7 +124,7 @@ DEFINE_XTYPEPROVIDER_4 ( License ,
XCloseable
)
-DEFINE_XSERVICEINFO_MULTISERVICE ( License,
+DEFINE_XSERVICEINFO_MULTISERVICE_2 ( License,
OWeakObject ,
SERVICENAME_LICENSE ,
IMPLEMENTATIONNAME_LICENSE
@@ -262,12 +264,10 @@ css::uno::Any SAL_CALL License::execute(const css::uno::Sequence< css::beans::Na
#endif
// check if we need to show the license at all
// open org.openoffice.Setup/Office/ooLicenseAcceptDate
- ::rtl::OUString sConfigSrvc = SERVICENAME_CFGPROVIDER;
::rtl::OUString sAccessSrvc("com.sun.star.configuration.ConfigurationUpdateAccess");
// get configuration provider
- Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >(
- m_xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW);
+ Reference< XMultiServiceFactory > theConfigProvider = theDefaultProvider::get( m_xContext );
Sequence< Any > theArgs(1);
NamedValue v;
v.Name = ::rtl::OUString("NodePath");
diff --git a/framework/source/uiconfiguration/globalsettings.cxx b/framework/source/uiconfiguration/globalsettings.cxx
index de8304da6534..4567c5ceddd9 100644
--- a/framework/source/uiconfiguration/globalsettings.cxx
+++ b/framework/source/uiconfiguration/globalsettings.cxx
@@ -32,6 +32,7 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XContainer.hpp>
@@ -74,7 +75,7 @@ class GlobalSettings_Access : public ::com::sun::star::lang::XComponent ,
public ::cppu::OWeakObject
{
public:
- GlobalSettings_Access( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
+ GlobalSettings_Access( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
virtual ~GlobalSettings_Access();
// XInterface, XTypeProvider, XServiceInfo
@@ -103,7 +104,7 @@ class GlobalSettings_Access : public ::com::sun::star::lang::XComponent ,
rtl::OUString m_aPropLocked;
rtl::OUString m_aPropDocked;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > m_xConfigAccess;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xContext;
};
@@ -116,7 +117,7 @@ DEFINE_XINTERFACE_2 ( GlobalSettings_Access ,
DIRECT_INTERFACE ( css::lang::XEventListener )
)
-GlobalSettings_Access::GlobalSettings_Access( const css::uno::Reference< css::lang::XMultiServiceFactory >& rServiceManager ) :
+GlobalSettings_Access::GlobalSettings_Access( const css::uno::Reference< css::uno::XComponentContext >& rxContext ) :
ThreadHelpBase(),
m_bDisposed( sal_False ),
m_bConfigRead( sal_False ),
@@ -125,7 +126,7 @@ GlobalSettings_Access::GlobalSettings_Access( const css::uno::Reference< css::la
m_aPropStatesEnabled( RTL_CONSTASCII_USTRINGPARAM( GLOBALSETTINGS_PROPERTY_STATESENABLED )),
m_aPropLocked( RTL_CONSTASCII_USTRINGPARAM( GLOBALSETTINGS_PROPERTY_LOCKED )),
m_aPropDocked( RTL_CONSTASCII_USTRINGPARAM( GLOBALSETTINGS_PROPERTY_DOCKED )),
- m_xServiceManager( rServiceManager )
+ m_xContext( rxContext )
{
}
@@ -255,14 +256,11 @@ sal_Bool GlobalSettings_Access::impl_initConfigAccess()
try
{
- css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider;
- if ( m_xServiceManager.is() )
- xConfigProvider = css::uno::Reference< css::lang::XMultiServiceFactory >(
- m_xServiceManager->createInstance( SERVICENAME_CFGPROVIDER ),
- css::uno::UNO_QUERY );
-
- if ( xConfigProvider.is() )
+ if ( m_xContext.is() )
{
+ css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider =
+ css::configuration::theDefaultProvider::get( m_xContext );
+
aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ));
aPropValue.Value = css::uno::makeAny( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( GLOBALSETTINGS_ROOT_ACCESS )));
aArgs[0] = css::uno::makeAny( aPropValue );
@@ -275,9 +273,8 @@ sal_Bool GlobalSettings_Access::impl_initConfigAccess()
SERVICENAME_CFGREADACCESS, aArgs ),
css::uno::UNO_QUERY );
- css::uno::Reference< css::lang::XComponent > xComponent( xConfigProvider, css::uno::UNO_QUERY );
- if ( xComponent.is() )
- xComponent->addEventListener(
+ css::uno::Reference< css::lang::XComponent >(
+ xConfigProvider, css::uno::UNO_QUERY_THROW )->addEventListener(
css::uno::Reference< css::lang::XEventListener >(
static_cast< cppu::OWeakObject* >( this ),
css::uno::UNO_QUERY ));
@@ -302,16 +299,16 @@ sal_Bool GlobalSettings_Access::impl_initConfigAccess()
struct mutexGlobalSettings : public rtl::Static< osl::Mutex, mutexGlobalSettings > {};
static GlobalSettings_Access* pStaticSettings = 0;
-static GlobalSettings_Access* GetGlobalSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSrvMgr )
+static GlobalSettings_Access* GetGlobalSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext )
{
osl::MutexGuard aGuard(mutexGlobalSettings::get());
if ( !pStaticSettings )
- pStaticSettings = new GlobalSettings_Access( rSrvMgr );
+ pStaticSettings = new GlobalSettings_Access( rxContext );
return pStaticSettings;
}
-GlobalSettings::GlobalSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSrvMgr ) :
- m_xSrvMgr( rSrvMgr )
+GlobalSettings::GlobalSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ) :
+ m_xContext( rxContext )
{
}
@@ -322,7 +319,7 @@ GlobalSettings::~GlobalSettings()
// settings access
sal_Bool GlobalSettings::HasStatesInfo( UIElementType eElementType )
{
- GlobalSettings_Access* pSettings( GetGlobalSettings( m_xSrvMgr ));
+ GlobalSettings_Access* pSettings( GetGlobalSettings( m_xContext ));
if ( pSettings )
return pSettings->HasStatesInfo( eElementType );
@@ -332,7 +329,7 @@ sal_Bool GlobalSettings::HasStatesInfo( UIElementType eElementType )
sal_Bool GlobalSettings::GetStateInfo( UIElementType eElementType, StateInfo eStateInfo, ::com::sun::star::uno::Any& aValue )
{
- GlobalSettings_Access* pSettings( GetGlobalSettings( m_xSrvMgr ));
+ GlobalSettings_Access* pSettings( GetGlobalSettings( m_xContext ));
if ( pSettings )
return pSettings->GetStateInfo( eElementType, eStateInfo, aValue );
diff --git a/framework/source/uiconfiguration/uicategorydescription.cxx b/framework/source/uiconfiguration/uicategorydescription.cxx
index 18ed4445d477..7f701e8f4446 100644
--- a/framework/source/uiconfiguration/uicategorydescription.cxx
+++ b/framework/source/uiconfiguration/uicategorydescription.cxx
@@ -36,6 +36,7 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XContainer.hpp>
@@ -55,6 +56,7 @@
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
+using namespace com::sun::star::configuration;
using namespace com::sun::star::container;
using namespace ::com::sun::star::frame;
@@ -85,7 +87,7 @@ class ConfigurationAccess_UICategory : // Order is neccessary for right initiali
public ::cppu::WeakImplHelper2<XNameAccess,XContainerListener>
{
public:
- ConfigurationAccess_UICategory( const ::rtl::OUString& aModuleName, const Reference< XNameAccess >& xGenericUICommands, const Reference< XMultiServiceFactory >& rServiceManager );
+ ConfigurationAccess_UICategory( const ::rtl::OUString& aModuleName, const Reference< XNameAccess >& xGenericUICommands, const Reference< XComponentContext >& rxContext );
virtual ~ConfigurationAccess_UICategory();
// XNameAccess
@@ -130,7 +132,6 @@ class ConfigurationAccess_UICategory : // Order is neccessary for right initiali
rtl::OUString m_aConfigCategoryAccess;
rtl::OUString m_aPropUIName;
Reference< XNameAccess > m_xGenericUICategories;
- Reference< XMultiServiceFactory > m_xServiceManager;
Reference< XMultiServiceFactory > m_xConfigProvider;
Reference< XNameAccess > m_xConfigAccess;
Reference< XContainerListener > m_xConfigListener;
@@ -143,12 +144,11 @@ class ConfigurationAccess_UICategory : // Order is neccessary for right initiali
// XInterface, XTypeProvider
//*****************************************************************************************************************
-ConfigurationAccess_UICategory::ConfigurationAccess_UICategory( const rtl::OUString& aModuleName, const Reference< XNameAccess >& rGenericUICategories, const Reference< XMultiServiceFactory >& rServiceManager ) :
+ConfigurationAccess_UICategory::ConfigurationAccess_UICategory( const rtl::OUString& aModuleName, const Reference< XNameAccess >& rGenericUICategories, const Reference< XComponentContext >& rxContext ) :
ThreadHelpBase(),
m_aConfigCategoryAccess( CONFIGURATION_ROOT_ACCESS ),
m_aPropUIName( CONFIGURATION_PROPERTY_NAME ),
m_xGenericUICategories( rGenericUICategories ),
- m_xServiceManager( rServiceManager ),
m_bConfigAccessInitialized( sal_False ),
m_bCacheFilled( sal_False )
{
@@ -157,7 +157,7 @@ ConfigurationAccess_UICategory::ConfigurationAccess_UICategory( const rtl::OUStr
m_aConfigCategoryAccess += aModuleName;
m_aConfigCategoryAccess += rtl::OUString( CONFIGURATION_CATEGORY_ELEMENT_ACCESS );
- m_xConfigProvider = Reference< XMultiServiceFactory >( rServiceManager->createInstance(SERVICENAME_CFGPROVIDER),UNO_QUERY );
+ m_xConfigProvider = theDefaultProvider::get( rxContext );
}
ConfigurationAccess_UICategory::~ConfigurationAccess_UICategory()
@@ -424,7 +424,7 @@ void SAL_CALL ConfigurationAccess_UICategory::disposing( const EventObject& aEve
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
-DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( UICategoryDescription ,
+DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2 ( UICategoryDescription ,
::cppu::OWeakObject ,
SERVICENAME_UICATEGORYDESCRIPTION ,
IMPLEMENTATIONNAME_UICATEGORYDESCRIPTION
@@ -432,12 +432,12 @@ DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( UICategoryDescription
DEFINE_INIT_SERVICE ( UICategoryDescription, {} )
-UICategoryDescription::UICategoryDescription( const Reference< XMultiServiceFactory >& xServiceManager ) :
- UICommandDescription(xServiceManager,true)
+UICategoryDescription::UICategoryDescription( const Reference< XComponentContext >& rxContext ) :
+ UICommandDescription(rxContext,true)
{
Reference< XNameAccess > xEmpty;
rtl::OUString aGenericCategories( "GenericCategories" );
- m_xGenericUICommands = new ConfigurationAccess_UICategory( aGenericCategories, xEmpty, xServiceManager );
+ m_xGenericUICommands = new ConfigurationAccess_UICategory( aGenericCategories, xEmpty, rxContext );
// insert generic categories mappings
m_aModuleToCommandFileMap.insert( ModuleToCommandFileMap::value_type(
@@ -455,7 +455,7 @@ UICategoryDescription::~UICategoryDescription()
}
Reference< XNameAccess > UICategoryDescription::impl_createConfigAccess(const ::rtl::OUString& _sName)
{
- return new ConfigurationAccess_UICategory( _sName,m_xGenericUICommands,m_xServiceManager );
+ return new ConfigurationAccess_UICategory( _sName, m_xGenericUICommands, m_xContext );
}
} // namespace framework
diff --git a/framework/source/uiconfiguration/windowstateconfiguration.cxx b/framework/source/uiconfiguration/windowstateconfiguration.cxx
index 0c831f3e1505..625aeb3128d8 100644
--- a/framework/source/uiconfiguration/windowstateconfiguration.cxx
+++ b/framework/source/uiconfiguration/windowstateconfiguration.cxx
@@ -34,6 +34,7 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XContainer.hpp>
@@ -55,6 +56,7 @@ using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
using namespace com::sun::star::util;
+using namespace com::sun::star::configuration;
using namespace com::sun::star::container;
using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::ui;
@@ -140,7 +142,7 @@ class ConfigurationAccess_WindowState : // interfaces
public ::cppu::OWeakObject
{
public:
- ConfigurationAccess_WindowState( const ::rtl::OUString& aWindowStateConfigFile, const Reference< XMultiServiceFactory >& rServiceManager );
+ ConfigurationAccess_WindowState( const ::rtl::OUString& aWindowStateConfigFile, const Reference< XComponentContext >& rxContext );
virtual ~ConfigurationAccess_WindowState();
// XInterface, XTypeProvider
@@ -250,7 +252,6 @@ class ConfigurationAccess_WindowState : // interfaces
::std::equal_to< ::rtl::OUString > > ResourceURLToInfoCache;
rtl::OUString m_aConfigWindowAccess;
- Reference< XMultiServiceFactory > m_xServiceManager;
Reference< XMultiServiceFactory > m_xConfigProvider;
Reference< XNameAccess > m_xConfigAccess;
Reference< XContainerListener > m_xConfigListener;
@@ -284,17 +285,16 @@ DEFINE_XTYPEPROVIDER_7 ( ConfigurationAccess_WindowState ,
css::lang::XTypeProvider
)
-ConfigurationAccess_WindowState::ConfigurationAccess_WindowState( const rtl::OUString& aModuleName, const Reference< XMultiServiceFactory >& rServiceManager ) :
+ConfigurationAccess_WindowState::ConfigurationAccess_WindowState( const rtl::OUString& aModuleName, const Reference< XComponentContext >& rxContext ) :
ThreadHelpBase(),
m_aConfigWindowAccess( CONFIGURATION_ROOT_ACCESS ),
- m_xServiceManager( rServiceManager ),
m_bConfigAccessInitialized( sal_False ),
m_bModified( sal_False )
{
// Create configuration hierachical access name
m_aConfigWindowAccess += aModuleName;
m_aConfigWindowAccess += rtl::OUString( CONFIGURATION_WINDOWSTATE_ACCESS );
- m_xConfigProvider = Reference< XMultiServiceFactory >( rServiceManager->createInstance( SERVICENAME_CFGPROVIDER ), UNO_QUERY );
+ m_xConfigProvider = theDefaultProvider::get( rxContext );
// Initialize access array with property names.
sal_Int32 n = 0;
@@ -1352,7 +1352,7 @@ DEFINE_XTYPEPROVIDER_4 ( WindowStateConfiguration
css::container::XElementAccess
)
-DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( WindowStateConfiguration ,
+DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2( WindowStateConfiguration ,
::cppu::OWeakObject ,
SERVICENAME_WINDOWSTATECONFIGURATION ,
IMPLEMENTATIONNAME_WINDOWSTATECONFIGURATION
@@ -1360,11 +1360,11 @@ DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( WindowStateConfiguration
DEFINE_INIT_SERVICE ( WindowStateConfiguration, {} )
-WindowStateConfiguration::WindowStateConfiguration( const Reference< XMultiServiceFactory >& xServiceManager ) :
+WindowStateConfiguration::WindowStateConfiguration( const Reference< XComponentContext >& rxContext ) :
ThreadHelpBase(),
- m_xServiceManager( xServiceManager )
+ m_xContext( rxContext )
{
- m_xModuleManager = ModuleManager::create( comphelper::getComponentContext(m_xServiceManager) );
+ m_xModuleManager = ModuleManager::create( m_xContext );
Reference< XNameAccess > xEmptyNameAccess;
Sequence< rtl::OUString > aElementNames;
try
@@ -1432,7 +1432,7 @@ throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::la
else
{
Reference< XNameAccess > xResourceURLWindowState;
- ConfigurationAccess_WindowState* pModuleWindowState = new ConfigurationAccess_WindowState( aWindowStateConfigFile, m_xServiceManager );
+ ConfigurationAccess_WindowState* pModuleWindowState = new ConfigurationAccess_WindowState( aWindowStateConfigFile, m_xContext );
xResourceURLWindowState = Reference< XNameAccess >( static_cast< cppu::OWeakObject* >( pModuleWindowState ),UNO_QUERY );
pModuleIter->second = xResourceURLWindowState;
a <<= xResourceURLWindowState;
diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx
index 232a1ce151e9..2946f1da2482 100644
--- a/framework/source/uielement/uicommanddescription.cxx
+++ b/framework/source/uielement/uicommanddescription.cxx
@@ -37,6 +37,7 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/ModuleManager.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XContainer.hpp>
@@ -58,6 +59,7 @@
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
+using namespace com::sun::star::configuration;
using namespace com::sun::star::container;
using namespace ::com::sun::star::frame;
@@ -97,12 +99,12 @@ namespace framework
// Configuration access class for PopupMenuControllerFactory implementation
//*****************************************************************************************************************
-class ConfigurationAccess_UICommand : // Order is neccessary for right initialization!
+class ConfigurationAccess_UICommand : // Order is necessary for right initialization!
private ThreadHelpBase ,
public ::cppu::WeakImplHelper2<XNameAccess,XContainerListener>
{
public:
- ConfigurationAccess_UICommand( const ::rtl::OUString& aModuleName, const Reference< XNameAccess >& xGenericUICommands, const Reference< XMultiServiceFactory >& rServiceManager );
+ ConfigurationAccess_UICommand( const ::rtl::OUString& aModuleName, const Reference< XNameAccess >& xGenericUICommands, const Reference< XComponentContext >& rxContext );
virtual ~ConfigurationAccess_UICommand();
// XNameAccess
@@ -180,7 +182,6 @@ class ConfigurationAccess_UICommand : // Order is neccessary for right initializ
rtl::OUString m_aExtension;
rtl::OUString m_aPrivateResourceURL;
Reference< XNameAccess > m_xGenericUICommands;
- Reference< XMultiServiceFactory > m_xServiceManager;
Reference< XMultiServiceFactory > m_xConfigProvider;
Reference< XNameAccess > m_xConfigAccess;
Reference< XContainerListener > m_xConfigListener;
@@ -198,7 +199,7 @@ class ConfigurationAccess_UICommand : // Order is neccessary for right initializ
//*****************************************************************************************************************
// XInterface, XTypeProvider
//*****************************************************************************************************************
-ConfigurationAccess_UICommand::ConfigurationAccess_UICommand( const rtl::OUString& aModuleName, const Reference< XNameAccess >& rGenericUICommands, const Reference< XMultiServiceFactory >& rServiceManager ) :
+ConfigurationAccess_UICommand::ConfigurationAccess_UICommand( const rtl::OUString& aModuleName, const Reference< XNameAccess >& rGenericUICommands, const Reference< XComponentContext>& rxContext ) :
ThreadHelpBase(),
m_aConfigCmdAccess( CONFIGURATION_ROOT_ACCESS ),
m_aConfigPopupAccess( CONFIGURATION_ROOT_ACCESS ),
@@ -210,7 +211,6 @@ ConfigurationAccess_UICommand::ConfigurationAccess_UICommand( const rtl::OUStrin
m_aPropProperties( PROPSET_PROPERTIES ),
m_aPrivateResourceURL( PRIVATE_RESOURCE_URL ),
m_xGenericUICommands( rGenericUICommands ),
- m_xServiceManager( rServiceManager ),
m_bConfigAccessInitialized( sal_False ),
m_bCacheFilled( sal_False ),
m_bGenericDataRetrieved( sal_False )
@@ -219,7 +219,7 @@ ConfigurationAccess_UICommand::ConfigurationAccess_UICommand( const rtl::OUStrin
m_aConfigCmdAccess += aModuleName;
m_aConfigCmdAccess += rtl::OUString( CONFIGURATION_CMD_ELEMENT_ACCESS );
- m_xConfigProvider = Reference< XMultiServiceFactory >( rServiceManager->createInstance(SERVICENAME_CFGPROVIDER),UNO_QUERY );
+ m_xConfigProvider = theDefaultProvider::get( rxContext );
m_aConfigPopupAccess += aModuleName;
m_aConfigPopupAccess += rtl::OUString( CONFIGURATION_POP_ELEMENT_ACCESS );
@@ -624,7 +624,7 @@ void SAL_CALL ConfigurationAccess_UICommand::disposing( const EventObject& aEven
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
-DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( UICommandDescription ,
+DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2 ( UICommandDescription ,
::cppu::OWeakObject ,
SERVICENAME_UICOMMANDDESCRIPTION ,
IMPLEMENTATIONNAME_UICOMMANDDESCRIPTION
@@ -632,15 +632,15 @@ DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( UICommandDescription
DEFINE_INIT_SERVICE ( UICommandDescription, {} )
-UICommandDescription::UICommandDescription( const Reference< XMultiServiceFactory >& xServiceManager ) :
+UICommandDescription::UICommandDescription( const Reference< XComponentContext >& rxContext ) :
ThreadHelpBase(),
m_aPrivateResourceURL( PRIVATE_RESOURCE_URL ),
- m_xServiceManager( xServiceManager )
+ m_xContext( rxContext )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UICommandDescription::UICommandDescription" );
Reference< XNameAccess > xEmpty;
rtl::OUString aGenericUICommand( "GenericCommands" );
- m_xGenericUICommands = new ConfigurationAccess_UICommand( aGenericUICommand, xEmpty, xServiceManager );
+ m_xGenericUICommands = new ConfigurationAccess_UICommand( aGenericUICommand, xEmpty, m_xContext );
impl_fillElements("ooSetupFactoryCommandConfigRef");
@@ -649,9 +649,9 @@ UICommandDescription::UICommandDescription( const Reference< XMultiServiceFactor
if ( pIter != m_aUICommandsHashMap.end() )
pIter->second = m_xGenericUICommands;
}
-UICommandDescription::UICommandDescription( const Reference< XMultiServiceFactory >& xServiceManager,bool ) :
+UICommandDescription::UICommandDescription( const Reference< XComponentContext >& rxContext, bool ) :
ThreadHelpBase(),
- m_xServiceManager( xServiceManager )
+ m_xContext( rxContext )
{
}
UICommandDescription::~UICommandDescription()
@@ -663,7 +663,7 @@ UICommandDescription::~UICommandDescription()
}
void UICommandDescription::impl_fillElements(const sal_Char* _pName)
{
- m_xModuleManager.set( ModuleManager::create( comphelper::getComponentContext(m_xServiceManager) ) );
+ m_xModuleManager.set( ModuleManager::create( m_xContext ) );
Sequence< rtl::OUString > aElementNames = m_xModuleManager->getElementNames();
Sequence< PropertyValue > aSeq;
::rtl::OUString aModuleIdentifier;
@@ -695,7 +695,7 @@ void UICommandDescription::impl_fillElements(const sal_Char* _pName)
}
Reference< XNameAccess > UICommandDescription::impl_createConfigAccess(const ::rtl::OUString& _sName)
{
- return new ConfigurationAccess_UICommand( _sName,m_xGenericUICommands,m_xServiceManager );
+ return new ConfigurationAccess_UICommand( _sName, m_xGenericUICommands, m_xContext );
}
Any SAL_CALL UICommandDescription::getByName( const ::rtl::OUString& aName )
@@ -720,7 +720,7 @@ throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::la
Reference< XNameAccess > xUICommands;
ConfigurationAccess_UICommand* pUICommands = new ConfigurationAccess_UICommand( aCommandFile,
m_xGenericUICommands,
- m_xServiceManager );
+ m_xContext );
xUICommands = Reference< XNameAccess >( static_cast< cppu::OWeakObject* >( pUICommands ),UNO_QUERY );
pIter->second = xUICommands;
a <<= xUICommands;
diff --git a/framework/source/uifactory/factoryconfiguration.cxx b/framework/source/uifactory/factoryconfiguration.cxx
index d029b849f013..476fefcb391b 100644
--- a/framework/source/uifactory/factoryconfiguration.cxx
+++ b/framework/source/uifactory/factoryconfiguration.cxx
@@ -34,6 +34,7 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XContainer.hpp>
@@ -69,19 +70,18 @@ rtl::OUString getHashKeyFromStrings( const rtl::OUString& aCommandURL, const rtl
//*****************************************************************************************************************
// XInterface, XTypeProvider
//*****************************************************************************************************************
-ConfigurationAccess_ControllerFactory::ConfigurationAccess_ControllerFactory( Reference< XMultiServiceFactory >& rServiceManager,const ::rtl::OUString& _sRoot,bool _bAskValue ) :
+ConfigurationAccess_ControllerFactory::ConfigurationAccess_ControllerFactory( const Reference< XComponentContext >& rxContext, const ::rtl::OUString& _sRoot,bool _bAskValue ) :
ThreadHelpBase(),
m_aPropCommand( RTL_CONSTASCII_USTRINGPARAM( "Command" )),
m_aPropModule( RTL_CONSTASCII_USTRINGPARAM( "Module" )),
m_aPropController( RTL_CONSTASCII_USTRINGPARAM( "Controller" )),
m_aPropValue( RTL_CONSTASCII_USTRINGPARAM( "Value" )),
m_sRoot(_sRoot),
- m_xServiceManager( rServiceManager ),
m_bConfigAccessInitialized( sal_False ),
m_bAskValue(_bAskValue)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "ConfigurationAccess_ControllerFactory::ConfigurationAccess_ControllerFactory" );
- m_xConfigProvider = Reference< XMultiServiceFactory >( rServiceManager->createInstance( SERVICENAME_CFGPROVIDER),UNO_QUERY );
+ m_xConfigProvider = configuration::theDefaultProvider::get( rxContext );
}
ConfigurationAccess_ControllerFactory::~ConfigurationAccess_ControllerFactory()
diff --git a/framework/source/uifactory/popupmenucontrollerfactory.cxx b/framework/source/uifactory/popupmenucontrollerfactory.cxx
index e98f03e91464..34dd936f7b72 100644
--- a/framework/source/uifactory/popupmenucontrollerfactory.cxx
+++ b/framework/source/uifactory/popupmenucontrollerfactory.cxx
@@ -64,7 +64,7 @@ PopupMenuControllerFactory::PopupMenuControllerFactory( const Reference< XMultiS
ToolbarControllerFactory(xServiceManager,true)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "PopupMenuControllerFactory::PopupMenuControllerFactory" );
- m_pConfigAccess = new ConfigurationAccess_ControllerFactory( m_xServiceManager,rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Controller/Registered/PopupMenu" )) );
+ m_pConfigAccess = new ConfigurationAccess_ControllerFactory( comphelper::getComponentContext(m_xServiceManager), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Controller/Registered/PopupMenu" )) );
m_pConfigAccess->acquire();
}
diff --git a/framework/source/uifactory/statusbarcontrollerfactory.cxx b/framework/source/uifactory/statusbarcontrollerfactory.cxx
index 3de5b25245ab..b0e0342f3e94 100644
--- a/framework/source/uifactory/statusbarcontrollerfactory.cxx
+++ b/framework/source/uifactory/statusbarcontrollerfactory.cxx
@@ -61,7 +61,7 @@ DEFINE_INIT_SERVICE ( StatusbarControllerFactory, {} )
StatusbarControllerFactory::StatusbarControllerFactory( const Reference< XMultiServiceFactory >& xServiceManager ) :
ToolbarControllerFactory(xServiceManager,true)
{
- m_pConfigAccess = new ConfigurationAccess_ControllerFactory( m_xServiceManager,rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Controller/Registered/StatusBar" )),true );
+ m_pConfigAccess = new ConfigurationAccess_ControllerFactory( comphelper::getComponentContext(m_xServiceManager), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Controller/Registered/StatusBar" )),true );
m_pConfigAccess->acquire();
}
diff --git a/framework/source/uifactory/toolbarcontrollerfactory.cxx b/framework/source/uifactory/toolbarcontrollerfactory.cxx
index 5651159be7dd..6967a8aae367 100644
--- a/framework/source/uifactory/toolbarcontrollerfactory.cxx
+++ b/framework/source/uifactory/toolbarcontrollerfactory.cxx
@@ -73,7 +73,7 @@ ToolbarControllerFactory::ToolbarControllerFactory( const Reference< XMultiServi
m_bConfigRead( sal_False ),
m_xServiceManager( xServiceManager )
{
- m_pConfigAccess = new ConfigurationAccess_ControllerFactory( m_xServiceManager,rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Controller/Registered/ToolBar" )) );
+ m_pConfigAccess = new ConfigurationAccess_ControllerFactory( comphelper::getComponentContext(m_xServiceManager), rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Controller/Registered/ToolBar" )) );
m_pConfigAccess->acquire();
}
diff --git a/framework/source/uifactory/uielementfactorymanager.cxx b/framework/source/uifactory/uielementfactorymanager.cxx
index 9e0debabe42c..6e4b9d59b9b8 100644
--- a/framework/source/uifactory/uielementfactorymanager.cxx
+++ b/framework/source/uifactory/uielementfactorymanager.cxx
@@ -35,6 +35,7 @@
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XContainer.hpp>
@@ -54,6 +55,7 @@ using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
using namespace com::sun::star::frame;
+using namespace com::sun::star::configuration;
using namespace com::sun::star::container;
using namespace ::com::sun::star::ui;
using namespace ::com::sun::star::frame;
@@ -82,18 +84,17 @@ rtl::OUString getHashKeyFromStrings( const rtl::OUString& aType, const rtl::OUSt
//*****************************************************************************************************************
-ConfigurationAccess_FactoryManager::ConfigurationAccess_FactoryManager( Reference< XMultiServiceFactory >& rServiceManager,const ::rtl::OUString& _sRoot ) :
+ConfigurationAccess_FactoryManager::ConfigurationAccess_FactoryManager( const Reference< XComponentContext >& rxContext, const ::rtl::OUString& _sRoot ) :
ThreadHelpBase(),
m_aPropType( RTL_CONSTASCII_USTRINGPARAM( "Type" )),
m_aPropName( RTL_CONSTASCII_USTRINGPARAM( "Name" )),
m_aPropModule( RTL_CONSTASCII_USTRINGPARAM( "Module" )),
m_aPropFactory( RTL_CONSTASCII_USTRINGPARAM( "FactoryImplementation" )),
m_sRoot(_sRoot),
- m_xServiceManager( rServiceManager ),
m_bConfigAccessInitialized( sal_False )
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UIElementFactoryManager::ConfigurationAccess_FactoryManager" );
- m_xConfigProvider = Reference< XMultiServiceFactory >( rServiceManager->createInstance( SERVICENAME_CFGPROVIDER),UNO_QUERY );
+ m_xConfigProvider = theDefaultProvider::get( rxContext );
}
ConfigurationAccess_FactoryManager::~ConfigurationAccess_FactoryManager()
@@ -379,7 +380,7 @@ sal_Bool ConfigurationAccess_FactoryManager::impl_getElementProps( const Any& aE
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
-DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( UIElementFactoryManager ,
+DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2 ( UIElementFactoryManager ,
::cppu::OWeakObject ,
SERVICENAME_UIELEMENTFACTORYMANAGER ,
IMPLEMENTATIONNAME_UIELEMENTFACTORYMANAGER
@@ -387,15 +388,15 @@ DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( UIElementFactoryManager
DEFINE_INIT_SERVICE ( UIElementFactoryManager, {} )
-UIElementFactoryManager::UIElementFactoryManager( const Reference< XMultiServiceFactory >& xServiceManager ) :
+UIElementFactoryManager::UIElementFactoryManager( const Reference< XComponentContext >& rxContext ) :
ThreadHelpBase( &Application::GetSolarMutex() ),
m_bConfigRead( sal_False ),
- m_xServiceManager( xServiceManager )
+ m_xContext(rxContext)
{
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "framework", "Ocke.Janssen@sun.com", "UIElementFactoryManager::UIElementFactoryManager" );
- m_pConfigAccess = new ConfigurationAccess_FactoryManager( m_xServiceManager,rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Factories/Registered/UIElementFactories" )) );
+ m_pConfigAccess = new ConfigurationAccess_FactoryManager( rxContext, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.Factories/Registered/UIElementFactories" )) );
m_pConfigAccess->acquire();
- m_xModuleManager = ModuleManager::create( comphelper::getComponentContext(m_xServiceManager) );
+ m_xModuleManager = ModuleManager::create( rxContext );
}
UIElementFactoryManager::~UIElementFactoryManager()
@@ -491,13 +492,13 @@ throw ( RuntimeException )
WindowContentFactoryManager::RetrieveTypeNameFromResourceURL( aResourceURL, aType, aName );
- Reference< XMultiServiceFactory > xSManager( m_xServiceManager );
+ Reference< XComponentContext > xContext( m_xContext );
rtl::OUString aServiceSpecifier = m_pConfigAccess->getFactorySpecifierFromTypeNameModule( aType, aName, aModuleId );
aLock.unlock();
if ( !aServiceSpecifier.isEmpty() )
- return Reference< XUIElementFactory >( xSManager->createInstance( aServiceSpecifier ), UNO_QUERY );
+ return Reference< XUIElementFactory >( xContext->getServiceManager()->createInstanceWithContext(aServiceSpecifier, xContext), UNO_QUERY );
else
return Reference< XUIElementFactory >();
}
diff --git a/framework/source/uifactory/windowcontentfactorymanager.cxx b/framework/source/uifactory/windowcontentfactorymanager.cxx
index a6a950bf2d5c..68176592ae00 100644
--- a/framework/source/uifactory/windowcontentfactorymanager.cxx
+++ b/framework/source/uifactory/windowcontentfactorymanager.cxx
@@ -63,7 +63,7 @@ namespace framework
//*****************************************************************************************************************
// XInterface, XTypeProvider, XServiceInfo
//*****************************************************************************************************************
-DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( WindowContentFactoryManager ,
+DEFINE_XSERVICEINFO_ONEINSTANCESERVICE_2 ( WindowContentFactoryManager ,
::cppu::OWeakObject ,
SERVICENAME_WINDOWCONTENTFACTORYMANAGER ,
IMPLEMENTATIONNAME_WINDOWCONTENTFACTORYMANAGER
@@ -71,14 +71,13 @@ DEFINE_XSERVICEINFO_ONEINSTANCESERVICE ( WindowContentFactoryManager
DEFINE_INIT_SERVICE ( WindowContentFactoryManager, {} )
-WindowContentFactoryManager::WindowContentFactoryManager( const uno::Reference< lang::XMultiServiceFactory >& xServiceManager ) :
+WindowContentFactoryManager::WindowContentFactoryManager( const uno::Reference< uno::XComponentContext >& rxContext ) :
ThreadHelpBase( &Application::GetSolarMutex() ),
- m_bConfigRead( sal_False ),
- m_xServiceManager( xServiceManager )
+ m_bConfigRead( sal_False )
{
- m_pConfigAccess = new ConfigurationAccess_FactoryManager( m_xServiceManager,rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.WindowContentFactories/Registered/ContentFactories" )) );
+ m_pConfigAccess = new ConfigurationAccess_FactoryManager( rxContext, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.UI.WindowContentFactories/Registered/ContentFactories" )) );
m_pConfigAccess->acquire();
- m_xModuleManager = frame::ModuleManager::create( comphelper::getComponentContext(m_xServiceManager) );
+ m_xModuleManager = frame::ModuleManager::create( rxContext );
}
WindowContentFactoryManager::~WindowContentFactoryManager()
diff --git a/i18npool/inc/defaultnumberingprovider.hxx b/i18npool/inc/defaultnumberingprovider.hxx
index a67ac1e3e072..53f56e5158dd 100644
--- a/i18npool/inc/defaultnumberingprovider.hxx
+++ b/i18npool/inc/defaultnumberingprovider.hxx
@@ -45,7 +45,7 @@ class DefaultNumberingProvider : public cppu::WeakImplHelper4
void impl_loadTranslit();
public:
DefaultNumberingProvider(
- const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory >& xMSF );
+ const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext >& rxContext );
~DefaultNumberingProvider();
//XDefaultNumberingProvider
@@ -85,7 +85,7 @@ public:
virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void)
throw( com::sun::star::uno::RuntimeException );
private:
- com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > xSMgr;
+ com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > m_xContext;
com::sun::star::uno::Reference < com::sun::star::container::XHierarchicalNameAccess > xHierarchicalNameAccess;
TransliterationImpl* translit;
rtl::OUString SAL_CALL makeNumberingIdentifier( sal_Int16 index )
diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
index e0ef03abec16..66145ef6b944 100644
--- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
+++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
@@ -20,6 +20,7 @@
#include <defaultnumberingprovider.hxx>
#include <com/sun/star/style/NumberingType.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/text/HoriOrientation.hpp>
#include <localedata.hxx>
#include <nativenumbersupplier.hxx>
@@ -259,7 +260,7 @@ static sal_Unicode table_PersianWord_decadeX[][8]={
};
-DefaultNumberingProvider::DefaultNumberingProvider( const Reference < XMultiServiceFactory >& xMSF ) : xSMgr(xMSF),translit(NULL)
+DefaultNumberingProvider::DefaultNumberingProvider( const Reference < XComponentContext >& rxContext ) : m_xContext(rxContext),translit(NULL)
{
}
@@ -272,7 +273,7 @@ DefaultNumberingProvider::~DefaultNumberingProvider()
void DefaultNumberingProvider::impl_loadTranslit()
{
if ( !translit )
- translit = new TransliterationImpl(comphelper::getComponentContext(xSMgr));
+ translit = new TransliterationImpl(m_xContext);
}
Sequence< Reference<container::XIndexAccess> >
@@ -966,11 +967,8 @@ sal_Bool SAL_CALL
DefaultNumberingProvider::isScriptFlagEnabled(const OUString& aName) throw(RuntimeException)
{
if (! xHierarchicalNameAccess.is()) {
- Reference< XInterface > xInterface;
-
- xInterface = xSMgr->createInstance(OUString("com.sun.star.configuration.ConfigurationProvider"));
Reference< XMultiServiceFactory > xConfigProvider =
- Reference< XMultiServiceFactory >(xInterface, UNO_QUERY );
+ configuration::theDefaultProvider::get(m_xContext);
if (! xConfigProvider.is())
throw RuntimeException();
@@ -981,7 +979,7 @@ DefaultNumberingProvider::isScriptFlagEnabled(const OUString& aName) throw(Runti
aPath.Value <<= OUString("/org.openoffice.Office.Common/I18N"),
aArgs[0] <<= aPath;
- xInterface = xConfigProvider->createInstanceWithArguments(
+ Reference<XInterface> xInterface = xConfigProvider->createInstanceWithArguments(
OUString("com.sun.star.configuration.ConfigurationAccess"), aArgs);
xHierarchicalNameAccess.set(xInterface, UNO_QUERY);
diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx
index 6345b916690a..c83702218c8c 100644
--- a/i18npool/source/registerservices/registerservices.cxx
+++ b/i18npool/source/registerservices/registerservices.cxx
@@ -130,7 +130,7 @@ using namespace ::com::sun::star::i18n;
IMPL_CREATEINSTANCE_CTX( NumberFormatCodeMapper )
IMPL_CREATEINSTANCE( NativeNumberSupplier )
IMPL_CREATEINSTANCE( LocaleData )
-IMPL_CREATEINSTANCE_MSF( DefaultNumberingProvider )
+IMPL_CREATEINSTANCE_CTX( DefaultNumberingProvider )
IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier )
IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_asian )
IMPL_CREATEINSTANCE_MSF( IndexEntrySupplier_ja_phonetic_alphanumeric_first_by_syllable )
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index b2f41628fd64..ce8efa727729 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -23,6 +23,7 @@
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XNameReplace.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/i18n/BreakIterator.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -967,14 +968,9 @@ uno::Reference< util::XChangesBatch > GrammarCheckingIterator::GetUpdateAccess()
try
{
// get configuration provider
- uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider;
- uno::Reference< lang::XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory();
- if (xMgr.is())
- {
- xConfigurationProvider = uno::Reference< lang::XMultiServiceFactory > (
- xMgr->createInstance( "com.sun.star.configuration.ConfigurationProvider" ),
- uno::UNO_QUERY_THROW ) ;
- }
+ uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
+ uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider =
+ configuration::theDefaultProvider::get( xContext );
// get configuration update access
beans::PropertyValue aValue;
diff --git a/offapi/com/sun/star/configuration/ConfigurationProvider.idl b/offapi/com/sun/star/configuration/ConfigurationProvider.idl
index 4d8e5799ef06..e0e33712f35f 100644
--- a/offapi/com/sun/star/configuration/ConfigurationProvider.idl
+++ b/offapi/com/sun/star/configuration/ConfigurationProvider.idl
@@ -46,6 +46,8 @@ module com { module sun { module star { module configuration {
may be given default values during creation of this service. In particular
this applies to the parameters <code>"Locale"</code> and <code>"EnableAsync"</code>.
</p>
+
+ @deprecated Use <type>theDefaultProvider</type> instead.
*/
published service ConfigurationProvider
{
diff --git a/padmin/source/helper.cxx b/padmin/source/helper.cxx
index db79ef0788e9..e9bc7ad7532c 100644
--- a/padmin/source/helper.cxx
+++ b/padmin/source/helper.cxx
@@ -62,7 +62,7 @@ ResId padmin::PaResId( sal_uInt32 nId )
utl::OConfigurationNode aNode =
utl::OConfigurationTreeRoot::tryCreateWithServiceFactory(
- comphelper::getProcessServiceFactory(),
+ comphelper::getProcessComponentContext(),
OUString("org.openoffice.Setup/L10N") );
if ( aNode.isValid() )
{
diff --git a/sd/source/core/CustomAnimationPreset.cxx b/sd/source/core/CustomAnimationPreset.cxx
index 87e19f8ee4a5..cee595c3314f 100644
--- a/sd/source/core/CustomAnimationPreset.cxx
+++ b/sd/source/core/CustomAnimationPreset.cxx
@@ -30,6 +30,7 @@
#include <com/sun/star/util/XMacroExpander.hpp>
#include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/xml/sax/Parser.hpp>
#include <com/sun/star/xml/sax/SAXParseException.hpp>
@@ -53,16 +54,11 @@
#include <algorithm>
using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::animations;
using namespace ::com::sun::star::presentation;
using ::rtl::OUString;
-using ::com::sun::star::uno::UNO_QUERY;
-using ::com::sun::star::uno::UNO_QUERY_THROW;
-using ::com::sun::star::uno::Any;
-using ::com::sun::star::uno::Sequence;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Exception;
using ::com::sun::star::io::XInputStream;
using ::com::sun::star::lang::XMultiServiceFactory;
using ::com::sun::star::container::XNameAccess;
@@ -320,9 +316,8 @@ void CustomAnimationPresets::importEffects()
xContext->getValueByName("/singletons/com.sun.star.util.theMacroExpander"),
UNO_QUERY );
- Reference< XMultiServiceFactory > xConfigProvider(
- xServiceFactory->createInstance("com.sun.star.configuration.ConfigurationProvider" ),
- UNO_QUERY_THROW );
+ Reference< XMultiServiceFactory > xConfigProvider =
+ configuration::theDefaultProvider::get( xContext );
// read path to transition effects files from config
Any propValue = uno::makeAny(
@@ -404,12 +399,10 @@ void CustomAnimationPresets::importResources()
try
{
// Get service factory
- Reference< XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() );
- DBG_ASSERT( xServiceFactory.is(), "sd::CustomAnimationPresets::import(), got no service manager" );
- if( !xServiceFactory.is() )
- return;
+ Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() );
- Reference< XMultiServiceFactory > xConfigProvider( xServiceFactory->createInstance("com.sun.star.configuration.ConfigurationProvider" ), UNO_QUERY );
+ Reference< XMultiServiceFactory > xConfigProvider =
+ configuration::theDefaultProvider::get( xContext );
const OUString aPropertyPath("/org.openoffice.Office.UI.Effects/UserInterface/Properties" );
implImportLabels( xConfigProvider, aPropertyPath, maPropertyNameMap );
diff --git a/sd/source/core/TransitionPreset.cxx b/sd/source/core/TransitionPreset.cxx
index 3c77ead958fe..49c0a5851cd3 100644
--- a/sd/source/core/TransitionPreset.cxx
+++ b/sd/source/core/TransitionPreset.cxx
@@ -30,6 +30,7 @@
#include <com/sun/star/animations/XTransitionFilter.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/util/XMacroExpander.hpp>
#include <com/sun/star/animations/AnimationNodeType.hpp>
@@ -68,7 +69,7 @@ using ::com::sun::star::beans::NamedValue;
namespace sd {
-extern Reference< XAnimationNode > implImportEffects( const Reference< XMultiServiceFactory >& xConfigProvider, const OUString& rPath );
+extern Reference< XAnimationNode > implImportEffects( const Reference< XMultiServiceFactory >& xServiceFactory, const OUString& rPath );
extern void implImportLabels( const Reference< XMultiServiceFactory >& xConfigProvider, const OUString& rNodePath, UStringMap& rStringMap );
TransitionPreset::TransitionPreset( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode )
@@ -161,8 +162,8 @@ bool TransitionPreset::importTransitionPresetList( TransitionPresetList& rList )
UNO_QUERY );
// import ui strings
- Reference< XMultiServiceFactory > xConfigProvider(
- xServiceFactory->createInstance("com.sun.star.configuration.ConfigurationProvider" ), UNO_QUERY_THROW );
+ Reference< XMultiServiceFactory > xConfigProvider =
+ configuration::theDefaultProvider::get( xContext );
UStringMap aTransitionNameMape;
const OUString aTransitionPath("/org.openoffice.Office.UI.Effects/UserInterface/Transitions" );
diff --git a/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx b/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx
index 95c0bab2d814..a3e4b1b6f826 100644
--- a/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx
+++ b/sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx
@@ -35,6 +35,7 @@
#include <comphelper/processfactory.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
using namespace ::com::sun::star;
@@ -82,19 +83,14 @@ Timer CacheConfiguration::maReleaseTimer;
CacheConfiguration::CacheConfiguration (void)
{
// Get the cache size from configuration.
- const ::rtl::OUString sConfigurationProviderServiceName("com.sun.star.configuration.ConfigurationProvider");
const ::rtl::OUString sPathToImpressConfigurationRoot("/org.openoffice.Office.Impress/");
const ::rtl::OUString sPathToNode("MultiPaneGUI/SlideSorter/PreviewCache");
try
{
// Obtain access to the configuration.
- Reference<lang::XMultiServiceFactory> xProvider (
- ::comphelper::getProcessServiceFactory()->createInstance(
- sConfigurationProviderServiceName),
- UNO_QUERY);
- if ( ! xProvider.is())
- return;
+ Reference<lang::XMultiServiceFactory> xProvider =
+ configuration::theDefaultProvider::get( ::comphelper::getProcessComponentContext() );
// Obtain access to Impress configuration.
Sequence<Any> aCreationArguments(3);
diff --git a/sd/source/ui/tools/ConfigurationAccess.cxx b/sd/source/ui/tools/ConfigurationAccess.cxx
index f56e7dafe190..50bff602a3d5 100644
--- a/sd/source/ui/tools/ConfigurationAccess.cxx
+++ b/sd/source/ui/tools/ConfigurationAccess.cxx
@@ -31,6 +31,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/util/XChangesBatch.hpp>
#include <comphelper/processfactory.hxx>
#include <tools/diagnose_ex.h>
@@ -47,17 +48,9 @@ ConfigurationAccess::ConfigurationAccess (
const WriteMode eMode)
: mxRoot()
{
- Reference<lang::XMultiComponentFactory> xFactory (rxContext->getServiceManager());
- if (xFactory.is())
- {
- Reference<lang::XMultiServiceFactory> xProvider (
- xFactory->createInstanceWithContext(
- "com.sun.star.configuration.ConfigurationProvider",
- rxContext),
- UNO_QUERY);
- if (xProvider.is())
- Initialize(xProvider, rsRootName, eMode);
- }
+ Reference<lang::XMultiServiceFactory> xProvider =
+ configuration::theDefaultProvider::get( rxContext );
+ Initialize(xProvider, rsRootName, eMode);
}
@@ -68,12 +61,9 @@ ConfigurationAccess::ConfigurationAccess (
const WriteMode eMode)
: mxRoot()
{
- Reference<lang::XMultiServiceFactory> xProvider (
- ::comphelper::getProcessServiceFactory()->createInstance(
- "com.sun.star.configuration.ConfigurationProvider"),
- UNO_QUERY);
- if (xProvider.is())
- Initialize(xProvider, rsRootName, eMode);
+ Reference<lang::XMultiServiceFactory> xProvider =
+ configuration::theDefaultProvider::get( ::comphelper::getProcessComponentContext() );
+ Initialize(xProvider, rsRootName, eMode);
}
diff --git a/sdext/source/minimizer/configurationaccess.cxx b/sdext/source/minimizer/configurationaccess.cxx
index d55cc63a8935..e0ba19b8f708 100644
--- a/sdext/source/minimizer/configurationaccess.cxx
+++ b/sdext/source/minimizer/configurationaccess.cxx
@@ -21,6 +21,7 @@
#include "configurationaccess.hxx"
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/util/XChangesBatch.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/util/XMacroExpander.hpp>
@@ -33,13 +34,6 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
-static const OUString& GetConfigurationProviderServiceName (void)
-{
- static const OUString sConfigurationProviderServiceName (
- RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationProvider"));
- return sConfigurationProviderServiceName;
-}
static const OUString& GetPathToConfigurationRoot (void)
{
static const OUString sPathToConfigurationRoot (
@@ -328,28 +322,25 @@ Reference< XInterface > ConfigurationAccess::OpenConfiguration( bool bReadOnly )
Reference< XInterface > xRoot;
try
{
- Reference< lang::XMultiServiceFactory > xProvider( mxMSF->getServiceManager()->createInstanceWithContext( GetConfigurationProviderServiceName(), mxMSF ), UNO_QUERY );
- if ( xProvider.is() )
- {
- Sequence< Any > aCreationArguments( 2 );
- aCreationArguments[0] = makeAny( PropertyValue(
- OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) ), 0,
- makeAny( GetPathToConfigurationRoot() ),
- PropertyState_DIRECT_VALUE ) );
- aCreationArguments[1] = makeAny(beans::PropertyValue(
- OUString( RTL_CONSTASCII_USTRINGPARAM( "lazywrite" ) ), 0, makeAny( true ),
- PropertyState_DIRECT_VALUE ) );
- OUString sAccessService;
- if ( bReadOnly )
- sAccessService = OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationAccess" ) );
- else
- sAccessService = OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationUpdateAccess" ) );
-
- xRoot = xProvider->createInstanceWithArguments(
- sAccessService, aCreationArguments );
- }
+ Reference< lang::XMultiServiceFactory > xProvider = configuration::theDefaultProvider::get( mxMSF );
+ Sequence< Any > aCreationArguments( 2 );
+ aCreationArguments[0] = makeAny( PropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) ), 0,
+ makeAny( GetPathToConfigurationRoot() ),
+ PropertyState_DIRECT_VALUE ) );
+ aCreationArguments[1] = makeAny(beans::PropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "lazywrite" ) ), 0, makeAny( true ),
+ PropertyState_DIRECT_VALUE ) );
+ OUString sAccessService;
+ if ( bReadOnly )
+ sAccessService = OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.ConfigurationAccess" ) );
+ else
+ sAccessService = OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.ConfigurationUpdateAccess" ) );
+
+ xRoot = xProvider->createInstanceWithArguments(
+ sAccessService, aCreationArguments );
}
catch (const Exception&)
{
diff --git a/sdext/source/presenter/PresenterConfigurationAccess.cxx b/sdext/source/presenter/PresenterConfigurationAccess.cxx
index e321b71215a5..2ae90dc1085a 100644
--- a/sdext/source/presenter/PresenterConfigurationAccess.cxx
+++ b/sdext/source/presenter/PresenterConfigurationAccess.cxx
@@ -22,6 +22,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/util/XChangesBatch.hpp>
using namespace ::com::sun::star;
@@ -44,8 +45,7 @@ PresenterConfigurationAccess::PresenterConfigurationAccess (
{
try
{
- Reference<lang::XMultiComponentFactory> xFactory (rxContext->getServiceManager());
- if (xFactory.is())
+ if (rxContext.is())
{
Sequence<Any> aCreationArguments(3);
aCreationArguments[0] = makeAny(beans::PropertyValue(
@@ -70,11 +70,8 @@ PresenterConfigurationAccess::PresenterConfigurationAccess (
else
sAccessService = A2S("com.sun.star.configuration.ConfigurationUpdateAccess");
- Reference<lang::XMultiServiceFactory> xProvider (
- xFactory->createInstanceWithContext(
- A2S("com.sun.star.configuration.ConfigurationProvider"),
- rxContext),
- UNO_QUERY_THROW);
+ Reference<lang::XMultiServiceFactory> xProvider =
+ configuration::theDefaultProvider::get( rxContext );
mxRoot = xProvider->createInstanceWithArguments(
sAccessService, aCreationArguments);
maNode <<= mxRoot;
diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx
index dc04ea6803fa..a49e7790f8e5 100644
--- a/sfx2/source/appl/appdata.cxx
+++ b/sfx2/source/appl/appdata.cxx
@@ -100,7 +100,7 @@ SfxAppData_Impl::SfxAppData_Impl( SfxApplication* )
, nAutoTabPageId(0)
, nRescheduleLocks(0)
, nInReschedule(0)
- , m_xImeStatusWindow(new sfx2::appl::ImeStatusWindow(comphelper::getProcessServiceFactory()))
+ , m_xImeStatusWindow(new sfx2::appl::ImeStatusWindow(comphelper::getProcessComponentContext()))
, pTbxCtrlFac(0)
, pStbCtrlFac(0)
, pViewFrames(0)
diff --git a/sfx2/source/appl/imestatuswindow.cxx b/sfx2/source/appl/imestatuswindow.cxx
index 754e35d9d7a7..56631e9ba801 100644
--- a/sfx2/source/appl/imestatuswindow.cxx
+++ b/sfx2/source/appl/imestatuswindow.cxx
@@ -26,6 +26,7 @@
#include "com/sun/star/beans/PropertyState.hpp"
#include "com/sun/star/beans/PropertyValue.hpp"
#include "com/sun/star/beans/XPropertySet.hpp"
+#include "com/sun/star/configuration/theDefaultProvider.hpp"
#include "com/sun/star/lang/DisposedException.hpp"
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
#include "com/sun/star/uno/Any.hxx"
@@ -84,9 +85,8 @@ namespace css = com::sun::star;
using sfx2::appl::ImeStatusWindow;
ImeStatusWindow::ImeStatusWindow(
- css::uno::Reference< css::lang::XMultiServiceFactory > const &
- rServiceFactory):
- m_xServiceFactory(rServiceFactory),
+ css::uno::Reference< css::uno::XComponentContext > const & rxContext):
+ m_xContext(rxContext),
m_bDisposed(false)
{}
@@ -201,24 +201,14 @@ css::uno::Reference< css::beans::XPropertySet > ImeStatusWindow::getConfig()
{
if (m_bDisposed)
throw css::lang::DisposedException();
- if (!m_xServiceFactory.is())
+ if (!m_xContext.is())
throw css::uno::RuntimeException(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
"null comphelper::getProcessServiceFactory")),
0);
- css::uno::Reference< css::lang::XMultiServiceFactory > xProvider(
- m_xServiceFactory->createInstance(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationProvider"))),
- css::uno::UNO_QUERY);
- if (!xProvider.is())
- throw css::uno::RuntimeException(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "null com.sun.star.configuration."
- "ConfigurationProvider")),
- 0);
+ css::uno::Reference< css::lang::XMultiServiceFactory > xProvider =
+ css::configuration::theDefaultProvider::get( m_xContext );
css::beans::PropertyValue aArg(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("nodepath")), -1,
css::uno::makeAny(
diff --git a/sfx2/source/appl/imestatuswindow.hxx b/sfx2/source/appl/imestatuswindow.hxx
index 5aee577fcc54..4ab18a5841ce 100644
--- a/sfx2/source/appl/imestatuswindow.hxx
+++ b/sfx2/source/appl/imestatuswindow.hxx
@@ -47,7 +47,7 @@ ImeStatusWindow_Impl;
class ImeStatusWindow: private ImeStatusWindow_Impl
{
public:
- ImeStatusWindow( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > const& rServiceFactory );
+ ImeStatusWindow( com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > const& rxContext );
/** Set up VCL according to the configuration.
@@ -103,8 +103,8 @@ private:
com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >
getConfig();
- com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
- m_xServiceFactory;
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
+ m_xContext;
osl::Mutex m_aMutex;
com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index c7194de34247..92b91947e841 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -39,6 +39,7 @@
#include <com/sun/star/beans/XPropertyContainer.hpp>
#include <com/sun/star/beans/StringPair.hpp>
#include <com/sun/star/util/XMacroExpander.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/container/XContainerQuery.hpp>
#include <com/sun/star/document/XTypeDetection.hpp>
#include <com/sun/star/document/XStandaloneDocumentInfo.hpp>
@@ -1838,10 +1839,8 @@ sal_Bool SfxDocTplService_Impl::storeTemplate( const OUString& rGroupName,
// get the actual filter name
::rtl::OUString aFilterName;
- uno::Reference< lang::XMultiServiceFactory > xConfigProvider(
- xFactory->createInstance(
- ::rtl::OUString("com.sun.star.configuration.ConfigurationProvider") ),
- uno::UNO_QUERY_THROW );
+ uno::Reference< lang::XMultiServiceFactory > xConfigProvider =
+ configuration::theDefaultProvider::get( comphelper::getComponentContext(xFactory) );
uno::Sequence< uno::Any > aArgs( 1 );
beans::PropertyValue aPathProp;
diff --git a/shell/source/cmdmail/cmdmailsuppl.cxx b/shell/source/cmdmail/cmdmailsuppl.cxx
index 5c0a5bb4c032..d64f0d10e002 100644
--- a/shell/source/cmdmail/cmdmailsuppl.cxx
+++ b/shell/source/cmdmail/cmdmailsuppl.cxx
@@ -28,6 +28,7 @@
#include "cmdmailmsg.hxx"
#include <com/sun/star/system/SimpleMailClientFlags.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
@@ -57,6 +58,7 @@ using namespace cppu;
using namespace com::sun::star::system::SimpleMailClientFlags;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
+using namespace com::sun::star::configuration;
#define COMP_IMPL_NAME "com.sun.star.comp.system.SimpleCommandMail2"
@@ -80,14 +82,7 @@ namespace // private
CmdMailSuppl::CmdMailSuppl( const Reference< XComponentContext >& xContext ) :
WeakImplHelper3< XSimpleMailClientSupplier, XSimpleMailClient, XServiceInfo >()
{
- Reference< XMultiComponentFactory > xServiceManager = xContext->getServiceManager();
-
- if ( xServiceManager.is() ) {
- m_xConfigurationProvider = Reference< XMultiServiceFactory > (
- xServiceManager->createInstanceWithContext(
- OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.configuration.ConfigurationProvider")), xContext ),
- UNO_QUERY );
- }
+ m_xConfigurationProvider = theDefaultProvider::get(xContext);
}
//-------------------------------------------------
diff --git a/svl/source/config/itemholder2.cxx b/svl/source/config/itemholder2.cxx
index 96f75247cef1..1659d0a89134 100644
--- a/svl/source/config/itemholder2.cxx
+++ b/svl/source/config/itemholder2.cxx
@@ -22,6 +22,7 @@
#include <comphelper/processfactory.hxx>
#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <svl/cjkoptions.hxx>
#include <svl/ctloptions.hxx>
@@ -42,12 +43,9 @@ ItemHolder2::ItemHolder2()
{
try
{
- css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
- css::uno::Reference< css::lang::XComponent > xCfg(
- xSMGR->createInstance(::rtl::OUString("com.sun.star.configuration.ConfigurationProvider")),
- css::uno::UNO_QUERY);
- if (xCfg.is())
- xCfg->addEventListener(static_cast< css::lang::XEventListener* >(this));
+ css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
+ css::uno::Reference< css::lang::XComponent > xCfg( css::configuration::theDefaultProvider::get(xContext), css::uno::UNO_QUERY_THROW );
+ xCfg->addEventListener(static_cast< css::lang::XEventListener* >(this));
}
catch(const css::uno::RuntimeException&)
{
diff --git a/svtools/source/config/itemholder2.cxx b/svtools/source/config/itemholder2.cxx
index 14d7c950a74b..2fcbfb8a8d45 100644
--- a/svtools/source/config/itemholder2.cxx
+++ b/svtools/source/config/itemholder2.cxx
@@ -31,6 +31,7 @@
#include <comphelper/processfactory.hxx>
#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <svtools/accessibilityoptions.hxx>
#include <svtools/apearcfg.hxx>
@@ -58,12 +59,11 @@ ItemHolder2::ItemHolder2()
{
try
{
- css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
+ css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
css::uno::Reference< css::lang::XComponent > xCfg(
- xSMGR->createInstance(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ))),
- css::uno::UNO_QUERY);
- if (xCfg.is())
- xCfg->addEventListener(static_cast< css::lang::XEventListener* >(this));
+ css::configuration::theDefaultProvider::get( xContext ),
+ css::uno::UNO_QUERY_THROW );
+ xCfg->addEventListener(static_cast< css::lang::XEventListener* >(this));
}
catch(const css::uno::RuntimeException&)
{
diff --git a/svtools/source/dialogs/insdlg.cxx b/svtools/source/dialogs/insdlg.cxx
index 460b183cea84..a5e1f0eaafdb 100644
--- a/svtools/source/dialogs/insdlg.cxx
+++ b/svtools/source/dialogs/insdlg.cxx
@@ -37,6 +37,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/container/XNameAccess.hpp>
@@ -118,89 +119,83 @@ void SvObjectServerList::FillInsertObjects()
*/
{
try{
- uno::Reference< lang::XMultiServiceFactory > _globalMSFactory= comphelper::getProcessServiceFactory();
- if( _globalMSFactory.is())
- {
- ::rtl::OUString sProviderService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ));
- uno::Reference< lang::XMultiServiceFactory > sProviderMSFactory(
- _globalMSFactory->createInstance( sProviderService ), uno::UNO_QUERY );
+ uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
+
+ uno::Reference< lang::XMultiServiceFactory > sProviderMSFactory =
+ configuration::theDefaultProvider::get(xContext);
+
+ ::rtl::OUString sReaderService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationAccess" ));
+ uno::Sequence< uno::Any > aArguments( 1 );
+ beans::PropertyValue aPathProp;
+ aPathProp.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ));
+ aPathProp.Value <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Embedding/ObjectNames" ));
+ aArguments[0] <<= aPathProp;
+
+ uno::Reference< container::XNameAccess > xNameAccess(
+ sProviderMSFactory->createInstanceWithArguments( sReaderService,aArguments ),
+ uno::UNO_QUERY );
- if( sProviderMSFactory.is())
+ if( xNameAccess.is())
{
- ::rtl::OUString sReaderService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationAccess" ));
- uno::Sequence< uno::Any > aArguments( 1 );
- beans::PropertyValue aPathProp;
- aPathProp.Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ));
- aPathProp.Value <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Embedding/ObjectNames" ));
- aArguments[0] <<= aPathProp;
-
- uno::Reference< container::XNameAccess > xNameAccess(
- sProviderMSFactory->createInstanceWithArguments( sReaderService,aArguments ),
- uno::UNO_QUERY );
-
- if( xNameAccess.is())
- {
- uno::Sequence< ::rtl::OUString > seqNames= xNameAccess->getElementNames();
- sal_Int32 nInd;
+ uno::Sequence< ::rtl::OUString > seqNames= xNameAccess->getElementNames();
+ sal_Int32 nInd;
- ::rtl::OUString aStringProductName( RTL_CONSTASCII_USTRINGPARAM( "%PRODUCTNAME" ) );
- sal_Int32 nStringProductNameLength = aStringProductName.getLength();
+ ::rtl::OUString aStringProductName( RTL_CONSTASCII_USTRINGPARAM( "%PRODUCTNAME" ) );
+ sal_Int32 nStringProductNameLength = aStringProductName.getLength();
- ::rtl::OUString aStringProductVersion( RTL_CONSTASCII_USTRINGPARAM( "%PRODUCTVERSION" ) );
- sal_Int32 nStringProductVersionLength = aStringProductVersion.getLength();
+ ::rtl::OUString aStringProductVersion( RTL_CONSTASCII_USTRINGPARAM( "%PRODUCTVERSION" ) );
+ sal_Int32 nStringProductVersionLength = aStringProductVersion.getLength();
- for( nInd = 0; nInd < seqNames.getLength(); nInd++ )
+ for( nInd = 0; nInd < seqNames.getLength(); nInd++ )
+ {
+ uno::Reference< container::XNameAccess > xEntry ;
+ xNameAccess->getByName( seqNames[nInd] ) >>= xEntry;
+ if ( xEntry.is() )
{
- uno::Reference< container::XNameAccess > xEntry ;
- xNameAccess->getByName( seqNames[nInd] ) >>= xEntry;
- if ( xEntry.is() )
- {
- ::rtl::OUString aUIName;
- ::rtl::OUString aClassID;
- xEntry->getByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ObjectUIName" )) ) >>= aUIName;
- xEntry->getByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ClassID" )) ) >>= aClassID;
+ ::rtl::OUString aUIName;
+ ::rtl::OUString aClassID;
+ xEntry->getByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ObjectUIName" )) ) >>= aUIName;
+ xEntry->getByName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ClassID" )) ) >>= aClassID;
- if ( !aUIName.isEmpty() )
+ if ( !aUIName.isEmpty() )
+ {
+ // replace %PRODUCTNAME
+ sal_Int32 nIndex = aUIName.indexOf( aStringProductName );
+ while( nIndex != -1 )
{
- // replace %PRODUCTNAME
- sal_Int32 nIndex = aUIName.indexOf( aStringProductName );
- while( nIndex != -1 )
- {
- aUIName = aUIName.replaceAt(
- nIndex, nStringProductNameLength,
- utl::ConfigManager::getProductName() );
- nIndex = aUIName.indexOf( aStringProductName );
- }
-
- // replace %PRODUCTVERSION
- nIndex = aUIName.indexOf( aStringProductVersion );
- while( nIndex != -1 )
- {
- aUIName = aUIName.replaceAt(
- nIndex, nStringProductVersionLength,
- utl::ConfigManager::getProductVersion() );
- nIndex = aUIName.indexOf( aStringProductVersion );
- }
+ aUIName = aUIName.replaceAt(
+ nIndex, nStringProductNameLength,
+ utl::ConfigManager::getProductName() );
+ nIndex = aUIName.indexOf( aStringProductName );
}
- SvGlobalName aClassName;
- if( aClassName.MakeId( String( aClassID )))
+ // replace %PRODUCTVERSION
+ nIndex = aUIName.indexOf( aStringProductVersion );
+ while( nIndex != -1 )
{
- if( !Get( aClassName ) )
- // noch nicht eingetragen
- aObjectServerList.push_back( SvObjectServer( aClassName, aUIName ) );
+ aUIName = aUIName.replaceAt(
+ nIndex, nStringProductVersionLength,
+ utl::ConfigManager::getProductVersion() );
+ nIndex = aUIName.indexOf( aStringProductVersion );
}
}
+
+ SvGlobalName aClassName;
+ if( aClassName.MakeId( String( aClassID )))
+ {
+ if( !Get( aClassName ) )
+ // noch nicht eingetragen
+ aObjectServerList.push_back( SvObjectServer( aClassName, aUIName ) );
+ }
}
}
}
- }
#ifdef WNT
- SvGlobalName aOleFact( SO3_OUT_CLASSID );
- String aOleObj( SVT_RESSTR( STR_FURTHER_OBJECT ) );
- aObjectServerList.push_back( SvObjectServer( aOleFact, aOleObj ) );
+ SvGlobalName aOleFact( SO3_OUT_CLASSID );
+ String aOleObj( SVT_RESSTR( STR_FURTHER_OBJECT ) );
+ aObjectServerList.push_back( SvObjectServer( aOleFact, aOleObj ) );
#endif
}catch(const container::NoSuchElementException&)
diff --git a/svtools/source/filter/FilterConfigCache.cxx b/svtools/source/filter/FilterConfigCache.cxx
index f0b6a5fbcf86..fb6352ec5a4f 100644
--- a/svtools/source/filter/FilterConfigCache.cxx
+++ b/svtools/source/filter/FilterConfigCache.cxx
@@ -33,11 +33,13 @@
#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
using namespace ::com::sun::star::lang ; // XMultiServiceFactory
using namespace ::com::sun::star::container ; // XNameAccess
using namespace ::com::sun::star::uno ; // Reference
using namespace ::com::sun::star::beans ; // PropertyValue
+using namespace ::com::sun::star::configuration ;
using ::rtl::OUString;
const char* FilterConfigCache::FilterConfigCacheEntry::InternalPixelFilterNameList[] =
@@ -127,32 +129,28 @@ String FilterConfigCache::FilterConfigCacheEntry::GetShortName()
Reference< XInterface > openConfig(const char* sPackage)
throw(RuntimeException)
{
- Reference< XMultiServiceFactory > xSMGR(
- comphelper::getProcessServiceFactory() );
+ Reference< XComponentContext > xContext(
+ comphelper::getProcessComponentContext() );
Reference< XInterface > xCfg;
try
{
// get access to config API (not to file!)
- Reference< XMultiServiceFactory > xConfigProvider( xSMGR->createInstance(
- OUString( "com.sun.star.configuration.ConfigurationProvider" )), UNO_QUERY);
-
- if (xConfigProvider.is())
- {
- Sequence< Any > lParams(1);
- PropertyValue aParam ;
-
- // define cfg path for open
- aParam.Name = OUString( "nodepath" );
- if (rtl_str_compareIgnoreAsciiCase(sPackage, "types") == 0)
- aParam.Value <<= OUString( "/org.openoffice.TypeDetection.Types/Types" );
- if (rtl_str_compareIgnoreAsciiCase(sPackage, "filters") == 0)
- aParam.Value <<= OUString( "/org.openoffice.TypeDetection.GraphicFilter/Filters" );
- lParams[0] = makeAny(aParam);
-
- // get access to file
- xCfg = xConfigProvider->createInstanceWithArguments(
- OUString( "com.sun.star.configuration.ConfigurationAccess" ), lParams);
- }
+ Reference< XMultiServiceFactory > xConfigProvider = theDefaultProvider::get( xContext );
+
+ Sequence< Any > lParams(1);
+ PropertyValue aParam ;
+
+ // define cfg path for open
+ aParam.Name = OUString( "nodepath" );
+ if (rtl_str_compareIgnoreAsciiCase(sPackage, "types") == 0)
+ aParam.Value <<= OUString( "/org.openoffice.TypeDetection.Types/Types" );
+ if (rtl_str_compareIgnoreAsciiCase(sPackage, "filters") == 0)
+ aParam.Value <<= OUString( "/org.openoffice.TypeDetection.GraphicFilter/Filters" );
+ lParams[0] = makeAny(aParam);
+
+ // get access to file
+ xCfg = xConfigProvider->createInstanceWithArguments(
+ OUString( "com.sun.star.configuration.ConfigurationAccess" ), lParams);
}
catch(const RuntimeException&)
{ throw; }
diff --git a/svtools/source/filter/FilterConfigItem.cxx b/svtools/source/filter/FilterConfigItem.cxx
index 275bcebdebbf..108b3dd29127 100644
--- a/svtools/source/filter/FilterConfigItem.cxx
+++ b/svtools/source/filter/FilterConfigItem.cxx
@@ -32,6 +32,7 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/util/XChangesBatch.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
@@ -45,6 +46,7 @@ using namespace ::com::sun::star::uno ; // Reference
using namespace ::com::sun::star::util ; // XChangesBatch
using namespace ::com::sun::star::awt ; // Size
using namespace ::com::sun::star::container ; //
+using namespace ::com::sun::star::configuration; //
using namespace ::com::sun::star::task ; // XStatusIndicator
static sal_Bool ImpIsTreeAvailable( Reference< XMultiServiceFactory >& rXCfgProv, const rtl::OUString& rTree )
@@ -122,50 +124,44 @@ void FilterConfigItem::ImpInitTree( const String& rSubTree )
{
bModified = sal_False;
- Reference< XMultiServiceFactory > xSMGR(
- comphelper::getProcessServiceFactory() );
+ Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() );
- Reference< XMultiServiceFactory > xCfgProv(
- xSMGR->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) ) ),
- UNO_QUERY );
+ Reference< XMultiServiceFactory > xCfgProv = theDefaultProvider::get( xContext );
- if ( xCfgProv.is() )
+ OUString sTree(
+ OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.")) +
+ rSubTree);
+ if ( ImpIsTreeAvailable(xCfgProv, sTree) )
{
- OUString sTree(
- OUString(RTL_CONSTASCII_USTRINGPARAM("/org.openoffice.")) +
- rSubTree);
- if ( ImpIsTreeAvailable(xCfgProv, sTree) )
- {
- Any aAny;
- // creation arguments: nodepath
- PropertyValue aPathArgument;
- aAny <<= sTree;
- aPathArgument.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) );
- aPathArgument.Value = aAny;
-
- // creation arguments: commit mode
- PropertyValue aModeArgument;
- sal_Bool bAsyncron = sal_True;
- aAny <<= bAsyncron;
- aModeArgument.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "lazywrite" ) );
- aModeArgument.Value = aAny;
-
- Sequence< Any > aArguments( 2 );
- aArguments[ 0 ] <<= aPathArgument;
- aArguments[ 1 ] <<= aModeArgument;
+ Any aAny;
+ // creation arguments: nodepath
+ PropertyValue aPathArgument;
+ aAny <<= sTree;
+ aPathArgument.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) );
+ aPathArgument.Value = aAny;
- try
- {
- xUpdatableView = xCfgProv->createInstanceWithArguments(
- OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess" ) ),
- aArguments );
- if ( xUpdatableView.is() )
- xPropSet = Reference< XPropertySet >( xUpdatableView, UNO_QUERY );
- }
- catch ( ::com::sun::star::uno::Exception& )
- {
- OSL_FAIL( "FilterConfigItem::FilterConfigItem - Could not access configuration Key" );
- }
+ // creation arguments: commit mode
+ PropertyValue aModeArgument;
+ sal_Bool bAsyncron = sal_True;
+ aAny <<= bAsyncron;
+ aModeArgument.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "lazywrite" ) );
+ aModeArgument.Value = aAny;
+
+ Sequence< Any > aArguments( 2 );
+ aArguments[ 0 ] <<= aPathArgument;
+ aArguments[ 1 ] <<= aModeArgument;
+
+ try
+ {
+ xUpdatableView = xCfgProv->createInstanceWithArguments(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess" ) ),
+ aArguments );
+ if ( xUpdatableView.is() )
+ xPropSet = Reference< XPropertySet >( xUpdatableView, UNO_QUERY );
+ }
+ catch ( ::com::sun::star::uno::Exception& )
+ {
+ OSL_FAIL( "FilterConfigItem::FilterConfigItem - Could not access configuration Key" );
}
}
}
diff --git a/svx/source/dialog/srchdlg.cxx b/svx/source/dialog/srchdlg.cxx
index b6aae0b4b176..1a092e6fb3b5 100644
--- a/svx/source/dialog/srchdlg.cxx
+++ b/svx/source/dialog/srchdlg.cxx
@@ -46,6 +46,7 @@
#include <com/sun/star/frame/XDispatch.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/frame/ModuleManager.hpp>
#include <comphelper/processfactory.hxx>
#include <svl/itempool.hxx>
@@ -461,9 +462,8 @@ void SvxSearchDialog::Construct_Impl()
try
{
uno::Reference< lang::XMultiServiceFactory > xMgr = getProcessServiceFactory();
- uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider(xMgr->createInstance(
- ::rtl::OUString( "com.sun.star.configuration.ConfigurationProvider")),
- uno::UNO_QUERY);
+ uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider =
+ configuration::theDefaultProvider::get( comphelper::getComponentContext(xMgr) );
uno::Sequence< uno::Any > aArgs(1);
::rtl::OUString sPath( "/org.openoffice.Office.Common/SearchOptions/");
aArgs[0] <<= sPath;
diff --git a/svx/source/smarttags/SmartTagMgr.cxx b/svx/source/smarttags/SmartTagMgr.cxx
index 6fcbcb8dd8d4..229214f19616 100644
--- a/svx/source/smarttags/SmartTagMgr.cxx
+++ b/svx/source/smarttags/SmartTagMgr.cxx
@@ -34,6 +34,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XSingleComponentFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/container/XContentEnumerationAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -382,10 +383,7 @@ void SmartTagMgr::PrepareConfiguration( const rtl::OUString& rConfigurationGroup
aPathArgument.Value = aAny;
Sequence< Any > aArguments( 1 );
aArguments[ 0 ] <<= aPathArgument;
- Reference< lang::XMultiServiceFactory > xConfProv( mxContext->getServiceManager()->createInstanceWithContext("com.sun.star.configuration.ConfigurationProvider", mxContext), UNO_QUERY );
-
- if ( !xConfProv.is() )
- return;
+ Reference< lang::XMultiServiceFactory > xConfProv = configuration::theDefaultProvider::get( mxContext );
// try to get read-write access to configuration:
Reference< XInterface > xConfigurationAccess;
diff --git a/ucb/source/core/ucb.cxx b/ucb/source/core/ucb.cxx
index ee3926c639ad..8a30605561b1 100644
--- a/ucb/source/core/ucb.cxx
+++ b/ucb/source/core/ucb.cxx
@@ -24,6 +24,7 @@
*************************************************************************/
#include <osl/diagnose.h>
+#include <comphelper/processfactory.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/ucb/GlobalTransferCommandArgument2.hpp>
@@ -33,6 +34,7 @@
#include <com/sun/star/ucb/XParameterizedContentProvider.hpp>
#include <com/sun/star/ucb/XContentProviderFactory.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/uno/Any.hxx>
@@ -878,11 +880,8 @@ bool UniversalContentBroker::getContentProviderData(
try
{
- uno::Reference< lang::XMultiServiceFactory > xConfigProv(
- m_xSMgr->createInstance(
- OUString(
- "com.sun.star.configuration.ConfigurationProvider" ) ),
- uno::UNO_QUERY_THROW );
+ uno::Reference< lang::XMultiServiceFactory > xConfigProv =
+ configuration::theDefaultProvider::get( comphelper::getComponentContext(m_xSMgr) );
OUStringBuffer aFullPath;
aFullPath.appendAscii( CONFIG_CONTENTPROVIDERS_KEY "/['" );
diff --git a/ucb/source/ucp/ftp/ftpcontentprovider.cxx b/ucb/source/ucp/ftp/ftpcontentprovider.cxx
index 9eff7864dc85..ee57e6d263c9 100644
--- a/ucb/source/ucp/ftp/ftpcontentprovider.cxx
+++ b/ucb/source/ucp/ftp/ftpcontentprovider.cxx
@@ -178,7 +178,7 @@ FTPContentProvider::queryContent(
void FTPContentProvider::init() {
m_ftpLoaderThread = new FTPLoaderThread();
- m_pProxyDecider = new ucbhelper::InternetProxyDecider(m_xSMgr);
+ m_pProxyDecider = new ucbhelper::InternetProxyDecider(comphelper::getComponentContext(m_xSMgr));
}
diff --git a/ucb/source/ucp/hierarchy/hierarchydatasource.cxx b/ucb/source/ucp/hierarchy/hierarchydatasource.cxx
index 574cff078a54..a6fd1d376ca1 100644
--- a/ucb/source/ucp/hierarchy/hierarchydatasource.cxx
+++ b/ucb/source/ucp/hierarchy/hierarchydatasource.cxx
@@ -30,8 +30,10 @@
#include <osl/diagnose.h>
#include "osl/doublecheckedlocking.h"
+#include <comphelper/processfactory.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/util/XChangesBatch.hpp>
@@ -50,8 +52,6 @@ using namespace hierarchy_ucp;
#define READ_SERVICE_NAME "com.sun.star.ucb.HierarchyDataReadAccess"
#define READWRITE_SERVICE_NAME "com.sun.star.ucb.HierarchyDataReadWriteAccess"
-#define CONFIG_PROVIDER_SERVICE_NAME \
- "com.sun.star.configuration.ConfigurationProvider"
#define CONFIG_READ_SERVICE_NAME \
"com.sun.star.configuration.ConfigurationAccess"
#define CONFIG_READWRITE_SERVICE_NAME \
@@ -213,8 +213,8 @@ using namespace hcp_impl;
//=========================================================================
HierarchyDataSource::HierarchyDataSource(
- const uno::Reference< lang::XMultiServiceFactory > & rxServiceMgr )
-: m_xSMgr( rxServiceMgr ),
+ const uno::Reference< uno::XComponentContext > & rxContext )
+: m_xContext( rxContext ),
m_pDisposeEventListeners( 0 )
{
}
@@ -256,7 +256,7 @@ XTYPEPROVIDER_IMPL_4( HierarchyDataSource,
//
//=========================================================================
-XSERVICEINFO_IMPL_0( HierarchyDataSource,
+XSERVICEINFO_IMPL_0_CTX( HierarchyDataSource,
rtl::OUString( "com.sun.star.comp.ucb.HierarchyDataSource" ) )
{
uno::Sequence< rtl::OUString > aSNS( 2 );
@@ -524,15 +524,7 @@ HierarchyDataSource::getConfigProvider()
{
try
{
- m_xConfigProvider
- = uno::Reference< lang::XMultiServiceFactory >(
- m_xSMgr->createInstance(
- rtl::OUString( CONFIG_PROVIDER_SERVICE_NAME ) ),
- uno::UNO_QUERY );
-
- OSL_ENSURE( m_xConfigProvider.is(),
- "HierarchyDataSource::getConfigProvider - "
- "No configuration provider!" );
+ m_xConfigProvider = configuration::theDefaultProvider::get( m_xContext );
}
catch ( uno::Exception const & )
{
diff --git a/ucb/source/ucp/hierarchy/hierarchydatasource.hxx b/ucb/source/ucp/hierarchy/hierarchydatasource.hxx
index f8994a882eaf..65b00d3d6ea4 100644
--- a/ucb/source/ucp/hierarchy/hierarchydatasource.hxx
+++ b/ucb/source/ucp/hierarchy/hierarchydatasource.hxx
@@ -25,6 +25,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/weak.hxx>
#include <ucbhelper/macros.hxx>
@@ -42,15 +43,15 @@ class HierarchyDataSource : public cppu::OWeakObject,
{
osl::Mutex m_aMutex;
com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+ com::sun::star::uno::XComponentContext > m_xContext;
com::sun::star::uno::Reference<
com::sun::star::lang::XMultiServiceFactory > m_xConfigProvider;
cppu::OInterfaceContainerHelper * m_pDisposeEventListeners;
public:
HierarchyDataSource( const com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory > &
- rxServiceMgr );
+ com::sun::star::uno::XComponentContext > &
+ rxContext );
virtual ~HierarchyDataSource();
// XInterface
diff --git a/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx b/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx
index b001e1444f2e..96fdd68d10af 100644
--- a/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx
+++ b/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx
@@ -139,12 +139,12 @@ int DAVAuthListener_Impl::authenticate(
//=========================================================================
DAVResourceAccess::DAVResourceAccess(
- const uno::Reference< lang::XMultiServiceFactory > & rSMgr,
+ const uno::Reference< uno::XComponentContext > & rxContext,
rtl::Reference< DAVSessionFactory > const & rSessionFactory,
const rtl::OUString & rURL )
: m_aURL( rURL ),
m_xSessionFactory( rSessionFactory ),
- m_xSMgr( rSMgr )
+ m_xContext( rxContext )
{
}
@@ -155,7 +155,7 @@ DAVResourceAccess::DAVResourceAccess( const DAVResourceAccess & rOther )
m_aFlags( rOther.m_aFlags ),
m_xSession( rOther.m_xSession ),
m_xSessionFactory( rOther.m_xSessionFactory ),
- m_xSMgr( rOther.m_xSMgr ),
+ m_xContext( rOther.m_xContext ),
m_aRedirectURIs( rOther.m_aRedirectURIs )
{
}
@@ -169,7 +169,7 @@ DAVResourceAccess & DAVResourceAccess::operator=(
m_aFlags = rOther.m_aFlags;
m_xSession = rOther.m_xSession;
m_xSessionFactory = rOther.m_xSessionFactory;
- m_xSMgr = rOther.m_xSMgr;
+ m_xContext = rOther.m_xContext;
m_aRedirectURIs = rOther.m_aRedirectURIs;
return *this;
@@ -598,7 +598,7 @@ void DAVResourceAccess::PUT(
// Make stream seekable, if it not. Needed, if request must be retried.
uno::Reference< io::XInputStream > xSeekableStream
= comphelper::OSeekableInputWrapper::CheckSeekableCanWrap(
- rStream, comphelper::getComponentContext(m_xSMgr) );
+ rStream, m_xContext );
int errorCount = 0;
bool bRetry = false;
@@ -647,7 +647,7 @@ uno::Reference< io::XInputStream > DAVResourceAccess::POST(
// Make stream seekable, if it not. Needed, if request must be retried.
uno::Reference< io::XInputStream > xSeekableStream
= comphelper::OSeekableInputWrapper::CheckSeekableCanWrap(
- rInputStream, comphelper::getComponentContext(m_xSMgr) );
+ rInputStream, m_xContext );
uno::Reference< io::XInputStream > xStream;
int errorCount = 0;
@@ -711,7 +711,7 @@ void DAVResourceAccess::POST(
// Make stream seekable, if it not. Needed, if request must be retried.
uno::Reference< io::XInputStream > xSeekableStream
= comphelper::OSeekableInputWrapper::CheckSeekableCanWrap(
- rInputStream, comphelper::getComponentContext(m_xSMgr) );
+ rInputStream, m_xContext );
int errorCount = 0;
bool bRetry = false;
@@ -1082,7 +1082,7 @@ void DAVResourceAccess::initialize()
// create new webdav session
m_xSession
- = m_xSessionFactory->createDAVSession( m_aURL, m_aFlags, m_xSMgr );
+ = m_xSessionFactory->createDAVSession( m_aURL, m_aFlags, m_xContext );
if ( !m_xSession.is() )
return;
diff --git a/ucb/source/ucp/webdav-neon/DAVResourceAccess.hxx b/ucb/source/ucp/webdav-neon/DAVResourceAccess.hxx
index 30770b06e3c1..99446236bf69 100644
--- a/ucb/source/ucp/webdav-neon/DAVResourceAccess.hxx
+++ b/ucb/source/ucp/webdav-neon/DAVResourceAccess.hxx
@@ -59,13 +59,13 @@ class DAVResourceAccess
rtl::Reference< DAVSession > m_xSession;
rtl::Reference< DAVSessionFactory > m_xSessionFactory;
com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+ com::sun::star::uno::XComponentContext > m_xContext;
std::vector< NeonUri > m_aRedirectURIs;
public:
DAVResourceAccess() : m_xSessionFactory( 0 ) {}
DAVResourceAccess( const com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory > & rSMgr,
+ com::sun::star::uno::XComponentContext > & rxContext,
rtl::Reference<
DAVSessionFactory > const & rSessionFactory,
const rtl::OUString & rURL );
diff --git a/ucb/source/ucp/webdav-neon/DAVSessionFactory.cxx b/ucb/source/ucp/webdav-neon/DAVSessionFactory.cxx
index 661799ae58d8..2534af78f628 100644
--- a/ucb/source/ucp/webdav-neon/DAVSessionFactory.cxx
+++ b/ucb/source/ucp/webdav-neon/DAVSessionFactory.cxx
@@ -41,15 +41,15 @@ DAVSessionFactory::~DAVSessionFactory()
rtl::Reference< DAVSession > DAVSessionFactory::createDAVSession(
const ::rtl::OUString & inUri,
const uno::Sequence< beans::NamedValue >& rFlags,
- const uno::Reference< lang::XMultiServiceFactory > & rxSMgr )
+ const uno::Reference< uno::XComponentContext > & rxContext )
throw( DAVException )
{
- m_xMSF = rxSMgr;
+ m_xContext = rxContext;
osl::MutexGuard aGuard( m_aMutex );
if ( !m_xProxyDecider.get() )
- m_xProxyDecider.reset( new ucbhelper::InternetProxyDecider( rxSMgr ) );
+ m_xProxyDecider.reset( new ucbhelper::InternetProxyDecider( rxContext ) );
Map::iterator aIt( m_aMap.begin() );
Map::iterator aEnd( m_aMap.end() );
diff --git a/ucb/source/ucp/webdav-neon/DAVSessionFactory.hxx b/ucb/source/ucp/webdav-neon/DAVSessionFactory.hxx
index 4e642c42af86..c29ec718e86f 100644
--- a/ucb/source/ucp/webdav-neon/DAVSessionFactory.hxx
+++ b/ucb/source/ucp/webdav-neon/DAVSessionFactory.hxx
@@ -62,13 +62,11 @@ public:
rtl::Reference< DAVSession >
createDAVSession( const ::rtl::OUString & inUri,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rFlags,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XMultiServiceFactory >&
- rxSMgr )
+ const ::uno::Sequence< ::com::sun::star::beans::NamedValue >& rFlags,
+ const ::uno::Reference< ::uno::XComponentContext >& rxContext )
throw( DAVException );
- ::uno::Reference< ::lang::XMultiServiceFactory > getServiceFactory() { return m_xMSF; }
+ ::uno::Reference< ::uno::XComponentContext > getComponentContext() { return m_xContext; }
private:
typedef std::map< rtl::OUString, DAVSession * > Map;
@@ -76,7 +74,7 @@ private:
osl::Mutex m_aMutex;
std::auto_ptr< ucbhelper::InternetProxyDecider > m_xProxyDecider;
- ::uno::Reference< ::lang::XMultiServiceFactory > m_xMSF;
+ ::uno::Reference< ::uno::XComponentContext > m_xContext;
void releaseElement( DAVSession * pElement ) SAL_THROW(());
diff --git a/ucb/source/ucp/webdav-neon/NeonSession.cxx b/ucb/source/ucp/webdav-neon/NeonSession.cxx
index d05973fc53f7..0d6f931d0635 100644
--- a/ucb/source/ucp/webdav-neon/NeonSession.cxx
+++ b/ucb/source/ucp/webdav-neon/NeonSession.cxx
@@ -407,7 +407,7 @@ extern "C" int NeonSession_CertificationNotify( void *userdata,
uno::Reference< security::XCertificateContainer > xCertificateContainer;
try
{
- xCertificateContainer = security::CertificateContainer::create( comphelper::getComponentContext( pSession->getMSF() ) );
+ xCertificateContainer = security::CertificateContainer::create( pSession->getComponentContext() );
}
catch ( uno::Exception const & )
{
@@ -437,8 +437,8 @@ extern "C" int NeonSession_CertificationNotify( void *userdata,
try
{
xSEInitializer = uno::Reference< xml::crypto::XSEInitializer >(
- pSession->getMSF()->createInstance(
- rtl::OUString( SEINITIALIZER_COMPONENT ) ),
+ pSession->getComponentContext()->getServiceManager()->createInstanceWithContext(
+ SEINITIALIZER_COMPONENT, pSession->getComponentContext()),
uno::UNO_QUERY );
}
catch ( uno::Exception const & )
diff --git a/ucb/source/ucp/webdav-neon/NeonSession.hxx b/ucb/source/ucp/webdav-neon/NeonSession.hxx
index f15eac408c4e..15c88bb72ffc 100644
--- a/ucb/source/ucp/webdav-neon/NeonSession.hxx
+++ b/ucb/source/ucp/webdav-neon/NeonSession.hxx
@@ -225,8 +225,8 @@ public:
const rtl::OUString & getHostName() const { return m_aHostName; }
- const ::uno::Reference< ::lang::XMultiServiceFactory > getMSF()
- { return m_xFactory->getServiceFactory(); }
+ const ::uno::Reference< ::uno::XComponentContext > getComponentContext()
+ { return m_xFactory->getComponentContext(); }
const void * getRequestData() const { return m_pRequestData; }
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
index bfabf8cedfac..9034c8632d1f 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
@@ -117,7 +117,7 @@ Content::Content(
try
{
m_xResAccess.reset( new DAVResourceAccess(
- rxSMgr,
+ comphelper::getComponentContext(rxSMgr),
rSessionFactory,
Identifier->getContentIdentifier() ) );
@@ -149,7 +149,7 @@ Content::Content(
try
{
m_xResAccess.reset( new DAVResourceAccess(
- rxSMgr, rSessionFactory, Identifier->getContentIdentifier() ) );
+ comphelper::getComponentContext(rxSMgr), rSessionFactory, Identifier->getContentIdentifier() ) );
}
catch ( DAVException const & )
{
@@ -2514,7 +2514,7 @@ void Content::transfer(
uno::Reference< ucb::XContentIdentifier > xTargetId
= new ::ucbhelper::ContentIdentifier( xSMgr, aTargetURL );
- DAVResourceAccess aSourceAccess( xSMgr,
+ DAVResourceAccess aSourceAccess( comphelper::getComponentContext(xSMgr),
xResAccess->getSessionFactory(),
sourceURI.GetURI() );
diff --git a/ucbhelper/inc/ucbhelper/macros.hxx b/ucbhelper/inc/ucbhelper/macros.hxx
index b2cb7cb89346..924989ae6d0f 100644
--- a/ucbhelper/inc/ucbhelper/macros.hxx
+++ b/ucbhelper/inc/ucbhelper/macros.hxx
@@ -656,6 +656,19 @@ Class##_CreateInstance( const com::sun::star::uno::Reference< \
com::sun::star::uno::XInterface >::query( pX ); \
}
+#define XSERVICEINFO_CREATE_INSTANCE_IMPL_CTX( Class ) \
+static com::sun::star::uno::Reference< \
+ com::sun::star::uno::XInterface > SAL_CALL \
+Class##_CreateInstance( const com::sun::star::uno::Reference< \
+ com::sun::star::lang::XMultiServiceFactory> & rSMgr ) \
+ throw( com::sun::star::uno::Exception ) \
+{ \
+ com::sun::star::lang::XServiceInfo* pX = \
+ (com::sun::star::lang::XServiceInfo*)new Class( comphelper::getComponentContext(rSMgr) ); \
+ return com::sun::star::uno::Reference< \
+ com::sun::star::uno::XInterface >::query( pX ); \
+}
+
//=========================================================================
//
// XServiceInfo impl.
@@ -708,6 +721,14 @@ XSERVICEINFO_CREATE_INSTANCE_IMPL( Class ) \
com::sun::star::uno::Sequence< rtl::OUString > \
Class::getSupportedServiceNames_Static()
+// Own implementation of getSupportedServiceNames_Static().
+#define XSERVICEINFO_IMPL_0_CTX( Class, ImplName ) \
+XSERVICEINFO_COMMOM_IMPL( Class, ImplName ) \
+XSERVICEINFO_CREATE_INSTANCE_IMPL_CTX( Class ) \
+ \
+com::sun::star::uno::Sequence< rtl::OUString > \
+Class::getSupportedServiceNames_Static()
+
// 1 service name
#define XSERVICEINFO_IMPL_1( Class, ImplName, Service1 ) \
XSERVICEINFO_COMMOM_IMPL( Class, ImplName ) \
diff --git a/ucbhelper/inc/ucbhelper/proxydecider.hxx b/ucbhelper/inc/ucbhelper/proxydecider.hxx
index fa3d6a03e745..fd59eae29b89 100644
--- a/ucbhelper/inc/ucbhelper/proxydecider.hxx
+++ b/ucbhelper/inc/ucbhelper/proxydecider.hxx
@@ -22,6 +22,7 @@
#include <rtl/ustring.hxx>
#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include "ucbhelper/ucbhelperdllapi.h"
namespace com { namespace sun { namespace star { namespace lang {
@@ -76,7 +77,7 @@ public:
* @param rxSMgr is a Service Manager.
*/
InternetProxyDecider( const ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XMultiServiceFactory >& rxSMgr );
+ ::com::sun::star::uno::XComponentContext >& rxContext );
/**
* Destructor.
diff --git a/ucbhelper/source/client/proxydecider.cxx b/ucbhelper/source/client/proxydecider.cxx
index b67e10929acc..4230eac91108 100644
--- a/ucbhelper/source/client/proxydecider.cxx
+++ b/ucbhelper/source/client/proxydecider.cxx
@@ -32,6 +32,7 @@
#include <osl/socket.hxx>
#include <rtl/ustrbuf.hxx>
#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/util/XChangesListener.hpp>
#include <com/sun/star/util/XChangesNotifier.hpp>
@@ -138,7 +139,7 @@ private:
bool bUseFullyQualified ) const;
public:
InternetProxyDecider_Impl(
- const uno::Reference< lang::XMultiServiceFactory >& rxSMgr );
+ const uno::Reference< uno::XComponentContext >& rxContext );
virtual ~InternetProxyDecider_Impl();
void dispose();
@@ -299,7 +300,7 @@ bool getConfigInt32Value(
//=========================================================================
InternetProxyDecider_Impl::InternetProxyDecider_Impl(
- const uno::Reference< lang::XMultiServiceFactory >& rxSMgr )
+ const uno::Reference< uno::XComponentContext >& rxContext )
: m_nProxyType( 0 ),
m_aHostnames( 256 ) // cache size
{
@@ -309,11 +310,8 @@ InternetProxyDecider_Impl::InternetProxyDecider_Impl(
// Read proxy configuration from config db.
//////////////////////////////////////////////////////////////
- uno::Reference< lang::XMultiServiceFactory > xConfigProv(
- rxSMgr->createInstance(
- rtl::OUString(
- "com.sun.star.configuration.ConfigurationProvider" ) ),
- uno::UNO_QUERY );
+ uno::Reference< lang::XMultiServiceFactory > xConfigProv =
+ configuration::theDefaultProvider::get( rxContext );
uno::Sequence< uno::Any > aArguments( 1 );
aArguments[ 0 ] <<= rtl::OUString( CONFIG_ROOT_KEY );
@@ -794,8 +792,8 @@ void InternetProxyDecider_Impl::setNoProxyList(
//=========================================================================
InternetProxyDecider::InternetProxyDecider(
- const uno::Reference< lang::XMultiServiceFactory >& rxSMgr )
-: m_pImpl( new proxydecider_impl::InternetProxyDecider_Impl( rxSMgr ) )
+ const uno::Reference< uno::XComponentContext>& rxContext )
+: m_pImpl( new proxydecider_impl::InternetProxyDecider_Impl( rxContext ) )
{
m_pImpl->acquire();
}
diff --git a/unotools/inc/unotools/confignode.hxx b/unotools/inc/unotools/confignode.hxx
index f68180cf724a..1189a9b59f0c 100644
--- a/unotools/inc/unotools/confignode.hxx
+++ b/unotools/inc/unotools/confignode.hxx
@@ -25,6 +25,7 @@
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/util/XChangesBatch.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <unotools/eventlisteneradapter.hxx>
namespace comphelper
@@ -301,7 +302,7 @@ namespace utl
the configuration could be initialized, errors in the creation of the specific node (e.g. because the
given node path does not exist) are still asserted.</p>
*/
- static OConfigurationTreeRoot tryCreateWithServiceFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB,
+ static OConfigurationTreeRoot tryCreateWithServiceFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
const ::rtl::OUString& _rPath, sal_Int32 _nDepth = -1, CREATION_MODE _eMode = CM_UPDATABLE, sal_Bool _bLazyWrite = sal_True );
/** commit all changes made on the subtree the object is the root for<p/>
diff --git a/unotools/source/config/configmgr.cxx b/unotools/source/config/configmgr.cxx
index 514ea959547a..a4589601e37c 100644
--- a/unotools/source/config/configmgr.cxx
+++ b/unotools/source/config/configmgr.cxx
@@ -24,6 +24,7 @@
#include "boost/noncopyable.hpp"
#include "com/sun/star/beans/NamedValue.hpp"
#include "com/sun/star/container/XHierarchicalNameAccess.hpp"
+#include "com/sun/star/configuration/theDefaultProvider.hpp"
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
#include "com/sun/star/uno/Any.hxx"
#include "com/sun/star/uno/Reference.hxx"
@@ -64,14 +65,7 @@ private:
css::uno::Reference< css::lang::XMultiServiceFactory >
getConfigurationProvider() {
- return css::uno::Reference< css::lang::XMultiServiceFactory >(
- (css::uno::Reference< css::lang::XMultiServiceFactory >(
- comphelper::getProcessServiceFactory(), css::uno::UNO_SET_THROW)->
- createInstance(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationProvider")))),
- css::uno::UNO_QUERY_THROW);
+ return css::configuration::theDefaultProvider::get( comphelper::getProcessComponentContext() );
}
rtl::OUString getConfigurationString(
diff --git a/unotools/source/config/confignode.cxx b/unotools/source/config/confignode.cxx
index e405b55d5f58..ca87f2744622 100644
--- a/unotools/source/config/confignode.cxx
+++ b/unotools/source/config/confignode.cxx
@@ -24,6 +24,7 @@
#include <osl/diagnose.h>
#include <com/sun/star/container/XHierarchicalName.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/util/XStringEscape.hpp>
@@ -47,6 +48,7 @@ namespace utl
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::container;
+ using namespace ::com::sun::star::configuration;
//========================================================================
//= OConfigurationNode
@@ -479,14 +481,12 @@ namespace utl
//========================================================================
namespace
{
- static const char s_sProviderServiceName[] = "com.sun.star.configuration.ConfigurationProvider";
-
//--------------------------------------------------------------------
Reference< XMultiServiceFactory > lcl_getConfigProvider( const ::comphelper::ComponentContext& i_rContext )
{
try
{
- Reference< XMultiServiceFactory > xProvider( i_rContext.createComponent(s_sProviderServiceName), UNO_QUERY_THROW );
+ Reference< XMultiServiceFactory > xProvider = theDefaultProvider::get( i_rContext.getUNOContext() );
return xProvider;
}
catch ( const Exception& )
@@ -592,22 +592,18 @@ namespace utl
}
//------------------------------------------------------------------------
- OConfigurationTreeRoot OConfigurationTreeRoot::tryCreateWithServiceFactory( const Reference< XMultiServiceFactory >& _rxORB,
+ OConfigurationTreeRoot OConfigurationTreeRoot::tryCreateWithServiceFactory( const Reference< XComponentContext >& rxContext,
const ::rtl::OUString& _rPath, sal_Int32 _nDepth , CREATION_MODE _eMode , sal_Bool _bLazyWrite )
{
- OSL_ENSURE( _rxORB.is(), "OConfigurationTreeRoot::tryCreateWithServiceFactory: invalid service factory!" );
- if ( _rxORB.is() )
+ OSL_ENSURE( rxContext.is(), "OConfigurationTreeRoot::tryCreateWithServiceFactory: invalid service factory!" );
+ try
{
- try
- {
- Reference< XMultiServiceFactory > xConfigFactory( _rxORB->createInstance(s_sProviderServiceName), UNO_QUERY );
- if ( xConfigFactory.is() )
- return createWithProvider( xConfigFactory, _rPath, _nDepth, _eMode, _bLazyWrite );
- }
- catch(const Exception&)
- {
- // silence this, 'cause the contract of this method states "no assertions"
- }
+ Reference< XMultiServiceFactory > xConfigFactory = theDefaultProvider::get( rxContext );
+ return createWithProvider( xConfigFactory, _rPath, _nDepth, _eMode, _bLazyWrite );
+ }
+ catch(const Exception&)
+ {
+ // silence this, 'cause the contract of this method states "no assertions"
}
return OConfigurationTreeRoot();
}
diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx
index 9a4b52c46183..314fed44faa3 100644
--- a/unotools/source/config/fontcfg.cxx
+++ b/unotools/source/config/fontcfg.cxx
@@ -24,6 +24,7 @@
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <unotools/configpaths.hxx>
#include <unotools/syslocale.hxx>
#include <rtl/ustrbuf.hxx>
@@ -43,6 +44,7 @@ using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
using namespace com::sun::star::container;
+using namespace com::sun::star::configuration;
using ::rtl::OUString;
@@ -102,61 +104,51 @@ DefaultFontConfiguration::DefaultFontConfiguration()
try
{
// get service provider
- Reference< XMultiServiceFactory > xSMgr( comphelper::getProcessServiceFactory() );
+ Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() );
// create configuration hierachical access name
- if( xSMgr.is() )
+ try
{
- try
+ m_xConfigProvider = theDefaultProvider::get( xContext );
+ Sequence< Any > aArgs(1);
+ PropertyValue aVal;
+ aVal.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) );
+ aVal.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.VCL/DefaultFonts" ) );
+ aArgs.getArray()[0] <<= aVal;
+ m_xConfigAccess =
+ Reference< XNameAccess >(
+ m_xConfigProvider->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.ConfigurationAccess" )),
+ aArgs ),
+ UNO_QUERY );
+ if( m_xConfigAccess.is() )
{
- m_xConfigProvider =
- Reference< XMultiServiceFactory >(
- xSMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationProvider" ))),
- UNO_QUERY );
- if( m_xConfigProvider.is() )
+ Sequence< OUString > aLocales = m_xConfigAccess->getElementNames();
+ // fill config hash with empty interfaces
+ int nLocales = aLocales.getLength();
+ const OUString* pLocaleStrings = aLocales.getConstArray();
+ Locale aLoc;
+ for( int i = 0; i < nLocales; i++ )
{
- Sequence< Any > aArgs(1);
- PropertyValue aVal;
- aVal.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) );
- aVal.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.VCL/DefaultFonts" ) );
- aArgs.getArray()[0] <<= aVal;
- m_xConfigAccess =
- Reference< XNameAccess >(
- m_xConfigProvider->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationAccess" )),
- aArgs ),
- UNO_QUERY );
- if( m_xConfigAccess.is() )
- {
- Sequence< OUString > aLocales = m_xConfigAccess->getElementNames();
- // fill config hash with empty interfaces
- int nLocales = aLocales.getLength();
- const OUString* pLocaleStrings = aLocales.getConstArray();
- Locale aLoc;
- for( int i = 0; i < nLocales; i++ )
- {
- sal_Int32 nIndex = 0;
- aLoc.Language = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiLowerCase();
- if( nIndex != -1 )
- aLoc.Country = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase();
- else
- aLoc.Country = OUString();
- if( nIndex != -1 )
- aLoc.Variant = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase();
- else
- aLoc.Variant = OUString();
- m_aConfig[ aLoc ] = LocaleAccess();
- m_aConfig[ aLoc ].aConfigLocaleString = pLocaleStrings[i];
- }
- }
+ sal_Int32 nIndex = 0;
+ aLoc.Language = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiLowerCase();
+ if( nIndex != -1 )
+ aLoc.Country = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase();
+ else
+ aLoc.Country = OUString();
+ if( nIndex != -1 )
+ aLoc.Variant = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase();
+ else
+ aLoc.Variant = OUString();
+ m_aConfig[ aLoc ] = LocaleAccess();
+ m_aConfig[ aLoc ].aConfigLocaleString = pLocaleStrings[i];
}
}
- catch (const Exception&)
- {
- // configuration is awry
- m_xConfigProvider.clear();
- m_xConfigAccess.clear();
- }
+ }
+ catch (const Exception&)
+ {
+ // configuration is awry
+ m_xConfigProvider.clear();
+ m_xConfigAccess.clear();
}
}
catch (const WrappedTargetException&)
@@ -380,61 +372,51 @@ FontSubstConfiguration::FontSubstConfiguration() :
try
{
// get service provider
- Reference< XMultiServiceFactory > xSMgr( comphelper::getProcessServiceFactory() );
+ Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() );
// create configuration hierachical access name
- if( xSMgr.is() )
+ try
{
- try
+ m_xConfigProvider = theDefaultProvider::get( xContext );
+ Sequence< Any > aArgs(1);
+ PropertyValue aVal;
+ aVal.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) );
+ aVal.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.VCL/FontSubstitutions" ) );
+ aArgs.getArray()[0] <<= aVal;
+ m_xConfigAccess =
+ Reference< XNameAccess >(
+ m_xConfigProvider->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.configuration.ConfigurationAccess" )),
+ aArgs ),
+ UNO_QUERY );
+ if( m_xConfigAccess.is() )
{
- m_xConfigProvider =
- Reference< XMultiServiceFactory >(
- xSMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationProvider" ))),
- UNO_QUERY );
- if( m_xConfigProvider.is() )
+ Sequence< OUString > aLocales = m_xConfigAccess->getElementNames();
+ // fill config hash with empty interfaces
+ int nLocales = aLocales.getLength();
+ const OUString* pLocaleStrings = aLocales.getConstArray();
+ Locale aLoc;
+ for( int i = 0; i < nLocales; i++ )
{
- Sequence< Any > aArgs(1);
- PropertyValue aVal;
- aVal.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) );
- aVal.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.VCL/FontSubstitutions" ) );
- aArgs.getArray()[0] <<= aVal;
- m_xConfigAccess =
- Reference< XNameAccess >(
- m_xConfigProvider->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationAccess" )),
- aArgs ),
- UNO_QUERY );
- if( m_xConfigAccess.is() )
- {
- Sequence< OUString > aLocales = m_xConfigAccess->getElementNames();
- // fill config hash with empty interfaces
- int nLocales = aLocales.getLength();
- const OUString* pLocaleStrings = aLocales.getConstArray();
- Locale aLoc;
- for( int i = 0; i < nLocales; i++ )
- {
- sal_Int32 nIndex = 0;
- aLoc.Language = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiLowerCase();
- if( nIndex != -1 )
- aLoc.Country = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase();
- else
- aLoc.Country = OUString();
- if( nIndex != -1 )
- aLoc.Variant = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase();
- else
- aLoc.Variant = OUString();
- m_aSubst[ aLoc ] = LocaleSubst();
- m_aSubst[ aLoc ].aConfigLocaleString = pLocaleStrings[i];
- }
- }
+ sal_Int32 nIndex = 0;
+ aLoc.Language = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiLowerCase();
+ if( nIndex != -1 )
+ aLoc.Country = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase();
+ else
+ aLoc.Country = OUString();
+ if( nIndex != -1 )
+ aLoc.Variant = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase();
+ else
+ aLoc.Variant = OUString();
+ m_aSubst[ aLoc ] = LocaleSubst();
+ m_aSubst[ aLoc ].aConfigLocaleString = pLocaleStrings[i];
}
}
- catch (const Exception&)
- {
- // configuration is awry
- m_xConfigProvider.clear();
- m_xConfigAccess.clear();
- }
+ }
+ catch (const Exception&)
+ {
+ // configuration is awry
+ m_xConfigProvider.clear();
+ m_xConfigAccess.clear();
}
}
catch (const WrappedTargetException&)
diff --git a/unotools/source/config/itemholder1.cxx b/unotools/source/config/itemholder1.cxx
index 1d2b90ede043..de973654dd9f 100644
--- a/unotools/source/config/itemholder1.cxx
+++ b/unotools/source/config/itemholder1.cxx
@@ -22,6 +22,7 @@
#include <comphelper/processfactory.hxx>
#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <unotools/misccfg.hxx>
#include <unotools/useroptions.hxx>
@@ -64,12 +65,11 @@ ItemHolder1::ItemHolder1()
{
try
{
- css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
+ css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
css::uno::Reference< css::lang::XComponent > xCfg(
- xSMGR->createInstance(::rtl::OUString("com.sun.star.configuration.ConfigurationProvider")),
- css::uno::UNO_QUERY);
- if (xCfg.is())
- xCfg->addEventListener(static_cast< css::lang::XEventListener* >(this));
+ css::configuration::theDefaultProvider::get( xContext ),
+ css::uno::UNO_QUERY_THROW );
+ xCfg->addEventListener(static_cast< css::lang::XEventListener* >(this));
}
#ifdef DBG_UTIL
catch(const css::uno::Exception& rEx)
diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx
index a291a95e3e70..7407d8289944 100644
--- a/unotools/source/config/lingucfg.cxx
+++ b/unotools/source/config/lingucfg.cxx
@@ -20,6 +20,7 @@
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XNameReplace.hpp>
@@ -1115,15 +1116,9 @@ uno::Reference< util::XChangesBatch > SvtLinguConfig::GetMainUpdateAccess() cons
try
{
// get configuration provider
- uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider;
- uno::Reference< lang::XMultiServiceFactory > xMgr = comphelper::getProcessServiceFactory();
- if (xMgr.is())
- {
- xConfigurationProvider = uno::Reference< lang::XMultiServiceFactory > (
- xMgr->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationProvider"))),
- uno::UNO_QUERY_THROW ) ;
- }
+ uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
+ uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider =
+ configuration::theDefaultProvider::get( xContext );
// get configuration update access
beans::PropertyValue aValue;
diff --git a/uui/source/iahndl.cxx b/uui/source/iahndl.cxx
index 60e49e41878a..3c24531e1dac 100644
--- a/uui/source/iahndl.cxx
+++ b/uui/source/iahndl.cxx
@@ -21,6 +21,7 @@
#include "com/sun/star/awt/XWindow.hpp"
#include "com/sun/star/beans/PropertyValue.hpp"
+#include "com/sun/star/configuration/theDefaultProvider.hpp"
#include "com/sun/star/configuration/backend/MergeRecoveryRequest.hpp"
#include "com/sun/star/configuration/backend/StratumCreationException.hpp"
#include "com/sun/star/container/XHierarchicalNameAccess.hpp"
@@ -971,18 +972,8 @@ UUIInteractionHelper::getInteractionHandlerList(
{
try
{
- uno::Reference< lang::XMultiServiceFactory > xConfigProv(
- m_xServiceFactory->createInstance(
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationProvider" )) ),
- uno::UNO_QUERY );
-
- if ( !xConfigProv.is() )
- throw uno::RuntimeException(
- rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
- "unable to instanciate config provider service")),
- uno::Reference< uno::XInterface >());
+ uno::Reference< lang::XMultiServiceFactory > xConfigProv =
+ configuration::theDefaultProvider::get( comphelper::getComponentContext(m_xServiceFactory) );
rtl::OUStringBuffer aFullPath;
aFullPath.appendAscii(
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx
index 487ad67ca16a..53c51dd2eb84 100644
--- a/vcl/source/app/settings.cxx
+++ b/vcl/source/app/settings.cxx
@@ -1512,7 +1512,7 @@ bool AllSettings::GetLayoutRTL() const
{
nUIMirroring = 0; // ask configuration only once
utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithServiceFactory(
- comphelper::getProcessServiceFactory(),
+ comphelper::getProcessComponentContext(),
OUString("org.openoffice.Office.Common/I18N/CTL") ); // note: case sensitive !
if ( aNode.isValid() )
{
diff --git a/vcl/source/gdi/print.cxx b/vcl/source/gdi/print.cxx
index 73ece38aa9bd..8bf7da76b4d2 100644
--- a/vcl/source/gdi/print.cxx
+++ b/vcl/source/gdi/print.cxx
@@ -56,6 +56,7 @@
#include <comphelper/processfactory.hxx>
#include "com/sun/star/beans/XPropertySet.hpp"
+#include "com/sun/star/configuration/theDefaultProvider.hpp"
#include "com/sun/star/container/XNameAccess.hpp"
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
@@ -63,6 +64,7 @@ using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::beans;
using namespace com::sun::star::container;
+using namespace com::sun::star::configuration;
int nImplSysDialog = 0;
@@ -157,69 +159,61 @@ bool PrinterOptions::ReadFromConfig( bool i_bFile )
try
{
// get service provider
- Reference< XMultiServiceFactory > xSMgr( comphelper::getProcessServiceFactory() );
+ Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() );
// create configuration hierachical access name
- if( xSMgr.is() )
+ try
{
- try
- {
- xConfigProvider = Reference< XMultiServiceFactory >(
- xSMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
- "com.sun.star.configuration.ConfigurationProvider" ))),
+ xConfigProvider = theDefaultProvider::get( xContext );
+
+ Sequence< Any > aArgs(1);
+ PropertyValue aVal;
+ aVal.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) );
+ if( i_bFile )
+ aVal.Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common/Print/Option/File" ) );
+ else
+ aVal.Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common/Print/Option/Printer" ) );
+ aArgs.getArray()[0] <<= aVal;
+ xConfigAccess = Reference< XNameAccess >(
+ xConfigProvider->createInstanceWithArguments(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationAccess" )), aArgs ),
UNO_QUERY );
- if( xConfigProvider.is() )
+ if( xConfigAccess.is() )
+ {
+ Reference< XPropertySet > xSet( xConfigAccess, UNO_QUERY );
+ if( xSet.is() )
{
- Sequence< Any > aArgs(1);
- PropertyValue aVal;
- aVal.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) );
- if( i_bFile )
- aVal.Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common/Print/Option/File" ) );
- else
- aVal.Value <<= rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Common/Print/Option/Printer" ) );
- aArgs.getArray()[0] <<= aVal;
- xConfigAccess = Reference< XNameAccess >(
- xConfigProvider->createInstanceWithArguments(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationAccess" )), aArgs ),
- UNO_QUERY );
- if( xConfigAccess.is() )
- {
- Reference< XPropertySet > xSet( xConfigAccess, UNO_QUERY );
- if( xSet.is() )
- {
- sal_Int32 nValue = 0;
- sal_Bool bValue = 0;
- if( xSet->getPropertyValue(PROPERTYNAME_REDUCETRANSPARENCY) >>= bValue )
- SetReduceTransparency( bValue );
- if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDTRANSPARENCYMODE) >>= nValue )
- SetReducedTransparencyMode( (PrinterTransparencyMode)nValue );
- if( xSet->getPropertyValue(PROPERTYNAME_REDUCEGRADIENTS) >>= bValue )
- SetReduceGradients( bValue );
- if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTMODE) >>= nValue )
- SetReducedGradientMode( (PrinterGradientMode)nValue );
- if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT) >>= nValue )
- SetReducedGradientStepCount( (sal_uInt16)nValue );
- if( xSet->getPropertyValue(PROPERTYNAME_REDUCEBITMAPS) >>= bValue )
- SetReduceBitmaps( bValue );
- if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPMODE) >>= nValue )
- SetReducedBitmapMode( (PrinterBitmapMode)nValue );
- if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPRESOLUTION) >>= nValue )
- SetReducedBitmapResolution( (sal_uInt16)nValue );
- if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY) >>= bValue )
- SetReducedBitmapIncludesTransparency( bValue );
- if( xSet->getPropertyValue(PROPERTYNAME_CONVERTTOGREYSCALES) >>= bValue )
- SetConvertToGreyscales( bValue );
-
- bSuccess = true;
- }
- }
+ sal_Int32 nValue = 0;
+ sal_Bool bValue = 0;
+ if( xSet->getPropertyValue(PROPERTYNAME_REDUCETRANSPARENCY) >>= bValue )
+ SetReduceTransparency( bValue );
+ if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDTRANSPARENCYMODE) >>= nValue )
+ SetReducedTransparencyMode( (PrinterTransparencyMode)nValue );
+ if( xSet->getPropertyValue(PROPERTYNAME_REDUCEGRADIENTS) >>= bValue )
+ SetReduceGradients( bValue );
+ if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTMODE) >>= nValue )
+ SetReducedGradientMode( (PrinterGradientMode)nValue );
+ if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDGRADIENTSTEPCOUNT) >>= nValue )
+ SetReducedGradientStepCount( (sal_uInt16)nValue );
+ if( xSet->getPropertyValue(PROPERTYNAME_REDUCEBITMAPS) >>= bValue )
+ SetReduceBitmaps( bValue );
+ if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPMODE) >>= nValue )
+ SetReducedBitmapMode( (PrinterBitmapMode)nValue );
+ if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPRESOLUTION) >>= nValue )
+ SetReducedBitmapResolution( (sal_uInt16)nValue );
+ if( xSet->getPropertyValue(PROPERTYNAME_REDUCEDBITMAPINCLUDESTRANSPARENCY) >>= bValue )
+ SetReducedBitmapIncludesTransparency( bValue );
+ if( xSet->getPropertyValue(PROPERTYNAME_CONVERTTOGREYSCALES) >>= bValue )
+ SetConvertToGreyscales( bValue );
+
+ bSuccess = true;
}
}
- catch( Exception& )
- {
- }
+ }
+ catch( const Exception& )
+ {
}
}
- catch( WrappedTargetException& )
+ catch( const WrappedTargetException& )
{
}
diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx
index 73c1fbc4b495..64020ff5f98c 100644
--- a/vcl/source/window/toolbox2.cxx
+++ b/vcl/source/window/toolbox2.cxx
@@ -2140,7 +2140,7 @@ sal_Bool ToolBox::AlwaysLocked()
nAlwaysLocked = 0; // ask configuration only once
utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithServiceFactory(
- comphelper::getProcessServiceFactory(),
+ comphelper::getProcessComponentContext(),
OUString("/org.openoffice.Office.UI.GlobalSettings/Toolbars") ); // note: case sensitive !
if ( aNode.isValid() )
{
@@ -2153,7 +2153,7 @@ sal_Bool ToolBox::AlwaysLocked()
{
// now read the locking state
utl::OConfigurationNode aNode2 = utl::OConfigurationTreeRoot::tryCreateWithServiceFactory(
- comphelper::getProcessServiceFactory(),
+ comphelper::getProcessComponentContext(),
OUString("/org.openoffice.Office.UI.GlobalSettings/Toolbars/States") ); // note: case sensitive !
sal_Bool bLocked = sal_Bool();
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 2663644579c0..6d5c36d3d783 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -485,7 +485,7 @@ void Window::ImplUpdateGlobalSettings( AllSettings& rSettings, sal_Bool bCallHdl
{
sal_Bool bTmp = sal_False, bAutoHCMode = sal_True;
utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithServiceFactory(
- comphelper::getProcessServiceFactory(),
+ comphelper::getProcessComponentContext(),
OUString("org.openoffice.Office.Common/Accessibility") ); // note: case sensitive !
if ( aNode.isValid() )
{
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx
index fb84af33f690..5113638f002a 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -51,6 +51,7 @@
#include <com/sun/star/beans/Optional.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/frame/XConfigManager.hpp>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include <com/sun/star/util/XMacroExpander.hpp>
@@ -252,8 +253,8 @@ rtl::OString Databases::getImagesZipFileURL()
sal_Int16 nSymbolsStyle = 0;
try
{
- uno::Reference< lang::XMultiServiceFactory > xConfigProvider(
- m_xSMgr ->createInstanceWithContext(::rtl::OUString("com.sun.star.configuration.ConfigurationProvider"), m_xContext), uno::UNO_QUERY_THROW);
+ uno::Reference< lang::XMultiServiceFactory > xConfigProvider =
+ configuration::theDefaultProvider::get(m_xContext);
// set root path
uno::Sequence < uno::Any > lParams(1);
diff --git a/xmlhelp/source/cxxhelp/provider/provider.cxx b/xmlhelp/source/cxxhelp/provider/provider.cxx
index e3deabafd57e..6272306e1b11 100644
--- a/xmlhelp/source/cxxhelp/provider/provider.cxx
+++ b/xmlhelp/source/cxxhelp/provider/provider.cxx
@@ -40,6 +40,7 @@
#include <com/sun/star/frame/XConfigManager.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/container/XContainer.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XNameReplace.hpp>
@@ -306,8 +307,8 @@ void ContentProvider::init()
try
{
- uno::Reference< lang::XMultiServiceFactory > xConfigProvider(
- m_xSMgr ->createInstance(::rtl::OUString("com.sun.star.configuration.ConfigurationProvider")), uno::UNO_QUERY_THROW);
+ uno::Reference< lang::XMultiServiceFactory > xConfigProvider =
+ configuration::theDefaultProvider::get( comphelper::getComponentContext(m_xSMgr) );
uno::Sequence < uno::Any > lParams(1);
beans::PropertyValue aParam ;
@@ -361,26 +362,20 @@ void ContentProvider::init()
uno::Reference< lang::XMultiServiceFactory >
ContentProvider::getConfiguration() const
{
- uno::Reference< lang::XMultiServiceFactory > sProvider;
+ uno::Reference< lang::XMultiServiceFactory > xProvider;
if( m_xSMgr.is() )
{
try
{
- rtl::OUString sProviderService =
- rtl::OUString(
- "com.sun.star.configuration.ConfigurationProvider" );
- sProvider =
- uno::Reference< lang::XMultiServiceFactory >(
- m_xSMgr->createInstance( sProviderService ),
- uno::UNO_QUERY );
+ xProvider = configuration::theDefaultProvider::get( comphelper::getComponentContext(m_xSMgr) );
}
catch( const uno::Exception& )
{
- OSL_ENSURE( sProvider.is(), "cant instantiate configuration" );
+ OSL_ENSURE( xProvider.is(), "cant instantiate configuration" );
}
}
- return sProvider;
+ return xProvider;
}
uno::Reference< container::XHierarchicalNameAccess >
diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx
index 52d1e4abacc5..e4b4b948404f 100644
--- a/xmlhelp/source/treeview/tvread.cxx
+++ b/xmlhelp/source/treeview/tvread.cxx
@@ -33,6 +33,7 @@
#include <expat.h>
#include <osl/file.hxx>
#include <unotools/configmgr.hxx>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include <com/sun/star/frame/XConfigManager.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -182,6 +183,7 @@ using namespace treeview;
using namespace com::sun::star;
using namespace com::sun::star::uno;
using namespace com::sun::star::beans;
+using namespace com::sun::star::configuration;
using namespace com::sun::star::lang;
using namespace com::sun::star::util;
using namespace com::sun::star::frame;
@@ -720,7 +722,7 @@ TVChildTarget::hasByHierarchicalName( const rtl::OUString& aName )
ConfigData TVChildTarget::init( const Reference< XMultiServiceFactory >& xSMgr )
{
ConfigData configData;
- Reference< XMultiServiceFactory > sProvider( getConfiguration(xSMgr) );
+ Reference< XMultiServiceFactory > sProvider( getConfiguration(comphelper::getComponentContext(xSMgr)) );
/**********************************************************************/
/* reading Office.Common */
@@ -750,8 +752,7 @@ ConfigData TVChildTarget::init( const Reference< XMultiServiceFactory >& xSMgr )
try
{
- uno::Reference< lang::XMultiServiceFactory > xConfigProvider(
- xSMgr ->createInstance(::rtl::OUString("com.sun.star.configuration.ConfigurationProvider")), uno::UNO_QUERY_THROW);
+ Reference< lang::XMultiServiceFactory > xConfigProvider = theDefaultProvider::get( comphelper::getComponentContext(xSMgr) );
uno::Sequence < uno::Any > lParams(1);
beans::PropertyValue aParam ;
@@ -889,27 +890,22 @@ ConfigData TVChildTarget::init( const Reference< XMultiServiceFactory >& xSMgr )
Reference< XMultiServiceFactory >
-TVChildTarget::getConfiguration(const Reference< XMultiServiceFactory >& m_xSMgr) const
+TVChildTarget::getConfiguration(const Reference< XComponentContext >& rxContext) const
{
- Reference< XMultiServiceFactory > sProvider;
- if( m_xSMgr.is() )
+ Reference< XMultiServiceFactory > xProvider;
+ if( rxContext.is() )
{
try
{
- rtl::OUString sProviderService =
- rtl::OUString( "com.sun.star.configuration.ConfigurationProvider" );
- sProvider =
- Reference< XMultiServiceFactory >(
- m_xSMgr->createInstance( sProviderService ),
- UNO_QUERY );
+ xProvider = theDefaultProvider::get( rxContext );
}
catch( const com::sun::star::uno::Exception& )
{
- OSL_ENSURE( sProvider.is(),"cant instantiate configuration" );
+ OSL_ENSURE( xProvider.is(),"cant instantiate configuration" );
}
}
- return sProvider;
+ return xProvider;
}
diff --git a/xmlhelp/source/treeview/tvread.hxx b/xmlhelp/source/treeview/tvread.hxx
index 2afcd10bef9f..a35da146b417 100644
--- a/xmlhelp/source/treeview/tvread.hxx
+++ b/xmlhelp/source/treeview/tvread.hxx
@@ -300,10 +300,10 @@ namespace treeview {
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
getConfiguration(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xMSgr ) const;
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext ) const;
::com::sun::star::uno::Reference< ::com::sun::star::container::XHierarchicalNameAccess >
- getHierAccess( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& sProvider,
+ getHierAccess( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxProvider,
const char* file ) const;
::rtl::OUString