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 switch( id) 17*cdf0e10cSrcweir { 18*cdf0e10cSrcweir case 1: // Test simple call of JScript object function from UNO 19*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 1); 20*cdf0e10cSrcweir break; 21*cdf0e10cSrcweir 22*cdf0e10cSrcweir case 2: 23*cdf0e10cSrcweir // return value is the parameter object 24*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 2); 25*cdf0e10cSrcweir break; 26*cdf0e10cSrcweir //################################################## 27*cdf0e10cSrcweir // OUT parameter 28*cdf0e10cSrcweir //################################################## 29*cdf0e10cSrcweir case 3: // Test out parameter of type interface 30*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 3); 31*cdf0e10cSrcweir break; 32*cdf0e10cSrcweir case 4: // Test out parameter of type struct 33*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 4); 34*cdf0e10cSrcweir break; 35*cdf0e10cSrcweir case 5: // Test out parameter of type enum 36*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 5); 37*cdf0e10cSrcweir break; 38*cdf0e10cSrcweir case 6: // Test out parameter of type sequence<any> 39*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 6); 40*cdf0e10cSrcweir break; 41*cdf0e10cSrcweir case 7: // Test out parameter of type any 42*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 7); 43*cdf0e10cSrcweir break; 44*cdf0e10cSrcweir case 8: // Test out parameter of type bool 45*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 8); 46*cdf0e10cSrcweir break; 47*cdf0e10cSrcweir case 9: // Test out parameter of type char 48*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 9); 49*cdf0e10cSrcweir break; 50*cdf0e10cSrcweir case 10: // Test out parameter of type string 51*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 10); 52*cdf0e10cSrcweir break; 53*cdf0e10cSrcweir case 11: // Test out parameter of type float 54*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 11); 55*cdf0e10cSrcweir break; 56*cdf0e10cSrcweir case 12: // Test out parameter of type double 57*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 12); 58*cdf0e10cSrcweir break; 59*cdf0e10cSrcweir case 13: // Test out parameter of type byte 60*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 13); 61*cdf0e10cSrcweir break; 62*cdf0e10cSrcweir case 14: // Test out parameter of type short 63*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 14); 64*cdf0e10cSrcweir break; 65*cdf0e10cSrcweir case 15: // Test out parameter of type long 66*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 15); 67*cdf0e10cSrcweir break; 68*cdf0e10cSrcweir case 30: // outValuesMixed 69*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 30); 70*cdf0e10cSrcweir break; 71*cdf0e10cSrcweir case 31: // outValuesAll 72*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 31); 73*cdf0e10cSrcweir break; 74*cdf0e10cSrcweir //################################################## 75*cdf0e10cSrcweir // IN/OUT parameter 76*cdf0e10cSrcweir //################################################## 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir case 100: // inoutInterface 79*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 100); 80*cdf0e10cSrcweir break; 81*cdf0e10cSrcweir case 101: // inoutStruct 82*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 101); 83*cdf0e10cSrcweir break; 84*cdf0e10cSrcweir case 102: // inoutEnum 85*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 102); 86*cdf0e10cSrcweir break; 87*cdf0e10cSrcweir case 103: // inoutSeqAny 88*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 103); 89*cdf0e10cSrcweir break; 90*cdf0e10cSrcweir case 104: // inoutAny 91*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 104); 92*cdf0e10cSrcweir break; 93*cdf0e10cSrcweir case 105: // inoutBool 94*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 105); 95*cdf0e10cSrcweir break; 96*cdf0e10cSrcweir case 106: // inoutChar 97*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 106); 98*cdf0e10cSrcweir break; 99*cdf0e10cSrcweir case 107: // inoutString 100*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 107); 101*cdf0e10cSrcweir break; 102*cdf0e10cSrcweir case 108: // inoutFloat 103*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 108); 104*cdf0e10cSrcweir break; 105*cdf0e10cSrcweir case 109: // inoutDouble 106*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 109); 107*cdf0e10cSrcweir break; 108*cdf0e10cSrcweir case 110: // inoutByte 109*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 110); 110*cdf0e10cSrcweir break; 111*cdf0e10cSrcweir case 111: // inoutShort 112*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 111); 113*cdf0e10cSrcweir break; 114*cdf0e10cSrcweir case 112: // inoutLong 115*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 112); 116*cdf0e10cSrcweir break; 117*cdf0e10cSrcweir case 120: // inoutValuesAll 118*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 120); 119*cdf0e10cSrcweir break; 120*cdf0e10cSrcweir case 200: // inValues 121*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 200); 122*cdf0e10cSrcweir break; 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir // Call a COM object that has not been passed as parameter to a UNO component and 125*cdf0e10cSrcweir // hence no type information are available in the COM wrapper 126*cdf0e10cSrcweir// case 300: 127*cdf0e10cSrcweir //################################################## 128*cdf0e10cSrcweir // Attributes 129*cdf0e10cSrcweir //################################################## 130*cdf0e10cSrcweir case 400: 131*cdf0e10cSrcweir oletest.testInterface( new XCallback_Impl, 400); 132*cdf0e10cSrcweir break; 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir case 1000: 135*cdf0e10cSrcweir oletest.testInterface2(new MultiInterface(), 0); 136*cdf0e10cSrcweir break; 137*cdf0e10cSrcweir } 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir} 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir// The class -------------------------------------------- 144*cdf0e10cSrcweir 145*cdf0e10cSrcweirfunction XCallback_Impl() 146*cdf0e10cSrcweir{ 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir // XCallback 149*cdf0e10cSrcweir this._environment= "JScript"; 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir this.func1= XCallback_Impl_func1; 152*cdf0e10cSrcweir this.returnInterface= XCallback_Impl_returnInterface; 153*cdf0e10cSrcweir // ################################################# 154*cdf0e10cSrcweir // OUT parameter 155*cdf0e10cSrcweir //################################################### 156*cdf0e10cSrcweir this.outInterface= XCallback_Impl_outInterface; 157*cdf0e10cSrcweir this.outStruct= XCallback_Impl_outStruct; 158*cdf0e10cSrcweir this.outEnum= XCallback_Impl_outEnum; 159*cdf0e10cSrcweir this.outSeqAny= XCallback_Impl_outSeqAny; 160*cdf0e10cSrcweir this.outAny= XCallback_Impl_outAny; 161*cdf0e10cSrcweir this.outBool= XCallback_Impl_outBool; 162*cdf0e10cSrcweir this.outChar= XCallback_Impl_outChar; 163*cdf0e10cSrcweir this.outString= XCallback_Impl_outString; 164*cdf0e10cSrcweir this.outFloat= XCallback_Impl_outFloat; 165*cdf0e10cSrcweir this.outDouble= XCallback_Impl_outDouble; 166*cdf0e10cSrcweir this.outByte= XCallback_Impl_outByte; 167*cdf0e10cSrcweir this.outShort= XCallback_Impl_outShort; 168*cdf0e10cSrcweir this.outLong= XCallback_Impl_outLong; 169*cdf0e10cSrcweir this.outValuesMixed= XCallback_Impl_outValuesMixed; 170*cdf0e10cSrcweir this.outValuesAll= XCallback_Impl_outValuesAll; 171*cdf0e10cSrcweir // ################################################# 172*cdf0e10cSrcweir // IN/ OUT parameter 173*cdf0e10cSrcweir //################################################### 174*cdf0e10cSrcweir this.inoutInterface= XCallback_Impl_inoutInterface; 175*cdf0e10cSrcweir this.inoutStruct= XCallback_Impl_inoutStruct; 176*cdf0e10cSrcweir this.inoutEnum= XCallback_Impl_inoutEnum; 177*cdf0e10cSrcweir this.inoutSeqAny= XCallback_Impl_inoutSeqAny; 178*cdf0e10cSrcweir this.inoutAny= XCallback_Impl_inoutAny; 179*cdf0e10cSrcweir this.inoutBool= XCallback_Impl_inoutBool; 180*cdf0e10cSrcweir this.inoutChar= XCallback_Impl_inoutChar; 181*cdf0e10cSrcweir this.inoutString= XCallback_Impl_inoutString; 182*cdf0e10cSrcweir this.inoutFloat= XCallback_Impl_inoutFloat; 183*cdf0e10cSrcweir this.inoutDouble= XCallback_Impl_inoutDouble; 184*cdf0e10cSrcweir this.inoutByte= XCallback_Impl_inoutByte; 185*cdf0e10cSrcweir this.inoutShort= XCallback_Impl_inoutShort; 186*cdf0e10cSrcweir this.inoutLong= XCallback_Impl_inoutLong; 187*cdf0e10cSrcweir this.inoutValuesAll= XCallback_Impl_inoutValuesAll; 188*cdf0e10cSrcweir // ################################################# 189*cdf0e10cSrcweir // IN parameter 190*cdf0e10cSrcweir //################################################## 191*cdf0e10cSrcweir this.inValues= XCallback_Impl_inValues; 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir // ################################################# 194*cdf0e10cSrcweir // Attributes 195*cdf0e10cSrcweir //################################################## 196*cdf0e10cSrcweir this.simple= new XSimple_Impl(); 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir} 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir 202*cdf0e10cSrcweirfunction XCallback_Impl_func1() 203*cdf0e10cSrcweir{ 204*cdf0e10cSrcweir alert("XCallback_Impl_func1"); 205*cdf0e10cSrcweir} 206*cdf0e10cSrcweirfunction XCallback_Impl_returnInterface() 207*cdf0e10cSrcweir{ 208*cdf0e10cSrcweir alert("XCallback::returnInterface called"); 209*cdf0e10cSrcweir return new XSimple_Impl(); 210*cdf0e10cSrcweir} 211*cdf0e10cSrcweir 212*cdf0e10cSrcweirfunction XCallback_Impl_outInterface( outVal) 213*cdf0e10cSrcweir{ 214*cdf0e10cSrcweir outVal[0]= new XSimple_Impl(); 215*cdf0e10cSrcweir} 216*cdf0e10cSrcweir 217*cdf0e10cSrcweirfunction XCallback_Impl_outLong( outVal) 218*cdf0e10cSrcweir{ 219*cdf0e10cSrcweir alert("outLong"); 220*cdf0e10cSrcweir} 221*cdf0e10cSrcweirfunction XCallback_Impl_outStruct( outVal) 222*cdf0e10cSrcweir{ 223*cdf0e10cSrcweir var factory= new ActiveXObject("com.sun.star.ServiceManager"); 224*cdf0e10cSrcweir var starCoreReflection = factory.createInstance("com.sun.star.reflection.CoreReflection"); 225*cdf0e10cSrcweir var structClass = starCoreReflection.forName("oletest.SimpleStruct"); 226*cdf0e10cSrcweir var outParam= new Array(); 227*cdf0e10cSrcweir structClass.createObject(outParam); 228*cdf0e10cSrcweir var aStruct= outParam[0]; 229*cdf0e10cSrcweir aStruct.message= "a Struct created in JScript"; 230*cdf0e10cSrcweir outVal[0]= aStruct; 231*cdf0e10cSrcweir 232*cdf0e10cSrcweir} 233*cdf0e10cSrcweirfunction XCallback_Impl_outEnum( outVal) 234*cdf0e10cSrcweir{ 235*cdf0e10cSrcweir outVal[0]= 2; 236*cdf0e10cSrcweir} 237*cdf0e10cSrcweirfunction XCallback_Impl_outSeqAny( outVal) 238*cdf0e10cSrcweir{ 239*cdf0e10cSrcweir var ar= new Array(1,2,3); 240*cdf0e10cSrcweir outVal[0]= ar; 241*cdf0e10cSrcweir} 242*cdf0e10cSrcweirfunction XCallback_Impl_outAny( outVal) 243*cdf0e10cSrcweir{ 244*cdf0e10cSrcweir outVal[0]= "this is an Any"; 245*cdf0e10cSrcweir} 246*cdf0e10cSrcweirfunction XCallback_Impl_outBool( outVal) 247*cdf0e10cSrcweir{ 248*cdf0e10cSrcweir outVal[0]= true; 249*cdf0e10cSrcweir} 250*cdf0e10cSrcweirfunction XCallback_Impl_outChar( outVal) 251*cdf0e10cSrcweir{ 252*cdf0e10cSrcweir outVal[0]= "a"; 253*cdf0e10cSrcweir} 254*cdf0e10cSrcweirfunction XCallback_Impl_outString( outVal) 255*cdf0e10cSrcweir{ 256*cdf0e10cSrcweir outVal[0]= "This string was created in JScript"; 257*cdf0e10cSrcweir} 258*cdf0e10cSrcweirfunction XCallback_Impl_outFloat( outVal) 259*cdf0e10cSrcweir{ 260*cdf0e10cSrcweir outVal[0]= 3.14; 261*cdf0e10cSrcweir} 262*cdf0e10cSrcweirfunction XCallback_Impl_outDouble( outVal) 263*cdf0e10cSrcweir{ 264*cdf0e10cSrcweir outVal[0]= 3.145; 265*cdf0e10cSrcweir} 266*cdf0e10cSrcweirfunction XCallback_Impl_outByte( outVal) 267*cdf0e10cSrcweir{ 268*cdf0e10cSrcweir outVal[0]= 100; 269*cdf0e10cSrcweir} 270*cdf0e10cSrcweirfunction XCallback_Impl_outShort( outVal) 271*cdf0e10cSrcweir{ 272*cdf0e10cSrcweir outVal[0]= 1000; 273*cdf0e10cSrcweir} 274*cdf0e10cSrcweirfunction XCallback_Impl_outLong( outVal) 275*cdf0e10cSrcweir{ 276*cdf0e10cSrcweir outVal[0]= 1000000; 277*cdf0e10cSrcweir} 278*cdf0e10cSrcweirfunction XCallback_Impl_outValuesMixed( inLong, outLong, inString) 279*cdf0e10cSrcweir{ 280*cdf0e10cSrcweir alert("inVal long: " + inLong +" inString:" + inString); 281*cdf0e10cSrcweir outLong[0]= inLong + 1; 282*cdf0e10cSrcweir} 283*cdf0e10cSrcweirfunction XCallback_Impl_outValuesAll( xSimple, aSimpleStruct, aSimpleEnum, seqAny, aAny, aBool, 284*cdf0e10cSrcweir aChar, aString, aFloat, aDouble, aByte, aShort, aLong) 285*cdf0e10cSrcweir{ 286*cdf0e10cSrcweir this.outInterface( xSimple); 287*cdf0e10cSrcweir this.outStruct( aSimpleStruct); 288*cdf0e10cSrcweir this.outEnum( aSimpleEnum); 289*cdf0e10cSrcweir this.outSeqAny( seqAny); 290*cdf0e10cSrcweir this.outAny( aAny); 291*cdf0e10cSrcweir this.outBool( aBool); 292*cdf0e10cSrcweir this.outChar( aChar); 293*cdf0e10cSrcweir this.outString( aString); 294*cdf0e10cSrcweir this.outFloat( aFloat); 295*cdf0e10cSrcweir this.outDouble( aDouble); 296*cdf0e10cSrcweir this.outByte( aByte); 297*cdf0e10cSrcweir this.outShort( aShort); 298*cdf0e10cSrcweir this.outLong( aLong); 299*cdf0e10cSrcweir} 300*cdf0e10cSrcweir 301*cdf0e10cSrcweirfunction XCallback_Impl_inoutInterface( val) 302*cdf0e10cSrcweir{ 303*cdf0e10cSrcweir val[0].func("calling on in parameter"); 304*cdf0e10cSrcweir val[0]= new XSimple_Impl(); 305*cdf0e10cSrcweir} 306*cdf0e10cSrcweirfunction XCallback_Impl_inoutStruct( val) 307*cdf0e10cSrcweir{ 308*cdf0e10cSrcweir alert( val[0].message); 309*cdf0e10cSrcweir val[0].message= "property message changed in JScript"; 310*cdf0e10cSrcweir} 311*cdf0e10cSrcweirfunction XCallback_Impl_inoutEnum(val) 312*cdf0e10cSrcweir{ 313*cdf0e10cSrcweir alert("enum value +" + val); 314*cdf0e10cSrcweir val[0]= 2; 315*cdf0e10cSrcweir} 316*cdf0e10cSrcweirfunction XCallback_Impl_inoutSeqAny( val) 317*cdf0e10cSrcweir{ 318*cdf0e10cSrcweir var vbar = new VBArray(val[0]); 319*cdf0e10cSrcweir var seq= vbar.toArray(); 320*cdf0e10cSrcweir alert( seq[0] +" "+seq[1] +" " +seq[2]); 321*cdf0e10cSrcweir val[0]= new Array("jscript1", "jscript2","jscript3"); 322*cdf0e10cSrcweir} 323*cdf0e10cSrcweirfunction XCallback_Impl_inoutAny(val) 324*cdf0e10cSrcweir{ 325*cdf0e10cSrcweir alert( "JScript in any: " + val[0]); 326*cdf0e10cSrcweir val[0]= "a string from JScript"; 327*cdf0e10cSrcweir} 328*cdf0e10cSrcweirfunction XCallback_Impl_inoutBool(val) 329*cdf0e10cSrcweir{ 330*cdf0e10cSrcweir alert( "JScript in bool: " + val[0]); 331*cdf0e10cSrcweir val[0]= true; 332*cdf0e10cSrcweir} 333*cdf0e10cSrcweirfunction XCallback_Impl_inoutChar(val) 334*cdf0e10cSrcweir{ 335*cdf0e10cSrcweir alert( "JScript in char: " + val[0]); 336*cdf0e10cSrcweir val[0]= 'b'; 337*cdf0e10cSrcweir} 338*cdf0e10cSrcweirfunction XCallback_Impl_inoutString(val) 339*cdf0e10cSrcweir{ 340*cdf0e10cSrcweir alert( "JScript in string: " + val[0]); 341*cdf0e10cSrcweir val[0]= " a JScript string"; 342*cdf0e10cSrcweir} 343*cdf0e10cSrcweirfunction XCallback_Impl_inoutFloat(val) 344*cdf0e10cSrcweir{ 345*cdf0e10cSrcweir alert( "JScript in float: " + val[0]); 346*cdf0e10cSrcweir val[0]= 4.14; 347*cdf0e10cSrcweir} 348*cdf0e10cSrcweirfunction XCallback_Impl_inoutDouble(val) 349*cdf0e10cSrcweir{ 350*cdf0e10cSrcweir alert( "JScript in double: " + val[0]); 351*cdf0e10cSrcweir val[0]= 4.145; 352*cdf0e10cSrcweir} 353*cdf0e10cSrcweir 354*cdf0e10cSrcweirfunction XCallback_Impl_inoutByte(val) 355*cdf0e10cSrcweir{ 356*cdf0e10cSrcweir alert( "JScript in byte: " + val[0]); 357*cdf0e10cSrcweir val[0]= 100; 358*cdf0e10cSrcweir} 359*cdf0e10cSrcweirfunction XCallback_Impl_inoutShort(val) 360*cdf0e10cSrcweir{ 361*cdf0e10cSrcweir alert( "JScript in short: " + val[0]); 362*cdf0e10cSrcweir val[0]= 1000; 363*cdf0e10cSrcweir} 364*cdf0e10cSrcweirfunction XCallback_Impl_inoutLong(val) 365*cdf0e10cSrcweir{ 366*cdf0e10cSrcweir alert( "JScript in long: " + val[0]); 367*cdf0e10cSrcweir val[0]= 100000; 368*cdf0e10cSrcweir} 369*cdf0e10cSrcweirfunction XCallback_Impl_inoutValuesAll(aXSimple, aStruct, aEnum, aSeq, 370*cdf0e10cSrcweir aAny, aBool, aChar, aString, aFloat, aDouble, 371*cdf0e10cSrcweir aByte, aShort, aLong ) 372*cdf0e10cSrcweir{ 373*cdf0e10cSrcweir this.inoutInterface( aXSimple); 374*cdf0e10cSrcweir this.inoutStruct( aStruct); 375*cdf0e10cSrcweir this.inoutEnum( aEnum); 376*cdf0e10cSrcweir this.inoutSeqAny( aSeq); 377*cdf0e10cSrcweir this.inoutAny( aAny); 378*cdf0e10cSrcweir this.inoutBool( aBool); 379*cdf0e10cSrcweir this.inoutChar( aChar); 380*cdf0e10cSrcweir this.inoutString( aString); 381*cdf0e10cSrcweir this.inoutFloat( aFloat); 382*cdf0e10cSrcweir this.inoutDouble( aDouble); 383*cdf0e10cSrcweir this.inoutByte( aByte); 384*cdf0e10cSrcweir this.inoutShort( aShort); 385*cdf0e10cSrcweir this.inoutLong( aLong); 386*cdf0e10cSrcweir} 387*cdf0e10cSrcweir 388*cdf0e10cSrcweirfunction XCallback_Impl_inValues( aChar, aLong, aString) 389*cdf0e10cSrcweir{ 390*cdf0e10cSrcweir alert( "char : " + aChar + " long: " + aLong + " string: " + aString); 391*cdf0e10cSrcweir} 392*cdf0e10cSrcweir 393*cdf0e10cSrcweir 394*cdf0e10cSrcweir//################################################################ 395*cdf0e10cSrcweir// class MultiInterface implements XSimple, XSimple2, XSimple3 396*cdf0e10cSrcweir//################################################################ 397*cdf0e10cSrcweirfunction MultiInterface() 398*cdf0e10cSrcweir{ 399*cdf0e10cSrcweir this._environment= "JScript"; 400*cdf0e10cSrcweir this._implementedInterfaces= new Array( "oletest.XSimple", "oletest.XSimple2", "oletest.XSimple3"); 401*cdf0e10cSrcweir // XSimple --------------- 402*cdf0e10cSrcweir this.getName= MultiInterface_getName; 403*cdf0e10cSrcweir this.func= MultiInterface_func; 404*cdf0e10cSrcweir this.func2= MultiInterface_func2; 405*cdf0e10cSrcweir this.func3= MultiInterface_func3; 406*cdf0e10cSrcweir // XSimple2 407*cdf0e10cSrcweir this.getName2= MultiInterface_getName2; 408*cdf0e10cSrcweir // XSimple3 409*cdf0e10cSrcweir this.getName3= MultiInterface_getName3; 410*cdf0e10cSrcweir} 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir 413*cdf0e10cSrcweirfunction MultiInterface_getName() 414*cdf0e10cSrcweir{ 415*cdf0e10cSrcweir return "JScript XSimple called"; 416*cdf0e10cSrcweir} 417*cdf0e10cSrcweirfunction MultiInterface_func( message) 418*cdf0e10cSrcweir{ 419*cdf0e10cSrcweir alert("JScript object (XSimple)-- " + message); 420*cdf0e10cSrcweir} 421*cdf0e10cSrcweir 422*cdf0e10cSrcweirfunction MultiInterface_getName2() 423*cdf0e10cSrcweir{ 424*cdf0e10cSrcweir return "JScript XSimple2 called"; 425*cdf0e10cSrcweir} 426*cdf0e10cSrcweirfunction MultiInterface_func2( message) 427*cdf0e10cSrcweir{ 428*cdf0e10cSrcweir alert("JScript object (XSimple2) -- " + message); 429*cdf0e10cSrcweir} 430*cdf0e10cSrcweir 431*cdf0e10cSrcweirfunction MultiInterface_getName3() 432*cdf0e10cSrcweir{ 433*cdf0e10cSrcweir return "JScript XSimple3 called"; 434*cdf0e10cSrcweir} 435*cdf0e10cSrcweirfunction MultiInterface_func3( message) 436*cdf0e10cSrcweir{ 437*cdf0e10cSrcweir alert("JScript object (XSimple3) -- " + message); 438*cdf0e10cSrcweir} 439*cdf0e10cSrcweir 440*cdf0e10cSrcweir 441*cdf0e10cSrcweir 442*cdf0e10cSrcweir 443*cdf0e10cSrcweir//XCallback_Impl_outValuesMixed( val1, outval, val2) 444*cdf0e10cSrcweir//{ 445*cdf0e10cSrcweir//} 446*cdf0e10cSrcweir//XCallback_Impl_outValuesAll( xSimple, aSimpleStruct, aSimpleEnum, seqAny, aAny, aBool, 447*cdf0e10cSrcweir// aChar, aString, aFloat, aDouble, aByte, aShort, aLong, aUShort, aULong) 448*cdf0e10cSrcweir//{ 449*cdf0e10cSrcweir// 450*cdf0e10cSrcweir//} 451*cdf0e10cSrcweir 452*cdf0e10cSrcweir 453*cdf0e10cSrcweir 454*cdf0e10cSrcweir// class XSimple_Impl---------------------------------------------------------------------- 455*cdf0e10cSrcweirfunction XSimple_Impl() 456*cdf0e10cSrcweir{ 457*cdf0e10cSrcweir //XSimple 458*cdf0e10cSrcweir this.func= XSimple_Impl_func; 459*cdf0e10cSrcweir} 460*cdf0e10cSrcweirfunction XSimple_Impl_func( message) 461*cdf0e10cSrcweir{ 462*cdf0e10cSrcweir alert( "XSimple called." + message); 463*cdf0e10cSrcweir} 464*cdf0e10cSrcweir 465*cdf0e10cSrcweir 466*cdf0e10cSrcweir</script> 467*cdf0e10cSrcweir 468*cdf0e10cSrcweir 469*cdf0e10cSrcweir 470*cdf0e10cSrcweir<h2> Object in JScript</h2> 471*cdf0e10cSrcweir 472*cdf0e10cSrcweirThis test passes a XCallback to an UNO function of the UNO test control. 473*cdf0e10cSrcweirXCallback is implemented by the JScript class XCallback_Impl. The function 474*cdf0e10cSrcweirXCallback::func1 is then called from the UNO test control. 475*cdf0e10cSrcweir<br> 476*cdf0e10cSrcweir<button onclick='callOleTest( 1)'>go</Button> 477*cdf0e10cSrcweir<br> 478*cdf0e10cSrcweirOn the UNO object the function testInterface is called which takes 479*cdf0e10cSrcweira XCallback as parameter. XCallback is implemented in a JScript object.The function 480*cdf0e10cSrcweirreturns a XSimple Interface. Then the UNO object calls XSimple::notify. This test shall 481*cdf0e10cSrcweirverify the correct conversion of the return value( IDispatch JScript object) to an XSimple object.<br> 482*cdf0e10cSrcweir<button onclick='callOleTest( 2)'>go</Button> 483*cdf0e10cSrcweir<br> 484*cdf0e10cSrcweir<h1> out parameter </h1> 485*cdf0e10cSrcweirThe a JScript object of class XCallback_Impl is passed to the UNO OleTest Control as parameter. 486*cdf0e10cSrcweirAccording to the buttons the OleTest object calls a function on XCallback_Impl that has appropriate type 487*cdf0e10cSrcweiras out parameter.<br> 488*cdf0e10cSrcweir<button onclick='callOleTest( 3)'>interface</Button> 489*cdf0e10cSrcweir<button onclick='callOleTest( 4)'>struct</Button> 490*cdf0e10cSrcweir<button onclick='callOleTest( 5)'>enum</Button> 491*cdf0e10cSrcweir<button onclick='callOleTest( 6)'>sequence<any></Button> 492*cdf0e10cSrcweir<button onclick='callOleTest( 7)'>any</Button> 493*cdf0e10cSrcweir<button onclick='callOleTest( 8)'>bool</Button> 494*cdf0e10cSrcweir<button onclick='callOleTest( 9)'>char</Button> 495*cdf0e10cSrcweir<button onclick='callOleTest( 10)'>string</Button> 496*cdf0e10cSrcweir<button onclick='callOleTest( 11)'>float</Button> 497*cdf0e10cSrcweir<button onclick='callOleTest( 12)'>double</Button> 498*cdf0e10cSrcweir<button onclick='callOleTest( 13)'>byte</Button> 499*cdf0e10cSrcweir<button onclick='callOleTest( 14)'>short</Button> 500*cdf0e10cSrcweir<button onclick='callOleTest( 15)'>long</Button> 501*cdf0e10cSrcweir<br> 502*cdf0e10cSrcweirOther test with out parameters <br> 503*cdf0e10cSrcweir<button onclick='callOleTest( 30)'>outValuesMixed</Button> 504*cdf0e10cSrcweir<button onclick='callOleTest( 31)'>outValuesAll</Button> 505*cdf0e10cSrcweir<h1> in out parameter </h1> 506*cdf0e10cSrcweir<button onclick='callOleTest( 100)'>interface</Button> 507*cdf0e10cSrcweir<button onclick='callOleTest( 101)'>struct</Button> 508*cdf0e10cSrcweir<button onclick='callOleTest( 102)'>enum</Button> 509*cdf0e10cSrcweir<button onclick='callOleTest( 103)'>seqence<any></Button> 510*cdf0e10cSrcweir<button onclick='callOleTest( 104)'>any</Button> 511*cdf0e10cSrcweir<button onclick='callOleTest( 105)'>bool</Button> 512*cdf0e10cSrcweir<button onclick='callOleTest( 106)'>char</Button> 513*cdf0e10cSrcweir<button onclick='callOleTest( 107)'>string</Button> 514*cdf0e10cSrcweir<button onclick='callOleTest( 108)'>float</Button> 515*cdf0e10cSrcweir<button onclick='callOleTest( 109)'>double</Button> 516*cdf0e10cSrcweir<button onclick='callOleTest( 110)'>byte</Button> 517*cdf0e10cSrcweir<button onclick='callOleTest( 111)'>short</Button> 518*cdf0e10cSrcweir<button onclick='callOleTest( 112)'>long</Button> 519*cdf0e10cSrcweir<br> 520*cdf0e10cSrcweir<h1> Attributes </h1> 521*cdf0e10cSrcweir<button onclick='callOleTest( 400)'>getting XSimple</Button> 522*cdf0e10cSrcweir<br> 523*cdf0e10cSrcweir 524*cdf0e10cSrcweirOther tests with inout parameters <br> 525*cdf0e10cSrcweir<button onclick='callOleTest( 120)'>inoutValuesAll</Button> 526*cdf0e10cSrcweir<h1>in parameters </h1> 527*cdf0e10cSrcweir<button onclick='callOleTest( 200)'>inValues</Button> 528*cdf0e10cSrcweir 529*cdf0e10cSrcweir<h1> JScript object implements several interfaces </h1> 530*cdf0e10cSrcweir<button onclick='callOleTest( 1000)'>go</Button> 531*cdf0e10cSrcweir 532*cdf0e10cSrcweir 533*cdf0e10cSrcweir 534*cdf0e10cSrcweir 535*cdf0e10cSrcweir</body> 536*cdf0e10cSrcweir</html> 537*cdf0e10cSrcweir 538*cdf0e10cSrcweir 539