Kaydet (Commit) f543c050 authored tarafından Rüdiger Timm's avatar Rüdiger Timm

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.
üst e570e3f6
//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());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment