From 094f92bb789ecd24793c5843bfae13e79122fc5a Mon Sep 17 00:00:00 2001 From: Matúš Kukan Date: Mon, 27 Jan 2014 09:51:58 +0100 Subject: Introduce com.sun.star.util.thePathSettings singleton. To replace single-instance com.sun.star.util.PathSettings service, incorrectly converted in 89b0017b22889af6a8afe28b94c06e7095dc8c6f Keeping util::PathSettings::create in sc/source/ui/vba/vbaapplication.cxx because for some reason util::thePathSettings::get does not work in sc_macros_test while testing sc/qa/extras/testdocuments/Ranges.xls. Change-Id: I75b68ae56ac5b58f72416070dba100ab3ab70fe8 --- odk/examples/DevelopersGuide/GUI/SystemDialog.java | 6 +++--- odk/examples/DevelopersGuide/GUI/UnoDialogSample.java | 3 ++- .../DevelopersGuide/OfficeDev/PathSettings/PathSettingsTest.java | 6 ++---- 3 files changed, 7 insertions(+), 8 deletions(-) (limited to 'odk') diff --git a/odk/examples/DevelopersGuide/GUI/SystemDialog.java b/odk/examples/DevelopersGuide/GUI/SystemDialog.java index 1c1de4364cf8..453d9b99cd72 100644 --- a/odk/examples/DevelopersGuide/GUI/SystemDialog.java +++ b/odk/examples/DevelopersGuide/GUI/SystemDialog.java @@ -42,7 +42,7 @@ import com.sun.star.ui.dialogs.XFilterManager; import com.sun.star.ui.dialogs.XFolderPicker2; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; - +import com.sun.star.util.thePathSettings; public class SystemDialog { @@ -86,7 +86,7 @@ public class SystemDialog { xFilePicker.setDefaultName("MyExampleDocument"); // set the initial displaydirectory. In this example the user template directory is used - Object oPathSettings = m_xMCF.createInstanceWithContext("com.sun.star.util.PathSettings",m_xContext); + Object oPathSettings = thePathSettings.get(m_xContext); XPropertySet xPropertySet = com.sun.star.uno.UnoRuntime.queryInterface(XPropertySet.class, oPathSettings); String sTemplateUrl = (String) xPropertySet.getPropertyValue("Template_writable"); xFilePicker.setDisplayDirectory(sTemplateUrl); @@ -134,7 +134,7 @@ public class SystemDialog { String sWorkUrl = ""; try{ // retrieve the configured Work path... - Object oPathSettings = m_xMCF.createInstanceWithContext("com.sun.star.util.PathSettings",m_xContext); + Object oPathSettings = thePathSettings.get(m_xContext); XPropertySet xPropertySet = com.sun.star.uno.UnoRuntime.queryInterface(XPropertySet.class, oPathSettings); sWorkUrl = (String) xPropertySet.getPropertyValue("Work"); } catch (com.sun.star.uno.Exception exception) { diff --git a/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java b/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java index 851158f91d81..60eb85475dd5 100644 --- a/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java +++ b/odk/examples/DevelopersGuide/GUI/UnoDialogSample.java @@ -98,6 +98,7 @@ import com.sun.star.util.XNumberFormats; import com.sun.star.util.XNumberFormatsSupplier; import com.sun.star.util.Date; import com.sun.star.util.Time; +import com.sun.star.util.thePathSettings; // Anregung von DV: @@ -1116,7 +1117,7 @@ public class UnoDialogSample implements XTextListener, XSpinListener, XActionLis String sName = createUniqueName(m_xDlgModelNameContainer, "FileControl"); // retrieve the configured Work path... - Object oPathSettings = m_xMCF.createInstanceWithContext("com.sun.star.util.PathSettings",m_xContext); + Object oPathSettings = thePathSettings.get(m_xContext); XPropertySet xPropertySet = com.sun.star.uno.UnoRuntime.queryInterface(XPropertySet.class, oPathSettings); String sWorkUrl = (String) xPropertySet.getPropertyValue("Work"); diff --git a/odk/examples/DevelopersGuide/OfficeDev/PathSettings/PathSettingsTest.java b/odk/examples/DevelopersGuide/OfficeDev/PathSettings/PathSettingsTest.java index 5fff201ef552..903cc14a5738 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/PathSettings/PathSettingsTest.java +++ b/odk/examples/DevelopersGuide/OfficeDev/PathSettings/PathSettingsTest.java @@ -36,6 +36,7 @@ import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; import com.sun.star.lang.XMultiComponentFactory; import com.sun.star.beans.XPropertySet; +import com.sun.star.util.thePathSettings; /* * Provides example code how to access and use the @@ -80,7 +81,6 @@ public class PathSettingsTest extends java.lang.Object { public static void main(String[] args) { XComponentContext xRemoteContext = null; - XMultiComponentFactory xRemoteServiceManager = null; XPropertySet xPathSettingsService = null; try { @@ -88,10 +88,8 @@ public class PathSettingsTest extends java.lang.Object { // process is started xRemoteContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); System.out.println("Connected to a running office ..."); - xRemoteServiceManager = xRemoteContext.getServiceManager(); - Object pathSubst = xRemoteServiceManager.createInstanceWithContext( - "com.sun.star.comp.framework.PathSettings", xRemoteContext ); + Object pathSubst = thePathSettings.get( xRemoteContext ); xPathSettingsService = UnoRuntime.queryInterface( XPropertySet.class, pathSubst); -- cgit