<script language="JScript">
function callOleTest( id)
{ var factory= new ActiveXObject("com.sun.star.ServiceManager"); var oletest= factory.createInstance("oletest.OleTest");
// alert(oletest);
switch( id)
{
case 1: // Test simple call of JScript object function from UNO
oletest.testInterface( new XCallback_Impl, 1);
break;
case 2:
// return value is the parameter object
oletest.testInterface( new XCallback_Impl, 2);
break;
// OUT parameter
case 3: // Test out parameter of type interface
oletest.testInterface( new XCallback_Impl, 3);
break;
case 4: // Test out parameter of type struct
oletest.testInterface( new XCallback_Impl, 4);
break;
case 5: // Test out parameter of type enum
oletest.testInterface( new XCallback_Impl, 5);
break;
case 6: // Test out parameter of type sequence<any>
oletest.testInterface( new XCallback_Impl, 6);
break;
case 7: // Test out parameter of type any
oletest.testInterface( new XCallback_Impl, 7);
break;
case 8: // Test out parameter of type bool
oletest.testInterface( new XCallback_Impl, 8);
break;
case 9: // Test out parameter of type char
oletest.testInterface( new XCallback_Impl, 9);
break;
case 10: // Test out parameter of type string
oletest.testInterface( new XCallback_Impl, 10);
break;
case 11: // Test out parameter of type float
oletest.testInterface( new XCallback_Impl, 11);
break;
case 12: // Test out parameter of type double
oletest.testInterface( new XCallback_Impl, 12);
break;
case 13: // Test out parameter of type byte
oletest.testInterface( new XCallback_Impl, 13);
break;
case 14: // Test out parameter of type short
oletest.testInterface( new XCallback_Impl, 14);
break;
case 15: // Test out parameter of type long
oletest.testInterface( new XCallback_Impl, 15);
break;
case 30: // outValuesMixed
oletest.testInterface( new XCallback_Impl, 30);
break;
case 31: // outValuesAll
oletest.testInterface( new XCallback_Impl, 31);
break;
// IN/OUT parameter
case 100: // inoutInterface
oletest.testInterface( new XCallback_Impl, 100);
break;
case 101: // inoutStruct
oletest.testInterface( new XCallback_Impl, 101);
break;
case 102: // inoutEnum
oletest.testInterface( new XCallback_Impl, 102);
break;
case 103: // inoutSeqAny
oletest.testInterface( new XCallback_Impl, 103);
break;
case 104: // inoutAny
oletest.testInterface( new XCallback_Impl, 104);
break;
case 105: // inoutBool
oletest.testInterface( new XCallback_Impl, 105);
break;
case 106: // inoutChar
oletest.testInterface( new XCallback_Impl, 106);
break;
case 107: // inoutString
oletest.testInterface( new XCallback_Impl, 107);
break;
case 108: // inoutFloat
oletest.testInterface( new XCallback_Impl, 108);
break;
case 109: // inoutDouble
oletest.testInterface( new XCallback_Impl, 109);
break;
case 110: // inoutByte
oletest.testInterface( new XCallback_Impl, 110);
break;
case 111: // inoutShort
oletest.testInterface( new XCallback_Impl, 111);
break;
case 112: // inoutLong
oletest.testInterface( new XCallback_Impl, 112);
break;
case 120: // inoutValuesAll
oletest.testInterface( new XCallback_Impl, 120);
break;
case 200: // inValues
oletest.testInterface( new XCallback_Impl, 200);
break;
// Call a COM object that has not been passed as parameter to a UNO component and
// hence no type information is available in the COM wrapper
// case 300:
// Attributes
case 400:
oletest.testInterface( new XCallback_Impl, 400);
break;
case 1000:
oletest.testInterface2(new MultiInterface(), 0);
break;
}
}
// The class --------------------------------------------
function XCallback_Impl()
{
// XCallback
this._environment= "JScript";
this.func1= XCallback_Impl_func1;
this.returnInterface= XCallback_Impl_returnInterface;
// #################################################
// OUT parameter
function XCallback_Impl_func1()
{
alert("XCallback_Impl_func1");
}
function XCallback_Impl_returnInterface()
{
alert("XCallback::returnInterface called");
return new XSimple_Impl();
}
function XCallback_Impl_outInterface( outVal)
{
outVal[0]= new XSimple_Impl();
}
function XCallback_Impl_outLong( outVal)
{
alert("outLong");
}
function XCallback_Impl_outStruct( outVal)
{ var factory= new ActiveXObject("com.sun.star.ServiceManager"); var starCoreReflection = factory.createInstance("com.sun.star.reflection.CoreReflection"); var structClass = starCoreReflection.forName("oletest.SimpleStruct"); var outParam= new Array();
structClass.createObject(outParam); var aStruct= outParam[0];
aStruct.message= "a Struct created in JScript";
outVal[0]= aStruct;
}
function XCallback_Impl_outEnum( outVal)
{
outVal[0]= 2;
}
function XCallback_Impl_outSeqAny( outVal)
{ var ar= new Array(1,2,3);
outVal[0]= ar;
}
function XCallback_Impl_outAny( outVal)
{
outVal[0]= "this is an Any";
}
function XCallback_Impl_outBool( outVal)
{
outVal[0]= true;
}
function XCallback_Impl_outChar( outVal)
{
outVal[0]= "a";
}
function XCallback_Impl_outString( outVal)
{
outVal[0]= "This string was created in JScript";
}
function XCallback_Impl_outFloat( outVal)
{
outVal[0]= 3.14;
}
function XCallback_Impl_outDouble( outVal)
{
outVal[0]= 3.145;
}
function XCallback_Impl_outByte( outVal)
{
outVal[0]= 100;
}
function XCallback_Impl_outShort( outVal)
{
outVal[0]= 1000;
}
function XCallback_Impl_outLong( outVal)
{
outVal[0]= 1000000;
}
function XCallback_Impl_outValuesMixed( inLong, outLong, inString)
{
alert("inVal long: " + inLong +" inString:" + inString);
outLong[0]= inLong + 1;
}
function XCallback_Impl_outValuesAll( xSimple, aSimpleStruct, aSimpleEnum, seqAny, aAny, aBool,
aChar, aString, aFloat, aDouble, aByte, aShort, aLong)
{
this.outInterface( xSimple);
this.outStruct( aSimpleStruct);
this.outEnum( aSimpleEnum);
this.outSeqAny( seqAny);
this.outAny( aAny);
this.outBool( aBool);
this.outChar( aChar);
this.outString( aString);
this.outFloat( aFloat);
this.outDouble( aDouble);
this.outByte( aByte);
this.outShort( aShort);
this.outLong( aLong);
}
function XCallback_Impl_inoutInterface( val)
{
val[0].func("calling on in parameter");
val[0]= new XSimple_Impl();
}
function XCallback_Impl_inoutStruct( val)
{
alert( val[0].message);
val[0].message= "property message changed in JScript";
}
function XCallback_Impl_inoutEnum(val)
{
alert("enum value +" + val);
val[0]= 2;
}
function XCallback_Impl_inoutSeqAny( val)
{ var vbar = new VBArray(val[0]); var seq= vbar.toArray();
alert( seq[0] +" "+seq[1] +" " +seq[2]);
val[0]= new Array("jscript1", "jscript2","jscript3");
}
function XCallback_Impl_inoutAny(val)
{
alert( "JScript in any: " + val[0]);
val[0]= "a string from JScript";
}
function XCallback_Impl_inoutBool(val)
{
alert( "JScript in bool: " + val[0]);
val[0]= true;
}
function XCallback_Impl_inoutChar(val)
{
alert( "JScript in char: " + val[0]);
val[0]= 'b';
}
function XCallback_Impl_inoutString(val)
{
alert( "JScript in string: " + val[0]);
val[0]= " a JScript string";
}
function XCallback_Impl_inoutFloat(val)
{
alert( "JScript in float: " + val[0]);
val[0]= 4.14;
}
function XCallback_Impl_inoutDouble(val)
{
alert( "JScript in double: " + val[0]);
val[0]= 4.145;
}
// class XSimple_Impl----------------------------------------------------------------------
function XSimple_Impl()
{
//XSimple
this.func= XSimple_Impl_func;
}
function XSimple_Impl_func( message)
{
alert( "XSimple called." + message);
}
</script>
<h2> Object in JScript</h2>
This test passes a XCallback to a UNO function of the UNO test control.
XCallback is implemented by the JScript class XCallback_Impl. The function
XCallback::func1 is then called from the UNO test control.
<br>
<button onclick='callOleTest( 1)'>go</Button>
<br>
On the UNO object the function testInterface is called which takes a XCallback as parameter. XCallback is implemented in a JScript object.The function
returns a XSimple Interface. Then the UNO object calls XSimple::notify. This test shall
verify the correct conversion of the return value( IDispatch JScript object) to an XSimple object.<br>
<button onclick='callOleTest( 2)'>go</Button>
<br>
<h1> out parameter </h1>
The a JScript object of class XCallback_Impl is passed to the UNO OleTest Control as parameter.
According to the buttons the OleTest object calls a function on XCallback_Impl that has appropriate type
as out parameter.<br>
<button onclick='callOleTest( 3)'>interface</Button>
<button onclick='callOleTest( 4)'>struct</Button>
<button onclick='callOleTest( 5)'>enum</Button>
<button onclick='callOleTest( 6)'>sequence<any></Button>
<button onclick='callOleTest( 7)'>any</Button>
<button onclick='callOleTest( 8)'>bool</Button>
<button onclick='callOleTest( 9)'>char</Button>
<button onclick='callOleTest( 10)'>string</Button>
<button onclick='callOleTest( 11)'>float</Button>
<button onclick='callOleTest( 12)'>double</Button>
<button onclick='callOleTest( 13)'>byte</Button>
<button onclick='callOleTest( 14)'>short</Button>
<button onclick='callOleTest( 15)'>long</Button>
<br>
Other test without parameters <br>
<button onclick='callOleTest( 30)'>outValuesMixed</Button>
<button onclick='callOleTest( 31)'>outValuesAll</Button>
<h1> in out parameter </h1>
<button onclick='callOleTest( 100)'>interface</Button>
<button onclick='callOleTest( 101)'>struct</Button>
<button onclick='callOleTest( 102)'>enum</Button>
<button onclick='callOleTest( 103)'>sequence<any></Button>
<button onclick='callOleTest( 104)'>any</Button>
<button onclick='callOleTest( 105)'>bool</Button>
<button onclick='callOleTest( 106)'>char</Button>
<button onclick='callOleTest( 107)'>string</Button>
<button onclick='callOleTest( 108)'>float</Button>
<button onclick='callOleTest( 109)'>double</Button>
<button onclick='callOleTest( 110)'>byte</Button>
<button onclick='callOleTest( 111)'>short</Button>
<button onclick='callOleTest( 112)'>long</Button>
<br>
<h1> Attributes </h1>
<button onclick='callOleTest( 400)'>getting XSimple</Button>
<br>
Other tests with inout parameters <br>
<button onclick='callOleTest( 120)'>inoutValuesAll</Button>
<h1>in parameters </h1>
<button onclick='callOleTest( 200)'>inValues</Button>
<h1> JScript object implements several interfaces </h1>
<button onclick='callOleTest( 1000)'>go</Button>
</body>
</html>
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.15Bemerkung:
(vorverarbeitet am 2026-10-12)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.