summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2014-01-08 09:10:29 +0100
committerStephan Bergmann <sbergman@redhat.com>2014-01-08 09:10:29 +0100
commit382b013275f0dd81d6bbf299782f59d2735c5beb (patch)
tree6fcfccba42ff0ced32342b5c2720dfaf38da19eb
parentb45e8153b28b7447a922129d3e3a182315c8b337 (diff)
Some ConfigurationProvider -> theDefaultProvider simplifications
Change-Id: I7c25cd94f8a1ca339f7423c26f21f13c7a68906d
-rw-r--r--desktop/source/deployment/misc/dp_descriptioninfoset.cxx15
-rw-r--r--framework/qa/complex/accelerators/AcceleratorsConfigurationTest.java4
-rw-r--r--framework/qa/complex/framework/autosave/AutoSave.java2
-rw-r--r--framework/qa/complex/framework/autosave/ConfigHelper.java8
-rw-r--r--librelogo/source/LibreLogo/LibreLogo.py2
-rw-r--r--nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/ResourceManager.java6
-rw-r--r--odk/examples/DevelopersGuide/GUI/UnoDialogSample.java5
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DisableCommands/DisableCommandsTest.java7
-rw-r--r--odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObject.java6
-rw-r--r--stoc/source/javavm/javavm.cxx5
10 files changed, 26 insertions, 34 deletions
diff --git a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx
index 3572caab479f..55748c364f2a 100644
--- a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx
+++ b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx
@@ -27,6 +27,7 @@
#include "comphelper/makesequence.hxx"
#include "comphelper/processfactory.hxx"
#include "boost/optional.hpp"
+#include "com/sun/star/configuration/theDefaultProvider.hpp"
#include "com/sun/star/container/XNameAccess.hpp"
#include "com/sun/star/beans/Optional.hpp"
#include "com/sun/star/beans/PropertyValue.hpp"
@@ -374,12 +375,6 @@ void DescriptionInfoset::checkBlacklist() const
if (currentversion.getLength() == 0)
return; // nothing to check
- css::uno::Reference< css::lang::XMultiComponentFactory > manager(
- m_context->getServiceManager(), css::uno::UNO_QUERY_THROW);
- css::uno::Reference< css::lang::XMultiServiceFactory> provider(
- manager->createInstanceWithContext("com.sun.star.configuration.ConfigurationProvider", m_context),
- css::uno::UNO_QUERY_THROW);
-
css::uno::Sequence< css::uno::Any > args = css::uno::Sequence< css::uno::Any >(1);
css::beans::PropertyValue prop;
prop.Name = "nodepath";
@@ -387,8 +382,10 @@ void DescriptionInfoset::checkBlacklist() const
args[0] <<= prop;
css::uno::Reference< css::container::XNameAccess > blacklist(
- provider->createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", args),
- css::uno::UNO_QUERY_THROW);
+ (css::configuration::theDefaultProvider::get(m_context)
+ ->createInstanceWithArguments(
+ "com.sun.star.configuration.ConfigurationAccess", args)),
+ css::uno::UNO_QUERY_THROW);
// check first if a blacklist entry is available
if (blacklist.is() && blacklist->hasByName(*id)) {
@@ -412,7 +409,7 @@ void DescriptionInfoset::checkBlacklist() const
OString xmlDependencies = OUStringToOString(udeps, RTL_TEXTENCODING_UNICODE);
css::uno::Reference< css::xml::dom::XDocumentBuilder> docbuilder(
- manager->createInstanceWithContext("com.sun.star.xml.dom.DocumentBuilder", m_context),
+ m_context->getServiceManager()->createInstanceWithContext("com.sun.star.xml.dom.DocumentBuilder", m_context),
css::uno::UNO_QUERY_THROW);
css::uno::Sequence< sal_Int8 > byteSeq((const sal_Int8*)xmlDependencies.getStr(), xmlDependencies.getLength());
diff --git a/framework/qa/complex/accelerators/AcceleratorsConfigurationTest.java b/framework/qa/complex/accelerators/AcceleratorsConfigurationTest.java
index 96f24e57da30..c5cc63253f25 100644
--- a/framework/qa/complex/accelerators/AcceleratorsConfigurationTest.java
+++ b/framework/qa/complex/accelerators/AcceleratorsConfigurationTest.java
@@ -21,6 +21,7 @@ package complex.accelerators;
import com.sun.star.awt.KeyEvent;
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertySet;
+import com.sun.star.configuration.theDefaultProvider;
import com.sun.star.container.XNameAccess;
import com.sun.star.embed.XStorage;
import com.sun.star.embed.XTransactedObject;
@@ -750,7 +751,8 @@ public class AcceleratorsConfigurationTest
boolean bReadOnly)
throws java.lang.Exception
{
- XMultiServiceFactory xConfigRoot = UnoRuntime.queryInterface(XMultiServiceFactory.class, xSMGR.createInstance("com.sun.star.configuration.ConfigurationProvider"));
+ XMultiServiceFactory xConfigRoot = theDefaultProvider.get(
+ connection.getComponentContext());
PropertyValue[] lParams = new PropertyValue[2];
lParams[0] = new PropertyValue();
diff --git a/framework/qa/complex/framework/autosave/AutoSave.java b/framework/qa/complex/framework/autosave/AutoSave.java
index ec80058782fa..92d95f8da5cf 100644
--- a/framework/qa/complex/framework/autosave/AutoSave.java
+++ b/framework/qa/complex/framework/autosave/AutoSave.java
@@ -208,7 +208,7 @@ public class AutoSave
// prepare AutoSave
// make sure it will be started every 1 min
- ConfigHelper aConfig = new ConfigHelper(m_xSMGR, "org.openoffice.Office.Recovery", false);
+ ConfigHelper aConfig = new ConfigHelper(connection.getComponentContext(), "org.openoffice.Office.Recovery", false);
aConfig.writeRelativeKey("AutoSave", "Enabled" , Boolean.TRUE );
aConfig.writeRelativeKey("AutoSave", "TimeIntervall", new Integer(1)); // 1 min
aConfig.flush();
diff --git a/framework/qa/complex/framework/autosave/ConfigHelper.java b/framework/qa/complex/framework/autosave/ConfigHelper.java
index 8de6e87505ff..ab11a324478e 100644
--- a/framework/qa/complex/framework/autosave/ConfigHelper.java
+++ b/framework/qa/complex/framework/autosave/ConfigHelper.java
@@ -20,24 +20,22 @@ package complex.framework.autosave;
import com.sun.star.uno.*;
import com.sun.star.lang.*;
+import com.sun.star.configuration.theDefaultProvider;
import com.sun.star.container.*;
import com.sun.star.beans.*;
import com.sun.star.util.*;
class ConfigHelper
{
- private XMultiServiceFactory m_xSMGR = null;
private XHierarchicalNameAccess m_xConfig = null;
//-----------------------------------------------
- public ConfigHelper(XMultiServiceFactory xSMGR ,
+ public ConfigHelper(XComponentContext context,
String sConfigPath ,
boolean bReadOnly )
throws com.sun.star.uno.Exception
{
- m_xSMGR = xSMGR;
-
- XMultiServiceFactory xConfigRoot = UnoRuntime.queryInterface(XMultiServiceFactory.class, m_xSMGR.createInstance("com.sun.star.configuration.ConfigurationProvider"));
+ XMultiServiceFactory xConfigRoot = theDefaultProvider.get(context);
PropertyValue[] lParams = new PropertyValue[1];
lParams[0] = new PropertyValue();
diff --git a/librelogo/source/LibreLogo/LibreLogo.py b/librelogo/source/LibreLogo/LibreLogo.py
index 7b5930bf715b..8c48024c5cdf 100644
--- a/librelogo/source/LibreLogo/LibreLogo.py
+++ b/librelogo/source/LibreLogo/LibreLogo.py
@@ -141,7 +141,7 @@ def __getprop__(name, value):
p, p.Name, p.Value = __property__(), name, value
return p
-__uilocale__ = uno.getComponentContext().ServiceManager.createInstance("com.sun.star.configuration.ConfigurationProvider").\
+__uilocale__ = uno.getComponentContext().getValueByName("/singletons/com.sun.star.configuration.theDefaultProvider").\
createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess",\
(__getprop__("nodepath", "/org.openoffice.Setup/L10N"),)).getByName("ooLocale") + '-' # handle missing Country of locale 'eo'
diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/ResourceManager.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/ResourceManager.java
index 6780826a43ff..1484173ff280 100644
--- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/ResourceManager.java
+++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/ResourceManager.java
@@ -30,6 +30,7 @@ package com.sun.star.comp.Calc.NLPSolver;
import com.sun.star.beans.PropertyState;
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertySet;
+import com.sun.star.configuration.theDefaultProvider;
import com.sun.star.deployment.PackageInformationProvider;
import com.sun.star.deployment.XPackageInformationProvider;
import com.sun.star.lang.Locale;
@@ -60,8 +61,7 @@ public class ResourceManager {
m_resourceBaseUrl = m_oxtRoot + relativeResourceBaseUrl;
try {
- XMultiServiceFactory xConfig = UnoRuntime.queryInterface(XMultiServiceFactory.class,
- m_context.getServiceManager().createInstanceWithContext("com.sun.star.configuration.ConfigurationProvider", m_context));
+ XMultiServiceFactory xConfig = theDefaultProvider.get(m_context);
Object[] args = new Object[1];
args[0] = new PropertyValue("nodepath", 0, "/org.openoffice.Setup/L10N", PropertyState.DIRECT_VALUE);
@@ -95,4 +95,4 @@ public class ResourceManager {
}
}
-} \ No newline at end of file
+}
diff --git a/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java b/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java
index e69799580746..851158f91d81 100644
--- a/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java
+++ b/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java
@@ -76,6 +76,7 @@ import com.sun.star.awt.XWindowPeer;
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XMultiPropertySet;
import com.sun.star.beans.XPropertySet;
+import com.sun.star.configuration.theDefaultProvider;
import com.sun.star.container.XIndexContainer;
import com.sun.star.container.XNameAccess;
import com.sun.star.container.XNameContainer;
@@ -193,13 +194,11 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis
*/
public XNameAccess getRegistryKeyContent(String _sKeyName){
try {
- Object oConfigProvider;
PropertyValue[] aNodePath = new PropertyValue[1];
- oConfigProvider = m_xMCF.createInstanceWithContext("com.sun.star.configuration.ConfigurationProvider", this.m_xContext);
+ XMultiServiceFactory xMSFConfig = theDefaultProvider.get(m_xContext);
aNodePath[0] = new PropertyValue();
aNodePath[0].Name = "nodepath";
aNodePath[0].Value = _sKeyName;
- XMultiServiceFactory xMSFConfig = UnoRuntime.queryInterface(XMultiServiceFactory.class, oConfigProvider);
Object oNode = xMSFConfig.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", aNodePath);
XNameAccess xNameAccess = UnoRuntime.queryInterface(XNameAccess.class, oNode);
return xNameAccess;
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DisableCommands/DisableCommandsTest.java b/odk/examples/DevelopersGuide/OfficeDev/DisableCommands/DisableCommandsTest.java
index f81c59afca31..2f161b42708e 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DisableCommands/DisableCommandsTest.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DisableCommands/DisableCommandsTest.java
@@ -32,6 +32,7 @@
*
*************************************************************************/
+import com.sun.star.configuration.theDefaultProvider;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
import com.sun.star.lang.XMultiComponentFactory;
@@ -79,11 +80,7 @@ public class DisableCommandsTest extends java.lang.Object {
xTransformer = UnoRuntime.queryInterface(com.sun.star.util.XURLTransformer.class,
transformer );
- Object configProvider = xRemoteServiceManager.createInstanceWithContext(
- "com.sun.star.configuration.ConfigurationProvider",
- xRemoteContext );
- xConfigProvider = UnoRuntime.queryInterface(
- com.sun.star.lang.XMultiServiceFactory.class, configProvider );
+ xConfigProvider = theDefaultProvider.get(xRemoteContext);
// create a new test document
Object oDesktop = xRemoteServiceManager.createInstanceWithContext(
diff --git a/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObject.java b/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObject.java
index b38bb8c3b56f..3ae069560838 100644
--- a/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObject.java
+++ b/odk/examples/java/EmbedDocument/EmbeddedObject/OwnEmbeddedObject.java
@@ -20,6 +20,7 @@ import java.awt.Dimension;
import java.util.ArrayList;
import com.sun.star.beans.XPropertySet;
+import com.sun.star.configuration.theDefaultProvider;
import com.sun.star.container.XNameAccess;
import com.sun.star.embed.VisualRepresentation;
import com.sun.star.embed.XStorage;
@@ -29,7 +30,6 @@ import com.sun.star.io.XOutputStream;
import com.sun.star.io.XStream;
import com.sun.star.io.XTruncate;
import com.sun.star.lang.XComponent;
-import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lib.uno.helper.WeakBase;
import com.sun.star.uno.AnyConverter;
@@ -987,9 +987,7 @@ public final class OwnEmbeddedObject extends WeakBase
{
try
{
- XMultiComponentFactory xFactory = m_xContext.getServiceManager();
- Object obj = xFactory.createInstanceWithContext( "com.sun.star.configuration.ConfigurationProvider", m_xContext );
- XMultiServiceFactory xConfProvider = UnoRuntime.queryInterface( XMultiServiceFactory.class, obj );
+ XMultiServiceFactory xConfProvider = theDefaultProvider.get(m_xContext);
if ( xConfProvider == null )
throw new com.sun.star.uno.RuntimeException();
diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx
index 735cabfee01b..f1af2524762d 100644
--- a/stoc/source/javavm/javavm.cxx
+++ b/stoc/source/javavm/javavm.cxx
@@ -1334,8 +1334,9 @@ void JavaVirtualMachine::registerConfigChangesListener()
try
{
css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider(
- m_xContext->getServiceManager()->createInstanceWithContext( OUString(
- "com.sun.star.configuration.ConfigurationProvider"), m_xContext), css::uno::UNO_QUERY);
+ m_xContext->getValueByName(
+ "/singletons/com.sun.star.configuration.theDefaultProvider"),
+ css::uno::UNO_QUERY);
if (xConfigProvider.is())
{