1 '*************************************************************************
3 ' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 ' Copyright 2000, 2010 Oracle and/or its affiliates.
7 ' OpenOffice.org - a multi-platform office productivity suite
9 ' This file is part of OpenOffice.org.
11 ' OpenOffice.org is free software: you can redistribute it and/or modify
12 ' it under the terms of the GNU Lesser General Public License version 3
13 ' only, as published by the Free Software Foundation.
15 ' OpenOffice.org is distributed in the hope that it will be useful,
16 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ' GNU Lesser General Public License version 3 for more details
19 ' (a copy is included in the LICENSE file that accompanied this code).
21 ' You should have received a copy of the GNU Lesser General Public License
22 ' version 3 along with OpenOffice.org. If not, see
23 ' <http://www.openoffice.org/license.html>
24 ' for a copy of the LGPLv3 License.
26 '*************************************************************************
34 imports unoidl
.com
.sun
.star
.lang
35 imports unoidl
.com
.sun
.star
.uno
36 imports unoidl
.com
.sun
.star
.test
.bridge
37 imports System
.Windows
.Forms
38 imports System
.Diagnostics
39 imports System
.Reflection
43 Public Class VBBridgeTestObject
45 Implements XRecursiveCall
, XBridgeTest2
47 Private m_xContext
As XComponentContext
49 Public Sub New (xContext
As XComponentContext
)
54 Private m_bool
As Boolean
55 Private m_char
As Char
56 Private m_byte
As Byte
57 Private m_short
As Short
58 Private m_ushort
As UInt16
59 Private m_long
As Integer
60 Private m_ulong
As UInt32
61 Private m_hyper
As Long
62 Private m_uhyper
As UInt64
63 Private m_float
As Single
64 Private m_double
As Double
65 Private m_string
As String
66 Private m_xInterface
As Object
68 Private m_testEnum
As TestEnum
= TestEnum
.TEST
69 Private m_testElements() As TestElement
= New TestElement(){}
70 Private m_testDataElements
As TestDataElements
= New TestDataElements
71 Private m_nLastCallId
As Integer = 0
72 Private m_bFirstCall
As Boolean = True
73 Private m_bSequenceOfCallTestPassed
As Boolean = True
75 Private m_arBool() As Boolean
76 Private m_arChar() As Char
77 Private m_arByte() As Byte
78 Private m_arShort() As Short
79 Private m_arLong() As Integer
80 Private m_arHyper() As Long
81 Private m_arUShort() As UInt16
82 Private m_arULong() As UInt32
83 Private m_arUHyper() As UInt64
84 Private m_arString() As String
85 Private m_arFloat() As Single
86 Private m_arDouble() As Double
87 Private m_arEnum() As TestEnum
88 Private m_arObject() As Object
89 Private m_arLong2()() As Integer
90 Private m_arLong3()()() As Integer
91 Private m_arAny() As Any
93 Public Overridable
Sub setValues( _
94 bBool
As Boolean, aChar
As Char
, nByte
As Byte, nShort
As Short
, _
95 nUShort
As UInt16
, nLong
As Integer, nULong
As UInt32
, _
96 nHyper
As Long, nUHyper
As UInt64
, fFloat
As Single, _
97 fDouble
As Double, testEnum
As TestEnum
, str
As String, _
98 xInterface
As Object, any
As Any
, testElements() As TestElement
, _
99 testDataElements
As TestDataElements
) _
100 Implements XBridgeTest2
.setValues
102 ' Console.WriteLine( "##### " + GetType().FullName + ".setValues:" + any )
115 m_testEnum
= testEnum
117 m_xInterface
= xInterface
119 m_testElements
= testElements
120 m_testDataElements
= testDataElements
123 Public Overridable
Function setValues2( _
124 ByRef io_bool
As Boolean, ByRef io_char
As Char
, _
125 ByRef io_byte
As Byte, ByRef io_short
As Short
, _
126 ByRef io_ushort
As UInt16
, ByRef io_long
As Integer, _
127 ByRef io_ulong
As UInt32
, ByRef io_hyper
As Long, _
128 ByRef io_uhyper
As UInt64
, ByRef io_float
As Single, _
129 ByRef io_double
As Double, ByRef io_testEnum
As TestEnum
, _
130 ByRef io_string
As String, ByRef io_xInterface
As Object, _
131 ByRef io_any
As Any
, ByRef io_testElements() As TestElement
, _
132 ByRef io_testDataElements
As TestDataElements
) As TestDataElements _
133 Implements XBridgeTest2
.setValues2
136 'Console.WriteLine( "##### " + GetType().FullName + ".setValues2:" + io_any )
150 m_testEnum
= io_testEnum
152 m_xInterface
= io_xInterface
154 m_testElements
= DirectCast(io_testElements
.Clone(), TestElement())
155 m_testDataElements
= io_testDataElements
157 Dim temp
As TestElement
= io_testElements(0)
158 io_testElements(0) = io_testElements(1)
159 io_testElements(1) = temp
161 Return m_testDataElements
164 Public Overridable
Function getValues( _
165 ByRef o_bool
As Boolean, ByRef o_char
As Char
, _
166 ByRef o_byte
As Byte, ByRef o_short
As Short
, _
167 ByRef o_ushort
As UInt16
, ByRef o_long
As Integer, _
168 ByRef o_ulong
As UInt32
, ByRef o_hyper
As Long, _
169 ByRef o_uhyper
As UInt64
, ByRef o_float
As Single, _
170 ByRef o_double
As Double, ByRef o_testEnum
As TestEnum
, _
171 ByRef o_string
As String, ByRef o_xInterface
As Object, _
172 ByRef o_any
As Any
, ByRef o_testElements() As TestElement
, _
173 ByRef o_testDataElements
As TestDataElements
) As TestDataElements _
174 Implements XBridgeTest2
.getValues
176 'Console.WriteLine( "##### " + GetType().FullName + ".getValues" )
190 o_testEnum
= m_testEnum
192 o_xInterface
= m_xInterface
194 o_testElements
= m_testElements
195 o_testDataElements
= m_testDataElements
197 Return m_testDataElements
200 ' Attributes ---------------------------------------------------------
201 Public Overridable
Property Bool
As Boolean _
202 Implements XBridgeTest2
.Bool
206 Set (Value
As Boolean)
211 Public Overridable
Property [Byte] As Byte _
212 Implements XBridgeTest2
.Byte
221 Public Overridable
Property [Char
] As Char _
222 Implements XBridgeTest2
.Char
231 Public Overridable
Property [Short
] As Short _
232 Implements XBridgeTest2
.Short
241 Public Overridable
Property [UShort
] As UInt16 _
242 Implements XBridgeTest2
.UShort
246 Set (Value
As UInt16
)
251 Public Overridable
Property [Long] As Integer _
252 Implements XBridgeTest2
.Long
256 Set (Value
As Integer)
261 Public Overridable
Property [ULong
]() As UInt32 _
262 Implements XBridgeTest2
.ULong
266 Set (Value
As UInt32
)
271 Public Overridable
Property Hyper
As Long _
272 Implements XBridgeTest2
.Hyper
281 Public Overridable
Property UHyper
As UInt64 _
282 Implements XBridgeTest2
.UHyper
286 Set (Value
As UInt64
)
291 Public Overridable
Property Float
As Single _
292 Implements XBridgeTest2
.Float
296 Set (Value
As Single)
301 Public Overridable
Property [Double] As Double _
302 Implements XBridgeTest2
.Double
306 Set (Value
As Double)
311 Public Overridable
Property [Enum] As TestEnum _
312 Implements XBridgeTest2
.Enum
316 Set (Value
As TestEnum
)
321 Public Overridable
Property [String] As String _
322 Implements XBridgeTest2
.String
326 Set (Value
As String)
331 Public Overridable
Property [Interface
] As Object _
332 Implements XBridgeTest2
.Interface
336 Set (Value
As Object)
341 Public Overridable
Property Any
As uno
.Any _
342 Implements XBridgeTest2
.Any
345 ' Console.WriteLine( "##### " + GetType().FullName + ".Any" )
351 'Console.WriteLine( "##### " + GetType().FullName + ".Any:" + value )
357 Public Overridable
Property Sequence
As TestElement() _
358 Implements XBridgeTest2
.Sequence
360 Return m_testElements
362 Set (Value() As TestElement
)
363 m_testElements
= value
367 Public Overridable
Property Struct
As TestDataElements _
368 Implements XBridgeTest2
.Struct
370 Return m_testDataElements
372 Set (Value
As TestDataElements
)
373 m_testDataElements
= value
377 Public Overridable
Function transportAny(value
As Any
) As Any _
378 Implements XBridgeTest2
.transportAny
382 Public Overridable
Sub [call](nCallId
As Integer, nWaitMUSEC
As Integer) _
383 Implements XBridgeTest2
.call
385 Threading
.Thread
.Sleep(CType(nWaitMUSEC
/ 10000, Integer))
386 If m_bFirstCall
= True
389 m_bSequenceOfCallTestPassed
= m_bSequenceOfCallTestPassed
And (nCallId
> m_nLastCallId
)
391 m_nLastCallId
= nCallId
394 Public Overridable
Sub callOneway(nCallId
As Integer, nWaitMUSEC
As Integer) _
395 Implements XBridgeTest2
.callOneway
397 Threading
.Thread
.Sleep(CType(nWaitMUSEC
/ 10000, Integer))
398 m_bSequenceOfCallTestPassed
= m_bSequenceOfCallTestPassed
And (nCallId
> m_nLastCallId
)
399 m_nLastCallId
= nCallId
402 Public Overridable
Function sequenceOfCallTestPassed() As Boolean _
403 Implements XBridgeTest2
.sequenceOfCallTestPassed
404 Return m_bSequenceOfCallTestPassed
407 Public Overridable
Sub callRecursivly(xCall
As XRecursiveCall
, nToCall
As Integer) _
408 Implements XRecursiveCall
.callRecursivly
411 nToCall
= nToCall
- 1
412 xCall
.callRecursivly(Me , nToCall
)
417 Public Overridable
Sub startRecursiveCall(xCall
As XRecursiveCall
, nToCall
As Integer) _
418 Implements XBridgeTest2
.startRecursiveCall
421 nToCall
= nToCall
- 1
422 xCall
.callRecursivly(Me , nToCall
)
428 Public Overridable
Function raiseException( _
429 nArgumentPos
As Short
, rMsg
As String, xContext
As Object) As TestDataElements _
430 Implements XBridgeTest2
.raiseException
431 Throw
New IllegalArgumentException(rMsg
, xContext
, nArgumentPos
)
434 Public Overridable
Sub raiseRuntimeExceptionOneway(rMsg
As String , xContext
As Object) _
435 Implements XBridgeTest2
.raiseRuntimeExceptionOneway
436 Throw
New RuntimeException(rMsg
, xContext
)
439 Public Overridable
Property RuntimeException
As Integer _
440 Implements XBridgeTest2
.RuntimeException
442 Throw
New RuntimeException(m_string
, m_xInterface
)
444 Set (Value
As Integer)
445 Throw
New RuntimeException(m_string
, m_xInterface
)
450 Public Overridable
Function setDim2(val()() As Integer) As Integer()() _
451 Implements XBridgeTest2
.setDim2
456 Public Overridable
Function setDim3(val()()() As Integer) As Integer()()() _
457 Implements XBridgeTest2
.setDim3
462 Public Overridable
Function setSequenceAny(val() As Any
) As Any() _
463 Implements XBridgeTest2
.setSequenceAny
468 Public Overridable
Function setSequenceBool(val() As Boolean) As Boolean() _
469 Implements XBridgeTest2
.setSequenceBool
474 Public Overridable
Function setSequenceByte(val() As Byte) As Byte() _
475 Implements XBridgeTest2
.setSequenceByte
480 Public Overridable
Function setSequenceChar(val() As Char
) As Char() _
481 Implements XBridgeTest2
.setSequenceChar
486 Public Overridable
Function setSequenceShort(val() As Short
) As Short() _
487 Implements XBridgeTest2
.setSequenceShort
492 Public Overridable
Function setSequenceLong(val() As Integer) As Integer() _
493 Implements XBridgeTest2
.setSequenceLong
499 Public Overridable
Function setSequenceHyper(val() As Long) As Long() _
500 Implements XBridgeTest2
.setSequenceHyper
505 Public Overridable
Function setSequenceFloat(val() As Single) As Single() _
506 Implements XBridgeTest2
.setSequenceFloat
511 Public Overridable
Function setSequenceDouble(val() As Double) As Double() _
512 Implements XBridgeTest2
.setSequenceDouble
517 Public Overridable
Function setSequenceEnum(val() As TestEnum
) As TestEnum() _
518 Implements XBridgeTest2
.setSequenceEnum
523 Public Overridable
Function setSequenceUShort(val() As UInt16
) As UInt16() _
524 Implements XBridgeTest2
.setSequenceUShort
529 Public Overridable
Function setSequenceULong(val() As UInt32
) As UInt32() _
530 Implements XBridgeTest2
.setSequenceULong
535 Public Overridable
Function setSequenceUHyper(val() As UInt64
) As UInt64() _
536 Implements XBridgeTest2
.setSequenceUHyper
541 Public Overridable
Function setSequenceXInterface(val() As Object ) As Object() _
542 Implements XBridgeTest2
.setSequenceXInterface
547 Public Overridable
Function setSequenceString(val() As String) As String() _
548 Implements XBridgeTest2
.setSequenceString
553 Public Overridable
Function setSequenceStruct(val() As TestElement
) As TestElement() _
554 Implements XBridgeTest2
.setSequenceStruct
559 Public Overridable
Sub setSequencesInOut( _
560 ByRef aSeqBoolean() As Boolean, ByRef aSeqChar() As Char
, _
561 ByRef aSeqByte() As Byte, ByRef aSeqShort() As Short
, _
562 ByRef aSeqUShort() As UInt16
, ByRef aSeqLong() As Integer, _
563 ByRef aSeqULong() As UInt32
, ByRef aSeqHyper() As Long, _
564 ByRef aSeqUHyper() As UInt64
, ByRef aSeqFloat() As Single, _
565 ByRef aSeqDouble() As Double, ByRef aSeqTestEnum() As TestEnum
, _
566 ByRef aSeqString() As String, ByRef aSeqXInterface() As Object, _
567 ByRef aSeqAny() As Any
, ByRef aSeqDim2()() As Integer, _
568 ByRef aSeqDim3()()() As Integer) _
569 Implements XBridgeTest2
.setSequencesInOut
571 m_arBool
= aSeqBoolean
574 m_arShort
= aSeqShort
575 m_arUShort
= aSeqUShort
577 m_arULong
= aSeqULong
578 m_arHyper
= aSeqHyper
579 m_arUHyper
= aSeqUHyper
580 m_arFloat
= aSeqFloat
581 m_arDouble
= aSeqDouble
582 m_arEnum
= aSeqTestEnum
583 m_arString
= aSeqString
584 m_arObject
= aSeqXInterface
590 Public Overridable
Sub setSequencesOut( _
591 ByRef aSeqBoolean() As Boolean, ByRef aSeqChar() As Char
, _
592 ByRef aSeqByte() As Byte, ByRef aSeqShort() As Short
, _
593 ByRef aSeqUShort() As UInt16
, ByRef aSeqLong() As Integer, _
594 ByRef aSeqULong() As UInt32
, ByRef aSeqHyper() As Long, _
595 ByRef aSeqUHyper() As UInt64
, ByRef aSeqFloat() As Single, _
596 ByRef aSeqDouble() As Double, ByRef aSeqTestEnum() As TestEnum
, _
597 ByRef aSeqString() As String, ByRef aSeqXInterface() As Object, _
598 ByRef aSeqAny() As Any
, ByRef aSeqDim2()() As Integer, _
599 ByRef aSeqDim3()()() As Integer) _
600 Implements XBridgeTest2
.setSequencesOut
602 aSeqBoolean
= m_arBool
605 aSeqShort
= m_arShort
606 aSeqUShort
= m_arUShort
608 aSeqULong
= m_arULong
609 aSeqHyper
= m_arHyper
610 aSeqUHyper
= m_arUHyper
611 aSeqFloat
= m_arFloat
612 aSeqDouble
= m_arDouble
613 aSeqTestEnum
= m_arEnum
614 aSeqString
= m_arString
615 aSeqXInterface
= m_arObject