diff options
author | Kurt Zenker <kz@openoffice.org> | 2008-03-06 15:15:02 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2008-03-06 15:15:02 +0000 |
commit | 78f8e10b69ef42e4ff2947755e4f6b3a5bda0b35 (patch) | |
tree | f44f817b6d2144244319bfe8d28d353b5d3c707e /scripting | |
parent | e1bcf39a877cd84c0d59e173757107cf4da8d358 (diff) |
INTEGRATION: CWS odbmacros2 (1.8.90); FILE MERGED
2008/01/02 14:42:13 fs 1.8.90.1: #i49133# allow script providers to be created with an XScriptInvocationContext instead of a mere TDOC URL
Diffstat (limited to 'scripting')
2 files changed, 17 insertions, 36 deletions
diff --git a/scripting/java/com/sun/star/script/framework/provider/java/ScriptProviderForJava.java b/scripting/java/com/sun/star/script/framework/provider/java/ScriptProviderForJava.java index 637113032740..3bd2072d7b57 100755 --- a/scripting/java/com/sun/star/script/framework/provider/java/ScriptProviderForJava.java +++ b/scripting/java/com/sun/star/script/framework/provider/java/ScriptProviderForJava.java @@ -4,9 +4,9 @@ * * $RCSfile: ScriptProviderForJava.java,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: rt $ $Date: 2005-09-09 02:03:57 $ + * last change: $Author: kz $ $Date: 2008-03-06 16:14:01 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -37,45 +37,21 @@ package com.sun.star.script.framework.provider.java; import com.sun.star.frame.XModel; import com.sun.star.frame.XDesktop; import com.sun.star.comp.loader.FactoryHelper; +import com.sun.star.document.XScriptInvocationContext; import com.sun.star.uno.XComponentContext; import com.sun.star.lang.XMultiComponentFactory; import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.lang.XSingleServiceFactory; -import com.sun.star.lang.XInitialization; import com.sun.star.registry.XRegistryKey; -import com.sun.star.lang.XTypeProvider; -import com.sun.star.lang.XServiceInfo; -import com.sun.star.uno.AnyConverter; -import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.Type; import com.sun.star.uno.Any; -import com.sun.star.beans.Property; -import com.sun.star.beans.XPropertySet; -import com.sun.star.beans.UnknownPropertyException; -import com.sun.star.beans.PropertyVetoException; -import com.sun.star.beans.XPropertyChangeListener; -import com.sun.star.beans.XPropertySetInfo; -import com.sun.star.beans.XVetoableChangeListener; -import com.sun.star.lang.IllegalArgumentException; -import com.sun.star.lang.WrappedTargetException; -import com.sun.star.reflection.InvocationTargetException; -import com.sun.star.script.CannotConvertException; - -import java.util.Properties; import java.util.ArrayList; import java.util.Map; -import java.util.Vector; -import java.net.URL; import java.net.MalformedURLException; -import java.net.URLEncoder; import com.sun.star.script.provider.XScriptContext; -import com.sun.star.script.provider.XScriptProvider; import com.sun.star.script.provider.XScript; -import com.sun.star.script.browse.XBrowseNode; -import com.sun.star.script.browse.BrowseNodeTypes; -import com.sun.star.script.provider.ScriptErrorRaisedException; import com.sun.star.script.provider.ScriptExceptionRaisedException; import com.sun.star.script.provider.ScriptFrameworkErrorException; import com.sun.star.script.provider.ScriptFrameworkErrorType; @@ -116,7 +92,7 @@ public class ScriptProviderForJava ScriptImpl script = null; try { - script = new ScriptImpl( m_xContext, m_resolutionPolicy, scriptData, m_xModel ); + script = new ScriptImpl( m_xContext, m_resolutionPolicy, scriptData, m_xModel, m_xInvocContext ); return script; } catch ( com.sun.star.uno.RuntimeException re ) @@ -209,13 +185,15 @@ class ScriptImpl implements XScript private ScriptMetaData metaData; private XComponentContext m_xContext; private XModel m_xModel; + private XScriptInvocationContext m_xInvocContext; private XMultiComponentFactory m_xMultiComponentFactory; private Resolver m_resolutionPolicy; - ScriptImpl( XComponentContext ctx, Resolver resolver, ScriptMetaData metaData, XModel xModel ) throws com.sun.star.uno.RuntimeException + ScriptImpl( XComponentContext ctx, Resolver resolver, ScriptMetaData metaData, XModel xModel, XScriptInvocationContext xInvocContext ) throws com.sun.star.uno.RuntimeException { this.metaData = metaData; this.m_xContext = ctx; this.m_xModel = xModel; + this.m_xInvocContext = xInvocContext; this.m_resolutionPolicy = resolver; try { @@ -305,7 +283,7 @@ class ScriptImpl implements XScript LogUtils.DEBUG( "Parameter Mapping..." ); // Setup Context Object - XScriptContext xSc = ScriptContext.createContext(m_xModel, + XScriptContext xSc = ScriptContext.createContext(m_xModel, m_xInvocContext, m_xContext, m_xMultiComponentFactory); scriptDesc.addArgumentType( XScriptContext.class ); invocationArgList.add( xSc ); diff --git a/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript.java b/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript.java index 2ef3148325b5..a0f925752826 100755 --- a/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript.java +++ b/scripting/java/com/sun/star/script/framework/provider/javascript/ScriptProviderForJavaScript.java @@ -4,9 +4,9 @@ * * $RCSfile: ScriptProviderForJavaScript.java,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: rt $ $Date: 2005-09-09 02:05:15 $ + * last change: $Author: kz $ $Date: 2008-03-06 16:15:02 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -50,6 +50,7 @@ import com.sun.star.uno.Type; import com.sun.star.uno.Any; import com.sun.star.beans.XPropertySet; +import com.sun.star.document.XScriptInvocationContext; import com.sun.star.lang.IllegalArgumentException; import com.sun.star.lang.WrappedTargetException; import com.sun.star.reflection.InvocationTargetException; @@ -101,7 +102,7 @@ public class ScriptProviderForJavaScript try { scriptData = getScriptData( scriptURI ); - ScriptImpl script = new ScriptImpl( m_xContext, scriptData, m_xModel ); + ScriptImpl script = new ScriptImpl( m_xContext, scriptData, m_xModel, m_xInvocContext ); return script; } catch ( com.sun.star.uno.RuntimeException re ) @@ -192,12 +193,14 @@ class ScriptImpl implements XScript private XComponentContext m_xContext; private XMultiComponentFactory m_xMultiComponentFactory; private XModel m_xModel; + private XScriptInvocationContext m_xInvocContext; - ScriptImpl( XComponentContext ctx, ScriptMetaData metaData, XModel xModel ) throws com.sun.star.uno.RuntimeException + ScriptImpl( XComponentContext ctx, ScriptMetaData metaData, XModel xModel, XScriptInvocationContext xInvocContext ) throws com.sun.star.uno.RuntimeException { this.metaData = metaData; this.m_xContext = ctx; this.m_xModel = xModel; + this.m_xInvocContext = xInvocContext; try { this.m_xMultiComponentFactory = m_xContext.getServiceManager(); @@ -337,7 +340,7 @@ class ScriptImpl implements XScript Scriptable jsCtxt = Context.toObject( ScriptContext.createContext( - m_xModel, m_xContext, + m_xModel, m_xInvocContext, m_xContext, m_xMultiComponentFactory), scope); scope.put("XSCRIPTCONTEXT", scope, jsCtxt); @@ -399,7 +402,7 @@ class ScriptImpl implements XScript { editor = ScriptEditorForJavaScript.getEditor(); editor.edit( - ScriptContext.createContext(m_xModel, + ScriptContext.createContext(m_xModel, m_xInvocContext, m_xContext, m_xMultiComponentFactory), metaData ); editor = ScriptEditorForJavaScript.getEditor( sourceUrl ); } |