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