diff options
author | Noel Grandin <noel@peralex.com> | 2012-10-30 14:02:56 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-10-31 15:31:36 +0100 |
commit | 0ac9a10d312dc8f12a74720ce211823ce4addf7b (patch) | |
tree | 2c812432eca9315170af8b5b6b7ae5bcbf828d5b /svx | |
parent | d27c92961b78da138d3563ab596cca416af9eb38 (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
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/dialog/srchdlg.cxx | 6 | ||||
-rw-r--r-- | svx/source/smarttags/SmartTagMgr.cxx | 6 |
2 files changed, 5 insertions, 7 deletions
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; |