summaryrefslogtreecommitdiff
path: root/sd/source/ui
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 /sd/source/ui
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 'sd/source/ui')
-rw-r--r--sd/source/ui/slidesorter/cache/SlsCacheConfiguration.cxx10
-rw-r--r--sd/source/ui/tools/ConfigurationAccess.cxx24
2 files changed, 10 insertions, 24 deletions
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);
}