xref: /trunk/main/extensions/test/ole/OleTest.htm (revision cdf0e10c)
1<HTML>
2<HEAD>
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>
6</HEAD>
7<BODY id=theBody>
8
9<script language="JScript">
10// XEventListener implementation in JScript --------------------------------------------------
11function XEventListener_Impl()
12{
13	this._environment= "JScript";
14	this._implementedInterfaces= new Array( "com.sun.star.lang.XEventListener");
15
16	//XEventListener
17	this.disposing= XEventListener_disposing;
18
19	this.bdisposingCalled= false;
20	this.bQuiet= true;
21	this.resetDisposing= XEventListener_resetDisposing;
22	this.disposingCalled= XEventListener_disposingCalled;
23}
24
25function XEventListener_disposing( source)
26{
27  if( !this.bQuiet)
28        alert("JScript Event Listener \n disposing is being called");
29  this.bdisposingCalled= true;
30}
31
32function XEventListener_resetDisposing()
33{
34   this.bdisposingCalled= false;
35}
36
37function XEventListener_disposingCalled()
38{
39     return this.bdisposingCalled;
40}
41
42//--------------------------------------------------------------------------------------------
43function callOleTest(	 id)
44{
45	var factory= new ActiveXObject("com.sun.star.ServiceManager");
46	var oletest= factory.createInstance("oletest.OleTest");
47//	alert(oletest);
48
49	var arr= new Array( 1, 2, 3, 4, 0);
50	var arrDouble= new Array( 1.2345, 12.345, 123,45, 1234.5, 12345);
51	var arrBool= new Array( 1, 0, 2, 0, 3);
52	var arrChar= new Array( '1', 'A', "1", "A", ' ', 55, 56);
53	var arrString= new Array("hamburger","cheeseburger", "chicken nuggets", "chicken wings" , "pizza");
54	var arrAny= new Array( 100, 100.1235,"hallo");
55	var arrSeq= new Array( arr, arr, arr);
56	var arrSeq2= new Array( arrSeq, arrSeq, arrSeq)
57
58
59	var arrout1= new Array();
60	var arrout2= new Array();
61	var arrout3= new Array();
62
63	var ret, i;
64	var sfarray, sfarray1, sfarray2, sfarray3;
65	var arEventListener= new Array( new XEventListener_Impl(), new XEventListener_Impl(),
66	                                new XEventListener_Impl());
67	var arEventListener2= new Array( new XEventListener_Impl(), new XEventListener_Impl(),
68	                                new XEventListener_Impl());
69	var arArEventListener= new Array( arEventListener, arEventListener2);
70	switch( id)
71	{
72	// Array in-params
73	case 1: ret= oletest.methodByte( arr);
74		sfarray= new VBArray( ret);
75		document.writeln( "Param: " + arr.toString()  + "<br>");
76		document.writeln( "Returns a Sequence&lt BYTE &gt <br>" + sfarray.toArray()) ; break;
77
78	case 2: ret= oletest.methodDouble( arrDouble);
79		sfarray= new VBArray( ret);
80		document.writeln( "Param: " + arrDouble.toString() +"<br>");
81		document.writeln( "Returns a Sequence&lt double &gt <br>" + sfarray.toArray()) ; break;
82
83	case 3:	ret= oletest.methodBool( arrBool);
84		sfarray= new VBArray( ret);
85		document.writeln( "Param: " + arrBool.toString() +"<br>");
86		document.writeln( "Returns a Sequence&lt BOOL &gt <br>" + sfarray.toArray()) ; break;
87
88	case 4: ret= oletest.methodShort( arr);
89		sfarray= new VBArray( ret);
90		document.writeln( "Param: " + arr.toString() +"<br>");
91		document.writeln( "Returns a Sequence&lt SHORT &gt <br>" + sfarray.toArray()) ; break;
92
93	case 5: ret= oletest.methodUShort( arr);
94		sfarray= new VBArray( ret);
95		document.writeln( "Param: " + arr.toString() +"<br>");
96		document.writeln( "Returns a Sequence&lt unsigned SHORT &gt <br>" + sfarray.toArray()) ; break;
97
98	case 6: ret= oletest.methodLong( arr);
99		sfarray= new VBArray( ret);
100		document.writeln( "Param: " + arr.toString() +"<br>");
101		document.writeln( "Returns a Sequence&lt LONG &gt <br>" + sfarray.toArray()) ; break;
102
103	case 7:	ret= oletest.methodULong( arr);
104		sfarray= new VBArray( ret);
105		document.writeln( "Param: " + arr.toString() +"<br>");
106		document.writeln( "Returns a Sequence&lt unsigned LONG &gt <br>" + sfarray.toArray()) ; break;
107
108	case 8: ret= oletest.methodChar( arrChar);
109		sfarray= new VBArray( ret);
110		document.writeln( "Param: " + arrChar.toString() +"<br>");
111		document.writeln( "Returns a Sequence&lt wchar_t &gt <br>" + sfarray.toArray()) ; break;
112
113	case 9:	ret= oletest.methodString( arrString);
114		sfarray= new VBArray( ret);
115		document.writeln( "Param: " + arrString.toString() +"<br>");
116		document.writeln( "Returns a Sequence&lt UString &gt <br>" + sfarray.toArray()) ; break;
117
118	case 10: ret= oletest.methodAny( arrAny);
119		sfarray= new VBArray( ret);
120		document.writeln( "Param: " + arrAny.toString() +"<br>");
121		document.writeln( "Returns a Sequence&lt UsrAny &gt <br>" + sfarray.toArray() ) ; break;
122
123	case 11: ret= oletest.methodSequence( arrSeq);
124		sfarray= new VBArray( ret);
125		document.writeln( "Param: " + arrSeq.toString() +"<br>");
126		document.writeln("Returns a Sequence&lt Sequence &lt long &gt&gt <br>") ;
127		var arr1= new Array();
128		arr1= sfarray.toArray();
129		for( i=0; i < arr1.length; i++)
130		{
131			sfarray2= new VBArray( arr1[i]);
132			var arr2= new Array();
133			arr2= sfarray2.toArray();
134			document.writeln( arr2.toString() + "<br>" );
135		}
136		break;
137
138	case 12: ret= oletest.methodSequence2( arrSeq2);
139		document.writeln( "Param: " + arrSeq2.toString() +"<br>");
140		sfarray1= new VBArray( ret);
141		arr1= sfarray1.toArray();
142		for( i=0; i < arr1.length; i++)
143		{
144			sfarray2= new VBArray( arr1[i]);
145			arr2= sfarray2.toArray();
146
147			for ( j=0; j < arr2.length; j++)
148			{
149				sfarray3= new VBArray( arr2[j]);
150				arr3= sfarray3.toArray();
151				document.write( i+ " ");
152				document.writeln(j + ": "+ arr3.toString() + "<br>" );
153			}
154
155		}
156		break;
157
158	case 13:
159		var ar= new Array();
160		for( i=0; i< 3; i++)
161		{
162			var ob= new Object();
163			ob.value= "A JScript object!";
164			ar[i]= ob;
165		}
166
167		ret	=	oletest.methodXInterface( ar);
168		sfarray= new VBArray( ret);
169		var arRet= sfarray.toArray();
170
171		document.writeln( "Params : Array containing objects ")
172		for( index in ar)
173		{
174			document.writeln( "object " + index + ": " + ar[index].value +"  ");
175		}
176		document.writeln( "<br>" ) ;
177		document.writeln("Return: <br>");
178		for( index in arRet)
179		{
180			document.writeln( "object " + index + ": " + arRet[index].value + " ");
181		}
182		break;
183
184	case 14: ret= oletest.methodFloat( arrDouble);
185		sfarray= new VBArray( ret);
186		document.writeln( "Param: " + arrDouble.toString() +"<br>");
187		document.writeln( "Returns a Sequence&lt float&gt <br>" + sfarray.toArray()) ; break;
188
189	case 15:
190		ret= oletest.methodXEventListeners( arEventListener);
191		sfarray= new VBArray(ret);
192		_ret= sfarray.toArray();
193		for ( key in _ret)
194		{
195	           if( ! _ret[key].disposingCalled())
196		      alert("Error! oletest.methodXEventListeners")
197		}
198		break;
199	case 16:
200	   ret= oletest.methodXEventListenersMul( arArEventListener);
201	   sfarray= new VBArray(ret);
202	   _ret= sfarray.toArray();
203	   for( key in _ret)
204	   {
205	      sfarray2= new VBArray(_ret[key]);
206	      _ret2= sfarray2.toArray();
207	      for( key2 in _ret2)
208	      {
209	        if( ! _ret2[key2].disposingCalled())
210		      alert("Error! oletest.methodXEventListeners")
211	      }
212	   }
213	break;
214
215
216
217	// Properties: setting and getting values
218	case 200: oletest.AttrByte = arr;
219		ret= oletest.AttrByte;
220		document.writeln("Setting AttrByte: " + arr.toString() + "<p>");
221		document.writeln("Getting AttrByte: " + arr.toString()); break;
222
223	case 201: oletest.AttrDouble= arrDouble;
224		ret= oletest.AttrDouble;
225		document.writeln("Setting AttrDouble: " + arrDouble.toString() + "<p>");
226		document.writeln("Getting AttrDouble: " + arrDouble.toString()); break;
227
228	case 202: oletest.AttrBool= arrBool;
229		ret= oletest.AttrBool;
230		document.writeln("Setting AttrBool: " + arrBool.toString() + "<p>");
231		document.writeln("Getting AttrBool: " + arrBool.toString()); break;
232
233	case 203: oletest.AttrShort= arr;
234		ret= oletest.AttrShort;
235		document.writeln("Setting AttrShort: " + arr.toString() + "<p>");
236		document.writeln("Getting AttrShort: " + arr.toString()); break;
237
238	case 204: oletest.AttrUShort= arr;
239		ret= oletest.AttrUShort;
240		document.writeln("Setting AttrUShort: " + arr.toString() + "<p>");
241		document.writeln("Getting AttrUShort: " + arr.toString()); break;
242
243	case 205: oletest.AttrLong= arr;
244		ret= oletest.AttrLong;
245		document.writeln("Setting AttrLong: " + arr.toString() + "<p>");
246		document.writeln("Getting AttrLong: " + arr.toString()); break;
247
248	case 206: oletest.AttrULong= arr;
249		ret= oletest.AttrULong;
250		document.writeln("Setting AttrULong: " + arr.toString() + "<p>");
251		document.writeln("Getting AttrULong: " + arr.toString()); break;
252
253	case 207: oletest.AttrChar= arrChar;
254		ret= oletest.AttrChar;
255		document.writeln("Setting AttrChar: " + arrChar.toString() + "<p>");
256		document.writeln("Getting AttrChar: " + arrChar.toString()); break;
257
258	case 208: oletest.AttrString= arrString;
259		ret= oletest.AttrString;
260		document.writeln("Setting AttrString: " + arrString.toString() + "<p>");
261		document.writeln("Getting AttrString: " + arrString.toString()); break;
262
263	case 209: oletest.AttrAny= arrAny;
264		ret= oletest.AttrAny;
265		document.writeln("Setting AttrAny: " + arrAny.toString() + "<p>");
266		document.writeln("Getting AttrAny: " + arrAny.toString()); break;
267
268	case 210: oletest.AttrSequence= arrSeq;
269		ret= oletest.AttrSequence;
270		document.writeln("Setting AttrSequence: " + arrSeq.toString() + "<p>");
271		document.writeln("Getting AttrSequence: " + arrSeq.toString()); break;
272
273	case 211: oletest.AttrSequence2= arrSeq2;
274		ret= oletest.AttrSequence2;
275		document.writeln("Setting AttrSequence2: " + arrSeq2.toString() + "<p>");
276		document.writeln("Getting AttrSequence2: " + arrSeq2.toString()); break;
277
278	case 212: oletest.AttrFloat= arrDouble;
279		ret= oletest.AttrFloat;
280		document.writeln("Setting AttrFloat: " + arrDouble.toString() + "<p>");
281		document.writeln("Getting AttrFloat: " + arrDouble.toString()); break;
282
283
284
285	// Out-parameter ------------------------------------------------------------
286	case (2000):
287		oletest.testout_methodByte( arrout1 );
288		alert("byte: " + arrout1[0] ); 	break;
289	case (2001):
290		oletest.testout_methodDouble( arrout1 );
291		alert( "double: " + arrout1[0] ); break;
292	case (2002):
293		oletest.testout_methodBool( arrout1 );
294		alert( "boolean: " + arrout1[0] );	break;
295	case (2003):
296		oletest.testout_methodShort( arrout1 );
297		alert( "short: " + arrout1[0] ); break;
298	case (2004):
299		oletest.testout_methodUShort( arrout1 );
300		alert( "unsigned short: " + arrout1[0] ); break;
301	case (2005):
302		oletest.testout_methodLong( arrout1 );
303		alert( "long: " + arrout1[0] );	break;
304	case (2006):
305		oletest.testout_methodULong( arrout1 );
306		alert( "unsigned long: " + arrout1[0] ); break;
307	case (2007):
308		oletest.testout_methodChar( arrout1 );
309		alert( "char: " + arrout1[0] );	break;
310	case (2008):
311		oletest.testout_methodString( arrout1 );
312		alert( "string: " + arrout1[0] ); break;
313	case (2009):
314		oletest.testout_methodAny( arrout1 );
315		alert( "any: " + arrout1[0] );	break;
316	case (2010):
317		oletest.testout_methodSequence( arrout1 );
318		var sfarray= new VBArray( arrout1[0]);
319		arr= sfarray.toArray();
320		document.writeln("use the browser's back arrow to go to the previous page <p>");
321		document.writeln( arr.toString());
322		break;
323	case (2011):
324		oletest.testout_methodSequence2( arrout1 );
325		var sfarray= new VBArray( arrout1[0]);
326		arr= sfarray.toArray();
327		var i;
328		for( i=0; i < arr.length; i++)
329		{
330			var sfarray= new VBArray( arr[i]);
331			var arr2= new Array();
332			arr2= sfarray.toArray();
333			document.writeln( arr2.toString() + "<br>" );
334		}
335		break;
336	case (2012):
337		oletest.testout_methodMulParams1( arrout1, arrout2 );
338		document.writeln( "int : " + arrout1[0] + " int :" + arrout2[0] ); break;
339	case (2013):
340		oletest.testout_methodMulParams2( arrout1, arrout2, arrout3 );
341		document.writeln( "int: " + arrout1[0] + " int: " + arrout2[0] + " string: " + arrout3[0] ); break;
342	case (2014):
343		oletest.testout_methodMulParams3( "hallo", arrout1 );
344		document.writeln( "string: " + arrout1[0] ); break;
345	case (2015):
346		oletest.testout_methodXInterface( arrout1 );
347		var outVal= arrout1[0];
348		alert( outVal.AttrAny2);
349		document.writeln( "string: " + arrout1[0].AttrAny2); break;
350	case (2016):
351		oletest.testout_methodFloat( arrout1 );
352		alert( "float: " + arrout1[0] ); break;
353	case (2017):
354		var in1= 3.14;
355		var in2= 1111;
356		var in3= -2222;
357		oletest.testout_methodMulParams4( in1, arrout1, in2, arrout2, in3 );
358		document.write("param1 [in] float: " + in1 + " param2 [out] float: " + arrout1[0] +
359					" param3 [in] long: " + in2 + " param4 [out] long: " + arrout2[0] +
360					" param5 [in] long: " + in3);
361		break;
362
363
364	// INOUT - Parameter -------------------------------------------------------------------------------
365	// The in value has to be placed on index 0 of the passed in array
366	case (500):
367		arrout1[0]= 100;
368		oletest.testinout_methodByte( arrout1 );
369		alert("byte: " + arrout1[0] ); 	break;
370	case (501):
371		arrout1[0]= 3.14;
372		oletest.testinout_methodDouble( arrout1 );
373		alert( "double: " + arrout1[0] ); break;
374	case (502):
375		arrout1[0]= false;
376		oletest.testinout_methodBool( arrout1 );
377		alert( "boolean: " + arrout1[0] );	break;
378	case (503):
379		arrout1[0]= 200;
380		oletest.testinout_methodShort( arrout1 );
381		alert( "short: " + arrout1[0] ); break;
382	case (504):
383		arrout1[0]= 300;
384		oletest.testinout_methodUShort( arrout1 );
385		alert( "unsigned short: " + arrout1[0] ); break;
386	case (505):
387		arrout1[0]= 400;
388		oletest.testinout_methodLong( arrout1 );
389		alert( "long: " + arrout1[0] );	break;
390	case (506):
391		arrout1[0]= 500;
392		oletest.testinout_methodULong( arrout1 );
393		alert( "unsigned long: " + arrout1[0] ); break;
394	case (507):
395		arrout1[0]= "A";
396		oletest.testinout_methodChar( arrout1 );
397		alert( "char: " + arrout1[0] );	break;
398	case (508):
399		arrout1[0]= "I am a string";
400		oletest.testinout_methodString( arrout1 );
401		alert( "string: " + arrout1[0] ); break;
402	case (509):
403		arrout1[0]= arr;
404		oletest.testinout_methodAny( arrout1 ); // the method simply returns the argument
405		sfarray= new VBArray( arrout1[0]);
406		arr= sfarray.toArray();
407		alert( "any: " + arr.toString() );	break;
408	case (510):
409		arrout1[0]= arr;
410		oletest.testinout_methodSequence( arrout1 );
411		var sfarray= new VBArray( arrout1[0]);
412		arr= sfarray.toArray();
413		document.writeln("use the browser's back arrow to go to the previous page <p>");
414		document.writeln( arr.toString());
415		break;
416	case (511):
417		arrout1[0]= arrSeq;
418		oletest.testinout_methodSequence2( arrout1 );
419		var sfarray= new VBArray( arrout1[0]);
420		arr= sfarray.toArray();
421		var i;
422		for( i=0; i < arr.length; i++)
423		{
424			var sfarray= new VBArray( arr[i]);
425			var arr2= new Array();
426			arr2= sfarray.toArray();
427			document.writeln( arr2.toString() + "<br>" );
428		}
429		break;
430	case 512:
431		var ob= new Object();
432		ob.value= "this is a string";
433
434		arrout1[0]= ob;
435		alert (arrout1[0].value);
436		oletest.testinout_methodXInterface( arrout1);
437		alert (arrout1[0].value);
438		var outValue= arrout1[0];
439		for ( key in outValue)
440		{
441			document.write( outValue[key] );
442		}
443		document.write("Out value: " + outValue );
444		document.write("Out 1 value: " + arrout1[1]);
445		break;
446
447//	 	var ob= new Object();
448//		ob.value= "this is a string";
449//		inoutValue.Set( "object", ob);
450//		oletest.testinout_methodXInterface( inoutValue);
451//		document.write("Out value: " + inoutValue.Get().value );
452//		break;
453
454	case (513):
455		arrout1[0]= 3.14;
456		oletest.testinout_methodFloat( arrout1 );
457		alert( "float: " + arrout1[0] ); break;
458
459
460
461	// Test ANY
462	// Methods
463	case 1000:
464		i= 100;
465		ret= oletest.methodAnyTest1( i);
466		document.writeln( "in: " + i + " ret: " + ret);
467		break;
468	case 1001:
469		i= 3.14;
470		ret= oletest.methodAnyTest1( i);
471		document.writeln( "in: " + i + " ret: " + ret);
472		break;
473	case 1002:
474		i= "Hallo"
475		ret= oletest.methodAnyTest1( i);
476		document.writeln( "in: " + i + " ret: " + ret);
477		break;
478	case 1003:
479		i= arr;
480		ret= oletest.methodAnyTest1( i);
481		sfarray= new VBArray( ret);
482		document.writeln( "in: " + i + " ret: " + sfarray.toArray());
483		break;
484	case 1004:
485		var obj= new Object();
486		obj[1]= "This is index 0";
487		ret= oletest.methodAnyTest1( obj);
488		document.writeln( "in: " + obj + " ret: " + ret);
489		break;
490
491
492	// Test ANY property
493	case 1010:
494		i= 100;
495		oletest.AttrAny2= i;
496		ret= oletest.AttrAny2;
497		document.writeln( "set: " + i + " get: " + ret);
498		break;
499	case 1011:
500		i= 3.14;
501		oletest.AttrAny2= i;
502		ret= oletest.AttrAny2;
503		document.writeln( "set: " + i + " get: " + ret);
504		break;
505	case 1012:
506		i= "Hallo"
507		oletest.AttrAny2= i;
508		ret= oletest.AttrAny2;
509		document.writeln( "set: " + i + " get: " + ret);
510		break;
511	case 1013:
512		i= arr;
513		oletest.AttrAny2= i;
514		ret= oletest.AttrAny2;
515		sfarray= new VBArray( ret);
516		document.writeln( "set: " + i + " get: " + sfarray.toArray());
517		break;
518	case 1014:
519		var obj= new Object();
520		obj[1]= "This is index 0";
521		oletest.AttrAny2= obj;
522		ret= oletest.AttrAny2;
523		document.writeln( "set: " + obj + " get: " + ret);
524		break;
525
526	// Structs ----------------------------------------------
527	case 1020:
528		 var struct= oletest._GetStruct("com.sun.star.beans.Property");
529		 struct.Attributes= 1;
530		 struct.Handle= 2;
531		 struct.Name= "some Property"
532		 oletest.methodStruct( struct);
533		 break;
534	case 1021:
535		var struct= oletest.retMethodStruct();
536		alert( "Property::Attributes : " + struct.Attributes + " \nProperty::Handle : "
537		+ struct.Handle + "\n Property::Name : " + struct.Name);
538		break;
539	case 1022:
540		 var struct= oletest._GetStruct("com.sun.star.beans.Property");
541		 struct.Attributes= 1;
542		 struct.Handle= 2;
543		 struct.Name= "some Property"
544		 oletest.AttrStruct=  struct;
545
546		 var struct2= oletest.AttrStruct;
547		alert( "property get: \n Property::Attributes : " + struct2.Attributes + " \nProperty::Handle : "
548		+ struct2.Handle + "\n Property::Name : " + struct2.Name);
549		break;
550
551	case 2100:
552		alert("2100");
553		var ret= oletest.retMethodByte();
554		var sfarray= VBArray( ret);
555		document.writeln( sfarray.toArray() );
556		break;
557
558
559
560	}
561
562}
563
564function funcOut( out)
565{
566	out["du"]= 0xffff;
567}
568
569</script>
570
571<script language="VBScript">
572
573sub callBasic(id)
574
575	Dim factory
576	Set	factory= GetObject("", "com.sun.star.ServiceManager")
577
578	Set	oletest= factory.createInstance("oletest.OleTest")
579
580
581	arrInt= Array(1,2,3,4,5)
582	arrInt2= Array( -1, -2, 127, 128, 0)
583	arrDouble= Array(1.1, 2.2, 3.3, 4.4, 5.5)
584	arrBool= Array(0,1,0,2,0)
585	arrLong= Array( &Hff, &Hffff, &Hffffff, &Hffffffff)
586	arrString= Array("Chicken Wings", "Cheeseburger", "Hamburger")
587	arrChar= Array("a",65, "M")
588	arrAny= Array("Mickey", 3.14, 100, "A")
589
590	Dim arrDim2Int(1,1)
591	For i= 0 To 1
592		For j= 0 To 1
593			arrDim2Int(i,j) = i*2 + j
594		Next
595	Next
596
597	Dim arrDim3Int(1,1,1)
598	For i= 0 To 1
599		For j= 0 To 1
600			For k=0 To 1
601				arrDim3Int(i,j,k) = i*2 + j*2 + k
602			Next
603		Next
604	Next
605
606
607	select case id
608		case 0
609			document.writeln "param: "
610			printArray arrInt
611			ret= oletest.methodByte(arrInt)
612			document.writeln "<br> return value: "
613			printArray ret
614		case 1
615			document.writeln "param: "
616			printArray arrDouble
617			ret= oletest.methodDouble(arrDouble)
618			document.writeln "<br> return value: "
619			printArray ret
620		case 2
621			document.writeln "param: "
622			printArray arrBool
623			ret= oletest.methodBool(arrBool)
624			document.writeln "<br> return value: "
625			printArray ret
626		case 3
627			document.writeln "param: "
628			printArray arrInt2
629			ret= oletest.methodShort(arrInt2)
630			document.writeln "<br> return value: "
631			printArray ret
632		case 4
633			document.writeln "param: "
634			printArray arrInt
635			ret= oletest.methodUShort(arrInt)
636			document.writeln "<br> return value: "
637			printArray ret
638		case 5
639			document.writeln "param: "
640			printArray arrLong
641			ret= oletest.methodLong(arrLong)
642			document.writeln "<br> return value: "
643			printArray ret
644		case 6
645			document.writeln "param: "
646			printArray arrInt
647			ret= oletest.methodULong(arrInt)
648			document.writeln "<br> return value: "
649			printArray ret
650		case 7
651			document.writeln "param: "
652			printArray arrString
653			ret= oletest.methodString(arrString)
654			document.writeln "<br> return value: "
655			printArray ret
656		case 8
657			document.writeln "param: "
658			printArray arrChar
659			ret= oletest.methodChar(arrChar)
660			document.writeln "<br> return value: "
661			printArray ret
662		case 9
663			document.writeln "param: "
664			printArray arrAny
665			ret= oletest.methodAny(arrAny)
666			document.writeln "<br> return value: "
667			printArray ret
668		case 10
669			document.writeln "param: "
670			printArray2 arrDim2Int
671			ret= oletest.methodSequence(arrDim2Int)
672			document.writeln "<br> return value: "
673			for each val in ret
674				document.write "<br> array: "
675				for each val2 in val
676					document.write val2
677				next
678			next
679
680	// Out Parameter
681		case 150
682			dim rOut
683			oletest.testout_methodByte rOut
684			MsgBox rOut
685//	void testout_methodFloat( [out] float rOut);
686//	void testout_methodDouble( [out] double rOut);
687//	void testout_methodBool( [out] boolean rOut);
688//	void testout_methodShort( [out] short rOut);
689//	void testout_methodUShort( [out] unsigned short rOut);
690//	void testout_methodLong( [out]  long rOut);
691//	void testout_methodULong( [out] unsigned long rOut);
692
693
694 // In Out Parameter --------------------------------------------------
695		case 100
696			a= 100
697			document.write "param: " & CStr(  a) & "<br>"
698			oletest.testinout_methodByte a
699			document.write a
700		case 101
701			a= 1.11
702			document.write "param: " & CStr(  a) & "<br>"
703			oletest.testinout_methodDouble a
704			document.write a
705		case 102
706			a= 5
707			document.write "param: "& CStr(  a) & "<br>"
708			oletest.testinout_methodBool a
709			document.write a
710		case 103
711			a= -10
712			document.write "param: "& CStr(  a) & "<br>"
713			oletest.testinout_methodShort a
714			document.write a
715		case 104
716			a= 128
717			document.write "param: "& CStr(  a) & "<br>"
718			oletest.testinout_methodUShort a
719			document.write a
720		case 105
721			a= 65556
722			document.write "param: "& CStr(  a) & "<br>"
723			oletest.testinout_methodLong a
724			document.write a
725		case 106
726			a= 65556
727			document.write "param: "& CStr(  a) & "<br>"
728			oletest.testinout_methodULong a
729			document.write a
730		case 107
731			a= "ein test string"
732			document.write "param: "& CStr(  a) & "<br>"
733			oletest.testinout_methodString a
734			document.write a
735		case 108
736			a= "W"
737			document.write "param: "& CStr(  a) & "<br>"
738			oletest.testinout_methodChar a
739			document.write a
740		case 109
741			a= "Ein String im Any"
742			document.write "param: "& CStr(  a) & "<br>"
743			oletest.other_methodAnyIn a
744			document.write a
745
746		case 150
747			dim a
748			document.write "param: "& CStr(  a) & "<br>"
749			oletest.testout_methodByte( a)
750			document.write a
751// Attributes -----------------------------------------------------------------
752		case 200
753			document.write "set: "
754			printArray arrInt
755			oletest.AttrByte= arrInt
756			b= oletest.AttrByte
757			call printArrayEx( "<br> get: ", "<br>", b)
758		case 201
759			document.write "set: "
760			printArray arrDouble
761			oletest.AttrDouble= arrDouble
762			b= oletest.AttrDouble
763			call printArrayEx( "<br> get: ", "<br>", b)
764		case 202
765			document.write "set: "
766			printArray arrBool :
767			oletest.AttrBool= arrBool
768			b= oletest.AttrBool
769			call printArrayEx( "<br> get: ", "<br>", b)
770		case 203
771			document.write "set: "
772			printArray arrInt2 :
773			oletest.AttrShort= arrInt2
774			b= oletest.AttrShort
775			call printArrayEx( "<br> get: ", "<br>", b)
776		case 204
777			document.write "set: "
778			printArray arrInt
779			oletest.AttrUShort= arrInt
780			b= oletest.AttrUShort
781			call printArrayEx( "<br> get: ", "<br>", b)
782		case 205
783			document.write "set: "
784			printArray arrInt2
785			oletest.AttrLong= arrInt2
786			b= oletest.AttrLong
787			call printArrayEx( "<br> get: ", "<br>", b)
788		case 206
789			document.write "set: "
790			printArray arrInt
791			oletest.AttrULong= arrInt
792			b= oletest.AttrULong
793			call printArrayEx( "<br> get: ", "<br>", b)
794		case 207
795			document.write "set: "
796			printArray arrString
797			oletest.AttrString= arrString
798			b= oletest.AttrString
799			call printArrayEx( "<br> get: ", "<br>", b)
800		case 208
801			document.write "set: "
802			printArray arrChar
803			oletest.AttrChar= arrChar
804			b= oletest.AttrChar
805			call printArrayEx( "<br> get: ", "<br>", b)
806		case 209
807			document.write "set: "
808			printArray arrAny
809			oletest.AttrAny= arrAny
810			b= oletest.AttrAny
811			call printArrayEx( "<br> get: ", "<br>", b)
812
813		case 210
814			document.write "set: <br>"
815			printArray2 arrDim2Int :
816			oletest.AttrSequence= arrDim2Int
817			ret= oletest.AttrSequence
818			document.write "get: "
819			for each val in ret
820				document.write "<br> array: "
821				for each val2 in val
822					document.write val2
823				next
824			next
825
826		case 300
827			dim aByte
828			aByte= 100
829			call oletest.testinout_methodByte( aByte)
830			MsgBox aByte
831
832
833		case 400
834
835		set  struct= oletest.Bridge_GetStruct("com.sun.star.beans.Property")
836		 struct.Attributes= 1
837		 struct.Handle= 2
838		 struct.Name= "some Property"
839		 oletest.methodStruct struct
840
841	case 401
842		set struct= oletest.retMethodStruct()
843		alert( "Property::Attributes : " & struct.Attributes & vblf & " Property::Handle : " _
844		& struct.Handle & vblf & " Property::Name : " & struct.Name)
845
846	case 402
847		set struct= oletest.Bridge_GetStruct("com.sun.star.beans.Property")
848		 struct.Attributes= 1
849		 struct.Handle= 2
850		 struct.Name= "some Property"
851		 oletest.AttrStruct=  struct
852
853		 set struct2= oletest.AttrStruct
854		alert( "property get: " & vblf & "Property::Attributes : " & struct2.Attributes & _
855		vblf & " Property::Handle : " &  struct2.Handle & vblf & " Property::Name : " _
856		& struct2.Name)
857	end select
858end sub
859
860sub printArray( arr)
861	document.write "array: "
862	For Each val In arr
863		document.write CStr(val) & " "
864	Next
865end sub
866
867// print a 2 dimensional Array
868
869sub printArray2( arr)
870		elements1= UBound( arr, 1) - LBound( arr, 1) +1
871		elements2= UBound( arr, 2) - LBound( arr, 2) +1
872
873		For i=0 To elements1 -1
874			document.write( "array " & CStr( i) & ": "  )
875			For j=0 To elements2 -1
876				document.write CStr( arr(i,j))
877			Next
878			document.write( "<br>")
879		Next
880end sub
881
882sub printArrayEx( pre, post, array)
883	document.write pre
884	printArray array
885	document.write post
886end sub
887</script>
888
889<div id=out> </div>
890
891<!-- Insert HTML here -->
892
893<h2> JScript </h2>
894Tests Array/Sequence conversion.<br>
895All methods receive a Sequence as Parameter. The element type of the Sequence is written on the buttons.
896<br>
897<button onclick='callOleTest( 1)'>byte</Button>
898<button onclick='callOleTest( 14)'>float</Button>
899<button onclick='callOleTest( 2)'>double</Button>
900<button onclick='callOleTest( 3)'>boolean</Button>
901<button onclick='callOleTest( 4)'>short</Button>
902<button onclick='callOleTest( 5)'>unsigned short</Button>
903<button onclick='callOleTest( 6)'>long</Button>
904<button onclick='callOleTest( 7)'>unsigned long</Button>
905<button onclick='callOleTest( 8)'>char</Button>
906<button onclick='callOleTest( 9)'>string</Button>
907<button onclick='callOleTest( 10)'>any</Button>
908<button onclick='callOleTest( 11)'>sequence&lt;long&gt; </Button>
909<button onclick='callOleTest( 12)'>sequence&lt;sequence&lt;long&gt; &gt; </Button>
910<button onclick='callOleTest( 13)' id=button2 name=button2>XInterface</Button>
911<button onclick='callOleTest( 15)'>XEventListener</Button>
912<button onclick='callOleTest( 16)'>sequence&lt;XEventListener&gt;</Button>
913<p>
914
915<p>
916Out Parameter <br>
917<button onclick='callOleTest( 2000)'>byte </Button>
918<button onclick='callOleTest( 2016)'>float</Button>
919<button onclick='callOleTest( 2001)'>double</Button>
920<button onclick='callOleTest( 2002)'>boolean</Button>
921<button onclick='callOleTest( 2003)'>short</Button>
922<button onclick='callOleTest( 2004)'>unsigned short</Button>
923<button onclick='callOleTest( 2005)'>long</Button>
924<button onclick='callOleTest( 2006)'>unsigned long</Button>
925<button onclick='callOleTest( 2007)'>char</Button>
926<button onclick='callOleTest( 2008)'>string</Button>
927<button onclick='callOleTest( 2009)'>any</Button>
928<button onclick='callOleTest( 2010)'>sequence&ltlong&gt </Button>
929<button onclick='callOleTest( 2011)'>sequence&ltsequence&ltlong&gt &gt </Button>
930<button onclick='callOleTest( 2012)'>2 out </Button>
931<button onclick='callOleTest( 2013)'>3 out </Button>
932<button onclick='callOleTest( 2014)'>1 in & 1 out </Button>
933<button onclick='callOleTest( 2015)'>XInterface </Button>
934<button onclick='callOleTest( 2017)'>mixed out and in </Button>
935
936
937<p>
938In Out Parameter <br>
939<button onclick='callOleTest( 500)'>byte </Button>
940<button onclick='callOleTest( 513)'>float</Button>
941<button onclick='callOleTest( 501)'>double</Button>
942<button onclick='callOleTest( 502)'>boolean</Button>
943<button onclick='callOleTest( 503)'>short</Button>
944<button onclick='callOleTest( 504)'>unsigned short</Button>
945<button onclick='callOleTest( 505)'>long</Button>
946<button onclick='callOleTest( 506)'>unsigned long</Button>
947<button onclick='callOleTest( 507)'>char</Button>
948<button onclick='callOleTest( 508)'>string</Button>
949<button onclick='callOleTest( 509)'>any</Button>
950<button onclick='callOleTest( 510)'>sequence&ltlong&gt </Button>
951<button onclick='callOleTest( 511)'>sequence&ltsequence&ltlong&gt &gt </Button>
952<button onclick='callOleTest( 512)'>XInterface </Button>
953<p>
954
955Tests Array/Sequence conversion with Attributes. All params are of type Sequence and
956 the element type of the Sequence is written on the buttons. <br>
957<button onclick='callOleTest( 200)'>byte </Button>
958<button onclick='callOleTest( 212)'>float</Button>
959<button onclick='callOleTest( 201)'>double</Button>
960<button onclick='callOleTest( 202)'>boolean</Button>
961<button onclick='callOleTest( 203)'>short</Button>
962<button onclick='callOleTest( 204)'>unsigned short</Button>
963<button onclick='callOleTest( 205)'>long</Button>
964<button onclick='callOleTest( 206)'>unsigned long</Button>
965<button onclick='callOleTest( 207)'>char</Button>
966<button onclick='callOleTest( 208)'>string</Button>
967<button onclick='callOleTest( 209)'>any</Button>
968<button onclick='callOleTest( 210)'>sequence&ltlong&gt </Button>
969<button onclick='callOleTest( 211)'>sequence&ltsequence&ltlong&gt &gt </Button>
970<p>
971
972Test of Any parameter in a method. Any contains:<br>
973<button onclick='callOleTest( 1000)'>integer </Button>
974<button onclick='callOleTest( 1001)'>double </Button>
975<button onclick='callOleTest( 1002)'>string</Button>
976<button onclick='callOleTest( 1003)'>array</Button>
977<button onclick='callOleTest( 1004)'>object</Button>
978<p>
979Test of Any parameter in a property. Any contains:<br>
980<button onclick='callOleTest( 1010)'>integer </Button>
981<button onclick='callOleTest( 1011)'>double </Button>
982<button onclick='callOleTest( 1012)'>string</Button>
983<button onclick='callOleTest( 1013)'>array</Button>
984<button onclick='callOleTest( 1014)'>object</Button>
985<P>
986Test of Struct conversions<br>
987<button onclick='callOleTest( 1020)'>methodStruct </Button>
988<button onclick='callOleTest( 1021)'>return struct</Button>
989<button onclick='callOleTest( 1022)'>struct attribute</Button>
990
991
992
993
994<p>
995
996
997<h2> Visual Basic Tests </h2>
998Test array /Sequence conversion and return value<br>
999Template: <b> Sequence &lt type &gt method( Sequence&lt type &gt ) </b> <br>
1000<!--<font color= red>Multi dimensional arrays are not processed by VBSript</font> <br>  -->
1001<button onclick='callBasic(0)'>byte</button>
1002<button onclick='callBasic(1)'>double</button>
1003<button onclick='callBasic(2)'>boolean</button>
1004<button onclick='callBasic(3)'>short</button>
1005<button onclick='callBasic(4)'>u short</button>
1006<button onclick='callBasic(5)'>long</button>
1007<button onclick='callBasic(6)'>u long</button>
1008<button onclick='callBasic(7)'>string</button>
1009<button onclick='callBasic(8)'>char</button>
1010<button onclick='callBasic(9)'>any</button> <br>
1011<button onclick='callBasic(10)'>Seq &lt int &gt</button> <br>
1012
1013
1014IN/Out parameter <br>
1015Template: <b> void method(type  ) </b> <br>
1016<button onclick='callBasic(100)'>byte</button>
1017<button onclick='callBasic(101)'>double</button>
1018<button onclick='callBasic(102)'>boolean</button>
1019<button onclick='callBasic(103)'>short</button>
1020<button onclick='callBasic(104)'>u short</button>
1021<button onclick='callBasic(105)'>long</button>
1022<button onclick='callBasic(106)'>u long</button>
1023<button onclick='callBasic(107)'>string</button>
1024<button onclick='callBasic(108)'>char</button>
1025<button onclick='callBasic(109)'>any</button> <br>
1026
1027Simple out parameter<br>
1028<button onclick='callBasic(150)'>byte</button>
1029<!--<button onclick='callBasic(151)'>double</button>
1030<button onclick='callBasic(152)'>boolean</button>
1031<button onclick='callBasic(153)'>short</button>
1032<button onclick='callBasic(155)'>long</button>
1033<button onclick='callBasic(157)'>string</button>
1034<button onclick='callBasic(158)'>char</button>
1035<button onclick='callBasic(159)'>any</button> <br>
1036//-->
1037<br>
1038
1039
1040Tests Array/Sequence conversion with <b>Attributes</b>. All params are of type Sequence and
1041 the element type of the Sequence is written on the buttons. <br>
1042<button onclick='callBasic( 200)'>byte </Button>
1043<button onclick='callBasic( 201)'>double</Button>
1044<button onclick='callBasic( 202)'>boolean</Button>
1045<button onclick='callBasic( 203)'>short</Button>
1046<button onclick='callBasic( 204)'>unsigned short</Button>
1047<button onclick='callBasic( 205)'>long</Button>
1048<button onclick='callBasic( 206)'>unsigned long</Button>
1049<button onclick='callBasic( 207)'>string</Button>
1050<button onclick='callBasic( 208)'>char</Button>
1051<button onclick='callBasic( 209)'>any</Button>
1052<button onclick='callBasic( 210)'>sequence&ltlong&gt </Button> <br>
1053
1054In Out parameter <br>
1055<button onclick='callBasic( 300)'>byte</Button>
1056<p>
1057Structs <br>
1058<button onclick='callBasic(400)'>methodStruct</button>
1059<button onclick='callBasic(401)'>return Struct</button>
1060<button onclick='callBasic(402)'>struct attribute</button>
1061
1062
1063
1064