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