diff options
author | Rüdiger Timm <rt@openoffice.org> | 2004-10-22 12:50:13 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2004-10-22 12:50:13 +0000 |
commit | f543c0501922a4e8b1a6cb9461bc66bd1a291a22 (patch) | |
tree | e7bd1a107864dafd19652d95ce44e89ea683c3be /scripting/examples/beanshell | |
parent | e570e3f680d5a4730e6c77280e2ade7b764f98f2 (diff) |
INTEGRATION: CWS scriptingf6 (1.3.40); FILE MERGED
2004/09/16 14:26:46 dfoster 1.3.40.3: #i33670#
Rename the context variable to XSCRIPTCONTEXT
2004/08/03 16:12:49 dfoster 1.3.40.2: #i32502#
2004/07/23 09:55:20 dfoster 1.3.40.1: #i30606#
Add descriptions to code in examples.
Diffstat (limited to 'scripting/examples/beanshell')
-rw-r--r-- | scripting/examples/beanshell/WordCount/wordcount.bsh | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/scripting/examples/beanshell/WordCount/wordcount.bsh b/scripting/examples/beanshell/WordCount/wordcount.bsh index 35332799f6ba..a2018c00d420 100644 --- a/scripting/examples/beanshell/WordCount/wordcount.bsh +++ b/scripting/examples/beanshell/WordCount/wordcount.bsh @@ -1,11 +1,13 @@ +//Provides a word count of the selected text in A Writer document. import com.sun.star.uno.UnoRuntime; import com.sun.star.frame.XModel; import com.sun.star.view.XSelectionSupplier; import com.sun.star.container.XIndexAccess; import com.sun.star.text.XText; import com.sun.star.text.XTextRange; -import drafts.com.sun.star.script.provider.XScriptContext; +import com.sun.star.script.provider.XScriptContext; +// display the count in a Swing dialog void doDisplay(numWords) { wordsLabel = new JLabel("Word count = " + numWords); closeButton = new JButton("Close"); @@ -45,10 +47,10 @@ int wordcount() { return result; } -// The context variable is of type XScriptContext and is available to +// The XSCRIPTCONTEXT variable is of type XScriptContext and is available to // all BeanShell scripts executed by the Script Framework xModel = (XModel) - UnoRuntime.queryInterface(XModel.class, context.getDocument()); + UnoRuntime.queryInterface(XModel.class, XSCRIPTCONTEXT.getDocument()); //the writer controller impl supports the css.view.XSelectionSupplier interface xSelectionSupplier = (XSelectionSupplier) UnoRuntime.queryInterface(XSelectionSupplier.class, xModel.getCurrentController()); |