Kaydet (Commit) bad4c221 authored tarafından Vladimir Glazounov's avatar Vladimir Glazounov

INTEGRATION: CWS uno4 (1.3.2); FILE ADDED

2003/05/08 06:41:40 jl 1.3.2.1: *** empty log message ***
üst 238c51fd
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Developer Studio">
<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
<TITLE>Document Title</TITLE>
</HEAD>
<BODY id=theBody>
<script language="JScript">
function Main( id)
{
var objServiceManager= new ActiveXObject("com.sun.star.ServiceManager");
var objDesktop= objServiceManager.createInstance("com.sun.star.frame.Desktop");
var args= new Array();
var objDocument= objDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, args);
var listener;
if( id == 0)
listener= new XEventListener_Impl();
else if(id == 1)
listener= new ActiveXObject("EventListener.EvtListener");
objDocument.addEventListener( listener);
}
function XEventListener_Impl()
{
this._environment= "JScript";
this._implementedInterfaces= new Array( "com.sun.star.lang.XEventListener");
//XEventListener
this.disposing= XEventListener_disposing;
}
function XEventListener_disposing( source)
{
alert("JScript Event Listener \n The document was closed");
}
</script>
<script language="VBScript">
SUB MainVB( id)
Set objServiceManager= CreateObject("com.sun.star.ServiceManager")
Set objCoreReflection= objServiceManager.createInstance("com.sun.star.reflection.CoreReflection")
Set objDesktop= objServiceManager.createInstance("com.sun.star.frame.Desktop")
'Open a new empty writer document
Dim args()
Set objDocument= objDesktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, args)
Dim eventListener
select case id
case 0
Set eventListener= CreateObject("EventListener.EvtListener")
case 1
Set eventListener= CreateObject("VBasicEventListener.VBEventListener")
end select
objDocument.addEventListener eventlistener
END SUB
</script>
<p>
The script on this page creates a new StarOffice document and connects an event listener
to it. When the document is closed then the XEventListener::disposing method is called on the
listener object. How the listener is set up depends on the button being clicked.
</p>
<p>
The button will run JScript code that and adds an JScript event listener to the document.
The listener is also implemented in JScript an is on this page..
</p>
<button onclick='Main(0)'>JScript go</Button>
<p>
The button runs JScript code that creates the ActiveX component EventListener.EvtListener that
is written in C++ and housed in a dll. Then the event listener is added to the document.
</p>
<button onclick='Main( 1)'>JScript go</Button>
<p>
The button runs VBScript code that creates the components EventListener.EvtListener and adds it
to the document.
</p>
<button onclick='MainVB(0)'>VBScript</Button>
<p>
Runs VBScript code that creates VBasicEventListener.VBEventListener ActiveX component which was
written with VB
</p>
<button onclick='MainVB(1)'>VBScript</Button>
</body>
</html>
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