summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2008-03-06 15:12:59 +0000
committerKurt Zenker <kz@openoffice.org>2008-03-06 15:12:59 +0000
commitad49c1f96894bfb882f816c844d3a6d627edf51f (patch)
tree4c2994b896e389cc2e76e521d3002710d3feb73a /scripting
parentb7029f8f6167a7de4b436d9e3f2284704235a24a (diff)
INTEGRATION: CWS odbmacros2 (1.3.134); FILE MERGED
2008/01/02 14:42:12 fs 1.3.134.1: #i49133# allow script providers to be created with an XScriptInvocationContext instead of a mere TDOC URL
Diffstat (limited to 'scripting')
-rw-r--r--scripting/java/com/sun/star/script/framework/provider/beanshell/template.bsh10
1 files changed, 6 insertions, 4 deletions
diff --git a/scripting/java/com/sun/star/script/framework/provider/beanshell/template.bsh b/scripting/java/com/sun/star/script/framework/provider/beanshell/template.bsh
index 1dcf79a5cfc5..03cb114d79b7 100644
--- a/scripting/java/com/sun/star/script/framework/provider/beanshell/template.bsh
+++ b/scripting/java/com/sun/star/script/framework/provider/beanshell/template.bsh
@@ -20,23 +20,25 @@ import com.sun.star.frame.XModel;
Methods available are:
XSCRIPTCONTEXT.getDocument() returns XModel
+ XSCRIPTCONTEXT.getInvocationContext() returns XScriptInvocationContext or NULL
XSCRIPTCONTEXT.getDesktop() returns XDesktop
XSCRIPTCONTEXT.getComponentContext() returns XComponentContext
For more information on using this class see the scripting
developer guides at:
- http://framework.openoffice.org/scripting/index.html
+ http://api.openoffice.org/docs/DevelopersGuide/ScriptingFramework/ScriptingFramework.xhtml
*/
-import drafts.com.sun.star.script.provider.XScriptContext;
-
// Hello World in BeanShell
import com.sun.star.text.XTextDocument;
import com.sun.star.text.XText;
import com.sun.star.text.XTextRange;
-oDoc = XSCRIPTCONTEXT.getDocument();
+oDoc = UnoRuntime.queryInterface(XModel.class,XSCRIPTCONTEXT.getInvocationContext());
+if ( oDoc == null )
+ oDoc = XSCRIPTCONTEXT.getDocument();
+
xTextDoc = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class,oDoc);
xText = xTextDoc.getText();
xTextRange = xText.getEnd();