1 '*************************************************************************
3 ' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 ' Copyright 2008 by Sun Microsystems, Inc.
7 ' OpenOffice.org - a multi-platform office productivity suite
9 ' $RCSfile: cli_vb_testobj.vb,v $
13 ' This file is part of OpenOffice.org.
15 ' OpenOffice.org is free software: you can redistribute it and/or modify
16 ' it under the terms of the GNU Lesser General Public License version 3
17 ' only, as published by the Free Software Foundation.
19 ' OpenOffice.org is distributed in the hope that it will be useful,
20 ' but WITHOUT ANY WARRANTY; without even the implied warranty of
21 ' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ' GNU Lesser General Public License version 3 for more details
23 ' (a copy is included in the LICENSE file that accompanied this code).
25 ' You should have received a copy of the GNU Lesser General Public License
26 ' version 3 along with OpenOffice.org. If not, see
27 ' <http://www.openoffice.org/license.html>
28 ' for a copy of the LGPLv3 License.
30 '*************************************************************************
38 imports unoidl
.com
.sun
.star
.lang
39 imports unoidl
.com
.sun
.star
.uno
40 imports unoidl
.com
.sun
.star
.test
.bridge
41 imports System
.Windows
.Forms
42 imports System
.Diagnostics
43 imports System
.Reflection
47 Public Class VBBridgeTestObject
49 Implements XRecursiveCall
, XBridgeTest2
51 Private m_xContext
As XComponentContext
53 Public Sub New (xContext
As XComponentContext
)
58 Private m_bool
As Boolean
59 Private m_char
As Char
60 Private m_byte
As Byte
61 Private m_short
As Short
62 Private m_ushort
As UInt16
63 Private m_long
As Integer
64 Private m_ulong
As UInt32
65 Private m_hyper
As Long
66 Private m_uhyper
As UInt64
67 Private m_float
As Single
68 Private m_double
As Double
69 Private m_string
As String
70 Private m_xInterface
As Object
72 Private m_testEnum
As TestEnum
= TestEnum
.TEST
73 Private m_testElements() As TestElement
= New TestElement(){}
74 Private m_testDataElements
As TestDataElements
= New TestDataElements
75 Private m_nLastCallId
As Integer = 0
76 Private m_bFirstCall
As Boolean = True
77 Private m_bSequenceOfCallTestPassed
As Boolean = True
79 Private m_arBool() As Boolean
80 Private m_arChar() As Char
81 Private m_arByte() As Byte
82 Private m_arShort() As Short
83 Private m_arLong() As Integer
84 Private m_arHyper() As Long
85 Private m_arUShort() As UInt16
86 Private m_arULong() As UInt32
87 Private m_arUHyper() As UInt64
88 Private m_arString() As String
89 Private m_arFloat() As Single
90 Private m_arDouble() As Double
91 Private m_arEnum() As TestEnum
92 Private m_arObject() As Object
93 Private m_arLong2()() As Integer
94 Private m_arLong3()()() As Integer
95 Private m_arAny() As Any
97 Public Overridable
Sub setValues( _
98 bBool
As Boolean, aChar
As Char
, nByte
As Byte, nShort
As Short
, _
99 nUShort
As UInt16
, nLong
As Integer, nULong
As UInt32
, _
100 nHyper
As Long, nUHyper
As UInt64
, fFloat
As Single, _
101 fDouble
As Double, testEnum
As TestEnum
, str
As String, _
102 xInterface
As Object, any
As Any
, testElements() As TestElement
, _
103 testDataElements
As TestDataElements
) _
104 Implements XBridgeTest2
.setValues
106 ' Console.WriteLine( "##### " + GetType().FullName + ".setValues:" + any )
119 m_testEnum
= testEnum
121 m_xInterface
= xInterface
123 m_testElements
= testElements
124 m_testDataElements
= testDataElements
127 Public Overridable
Function setValues2( _
128 ByRef io_bool
As Boolean, ByRef io_char
As Char
, _
129 ByRef io_byte
As Byte, ByRef io_short
As Short
, _
130 ByRef io_ushort
As UInt16
, ByRef io_long
As Integer, _
131 ByRef io_ulong
As UInt32
, ByRef io_hyper
As Long, _
132 ByRef io_uhyper
As UInt64
, ByRef io_float
As Single, _
133 ByRef io_double
As Double, ByRef io_testEnum
As TestEnum
, _
134 ByRef io_string
As String, ByRef io_xInterface
As Object, _
135 ByRef io_any
As Any
, ByRef io_testElements() As TestElement
, _
136 ByRef io_testDataElements
As TestDataElements
) As TestDataElements _
137 Implements XBridgeTest2
.setValues2
140 'Console.WriteLine( "##### " + GetType().FullName + ".setValues2:" + io_any )
154 m_testEnum
= io_testEnum
156 m_xInterface
= io_xInterface
158 m_testElements
= DirectCast(io_testElements
.Clone(), TestElement())
159 m_testDataElements
= io_testDataElements
161 Dim temp
As TestElement
= io_testElements(0)
162 io_testElements(0) = io_testElements(1)
163 io_testElements(1) = temp
165 Return m_testDataElements
168 Public Overridable
Function getValues( _
169 ByRef o_bool
As Boolean, ByRef o_char
As Char
, _
170 ByRef o_byte
As Byte, ByRef o_short
As Short
, _
171 ByRef o_ushort
As UInt16
, ByRef o_long
As Integer, _
172 ByRef o_ulong
As UInt32
, ByRef o_hyper
As Long, _
173 ByRef o_uhyper
As UInt64
, ByRef o_float
As Single, _
174 ByRef o_double
As Double, ByRef o_testEnum
As TestEnum
, _
175 ByRef o_string
As String, ByRef o_xInterface
As Object, _
176 ByRef o_any
As Any
, ByRef o_testElements() As TestElement
, _
177 ByRef o_testDataElements
As TestDataElements
) As TestDataElements _
178 Implements XBridgeTest2
.getValues
180 'Console.WriteLine( "##### " + GetType().FullName + ".getValues" )
194 o_testEnum
= m_testEnum
196 o_xInterface
= m_xInterface
198 o_testElements
= m_testElements
199 o_testDataElements
= m_testDataElements
201 Return m_testDataElements
204 ' Attributes ---------------------------------------------------------
205 Public Overridable
Property Bool
As Boolean _
206 Implements XBridgeTest2
.Bool
210 Set (Value
As Boolean)
215 Public Overridable
Property [Byte] As Byte _
216 Implements XBridgeTest2
.Byte
225 Public Overridable
Property [Char
] As Char _
226 Implements XBridgeTest2
.Char
235 Public Overridable
Property [Short
] As Short _
236 Implements XBridgeTest2
.Short
245 Public Overridable
Property [UShort
] As UInt16 _
246 Implements XBridgeTest2
.UShort
250 Set (Value
As UInt16
)
255 Public Overridable
Property [Long] As Integer _
256 Implements XBridgeTest2
.Long
260 Set (Value
As Integer)
265 Public Overridable
Property [ULong
]() As UInt32 _
266 Implements XBridgeTest2
.ULong
270 Set (Value
As UInt32
)
275 Public Overridable
Property Hyper
As Long _
276 Implements XBridgeTest2
.Hyper
285 Public Overridable
Property UHyper
As UInt64 _
286 Implements XBridgeTest2
.UHyper
290 Set (Value
As UInt64
)
295 Public Overridable
Property Float
As Single _
296 Implements XBridgeTest2
.Float
300 Set (Value
As Single)
305 Public Overridable
Property [Double] As Double _
306 Implements XBridgeTest2
.Double
310 Set (Value
As Double)
315 Public Overridable
Property [Enum] As TestEnum _
316 Implements XBridgeTest2
.Enum
320 Set (Value
As TestEnum
)
325 Public Overridable
Property [String] As String _
326 Implements XBridgeTest2
.String
330 Set (Value
As String)
335 Public Overridable
Property [Interface
] As Object _
336 Implements XBridgeTest2
.Interface
340 Set (Value
As Object)
345 Public Overridable
Property Any
As uno
.Any _
346 Implements XBridgeTest2
.Any
349 ' Console.WriteLine( "##### " + GetType().FullName + ".Any" )
355 'Console.WriteLine( "##### " + GetType().FullName + ".Any:" + value )
361 Public Overridable
Property Sequence
As TestElement() _
362 Implements XBridgeTest2
.Sequence
364 Return m_testElements
366 Set (Value() As TestElement
)
367 m_testElements
= value
371 Public Overridable
Property Struct
As TestDataElements _
372 Implements XBridgeTest2
.Struct
374 Return m_testDataElements
376 Set (Value
As TestDataElements
)
377 m_testDataElements
= value
381 Public Overridable
Function transportAny(value
As Any
) As Any _
382 Implements XBridgeTest2
.transportAny
386 Public Overridable
Sub [call](nCallId
As Integer, nWaitMUSEC
As Integer) _
387 Implements XBridgeTest2
.call
389 Threading
.Thread
.Sleep(CType(nWaitMUSEC
/ 10000, Integer))
390 If m_bFirstCall
= True
393 m_bSequenceOfCallTestPassed
= m_bSequenceOfCallTestPassed
And (nCallId
> m_nLastCallId
)
395 m_nLastCallId
= nCallId
398 Public Overridable
Sub callOneway(nCallId
As Integer, nWaitMUSEC
As Integer) _
399 Implements XBridgeTest2
.callOneway
401 Threading
.Thread
.Sleep(CType(nWaitMUSEC
/ 10000, Integer))
402 m_bSequenceOfCallTestPassed
= m_bSequenceOfCallTestPassed
And (nCallId
> m_nLastCallId
)
403 m_nLastCallId
= nCallId
406 Public Overridable
Function sequenceOfCallTestPassed() As Boolean _
407 Implements XBridgeTest2
.sequenceOfCallTestPassed
408 Return m_bSequenceOfCallTestPassed
411 Public Overridable
Sub callRecursivly(xCall
As XRecursiveCall
, nToCall
As Integer) _
412 Implements XRecursiveCall
.callRecursivly
415 nToCall
= nToCall
- 1
416 xCall
.callRecursivly(Me , nToCall
)
421 Public Overridable
Sub startRecursiveCall(xCall
As XRecursiveCall
, nToCall
As Integer) _
422 Implements XBridgeTest2
.startRecursiveCall
425 nToCall
= nToCall
- 1
426 xCall
.callRecursivly(Me , nToCall
)
432 Public Overridable
Function raiseException( _
433 nArgumentPos
As Short
, rMsg
As String, xContext
As Object) As TestDataElements _
434 Implements XBridgeTest2
.raiseException
435 Throw
New IllegalArgumentException(rMsg
, xContext
, nArgumentPos
)
438 Public Overridable
Sub raiseRuntimeExceptionOneway(rMsg
As String , xContext
As Object) _
439 Implements XBridgeTest2
.raiseRuntimeExceptionOneway
440 Throw
New RuntimeException(rMsg
, xContext
)
443 Public Overridable
Property RuntimeException
As Integer _
444 Implements XBridgeTest2
.RuntimeException
446 Throw
New RuntimeException(m_string
, m_xInterface
)
448 Set (Value
As Integer)
449 Throw
New RuntimeException(m_string
, m_xInterface
)
454 Public Overridable
Function setDim2(val()() As Integer) As Integer()() _
455 Implements XBridgeTest2
.setDim2
460 Public Overridable
Function setDim3(val()()() As Integer) As Integer()()() _
461 Implements XBridgeTest2
.setDim3
466 Public Overridable
Function setSequenceAny(val() As Any
) As Any() _
467 Implements XBridgeTest2
.setSequenceAny
472 Public Overridable
Function setSequenceBool(val() As Boolean) As Boolean() _
473 Implements XBridgeTest2
.setSequenceBool
478 Public Overridable
Function setSequenceByte(val() As Byte) As Byte() _
479 Implements XBridgeTest2
.setSequenceByte
484 Public Overridable
Function setSequenceChar(val() As Char
) As Char() _
485 Implements XBridgeTest2
.setSequenceChar
490 Public Overridable
Function setSequenceShort(val() As Short
) As Short() _
491 Implements XBridgeTest2
.setSequenceShort
496 Public Overridable
Function setSequenceLong(val() As Integer) As Integer() _
497 Implements XBridgeTest2
.setSequenceLong
503 Public Overridable
Function setSequenceHyper(val() As Long) As Long() _
504 Implements XBridgeTest2
.setSequenceHyper
509 Public Overridable
Function setSequenceFloat(val() As Single) As Single() _
510 Implements XBridgeTest2
.setSequenceFloat
515 Public Overridable
Function setSequenceDouble(val() As Double) As Double() _
516 Implements XBridgeTest2
.setSequenceDouble
521 Public Overridable
Function setSequenceEnum(val() As TestEnum
) As TestEnum() _
522 Implements XBridgeTest2
.setSequenceEnum
527 Public Overridable
Function setSequenceUShort(val() As UInt16
) As UInt16() _
528 Implements XBridgeTest2
.setSequenceUShort
533 Public Overridable
Function setSequenceULong(val() As UInt32
) As UInt32() _
534 Implements XBridgeTest2
.setSequenceULong
539 Public Overridable
Function setSequenceUHyper(val() As UInt64
) As UInt64() _
540 Implements XBridgeTest2
.setSequenceUHyper
545 Public Overridable
Function setSequenceXInterface(val() As Object ) As Object() _
546 Implements XBridgeTest2
.setSequenceXInterface
551 Public Overridable
Function setSequenceString(val() As String) As String() _
552 Implements XBridgeTest2
.setSequenceString
557 Public Overridable
Function setSequenceStruct(val() As TestElement
) As TestElement() _
558 Implements XBridgeTest2
.setSequenceStruct
563 Public Overridable
Sub setSequencesInOut( _
564 ByRef aSeqBoolean() As Boolean, ByRef aSeqChar() As Char
, _
565 ByRef aSeqByte() As Byte, ByRef aSeqShort() As Short
, _
566 ByRef aSeqUShort() As UInt16
, ByRef aSeqLong() As Integer, _
567 ByRef aSeqULong() As UInt32
, ByRef aSeqHyper() As Long, _
568 ByRef aSeqUHyper() As UInt64
, ByRef aSeqFloat() As Single, _
569 ByRef aSeqDouble() As Double, ByRef aSeqTestEnum() As TestEnum
, _
570 ByRef aSeqString() As String, ByRef aSeqXInterface() As Object, _
571 ByRef aSeqAny() As Any
, ByRef aSeqDim2()() As Integer, _
572 ByRef aSeqDim3()()() As Integer) _
573 Implements XBridgeTest2
.setSequencesInOut
575 m_arBool
= aSeqBoolean
578 m_arShort
= aSeqShort
579 m_arUShort
= aSeqUShort
581 m_arULong
= aSeqULong
582 m_arHyper
= aSeqHyper
583 m_arUHyper
= aSeqUHyper
584 m_arFloat
= aSeqFloat
585 m_arDouble
= aSeqDouble
586 m_arEnum
= aSeqTestEnum
587 m_arString
= aSeqString
588 m_arObject
= aSeqXInterface
594 Public Overridable
Sub setSequencesOut( _
595 ByRef aSeqBoolean() As Boolean, ByRef aSeqChar() As Char
, _
596 ByRef aSeqByte() As Byte, ByRef aSeqShort() As Short
, _
597 ByRef aSeqUShort() As UInt16
, ByRef aSeqLong() As Integer, _
598 ByRef aSeqULong() As UInt32
, ByRef aSeqHyper() As Long, _
599 ByRef aSeqUHyper() As UInt64
, ByRef aSeqFloat() As Single, _
600 ByRef aSeqDouble() As Double, ByRef aSeqTestEnum() As TestEnum
, _
601 ByRef aSeqString() As String, ByRef aSeqXInterface() As Object, _
602 ByRef aSeqAny() As Any
, ByRef aSeqDim2()() As Integer, _
603 ByRef aSeqDim3()()() As Integer) _
604 Implements XBridgeTest2
.setSequencesOut
606 aSeqBoolean
= m_arBool
609 aSeqShort
= m_arShort
610 aSeqUShort
= m_arUShort
612 aSeqULong
= m_arULong
613 aSeqHyper
= m_arHyper
614 aSeqUHyper
= m_arUHyper
615 aSeqFloat
= m_arFloat
616 aSeqDouble
= m_arDouble
617 aSeqTestEnum
= m_arEnum
618 aSeqString
= m_arString
619 aSeqXInterface
= m_arObject