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