diff options
author | Noel Grandin <noel@peralex.com> | 2012-10-16 14:05:41 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-10-24 11:29:53 +0200 |
commit | e8aa70b5d44a6cbedacfe0e5d1b1da2c76a3c588 (patch) | |
tree | 2cb20208eb30391718b57c6302d3dcd6b2e99673 /comphelper | |
parent | 3688466ab127d7801b4cb752ee6205cc04acb2f7 (diff) |
fdo#46808, convert comphelper::ConfigurationHelper to XComponentContext
Convert the helper methods to take an XComponentContext parameter,
instead of XMultiServiceFactory.
Change-Id: I9f0098af37b91f107d8799f14caa04756eac82b1
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/inc/comphelper/configurationhelper.hxx | 13 | ||||
-rw-r--r-- | comphelper/source/misc/configurationhelper.cxx | 17 |
2 files changed, 15 insertions, 15 deletions
diff --git a/comphelper/inc/comphelper/configurationhelper.hxx b/comphelper/inc/comphelper/configurationhelper.hxx index 706e1b762912..2f6c94166337 100644 --- a/comphelper/inc/comphelper/configurationhelper.hxx +++ b/comphelper/inc/comphelper/configurationhelper.hxx @@ -21,6 +21,7 @@ #define _COMPHELPER_CONFIGURATIONHELPER_HXX_ #include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/container/XHierarchicalNameAccess.hpp> @@ -76,7 +77,7 @@ class COMPHELPER_DLLPUBLIC ConfigurationHelper * configuration package is needed. The configuration access can be cached * outside and used inbetween. * - * @param xSMGR + * @param rxContext * the uno service manager, which should be used to create the * configuration access. * @@ -95,9 +96,9 @@ class COMPHELPER_DLLPUBLIC ConfigurationHelper * @throw Any exceptions the underlying configuration can throw. * E.g. css::uno::Exception if the configuration could not be opened. */ - static css::uno::Reference< css::uno::XInterface > openConfig(const css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR , - const ::rtl::OUString& sPackage, - sal_Int32 eMode ); + static css::uno::Reference< css::uno::XInterface > openConfig(const css::uno::Reference< css::uno::XComponentContext >& rxContext, + const ::rtl::OUString& sPackage, + sal_Int32 eMode ); //----------------------------------------------- /** reads the value of an existing(!) configuration key, @@ -217,7 +218,7 @@ class COMPHELPER_DLLPUBLIC ConfigurationHelper * So its not very usefull to use this method for reading multiple keys at the same time. * (Excepting these keys exists inside different configuration packages ...)) */ - static css::uno::Any readDirectKey(const css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR , + static css::uno::Any readDirectKey(const css::uno::Reference< css::uno::XComponentContext >& rxContext, const ::rtl::OUString& sPackage, const ::rtl::OUString& sRelPath, const ::rtl::OUString& sKey , @@ -233,7 +234,7 @@ class COMPHELPER_DLLPUBLIC ConfigurationHelper * So its not very usefull to use this method for writing multiple keys at the same time. * (Excepting these keys exists inside different configuration packages ...)) */ - static void writeDirectKey(const css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR , + static void writeDirectKey(const css::uno::Reference< css::uno::XComponentContext >& rxContext, const ::rtl::OUString& sPackage, const ::rtl::OUString& sRelPath, const ::rtl::OUString& sKey , diff --git a/comphelper/source/misc/configurationhelper.cxx b/comphelper/source/misc/configurationhelper.cxx index 1ace6f28ebcf..7c16385fd3cc 100644 --- a/comphelper/source/misc/configurationhelper.cxx +++ b/comphelper/source/misc/configurationhelper.cxx @@ -32,13 +32,12 @@ namespace css = ::com::sun::star; //----------------------------------------------- -css::uno::Reference< css::uno::XInterface > ConfigurationHelper::openConfig(const css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR , - const ::rtl::OUString& sPackage, - sal_Int32 eMode ) +css::uno::Reference< css::uno::XInterface > ConfigurationHelper::openConfig(const css::uno::Reference< css::uno::XComponentContext >& rxContext, + const ::rtl::OUString& sPackage, + sal_Int32 eMode ) { css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider( - css::configuration::theDefaultProvider::get( - getComponentContext( xSMGR ) ) ); + css::configuration::theDefaultProvider::get( rxContext ) ); ::comphelper::SequenceAsVector< css::uno::Any > lParams; css::beans::PropertyValue aParam ; @@ -160,25 +159,25 @@ css::uno::Reference< css::uno::XInterface > ConfigurationHelper::makeSureSetNode } //----------------------------------------------- -css::uno::Any ConfigurationHelper::readDirectKey(const css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR , +css::uno::Any ConfigurationHelper::readDirectKey(const css::uno::Reference< css::uno::XComponentContext >& rxContext, const ::rtl::OUString& sPackage, const ::rtl::OUString& sRelPath, const ::rtl::OUString& sKey , sal_Int32 eMode ) { - css::uno::Reference< css::uno::XInterface > xCFG = ConfigurationHelper::openConfig(xSMGR, sPackage, eMode); + css::uno::Reference< css::uno::XInterface > xCFG = ConfigurationHelper::openConfig(rxContext, sPackage, eMode); return ConfigurationHelper::readRelativeKey(xCFG, sRelPath, sKey); } //----------------------------------------------- -void ConfigurationHelper::writeDirectKey(const css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR , +void ConfigurationHelper::writeDirectKey(const css::uno::Reference< css::uno::XComponentContext >& rxContext, const ::rtl::OUString& sPackage, const ::rtl::OUString& sRelPath, const ::rtl::OUString& sKey , const css::uno::Any& aValue , sal_Int32 eMode ) { - css::uno::Reference< css::uno::XInterface > xCFG = ConfigurationHelper::openConfig(xSMGR, sPackage, eMode); + css::uno::Reference< css::uno::XInterface > xCFG = ConfigurationHelper::openConfig(rxContext, sPackage, eMode); ConfigurationHelper::writeRelativeKey(xCFG, sRelPath, sKey, aValue); ConfigurationHelper::flush(xCFG); } |