INTEGRATION: CWS odbmacros2 (1.3.134); FILE MERGED
2008/01/02 14:42:13 fs 1.3.134.1: #i49133# allow script providers to be created with an XScriptInvocationContext instead of a mere TDOC URL
This commit is contained in:
@@ -8,6 +8,7 @@ importClass(Packages.com.sun.star.uno.UnoRuntime);
|
||||
importClass(Packages.com.sun.star.text.XTextDocument);
|
||||
importClass(Packages.com.sun.star.text.XText);
|
||||
importClass(Packages.com.sun.star.text.XTextRange);
|
||||
importClass(Packages.com.sun.star.frame.XModel);
|
||||
|
||||
// Import XScriptContext class. An instance of this class is available
|
||||
// to all JavaScript scripts in the global variable "XSCRIPTCONTEXT". This
|
||||
@@ -17,14 +18,19 @@ importClass(Packages.com.sun.star.text.XTextRange);
|
||||
// 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
|
||||
oDoc = XSCRIPTCONTEXT.getDocument();
|
||||
// http://api.openoffice.org/docs/DevelopersGuide/ScriptingFramework/ScriptingFramework.xhtml
|
||||
//
|
||||
|
||||
oDoc = UnoRuntime.queryInterface(XModel,XSCRIPTCONTEXT.getInvocationContext());
|
||||
if ( !oDoc )
|
||||
oDoc = XSCRIPTCONTEXT.getDocument();
|
||||
xTextDoc = UnoRuntime.queryInterface(XTextDocument,oDoc);
|
||||
xText = xTextDoc.getText();
|
||||
xTextRange = xText.getEnd();
|
||||
|
Reference in New Issue
Block a user