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> 8 9<script language="JScript"> 10 11function runJScriptTest( Log) 12{ 13document.writeln("================================================================================<br>"); 14document.writeln("JScript<br>"); 15document.writeln("================================================================================<p>"); 16 17//var name : String = "Fred"; 18//print(name); 19var arr= new Array( 1, 2, 3, 4, 0); 20var arrInt= new Array( 1,2,3,4,5); 21var arrDouble= new Array( 1.2345, 12.345, 123.45, 1234.5, 12345); 22var arrBool= new Array( true, false, true, false, true); 23var arrChar= new Array( '1', 'A'," ", 55); 24 25var arrString= new Array("hamburger","cheeseburger", "chicken nuggets", "chicken wings" , "pizza"); 26var arrAny= new Array( 100, 100.1235,"hallo"); 27var arrSeq= new Array( arr, arr, arr); 28var arrSeq2= new Array( ); 29 30var arEventListener= new Array( new XEventListener_Impl(), new XEventListener_Impl(), 31 new XEventListener_Impl()); 32var arEventListener2= new Array( new XEventListener_Impl(), new XEventListener_Impl(), 33 new XEventListener_Impl()); 34var arArEventListener= new Array( arEventListener, arEventListener2); 35 36var arObj= new Array(); 37for( i=0; i< 3; i++) 38{ 39 arObj[i]= new Object(); 40} 41var outVal= new Array(); 42var outVal2= new Array(); 43var outVal3= new Array(); 44 45for( i=0; i < 3; i++) 46{ 47 arrSeq2[i]= new Array(); 48 for( j= 0; j < 3; j++) 49 { 50 arrSeq2[i][j]= new Array(); 51 for( k= 0; k < 5; k++) 52 { 53 arrSeq2[i][j][k]= (i * 3 * 5) + (j * 5) + k; 54// document.write(arrSeq2[i][j][k] + " "); 55 } 56// document.write("<br>"); 57 } 58} 59 60 61ret= oletest.methodByte( arr); 62_ret= new VBArray( ret).toArray(); 63Log.print( isEqualAr( arr, _ret), "methodByte"); 64 65ret= oletest.methodFloat( arrDouble); 66_ret= new VBArray( ret).toArray(); 67bOk= false; 68if( (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; 75Log.print( bOk, "methodFloat"); 76 77ret= oletest.methodDouble( arrDouble); 78_ret= new VBArray( ret).toArray(); 79Log.print( isEqualAr( arrDouble, _ret), "methodDouble"); 80 81ret= oletest.methodBool( arrBool); 82_ret= new VBArray( ret).toArray(); 83Log.print( isEqualAr( arrBool, _ret), "methodBool"); 84 85ret= oletest.methodShort( arr); 86_ret= new VBArray( ret).toArray(); 87Log.print( isEqualAr( arr, _ret), "methodShort"); 88 89ret= oletest.methodUShort( arr); 90_ret= new VBArray( ret).toArray(); 91Log.print( isEqualAr( arr, _ret), "methodUShort"); 92 93ret= oletest.methodLong( arr); 94_ret= new VBArray( ret).toArray(); 95Log.print( isEqualAr( arr, _ret), "methodLong"); 96 97ret= oletest.methodULong( arr); 98_ret= new VBArray( ret).toArray(); 99Log.print( isEqualAr( arr, _ret), "methodULong"); 100 101ret= oletest.methodChar( arrChar); 102_ret= new VBArray( ret).toArray(); 103bOk= false; 104if( _ret.length == arrChar.length && _ret[0] == 49 && _ret[1] == 65 && _ret[2] == 32 && _ret[3] == 55) 105 bOk= true; 106Log.print( bOk, "methodChar"); 107 108ret= oletest.methodString( arrString); 109_ret= new VBArray( ret).toArray(); 110Log.print( isEqualAr( arrString, _ret), "methodString"); 111 112ret= oletest.methodAny( arrAny); 113_ret= new VBArray( ret).toArray(); 114Log.print( isEqualAr( arrAny, _ret), "methodAny"); 115 116ret= oletest.methodSequence( arrSeq); 117_ret= new VBArray( ret).toArray(); 118for( i=0; i < _ret.length; i++) 119{ 120 sfarray2= new VBArray( _ret[i]); 121 var arr2= sfarray2.toArray(); 122 if( ! isEqualAr(arrSeq[i], arr2)) 123 { 124 bOk= false; 125 break; 126 } 127} 128Log.print( bOk, "methodSequence"); 129 130ret= oletest.methodSequence2( arrSeq2); 131arr1= new VBArray( ret).toArray(); 132for( i=0; i < arr1.length; i++) 133{ 134 var ar2Dim= arrSeq2[i]; 135 sfarray2= new VBArray( arr1[i]); 136 arr2= sfarray2.toArray(); 137 for ( j=0; j < arr2.length; j++) 138 { 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)) 144 { 145 bOk= false; 146 break; 147 } 148 } 149} 150Log.print( bOk, "methodSequence2"); 151 152ret= oletest.methodXInterface( arObj); 153_ret= new VBArray( ret).toArray(); 154bOk= true; 155for(i in _ret) 156{ 157 if( _ret[i] !== arObj[i]) 158 { 159 bOk= false; 160 break; 161 } 162} 163Log.print( bOk, "methodXInterface"); 164 165 166ret= oletest.methodXEventListeners( arEventListener); 167_ret= new VBArray(ret).toArray(); 168bOk= true; 169for ( key in _ret) 170{ 171 if( ! _ret[key].disposingCalled()) 172 { 173 bOk= false; 174 break; 175 } 176} 177Log.print( bOk, "methodXEventListeners"); 178 179ret= oletest.methodXEventListenersMul( arArEventListener); 180_ret= new VBArray(ret).toArray(); 181bOk= true; 182for( key in _ret) 183{ 184 _ret2= new VBArray(_ret[key]).toArray(); 185 for( key2 in _ret2) 186 { 187 if( ! _ret2[key2].disposingCalled()) 188 { 189 bOk= false; 190 break; 191 } 192 } 193} 194Log.print( bOk, "methodXEventListenersMul"); 195 196document.writeln("<br>"); 197oletest.AttrByte = arr; 198ret= oletest.AttrByte; 199_ret= new VBArray( ret).toArray(); 200Log.print( isEqualAr( arr, _ret), "AttrByte"); 201 202oletest.AttrFloat= arrDouble; 203ret= oletest.AttrFloat; 204_ret= new VBArray( ret).toArray(); 205bOk= false; 206if( (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; 213Log.print( bOk, "AttrFloat"); 214 215oletest.AttrDouble= arrDouble; 216ret= oletest.AttrDouble; 217_ret= new VBArray( ret).toArray(); 218Log.print( isEqualAr( arrDouble, _ret), "AttrDouble"); 219 220oletest.AttrBool= arrBool; 221ret= oletest.AttrBool; 222_ret= new VBArray( ret).toArray(); 223Log.print( isEqualAr( arrBool, _ret), "AttrBool"); 224 225oletest.AttrShort= arr; 226ret= oletest.AttrShort; 227_ret= new VBArray( ret).toArray(); 228Log.print( isEqualAr( arr, _ret), "AttrShort"); 229 230oletest.AttrUShort= arr; 231ret= oletest.AttrUShort; 232_ret= new VBArray( ret).toArray(); 233Log.print( isEqualAr( arr, _ret), "AttrUShort"); 234 235oletest.AttrLong= arr; 236ret= oletest.AttrLong; 237_ret= new VBArray( ret).toArray(); 238Log.print( isEqualAr( arr, _ret), "AttrLong"); 239 240oletest.AttrULong= arr; 241ret= oletest.AttrULong; 242_ret= new VBArray( ret).toArray(); 243Log.print( isEqualAr( arr, _ret), "AttrULong"); 244 245oletest.AttrChar= arrChar; 246ret= oletest.AttrChar; 247_ret= new VBArray(ret).toArray(); 248bOk= false; 249if( _ret.length == arrChar.length && _ret[0] == 49 && _ret[1] == 65 && _ret[2] == 32 && _ret[3] == 55) 250 bOk= true; 251Log.print( bOk, "AttrChar"); 252 253oletest.AttrString= arrString; 254ret= oletest.AttrString; 255_ret= new VBArray( ret).toArray(); 256Log.print( isEqualAr( arrString, _ret), "AttrString"); 257 258oletest.AttrAny= arrAny; 259ret= oletest.AttrAny; 260_ret= new VBArray( ret).toArray(); 261Log.print( isEqualAr( arrAny, _ret), "AttrAny"); 262 263oletest.AttrSequence= arrSeq; 264ret= oletest.AttrSequence; 265_ret= new VBArray( ret).toArray(); 266for( i=0; i < _ret.length; i++) 267{ 268 sfarray2= new VBArray( _ret[i]); 269 var arr2= sfarray2.toArray(); 270 if( ! isEqualAr(arrSeq[i], arr2)) 271 { 272 bOk= false; 273 break; 274 } 275} 276Log.print( bOk, "AttrSequence"); 277 278oletest.AttrSequence2= arrSeq2; 279ret= oletest.AttrSequence2; 280arr1= new VBArray( ret).toArray(); 281for( i=0; i < arr1.length; i++) 282{ 283 var ar2Dim= arrSeq2[i]; 284 sfarray2= new VBArray( arr1[i]); 285 arr2= sfarray2.toArray(); 286 for ( j=0; j < arr2.length; j++) 287 { 288 var ar1Dim= ar2Dim[j]; 289 sfarray3= new VBArray( arr2[j]); 290 arr3= sfarray3.toArray(); 291 if( ! isEqualAr( arrSeq2[i][j], arr3)) 292 { 293 bOk= false; 294 break; 295 } 296 } 297} 298Log.print( bOk, "AttrSequence2"); 299 300oletest.AttrXInterface= arObj; 301ret= oletest.AttrXInterface; 302_ret= new VBArray( ret).toArray(); 303bOk= true; 304for(i in _ret) 305{ 306 if( _ret[i] !== arObj[i]) 307 { 308 bOk= false; 309 break; 310 } 311} 312Log.print( bOk, "AttrXInterface"); 313 314ret= oletest.methodXInterface( arObj); 315_ret= new VBArray( ret); 316_ret= _ret.toArray(); 317bOk= true; 318for(i in _ret) 319{ 320 if( _ret[i] !== arObj[i]) 321 { 322 bOk= false; 323 break; 324 } 325} 326Log.print( bOk, "methodXInterface"); 327//====================================================================================== 328document.writeln("<br>"); 329var inVal, outVal, retVal; 330outVal = new Array(); 331 332inVal = 77; 333retVal = oletest.in_methodByte(inVal) 334oletest.testout_methodByte( outVal ); 335Log.print( retVal == inVal, "in_methodByte"); 336Log.print( outVal[0] == inVal, "testout_methodByte"); 337 338inVal = 3.14 339retVal = oletest.in_methodFloat(inVal); 340oletest.testout_methodFloat( outVal ); 341Log.print( retVal > 3.14 && retVal < 3.15, "in_methodFloat"); 342Log.print( outVal[0] > 3.13 && outVal[0] < 3.15, "testout_methodFloat"); 343//Log.print( outVal[0] == inVal, "testout_methodFloat"); 344 345retVal = oletest.in_methodDouble(inVal) 346oletest.testout_methodDouble( outVal ); 347Log.print( retVal == inVal, "in_methodDouble"); 348Log.print( outVal[0] == 3.14, "testout_methodDouble" ); 349 350inVal = true; 351retVal = oletest.in_methodBool(inVal); 352oletest.testout_methodBool( outVal ); 353Log.print(retVal == inVal, "in_methodBool"); 354Log.print( outVal[0] == true, "testout_methodBool"); 355 356inVal = 111 357retVal = oletest.in_methodShort(inVal); 358oletest.testout_methodShort( outVal ); 359Log.print(retVal == inVal, "in_methodShort"); 360Log.print( outVal[0] == inVal, "testout_methodShort"); 361 362retVal = oletest.in_methodUShort(inVal); 363oletest.testout_methodUShort( outVal ); 364Log.print(retVal == inVal, "in_methodUShort"); 365Log.print( outVal[0] == inVal, "testout_methodUShort"); 366 367retVal = oletest.in_methodLong(inVal); 368oletest.testout_methodLong( outVal ); 369Log.print(retVal == inVal, "in_methodLong"); 370Log.print( outVal[0] == inVal, "testout_methodLong"); 371 372retVal = oletest.in_methodULong(inVal); 373oletest.testout_methodULong( outVal ); 374Log.print(retVal == inVal, "in_methodULong"); 375Log.print( outVal[0] == inVal, "testout_methodULong"); 376 377retVal = oletest.in_methodChar(inVal); 378oletest.testout_methodChar( outVal ); 379Log.print(retVal == inVal, "in_methodChar"); 380Log.print( outVal[0] == inVal, "testout_methodChar"); 381 382inVal = "Hello World"; 383retVal = oletest.in_methodString(inVal); 384oletest.testout_methodString( outVal ); 385Log.print(retVal == inVal, "in_methodString"); 386Log.print( outVal[0] == inVal, "testout_methodString"); 387 388retVal = oletest.in_methodAny(inVal); 389oletest.testout_methodAny( outVal ); 390Log.print(retVal == inVal, "in_methodAny"); 391Log.print( outVal[0] == inVal, "testout_methodAny"); 392 393inVal = new Object(); 394retVal = oletest.in_methodXInterface(inVal); 395oletest.testout_methodXInterface(outVal); 396Log.print(retVal === inVal, "in_methodXInterface"); 397Log.print(outVal[0] === inVal, "testout_methodXInterface"); 398 399inVal = oletest; 400retVal = oletest.in_methodXInterface(inVal); 401oletest.testout_methodXInterface(outVal); 402Log.print(retVal === inVal, "in_methodXInterface"); 403Log.print(outVal[0] === inVal, "testout_methodXInterface"); 404 405 406oletest.testout_methodSequence( outVal ); 407var arr= new VBArray( outVal[0]).toArray(); 408Log.print( isEqualAr(arr, new Array( 0,1,2,3,4,5,6,7,8,9)), "testout_methodSequence"); 409 410oletest.testout_methodSequence2( outVal ); 411var arr= new VBArray( outVal[0]).toArray(); 412bOk= true; 413if( arr.length= 10) 414{ 415 for( i=0; i < arr.length; i++) 416 { 417 var arr2= new VBArray( arr[i]).toArray(); 418 if( ! isEqualAr( arr2, new Array( 0,1,2,3,4,5,6,7,8,9))) 419 { 420 bOk= false; 421 break; 422 } 423 } 424} 425Log.print( bOk, "testout_methodSequence2"); 426 427oletest.testout_methodMulParams1( outVal, outVal2 ); 428Log.print( outVal[0] == 999 && outVal2[0] == 1111, "testout_methodMulParams1"); 429 430oletest.testout_methodMulParams2( outVal, outVal2, outVal3 ); 431Log.print( outVal[0] == 1111 && outVal2[0] == 1222 && outVal3[0] == " another string", 432 "testout_methodMulParams2"); 433 434oletest.testout_methodMulParams3( "hallo", outVal ); 435Log.print( outVal[0] == "Out Hallo!", "testout_methodMulParams3"); 436 437var in1= 3.14; 438var in2= 1111; 439var in3= -2222; 440oletest.testout_methodMulParams4( in1, outVal, in2, outVal2, in3 ); 441Log.print( (outVal[0] > 4.13 && outVal[0] < 4.15) && (outVal2[0] == 1112), "testout_methodMulParams4"); 442 443document.writeln("<p>"); 444 445inVal = 100; 446outVal[0]= inVal; 447oletest.testinout_methodByte( outVal ); 448oletest.testinout_methodByte( outVal ); 449Log.print( outVal[0] == inVal, "testinout_methodByte"); 450 451inVal = 3.14; 452outVal[0]= inVal; 453oletest.testinout_methodFloat( outVal ); 454oletest.testinout_methodFloat( outVal ); 455Log.print( outVal[0] > 3.13 && outVal[0] < 3.15, "testinout_methodFloat"); 456 457inVal = 3.14 458outVal[0]= inVal; 459oletest.testinout_methodDouble( outVal ); 460oletest.testinout_methodDouble( outVal ); 461Log.print( outVal[0] == inVal, "testinout_methodDouble"); 462 463inVal = true; 464outVal[0]= inVal; 465oletest.testinout_methodBool( outVal ); 466oletest.testinout_methodBool( outVal ); 467Log.print( outVal[0] == inVal, "testinout_methodBool"); 468 469inVal = 200; 470outVal[0]= inVal; 471oletest.testinout_methodShort( outVal ); 472oletest.testinout_methodShort( outVal ); 473Log.print( outVal[0] == inVal, "testinout_methodShort"); 474 475inVal = 300; 476outVal[0]= inVal; 477oletest.testinout_methodUShort( outVal ); 478oletest.testinout_methodUShort( outVal ); 479Log.print( outVal[0] == inVal, "testinout_methodUShort"); 480 481inVal = 400 482outVal[0]= inVal; 483oletest.testinout_methodLong( outVal ); 484oletest.testinout_methodLong( outVal ); 485Log.print( outVal[0] == inVal, "testinout_methodLong"); 486 487inVal = 500; 488outVal[0]= inVal; 489oletest.testinout_methodULong( outVal ); 490oletest.testinout_methodULong( outVal ); 491Log.print( outVal[0] == inVal, "testinout_methodULong"); 492 493inVal = "B"; 494outVal[0]= inVal; 495oletest.testinout_methodChar( outVal ); 496oletest.testinout_methodChar( outVal ); 497 498Log.print( outVal[0] == 66, "testinout_methodChar"); 499 500inVal = "Hello World 2!"; 501outVal[0]= inVal; 502oletest.testinout_methodString( outVal ); 503oletest.testinout_methodString( outVal ); 504Log.print( outVal[0] == inVal, "testinout_methodString"); 505 506inVal = new Object(); 507outVal[0]= inVal; 508oletest.testinout_methodAny( outVal ); 509oletest.testinout_methodAny( outVal ); 510Log.print( outVal[0] === inVal, "testinout_methodAny"); 511 512inVal = arrInt; 513outVal[0] = inVal; 514oletest.testinout_methodSequence( outVal ); 515oletest.testinout_methodSequence( outVal ); 516retVal = new VBArray(outVal[0]).toArray(); 517 518Log.print( isEqualAr(retVal, new Array(3,4,5,6,7)), "testinout_methodSequence"); 519 520 521outVal[0]= arrSeq; 522oletest.testinout_methodSequence2( outVal ); 523var arr= new VBArray( outVal[0]).toArray(); 524var i; 525bOk= true; 526if( arr.length == 3) 527{ 528 var tmpArr= new Array(2,4,6,8,0); 529 for( i=0; i < arr.length; i++) 530 { 531 var arr2= new VBArray( arr[i]).toArray(); 532 if( ! isEqualAr( arr2, tmpArr)) 533 { 534 bOk= false; 535 break; 536 } 537 } 538} 539Log.print( bOk, "testinout_methodSequence2"); 540 541 542var ob= new Object(); 543var sInVal= "this is a string" 544ob.value= sInVal; 545outVal[0]= ob; 546oletest.testinout_methodXInterface( outVal); 547Log.print( outVal[0].value == "out", "testinout_methodXInterface"); 548document.writeln("<p>"); 549 550i= 100; 551ret= oletest.methodAnyTest1( i); 552Log.print( i == ret, "methodAnyTest1"); 553 554i= 3.14; 555ret= oletest.methodAnyTest1( i); 556Log.print( i == ret, "methodAnyTest1"); 557 558i= "Hallo" 559ret= oletest.methodAnyTest1( i); 560Log.print( i == ret, "methodAnyTest1"); 561 562i= arrInt; 563ret= oletest.methodAnyTest1( i); 564var arr= new VBArray( ret).toArray(); 565Log.print( isEqualAr(arr, arrInt), "methodAnyTest1"); 566 567var obj= new Object(); 568ret= oletest.methodAnyTest1( obj); 569Log.print( obj == ret, "methodAnyTest1"); 570 571 572document.writeln("<p>"); 573 574i= 100; 575oletest.AttrAny2= i; 576ret= oletest.AttrAny2; 577Log.print( i == ret, "AttrAny2"); 578 579i= 3.14; 580oletest.AttrAny2= i; 581ret= oletest.AttrAny2; 582Log.print( i == ret, "AttrAny2"); 583 584i= "Hallo" 585oletest.AttrAny2= i; 586ret= oletest.AttrAny2; 587Log.print( i == ret, "AttrAny2"); 588 589i= arrInt; 590oletest.AttrAny2= i; 591ret= oletest.AttrAny2; 592var arr= new VBArray( ret).toArray(); 593Log.print( isEqualAr(arr, arrInt), "AttrAny2"); 594 595var obj= new Object(); 596oletest.AttrAny2= obj; 597ret= oletest.AttrAny2; 598Log.print( obj == ret, "AttrAny2"); 599 600 601document.writeln("<p>"); 602// Structs ---------------------------------------------- 603 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); */ 609 610var ret= oletest.retMethodStruct(); 611Log.print( ret.Attributes == 127 && ret.Handle == 255 && ret.Name == "OleTest_Property", "retMethodStruct"); 612 613var astruct= oletest._GetStruct("com.sun.star.beans.Property"); 614astruct.Attributes= 1; 615astruct.Handle= 2; 616astruct.Name= "some Property" 617oletest.AttrStruct= astruct; 618 619var ret= oletest.AttrStruct; 620Log.print( ret.Attributes == 127 && ret.Handle == 255 && ret.Name == "OleTest_Property", "AttrStruct"); 621 622// The function returns the struct. Since structs are passed by value the returned struct 623// will be wrapped in another IDispatch object 624astruct.Attributes= 1; 625astruct.Handle= 2; 626astruct.Name= "Property"; 627ret= oletest.methodStruct2( astruct); 628Log.print( ret.Attributes == 1 && ret.Handle == 2 && ret.Name == "Property", "methodStruct2"); 629 630 631document.writeln("<p>"); 632// Test Identity from COM objects in UNO 633var listener1= new XEventListener_Impl(); 634oletest.setObject(listener1); 635ret= oletest.isSame(listener1); 636Log.print2( ret, "Ok Testing identity of COM objects<br>","Failed Testing identity of COM objects<br>"); 637 638var oletest2= oletest.getThis(); 639ret= oletest === oletest2; 640Log.print2(ret, "Ok Testing identity of UNO objects<br>","Failed Testing identity of UNO objects<br>"); 641} 642 643 644 645 646function isEqualAr( ar1, ar2) 647{ 648 var bOk= false; 649 if( ar1.length == ar2.length) 650 { 651 bOk= true; 652 for( x in ar1) 653 { 654// document.writeln( ar1[x] + " "); 655// document.writeln( ar2[x] + " "); 656 if( ar1[x] != ar2[x]) 657 { 658 bOk= false; 659 break; 660 } 661 } 662 } 663 return bOk; 664} 665 666/* function isEqualAr2( ar1, ar2) */ 667/* { */ 668 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; */ 685 686/* } */ 687 688function XEventListener_Impl() 689{ 690 this._environment= "JScript"; 691 this._implementedInterfaces= new Array( "com.sun.star.lang.XEventListener"); 692 693 //XEventListener 694 this.disposing= XEventListener_disposing; 695 696 this.bdisposingCalled= false; 697 this.bQuiet= true; 698 this.resetDisposing= XEventListener_resetDisposing; 699 this.disposingCalled= XEventListener_disposingCalled; 700} 701 702function XEventListener_disposing( source) 703{ 704 if( !this.bQuiet) 705 alert("JScript Event Listener \n disposing is being called"); 706 this.bdisposingCalled= true; 707} 708 709function XEventListener_resetDisposing() 710{ 711 this.bdisposingCalled= false; 712} 713 714function XEventListener_disposingCalled() 715{ 716 return this.bdisposingCalled; 717} 718</script> 719 720<script language="VBScript"> 721Function runVBTest( Log) 722document.writeln("================================================================================<br>") 723document.writeln("VB Script<br>") 724document.writeln("================================================================================<p>") 725 726Dim arrInt 727arrInt= Array(1,2,3,-4,-5, 0) 728arrUInt= Array(1,2,3,4,5) 729arrDouble= Array( 1.2345, 12.345, 123.45, 1234.5, 12345) 730arrBool= Array( true, false, true, false, true) 731arrChar= Array("A","B",67) 732arrString= Array("hamburger","cheeseburger", "chicken nuggets", "chicken wings" , "pizza") 733arrAny= Array( 100, 100.1235,"hallo") 734 735 736Dim arrDim2Int(2,1) 737Dim i,j,k 738For i= 0 To 1 739 For j= 0 To 2 740 arrDim2Int(j,i) = i*3 + j 741 Next 742Next 743 744 745Dim arrDim3Int(3,2,1) 746For 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 752Next 753 754Dim arrXEvent(2) 755For i= 0 To 2 756 Set arrXEvent(i)= new VBEventListener 757Next 758 759Dim arrXEvent2(2,1) 760For i= 0 To 1 761 For j= 0 To 2 762 Set arrXEvent2(j,i)= new VBEventListener 763 Next 764Next 765 766 767 768ret= oletest.methodByte( arrUInt) 769Log.print isEqualVBAr( ret, arrUInt), "methodByte" 770 771ret= oletest.methodFloat( arrDouble) 772Log.print isEqualVBAr( ret, arrDouble), "methodFloat" 773 774ret= oletest.methodDouble( arrDouble) 775Log.print isEqualVBAr( ret, arrDouble), "methodDouble" 776 777ret= oletest.methodBool( arrBool) 778Log.print isEqualVBAr( ret, arrBool), "methodBool" 779 780ret= oletest.methodShort( arrInt) 781Log.print isEqualVBAr( ret, arrInt), "methodShort" 782 783ret= oletest.methodUShort( arrUInt) 784Log.print isEqualVBAr( ret, arrUInt), "methodUShort" 785 786ret= oletest.methodLong( arrInt) 787Log.print isEqualVBAr( ret, arrInt), "methodLong" 788 789ret= oletest.methodULong( arrUInt) 790Log.print isEqualVBAr( ret, arrUInt), "methodULong" 791 792ret= oletest.methodChar( arrChar) 793bOk= false 794if ret(0) = 65 AND ret(1) = 66 AND ret(2) = 67 then 795 bOk= true 796end if 797Log.print bOk, "methodChar" 798 799ret= oletest.methodString( arrString) 800Log.print isEqualVBAr( ret, arrString), "methodString" 801 802ret= oletest.methodAny( arrAny) 803Log.print isEqualVBAr( ret, arrAny), "methodAny" 804 805 806ret= oletest.methodSequence( arrDim2Int) 807bOk= true 808 809For 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 818Next 819Log.print bOk, "methodSequence" 820 821ret= oletest.methodSequence2( arrDim3Int) 822'arrDim3Int(3,2,1) 823bOk= true 824For 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 835Next 836Log.print bOk, "methodSequence2" 837 838ret= oletest.methodXInterface(arrXEvent) 839bOk= true 840numArg= UBound( arrXEvent) - LBound( arrXEvent) + 1 841numRet= UBound( ret) - LBound( ret) + 1 842If 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 849End If 850Log.print bOk, "methodXInterface" 851 852ret= oletest.methodXEventListeners( arrXEvent) 853bOk= true 854For i= 0 To 2 855 If arrXEvent(i).disposingCalled = false then 856 bOk= false 857 Exit For 858 End If 859Next 860Log.print bOk, "methodXEventListeners" 861 862ret= oletest.methodXEventListenersMul(arrXEvent2) 863bOk= true 864For 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 871Next 872Log.print bOk, "methodXEventListenersMul" 873 874' Attributes ------------------------------------------------------ 875document.writeln( "<br>" ) 876oletest.AttrByte= arrUInt 877ret= oletest.AttrByte 878Log.print isEqualVBAr( arrUInt, ret), "AttrByte" 879 880oletest.AttrFloat= arrDouble 881ret= oletest.AttrFloat 882Log.print isEqualVBAr( arrDouble, ret), "AttrFloat" 883 884oletest.AttrDouble= arrDouble 885ret= oletest.AttrDouble 886Log.print isEqualVBAr( arrDouble, ret), "AttrDouble" 887 888oletest.AttrBool= arrBool 889ret= oletest.AttrBool 890Log.print isEqualVBAr( arrBool, ret), "AttrBool" 891 892oletest.AttrShort= arrInt 893ret= oletest.AttrShort 894Log.print isEqualVBAr( arrInt, ret), "AttrShort" 895 896oletest.AttrUShort= arrUInt 897ret= oletest.AttrUShort 898Log.print isEqualVBAr( arrUInt, ret), "AttrUShort" 899 900oletest.AttrLong= arrInt 901ret= oletest.AttrLong 902Log.print isEqualVBAr( arrInt, ret), "AttrLong" 903 904oletest.AttrULong= arrUInt 905ret= oletest.AttrULong 906Log.print isEqualVBAr( arrUInt, ret), "AttrULong" 907 908oletest.AttrChar= arrChar 909ret= oletest.AttrChar 910bOk= false 911if ret(0) = 65 AND ret(1) = 66 AND ret(2) = 67 then 912 bOk= true 913end if 914Log.print bOk, "AttrChar" 915 916oletest.AttrString= arrString 917ret= oletest.AttrString 918Log.print isEqualVBAr( arrString, ret), "AttrString" 919 920oletest.AttrSequence= arrDim2Int 921ret= oletest.AttrSequence 922bOk= true 923For 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 931Next 932Log.print bOk, "AttrSequence" 933 934oletest.AttrSequence2= arrDim3Int 935ret= oletest.AttrSequence2 936'arrDim3Int(3,2,1) 937bOk= true 938For 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 949Next 950Log.print bOk, "AttrSequence2" 951 952oletest.AttrXInterface= arrXEvent 953ret= oletest.AttrXInterface 954bOk= true 955numArg= UBound( arrXEvent) - LBound( arrXEvent) + 1 956numRet= UBound( ret) - LBound( ret) + 1 957If 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 964End If 965Log.print bOk, "AttrXInterface" 966 967'out params ================================================================================ 968document.writeln("<p>") 969Dim inVal, outVal, retVal 970 971inVal = 111 972retVal = oletest.in_methodByte(inVal) 973oletest.testout_methodByte outVal 974Log.print inVal = retVal, "in_methodByte" 975Log.print outVal = inVal, "testout_methodByte" 976 977inVal = 3.14 978retVal = oletest.in_methodFloat(inVal) 979oletest.testout_methodFloat outVal 980Log.print inVal = retVal, "in_methodFloat" 981Log.print outVal > 3.13 AND outVal < 3.15, "testout_methodFloat" 982 983inVal = 3.14 984retVal = oletest.in_methodDouble(inVal) 985oletest.testout_methodDouble outVal 986Log.print inVal = retVal, "in_methodDouble" 987Log.print outVal = 3.14, "testout_methodDouble" 988 989inVal = true 990retVal = oletest.in_methodBool(inVal) 991oletest.testout_methodBool outVal 992Log.print inVal = retVal, "in_methodBool" 993Log.print outVal = inVal, "testout_methodBool" 994 995inVal = 222 996retVal = oletest.in_methodShort(inVal) 997oletest.testout_methodShort outVal 998Log.print inVal = retVal, "in_methodShort" 999Log.print outVal = inVAl, "testout_methodShort" 1000 1001inVal = 333 1002retVal = oletest.in_methodUShort(inVal) 1003oletest.testout_methodUShort outVal 1004Log.print inVal = retVal, "in_methodUShort" 1005Log.print outVal = inVal, "testout_methodUShort" 1006 1007inVal = 4444 1008retVal = oletest.in_methodLong(inVal) 1009oletest.testout_methodLong outVal 1010Log.print inVal = retVal, "in_methodLong" 1011Log.print outVal = inVal, "testout_methodLong" 1012 1013inVal = 5555 1014retVal = oletest.in_methodULong(inVal) 1015oletest.testout_methodULong outVal 1016Log.print inVal = retVal, "in_methodULong" 1017Log.print outVal = inVal, "testout_methodULong" 1018 1019inVal = 65 1020retVal = oletest.in_methodChar(inVal) 1021oletest.testout_methodChar outVal 1022Log.print inVal = retVal, "in_methodChar" 1023Log.print outVal = 65, "testout_methodChar" 1024 1025inVal = "Hello World 3!" 1026retVal = oletest.in_methodString(inVal) 1027oletest.testout_methodString outVal 1028Log.print inVal = retVal, "in_methodString" 1029Log.print outVal = inVal, "testout_methodString" 1030 1031inVal = "Hello World 4!" 1032retVal = oletest.in_methodAny(inVal) 1033oletest.testout_methodAny outVal 1034Log.print outVal = inVal, "testout_methodAny" 1035 1036oletest.testout_methodSequence outVal 1037Log.print isEqualVBAr(outVal, Array( 0,1,2,3,4,5,6,7,8,9)), "testout_methodSequence" 1038 1039oletest.testout_methodSequence2 outVal 1040count= UBound( outVal) - LBound( outVal) + 1 1041ret= False 1042If 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 1049End If 1050Log.print ret, "testout_methodSequence2" 1051 1052outVal= Empty 1053outVal2= Empty 1054oletest.testout_methodMulParams1 outVal, outVal2 1055ret= false 1056If outVal = 999 AND outVal2 = 1111 Then 1057 ret= true 1058End If 1059Log.print ret, "testout_methodMulParams1" 1060 1061outVal= Empty 1062outVal2= Empty 1063outVal3= Empty 1064oletest.testout_methodMulParams2 outVal, outVal2, outVal3 1065ret = false 1066If outVal = 1111 AND outVal2 = 1222 AND outVal3 = " another string" Then 1067 ret= true 1068End If 1069Log.print ret, "testout_methodMulParams2" 1070 1071document.writeln("missing: testout_methodMulParams3 <br>") 1072document.writeln("missing: testout_methodMulParams4 <br>") 1073 1074outVal= Empty 1075oletest.testout_methodXInterface outVal 1076ret= false 1077If outVal Is oletest Then 1078 ret= true 1079End If 1080Log.print ret, "testout_methodXInterface" 1081 1082Set outVal= Nothing 1083document.writeln("missing: testout_methodXInterface <br>") 1084 1085inVal = 1 1086outVal= inVal 1087oletest.testinout_methodByte outVal 1088oletest.testinout_methodByte outVal 1089Log.print inVal = outVal, "testinout_methodByte" 1090 1091 1092document.writeln("missing: testinout_methodFloat <br>") 1093document.writeln("missing: testinout_methodDouble <br>") 1094document.writeln("missing: testinout_methodBool <br>") 1095document.writeln("missing: testinout_methodShort <br>") 1096document.writeln("missing: testinout_methodUShort <br>") 1097document.writeln("missing: testinout_methodLong <br>") 1098document.writeln("missing: testinout_methodULong <br>") 1099document.writeln("missing: testinout_methodChar <br>") 1100document.writeln("missing: testinout_methodString <br>") 1101document.writeln("missing: testinout_methodAny <br>") 1102document.writeln("missing: testinout_methodSequence <br>") 1103document.writeln("missing: testinout_methodSequence2 <br>") 1104document.writeln("missing: testinout_methodXInterface <br>") 1105document.writeln("missing: methodAnyTest1 <br>") 1106document.writeln("missing: methodAnyTest1 <br>") 1107document.writeln("missing: methodAnyTest1 <br>") 1108document.writeln("missing: methodAnyTest1 <br>") 1109document.writeln("missing: methodAnyTest1 <br>") 1110document.writeln("missing: AttrAny2 <br>") 1111document.writeln("missing: methodAnyTest1 <br>") 1112document.writeln("missing: methodAnyTest1 <br>") 1113document.writeln("missing: methodAnyTest1 <br>") 1114document.writeln("missing: methodAnyTest1 <br>") 1115document.writeln("missing: methodAnyTest1 <br>") 1116document.writeln("missing: retMethodStruct <br>") 1117document.writeln("missing: AttrStruct <br>") 1118document.writeln("missing: methodStruct2 <br>") 1119 1120' Test Identity from COM objects in UNO 1121Dim listener1 1122Set listener1= new VBEventListener 1123call oletest.setObject( listener1) 1124ret= oletest.isSame(listener1) 1125Log.print2 ret, "Ok Testing identity of COM objects <br>","Failed Testing identity of COM objects<br>" 1126' Test identity of UNO objects 1127 1128set oletest2= oletest.getThis() 1129ret= oletest Is oletest2 1130Log.print2 ret, "Ok Testing identity of UNO objects<br>","Failed Testing identity of UNO objects<br>" 1131 1132End Function 1133 1134 1135Function isEqualVBAr( arr1, arr2) 1136 ret = false 1137 s1= UBound( arr1) - LBound( arr1) + 1 1138 s2= UBound( arr2) - LBound( arr2) + 1 1139 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 1151End Function 1152 1153 1154'The listener object 1155 1156Class VBEventListener 1157 Dim Bridge_ImplementedInterfaces(0) 1158 Dim bDisposingCalled 1159 1160'XEventListener::disposing 1161 Function disposing( source) 1162 bDisposingCalled= true 1163 End Function 1164 1165 Sub Class_Initialize() 1166 bDisposingCalled= false 1167 Bridge_ImplementedInterfaces(0)= "com.sun.star.lang.XEventListener" 1168 End Sub 1169 1170 Function resetDisposing() 1171 bDisposingCalled= false 1172 End Function 1173 1174 Function disposingCalled() 1175 disposingCalled= bDisposingCalled 1176 End Function 1177End Class 1178 1179 1180sub callBasic(id) 1181 1182 Dim factory 1183 Set factory= GetObject("", "com.sun.star.ServiceManager") 1184 1185 Set oletest= factory.createInstance("oletest.OleTest") 1186 1187 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") 1196 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 1203 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 1212 1213 1214 select case id 1215 1216 // Out Parameter 1217 1218 1219 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 1271 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) 1338 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 1351 1352 case 300 1353 dim aByte 1354 aByte= 100 1355 call oletest.testinout_methodByte( aByte) 1356 MsgBox aByte 1357 1358 1359 case 400 1360 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 1366 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) 1371 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 1378 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 1384end sub 1385 1386sub printArray( arr) 1387 document.write "array: " 1388 For Each val In arr 1389 document.write CStr(val) & " " 1390 Next 1391end sub 1392 1393// print a 2 dimensional Array 1394 1395sub printArray2( arr) 1396 elements1= UBound( arr, 1) - LBound( arr, 1) +1 1397 elements2= UBound( arr, 2) - LBound( arr, 2) +1 1398 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 1406end sub 1407 1408sub printArrayEx( pre, post, array) 1409 document.write pre 1410 printArray array 1411 document.write post 1412end sub 1413</script> 1414 1415<script language="JScript"> 1416var arFunctions= new Array(); 1417arFunctions["methodByte"]= "sequence<byte> methodByte( [in] sequence<byte> aSeq )"; 1418arFunctions["methodFloat"]= "sequence<float> methodFloat( [in] sequence<float> aSeq)"; 1419arFunctions["methodDouble"]= "sequence<double> methodDouble( [in] sequence<double> aSeq)"; 1420arFunctions["methodBool"]= "sequence<boolean> methodBool( [in] sequence<boolean> aSeq)"; 1421arFunctions["methodShort"]= "sequence<short> methodShort( [in] sequence<short> aSeq)"; 1422arFunctions["methodUShort"]= "sequence<unsigned short> methodUShort( [in] sequence<unsigned short> aSeq)"; 1423arFunctions["methodLong"]= "sequence<long> methodLong( [in] sequence<long> aSeq)"; 1424arFunctions["methodULong"]= "sequence<unsigned long> methodULong( [in] sequence<unsigned long> aSeq)"; 1425arFunctions["methodString"]= "sequence<string> methodString( [in] sequence<string> aSeq)"; 1426arFunctions["methodChar"]= "sequence<char> methodChar( [in] sequence<char> aSeq)"; 1427arFunctions["methodAny"]= "sequence<any> methodAny ( [in] sequence<any> aSeq)"; 1428arFunctions["methodXInterface"]= "sequence<XInterface> methodXInterface ( [in] sequence<XInterface> aSeq)"; 1429arFunctions["methodSequence"]= "sequence< sequence <long> > methodSequence( [in] sequence< sequence< long > > aSeq)"; 1430arFunctions["methodSequence2"]= "sequence< sequence <sequence <long> > > methodSequence2( [in] sequence< sequence< sequence<long> > > aSeq)"; 1431arFunctions["methodXEventListeners"]= "sequence< com::sun::star::lang::XEventListener > methodXEventListeners( [in] sequence<com::sun::star::lang::XEventListener> aSeq)"; 1432arFunctions["methodXEventListenersMul"]= "sequence< sequence< com::sun::star::lang::XEventListener > > methodXEventListenersMul( [in] sequence< sequence< com::sun::star::lang::XEventListener> > aSeq)"; 1433arFunctions["AttrByte"]="[attribute] sequence<byte> AttrByte"; 1434arFunctions["AttrFloat"]="[attribute] sequence<float> AttrFloat"; 1435arFunctions["AttrDouble"]="[attribute] sequence<double> AttrDouble"; 1436arFunctions["AttrBool"]="[attribute] sequence<boolean> AttrBool"; 1437arFunctions["AttrShort"]="[attribute] sequence<short> AttrShort"; 1438arFunctions["AttrUShort"]="[attribute] sequence<unsigned short> AttrUShort"; 1439arFunctions["AttrLong"]="[attribute] sequence<long> AttrLong"; 1440arFunctions["AttrULong"]="[attribute] sequence<unsigned long> AttrULong"; 1441arFunctions["AttrString"]="[attribute] sequence<string> AttrString"; 1442arFunctions["AttrChar"]="[attribute] sequence<char> AttrChar"; 1443arFunctions["AttrAny"]="[attribute] sequence<any> AttrAny"; 1444arFunctions["AttrSequence"]="[attribute] sequence< sequence<long> > AttrSequence"; 1445arFunctions["AttrSequence2"]="[attribute] sequence< sequence< sequence <long> > > AttrSequence2"; 1446arFunctions["AttrXInterface"]="[attribute] sequence< com::sun::star::uno::XInterface > AttrXInterface"; 1447 1448arFunctions["testout_methodByte"]= " void testout_methodByte( [out] byte rOut )"; 1449arFunctions["testout_methodFloat"]= "void testout_methodFloat( [out] float rOut)"; 1450arFunctions["testout_methodDouble"]= "void testout_methodDouble( [out] double rOut)"; 1451arFunctions["testout_methodBool"]= "void testout_methodBool( [out] boolean rOut)"; 1452arFunctions["testout_methodShort"]= "void testout_methodShort( [out] short rOut)"; 1453arFunctions["testout_methodUShort"]= "void testout_methodUShort( [out] unsigned short rOut)"; 1454arFunctions["testout_methodLong"]= "void testout_methodLong( [out] long rOut)"; 1455arFunctions["testout_methodULong"]= "void testout_methodULong( [out] unsigned long rOut)"; 1456arFunctions["testout_methodString"]= "void testout_methodString( [out] string rOut)"; 1457arFunctions["testout_methodChar"]= "void testout_methodChar( [out] char rOut)"; 1458arFunctions["testout_methodAny"]= "void testout_methodAny( [out] any rOut)"; 1459arFunctions["testout_methodSequence"]= "void testout_methodSequence( [out] sequence< long > rOut)"; 1460arFunctions["testout_methodSequence2"]= "void testout_methodSequence2( [out] sequence < sequence< long > > rOut)"; 1461arFunctions["testout_methodXInterface"]= "void testout_methodXInterface( [out] com::sun::star::uno::XInterface rOut)"; 1462arFunctions["testout_methodMulParams1"]= "void testout_methodMulParams1( [out] long rout1, [out] long rout2)"; 1463arFunctions["testout_methodMulParams2"]= "void testout_methodMulParams2( [out] long rout1, [out] long rout2, [out] string rout3)"; 1464arFunctions["testout_methodMulParams3"]= "void testout_methodMulParams3( [in] string sin, [out] string sout)"; 1465arFunctions["testout_methodMulParams4"]= "void testout_methodMulParams4( [in] float in1, [out] float out1, [in] long in2, [out] long out2, [in] long in3)"; 1466arFunctions["testinout_methodByte"]="void testinout_methodByte( [inout] byte rOut )"; 1467arFunctions["testinout_methodFloat"]="void testinout_methodFloat( [inout] float rOut)"; 1468arFunctions["testinout_methodDouble"]="void testinout_methodDouble( [inout] double rOut)"; 1469arFunctions["testinout_methodBool"]="void testinout_methodBool( [inout] boolean rOut)"; 1470arFunctions["testinout_methodShort"]="void testinout_methodShort( [inout] short rOut)"; 1471arFunctions["testinout_methodUShort"]="void testinout_methodUShort( [inout] unsigned short rOut)"; 1472arFunctions["testinout_methodLong"]="void testinout_methodLong( [inout] long rOut)"; 1473arFunctions["testinout_methodULong"]="void testinout_methodULong( [inout] unsigned long rOut)"; 1474arFunctions["testinout_methodString"]="void testinout_methodString( [inout] string rOut)"; 1475arFunctions["testinout_methodChar"]="void testinout_methodChar( [inout] char rOut)"; 1476arFunctions["testinout_methodAny"]="void testinout_methodAny( [inout] any rOut)"; 1477arFunctions["testinout_methodSequence"]="void testinout_methodSequence( [inout] sequence< long > rOut)"; 1478arFunctions["testinout_methodSequence2"]="void testinout_methodSequence2( [inout] sequence < sequence< long > > rOut)"; 1479arFunctions["testinout_methodXInterface"]="void testinout_methodXInterface( [inout] com::sun::star::script::XInvocation rOut)"; 1480arFunctions["testinout_methodXInterface2"]="void testinout_methodXInterface2( [inout] com::sun::star::uno::XInterface rOut)"; 1481 1482arFunctions["in_methodByte"]= "byte in_methodByte( [in] byte rIn )"; 1483arFunctions["in_methodFloat"]= "float in_methodFloat( [in] float rIn);" 1484arFunctions["in_methodDouble"]= "double in_methodDouble( [in] double rIn)"; 1485arFunctions["in_methodBool"]= "boolean in_methodBool( [in] boolean rIn)"; 1486arFunctions["in_methodShort"]= "short in_methodShort( [in] short rIn)"; 1487arFunctions["in_methodUShort"]= "unsigned short in_methodUShort( [in] unsigned short rIn)"; 1488arFunctions["in_methodLong"]= "long in_methodLong( [in] long rIn)"; 1489arFunctions["in_methodULong"]= "unsigned long in_methodULong( [in] unsigned long rIn)"; 1490arFunctions["in_methodHyper"]= "hyper in_methodHyper( [in] hyper rIn)"; 1491arFunctions["in_methodUHyper"]= "unsigned hyper in_methodHyper( [in] unsigned hyper rIn)"; 1492arFunctions["in_methodString"]= "string in_methodString( [in] string rIn)"; 1493arFunctions["in_methodChar"]= "char in_methodChar( [in] char rIn)"; 1494arFunctions["in_methodAny"]= "any in_methodAny ( [in] any rIn)"; 1495arFunctions["in_methodXInterface"]= "XInterface in_methodXInterface([in] XInterface rIn)"; 1496 1497 1498arFunctions["methodAnyTest1"]="any methodAnyTest1( [in] any rIn)"; 1499arFunctions["AttrAny2"]= "[attribute] any AttrAny2"; 1500arFunctions["retMethodStruct"]= "com::sun::star::beans::Property retMethodStruct()"; 1501arFunctions["AttrStruct"]= "[attribute] com::sun::star::beans::Property AttrStruct"; 1502arFunctions["methodStruct2"]= "com::sun::star::beans::Property methodStruct2( [in] com::sun::star::beans::Property aProp)"; 1503 1504 1505var factory= new ActiveXObject("com.sun.star.ServiceManager"); 1506var oletest= factory.createInstance("oletest.OleTest"); 1507 1508Log= new Logger(); 1509 1510 1511runJScriptTest(Log); 1512runVBTest(Log); 1513Log.summarize(); 1514 1515 1516function Logger() 1517{ 1518 this.print= logger_print; 1519 this.print2= logger_print2; 1520 this.summarize= logger_summarize; 1521 this.bAllOk= true; 1522} 1523function logger_print( bool, method) 1524{ 1525 this.print2(bool, "Ok " + arFunctions[method] + "<br>", 1526 "Failed " + arFunctions[method] + "<br>"); 1527} 1528 1529function logger_print2( bool, okString, failedString) 1530{ 1531 if( bool) 1532 document.writeln( okString); 1533 else 1534 { 1535 document.writeln( failedString); 1536 this.bAllOk= this.bAllOk && false; 1537 } 1538} 1539 1540function logger_summarize() 1541{ 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>"); 1547} 1548 1549 1550</script> 1551 1552</body> 1553</html> 1554 1555 1556