1054 lines
31 KiB
HTML
1054 lines
31 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<META NAME="GENERATOR" Content="Microsoft Developer Studio">
|
|
<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<TITLE>Document Title</TITLE>
|
|
</HEAD>
|
|
<BODY id=theBody>
|
|
|
|
<script language="JScript">
|
|
function callOleTest( id)
|
|
{
|
|
var factory= new ActiveXObject("com.sun.star.ServiceManager");
|
|
var oletest= factory.createInstance("oletest.OleTest");
|
|
// alert(oletest);
|
|
|
|
var arr= new Array( 1, 2, 3, 4, 0);
|
|
var arrDouble= new Array( 1.2345, 12.345, 123,45, 1234.5, 12345);
|
|
var arrBool= new Array( 1, 0, 2, 0, 3);
|
|
var arrChar= new Array( '1', 'A', "1", "A", ' ', 55, 56);
|
|
var arrString= new Array("hamburger","cheeseburger", "chicken nuggets", "chicken wings" , "pizza");
|
|
var arrAny= new Array( 100, 100.1235,"hallo");
|
|
var arrSeq= new Array( arr, arr, arr);
|
|
var arrSeq2= new Array( arrSeq, arrSeq, arrSeq)
|
|
|
|
// var ob= new Object();
|
|
// ob.value= "A JScript object";
|
|
// var arrObject= new Array( ob, ob, ob);
|
|
|
|
|
|
var arrout1= new Array();
|
|
var arrout2= new Array();
|
|
var arrout3= new Array();
|
|
|
|
var ret, i;
|
|
var sfarray, sfarray1, sfarray2, sfarray3;
|
|
var value= oletest._GetValueObject();
|
|
var outValue= oletest._GetValueObject();
|
|
outValue.InitOutParam();
|
|
var outValue2= oletest._GetValueObject();
|
|
outValue2.InitOutParam();
|
|
var outValue3= oletest._GetValueObject();
|
|
outValue3.InitOutParam();
|
|
|
|
var inoutValue= oletest._GetValueObject();
|
|
// inoutValue.InitInOutParam();
|
|
|
|
switch( id)
|
|
{
|
|
// Array in-params
|
|
case 1:
|
|
value.Set("[]byte", arr)
|
|
ret= oletest.methodByte( value);
|
|
sfarray= new VBArray( ret);
|
|
document.writeln( "Param: " + arr.toString() + "<br>");
|
|
document.writeln( "Returns a Sequence< BYTE > <br>" + sfarray.toArray()) ; break;
|
|
|
|
case 2:
|
|
value.Set("[]double", arrDouble)
|
|
ret= oletest.methodDouble( value);
|
|
sfarray= new VBArray( ret);
|
|
document.writeln( "Param: " + arrDouble.toString() +"<br>");
|
|
document.writeln( "Returns a Sequence< double > <br>" + sfarray.toArray()) ; break;
|
|
|
|
case 3:
|
|
value.Set("[]boolean", arrBool)
|
|
ret= oletest.methodBool( value);
|
|
sfarray= new VBArray( ret);
|
|
document.writeln( "Param: " + arrBool.toString() +"<br>");
|
|
document.writeln( "Returns a Sequence< BOOL > <br>" + sfarray.toArray()) ; break;
|
|
|
|
case 4:
|
|
value.Set("[]short", arr)
|
|
ret= oletest.methodShort( value);
|
|
sfarray= new VBArray( ret);
|
|
document.writeln( "Param: " + arr.toString() +"<br>");
|
|
document.writeln( "Returns a Sequence< SHORT > <br>" + sfarray.toArray()) ; break;
|
|
|
|
case 5:
|
|
value.Set("[]unsigned short", arr)
|
|
ret= oletest.methodUShort( value);
|
|
sfarray= new VBArray( ret);
|
|
document.writeln( "Param: " + arr.toString() +"<br>");
|
|
document.writeln( "Returns a Sequence< unsigned SHORT > <br>" + sfarray.toArray()) ; break;
|
|
|
|
case 6:
|
|
value.Set("[]long", arr)
|
|
ret= oletest.methodLong( value);
|
|
sfarray= new VBArray( ret);
|
|
document.writeln( "Param: " + arr.toString() +"<br>");
|
|
document.writeln( "Returns a Sequence< LONG > <br>" + sfarray.toArray()) ; break;
|
|
|
|
case 7:
|
|
value.Set("[]unsigned long", arr)
|
|
ret= oletest.methodULong( value);
|
|
sfarray= new VBArray( ret);
|
|
document.writeln( "Param: " + arr.toString() +"<br>");
|
|
document.writeln( "Returns a Sequence< unsigned LONG > <br>" + sfarray.toArray()) ; break;
|
|
|
|
case 8:
|
|
value.Set("[]char", arrChar)
|
|
ret= oletest.methodChar( value);
|
|
sfarray= new VBArray( ret);
|
|
document.writeln( "Param: " + arrChar.toString() +"<br>");
|
|
document.writeln( "Returns a Sequence< wchar_t > <br>" + sfarray.toArray()) ; break;
|
|
|
|
case 9:
|
|
value.Set("[]string", arrString)
|
|
ret= oletest.methodString( value);
|
|
sfarray= new VBArray( ret);
|
|
document.writeln( "Param: " + arrString.toString() +"<br>");
|
|
document.writeln( "Returns a Sequence< UString > <br>" + sfarray.toArray()) ; break;
|
|
|
|
case 10:
|
|
value.Set("[]any", arrAny)
|
|
ret= oletest.methodAny( value);
|
|
sfarray= new VBArray( ret);
|
|
document.writeln( "Param: " + arrAny.toString() +"<br>");
|
|
document.writeln( "Returns a Sequence< UsrAny > <br>" + sfarray.toArray() ) ; break;
|
|
|
|
case 11:
|
|
var allArray= new Array();
|
|
for(var i= 0; i <3; i++)
|
|
{
|
|
var value1= oletest._GetValueObject();
|
|
value1.Set("[]long", arr);
|
|
allArray[i]= value1;
|
|
}
|
|
|
|
value.Set("[][]long", allArray);
|
|
|
|
ret= oletest.methodSequence( value);
|
|
sfarray= new VBArray( ret);
|
|
document.writeln( "Param: " + arrSeq.toString() +"<br>");
|
|
document.writeln("Returns a Sequence< Sequence < long >> <br>") ;
|
|
var arr1= new Array();
|
|
arr1= sfarray.toArray();
|
|
for( i=0; i < arr1.length; i++)
|
|
{
|
|
sfarray2= new VBArray( arr1[i]);
|
|
var arr2= new Array();
|
|
arr2= sfarray2.toArray();
|
|
document.writeln( arr2.toString() + "<br>" );
|
|
}
|
|
break;
|
|
|
|
case 12:
|
|
var array1= new Array();
|
|
for(var i= 0; i <3; i++)
|
|
{
|
|
var array2 = new Array();
|
|
for( var j= 0; j < 3; j++)
|
|
{
|
|
var value2= oletest._GetValueObject();
|
|
value2.Set("[]long", arr);
|
|
array2[j]= value2;
|
|
}
|
|
|
|
var value1= oletest._GetValueObject();
|
|
value1.Set("[][]long", array2)
|
|
array1[i]= value1;
|
|
}
|
|
var valueAll= oletest._GetValueObject();
|
|
valueAll.Set("[][][]long",array1);
|
|
|
|
ret= oletest.methodSequence2( valueAll);
|
|
document.writeln( "Param: " + arrSeq2.toString() +"<br>");
|
|
sfarray1= new VBArray( ret);
|
|
arr1= sfarray1.toArray();
|
|
for( i=0; i < arr1.length; i++)
|
|
{
|
|
sfarray2= new VBArray( arr1[i]);
|
|
arr2= sfarray2.toArray();
|
|
|
|
for ( j=0; j < arr2.length; j++)
|
|
{
|
|
sfarray3= new VBArray( arr2[j]);
|
|
arr3= sfarray3.toArray();
|
|
document.write( i+ " ");
|
|
document.writeln(j + ": "+ arr3.toString() + "<br>" );
|
|
}
|
|
|
|
}
|
|
break;
|
|
|
|
case 13:
|
|
|
|
var ar= new Array();
|
|
for( i=0; i< 3; i++)
|
|
{
|
|
var ob= new Object();
|
|
var valueObject= oletest._GetValueObject();
|
|
ob.value= "A JScript object!";
|
|
valueObject.Set("com.sun.star.uno.XInterface", ob);
|
|
// valueObject.Set("long", 5);
|
|
ar[i]= valueObject;
|
|
}
|
|
value.Set("[]com.sun.star.uno.XInterface", ar);
|
|
// value.Set("[]long", ar);
|
|
|
|
ret = oletest.methodXInterface( value);
|
|
sfarray= new VBArray( ret);
|
|
var arRet= sfarray.toArray();
|
|
|
|
document.writeln( "Params : Array containing objects ")
|
|
for( index in ar)
|
|
{
|
|
document.writeln( "object " + index + ": " + ar[index].Get().value +" ");
|
|
}
|
|
document.writeln( "<br>" ) ;
|
|
document.writeln("Return: <br>");
|
|
for( index in arRet)
|
|
{
|
|
document.writeln( "object " + index + ": " + arRet[index].value + " ");
|
|
}
|
|
break;
|
|
|
|
|
|
|
|
|
|
// Properties: setting and getting values
|
|
case 200:
|
|
value.Set("[]byte", arr)
|
|
oletest.AttrByte = value;
|
|
ret= oletest.AttrByte;
|
|
sfarray= new VBArray( ret);
|
|
document.writeln("Setting AttrByte: " + arr.toString() + "<p>");
|
|
document.writeln("Getting AttrByte: " + sfarray.toArray()); break;
|
|
|
|
case 201:
|
|
value.Set("[]double", arrDouble)
|
|
oletest.AttrDouble= value;
|
|
ret= oletest.AttrDouble;
|
|
sfarray= new VBArray( ret);
|
|
document.writeln("Setting AttrDouble: " + arrDouble.toString() + "<p>");
|
|
document.writeln("Getting AttrDouble: " + sfarray.toArray()); break;
|
|
|
|
case 202:
|
|
value.Set("[]boolean", arrBool)
|
|
oletest.AttrBool= value;
|
|
ret= oletest.AttrBool;
|
|
sfarray= new VBArray( ret);
|
|
document.writeln("Setting AttrBool: " + arrBool.toString() + "<p>");
|
|
document.writeln("Getting AttrBool: " + sfarray.toArray()); break;
|
|
|
|
case 203:
|
|
value.Set("[]short", arr)
|
|
oletest.AttrShort= value;
|
|
ret= oletest.AttrShort;
|
|
sfarray= new VBArray( ret);
|
|
document.writeln("Setting AttrShort: " + arr.toString() + "<p>");
|
|
document.writeln("Getting AttrShort: " + sfarray.toArray()); break;
|
|
|
|
case 204:
|
|
value.Set("[]unsigned short", arr)
|
|
oletest.AttrUShort= value;
|
|
ret= oletest.AttrUShort;
|
|
sfarray= new VBArray( ret);
|
|
document.writeln("Setting AttrUShort: " + arr.toString() + "<p>");
|
|
document.writeln("Getting AttrUShort: " + sfarray.toArray()); break;
|
|
|
|
case 205:
|
|
value.Set("[]long", arr)
|
|
oletest.AttrLong= value;
|
|
ret= oletest.AttrLong;
|
|
sfarray= new VBArray( ret);
|
|
document.writeln("Setting AttrLong: " + arr.toString() + "<p>");
|
|
document.writeln("Getting AttrLong: " + sfarray.toArray()); break;
|
|
|
|
case 206:
|
|
value.Set("[]unsigned long", arr)
|
|
oletest.AttrULong= value;
|
|
ret= oletest.AttrULong;
|
|
sfarray= new VBArray( ret);
|
|
document.writeln("Setting AttrULong: " + arr.toString() + "<p>");
|
|
document.writeln("Getting AttrULong: " + sfarray.toArray()); break;
|
|
|
|
case 207:
|
|
value.Set("[]char", arrChar)
|
|
oletest.AttrChar= value;
|
|
ret= oletest.AttrChar;
|
|
sfarray= new VBArray( ret);
|
|
document.writeln("Setting AttrChar: " + arrChar.toString() + "<p>");
|
|
document.writeln("Getting AttrChar: " + sfarray.toArray()); break;
|
|
|
|
case 208:
|
|
value.Set("[]string", arrString)
|
|
oletest.AttrString= value;
|
|
ret= oletest.AttrString;
|
|
sfarray= new VBArray( ret);
|
|
document.writeln("Setting AttrString: " + arrString.toString() + "<p>");
|
|
document.writeln("Getting AttrString: " + sfarray.toArray()); break;
|
|
|
|
case 209:
|
|
value.Set("[]any", arrAny)
|
|
oletest.AttrAny= value;
|
|
ret= oletest.AttrAny;
|
|
sfarray= new VBArray( ret);
|
|
document.writeln("Setting AttrAny: " + arrAny.toString() + "<p>");
|
|
document.writeln("Getting AttrAny: " + sfarray.toArray()); break;
|
|
|
|
case 210:
|
|
var allArray= new Array();
|
|
for(var i= 0; i <3; i++)
|
|
{
|
|
var value1= oletest._GetValueObject();
|
|
value1.Set("[]long", arr);
|
|
allArray[i]= value1;
|
|
}
|
|
|
|
value.Set("[][]long", allArray);
|
|
|
|
oletest.AttrSequence= value;
|
|
ret= oletest.AttrSequence;
|
|
sfarray= new VBArray( ret);
|
|
|
|
document.writeln( "Param: " + arrSeq.toString() +"<br>");
|
|
document.writeln("Returns a Sequence< Sequence < long >> <br>") ;
|
|
var arr1= new Array();
|
|
arr1= sfarray.toArray();
|
|
for( i=0; i < arr1.length; i++)
|
|
{
|
|
sfarray2= new VBArray( arr1[i]);
|
|
var arr2= new Array();
|
|
arr2= sfarray2.toArray();
|
|
document.writeln( arr2.toString() + "<br>" );
|
|
}
|
|
break;
|
|
|
|
case 211:
|
|
var array1= new Array();
|
|
for(var i= 0; i <3; i++)
|
|
{
|
|
var array2 = new Array();
|
|
for( var j= 0; j < 3; j++)
|
|
{
|
|
var value2= oletest._GetValueObject();
|
|
value2.Set("[]long", arr);
|
|
array2[j]= value2;
|
|
}
|
|
|
|
var value1= oletest._GetValueObject();
|
|
value1.Set("[][]long", array2)
|
|
array1[i]= value1;
|
|
}
|
|
var valueAll= oletest._GetValueObject();
|
|
valueAll.Set("[][][]long",array1);
|
|
|
|
oletest.AttrSequence2= valueAll;
|
|
ret= oletest.AttrSequence2;
|
|
sfarray1= new VBArray( ret);
|
|
arr1= sfarray1.toArray();
|
|
for( i=0; i < arr1.length; i++)
|
|
{
|
|
sfarray2= new VBArray( arr1[i]);
|
|
arr2= sfarray2.toArray();
|
|
|
|
for ( j=0; j < arr2.length; j++)
|
|
{
|
|
sfarray3= new VBArray( arr2[j]);
|
|
arr3= sfarray3.toArray();
|
|
document.write( i+ " ");
|
|
document.writeln(j + ": "+ arr3.toString() + "<br>" );
|
|
}
|
|
|
|
}
|
|
break;
|
|
|
|
case 212:
|
|
var ar= new Array();
|
|
for( i=0; i< 3; i++)
|
|
{
|
|
var ob= new Object();
|
|
var valueObject= oletest._GetValueObject();
|
|
ob.value= "A JScript object!";
|
|
valueObject.Set("com.sun.star.uno.XInterface", ob);
|
|
ar[i]= valueObject;
|
|
}
|
|
value.Set("[]com.sun.star.uno.XInterface", ar);
|
|
|
|
oletest.AttrXInterface= value;
|
|
ret= oletest.AttrXInterface;
|
|
sfarray= new VBArray( ret);
|
|
var arRet= sfarray.toArray();
|
|
|
|
document.writeln( "Params : Array containing objects ")
|
|
for( index in ar)
|
|
{
|
|
document.writeln( "object " + index + ": " + ar[index].Get().value +" ");
|
|
}
|
|
document.writeln( "<br>" ) ;
|
|
document.writeln("Return: <br>");
|
|
for( index in arRet)
|
|
{
|
|
document.writeln( "object " + index + ": " + arRet[index].value + " ");
|
|
}
|
|
|
|
break;
|
|
|
|
// Out-parameter ------------------------------------------------------------
|
|
case (2000):
|
|
|
|
oletest.testout_methodByte( outValue );
|
|
alert("byte: " + outValue.Get() ); break;
|
|
case (2001):
|
|
oletest.testout_methodDouble( outValue );
|
|
alert( "double: " + outValue.Get() ); break;
|
|
case (2002):
|
|
oletest.testout_methodBool( outValue );
|
|
alert( "boolean: " + outValue.Get() ); break;
|
|
case (2003):
|
|
oletest.testout_methodShort( outValue );
|
|
alert( "short: " + outValue.Get() ); break;
|
|
case (2004):
|
|
oletest.testout_methodUShort( outValue );
|
|
alert( "unsigned short: " + outValue.Get() ); break;
|
|
case (2005):
|
|
oletest.testout_methodLong( outValue );
|
|
alert( "long: " + outValue.Get() ); break;
|
|
case (2006):
|
|
oletest.testout_methodULong( outValue );
|
|
alert( "unsigned long: " + outValue.Get() ); break;
|
|
case (2007):
|
|
oletest.testout_methodChar( outValue );
|
|
alert( "char: " + outValue.Get() ); break;
|
|
case (2008):
|
|
oletest.testout_methodString( outValue );
|
|
alert( "string: " + outValue.Get()); break;
|
|
case (2009):
|
|
oletest.testout_methodAny( outValue );
|
|
alert( "any: " + outValue.Get() ); break;
|
|
case (2010):
|
|
oletest.testout_methodSequence( outValue );
|
|
var sfarray= new VBArray( outValue.Get());
|
|
arr= sfarray.toArray();
|
|
document.writeln("use the browser's back arrow to go to the previous page <p>");
|
|
document.writeln( arr.toString());
|
|
break;
|
|
case (2011):
|
|
oletest.testout_methodSequence2( outValue );
|
|
var sfarray= new VBArray( outValue.Get());
|
|
arr= sfarray.toArray();
|
|
var i;
|
|
for( i=0; i < arr.length; i++)
|
|
{
|
|
var sfarray= new VBArray( arr[i]);
|
|
var arr2= new Array();
|
|
arr2= sfarray.toArray();
|
|
document.writeln( arr2.toString() + "<br>" );
|
|
}
|
|
break;
|
|
case (2012):
|
|
oletest.testout_methodMulParams1( outValue, outValue2 );
|
|
document.writeln( "int : " + outValue.Get() + " int :" + outValue2.Get()); break;
|
|
case (2013):
|
|
oletest.testout_methodMulParams2( outValue, outValue2, outValue3 );
|
|
document.writeln( "int: " + outValue.Get() + " int: " + outValue2.Get() + " string: " + outValue3.Get() ); break;
|
|
case (2014):
|
|
oletest.testout_methodMulParams3( "hallo", outValue );
|
|
document.writeln( "string: " + outValue.Get() ); break;
|
|
case (2015):
|
|
oletest.testout_methodXInterface( outValue );
|
|
var out= outValue.Get();
|
|
document.writeln( "string: " + out.AttrAny2); break;
|
|
|
|
// INOUT - Parameter -------------------------------------------------------------------------------
|
|
// The in value has to be placed on index 0 of the passed in array
|
|
case (500):
|
|
inoutValue.InitInOutParam("byte", 100);
|
|
oletest.testinout_methodByte( inoutValue );
|
|
alert("byte: " + inoutValue.Get() ); break;
|
|
case (501):
|
|
inoutValue.InitInOutParam("double", 3.14);
|
|
oletest.testinout_methodDouble( inoutValue );
|
|
alert( "double: " + inoutValue.Get() ); break;
|
|
case (502):
|
|
inoutValue.InitInOutParam("boolean", false);
|
|
oletest.testinout_methodBool( inoutValue );
|
|
alert( "boolean: " + inoutValue.Get() ); break;
|
|
case (503):
|
|
inoutValue.InitInOutParam( "short", 200);
|
|
oletest.testinout_methodShort( inoutValue );
|
|
alert( "short: " + inoutValue.Get() ); break;
|
|
case (504):
|
|
inoutValue.InitInOutParam("unsigned short", 300);
|
|
oletest.testinout_methodUShort( inoutValue );
|
|
alert( "unsigned short: " + inoutValue.Get() ); break;
|
|
case (505):
|
|
inoutValue.InitInOutParam("long", 400);
|
|
oletest.testinout_methodLong( inoutValue );
|
|
alert( "long: " + inoutValue.Get() ); break;
|
|
case (506):
|
|
inoutValue.InitInOutParam( "unsigned long", 500);
|
|
oletest.testinout_methodULong( inoutValue );
|
|
alert( "unsigned long: " + inoutValue.Get() ); break;
|
|
case (507):
|
|
inoutValue.InitInOutParam( "char", "A");
|
|
oletest.testinout_methodChar( inoutValue );
|
|
alert( "char: " + inoutValue.Get() ); break;
|
|
case (508):
|
|
inoutValue.InitInOutParam("string", "I am a string");
|
|
oletest.testinout_methodString( inoutValue );
|
|
alert( "string: " + inoutValue.Get() ); break;
|
|
case (509):
|
|
inoutValue.InitInOutParam("[]long", arr);
|
|
oletest.testinout_methodAny( inoutValue ); // the method simply returns the argument
|
|
sfarray= new VBArray( inoutValue.Get());
|
|
arr= sfarray.toArray();
|
|
alert( "any: " + arr.toString() ); break;
|
|
case (510):
|
|
inoutValue.InitInOutParam("[]long", arr);
|
|
oletest.testinout_methodSequence( inoutValue );
|
|
var sfarray= new VBArray( inoutValue.Get());
|
|
arr= sfarray.toArray();
|
|
document.writeln("use the browser's back arrow to go to the previous page <p>");
|
|
document.writeln( arr.toString());
|
|
break;
|
|
case (511):
|
|
inoutValue.InitInOutParam( "[][]long", arrSeq);
|
|
oletest.testinout_methodSequence2( inoutValue );
|
|
var sfarray= new VBArray( inoutValue.Get());
|
|
arr= sfarray.toArray();
|
|
var i;
|
|
for( i=0; i < arr.length; i++)
|
|
{
|
|
var sfarray= new VBArray( arr[i]);
|
|
var arr2= new Array();
|
|
arr2= sfarray.toArray();
|
|
document.writeln( arr2.toString() + "<br>" );
|
|
}
|
|
break;
|
|
case 512:
|
|
var ob= new Object();
|
|
ob.value= "this is a string";
|
|
inoutValue.InitInOutParam( "com.sun.star.script.XInvocation", ob);
|
|
oletest.testinout_methodXInterface( inoutValue);
|
|
document.write("Out value: " + inoutValue.Get().value );
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
// Test ANY
|
|
// Methods
|
|
case 1000:
|
|
i= 100;
|
|
ret= oletest.methodAnyTest1( i);
|
|
document.writeln( "in: " + i + " ret: " + ret);
|
|
break;
|
|
case 1001:
|
|
i= 3.14;
|
|
ret= oletest.methodAnyTest1( i);
|
|
document.writeln( "in: " + i + " ret: " + ret);
|
|
break;
|
|
case 1002:
|
|
i= "Hallo"
|
|
ret= oletest.methodAnyTest1( i);
|
|
document.writeln( "in: " + i + " ret: " + ret);
|
|
break;
|
|
case 1003:
|
|
i= arr;
|
|
ret= oletest.methodAnyTest1( i);
|
|
sfarray= new VBArray( ret);
|
|
document.writeln( "in: " + i + " ret: " + sfarray.toArray());
|
|
break;
|
|
case 1004:
|
|
var obj= new Object();
|
|
obj[1]= "This is index 0";
|
|
ret= oletest.methodAnyTest1( obj);
|
|
document.writeln( "in: " + obj + " ret: " + ret);
|
|
break;
|
|
|
|
|
|
// Test ANY property
|
|
case 1010:
|
|
i= 100;
|
|
oletest.AttrAny2= i;
|
|
ret= oletest.AttrAny2;
|
|
document.writeln( "set: " + i + " get: " + ret);
|
|
break;
|
|
case 1011:
|
|
i= 3.14;
|
|
oletest.AttrAny2= i;
|
|
ret= oletest.AttrAny2;
|
|
document.writeln( "set: " + i + " get: " + ret);
|
|
break;
|
|
case 1012:
|
|
i= "Hallo"
|
|
oletest.AttrAny2= i;
|
|
ret= oletest.AttrAny2;
|
|
document.writeln( "set: " + i + " get: " + ret);
|
|
break;
|
|
case 1013:
|
|
i= arr;
|
|
oletest.AttrAny2= i;
|
|
ret= oletest.AttrAny2;
|
|
sfarray= new VBArray( ret);
|
|
document.writeln( "set: " + i + " get: " + sfarray.toArray());
|
|
break;
|
|
case 1014:
|
|
var obj= new Object();
|
|
obj[1]= "This is index 0";
|
|
oletest.AttrAny2= obj;
|
|
ret= oletest.AttrAny2;
|
|
document.writeln( "set: " + obj + " get: " + ret);
|
|
break;
|
|
|
|
|
|
case 2100:
|
|
alert("2100");
|
|
var ret= oletest.retMethodByte();
|
|
var sfarray= VBArray( ret);
|
|
document.writeln( sfarray.toArray() );
|
|
break;
|
|
|
|
|
|
// case 5000:
|
|
// oletest.other_methodAnyIn("hallo");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function funcOut( out)
|
|
{
|
|
out["du"]= 0xffff;
|
|
}
|
|
|
|
</script>
|
|
|
|
<script language="VBScript">
|
|
|
|
sub callBasic(id)
|
|
|
|
Dim factory
|
|
Set factory= GetObject("", "com.sun.star.ServiceManager")
|
|
|
|
Set oletest= factory.createInstance("oletest.OleTest")
|
|
|
|
|
|
arrInt= Array(1,2,3,4,5)
|
|
arrInt2= Array( -1, -2, 127, 128, 0)
|
|
arrDouble= Array(1.1, 2.2, 3.3, 4.4, 5.5)
|
|
arrBool= Array(0,1,0,2,0)
|
|
arrLong= Array( &Hff, &Hffff, &Hffffff, &Hffffffff)
|
|
arrString= Array("Chicken Wings", "Cheeseburger", "Hamburger")
|
|
arrChar= Array("a",65, "M")
|
|
arrAny= Array("Mickey", 3.14, 100, "A")
|
|
|
|
Dim arrDim2Int(1,1)
|
|
For i= 0 To 1
|
|
For j= 0 To 1
|
|
arrDim2Int(i,j) = i*2 + j
|
|
Next
|
|
Next
|
|
|
|
Dim arrDim3Int(1,1,1)
|
|
For i= 0 To 1
|
|
For j= 0 To 1
|
|
For k=0 To 1
|
|
arrDim3Int(i,j,k) = i*2 + j*2 + k
|
|
Next
|
|
Next
|
|
Next
|
|
|
|
|
|
set outValue= factory.Bridge_GetValueObject()
|
|
outValue.InitOutParam
|
|
set value= factory.Bridge_GetValueObject()
|
|
select case id
|
|
case 0
|
|
value.Set "[]byte", arrInt
|
|
ret= oletest.methodByte(value)
|
|
document.writeln "<br> return value: "
|
|
printArray ret
|
|
case 1
|
|
document.writeln "param: "
|
|
printArray arrDouble
|
|
ret= oletest.methodDouble(arrDouble)
|
|
document.writeln "<br> return value: "
|
|
printArray ret
|
|
case 2
|
|
document.writeln "param: "
|
|
printArray arrBool
|
|
ret= oletest.methodBool(arrBool)
|
|
document.writeln "<br> return value: "
|
|
printArray ret
|
|
case 3
|
|
document.writeln "param: "
|
|
printArray arrInt2
|
|
ret= oletest.methodShort(arrInt2)
|
|
document.writeln "<br> return value: "
|
|
printArray ret
|
|
case 4
|
|
document.writeln "param: "
|
|
printArray arrInt
|
|
ret= oletest.methodUShort(arrInt)
|
|
document.writeln "<br> return value: "
|
|
printArray ret
|
|
case 5
|
|
document.writeln "param: "
|
|
printArray arrLong
|
|
ret= oletest.methodLong(arrLong)
|
|
document.writeln "<br> return value: "
|
|
printArray ret
|
|
case 6
|
|
document.writeln "param: "
|
|
printArray arrInt
|
|
ret= oletest.methodULong(arrInt)
|
|
document.writeln "<br> return value: "
|
|
printArray ret
|
|
case 7
|
|
document.writeln "param: "
|
|
printArray arrString
|
|
ret= oletest.methodString(arrString)
|
|
document.writeln "<br> return value: "
|
|
printArray ret
|
|
case 8
|
|
document.writeln "param: "
|
|
printArray arrChar
|
|
ret= oletest.methodChar(arrChar)
|
|
document.writeln "<br> return value: "
|
|
printArray ret
|
|
case 9
|
|
document.writeln "param: "
|
|
printArray arrAny
|
|
ret= oletest.methodAny(arrAny)
|
|
document.writeln "<br> return value: "
|
|
printArray ret
|
|
case 10
|
|
document.writeln "param: "
|
|
printArray2 arrDim2Int
|
|
ret= oletest.methodSequence(arrDim2Int)
|
|
document.writeln "<br> return value: "
|
|
for each val in ret
|
|
document.write "<br> array: "
|
|
for each val2 in val
|
|
document.write val2
|
|
next
|
|
next
|
|
|
|
// In Out Parameter --------------------------------------------------
|
|
case 100
|
|
a= 100
|
|
document.write "param: " & CStr( a) & "<br>"
|
|
oletest.testinout_methodByte a
|
|
document.write a
|
|
case 101
|
|
a= 1.11
|
|
document.write "param: " & CStr( a) & "<br>"
|
|
oletest.testinout_methodDouble a
|
|
document.write a
|
|
case 102
|
|
a= 5
|
|
document.write "param: "& CStr( a) & "<br>"
|
|
oletest.testinout_methodBool a
|
|
document.write a
|
|
case 103
|
|
a= -10
|
|
document.write "param: "& CStr( a) & "<br>"
|
|
oletest.testinout_methodShort a
|
|
document.write a
|
|
case 104
|
|
a= 128
|
|
document.write "param: "& CStr( a) & "<br>"
|
|
oletest.testinout_methodUShort a
|
|
document.write a
|
|
case 105
|
|
a= 65556
|
|
document.write "param: "& CStr( a) & "<br>"
|
|
oletest.testinout_methodLong a
|
|
document.write a
|
|
case 106
|
|
a= 65556
|
|
document.write "param: "& CStr( a) & "<br>"
|
|
oletest.testinout_methodULong a
|
|
document.write a
|
|
case 107
|
|
a= "ein test string"
|
|
document.write "param: "& CStr( a) & "<br>"
|
|
oletest.testinout_methodString a
|
|
document.write a
|
|
case 108
|
|
a= "W"
|
|
document.write "param: "& CStr( a) & "<br>"
|
|
oletest.testinout_methodChar a
|
|
document.write a
|
|
case 109
|
|
a= "Ein String im Any"
|
|
document.write "param: "& CStr( a) & "<br>"
|
|
oletest.other_methodAnyIn a
|
|
document.write a
|
|
// Attributes -----------------------------------------------------------------
|
|
case 200
|
|
document.write "set: "
|
|
printArray arrInt
|
|
oletest.AttrByte= arrInt
|
|
b= oletest.AttrByte
|
|
call printArrayEx( "<br> get: ", "<br>", b)
|
|
case 201
|
|
document.write "set: "
|
|
printArray arrDouble
|
|
oletest.AttrDouble= arrDouble
|
|
b= oletest.AttrDouble
|
|
call printArrayEx( "<br> get: ", "<br>", b)
|
|
case 202
|
|
document.write "set: "
|
|
printArray arrBool :
|
|
oletest.AttrBool= arrBool
|
|
b= oletest.AttrBool
|
|
call printArrayEx( "<br> get: ", "<br>", b)
|
|
case 203
|
|
document.write "set: "
|
|
printArray arrInt2 :
|
|
oletest.AttrShort= arrInt2
|
|
b= oletest.AttrShort
|
|
call printArrayEx( "<br> get: ", "<br>", b)
|
|
case 204
|
|
document.write "set: "
|
|
printArray arrInt
|
|
oletest.AttrUShort= arrInt
|
|
b= oletest.AttrUShort
|
|
call printArrayEx( "<br> get: ", "<br>", b)
|
|
case 205
|
|
document.write "set: "
|
|
printArray arrInt2
|
|
oletest.AttrLong= arrInt2
|
|
b= oletest.AttrLong
|
|
call printArrayEx( "<br> get: ", "<br>", b)
|
|
case 206
|
|
document.write "set: "
|
|
printArray arrInt
|
|
oletest.AttrULong= arrInt
|
|
b= oletest.AttrULong
|
|
call printArrayEx( "<br> get: ", "<br>", b)
|
|
case 207
|
|
document.write "set: "
|
|
printArray arrString
|
|
oletest.AttrString= arrString
|
|
b= oletest.AttrString
|
|
call printArrayEx( "<br> get: ", "<br>", b)
|
|
case 208
|
|
document.write "set: "
|
|
printArray arrChar
|
|
oletest.AttrChar= arrChar
|
|
b= oletest.AttrChar
|
|
call printArrayEx( "<br> get: ", "<br>", b)
|
|
case 209
|
|
document.write "set: "
|
|
printArray arrAny
|
|
oletest.AttrAny= arrAny
|
|
b= oletest.AttrAny
|
|
call printArrayEx( "<br> get: ", "<br>", b)
|
|
|
|
case 210
|
|
document.write "set: <br>"
|
|
printArray2 arrDim2Int :
|
|
oletest.AttrSequence= arrDim2Int
|
|
ret= oletest.AttrSequence
|
|
document.write "get: "
|
|
for each val in ret
|
|
document.write "<br> array: "
|
|
for each val2 in val
|
|
document.write val2
|
|
next
|
|
next
|
|
|
|
// out params
|
|
case 300
|
|
oletest.testout_methodByte( outValue )
|
|
alert("byte: " & outValue.Get() )
|
|
|
|
|
|
end select
|
|
end sub
|
|
sub printArray( arr)
|
|
document.write "array: "
|
|
For Each val In arr
|
|
document.write CStr(val) & " "
|
|
Next
|
|
end sub
|
|
|
|
// print a 2 dimensional Array
|
|
|
|
sub printArray2( arr)
|
|
elements1= UBound( arr, 1) - LBound( arr, 1) +1
|
|
elements2= UBound( arr, 2) - LBound( arr, 2) +1
|
|
|
|
For i=0 To elements1 -1
|
|
document.write( "array " & CStr( i) & ": " )
|
|
For j=0 To elements2 -1
|
|
document.write CStr( arr(i,j))
|
|
Next
|
|
document.write( "<br>")
|
|
Next
|
|
end sub
|
|
|
|
sub printArrayEx( pre, post, array)
|
|
document.write pre
|
|
printArray array
|
|
document.write post
|
|
end sub
|
|
</script>
|
|
|
|
<div id=out> </div>
|
|
|
|
<!-- Insert HTML here -->
|
|
|
|
<h2> JScript with _GetValueObject </h2>
|
|
Tests Array/Sequence conversion.<br>
|
|
All methods receive a Sequence as Parameter. The element type of the Sequence is written on the buttons.
|
|
<br>
|
|
<button onclick='callOleTest( 1)'>byte</Button>
|
|
<button onclick='callOleTest( 2)'>double</Button>
|
|
<button onclick='callOleTest( 3)'>boolean</Button>
|
|
<button onclick='callOleTest( 4)'>short</Button>
|
|
<button onclick='callOleTest( 5)'>unsigned short</Button>
|
|
<button onclick='callOleTest( 6)'>long</Button>
|
|
<button onclick='callOleTest( 7)'>unsigned long</Button>
|
|
<button onclick='callOleTest( 8)'>char</Button>
|
|
<button onclick='callOleTest( 10)'>any</Button>
|
|
<button onclick='callOleTest( 11)'>sequence<long> </Button>
|
|
<button onclick='callOleTest( 12)'>sequence<sequence<long> > </Button>
|
|
<button onclick='callOleTest( 13)'>XInterface</Button>
|
|
<p>
|
|
|
|
|
|
Out Parameter <br>
|
|
<button onclick='callOleTest( 2000)'>byte </Button>
|
|
<button onclick='callOleTest( 2001)'>double</Button>
|
|
<button onclick='callOleTest( 2002)'>boolean</Button>
|
|
<button onclick='callOleTest( 2003)'>short</Button>
|
|
<button onclick='callOleTest( 2004)'>unsigned short</Button>
|
|
<button onclick='callOleTest( 2005)'>long</Button>
|
|
<button onclick='callOleTest( 2006)'>unsigned long</Button>
|
|
<button onclick='callOleTest( 2007)'>char</Button>
|
|
<button onclick='callOleTest( 2008)'>string</Button>
|
|
<button onclick='callOleTest( 2009)'>any</Button>
|
|
<button onclick='callOleTest( 2010)'>sequence<long> </Button>
|
|
<button onclick='callOleTest( 2011)'>sequence<sequence<long> > </Button>
|
|
<button onclick='callOleTest( 2012)'>2 out </Button>
|
|
<button onclick='callOleTest( 2013)'>3 out </Button>
|
|
<button onclick='callOleTest( 2014)'>1 in & 1 out </Button>
|
|
<button onclick='callOleTest( 2015)'>XInterface </Button>
|
|
|
|
<p>
|
|
In Out Parameter <br>
|
|
<button onclick='callOleTest( 500)'>byte </Button>
|
|
<button onclick='callOleTest( 501)'>double</Button>
|
|
<button onclick='callOleTest( 502)'>boolean</Button>
|
|
<button onclick='callOleTest( 503)'>short</Button>
|
|
<button onclick='callOleTest( 504)'>unsigned short</Button>
|
|
<button onclick='callOleTest( 505)'>long</Button>
|
|
<button onclick='callOleTest( 506)'>unsigned long</Button>
|
|
<button onclick='callOleTest( 507)'>char</Button>
|
|
<button onclick='callOleTest( 508)'>string</Button>
|
|
<button onclick='callOleTest( 509)'>any</Button>
|
|
<button onclick='callOleTest( 510)'>sequence<long> </Button>
|
|
<button onclick='callOleTest( 511)'>sequence<sequence<long> > </Button>
|
|
<button onclick='callOleTest( 512)'>XInterface </Button>
|
|
<p>
|
|
|
|
Tests Array/Sequence conversion with Attributes. All params are of type Sequence and
|
|
the element type of the Sequence is written on the buttons. <br>
|
|
<button onclick='callOleTest( 200)'>byte </Button>
|
|
<button onclick='callOleTest( 201)'>double</Button>
|
|
<button onclick='callOleTest( 202)'>boolean</Button>
|
|
<button onclick='callOleTest( 203)'>short</Button>
|
|
<button onclick='callOleTest( 204)'>unsigned short</Button>
|
|
<button onclick='callOleTest( 205)'>long</Button>
|
|
<button onclick='callOleTest( 206)'>unsigned long</Button>
|
|
<button onclick='callOleTest( 207)'>char</Button>
|
|
<button onclick='callOleTest( 208)'>string</Button>
|
|
<button onclick='callOleTest( 209)'>any</Button>
|
|
<button onclick='callOleTest( 210)'>sequence<long> </Button>
|
|
<button onclick='callOleTest( 211)'>sequence<sequence<long> > </Button>
|
|
<button onclick='callOleTest( 212)'>XInterface </Button>
|
|
<p>
|
|
|
|
<!--
|
|
Test of Any parameter in a method. Any contains:<br>
|
|
<button onclick='callOleTest( 1000)'>integer </Button>
|
|
<button onclick='callOleTest( 1001)'>double </Button>
|
|
<button onclick='callOleTest( 1002)'>string</Button>
|
|
<button onclick='callOleTest( 1003)'>array</Button>
|
|
<button onclick='callOleTest( 1004)'>object</Button>
|
|
<p>
|
|
Test of Any parameter in a property. Any contains:<br>
|
|
<button onclick='callOleTest( 1010)'>integer </Button>
|
|
<button onclick='callOleTest( 1011)'>double </Button>
|
|
<button onclick='callOleTest( 1012)'>string</Button>
|
|
<button onclick='callOleTest( 1013)'>array</Button>
|
|
<button onclick='callOleTest( 1014)'>object</Button>
|
|
<p>
|
|
<p>
|
|
-->
|
|
|
|
<h2> Visual Basic Tests </h2>
|
|
Test array /Sequence conversion and return value<br>
|
|
Template: <b> Sequence < type > method( Sequence< type > ) </b>
|
|
<p>
|
|
|
|
|
|
<button onclick='callBasic(0)'>byte</button>
|
|
<!--
|
|
<button onclick='callBasic(1)'>double</button>
|
|
<button onclick='callBasic(2)'>boolean</button>
|
|
<button onclick='callBasic(3)'>short</button>
|
|
<button onclick='callBasic(4)'>u short</button>
|
|
<button onclick='callBasic(5)'>long</button>
|
|
<button onclick='callBasic(6)'>u long</button>
|
|
<button onclick='callBasic(7)'>string</button>
|
|
<button onclick='callBasic(8)'>char</button>
|
|
<button onclick='callBasic(9)'>any</button> <br>
|
|
<button onclick='callBasic(10)'>Seq < int ></button>
|
|
-->
|
|
<p>
|
|
|
|
|
|
Out parameter <br>
|
|
Template: <b> void method( Sequence < type > ) </b> <br>
|
|
<button onclick='callBasic(300)'>byte</button>
|
|
<!--
|
|
<button onclick='callBasic(101)'>double</button>
|
|
<button onclick='callBasic(102)'>boolean</button>
|
|
<button onclick='callBasic(103)'>short</button>
|
|
<button onclick='callBasic(104)'>u short</button>
|
|
<button onclick='callBasic(105)'>long</button>
|
|
<button onclick='callBasic(106)'>u long</button>
|
|
<button onclick='callBasic(107)'>string</button>
|
|
<button onclick='callBasic(108)'>char</button>
|
|
<button onclick='callBasic(109)'>any</button> <br>
|
|
-->
|
|
<p>
|
|
<!--
|
|
Tests Array/Sequence conversion with <b>Attributes</b>. All params are of type Sequence and
|
|
the element type of the Sequence is written on the buttons. <br>
|
|
<button onclick='callBasic( 200)'>byte </Button>
|
|
<button onclick='callBasic( 201)'>double</Button>
|
|
<button onclick='callBasic( 202)'>boolean</Button>
|
|
<button onclick='callBasic( 203)'>short</Button>
|
|
<button onclick='callBasic( 204)'>unsigned short</Button>
|
|
<button onclick='callBasic( 205)'>long</Button>
|
|
<button onclick='callBasic( 206)'>unsigned long</Button>
|
|
<button onclick='callBasic( 207)'>string</Button>
|
|
<button onclick='callBasic( 208)'>char</Button>
|
|
<button onclick='callBasic( 209)'>any</Button>
|
|
<button onclick='callBasic( 210)'>sequence<long> </Button>
|
|
-->
|
|
|
|
|
|
|