2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 <META NAME=
"GENERATOR" Content=
"Microsoft Developer Studio">
21 <META HTTP-EQUIV=
"Content-Type" content=
"text/html; charset=iso-8859-1">
22 <TITLE>Document Title
</TITLE>
26 <script language=
"JScript">
29 var objServiceManager= new ActiveXObject(
"com.sun.star.ServiceManager");
31 var objDesktop= objServiceManager.createInstance(
"com.sun.star.frame.Desktop");
33 var args= new Array();
35 var objDocument= objDesktop.loadComponentFromURL(
"private:factory/swriter",
"_blank",
0, args);
39 listener= new XEventListener_Impl();
41 listener= new ActiveXObject(
"EventListener.EvtListener");
42 objDocument.addEventListener( listener);
46 function XEventListener_Impl()
48 this._environment=
"JScript";
49 this._implementedInterfaces= new Array(
"com.sun.star.lang.XEventListener");
52 this.disposing= XEventListener_disposing;
55 function XEventListener_disposing( source)
57 alert(
"JScript Event Listener \n The document was closed");
61 <script language=
"VBScript">
63 Set objServiceManager= CreateObject(
"com.sun.star.ServiceManager")
65 Set objCoreReflection= objServiceManager.createInstance(
"com.sun.star.reflection.CoreReflection")
67 Set objDesktop= objServiceManager.createInstance(
"com.sun.star.frame.Desktop")
69 'Open a new empty writer document
71 Set objDocument= objDesktop.loadComponentFromURL(
"private:factory/swriter",
"_blank",
0, args)
76 Set eventListener= CreateObject(
"EventListener.EvtListener")
78 Set eventListener= CreateObject(
"VBasicEventListener.VBEventListener")
81 objDocument.addEventListener eventlistener
86 The script on this page creates a new StarOffice document and connects an event listener
87 to it. When the document is closed then the XEventListener::disposing method is called on the
88 listener object. How the listener is set up depends on the button being clicked.
91 The button will run JScript code that and adds an JScript event listener to the document.
92 The listener is also implemented in JScript an is on this page..
94 <button onclick='Main(
0)'
>JScript go
</Button>
97 The button runs JScript code that creates the ActiveX component EventListener.EvtListener that
98 is written in C++ and housed in a dll. Then the event listener is added to the document.
100 <button onclick='Main(
1)'
>JScript go
</Button>
102 The button runs VBScript code that creates the components EventListener.EvtListener and adds it
105 <button onclick='MainVB(
0)'
>VBScript
</Button>
107 Runs VBScript code that creates VBasicEventListener.VBEventListener ActiveX component which was
110 <button onclick='MainVB(
1)'
>VBScript
</Button>