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