summaryrefslogtreecommitdiff
path: root/odk/examples/DevelopersGuide/OfficeDev
diff options
context:
space:
mode:
Diffstat (limited to 'odk/examples/DevelopersGuide/OfficeDev')
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java114
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OfficeConnect.java75
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java5
-rw-r--r--odk/examples/DevelopersGuide/OfficeDev/OfficeConnect.java32
4 files changed, 4 insertions, 222 deletions
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java
index 44159959398d..7439b31fe898 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/FunctionHelper.java
@@ -490,50 +490,7 @@ public class FunctionHelper
- /**
- * Dispatch an URL to given frame.
- * Caller can register himself for following result events for dispatched
- * URL too. Notifications are guaranteed (instead of dispatch())
- * Returning of the dispatch object isn't necessary.
- * Nobody must hold it alive longer the dispatch needs.
- *
- * @param xFrame frame which should be the target of this dispatch
- * @param aURL full parsed and converted office URL for dispatch
- * @param lProperties optional arguments for dispatch
- * @param xListener optional listener which is registered automatically for status events
- * (Note: Deregistration is not supported. Dispatcher does it automatically.)
- */
- public static void executeWithNotification(com.sun.star.frame.XFrame xFrame ,
- com.sun.star.util.URL aURL ,
- com.sun.star.beans.PropertyValue[] lProperties,
- com.sun.star.frame.XDispatchResultListener xListener )
- {
- try
- {
- // Query the frame for right interface which provides access to all available dispatch objects.
- com.sun.star.frame.XDispatchProvider xProvider = UnoRuntime.queryInterface(
- com.sun.star.frame.XDispatchProvider.class,
- xFrame);
- // Ask himn for right dispatch object for given URL.
- // Force THIS frame as target for following dispatch.
- // Attention: The interface XNotifyingDispatch is an optional one!
- com.sun.star.frame.XDispatch xDispatcher = xProvider.queryDispatch(aURL,"",0);
- com.sun.star.frame.XNotifyingDispatch xNotifyingDispatcher = UnoRuntime.queryInterface(
- com.sun.star.frame.XNotifyingDispatch.class,
- xDispatcher);
-
- // Dispatch the URL.
- if(xNotifyingDispatcher!=null)
- xNotifyingDispatcher.dispatchWithNotification(aURL,lProperties,xListener);
- }
- catch(com.sun.star.uno.RuntimeException exUno)
- {
- // Any UNO method of this scope can throw this exception.
- // But there is nothing we can do then.
- exUno.printStackTrace();
- }
- }
@@ -782,78 +739,7 @@ public class FunctionHelper
- /**
- * Try to close the document without any saving of modifications.
- * We can try it only! Controller and/or model of this document
- * can disagree with that. But mostly they doesn't do so.
- *
- * @param xDocument document which should be clcosed
- */
- public static void closeDocument(com.sun.star.lang.XComponent xDocument)
- {
- try
- {
- // Check supported functionality of the document (model or controller).
- com.sun.star.frame.XModel xModel =
- UnoRuntime.queryInterface(
- com.sun.star.frame.XModel.class, xDocument);
- if(xModel!=null)
- {
- // It's a full featured office document.
- // Reset the modify state of it and close it.
- // Note: Model can disgree by throwing a veto exception.
- com.sun.star.util.XModifiable xModify =
- UnoRuntime.queryInterface(
- com.sun.star.util.XModifiable.class, xModel);
-
- xModify.setModified(false);
- xDocument.dispose();
- }
- else
- {
- // It's a document which supports a controller .. or may by a pure
- // window only. If it's at least a controller - we can try to
- // suspend him. But - he can disagree with that!
- com.sun.star.frame.XController xController =
- UnoRuntime.queryInterface(
- com.sun.star.frame.XController.class, xDocument);
-
- if(xController!=null)
- {
- if(xController.suspend(true)==true)
- {
- // Note: Don't dispose the controller - destroy the frame
- // to make it right!
- com.sun.star.frame.XFrame xFrame = xController.getFrame();
- xFrame.dispose();
- }
- }
- }
- }
- catch(com.sun.star.beans.PropertyVetoException exVeto)
- {
- // Can be thrown by "setModified()" call on model.
- // He disagree with our request.
- // But there is nothing to do then. Following "dispose()" call wasn't
- // never called (because we catch it before). Closing failed -that's it.
- exVeto.printStackTrace();
- }
- catch(com.sun.star.lang.DisposedException exDisposed)
- {
- // If an UNO object was already disposed before - he throw this special
- // runtime exception. Of course every UNO call must be look for that -
- // but it's a question of error handling.
- // For demonstration this exception is handled here.
- exDisposed.printStackTrace();
- }
- catch(com.sun.star.uno.RuntimeException exRuntime)
- {
- // Every uno call can throw that.
- // Do nothing - closing failed - that's it.
- exRuntime.printStackTrace();
- }
- }
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OfficeConnect.java b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OfficeConnect.java
index d6e0563359ef..782a3d2d6d11 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OfficeConnect.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/DesktopEnvironment/OfficeConnect.java
@@ -67,18 +67,7 @@ public class OfficeConnect
- /**
- * close connection to remote office if it exist
- */
- public static synchronized void disconnect()
- {
- if(maConnection!=null)
- {
- mxServiceManager=null;
- mxOfficeContext=null;
- maConnection=null;
- }
- }
+
@@ -112,69 +101,7 @@ public class OfficeConnect
- /**
- * create uno components inside remote office process
- * After connection of these process to a running office we have access to
- * remote service manager of it.
- * So we can use it to create all existing services. Use this method to create
- * components by name and get her interface. Casting of it to right target
- * interface is part of your implementation.
- *
- * @param aType describe class type of created service
- * Returned object can be casted directly to this one.
- * Uno query was done by this method automatically.
- * @param sServiceSpecifier name of service which should be created
- * @return the new created service object
- */
- public static synchronized <T> T createRemoteInstance(
- Class<T> aType, String sServiceSpecifier)
- {
- T aResult = null;
- try
- {
- aResult = UnoRuntime.queryInterface(aType,
- mxServiceManager.createInstanceWithContext(
- sServiceSpecifier, mxOfficeContext));
- }
- catch (com.sun.star.uno.Exception ex)
- {
- System.err.println("Couldn't create Service of type "
- + sServiceSpecifier + ": " + ex);
- System.exit(0);
- }
- return aResult;
- }
-
-
- /**
- * same as "createRemoteInstance()" but supports additional parameter for
- * initializing created object
- *
- * @param lArguments optional arguments
- * They are used to initialize new created service.
- * @param aType Description of Parameter
- * @param sServiceSpecifier Description of Parameter
- * @return the new create service object
- */
- public static synchronized <T> T createRemoteInstanceWithArguments(
- Class<T> aType, String sServiceSpecifier, Any[] lArguments)
- {
- T aResult = null;
- try
- {
- aResult = UnoRuntime.queryInterface(aType,
- mxServiceManager.createInstanceWithArgumentsAndContext(
- sServiceSpecifier, lArguments, mxOfficeContext));
- }
- catch (com.sun.star.uno.Exception ex)
- {
- System.err.println("Couldn't create Service of type "
- + sServiceSpecifier + ": " + ex);
- System.exit(0);
- }
- return aResult;
- }
diff --git a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java
index c1ab8438467b..45b2d04d04f7 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/Linguistic/PropChgHelper.java
@@ -72,10 +72,7 @@ public class PropChgHelper implements
return xPropSet;
}
- public String[] GetPropNames()
- {
- return aPropNames;
- }
+
public void LaunchEvent( LinguServiceEvent aEvt )
{
diff --git a/odk/examples/DevelopersGuide/OfficeDev/OfficeConnect.java b/odk/examples/DevelopersGuide/OfficeDev/OfficeConnect.java
index faecbe5e6513..f49e6a1d314e 100644
--- a/odk/examples/DevelopersGuide/OfficeDev/OfficeConnect.java
+++ b/odk/examples/DevelopersGuide/OfficeDev/OfficeConnect.java
@@ -71,10 +71,7 @@ public class OfficeConnect
- public static synchronized OfficeConnect getConnection()
- {
- return maConnection;
- }
+
@@ -127,32 +124,7 @@ public class OfficeConnect
- /**
- * same as "createRemoteInstance()" but supports additional parameter for initializing created object
- *
- * @param lArguments optional arguments
- * They are used to initialize new created service.
- * @param aType Description of Parameter
- * @param sServiceSpecifier Description of Parameter
- * @return Description of the Returned Value
- */
- public <T> T createRemoteInstanceWithArguments(Class<T> aType, String sServiceSpecifier, Any[] lArguments)
- {
- T aResult = null;
- try
- {
- aResult = UnoRuntime.queryInterface(
- aType, mxServiceManager.createInstanceWithArgumentsAndContext(
- sServiceSpecifier, lArguments, mxOfficeContext));
- }
- catch (com.sun.star.uno.Exception ex)
- {
- System.err.println("Couldn't create Service of type " + sServiceSpecifier + ": " + ex);
- ex.printStackTrace();
- System.exit(0);
- }
- return aResult;
- }
+