summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRüdiger Timm <rt@openoffice.org>2004-10-22 12:48:52 +0000
committerRüdiger Timm <rt@openoffice.org>2004-10-22 12:48:52 +0000
commitc5c55615c635b00ced0fa3751e4f8e1584b4e167 (patch)
treeffb2581bc274820a55b58b771afb6a72efe41ae1
parentb69577d0e6f8fc70564121a51d4c912fea06f64e (diff)
INTEGRATION: CWS scriptingf6 (1.2.30); FILE MERGED
2004/09/16 14:26:44 dfoster 1.2.30.2: #i33670# Rename the context variable to XSCRIPTCONTEXT 2004/07/23 09:55:16 dfoster 1.2.30.1: #i30606# Add descriptions to code in examples.
-rw-r--r--scripting/examples/beanshell/HelloWorld/helloworld.bsh8
1 files changed, 7 insertions, 1 deletions
diff --git a/scripting/examples/beanshell/HelloWorld/helloworld.bsh b/scripting/examples/beanshell/HelloWorld/helloworld.bsh
index e5bd20f06098..2e7655486680 100644
--- a/scripting/examples/beanshell/HelloWorld/helloworld.bsh
+++ b/scripting/examples/beanshell/HelloWorld/helloworld.bsh
@@ -4,8 +4,14 @@ import com.sun.star.text.XTextDocument;
import com.sun.star.text.XText;
import com.sun.star.text.XTextRange;
-oDoc = context.getDocument();
+// get the document from the scripting context which is made available to all
+// scripts
+oDoc = XSCRIPTCONTEXT.getDocument();
+//get the XTextDocument interface
xTextDoc = (XTextDocument) UnoRuntime.queryInterface(XTextDocument.class,oDoc);
+//get the XText interface
xText = xTextDoc.getText();
+// get an (empty) XTextRange at the end of the document
xTextRange = xText.getEnd();
+// set the string
xTextRange.setString( "Hello World (in BeanShell)" );