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