summaryrefslogtreecommitdiff
path: root/xmlhelp
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 /xmlhelp
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
Diffstat (limited to 'xmlhelp')
-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
4 files changed, 22 insertions, 30 deletions
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