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