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