2 ' This file is part of the LibreOffice project.
4 ' This Source Code Form is subject to the terms of the Mozilla Public
5 ' License, v. 2.0. If a copy of the MPL was not distributed with this
6 ' file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 ' This file incorporates work covered by the following license notice:
10 ' Licensed to the Apache Software Foundation (ASF) under one or more
11 ' contributor license agreements. See the NOTICE file distributed
12 ' with this work for additional information regarding copyright
13 ' ownership. The ASF licenses this file to you under the Apache
14 ' License, Version 2.0 (the "License"); you may not use this file
15 ' except in compliance with the License. You may obtain a copy of
16 ' the License at http://www.apache.org/licenses/LICENSE-2.0 .
25 imports unoidl
.com
.sun
.star
.lang
26 imports unoidl
.com
.sun
.star
.uno
27 imports unoidl
.com
.sun
.star
.test
.bridge
28 imports System
.Windows
.Forms
29 imports System
.Diagnostics
30 imports System
.Reflection
34 Public Class VBBridgeTestObject
36 Implements XRecursiveCall
, XBridgeTest2
38 Private m_xContext
As XComponentContext
40 Public Sub New (xContext
As XComponentContext
)
45 Private m_bool
As Boolean
46 Private m_char
As Char
47 Private m_byte
As Byte
48 Private m_short
As Short
49 Private m_ushort
As UInt16
50 Private m_long
As Integer
51 Private m_ulong
As UInt32
52 Private m_hyper
As Long
53 Private m_uhyper
As UInt64
54 Private m_float
As Single
55 Private m_double
As Double
56 Private m_string
As String
57 Private m_xInterface
As Object
59 Private m_testEnum
As TestEnum
= TestEnum
.TEST
60 Private m_testElements() As TestElement
= New TestElement(){}
61 Private m_testDataElements
As TestDataElements
= New TestDataElements
62 Private m_nLastCallId
As Integer = 0
63 Private m_bFirstCall
As Boolean = True
64 Private m_bSequenceOfCallTestPassed
As Boolean = True
66 Private m_arBool() As Boolean
67 Private m_arChar() As Char
68 Private m_arByte() As Byte
69 Private m_arShort() As Short
70 Private m_arLong() As Integer
71 Private m_arHyper() As Long
72 Private m_arUShort() As UInt16
73 Private m_arULong() As UInt32
74 Private m_arUHyper() As UInt64
75 Private m_arString() As String
76 Private m_arFloat() As Single
77 Private m_arDouble() As Double
78 Private m_arEnum() As TestEnum
79 Private m_arObject() As Object
80 Private m_arLong2()() As Integer
81 Private m_arLong3()()() As Integer
82 Private m_arAny() As Any
84 Public Overridable
Sub setValues( _
85 bBool
As Boolean, aChar
As Char
, nByte
As Byte, nShort
As Short
, _
86 nUShort
As UInt16
, nLong
As Integer, nULong
As UInt32
, _
87 nHyper
As Long, nUHyper
As UInt64
, fFloat
As Single, _
88 fDouble
As Double, testEnum
As TestEnum
, str
As String, _
89 xInterface
As Object, any
As Any
, testElements() As TestElement
, _
90 testDataElements
As TestDataElements
) _
91 Implements XBridgeTest2
.setValues
93 ' Console.WriteLine( "##### " + GetType().FullName + ".setValues:" + any )
106 m_testEnum
= testEnum
108 m_xInterface
= xInterface
110 m_testElements
= testElements
111 m_testDataElements
= testDataElements
114 Public Overridable
Function setValues2( _
115 ByRef io_bool
As Boolean, ByRef io_char
As Char
, _
116 ByRef io_byte
As Byte, ByRef io_short
As Short
, _
117 ByRef io_ushort
As UInt16
, ByRef io_long
As Integer, _
118 ByRef io_ulong
As UInt32
, ByRef io_hyper
As Long, _
119 ByRef io_uhyper
As UInt64
, ByRef io_float
As Single, _
120 ByRef io_double
As Double, ByRef io_testEnum
As TestEnum
, _
121 ByRef io_string
As String, ByRef io_xInterface
As Object, _
122 ByRef io_any
As Any
, ByRef io_testElements() As TestElement
, _
123 ByRef io_testDataElements
As TestDataElements
) As TestDataElements _
124 Implements XBridgeTest2
.setValues2
127 'Console.WriteLine( "##### " + GetType().FullName + ".setValues2:" + io_any )
141 m_testEnum
= io_testEnum
143 m_xInterface
= io_xInterface
145 m_testElements
= DirectCast(io_testElements
.Clone(), TestElement())
146 m_testDataElements
= io_testDataElements
148 Dim temp
As TestElement
= io_testElements(0)
149 io_testElements(0) = io_testElements(1)
150 io_testElements(1) = temp
152 Return m_testDataElements
155 Public Overridable
Function getValues( _
156 ByRef o_bool
As Boolean, ByRef o_char
As Char
, _
157 ByRef o_byte
As Byte, ByRef o_short
As Short
, _
158 ByRef o_ushort
As UInt16
, ByRef o_long
As Integer, _
159 ByRef o_ulong
As UInt32
, ByRef o_hyper
As Long, _
160 ByRef o_uhyper
As UInt64
, ByRef o_float
As Single, _
161 ByRef o_double
As Double, ByRef o_testEnum
As TestEnum
, _
162 ByRef o_string
As String, ByRef o_xInterface
As Object, _
163 ByRef o_any
As Any
, ByRef o_testElements() As TestElement
, _
164 ByRef o_testDataElements
As TestDataElements
) As TestDataElements _
165 Implements XBridgeTest2
.getValues
167 'Console.WriteLine( "##### " + GetType().FullName + ".getValues" )
181 o_testEnum
= m_testEnum
183 o_xInterface
= m_xInterface
185 o_testElements
= m_testElements
186 o_testDataElements
= m_testDataElements
188 Return m_testDataElements
191 ' Attributes ---------------------------------------------------------
192 Public Overridable
Property Bool
As Boolean _
193 Implements XBridgeTest2
.Bool
197 Set (Value
As Boolean)
202 Public Overridable
Property [Byte] As Byte _
203 Implements XBridgeTest2
.Byte
212 Public Overridable
Property [Char
] As Char _
213 Implements XBridgeTest2
.Char
222 Public Overridable
Property [Short
] As Short _
223 Implements XBridgeTest2
.Short
232 Public Overridable
Property [UShort
] As UInt16 _
233 Implements XBridgeTest2
.UShort
237 Set (Value
As UInt16
)
242 Public Overridable
Property [Long] As Integer _
243 Implements XBridgeTest2
.Long
247 Set (Value
As Integer)
252 Public Overridable
Property [ULong
]() As UInt32 _
253 Implements XBridgeTest2
.ULong
257 Set (Value
As UInt32
)
262 Public Overridable
Property Hyper
As Long _
263 Implements XBridgeTest2
.Hyper
272 Public Overridable
Property UHyper
As UInt64 _
273 Implements XBridgeTest2
.UHyper
277 Set (Value
As UInt64
)
282 Public Overridable
Property Float
As Single _
283 Implements XBridgeTest2
.Float
287 Set (Value
As Single)
292 Public Overridable
Property [Double] As Double _
293 Implements XBridgeTest2
.Double
297 Set (Value
As Double)
302 Public Overridable
Property [Enum] As TestEnum _
303 Implements XBridgeTest2
.Enum
307 Set (Value
As TestEnum
)
312 Public Overridable
Property [String] As String _
313 Implements XBridgeTest2
.String
317 Set (Value
As String)
322 Public Overridable
Property [Interface
] As Object _
323 Implements XBridgeTest2
.Interface
327 Set (Value
As Object)
332 Public Overridable
Property Any
As uno
.Any _
333 Implements XBridgeTest2
.Any
336 ' Console.WriteLine( "##### " + GetType().FullName + ".Any" )
342 'Console.WriteLine( "##### " + GetType().FullName + ".Any:" + value )
348 Public Overridable
Property Sequence
As TestElement() _
349 Implements XBridgeTest2
.Sequence
351 Return m_testElements
353 Set (Value() As TestElement
)
354 m_testElements
= value
358 Public Overridable
Property Struct
As TestDataElements _
359 Implements XBridgeTest2
.Struct
361 Return m_testDataElements
363 Set (Value
As TestDataElements
)
364 m_testDataElements
= value
368 Public Overridable
Function transportAny(value
As Any
) As Any _
369 Implements XBridgeTest2
.transportAny
373 Public Overridable
Sub [call](nCallId
As Integer, nWaitMUSEC
As Integer) _
374 Implements XBridgeTest2
.call
376 Threading
.Thread
.Sleep(CType(nWaitMUSEC
/ 10000, Integer))
377 If m_bFirstCall
= True
380 m_bSequenceOfCallTestPassed
= m_bSequenceOfCallTestPassed
And (nCallId
> m_nLastCallId
)
382 m_nLastCallId
= nCallId
385 Public Overridable
Sub callOneway(nCallId
As Integer, nWaitMUSEC
As Integer) _
386 Implements XBridgeTest2
.callOneway
388 Threading
.Thread
.Sleep(CType(nWaitMUSEC
/ 10000, Integer))
389 m_bSequenceOfCallTestPassed
= m_bSequenceOfCallTestPassed
And (nCallId
> m_nLastCallId
)
390 m_nLastCallId
= nCallId
393 Public Overridable
Function sequenceOfCallTestPassed() As Boolean _
394 Implements XBridgeTest2
.sequenceOfCallTestPassed
395 Return m_bSequenceOfCallTestPassed
398 Public Overridable
Sub callRecursivly(xCall
As XRecursiveCall
, nToCall
As Integer) _
399 Implements XRecursiveCall
.callRecursivly
402 nToCall
= nToCall
- 1
403 xCall
.callRecursivly(Me , nToCall
)
408 Public Overridable
Sub startRecursiveCall(xCall
As XRecursiveCall
, nToCall
As Integer) _
409 Implements XBridgeTest2
.startRecursiveCall
412 nToCall
= nToCall
- 1
413 xCall
.callRecursivly(Me , nToCall
)
419 Public Overridable
Function raiseException( _
420 nArgumentPos
As Short
, rMsg
As String, xContext
As Object) As TestDataElements _
421 Implements XBridgeTest2
.raiseException
422 Throw
New IllegalArgumentException(rMsg
, xContext
, nArgumentPos
)
425 Public Overridable
Sub raiseRuntimeExceptionOneway(rMsg
As String , xContext
As Object) _
426 Implements XBridgeTest2
.raiseRuntimeExceptionOneway
427 Throw
New RuntimeException(rMsg
, xContext
)
430 Public Overridable
Property RuntimeException
As Integer _
431 Implements XBridgeTest2
.RuntimeException
433 Throw
New RuntimeException(m_string
, m_xInterface
)
435 Set (Value
As Integer)
436 Throw
New RuntimeException(m_string
, m_xInterface
)
441 Public Overridable
Function setDim2(val()() As Integer) As Integer()() _
442 Implements XBridgeTest2
.setDim2
447 Public Overridable
Function setDim3(val()()() As Integer) As Integer()()() _
448 Implements XBridgeTest2
.setDim3
453 Public Overridable
Function setSequenceAny(val() As Any
) As Any() _
454 Implements XBridgeTest2
.setSequenceAny
459 Public Overridable
Function setSequenceBool(val() As Boolean) As Boolean() _
460 Implements XBridgeTest2
.setSequenceBool
465 Public Overridable
Function setSequenceByte(val() As Byte) As Byte() _
466 Implements XBridgeTest2
.setSequenceByte
471 Public Overridable
Function setSequenceChar(val() As Char
) As Char() _
472 Implements XBridgeTest2
.setSequenceChar
477 Public Overridable
Function setSequenceShort(val() As Short
) As Short() _
478 Implements XBridgeTest2
.setSequenceShort
483 Public Overridable
Function setSequenceLong(val() As Integer) As Integer() _
484 Implements XBridgeTest2
.setSequenceLong
490 Public Overridable
Function setSequenceHyper(val() As Long) As Long() _
491 Implements XBridgeTest2
.setSequenceHyper
496 Public Overridable
Function setSequenceFloat(val() As Single) As Single() _
497 Implements XBridgeTest2
.setSequenceFloat
502 Public Overridable
Function setSequenceDouble(val() As Double) As Double() _
503 Implements XBridgeTest2
.setSequenceDouble
508 Public Overridable
Function setSequenceEnum(val() As TestEnum
) As TestEnum() _
509 Implements XBridgeTest2
.setSequenceEnum
514 Public Overridable
Function setSequenceUShort(val() As UInt16
) As UInt16() _
515 Implements XBridgeTest2
.setSequenceUShort
520 Public Overridable
Function setSequenceULong(val() As UInt32
) As UInt32() _
521 Implements XBridgeTest2
.setSequenceULong
526 Public Overridable
Function setSequenceUHyper(val() As UInt64
) As UInt64() _
527 Implements XBridgeTest2
.setSequenceUHyper
532 Public Overridable
Function setSequenceXInterface(val() As Object ) As Object() _
533 Implements XBridgeTest2
.setSequenceXInterface
538 Public Overridable
Function setSequenceString(val() As String) As String() _
539 Implements XBridgeTest2
.setSequenceString
544 Public Overridable
Function setSequenceStruct(val() As TestElement
) As TestElement() _
545 Implements XBridgeTest2
.setSequenceStruct
550 Public Overridable
Sub setSequencesInOut( _
551 ByRef aSeqBoolean() As Boolean, ByRef aSeqChar() As Char
, _
552 ByRef aSeqByte() As Byte, ByRef aSeqShort() As Short
, _
553 ByRef aSeqUShort() As UInt16
, ByRef aSeqLong() As Integer, _
554 ByRef aSeqULong() As UInt32
, ByRef aSeqHyper() As Long, _
555 ByRef aSeqUHyper() As UInt64
, ByRef aSeqFloat() As Single, _
556 ByRef aSeqDouble() As Double, ByRef aSeqTestEnum() As TestEnum
, _
557 ByRef aSeqString() As String, ByRef aSeqXInterface() As Object, _
558 ByRef aSeqAny() As Any
, ByRef aSeqDim2()() As Integer, _
559 ByRef aSeqDim3()()() As Integer) _
560 Implements XBridgeTest2
.setSequencesInOut
562 m_arBool
= aSeqBoolean
565 m_arShort
= aSeqShort
566 m_arUShort
= aSeqUShort
568 m_arULong
= aSeqULong
569 m_arHyper
= aSeqHyper
570 m_arUHyper
= aSeqUHyper
571 m_arFloat
= aSeqFloat
572 m_arDouble
= aSeqDouble
573 m_arEnum
= aSeqTestEnum
574 m_arString
= aSeqString
575 m_arObject
= aSeqXInterface
581 Public Overridable
Sub setSequencesOut( _
582 ByRef aSeqBoolean() As Boolean, ByRef aSeqChar() As Char
, _
583 ByRef aSeqByte() As Byte, ByRef aSeqShort() As Short
, _
584 ByRef aSeqUShort() As UInt16
, ByRef aSeqLong() As Integer, _
585 ByRef aSeqULong() As UInt32
, ByRef aSeqHyper() As Long, _
586 ByRef aSeqUHyper() As UInt64
, ByRef aSeqFloat() As Single, _
587 ByRef aSeqDouble() As Double, ByRef aSeqTestEnum() As TestEnum
, _
588 ByRef aSeqString() As String, ByRef aSeqXInterface() As Object, _
589 ByRef aSeqAny() As Any
, ByRef aSeqDim2()() As Integer, _
590 ByRef aSeqDim3()()() As Integer) _
591 Implements XBridgeTest2
.setSequencesOut
593 aSeqBoolean
= m_arBool
596 aSeqShort
= m_arShort
597 aSeqUShort
= m_arUShort
599 aSeqULong
= m_arULong
600 aSeqHyper
= m_arHyper
601 aSeqUHyper
= m_arUHyper
602 aSeqFloat
= m_arFloat
603 aSeqDouble
= m_arDouble
604 aSeqTestEnum
= m_arEnum
605 aSeqString
= m_arString
606 aSeqXInterface
= m_arObject