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