merged tag ooo/OOO330_m14
[LibreOffice.git] / extensions / test / ole / ScriptTest.html
blob71e11145766a7ec7afe353cb240cfadc2be8ccb5
1 <HTML>
2 <HEAD>
3 <META NAME="GENERATOR" Content="Microsoft Developer Studio">
4 <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
5 <TITLE>Document Title</TITLE>
6 </HEAD>
7 <BODY id=theBody>
9 <script language="JScript">
11 function runJScriptTest( Log)
13 document.writeln("================================================================================<br>");
14 document.writeln("JScript<br>");
15 document.writeln("================================================================================<p>");
17 //var name : String = "Fred";
18 //print(name);
19 var arr= new Array( 1, 2, 3, 4, 0);
20 var arrInt= new Array( 1,2,3,4,5);
21 var arrDouble= new Array( 1.2345, 12.345, 123.45, 1234.5, 12345);
22 var arrBool= new Array( true, false, true, false, true);
23 var arrChar= new Array( '1', 'A'," ", 55);
25 var arrString= new Array("hamburger","cheeseburger", "chicken nuggets", "chicken wings" , "pizza");
26 var arrAny= new Array( 100, 100.1235,"hallo");
27 var arrSeq= new Array( arr, arr, arr);
28 var arrSeq2= new Array( );
30 var arEventListener= new Array( new XEventListener_Impl(), new XEventListener_Impl(),
31 new XEventListener_Impl());
32 var arEventListener2= new Array( new XEventListener_Impl(), new XEventListener_Impl(),
33 new XEventListener_Impl());
34 var arArEventListener= new Array( arEventListener, arEventListener2);
36 var arObj= new Array();
37 for( i=0; i< 3; i++)
39 arObj[i]= new Object();
41 var outVal= new Array();
42 var outVal2= new Array();
43 var outVal3= new Array();
45 for( i=0; i < 3; i++)
47 arrSeq2[i]= new Array();
48 for( j= 0; j < 3; j++)
50 arrSeq2[i][j]= new Array();
51 for( k= 0; k < 5; k++)
53 arrSeq2[i][j][k]= (i * 3 * 5) + (j * 5) + k;
54 // document.write(arrSeq2[i][j][k] + " ");
56 // document.write("<br>");
61 ret= oletest.methodByte( arr);
62 _ret= new VBArray( ret).toArray();
63 Log.print( isEqualAr( arr, _ret), "methodByte");
65 ret= oletest.methodFloat( arrDouble);
66 _ret= new VBArray( ret).toArray();
67 bOk= false;
68 if( (arrDouble.length == _ret.length)
69 && (_ret[0] > 1.2344 && _ret[0] < 1.2346)
70 && (_ret[1] > 12.344 && _ret[1] < 12.346)
71 && (_ret[2] > 123.44 && _ret[2] < 123.46)
72 && (_ret[3] > 1234.4 && _ret[3] < 1234.6)
73 && (_ret[4] > 12344 && _ret[4] < 12346))
74 bOk= true;
75 Log.print( bOk, "methodFloat");
77 ret= oletest.methodDouble( arrDouble);
78 _ret= new VBArray( ret).toArray();
79 Log.print( isEqualAr( arrDouble, _ret), "methodDouble");
81 ret= oletest.methodBool( arrBool);
82 _ret= new VBArray( ret).toArray();
83 Log.print( isEqualAr( arrBool, _ret), "methodBool");
85 ret= oletest.methodShort( arr);
86 _ret= new VBArray( ret).toArray();
87 Log.print( isEqualAr( arr, _ret), "methodShort");
89 ret= oletest.methodUShort( arr);
90 _ret= new VBArray( ret).toArray();
91 Log.print( isEqualAr( arr, _ret), "methodUShort");
93 ret= oletest.methodLong( arr);
94 _ret= new VBArray( ret).toArray();
95 Log.print( isEqualAr( arr, _ret), "methodLong");
97 ret= oletest.methodULong( arr);
98 _ret= new VBArray( ret).toArray();
99 Log.print( isEqualAr( arr, _ret), "methodULong");
101 ret= oletest.methodChar( arrChar);
102 _ret= new VBArray( ret).toArray();
103 bOk= false;
104 if( _ret.length == arrChar.length && _ret[0] == 49 && _ret[1] == 65 && _ret[2] == 32 && _ret[3] == 55)
105 bOk= true;
106 Log.print( bOk, "methodChar");
108 ret= oletest.methodString( arrString);
109 _ret= new VBArray( ret).toArray();
110 Log.print( isEqualAr( arrString, _ret), "methodString");
112 ret= oletest.methodAny( arrAny);
113 _ret= new VBArray( ret).toArray();
114 Log.print( isEqualAr( arrAny, _ret), "methodAny");
116 ret= oletest.methodSequence( arrSeq);
117 _ret= new VBArray( ret).toArray();
118 for( i=0; i < _ret.length; i++)
120 sfarray2= new VBArray( _ret[i]);
121 var arr2= sfarray2.toArray();
122 if( ! isEqualAr(arrSeq[i], arr2))
124 bOk= false;
125 break;
128 Log.print( bOk, "methodSequence");
130 ret= oletest.methodSequence2( arrSeq2);
131 arr1= new VBArray( ret).toArray();
132 for( i=0; i < arr1.length; i++)
134 var ar2Dim= arrSeq2[i];
135 sfarray2= new VBArray( arr1[i]);
136 arr2= sfarray2.toArray();
137 for ( j=0; j < arr2.length; j++)
139 var ar1Dim= ar2Dim[j];
140 sfarray3= new VBArray( arr2[j]);
141 arr3= sfarray3.toArray();
142 // document.write(arr3[j].toString());
143 if( ! isEqualAr( arrSeq2[i][j], arr3))
145 bOk= false;
146 break;
150 Log.print( bOk, "methodSequence2");
152 ret= oletest.methodXInterface( arObj);
153 _ret= new VBArray( ret).toArray();
154 bOk= true;
155 for(i in _ret)
157 if( _ret[i] !== arObj[i])
159 bOk= false;
160 break;
163 Log.print( bOk, "methodXInterface");
166 ret= oletest.methodXEventListeners( arEventListener);
167 _ret= new VBArray(ret).toArray();
168 bOk= true;
169 for ( key in _ret)
171 if( ! _ret[key].disposingCalled())
173 bOk= false;
174 break;
177 Log.print( bOk, "methodXEventListeners");
179 ret= oletest.methodXEventListenersMul( arArEventListener);
180 _ret= new VBArray(ret).toArray();
181 bOk= true;
182 for( key in _ret)
184 _ret2= new VBArray(_ret[key]).toArray();
185 for( key2 in _ret2)
187 if( ! _ret2[key2].disposingCalled())
189 bOk= false;
190 break;
194 Log.print( bOk, "methodXEventListenersMul");
196 document.writeln("<br>");
197 oletest.AttrByte = arr;
198 ret= oletest.AttrByte;
199 _ret= new VBArray( ret).toArray();
200 Log.print( isEqualAr( arr, _ret), "AttrByte");
202 oletest.AttrFloat= arrDouble;
203 ret= oletest.AttrFloat;
204 _ret= new VBArray( ret).toArray();
205 bOk= false;
206 if( (arrDouble.length == _ret.length)
207 && (_ret[0] > 1.2344 && _ret[0] < 1.2346)
208 && (_ret[1] > 12.344 && _ret[1] < 12.346)
209 && (_ret[2] > 123.44 && _ret[2] < 123.46)
210 && (_ret[3] > 1234.4 && _ret[3] < 1234.6)
211 && (_ret[4] > 12344 && _ret[4] < 12346))
212 bOk= true;
213 Log.print( bOk, "AttrFloat");
215 oletest.AttrDouble= arrDouble;
216 ret= oletest.AttrDouble;
217 _ret= new VBArray( ret).toArray();
218 Log.print( isEqualAr( arrDouble, _ret), "AttrDouble");
220 oletest.AttrBool= arrBool;
221 ret= oletest.AttrBool;
222 _ret= new VBArray( ret).toArray();
223 Log.print( isEqualAr( arrBool, _ret), "AttrBool");
225 oletest.AttrShort= arr;
226 ret= oletest.AttrShort;
227 _ret= new VBArray( ret).toArray();
228 Log.print( isEqualAr( arr, _ret), "AttrShort");
230 oletest.AttrUShort= arr;
231 ret= oletest.AttrUShort;
232 _ret= new VBArray( ret).toArray();
233 Log.print( isEqualAr( arr, _ret), "AttrUShort");
235 oletest.AttrLong= arr;
236 ret= oletest.AttrLong;
237 _ret= new VBArray( ret).toArray();
238 Log.print( isEqualAr( arr, _ret), "AttrLong");
240 oletest.AttrULong= arr;
241 ret= oletest.AttrULong;
242 _ret= new VBArray( ret).toArray();
243 Log.print( isEqualAr( arr, _ret), "AttrULong");
245 oletest.AttrChar= arrChar;
246 ret= oletest.AttrChar;
247 _ret= new VBArray(ret).toArray();
248 bOk= false;
249 if( _ret.length == arrChar.length && _ret[0] == 49 && _ret[1] == 65 && _ret[2] == 32 && _ret[3] == 55)
250 bOk= true;
251 Log.print( bOk, "AttrChar");
253 oletest.AttrString= arrString;
254 ret= oletest.AttrString;
255 _ret= new VBArray( ret).toArray();
256 Log.print( isEqualAr( arrString, _ret), "AttrString");
258 oletest.AttrAny= arrAny;
259 ret= oletest.AttrAny;
260 _ret= new VBArray( ret).toArray();
261 Log.print( isEqualAr( arrAny, _ret), "AttrAny");
263 oletest.AttrSequence= arrSeq;
264 ret= oletest.AttrSequence;
265 _ret= new VBArray( ret).toArray();
266 for( i=0; i < _ret.length; i++)
268 sfarray2= new VBArray( _ret[i]);
269 var arr2= sfarray2.toArray();
270 if( ! isEqualAr(arrSeq[i], arr2))
272 bOk= false;
273 break;
276 Log.print( bOk, "AttrSequence");
278 oletest.AttrSequence2= arrSeq2;
279 ret= oletest.AttrSequence2;
280 arr1= new VBArray( ret).toArray();
281 for( i=0; i < arr1.length; i++)
283 var ar2Dim= arrSeq2[i];
284 sfarray2= new VBArray( arr1[i]);
285 arr2= sfarray2.toArray();
286 for ( j=0; j < arr2.length; j++)
288 var ar1Dim= ar2Dim[j];
289 sfarray3= new VBArray( arr2[j]);
290 arr3= sfarray3.toArray();
291 if( ! isEqualAr( arrSeq2[i][j], arr3))
293 bOk= false;
294 break;
298 Log.print( bOk, "AttrSequence2");
300 oletest.AttrXInterface= arObj;
301 ret= oletest.AttrXInterface;
302 _ret= new VBArray( ret).toArray();
303 bOk= true;
304 for(i in _ret)
306 if( _ret[i] !== arObj[i])
308 bOk= false;
309 break;
312 Log.print( bOk, "AttrXInterface");
314 ret= oletest.methodXInterface( arObj);
315 _ret= new VBArray( ret);
316 _ret= _ret.toArray();
317 bOk= true;
318 for(i in _ret)
320 if( _ret[i] !== arObj[i])
322 bOk= false;
323 break;
326 Log.print( bOk, "methodXInterface");
327 //======================================================================================
328 document.writeln("<br>");
329 var inVal, outVal, retVal;
330 outVal = new Array();
332 inVal = 77;
333 retVal = oletest.in_methodByte(inVal)
334 oletest.testout_methodByte( outVal );
335 Log.print( retVal == inVal, "in_methodByte");
336 Log.print( outVal[0] == inVal, "testout_methodByte");
338 inVal = 3.14
339 retVal = oletest.in_methodFloat(inVal);
340 oletest.testout_methodFloat( outVal );
341 Log.print( retVal > 3.14 && retVal < 3.15, "in_methodFloat");
342 Log.print( outVal[0] > 3.13 && outVal[0] < 3.15, "testout_methodFloat");
343 //Log.print( outVal[0] == inVal, "testout_methodFloat");
345 retVal = oletest.in_methodDouble(inVal)
346 oletest.testout_methodDouble( outVal );
347 Log.print( retVal == inVal, "in_methodDouble");
348 Log.print( outVal[0] == 3.14, "testout_methodDouble" );
350 inVal = true;
351 retVal = oletest.in_methodBool(inVal);
352 oletest.testout_methodBool( outVal );
353 Log.print(retVal == inVal, "in_methodBool");
354 Log.print( outVal[0] == true, "testout_methodBool");
356 inVal = 111
357 retVal = oletest.in_methodShort(inVal);
358 oletest.testout_methodShort( outVal );
359 Log.print(retVal == inVal, "in_methodShort");
360 Log.print( outVal[0] == inVal, "testout_methodShort");
362 retVal = oletest.in_methodUShort(inVal);
363 oletest.testout_methodUShort( outVal );
364 Log.print(retVal == inVal, "in_methodUShort");
365 Log.print( outVal[0] == inVal, "testout_methodUShort");
367 retVal = oletest.in_methodLong(inVal);
368 oletest.testout_methodLong( outVal );
369 Log.print(retVal == inVal, "in_methodLong");
370 Log.print( outVal[0] == inVal, "testout_methodLong");
372 retVal = oletest.in_methodULong(inVal);
373 oletest.testout_methodULong( outVal );
374 Log.print(retVal == inVal, "in_methodULong");
375 Log.print( outVal[0] == inVal, "testout_methodULong");
377 retVal = oletest.in_methodChar(inVal);
378 oletest.testout_methodChar( outVal );
379 Log.print(retVal == inVal, "in_methodChar");
380 Log.print( outVal[0] == inVal, "testout_methodChar");
382 inVal = "Hello World";
383 retVal = oletest.in_methodString(inVal);
384 oletest.testout_methodString( outVal );
385 Log.print(retVal == inVal, "in_methodString");
386 Log.print( outVal[0] == inVal, "testout_methodString");
388 retVal = oletest.in_methodAny(inVal);
389 oletest.testout_methodAny( outVal );
390 Log.print(retVal == inVal, "in_methodAny");
391 Log.print( outVal[0] == inVal, "testout_methodAny");
393 inVal = new Object();
394 retVal = oletest.in_methodXInterface(inVal);
395 oletest.testout_methodXInterface(outVal);
396 Log.print(retVal === inVal, "in_methodXInterface");
397 Log.print(outVal[0] === inVal, "testout_methodXInterface");
399 inVal = oletest;
400 retVal = oletest.in_methodXInterface(inVal);
401 oletest.testout_methodXInterface(outVal);
402 Log.print(retVal === inVal, "in_methodXInterface");
403 Log.print(outVal[0] === inVal, "testout_methodXInterface");
406 oletest.testout_methodSequence( outVal );
407 var arr= new VBArray( outVal[0]).toArray();
408 Log.print( isEqualAr(arr, new Array( 0,1,2,3,4,5,6,7,8,9)), "testout_methodSequence");
410 oletest.testout_methodSequence2( outVal );
411 var arr= new VBArray( outVal[0]).toArray();
412 bOk= true;
413 if( arr.length= 10)
415 for( i=0; i < arr.length; i++)
417 var arr2= new VBArray( arr[i]).toArray();
418 if( ! isEqualAr( arr2, new Array( 0,1,2,3,4,5,6,7,8,9)))
420 bOk= false;
421 break;
425 Log.print( bOk, "testout_methodSequence2");
427 oletest.testout_methodMulParams1( outVal, outVal2 );
428 Log.print( outVal[0] == 999 && outVal2[0] == 1111, "testout_methodMulParams1");
430 oletest.testout_methodMulParams2( outVal, outVal2, outVal3 );
431 Log.print( outVal[0] == 1111 && outVal2[0] == 1222 && outVal3[0] == " another string",
432 "testout_methodMulParams2");
434 oletest.testout_methodMulParams3( "hallo", outVal );
435 Log.print( outVal[0] == "Out Hallo!", "testout_methodMulParams3");
437 var in1= 3.14;
438 var in2= 1111;
439 var in3= -2222;
440 oletest.testout_methodMulParams4( in1, outVal, in2, outVal2, in3 );
441 Log.print( (outVal[0] > 4.13 && outVal[0] < 4.15) && (outVal2[0] == 1112), "testout_methodMulParams4");
443 document.writeln("<p>");
445 inVal = 100;
446 outVal[0]= inVal;
447 oletest.testinout_methodByte( outVal );
448 oletest.testinout_methodByte( outVal );
449 Log.print( outVal[0] == inVal, "testinout_methodByte");
451 inVal = 3.14;
452 outVal[0]= inVal;
453 oletest.testinout_methodFloat( outVal );
454 oletest.testinout_methodFloat( outVal );
455 Log.print( outVal[0] > 3.13 && outVal[0] < 3.15, "testinout_methodFloat");
457 inVal = 3.14
458 outVal[0]= inVal;
459 oletest.testinout_methodDouble( outVal );
460 oletest.testinout_methodDouble( outVal );
461 Log.print( outVal[0] == inVal, "testinout_methodDouble");
463 inVal = true;
464 outVal[0]= inVal;
465 oletest.testinout_methodBool( outVal );
466 oletest.testinout_methodBool( outVal );
467 Log.print( outVal[0] == inVal, "testinout_methodBool");
469 inVal = 200;
470 outVal[0]= inVal;
471 oletest.testinout_methodShort( outVal );
472 oletest.testinout_methodShort( outVal );
473 Log.print( outVal[0] == inVal, "testinout_methodShort");
475 inVal = 300;
476 outVal[0]= inVal;
477 oletest.testinout_methodUShort( outVal );
478 oletest.testinout_methodUShort( outVal );
479 Log.print( outVal[0] == inVal, "testinout_methodUShort");
481 inVal = 400
482 outVal[0]= inVal;
483 oletest.testinout_methodLong( outVal );
484 oletest.testinout_methodLong( outVal );
485 Log.print( outVal[0] == inVal, "testinout_methodLong");
487 inVal = 500;
488 outVal[0]= inVal;
489 oletest.testinout_methodULong( outVal );
490 oletest.testinout_methodULong( outVal );
491 Log.print( outVal[0] == inVal, "testinout_methodULong");
493 inVal = "B";
494 outVal[0]= inVal;
495 oletest.testinout_methodChar( outVal );
496 oletest.testinout_methodChar( outVal );
498 Log.print( outVal[0] == 66, "testinout_methodChar");
500 inVal = "Hello World 2!";
501 outVal[0]= inVal;
502 oletest.testinout_methodString( outVal );
503 oletest.testinout_methodString( outVal );
504 Log.print( outVal[0] == inVal, "testinout_methodString");
506 inVal = new Object();
507 outVal[0]= inVal;
508 oletest.testinout_methodAny( outVal );
509 oletest.testinout_methodAny( outVal );
510 Log.print( outVal[0] === inVal, "testinout_methodAny");
512 inVal = arrInt;
513 outVal[0] = inVal;
514 oletest.testinout_methodSequence( outVal );
515 oletest.testinout_methodSequence( outVal );
516 retVal = new VBArray(outVal[0]).toArray();
518 Log.print( isEqualAr(retVal, new Array(3,4,5,6,7)), "testinout_methodSequence");
521 outVal[0]= arrSeq;
522 oletest.testinout_methodSequence2( outVal );
523 var arr= new VBArray( outVal[0]).toArray();
524 var i;
525 bOk= true;
526 if( arr.length == 3)
528 var tmpArr= new Array(2,4,6,8,0);
529 for( i=0; i < arr.length; i++)
531 var arr2= new VBArray( arr[i]).toArray();
532 if( ! isEqualAr( arr2, tmpArr))
534 bOk= false;
535 break;
539 Log.print( bOk, "testinout_methodSequence2");
542 var ob= new Object();
543 var sInVal= "this is a string"
544 ob.value= sInVal;
545 outVal[0]= ob;
546 oletest.testinout_methodXInterface( outVal);
547 Log.print( outVal[0].value == "out", "testinout_methodXInterface");
548 document.writeln("<p>");
550 i= 100;
551 ret= oletest.methodAnyTest1( i);
552 Log.print( i == ret, "methodAnyTest1");
554 i= 3.14;
555 ret= oletest.methodAnyTest1( i);
556 Log.print( i == ret, "methodAnyTest1");
558 i= "Hallo"
559 ret= oletest.methodAnyTest1( i);
560 Log.print( i == ret, "methodAnyTest1");
562 i= arrInt;
563 ret= oletest.methodAnyTest1( i);
564 var arr= new VBArray( ret).toArray();
565 Log.print( isEqualAr(arr, arrInt), "methodAnyTest1");
567 var obj= new Object();
568 ret= oletest.methodAnyTest1( obj);
569 Log.print( obj == ret, "methodAnyTest1");
572 document.writeln("<p>");
574 i= 100;
575 oletest.AttrAny2= i;
576 ret= oletest.AttrAny2;
577 Log.print( i == ret, "AttrAny2");
579 i= 3.14;
580 oletest.AttrAny2= i;
581 ret= oletest.AttrAny2;
582 Log.print( i == ret, "AttrAny2");
584 i= "Hallo"
585 oletest.AttrAny2= i;
586 ret= oletest.AttrAny2;
587 Log.print( i == ret, "AttrAny2");
589 i= arrInt;
590 oletest.AttrAny2= i;
591 ret= oletest.AttrAny2;
592 var arr= new VBArray( ret).toArray();
593 Log.print( isEqualAr(arr, arrInt), "AttrAny2");
595 var obj= new Object();
596 oletest.AttrAny2= obj;
597 ret= oletest.AttrAny2;
598 Log.print( obj == ret, "AttrAny2");
601 document.writeln("<p>");
602 // Structs ----------------------------------------------
604 /* var struct= oletest._GetStruct("com.sun.star.beans.Property"); */
605 /* struct.Attributes= 1; */
606 /* struct.Handle= 2; */
607 /* struct.Name= "some Property" */
608 /* oletest.methodStruct( struct); */
610 var ret= oletest.retMethodStruct();
611 Log.print( ret.Attributes == 127 && ret.Handle == 255 && ret.Name == "OleTest_Property", "retMethodStruct");
613 var astruct= oletest._GetStruct("com.sun.star.beans.Property");
614 astruct.Attributes= 1;
615 astruct.Handle= 2;
616 astruct.Name= "some Property"
617 oletest.AttrStruct= astruct;
619 var ret= oletest.AttrStruct;
620 Log.print( ret.Attributes == 127 && ret.Handle == 255 && ret.Name == "OleTest_Property", "AttrStruct");
622 // The function returns the struct. Since structs are passed by value the returned struct
623 // will be wrapped in another IDispatch object
624 astruct.Attributes= 1;
625 astruct.Handle= 2;
626 astruct.Name= "Property";
627 ret= oletest.methodStruct2( astruct);
628 Log.print( ret.Attributes == 1 && ret.Handle == 2 && ret.Name == "Property", "methodStruct2");
631 document.writeln("<p>");
632 // Test Identity from COM objects in UNO
633 var listener1= new XEventListener_Impl();
634 oletest.setObject(listener1);
635 ret= oletest.isSame(listener1);
636 Log.print2( ret, "Ok Testing identity of COM objects<br>","Failed Testing identity of COM objects<br>");
638 var oletest2= oletest.getThis();
639 ret= oletest === oletest2;
640 Log.print2(ret, "Ok Testing identity of UNO objects<br>","Failed Testing identity of UNO objects<br>");
646 function isEqualAr( ar1, ar2)
648 var bOk= false;
649 if( ar1.length == ar2.length)
651 bOk= true;
652 for( x in ar1)
654 // document.writeln( ar1[x] + " ");
655 // document.writeln( ar2[x] + " ");
656 if( ar1[x] != ar2[x])
658 bOk= false;
659 break;
663 return bOk;
666 /* function isEqualAr2( ar1, ar2) */
667 /* { */
669 /* var bOk= false; */
670 /* if( ar1.length == ar2.length) */
671 /* { */
672 /* bOk= true; */
673 /* for( x in ar1) */
674 /* { */
675 /* document.write( ar1[x]); */
676 /* document.write( ar2[x]); */
677 /* if( ! isEqualAr( ar1[x], ar2[x])) */
678 /* { */
679 /* bOk= false; */
680 /* break; */
681 /* } */
682 /* } */
683 /* } */
684 /* return bOk; */
686 /* } */
688 function XEventListener_Impl()
690 this._environment= "JScript";
691 this._implementedInterfaces= new Array( "com.sun.star.lang.XEventListener");
693 //XEventListener
694 this.disposing= XEventListener_disposing;
696 this.bdisposingCalled= false;
697 this.bQuiet= true;
698 this.resetDisposing= XEventListener_resetDisposing;
699 this.disposingCalled= XEventListener_disposingCalled;
702 function XEventListener_disposing( source)
704 if( !this.bQuiet)
705 alert("JScript Event Listener \n disposing is being called");
706 this.bdisposingCalled= true;
709 function XEventListener_resetDisposing()
711 this.bdisposingCalled= false;
714 function XEventListener_disposingCalled()
716 return this.bdisposingCalled;
718 </script>
720 <script language="VBScript">
721 Function runVBTest( Log)
722 document.writeln("================================================================================<br>")
723 document.writeln("VB Script<br>")
724 document.writeln("================================================================================<p>")
726 Dim arrInt
727 arrInt= Array(1,2,3,-4,-5, 0)
728 arrUInt= Array(1,2,3,4,5)
729 arrDouble= Array( 1.2345, 12.345, 123.45, 1234.5, 12345)
730 arrBool= Array( true, false, true, false, true)
731 arrChar= Array("A","B",67)
732 arrString= Array("hamburger","cheeseburger", "chicken nuggets", "chicken wings" , "pizza")
733 arrAny= Array( 100, 100.1235,"hallo")
736 Dim arrDim2Int(2,1)
737 Dim i,j,k
738 For i= 0 To 1
739 For j= 0 To 2
740 arrDim2Int(j,i) = i*3 + j
741 Next
742 Next
745 Dim arrDim3Int(3,2,1)
746 For i= 0 To 1
747 For j= 0 To 2
748 For k= 0 To 3
749 arrDim3Int(k,j,i)= i* 3 + j* 4 + k
750 Next
751 Next
752 Next
754 Dim arrXEvent(2)
755 For i= 0 To 2
756 Set arrXEvent(i)= new VBEventListener
757 Next
759 Dim arrXEvent2(2,1)
760 For i= 0 To 1
761 For j= 0 To 2
762 Set arrXEvent2(j,i)= new VBEventListener
763 Next
764 Next
768 ret= oletest.methodByte( arrUInt)
769 Log.print isEqualVBAr( ret, arrUInt), "methodByte"
771 ret= oletest.methodFloat( arrDouble)
772 Log.print isEqualVBAr( ret, arrDouble), "methodFloat"
774 ret= oletest.methodDouble( arrDouble)
775 Log.print isEqualVBAr( ret, arrDouble), "methodDouble"
777 ret= oletest.methodBool( arrBool)
778 Log.print isEqualVBAr( ret, arrBool), "methodBool"
780 ret= oletest.methodShort( arrInt)
781 Log.print isEqualVBAr( ret, arrInt), "methodShort"
783 ret= oletest.methodUShort( arrUInt)
784 Log.print isEqualVBAr( ret, arrUInt), "methodUShort"
786 ret= oletest.methodLong( arrInt)
787 Log.print isEqualVBAr( ret, arrInt), "methodLong"
789 ret= oletest.methodULong( arrUInt)
790 Log.print isEqualVBAr( ret, arrUInt), "methodULong"
792 ret= oletest.methodChar( arrChar)
793 bOk= false
794 if ret(0) = 65 AND ret(1) = 66 AND ret(2) = 67 then
795 bOk= true
796 end if
797 Log.print bOk, "methodChar"
799 ret= oletest.methodString( arrString)
800 Log.print isEqualVBAr( ret, arrString), "methodString"
802 ret= oletest.methodAny( arrAny)
803 Log.print isEqualVBAr( ret, arrAny), "methodAny"
806 ret= oletest.methodSequence( arrDim2Int)
807 bOk= true
809 For i= 0 To 1
810 Dim arr1
811 arr1= ret(i)
812 For j= 0 To 2
813 if arr1(j) <> arrDim2Int(j,i) then
814 bOk= false
815 exit for
816 end if
817 Next
818 Next
819 Log.print bOk, "methodSequence"
821 ret= oletest.methodSequence2( arrDim3Int)
822 'arrDim3Int(3,2,1)
823 bOk= true
824 For i= 0 To 1
825 arr1= ret(i)
826 For j= 0 To 2
827 arr2= arr1(j)
828 For k= 0 To 3
829 If arr2(k) <> arrDim3Int(k,j,i) then
830 bOk= false
831 exit for
832 End If
833 Next
834 Next
835 Next
836 Log.print bOk, "methodSequence2"
838 ret= oletest.methodXInterface(arrXEvent)
839 bOk= true
840 numArg= UBound( arrXEvent) - LBound( arrXEvent) + 1
841 numRet= UBound( ret) - LBound( ret) + 1
842 If numArg = numRet then
843 For i= 0 To numArg - 1
844 If NOT (arrXEvent(i) Is ret(i)) then
845 bOk= false
846 Exit For
847 End if
848 Next
849 End If
850 Log.print bOk, "methodXInterface"
852 ret= oletest.methodXEventListeners( arrXEvent)
853 bOk= true
854 For i= 0 To 2
855 If arrXEvent(i).disposingCalled = false then
856 bOk= false
857 Exit For
858 End If
859 Next
860 Log.print bOk, "methodXEventListeners"
862 ret= oletest.methodXEventListenersMul(arrXEvent2)
863 bOk= true
864 For i= 0 To 1
865 For j= 0 To 2
866 If arrXEvent2(j,i).disposingCalled = false then
867 bOk= false
868 Exit For
869 End If
870 Next
871 Next
872 Log.print bOk, "methodXEventListenersMul"
874 ' Attributes ------------------------------------------------------
875 document.writeln( "<br>" )
876 oletest.AttrByte= arrUInt
877 ret= oletest.AttrByte
878 Log.print isEqualVBAr( arrUInt, ret), "AttrByte"
880 oletest.AttrFloat= arrDouble
881 ret= oletest.AttrFloat
882 Log.print isEqualVBAr( arrDouble, ret), "AttrFloat"
884 oletest.AttrDouble= arrDouble
885 ret= oletest.AttrDouble
886 Log.print isEqualVBAr( arrDouble, ret), "AttrDouble"
888 oletest.AttrBool= arrBool
889 ret= oletest.AttrBool
890 Log.print isEqualVBAr( arrBool, ret), "AttrBool"
892 oletest.AttrShort= arrInt
893 ret= oletest.AttrShort
894 Log.print isEqualVBAr( arrInt, ret), "AttrShort"
896 oletest.AttrUShort= arrUInt
897 ret= oletest.AttrUShort
898 Log.print isEqualVBAr( arrUInt, ret), "AttrUShort"
900 oletest.AttrLong= arrInt
901 ret= oletest.AttrLong
902 Log.print isEqualVBAr( arrInt, ret), "AttrLong"
904 oletest.AttrULong= arrUInt
905 ret= oletest.AttrULong
906 Log.print isEqualVBAr( arrUInt, ret), "AttrULong"
908 oletest.AttrChar= arrChar
909 ret= oletest.AttrChar
910 bOk= false
911 if ret(0) = 65 AND ret(1) = 66 AND ret(2) = 67 then
912 bOk= true
913 end if
914 Log.print bOk, "AttrChar"
916 oletest.AttrString= arrString
917 ret= oletest.AttrString
918 Log.print isEqualVBAr( arrString, ret), "AttrString"
920 oletest.AttrSequence= arrDim2Int
921 ret= oletest.AttrSequence
922 bOk= true
923 For i= 0 To 1
924 arr1= ret(i)
925 For j= 0 To 2
926 if arr1(j) <> arrDim2Int(j,i) then
927 bOk= false
928 exit for
929 end if
930 Next
931 Next
932 Log.print bOk, "AttrSequence"
934 oletest.AttrSequence2= arrDim3Int
935 ret= oletest.AttrSequence2
936 'arrDim3Int(3,2,1)
937 bOk= true
938 For i= 0 To 1
939 arr1= ret(i)
940 For j= 0 To 2
941 arr2= arr1(j)
942 For k= 0 To 3
943 If arr2(k) <> arrDim3Int(k,j,i) then
944 bOk= false
945 exit for
946 End If
947 Next
948 Next
949 Next
950 Log.print bOk, "AttrSequence2"
952 oletest.AttrXInterface= arrXEvent
953 ret= oletest.AttrXInterface
954 bOk= true
955 numArg= UBound( arrXEvent) - LBound( arrXEvent) + 1
956 numRet= UBound( ret) - LBound( ret) + 1
957 If numArg = numRet then
958 For i= 0 To numArg - 1
959 If NOT (arrXEvent(i) Is ret(i)) then
960 bOk= false
961 Exit For
962 End if
963 Next
964 End If
965 Log.print bOk, "AttrXInterface"
967 'out params ================================================================================
968 document.writeln("<p>")
969 Dim inVal, outVal, retVal
971 inVal = 111
972 retVal = oletest.in_methodByte(inVal)
973 oletest.testout_methodByte outVal
974 Log.print inVal = retVal, "in_methodByte"
975 Log.print outVal = inVal, "testout_methodByte"
977 inVal = 3.14
978 retVal = oletest.in_methodFloat(inVal)
979 oletest.testout_methodFloat outVal
980 Log.print inVal = retVal, "in_methodFloat"
981 Log.print outVal > 3.13 AND outVal < 3.15, "testout_methodFloat"
983 inVal = 3.14
984 retVal = oletest.in_methodDouble(inVal)
985 oletest.testout_methodDouble outVal
986 Log.print inVal = retVal, "in_methodDouble"
987 Log.print outVal = 3.14, "testout_methodDouble"
989 inVal = true
990 retVal = oletest.in_methodBool(inVal)
991 oletest.testout_methodBool outVal
992 Log.print inVal = retVal, "in_methodBool"
993 Log.print outVal = inVal, "testout_methodBool"
995 inVal = 222
996 retVal = oletest.in_methodShort(inVal)
997 oletest.testout_methodShort outVal
998 Log.print inVal = retVal, "in_methodShort"
999 Log.print outVal = inVAl, "testout_methodShort"
1001 inVal = 333
1002 retVal = oletest.in_methodUShort(inVal)
1003 oletest.testout_methodUShort outVal
1004 Log.print inVal = retVal, "in_methodUShort"
1005 Log.print outVal = inVal, "testout_methodUShort"
1007 inVal = 4444
1008 retVal = oletest.in_methodLong(inVal)
1009 oletest.testout_methodLong outVal
1010 Log.print inVal = retVal, "in_methodLong"
1011 Log.print outVal = inVal, "testout_methodLong"
1013 inVal = 5555
1014 retVal = oletest.in_methodULong(inVal)
1015 oletest.testout_methodULong outVal
1016 Log.print inVal = retVal, "in_methodULong"
1017 Log.print outVal = inVal, "testout_methodULong"
1019 inVal = 65
1020 retVal = oletest.in_methodChar(inVal)
1021 oletest.testout_methodChar outVal
1022 Log.print inVal = retVal, "in_methodChar"
1023 Log.print outVal = 65, "testout_methodChar"
1025 inVal = "Hello World 3!"
1026 retVal = oletest.in_methodString(inVal)
1027 oletest.testout_methodString outVal
1028 Log.print inVal = retVal, "in_methodString"
1029 Log.print outVal = inVal, "testout_methodString"
1031 inVal = "Hello World 4!"
1032 retVal = oletest.in_methodAny(inVal)
1033 oletest.testout_methodAny outVal
1034 Log.print outVal = inVal, "testout_methodAny"
1036 oletest.testout_methodSequence outVal
1037 Log.print isEqualVBAr(outVal, Array( 0,1,2,3,4,5,6,7,8,9)), "testout_methodSequence"
1039 oletest.testout_methodSequence2 outVal
1040 count= UBound( outVal) - LBound( outVal) + 1
1041 ret= False
1042 If count = 10 Then
1043 For Each ar In outVal
1044 ret= isEqualVBAr(ar, Array( 0,1,2,3,4,5,6,7,8,9))
1045 If ret = false Then
1046 Exit For
1047 End If
1048 Next
1049 End If
1050 Log.print ret, "testout_methodSequence2"
1052 outVal= Empty
1053 outVal2= Empty
1054 oletest.testout_methodMulParams1 outVal, outVal2
1055 ret= false
1056 If outVal = 999 AND outVal2 = 1111 Then
1057 ret= true
1058 End If
1059 Log.print ret, "testout_methodMulParams1"
1061 outVal= Empty
1062 outVal2= Empty
1063 outVal3= Empty
1064 oletest.testout_methodMulParams2 outVal, outVal2, outVal3
1065 ret = false
1066 If outVal = 1111 AND outVal2 = 1222 AND outVal3 = " another string" Then
1067 ret= true
1068 End If
1069 Log.print ret, "testout_methodMulParams2"
1071 document.writeln("missing: testout_methodMulParams3 <br>")
1072 document.writeln("missing: testout_methodMulParams4 <br>")
1074 outVal= Empty
1075 oletest.testout_methodXInterface outVal
1076 ret= false
1077 If outVal Is oletest Then
1078 ret= true
1079 End If
1080 Log.print ret, "testout_methodXInterface"
1082 Set outVal= Nothing
1083 document.writeln("missing: testout_methodXInterface <br>")
1085 inVal = 1
1086 outVal= inVal
1087 oletest.testinout_methodByte outVal
1088 oletest.testinout_methodByte outVal
1089 Log.print inVal = outVal, "testinout_methodByte"
1092 document.writeln("missing: testinout_methodFloat <br>")
1093 document.writeln("missing: testinout_methodDouble <br>")
1094 document.writeln("missing: testinout_methodBool <br>")
1095 document.writeln("missing: testinout_methodShort <br>")
1096 document.writeln("missing: testinout_methodUShort <br>")
1097 document.writeln("missing: testinout_methodLong <br>")
1098 document.writeln("missing: testinout_methodULong <br>")
1099 document.writeln("missing: testinout_methodChar <br>")
1100 document.writeln("missing: testinout_methodString <br>")
1101 document.writeln("missing: testinout_methodAny <br>")
1102 document.writeln("missing: testinout_methodSequence <br>")
1103 document.writeln("missing: testinout_methodSequence2 <br>")
1104 document.writeln("missing: testinout_methodXInterface <br>")
1105 document.writeln("missing: methodAnyTest1 <br>")
1106 document.writeln("missing: methodAnyTest1 <br>")
1107 document.writeln("missing: methodAnyTest1 <br>")
1108 document.writeln("missing: methodAnyTest1 <br>")
1109 document.writeln("missing: methodAnyTest1 <br>")
1110 document.writeln("missing: AttrAny2 <br>")
1111 document.writeln("missing: methodAnyTest1 <br>")
1112 document.writeln("missing: methodAnyTest1 <br>")
1113 document.writeln("missing: methodAnyTest1 <br>")
1114 document.writeln("missing: methodAnyTest1 <br>")
1115 document.writeln("missing: methodAnyTest1 <br>")
1116 document.writeln("missing: retMethodStruct <br>")
1117 document.writeln("missing: AttrStruct <br>")
1118 document.writeln("missing: methodStruct2 <br>")
1120 ' Test Identity from COM objects in UNO
1121 Dim listener1
1122 Set listener1= new VBEventListener
1123 call oletest.setObject( listener1)
1124 ret= oletest.isSame(listener1)
1125 Log.print2 ret, "Ok Testing identity of COM objects <br>","Failed Testing identity of COM objects<br>"
1126 ' Test identity of UNO objects
1128 set oletest2= oletest.getThis()
1129 ret= oletest Is oletest2
1130 Log.print2 ret, "Ok Testing identity of UNO objects<br>","Failed Testing identity of UNO objects<br>"
1132 End Function
1135 Function isEqualVBAr( arr1, arr2)
1136 ret = false
1137 s1= UBound( arr1) - LBound( arr1) + 1
1138 s2= UBound( arr2) - LBound( arr2) + 1
1140 if s1 = s2 then
1141 ret= true
1142 Dim i
1143 for i= 0 To s1 - 1
1144 if arr1(i) <> arr2(i) then
1145 ret= false
1146 exit for
1147 end if
1148 next
1149 end if
1150 isEqualVBar= ret
1151 End Function
1154 'The listener object
1156 Class VBEventListener
1157 Dim Bridge_ImplementedInterfaces(0)
1158 Dim bDisposingCalled
1160 'XEventListener::disposing
1161 Function disposing( source)
1162 bDisposingCalled= true
1163 End Function
1165 Sub Class_Initialize()
1166 bDisposingCalled= false
1167 Bridge_ImplementedInterfaces(0)= "com.sun.star.lang.XEventListener"
1168 End Sub
1170 Function resetDisposing()
1171 bDisposingCalled= false
1172 End Function
1174 Function disposingCalled()
1175 disposingCalled= bDisposingCalled
1176 End Function
1177 End Class
1180 sub callBasic(id)
1182 Dim factory
1183 Set factory= GetObject("", "com.sun.star.ServiceManager")
1185 Set oletest= factory.createInstance("oletest.OleTest")
1188 arrInt= Array(1,2,3,4,5)
1189 arrInt2= Array( -1, -2, 127, 128, 0)
1190 arrDouble= Array(1.1, 2.2, 3.3, 4.4, 5.5)
1191 arrBool= Array(0,1,0,2,0)
1192 arrLong= Array( &Hff, &Hffff, &Hffffff, &Hffffffff)
1193 arrString= Array("Chicken Wings", "Cheeseburger", "Hamburger")
1194 arrChar= Array("a",65, "M")
1195 arrAny= Array("Mickey", 3.14, 100, "A")
1197 Dim arrDim2Int(1,2)
1198 For i= 0 To 1
1199 For j= 0 To 1
1200 arrDim2Int(i,j) = i*2 + j
1201 Next
1202 Next
1204 Dim arrDim3Int(1,1,1)
1205 For i= 0 To 1
1206 For j= 0 To 1
1207 For k=0 To 1
1208 arrDim3Int(i,j,k) = i*2 + j*2 + k
1209 Next
1210 Next
1211 Next
1214 select case id
1216 // Out Parameter
1220 // In Out Parameter --------------------------------------------------
1221 case 100
1222 a= 100
1223 document.write "param: " & CStr( a) & "<br>"
1224 oletest.testinout_methodByte a
1225 document.write a
1226 case 101
1227 a= 1.11
1228 document.write "param: " & CStr( a) & "<br>"
1229 oletest.testinout_methodDouble a
1230 document.write a
1231 case 102
1232 a= 5
1233 document.write "param: "& CStr( a) & "<br>"
1234 oletest.testinout_methodBool a
1235 document.write a
1236 case 103
1237 a= -10
1238 document.write "param: "& CStr( a) & "<br>"
1239 oletest.testinout_methodShort a
1240 document.write a
1241 case 104
1242 a= 128
1243 document.write "param: "& CStr( a) & "<br>"
1244 oletest.testinout_methodUShort a
1245 document.write a
1246 case 105
1247 a= 65556
1248 document.write "param: "& CStr( a) & "<br>"
1249 oletest.testinout_methodLong a
1250 document.write a
1251 case 106
1252 a= 65556
1253 document.write "param: "& CStr( a) & "<br>"
1254 oletest.testinout_methodULong a
1255 document.write a
1256 case 107
1257 a= "ein test string"
1258 document.write "param: "& CStr( a) & "<br>"
1259 oletest.testinout_methodString a
1260 document.write a
1261 case 108
1262 a= "W"
1263 document.write "param: "& CStr( a) & "<br>"
1264 oletest.testinout_methodChar a
1265 document.write a
1266 case 109
1267 a= "Ein String im Any"
1268 document.write "param: "& CStr( a) & "<br>"
1269 oletest.other_methodAnyIn a
1270 document.write a
1272 case 150
1273 dim a
1274 document.write "param: "& CStr( a) & "<br>"
1275 oletest.testout_methodByte( a)
1276 document.write a
1277 // Attributes -----------------------------------------------------------------
1278 case 200
1279 document.write "set: "
1280 printArray arrInt
1281 oletest.AttrByte= arrInt
1282 b= oletest.AttrByte
1283 call printArrayEx( "<br> get: ", "<br>", b)
1284 case 201
1285 document.write "set: "
1286 printArray arrDouble
1287 oletest.AttrDouble= arrDouble
1288 b= oletest.AttrDouble
1289 call printArrayEx( "<br> get: ", "<br>", b)
1290 case 202
1291 document.write "set: "
1292 printArray arrBool :
1293 oletest.AttrBool= arrBool
1294 b= oletest.AttrBool
1295 call printArrayEx( "<br> get: ", "<br>", b)
1296 case 203
1297 document.write "set: "
1298 printArray arrInt2 :
1299 oletest.AttrShort= arrInt2
1300 b= oletest.AttrShort
1301 call printArrayEx( "<br> get: ", "<br>", b)
1302 case 204
1303 document.write "set: "
1304 printArray arrInt
1305 oletest.AttrUShort= arrInt
1306 b= oletest.AttrUShort
1307 call printArrayEx( "<br> get: ", "<br>", b)
1308 case 205
1309 document.write "set: "
1310 printArray arrInt2
1311 oletest.AttrLong= arrInt2
1312 b= oletest.AttrLong
1313 call printArrayEx( "<br> get: ", "<br>", b)
1314 case 206
1315 document.write "set: "
1316 printArray arrInt
1317 oletest.AttrULong= arrInt
1318 b= oletest.AttrULong
1319 call printArrayEx( "<br> get: ", "<br>", b)
1320 case 207
1321 document.write "set: "
1322 printArray arrString
1323 oletest.AttrString= arrString
1324 b= oletest.AttrString
1325 call printArrayEx( "<br> get: ", "<br>", b)
1326 case 208
1327 document.write "set: "
1328 printArray arrChar
1329 oletest.AttrChar= arrChar
1330 b= oletest.AttrChar
1331 call printArrayEx( "<br> get: ", "<br>", b)
1332 case 209
1333 document.write "set: "
1334 printArray arrAny
1335 oletest.AttrAny= arrAny
1336 b= oletest.AttrAny
1337 call printArrayEx( "<br> get: ", "<br>", b)
1339 case 210
1340 document.write "set: <br>"
1341 printArray2 arrDim2Int :
1342 oletest.AttrSequence= arrDim2Int
1343 ret= oletest.AttrSequence
1344 document.write "get: "
1345 for each val in ret
1346 document.write "<br> array: "
1347 for each val2 in val
1348 document.write val2
1349 next
1350 next
1352 case 300
1353 dim aByte
1354 aByte= 100
1355 call oletest.testinout_methodByte( aByte)
1356 MsgBox aByte
1359 case 400
1361 set struct= oletest.Bridge_GetStruct("com.sun.star.beans.Property")
1362 struct.Attributes= 1
1363 struct.Handle= 2
1364 struct.Name= "some Property"
1365 oletest.methodStruct struct
1367 case 401
1368 set struct= oletest.retMethodStruct()
1369 alert( "Property::Attributes : " & struct.Attributes & vblf & " Property::Handle : " _
1370 & struct.Handle & vblf & " Property::Name : " & struct.Name)
1372 case 402
1373 set struct= oletest.Bridge_GetStruct("com.sun.star.beans.Property")
1374 struct.Attributes= 1
1375 struct.Handle= 2
1376 struct.Name= "some Property"
1377 oletest.AttrStruct= struct
1379 set struct2= oletest.AttrStruct
1380 alert( "property get: " & vblf & "Property::Attributes : " & struct2.Attributes & _
1381 vblf & " Property::Handle : " & struct2.Handle & vblf & " Property::Name : " _
1382 & struct2.Name)
1383 end select
1384 end sub
1386 sub printArray( arr)
1387 document.write "array: "
1388 For Each val In arr
1389 document.write CStr(val) & " "
1390 Next
1391 end sub
1393 // print a 2 dimensional Array
1395 sub printArray2( arr)
1396 elements1= UBound( arr, 1) - LBound( arr, 1) +1
1397 elements2= UBound( arr, 2) - LBound( arr, 2) +1
1399 For i=0 To elements1 -1
1400 document.write( "array " & CStr( i) & ": " )
1401 For j=0 To elements2 -1
1402 document.write CStr( arr(i,j))
1403 Next
1404 document.write( "<br>")
1405 Next
1406 end sub
1408 sub printArrayEx( pre, post, array)
1409 document.write pre
1410 printArray array
1411 document.write post
1412 end sub
1413 </script>
1415 <script language="JScript">
1416 var arFunctions= new Array();
1417 arFunctions["methodByte"]= "sequence&lt;byte&gt; methodByte( [in] sequence&lt;byte&gt; aSeq )";
1418 arFunctions["methodFloat"]= "sequence&lt;float&gt; methodFloat( [in] sequence&lt;float&gt; aSeq)";
1419 arFunctions["methodDouble"]= "sequence&lt;double&gt; methodDouble( [in] sequence&lt;double&gt; aSeq)";
1420 arFunctions["methodBool"]= "sequence&lt;boolean&gt; methodBool( [in] sequence&lt;boolean&gt; aSeq)";
1421 arFunctions["methodShort"]= "sequence&lt;short&gt; methodShort( [in] sequence&lt;short&gt; aSeq)";
1422 arFunctions["methodUShort"]= "sequence&lt;unsigned short&gt; methodUShort( [in] sequence&lt;unsigned short&gt; aSeq)";
1423 arFunctions["methodLong"]= "sequence&lt;long&gt; methodLong( [in] sequence&lt;long&gt; aSeq)";
1424 arFunctions["methodULong"]= "sequence&lt;unsigned long&gt; methodULong( [in] sequence&lt;unsigned long&gt; aSeq)";
1425 arFunctions["methodString"]= "sequence&lt;string&gt; methodString( [in] sequence&lt;string&gt; aSeq)";
1426 arFunctions["methodChar"]= "sequence&lt;char&gt; methodChar( [in] sequence&lt;char&gt; aSeq)";
1427 arFunctions["methodAny"]= "sequence&lt;any&gt; methodAny ( [in] sequence&lt;any&gt; aSeq)";
1428 arFunctions["methodXInterface"]= "sequence&lt;XInterface&gt; methodXInterface ( [in] sequence&lt;XInterface&gt; aSeq)";
1429 arFunctions["methodSequence"]= "sequence&lt; sequence &lt;long&gt; &gt; methodSequence( [in] sequence&lt; sequence&lt; long &gt; &gt; aSeq)";
1430 arFunctions["methodSequence2"]= "sequence&lt; sequence &lt;sequence &lt;long&gt; &gt; &gt; methodSequence2( [in] sequence&lt; sequence&lt; sequence&lt;long&gt; &gt; &gt; aSeq)";
1431 arFunctions["methodXEventListeners"]= "sequence&lt; com::sun::star::lang::XEventListener &gt; methodXEventListeners( [in] sequence&lt;com::sun::star::lang::XEventListener&gt; aSeq)";
1432 arFunctions["methodXEventListenersMul"]= "sequence&lt; sequence&lt; com::sun::star::lang::XEventListener &gt; &gt; methodXEventListenersMul( [in] sequence&lt; sequence&lt; com::sun::star::lang::XEventListener&gt; &gt; aSeq)";
1433 arFunctions["AttrByte"]="[attribute] sequence<byte> AttrByte";
1434 arFunctions["AttrFloat"]="[attribute] sequence<float> AttrFloat";
1435 arFunctions["AttrDouble"]="[attribute] sequence<double> AttrDouble";
1436 arFunctions["AttrBool"]="[attribute] sequence<boolean> AttrBool";
1437 arFunctions["AttrShort"]="[attribute] sequence<short> AttrShort";
1438 arFunctions["AttrUShort"]="[attribute] sequence<unsigned short> AttrUShort";
1439 arFunctions["AttrLong"]="[attribute] sequence<long> AttrLong";
1440 arFunctions["AttrULong"]="[attribute] sequence<unsigned long> AttrULong";
1441 arFunctions["AttrString"]="[attribute] sequence<string> AttrString";
1442 arFunctions["AttrChar"]="[attribute] sequence<char> AttrChar";
1443 arFunctions["AttrAny"]="[attribute] sequence<any> AttrAny";
1444 arFunctions["AttrSequence"]="[attribute] sequence< sequence<long> > AttrSequence";
1445 arFunctions["AttrSequence2"]="[attribute] sequence< sequence< sequence <long> > > AttrSequence2";
1446 arFunctions["AttrXInterface"]="[attribute] sequence< com::sun::star::uno::XInterface > AttrXInterface";
1448 arFunctions["testout_methodByte"]= " void testout_methodByte( [out] byte rOut )";
1449 arFunctions["testout_methodFloat"]= "void testout_methodFloat( [out] float rOut)";
1450 arFunctions["testout_methodDouble"]= "void testout_methodDouble( [out] double rOut)";
1451 arFunctions["testout_methodBool"]= "void testout_methodBool( [out] boolean rOut)";
1452 arFunctions["testout_methodShort"]= "void testout_methodShort( [out] short rOut)";
1453 arFunctions["testout_methodUShort"]= "void testout_methodUShort( [out] unsigned short rOut)";
1454 arFunctions["testout_methodLong"]= "void testout_methodLong( [out] long rOut)";
1455 arFunctions["testout_methodULong"]= "void testout_methodULong( [out] unsigned long rOut)";
1456 arFunctions["testout_methodString"]= "void testout_methodString( [out] string rOut)";
1457 arFunctions["testout_methodChar"]= "void testout_methodChar( [out] char rOut)";
1458 arFunctions["testout_methodAny"]= "void testout_methodAny( [out] any rOut)";
1459 arFunctions["testout_methodSequence"]= "void testout_methodSequence( [out] sequence< long > rOut)";
1460 arFunctions["testout_methodSequence2"]= "void testout_methodSequence2( [out] sequence < sequence< long > > rOut)";
1461 arFunctions["testout_methodXInterface"]= "void testout_methodXInterface( [out] com::sun::star::uno::XInterface rOut)";
1462 arFunctions["testout_methodMulParams1"]= "void testout_methodMulParams1( [out] long rout1, [out] long rout2)";
1463 arFunctions["testout_methodMulParams2"]= "void testout_methodMulParams2( [out] long rout1, [out] long rout2, [out] string rout3)";
1464 arFunctions["testout_methodMulParams3"]= "void testout_methodMulParams3( [in] string sin, [out] string sout)";
1465 arFunctions["testout_methodMulParams4"]= "void testout_methodMulParams4( [in] float in1, [out] float out1, [in] long in2, [out] long out2, [in] long in3)";
1466 arFunctions["testinout_methodByte"]="void testinout_methodByte( [inout] byte rOut )";
1467 arFunctions["testinout_methodFloat"]="void testinout_methodFloat( [inout] float rOut)";
1468 arFunctions["testinout_methodDouble"]="void testinout_methodDouble( [inout] double rOut)";
1469 arFunctions["testinout_methodBool"]="void testinout_methodBool( [inout] boolean rOut)";
1470 arFunctions["testinout_methodShort"]="void testinout_methodShort( [inout] short rOut)";
1471 arFunctions["testinout_methodUShort"]="void testinout_methodUShort( [inout] unsigned short rOut)";
1472 arFunctions["testinout_methodLong"]="void testinout_methodLong( [inout] long rOut)";
1473 arFunctions["testinout_methodULong"]="void testinout_methodULong( [inout] unsigned long rOut)";
1474 arFunctions["testinout_methodString"]="void testinout_methodString( [inout] string rOut)";
1475 arFunctions["testinout_methodChar"]="void testinout_methodChar( [inout] char rOut)";
1476 arFunctions["testinout_methodAny"]="void testinout_methodAny( [inout] any rOut)";
1477 arFunctions["testinout_methodSequence"]="void testinout_methodSequence( [inout] sequence< long > rOut)";
1478 arFunctions["testinout_methodSequence2"]="void testinout_methodSequence2( [inout] sequence < sequence< long > > rOut)";
1479 arFunctions["testinout_methodXInterface"]="void testinout_methodXInterface( [inout] com::sun::star::script::XInvocation rOut)";
1480 arFunctions["testinout_methodXInterface2"]="void testinout_methodXInterface2( [inout] com::sun::star::uno::XInterface rOut)";
1482 arFunctions["in_methodByte"]= "byte in_methodByte( [in] byte rIn )";
1483 arFunctions["in_methodFloat"]= "float in_methodFloat( [in] float rIn);"
1484 arFunctions["in_methodDouble"]= "double in_methodDouble( [in] double rIn)";
1485 arFunctions["in_methodBool"]= "boolean in_methodBool( [in] boolean rIn)";
1486 arFunctions["in_methodShort"]= "short in_methodShort( [in] short rIn)";
1487 arFunctions["in_methodUShort"]= "unsigned short in_methodUShort( [in] unsigned short rIn)";
1488 arFunctions["in_methodLong"]= "long in_methodLong( [in] long rIn)";
1489 arFunctions["in_methodULong"]= "unsigned long in_methodULong( [in] unsigned long rIn)";
1490 arFunctions["in_methodHyper"]= "hyper in_methodHyper( [in] hyper rIn)";
1491 arFunctions["in_methodUHyper"]= "unsigned hyper in_methodHyper( [in] unsigned hyper rIn)";
1492 arFunctions["in_methodString"]= "string in_methodString( [in] string rIn)";
1493 arFunctions["in_methodChar"]= "char in_methodChar( [in] char rIn)";
1494 arFunctions["in_methodAny"]= "any in_methodAny ( [in] any rIn)";
1495 arFunctions["in_methodXInterface"]= "XInterface in_methodXInterface([in] XInterface rIn)";
1498 arFunctions["methodAnyTest1"]="any methodAnyTest1( [in] any rIn)";
1499 arFunctions["AttrAny2"]= "[attribute] any AttrAny2";
1500 arFunctions["retMethodStruct"]= "com::sun::star::beans::Property retMethodStruct()";
1501 arFunctions["AttrStruct"]= "[attribute] com::sun::star::beans::Property AttrStruct";
1502 arFunctions["methodStruct2"]= "com::sun::star::beans::Property methodStruct2( [in] com::sun::star::beans::Property aProp)";
1505 var factory= new ActiveXObject("com.sun.star.ServiceManager");
1506 var oletest= factory.createInstance("oletest.OleTest");
1508 Log= new Logger();
1511 runJScriptTest(Log);
1512 runVBTest(Log);
1513 Log.summarize();
1516 function Logger()
1518 this.print= logger_print;
1519 this.print2= logger_print2;
1520 this.summarize= logger_summarize;
1521 this.bAllOk= true;
1523 function logger_print( bool, method)
1525 this.print2(bool, "Ok &nbsp;&nbsp;&nbsp;&nbsp;" + arFunctions[method] + "<br>",
1526 "Failed &nbsp;&nbsp;&nbsp;&nbsp;" + arFunctions[method] + "<br>");
1529 function logger_print2( bool, okString, failedString)
1531 if( bool)
1532 document.writeln( okString);
1533 else
1535 document.writeln( failedString);
1536 this.bAllOk= this.bAllOk && false;
1540 function logger_summarize()
1542 document.writeln("<p> ==============================================================================<br>");
1543 if(this.bAllOk)
1544 document.writeln("No errors <br>");
1545 else
1546 document.writeln("Error ! The test failed! <br>");
1550 </script>
1552 </body>
1553 </html>