summaryrefslogtreecommitdiff
path: root/extensions/test/ole
diff options
context:
space:
mode:
authorJoachim Lingner <jl@openoffice.org>2001-12-03 13:03:20 +0000
committerJoachim Lingner <jl@openoffice.org>2001-12-03 13:03:20 +0000
commit74fb4905297e6ba7d44d202d54195dd4351f26de (patch)
tree595d22cae6bdb375105a00198b9c5530ca5396c6 /extensions/test/ole
parentfc6e5e4731e672564bd271dc60ee5b62372d7fc4 (diff)
*** empty log message ***
Diffstat (limited to 'extensions/test/ole')
-rw-r--r--extensions/test/ole/EventListenerSample/EventListener/EvtListener.cpp5
-rw-r--r--extensions/test/ole/EventListenerSample/EventListener/EvtListener.h1
-rw-r--r--extensions/test/ole/OleTest.htm3
-rw-r--r--extensions/test/ole/VisualBasic/Form1.frm349
-rw-r--r--extensions/test/ole/VisualBasic/Module1.bas283
-rw-r--r--extensions/test/ole/VisualBasic/Project1.vbp33
-rw-r--r--extensions/test/ole/VisualBasic/Project1.vbw1
-rw-r--r--extensions/test/ole/cpnt/cpnt.cxx148
-rw-r--r--extensions/test/ole/cpnt/makefile.mk7
-rw-r--r--extensions/test/ole/idl/oletest.idl30
10 files changed, 836 insertions, 24 deletions
diff --git a/extensions/test/ole/EventListenerSample/EventListener/EvtListener.cpp b/extensions/test/ole/EventListenerSample/EventListener/EvtListener.cpp
index 821769e5bf50..9a469cbfcfc1 100644
--- a/extensions/test/ole/EventListenerSample/EventListener/EvtListener.cpp
+++ b/extensions/test/ole/EventListenerSample/EventListener/EvtListener.cpp
@@ -11,4 +11,9 @@ STDMETHODIMP CEvtListener::disposing( IDispatch* source)
::MessageBox(NULL,_T("XEventListener::disposing"),
_T("EventListener.EvtListener component"), MB_OK);
return S_OK;
+}
+
+CEvtListener::~CEvtListener()
+{
+
} \ No newline at end of file
diff --git a/extensions/test/ole/EventListenerSample/EventListener/EvtListener.h b/extensions/test/ole/EventListenerSample/EventListener/EvtListener.h
index 8bbb9c1591bf..7b9b6a1f8df7 100644
--- a/extensions/test/ole/EventListenerSample/EventListener/EvtListener.h
+++ b/extensions/test/ole/EventListenerSample/EventListener/EvtListener.h
@@ -16,6 +16,7 @@ public:
CEvtListener()
{
}
+ ~CEvtListener();
DECLARE_REGISTRY_RESOURCEID(IDR_EVTLISTENER)
diff --git a/extensions/test/ole/OleTest.htm b/extensions/test/ole/OleTest.htm
index 343d1b7c9c20..5aaad3322cd1 100644
--- a/extensions/test/ole/OleTest.htm
+++ b/extensions/test/ole/OleTest.htm
@@ -373,6 +373,7 @@ function callOleTest( id)
arrout1[0]= ob;
alert (arrout1[0].value);
oletest.testinout_methodXInterface( arrout1);
+ alert (arrout1[0].value);
var outValue= arrout1[0];
for ( key in outValue)
{
@@ -949,7 +950,7 @@ Template: <b> Sequence &lt type &gt method( Sequence&lt type &gt ) </b> <br>
IN/Out parameter <br>
-Template: <b> void method( Sequence &lt type &gt ) </b> <br>
+Template: <b> void method(type ) </b> <br>
<button onclick='callBasic(100)'>byte</button>
<button onclick='callBasic(101)'>double</button>
<button onclick='callBasic(102)'>boolean</button>
diff --git a/extensions/test/ole/VisualBasic/Form1.frm b/extensions/test/ole/VisualBasic/Form1.frm
new file mode 100644
index 000000000000..c2ed1f6a11f5
--- /dev/null
+++ b/extensions/test/ole/VisualBasic/Form1.frm
@@ -0,0 +1,349 @@
+VERSION 5.00
+Begin VB.Form Form1
+ Caption = "Form1"
+ ClientHeight = 4572
+ ClientLeft = 48
+ ClientTop = 336
+ ClientWidth = 8460
+ LinkTopic = "Form1"
+ ScaleHeight = 4572
+ ScaleWidth = 8460
+ StartUpPosition = 3 'Windows Default
+ Begin VB.CommandButton ctrInParamStart
+ Caption = "Start"
+ Height = 252
+ Left = 240
+ TabIndex = 20
+ Top = 480
+ Width = 732
+ End
+ Begin VB.TextBox tareaResult
+ Height = 1932
+ Left = 4920
+ TabIndex = 19
+ Top = 480
+ Width = 3372
+ End
+ Begin VB.CommandButton Command20
+ Caption = "Command20"
+ Height = 252
+ Left = 3000
+ TabIndex = 18
+ Top = 2640
+ Width = 492
+ End
+ Begin VB.CommandButton Command19
+ Caption = "string"
+ Height = 252
+ Left = 2280
+ TabIndex = 17
+ Top = 2640
+ Width = 492
+ End
+ Begin VB.CommandButton Command18
+ Caption = "long"
+ Height = 252
+ Left = 1560
+ TabIndex = 16
+ Top = 2640
+ Width = 492
+ End
+ Begin VB.CommandButton Command17
+ Caption = "short"
+ Height = 252
+ Left = 840
+ TabIndex = 15
+ Top = 2640
+ Width = 492
+ End
+ Begin VB.CommandButton Command16
+ Caption = "byte"
+ Height = 252
+ Left = 120
+ TabIndex = 14
+ Top = 2640
+ Width = 492
+ End
+ Begin VB.CommandButton Command15
+ Caption = "array"
+ Height = 252
+ Left = 3000
+ TabIndex = 12
+ Top = 1920
+ Width = 612
+ End
+ Begin VB.CommandButton Command14
+ Caption = "string"
+ Height = 252
+ Left = 2280
+ TabIndex = 11
+ Top = 1920
+ Width = 492
+ End
+ Begin VB.CommandButton Command13
+ Caption = "long"
+ Height = 252
+ Left = 1440
+ TabIndex = 10
+ Top = 1920
+ Width = 612
+ End
+ Begin VB.CommandButton Command12
+ Caption = "short"
+ Height = 252
+ Left = 720
+ TabIndex = 9
+ Top = 1920
+ Width = 612
+ End
+ Begin VB.CommandButton Command11
+ Caption = "byte"
+ Height = 252
+ Left = 120
+ TabIndex = 8
+ Top = 1920
+ Width = 492
+ End
+ Begin VB.CommandButton Command10
+ Caption = "array"
+ Height = 252
+ Left = 3000
+ TabIndex = 6
+ Top = 1200
+ Width = 612
+ End
+ Begin VB.CommandButton Command9
+ Caption = "string"
+ Height = 252
+ Left = 2280
+ TabIndex = 5
+ Top = 1200
+ Width = 612
+ End
+ Begin VB.CommandButton Command8
+ Caption = "long"
+ Height = 252
+ Left = 1560
+ TabIndex = 4
+ Top = 1200
+ Width = 612
+ End
+ Begin VB.CommandButton Command7
+ Caption = "short"
+ Height = 252
+ Left = 840
+ TabIndex = 3
+ Top = 1200
+ Width = 612
+ End
+ Begin VB.CommandButton Command6
+ Caption = "byte"
+ Height = 252
+ Left = 120
+ TabIndex = 2
+ Top = 1200
+ Width = 612
+ End
+ Begin VB.Label Label4
+ Caption = "Properties"
+ Height = 252
+ Left = 120
+ TabIndex = 13
+ Top = 2280
+ Width = 1212
+ End
+ Begin VB.Label Label3
+ Caption = "In Out Parameter"
+ Height = 252
+ Left = 120
+ TabIndex = 7
+ Top = 1560
+ Width = 1332
+ End
+ Begin VB.Label Label2
+ Caption = "Out Parameter"
+ Height = 252
+ Left = 120
+ TabIndex = 1
+ Top = 840
+ Width = 1332
+ End
+ Begin VB.Label Label1
+ Caption = "In Parameter"
+ Height = 252
+ Left = 240
+ TabIndex = 0
+ Top = 120
+ Width = 1212
+ End
+End
+Attribute VB_Name = "Form1"
+Attribute VB_GlobalNameSpace = False
+Attribute VB_Creatable = False
+Attribute VB_PredeclaredId = True
+Attribute VB_Exposed = False
+Option Explicit
+Private objServiceManager
+Private objCoreReflection
+Private objOleTest
+
+Private Sub ctrInParamStart_Click()
+Dim ret As Variant
+
+' In Parameter, simple types
+'============================================
+ret = objOleTest.in_methodByte(10)
+Debug.Print TypeName(ret) & " " & CStr(ret)
+ret = objOleTest.in_methodFloat(3.14)
+Debug.Print TypeName(ret) & " " & CStr(ret)
+
+Dim d As Double 'try conversion
+d = 3.14
+ret = objOleTest.in_methodFloat(3.14)
+Debug.Print TypeName(ret) & " " & CStr(ret)
+ret = objOleTest.in_methodDouble(4.14)
+Debug.Print TypeName(ret) & " " & CStr(ret)
+Dim s As Single
+s = 4.14
+ret = objOleTest.in_methodDouble(s)
+Debug.Print TypeName(ret) & " " & CStr(ret)
+ret = objOleTest.in_methodBool(True)
+Debug.Print TypeName(ret) & " " & CStr(ret)
+ret = objOleTest.in_methodBool(False)
+Debug.Print TypeName(ret) & " " & CStr(ret)
+ret = objOleTest.in_methodShort(-10)
+Debug.Print TypeName(ret) & " " & CStr(ret)
+ret = objOleTest.in_methodUShort(10)
+Debug.Print TypeName(ret) & " " & CStr(ret)
+ret = objOleTest.in_methodLong(-1000000)
+Debug.Print TypeName(ret) & " " & CStr(ret)
+ret = objOleTest.in_methodULong(1000000)
+Debug.Print TypeName(ret) & " " & CStr(ret)
+ret = objOleTest.in_methodString("This is a String")
+Debug.Print TypeName(ret) & " " & CStr(ret)
+ret = objOleTest.in_methodChar("A")
+Debug.Print TypeName(ret) & " " & CStr(ret)
+ret = objOleTest.in_methodAny("This is a String in an any")
+Debug.Print TypeName(ret) & " " & CStr(ret)
+
+Call objOleTest.in_methodAll(10, 10.1, 10.111, True, 10, 11, 12, 13, _
+ "A String", "A", "A String in an Any")
+
+'Out Parameter simple types
+'================================================
+Dim outByte As Byte
+objOleTest.testout_methodByte outByte
+Debug.Print "out byte " & CStr(outByte)
+Dim outFloat As Single
+objOleTest.testout_methodFloat outFloat
+Debug.Print "out float " & CStr(outFloat)
+Dim outDouble As Double
+objOleTest.testout_methodDouble outDouble
+Debug.Print "out double " & CStr(outDouble)
+Dim outBool As Boolean
+objOleTest.testout_methodBool outBool
+Debug.Print "out bool " & CStr(outBool)
+Dim outInt As Integer
+objOleTest.testout_methodShort outInt
+Debug.Print "out short " & CStr(outInt)
+objOleTest.testout_methodUShort outInt
+Debug.Print "out unsignedshort " & CStr(outInt)
+Dim outLong As Long
+objOleTest.testout_methodLong outLong
+Debug.Print "out long " & CStr(outInt)
+objOleTest.testout_methodULong outLong
+Debug.Print "out unsigned long " & CStr(outInt)
+Dim outString As String
+objOleTest.testout_methodString outString
+Debug.Print "out string " & CStr(outString)
+Dim outChar As Integer
+objOleTest.testout_methodChar outChar
+Debug.Print "out char " & CStr(outChar)
+Dim outCharS As String
+objOleTest.testout_methodChar outCharS
+Debug.Print "out char (String) " & CStr(outCharS)
+objOleTest.testout_methodAny outString
+Debug.Print "out Any " & CStr(outString)
+'Out Parameter simple types (VARIANT var)
+Dim outVar As Variant
+objOleTest.testout_methodByte outVar
+Debug.Print "out Byte (VARIANT) " & CStr(outVar)
+objOleTest.testout_methodFloat outVar
+Debug.Print "out float (VARIANT) " & CStr(outVar)
+objOleTest.testout_methodDouble outVar
+Debug.Print "out double (VARIANT) " & CStr(outVar)
+objOleTest.testout_methodBool outVar
+Debug.Print "out bool (VARIANT) " & CStr(outVar)
+objOleTest.testout_methodShort outVar
+Debug.Print "out short (VARIANT) " & CStr(outVar)
+objOleTest.testout_methodUShort outVar
+Debug.Print "out unsigned short (VARIANT) " & CStr(outVar)
+objOleTest.testout_methodLong outVar
+Debug.Print "out long (VARIANT) " & CStr(outVar)
+objOleTest.testout_methodULong outVar
+Debug.Print "out unsigned long (VARIANT) " & CStr(outVar)
+objOleTest.testout_methodString outVar
+Debug.Print "out string (VARIANT) " & CStr(outVar)
+objOleTest.testout_methodChar outVar
+Debug.Print "out char (VARIANT) " & CStr(outVar)
+objOleTest.testout_methodAny outVar
+Debug.Print "out any (VARIANT) " & CStr(outVar)
+
+'In/Out simple types
+outByte = 10
+objOleTest.testinout_methodByte outByte
+Debug.Print "inout byte " & CStr(outByte)
+outFloat = 3.14
+objOleTest.testinout_methodFloat outFloat
+Debug.Print "inout float " & CStr(outFloat)
+outDouble = 4.14
+objOleTest.testinout_methodDouble outDouble
+Debug.Print "inout double " & CStr(outDouble)
+outBool = True
+objOleTest.testinout_methodBool outBool
+Debug.Print "inout bool " & CStr(outBool)
+outInt = 10
+objOleTest.testinout_methodShort outInt
+Debug.Print "inout short " & CStr(outInt)
+outInt = 20
+objOleTest.testinout_methodUShort outInt
+Debug.Print "inout unsignedshort " & CStr(outInt)
+outLong = 30
+objOleTest.testinout_methodLong outLong
+Debug.Print "inout long " & CStr(outLong)
+outLong = 40
+objOleTest.testinout_methodULong outLong
+Debug.Print "inout unsigned long " & CStr(outLong)
+outString = "this is an in string"
+objOleTest.testinout_methodString outString
+Debug.Print "inout string " & CStr(outString)
+
+outString = "this is an in String"
+objOleTest.testout_methodChar outString
+Debug.Print "out char " & CStr(outString)
+outString = "this is another in out string"
+objOleTest.testout_methodAny outString
+Debug.Print "out Any " & CStr(outString)
+
+
+
+
+
+Dim var As Boolean
+var = True
+Debug.Print CStr(var)
+
+
+End Sub
+
+Private Sub Form_Load()
+ Set objServiceManager = CreateObject("com.sun.star.ServiceManager")
+ Set objCoreReflection = objServiceManager.createInstance("com.sun.star.reflection.CoreReflection")
+
+ Set objOleTest = objServiceManager.createInstance("oletest.OleTest")
+ Debug.Print TypeName(objOleTest)
+End Sub
+
+Private Sub Text1_Change()
+
+End Sub
diff --git a/extensions/test/ole/VisualBasic/Module1.bas b/extensions/test/ole/VisualBasic/Module1.bas
new file mode 100644
index 000000000000..e8655dccfc91
--- /dev/null
+++ b/extensions/test/ole/VisualBasic/Module1.bas
@@ -0,0 +1,283 @@
+Attribute VB_Name = "Module1"
+Option Explicit
+
+Private objServiceManager
+Private objCoreReflection
+Private objOleTest
+Private objEventListener
+
+Sub Main()
+ Set objServiceManager = CreateObject("com.sun.star.ServiceManager")
+ Set objCoreReflection = objServiceManager.createInstance("com.sun.star.reflection.CoreReflection")
+ ' extensions/test/ole/cpnt
+ Set objOleTest = objServiceManager.createInstance("oletest.OleTest")
+ ' extensions/test/ole/EventListenerSample/VBEventListener
+ Set objEventListener = CreateObject("VBasicEventListener.VBEventListener")
+ Debug.Print TypeName(objOleTest)
+
+' In Parameter, simple types
+'============================================
+Dim tmpVar As Variant
+Dim ret As Variant
+ret = objOleTest.in_methodByte(10)
+Debug.Print TypeName(ret) & " " & CStr(ret)
+ret = objOleTest.in_methodFloat(3.14)
+Debug.Print TypeName(ret) & " " & CStr(ret)
+
+Dim d As Double 'try conversion
+d = 3.14
+ret = objOleTest.in_methodFloat(3.14)
+Debug.Print TypeName(ret) & " " & CStr(ret)
+ret = objOleTest.in_methodDouble(4.14)
+Debug.Print TypeName(ret) & " " & CStr(ret)
+Dim s As Single
+s = 4.14
+ret = objOleTest.in_methodDouble(s)
+Debug.Print TypeName(ret) & " " & CStr(ret)
+ret = objOleTest.in_methodBool(True)
+Debug.Print TypeName(ret) & " " & CStr(ret)
+ret = objOleTest.in_methodBool(False)
+Debug.Print TypeName(ret) & " " & CStr(ret)
+ret = objOleTest.in_methodShort(-10)
+Debug.Print TypeName(ret) & " " & CStr(ret)
+ret = objOleTest.in_methodUShort(10)
+Debug.Print TypeName(ret) & " " & CStr(ret)
+ret = objOleTest.in_methodLong(-1000000)
+Debug.Print TypeName(ret) & " " & CStr(ret)
+ret = objOleTest.in_methodULong(1000000)
+Debug.Print TypeName(ret) & " " & CStr(ret)
+ret = objOleTest.in_methodString("This is a String")
+Debug.Print TypeName(ret) & " " & CStr(ret)
+'different character tests
+ret = objOleTest.in_methodChar("A")
+Debug.Print TypeName(ret) & " " & CStr(ret)
+Dim ret1 As String
+ret1 = objOleTest.in_methodChar("A")
+Debug.Print TypeName(ret1) & " " & CStr(ret1)
+ret1 = objOleTest.in_methodChar(65)
+Debug.Print TypeName(ret1) & " " & CStr(ret1)
+ret = objOleTest.in_methodAny("This is a String in an any")
+Debug.Print TypeName(ret) & " " & CStr(ret)
+'Call objOleTest.in_methodAll(10, 10.1, 10.111, True, 10, 11, 12, 13, _
+' "A String", "A", "A String in an Any")
+
+'Out Parameter simple types
+'================================================
+Dim outByte As Byte
+objOleTest.testout_methodByte outByte
+Debug.Print "out byte " & CStr(outByte)
+Dim outFloat As Single
+objOleTest.testout_methodFloat outFloat
+Debug.Print "out float " & CStr(outFloat)
+Dim outDouble As Double
+objOleTest.testout_methodDouble outDouble
+Debug.Print "out double " & CStr(outDouble)
+Dim outBool As Boolean
+objOleTest.testout_methodBool outBool
+Debug.Print "out bool " & CStr(outBool)
+Dim outInt As Integer
+objOleTest.testout_methodShort outInt
+Debug.Print "out short " & CStr(outInt)
+objOleTest.testout_methodUShort outInt
+Debug.Print "out unsignedshort " & CStr(outInt)
+Dim outLong As Long
+objOleTest.testout_methodLong outLong
+Debug.Print "out long " & CStr(outInt)
+objOleTest.testout_methodULong outLong
+Debug.Print "out unsigned long " & CStr(outInt)
+Dim outString As String
+objOleTest.testout_methodString outString
+Debug.Print "out string " & CStr(outString)
+Dim outChar As Integer
+objOleTest.testout_methodChar outChar
+Debug.Print "out char " & CStr(outChar)
+Dim outCharS As String
+objOleTest.testout_methodChar outCharS
+Debug.Print "out char (String) " & CStr(outCharS)
+objOleTest.testout_methodAny outString
+Debug.Print "out Any " & CStr(outString)
+
+'Out Parameter simple types (VARIANT var)
+Dim outVar As Variant
+objOleTest.testout_methodByte outVar
+Debug.Print "out Byte (VARIANT) " & CStr(outVar)
+objOleTest.testout_methodFloat outVar
+Debug.Print "out float (VARIANT) " & CStr(outVar)
+objOleTest.testout_methodDouble outVar
+Debug.Print "out double (VARIANT) " & CStr(outVar)
+objOleTest.testout_methodBool outVar
+Debug.Print "out bool (VARIANT) " & CStr(outVar)
+objOleTest.testout_methodShort outVar
+Debug.Print "out short (VARIANT) " & CStr(outVar)
+objOleTest.testout_methodUShort outVar
+Debug.Print "out unsigned short (VARIANT) " & CStr(outVar)
+objOleTest.testout_methodLong outVar
+Debug.Print "out long (VARIANT) " & CStr(outVar)
+objOleTest.testout_methodULong outVar
+Debug.Print "out unsigned long (VARIANT) " & CStr(outVar)
+objOleTest.testout_methodString outVar
+Debug.Print "out string (VARIANT) " & CStr(outVar)
+objOleTest.testout_methodChar outVar
+Debug.Print "out char (VARIANT) " & CStr(outVar)
+objOleTest.testout_methodAny outVar
+Debug.Print "out any (VARIANT) " & CStr(outVar)
+
+'In/Out simple types
+'============================================
+outByte = 10
+objOleTest.testinout_methodByte outByte
+Debug.Print "inout byte " & CStr(outByte)
+outFloat = 3.14
+objOleTest.testinout_methodFloat outFloat
+Debug.Print "inout float " & CStr(outFloat)
+outDouble = 4.14
+objOleTest.testinout_methodDouble outDouble
+Debug.Print "inout double " & CStr(outDouble)
+outBool = True
+objOleTest.testinout_methodBool outBool
+Debug.Print "inout bool " & CStr(outBool)
+outInt = 10
+objOleTest.testinout_methodShort outInt
+Debug.Print "inout short " & CStr(outInt)
+outInt = 20
+objOleTest.testinout_methodUShort outInt
+Debug.Print "inout unsignedshort " & CStr(outInt)
+outLong = 30
+objOleTest.testinout_methodLong outLong
+Debug.Print "inout long " & CStr(outLong)
+outLong = 40
+objOleTest.testinout_methodULong outLong
+Debug.Print "inout unsigned long " & CStr(outLong)
+outString = "this is an in string"
+objOleTest.testinout_methodString outString
+Debug.Print "inout string " & CStr(outString)
+'different Char conversions
+objOleTest.testout_methodChar outString
+Debug.Print "out char (in: String)" & CStr(outString)
+objOleTest.testout_methodChar outInt
+Debug.Print "out char (in: Int)" & CStr(outInt)
+'--
+outString = "this is another in out string"
+objOleTest.testout_methodAny outString
+Debug.Print "out Any " & CStr(outString)
+
+'Objects
+'
+'==========================================================
+' COM obj
+Dim retObj As Object
+'OleTest calls a disposing on the object
+Set retObj = objOleTest.in_methodInvocation(objEventListener)
+'The returned object should be objEventListener, test it
+' takes an IDispatch as Param ( EventObject).To provide a TypeMismatch
+'we put in another IDispatch
+objEventListener.disposing objEventListener
+
+' out param gives out the OleTestComponent
+objOleTest.testout_methodXInterface retObj
+outVar = Null
+retObj.testout_methodAny outVar
+Debug.Print "test out Interface " & CStr(outVar)
+'in out
+' in: UNO object, the same is expected as out param
+' the function expects OleTest as parameter and sets a value
+Dim objOleTest2 As Object
+Set objOleTest2 = objServiceManager.createInstance("oletest.OleTest")
+'Set a value
+objOleTest2.AttrAny2 = "VBString "
+objOleTest.testinout_methodXInterface2 objOleTest2
+tmpVar = Null
+tmpVar = objOleTest2.AttrAny2
+Debug.Print "in: Uno out: the same object // " & CStr(tmpVar)
+
+
+'create a struct
+Dim structClass As Object
+Set structClass = objCoreReflection.forName("oletest.SimpleStruct")
+Dim structInstance As Object
+structClass.CreateObject structInstance
+structInstance.message = "Now we are in VB"
+Debug.Print "struct out " & structInstance.message
+'put the struct into OleTest. The same struct will be returned with an added String
+Dim structRet As Object
+Set structRet = objOleTest.in_methodStruct(structInstance)
+Debug.Print "struct in - return " & structRet.message
+'inout later
+
+'Arrays
+'========================================
+Dim arrLong(2) As Long
+Dim arrObj(2) As Object
+Dim countvar As Long
+For countvar = 0 To 2
+ arrLong(countvar) = countvar + 10
+ Debug.Print countvar
+ Set arrObj(countvar) = CreateObject("VBasicEventListener.VBEventListener")
+Next
+
+'Arrays always contain VARIANTS
+Dim seq() As Variant
+seq = objOleTest.methodLong(arrLong)
+
+For countvar = 0 To 2
+ Debug.Print CStr(seq(countvar))
+Next
+seq = objOleTest.methodXInterface(arrObj)
+For countvar = 0 To 2
+ Dim tmp As Object
+ seq(countvar).disposing tmp
+Next
+
+'Get a sequence created in UNO, out param is Variant ( VT_BYREF|VT_VARIANT)
+Dim seqX As Variant
+
+objOleTest.testout_methodSequence seqX
+Dim key
+For Each key In seqX
+ Debug.Print CStr(seqX(key))
+Next
+'Get a sequence created in UNO, out param is array Variant ( VT_BYREF|VT_VARIANT|VT_ARRAY)
+Dim seqX2() As Variant
+objOleTest.testout_methodSequence seqX2
+
+For Each key In seqX2
+ Debug.Print CStr(seqX2(key))
+Next
+
+'pass it to UNO and get it back
+Dim seq7() As Variant
+seq7 = objOleTest.methodLong(seqX)
+Dim key2
+For Each key2 In seq7
+ Debug.Print CStr(seq7(key2))
+Next
+
+'in out Array
+' arrLong is Long Array
+Dim inoutVar(2) As Variant
+
+For countvar = 0 To 2
+ Debug.Print countvar
+ inoutVar(countvar) = countvar + 10
+Next
+
+objOleTest.testinout_methodSequence inoutVar
+Dim key5
+For Each key5 In inoutVar
+ Debug.Print CStr(key5)
+Next
+
+
+
+
+
+
+
+
+
+Dim var As Boolean
+var = True
+Debug.Print CStr(var)
+
+
+End Sub
diff --git a/extensions/test/ole/VisualBasic/Project1.vbp b/extensions/test/ole/VisualBasic/Project1.vbp
new file mode 100644
index 000000000000..07eeaa06511b
--- /dev/null
+++ b/extensions/test/ole/VisualBasic/Project1.vbp
@@ -0,0 +1,33 @@
+Type=Exe
+Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\..\..\WINNT\System32\stdole2.tlb#OLE Automation
+Module=Module1; Module1.bas
+Startup="Sub Main"
+HelpFile=""
+Command32=""
+Name="Project1"
+HelpContextID="0"
+CompatibleMode="0"
+MajorVer=1
+MinorVer=0
+RevisionVer=0
+AutoIncrementVer=0
+ServerSupportFiles=0
+VersionCompanyName="StarOffice"
+CompilationType=0
+OptimizationType=0
+FavorPentiumPro(tm)=0
+CodeViewDebugInfo=0
+NoAliasing=0
+BoundsCheck=0
+OverflowCheck=0
+FlPointCheck=0
+FDIVCheck=0
+UnroundedFP=0
+StartMode=0
+Unattended=0
+Retained=0
+ThreadPerObject=0
+MaxNumberOfThreads=1
+
+[MS Transaction Server]
+AutoRefresh=1
diff --git a/extensions/test/ole/VisualBasic/Project1.vbw b/extensions/test/ole/VisualBasic/Project1.vbw
new file mode 100644
index 000000000000..3d99943cbd3e
--- /dev/null
+++ b/extensions/test/ole/VisualBasic/Project1.vbw
@@ -0,0 +1 @@
+Module1 = 27, 27, 851, 658, Z
diff --git a/extensions/test/ole/cpnt/cpnt.cxx b/extensions/test/ole/cpnt/cpnt.cxx
index 16f2e4739d83..27d5dfd2072a 100644
--- a/extensions/test/ole/cpnt/cpnt.cxx
+++ b/extensions/test/ole/cpnt/cpnt.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: cpnt.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: jl $ $Date: 2001-03-23 11:58:31 $
+ * last change: $Author: jl $ $Date: 2001-12-03 13:56:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -70,9 +70,9 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/script/XInvocation.hpp>
#include <com/sun/star/reflection/XIdlReflection.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
-
-#include <cppuhelper/implbase5.hxx>
+#include <cppuhelper/implbase7.hxx>
#include <com/sun/star/uno/Reference.h>
#include <rtl/ustring>
#include <com/sun/star/uno/Reference.hxx>
@@ -83,7 +83,8 @@
#include <oletest/XSimple.hpp>
#include <oletest/XSimple2.hpp>
#include <oletest/XSimple3.hpp>
-
+#include <oletest/XTestInParameters.hpp>
+#include <oletest/XTestOutParameters.hpp>
#include <com/sun/star/beans/Property.hpp>
using namespace cppu;
using namespace osl;
@@ -101,8 +102,9 @@ using namespace com::sun::star::reflection;
#define KEY1 L"/oletest.OleTestImpl/UNO/SERVICES"
#define KEY2 L"oletest.OleTest"
-class OComponent : public WeakImplHelper5<
- XTestSequence, XTestStruct, XTestOther, XTestInterfaces, XSimple>
+class OComponent : public WeakImplHelper7<
+ XTestSequence, XTestStruct, XTestOther, XTestInterfaces,
+ XSimple, XTestOutParameters, XTestInParameters >
{
sal_Int32 m_arrayConstructor;
Reference<XMultiServiceFactory> m_rFactory;
@@ -126,13 +128,6 @@ public:
OComponent( const Reference<XMultiServiceFactory> & rFactory ) :
m_rFactory( rFactory ), m_arrayConstructor(0) {}
~OComponent();
-
-public: // refcounting
-// sal_Bool queryInterface( Uik aUik, XInterfaceRef & rOut );
-// void acquire() { OWeakObject::acquire(); }
-// void release() { OWeakObject::release(); }
-// void* getImplementation(Reflection *p) { return OWeakObject::getImplementation(p); }
-
public: // XTestSequence
virtual Sequence<sal_Int8> SAL_CALL methodByte(const Sequence< sal_Int8 >& aSeq) throw( RuntimeException );
virtual Sequence<float> SAL_CALL methodFloat(const Sequence< float >& aSeq) throw( RuntimeException );
@@ -211,6 +206,7 @@ public: // XTestSequence
virtual void SAL_CALL testinout_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException );
virtual void SAL_CALL testinout_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException );
virtual void SAL_CALL testinout_methodXInterface( Reference< XInvocation >& rOut ) throw(RuntimeException);
+ virtual void SAL_CALL testinout_methodXInterface2( Reference< XInterface > & rOut) throw( RuntimeException);
virtual Any SAL_CALL methodAnyTest1(const Any& rIn) throw( RuntimeException ) ;
virtual Any SAL_CALL getAttrAny2(void) throw( RuntimeException ) ;
virtual void SAL_CALL setAttrAny2(const Any& AttrAny2_) throw( RuntimeException ) ;
@@ -250,6 +246,22 @@ public: // XTestSequence
virtual void SAL_CALL out_methodMulParams2(sal_Int32& rout1, sal_Int32& rout2, OUString& rout3) throw( RuntimeException );
virtual void SAL_CALL out_methodMulParams3(const OUString& sin, OUString& sout) throw( RuntimeException );
+ // XTestInParameters
+ virtual sal_Int8 SAL_CALL in_methodByte( sal_Int8 rIn ) throw (RuntimeException);
+ virtual float SAL_CALL in_methodFloat( float rIn ) throw (RuntimeException);
+ virtual double SAL_CALL in_methodDouble( double rIn ) throw (RuntimeException);
+ virtual sal_Bool SAL_CALL in_methodBool( sal_Bool rIn ) throw (RuntimeException);
+ virtual sal_Int16 SAL_CALL in_methodShort( sal_Int16 rIn ) throw (RuntimeException);
+ virtual sal_uInt16 SAL_CALL in_methodUShort( sal_uInt16 rIn ) throw (RuntimeException);
+ virtual sal_Int32 SAL_CALL in_methodLong( sal_Int32 rIn ) throw (RuntimeException);
+ virtual sal_uInt32 SAL_CALL in_methodULong( sal_uInt32 rIn ) throw (RuntimeException);
+ virtual OUString SAL_CALL in_methodString( const OUString& rIn ) throw (RuntimeException);
+ virtual sal_Unicode SAL_CALL in_methodChar( sal_Unicode rIn ) throw (RuntimeException);
+ virtual Any SAL_CALL in_methodAny( const Any& rIn ) throw (RuntimeException);
+ virtual Reference<XInvocation > SAL_CALL in_methodInvocation( const Reference< XInvocation >& inv ) throw (RuntimeException);
+ virtual SimpleStruct SAL_CALL in_methodStruct( const SimpleStruct& aStruct ) throw (RuntimeException);
+ virtual void SAL_CALL in_methodAll( sal_Int8 b, float f, double d, sal_Bool boo, sal_Int16 sh, sal_uInt16 us, sal_Int32 l, sal_uInt32 ul, const OUString& s, sal_Unicode c, const Any& a, const Reference<XInvocation>& inv ) throw (RuntimeException);
+
// XTestInterfaces --------------------------------------------------------------------------
virtual void SAL_CALL testInterface( const Reference< XCallback >& xCallback, sal_Int32 mode ) throw(RuntimeException);
virtual void SAL_CALL testInterface2( const Reference< XSimple >& xSimple, sal_Int32 mode ) throw(RuntimeException);
@@ -696,10 +708,93 @@ void SAL_CALL OComponent::testout_methodXInterface( Reference< XInterface >& rOu
{
OUString string( L"Property Any");
m_any <<= string;
- rOut= (XInterface*) static_cast<XTestSequence*>(this);
+ rOut= Reference<XInterface> (static_cast<XTestSequence*>(this), UNO_QUERY);
+}
+
+// XTestInParameters ------------------------------------------------------------
+sal_Int8 SAL_CALL OComponent::in_methodByte( sal_Int8 rIn ) throw (RuntimeException)
+{
+ return rIn;
+}
+float SAL_CALL OComponent::in_methodFloat( float rIn ) throw (RuntimeException)
+{
+ return rIn;
+}
+double SAL_CALL OComponent::in_methodDouble( double rIn ) throw (RuntimeException)
+{
+ return rIn;
+}
+sal_Bool SAL_CALL OComponent::in_methodBool( sal_Bool rIn ) throw (RuntimeException)
+{
+ return rIn;
+}
+sal_Int16 SAL_CALL OComponent::in_methodShort( sal_Int16 rIn ) throw (RuntimeException)
+{
+ return rIn;
+}
+sal_uInt16 SAL_CALL OComponent::in_methodUShort( sal_uInt16 rIn ) throw (RuntimeException)
+{
+ return rIn;
+}
+sal_Int32 SAL_CALL OComponent::in_methodLong( sal_Int32 rIn ) throw (RuntimeException)
+{
+ return rIn;
+}
+sal_uInt32 SAL_CALL OComponent::in_methodULong( sal_uInt32 rIn ) throw (RuntimeException)
+{
+ return rIn;
+}
+OUString SAL_CALL OComponent::in_methodString( const OUString& rIn ) throw (RuntimeException)
+{
+ return rIn;
+}
+sal_Unicode SAL_CALL OComponent::in_methodChar( sal_Unicode rIn ) throw (RuntimeException)
+{
+ return rIn;
+}
+Any SAL_CALL OComponent::in_methodAny( const Any& rIn ) throw (RuntimeException)
+{
+ return rIn;
+}
+Reference<XInvocation > SAL_CALL OComponent::in_methodInvocation( const Reference< XInvocation >& inv )
+ throw (RuntimeException)
+{
+ //We expect the invocation results from a conversion of VBasicEventListener.VBEventListener
+//which implements XEventListener
+ // extensions/test/ole/EventListenerSample
+ EventObject event( Reference<XInterface>(static_cast<XTestInParameters*>(this),UNO_QUERY));
+ Any anyParam;
+ anyParam <<= event;
+ Sequence<Any> params( &anyParam, 1);
+ Sequence<sal_Int16> outIndex;
+ Sequence<Any> outParams;
+ try{
+ inv->invoke( OUString(RTL_CONSTASCII_USTRINGPARAM("disposing")),
+ params, outIndex, outParams);
+ }catch(IllegalArgumentException & iae) {
+ }
+ catch(CannotConvertException & cce) {
+ }
+ catch(InvocationTargetException& ite) {
+ }
+ return inv;
}
-// INOUT
+SimpleStruct SAL_CALL OComponent::in_methodStruct( const SimpleStruct& aStruct )
+ throw (RuntimeException)
+{
+ SimpleStruct& s= const_cast<SimpleStruct&>(aStruct);
+ s.message= s.message + OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "This string was set in OleTest"));
+ return aStruct;
+}
+void SAL_CALL OComponent::in_methodAll( sal_Int8 b, float f, double d, sal_Bool boo, sal_Int16 sh, sal_uInt16 us,
+ sal_Int32 l, sal_uInt32 ul, const OUString& s, sal_Unicode c,
+ const Any& a, const Reference<XInvocation>& inv ) throw (RuntimeException)
+{
+}
+
+// INOUT -----------------------------------------------------------------------------------
void SAL_CALL OComponent::testinout_methodByte(sal_Int8& rOut) throw( RuntimeException )
{
rOut += 1;
@@ -747,6 +842,7 @@ void SAL_CALL OComponent::testinout_methodAny(Any& rOut) throw( RuntimeException
}
void SAL_CALL OComponent::testinout_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException)
{
+ sal_Int32* arr= rOut.getArray();
for ( sal_Int32 i=0; i < rOut.getLength(); i++)
{
rOut.getArray()[i] += 1;
@@ -775,6 +871,25 @@ void SAL_CALL OComponent::testinout_methodXInterface( Reference< XInvocation >&
OUString string(L" this string was written in the UNO component to the inout pararmeter");
any <<= string;
rOut->setValue( OUString(L"value"), any);
+
+ any= rOut->getValue( OUString( L"value"));
+ any >>= _s;
+
+}
+
+void SAL_CALL OComponent::testinout_methodXInterface2( Reference< XInterface > & rOut) throw( RuntimeException)
+{
+ Reference<XTestSequence> xTest( rOut, UNO_QUERY);
+ if( xTest.is())
+ {
+ Any any= xTest->getAttrAny2();
+ OUString _s;
+ any >>= _s;
+ OUString string= _s + OUString((L" this string was written in the UNO component to the inout pararmeter"));
+ any <<= string;
+ xTest->setAttrAny2( any);
+ }
+
}
Any SAL_CALL OComponent::methodAnyTest1(const Any& rIn) throw( RuntimeException )
{
@@ -862,6 +977,7 @@ void SAL_CALL OComponent::out_methodByte(sal_Int8& rOut) throw( RuntimeException
{
rOut= 100;
}
+
void SAL_CALL OComponent::out_methodDouble(double& rOut) throw( RuntimeException )
{
rOut= 3.14;
diff --git a/extensions/test/ole/cpnt/makefile.mk b/extensions/test/ole/cpnt/makefile.mk
index 8e3e6a5835ef..5782ee146907 100644
--- a/extensions/test/ole/cpnt/makefile.mk
+++ b/extensions/test/ole/cpnt/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.2 $
+# $Revision: 1.3 $
#
-# last change: $Author: jl $ $Date: 2001-06-27 06:57:32 $
+# last change: $Author: jl $ $Date: 2001-12-03 13:57:38 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -93,11 +93,14 @@ UNOTYPES= oletest.XTestSequence oletest.XTestStruct \
oletest.XSimple \
oletest.XSimple2 \
oletest.XSimple3 \
+ oletest.XTestOutParameters \
+ oletest.XTestInParameters \
com.sun.star.beans.PropertyAttribute \
com.sun.star.uno.XAggregation \
com.sun.star.lang.XTypeProvider \
com.sun.star.lang.XMultiServiceFactory \
com.sun.star.lang.XSingleServiceFactory \
+ com.sun.star.lang.XEventListener \
com.sun.star.registry.XRegistryKey \
com.sun.star.script.XInvocation \
com.sun.star.reflection.XIdlReflection
diff --git a/extensions/test/ole/idl/oletest.idl b/extensions/test/ole/idl/oletest.idl
index c2f2ecab426f..4cbcd0b32612 100644
--- a/extensions/test/ole/idl/oletest.idl
+++ b/extensions/test/ole/idl/oletest.idl
@@ -2,9 +2,9 @@
*
* $RCSfile: oletest.idl,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: jl $ $Date: 2001-06-27 06:56:49 $
+ * last change: $Author: jl $ $Date: 2001-12-03 13:57:04 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -133,6 +133,7 @@ interface XTestSequence: com::sun::star::uno::XInterface
void testinout_methodSequence( [inout] sequence< long > rOut);
void testinout_methodSequence2( [inout] sequence < sequence< long > > rOut);
void testinout_methodXInterface( [inout] com::sun::star::script::XInvocation rOut);
+ void testinout_methodXInterface2( [inout] com::sun::star::uno::XInterface rOut);
any methodAnyTest1( [in] any rIn);
[attribute] any AttrAny2;
@@ -151,6 +152,7 @@ interface XTestStruct: com::sun::star::uno::XInterface
interface XTestOutParameters: com::sun::star::uno::XInterface
{
void out_methodByte( [out] byte rOut );
+ void out_methodFloat( [out] float rOut);
void out_methodDouble( [out] double rOut);
void out_methodBool( [out] boolean rOut);
void out_methodShort( [out] short rOut);
@@ -162,19 +164,38 @@ interface XTestOutParameters: com::sun::star::uno::XInterface
void out_methodAny ( [out] any rOut);
void out_methodSequence( [out] sequence< long > rOut);
void out_methodSequence2( [out] sequence < sequence< long > > rOut);
-
void out_methodMulParams1( [out] long rout1, [out] long rout2);
void out_methodMulParams2( [out] long rout1, [out] long rout2, [out] string rout3);
void out_methodMulParams3( [in] string sin, [out] string sout);
};
-
struct SimpleStruct
{
string message;
};
+interface XTestInParameters: com::sun::star::uno::XInterface
+{
+ byte in_methodByte( [in] byte rIn );
+ float in_methodFloat( [in] float rIn);
+ double in_methodDouble( [in] double rIn);
+ boolean in_methodBool( [in] boolean rIn);
+ short in_methodShort( [in] short rIn);
+ unsigned short in_methodUShort( [in] unsigned short rIn);
+ long in_methodLong( [in] long rIn);
+ unsigned long in_methodULong( [in] unsigned long rIn);
+ string in_methodString( [in] string rIn);
+ char in_methodChar( [in] char rIn);
+ any in_methodAny ( [in] any rIn);
+ com::sun::star::script::XInvocation in_methodInvocation( [in] com::sun::star::script::XInvocation inv);
+ SimpleStruct in_methodStruct( [in] SimpleStruct aStruct);
+ void in_methodAll( [in] byte b, [in] float f, [in] double d, [in] boolean bool, [in]short sh,
+ [in] unsigned short us, [in] long l, [in] unsigned long ul,
+ [in] string s, [in] char c, [in] any a, [in] com::sun::star::script::XInvocation inv);
+};
+
+
enum SimpleEnum
{
A,
@@ -285,7 +306,6 @@ interface XCallback: com::sun::star::uno::XInterface
};
-
interface XTestInterfaces: com::sun::star::uno::XInterface
{
// Any test