3 <META NAME=
"GENERATOR" Content=
"Microsoft Developer Studio">
4 <META HTTP-EQUIV=
"Content-Type" content=
"text/html; charset=iso-8859-1">
5 <TITLE>Document Title
</TITLE>
9 <script language=
"JScript">
12 var objServiceManager= new ActiveXObject(
"com.sun.star.ServiceManager");
14 var objDesktop= objServiceManager.createInstance(
"com.sun.star.frame.Desktop");
16 var args= new Array();
18 var objDocument= objDesktop.loadComponentFromURL(
"private:factory/swriter",
"_blank",
0, args);
22 listener= new XEventListener_Impl();
24 listener= new ActiveXObject(
"EventListener.EvtListener");
25 objDocument.addEventListener( listener);
29 function XEventListener_Impl()
31 this._environment=
"JScript";
32 this._implementedInterfaces= new Array(
"com.sun.star.lang.XEventListener");
35 this.disposing= XEventListener_disposing;
38 function XEventListener_disposing( source)
40 alert(
"JScript Event Listener \n The document was closed");
44 <script language=
"VBScript">
46 Set objServiceManager= CreateObject(
"com.sun.star.ServiceManager")
48 Set objCoreReflection= objServiceManager.createInstance(
"com.sun.star.reflection.CoreReflection")
50 Set objDesktop= objServiceManager.createInstance(
"com.sun.star.frame.Desktop")
52 'Open a new empty writer document
54 Set objDocument= objDesktop.loadComponentFromURL(
"private:factory/swriter",
"_blank",
0, args)
59 Set eventListener= CreateObject(
"EventListener.EvtListener")
61 Set eventListener= CreateObject(
"VBasicEventListener.VBEventListener")
64 objDocument.addEventListener eventlistener
69 The script on this page creates a new StarOffice document and connects an event listener
70 to it. When the document is closed then the XEventListener::disposing method is called on the
71 listener object. How the listener is set up depends on the button being clicked.
74 The button will run JScript code that and adds an JScript event listener to the document.
75 The listener is also implemented in JScript an is on this page..
77 <button onclick='Main(
0)'
>JScript go
</Button>
80 The button runs JScript code that creates the ActiveX component EventListener.EvtListener that
81 is written in C++ and housed in a dll. Then the event listener is added to the document.
83 <button onclick='Main(
1)'
>JScript go
</Button>
85 The button runs VBScript code that creates the components EventListener.EvtListener and adds it
88 <button onclick='MainVB(
0)'
>VBScript
</Button>
90 Runs VBScript code that creates VBasicEventListener.VBEventListener ActiveX component which was
93 <button onclick='MainVB(
1)'
>VBScript
</Button>