1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23#ifndef __com_sun_star_test_bridge_XBridge_idl__
24#define __com_sun_star_test_bridge_XBridge_idl__
25
26#ifndef __com_sun_star_uno_XInterface_idl__
27#include <com/sun/star/uno/XInterface.idl>
28#endif
29
30#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
31#include <com/sun/star/lang/IllegalArgumentException.idl>
32#endif
33
34module com
35{
36module sun
37{
38module star
39{
40module test
41{
42module bridge
43{
44
45published enum TestEnum
46{
47	TEST,
48	ONE,
49	TWO,
50	CHECK,
51	LOLA,
52	PALOO,
53	ZA
54};
55
56/**
57 * simple types
58 */
59published struct TestSimple
60{
61	boolean					   Bool;
62	char					   Char;
63	byte					   Byte;
64	short					   Short;
65	unsigned short			   UShort;
66	long					   Long;
67	unsigned long			   ULong;
68	hyper					   Hyper;
69	unsigned hyper			   UHyper;
70	float					   Float;
71	double					   Double;
72	TestEnum				   Enum;
73};
74/**
75 * complex types adding string, inteface, any
76 */
77published struct TestElement : TestSimple
78{
79	string					   String;
80	com::sun::star::uno::XInterface   Interface;
81	any						   Any;
82};
83/**
84 * adding even more complexity, sequence< TestElement >
85 */
86published struct TestDataElements : TestElement
87{
88	sequence< TestElement > Sequence;
89};
90
91/**
92 * typedef used in interface
93 */
94published typedef TestDataElements TestData;
95
96published interface XRecursiveCall : com::sun::star::uno::XInterface
97{
98	/***
99	 * @param nToCall If nToCall is 0, the method returns immeadiatly.
100	 *                Otherwise, call the given interface with nToCall -1
101	 *
102	 ***/
103	void callRecursivly( [in] XRecursiveCall xCall , [in] long nToCall );
104};
105
106/**
107 * Monster test interface to test bridge calls.
108 * An implementation of this object has to store given values and return whenever there
109 * is an out param or return value.
110 */
111published interface XBridgeTestBase : com::sun::star::uno::XInterface
112{
113	/**
114	 * in parameter test, tests by calls reference also (complex types)
115	 */
116	[oneway] void setValues( [in] boolean bBool, [in] char cChar, [in] byte nByte,
117							 [in] short nShort, [in] unsigned short nUShort,
118							 [in] long nLong, [in] unsigned long nULong,
119							 [in] hyper nHyper, [in] unsigned hyper nUHyper,
120							 [in] float fFloat, [in] double fDouble,
121							 [in] TestEnum eEnum, [in] string aString,
122							 [in] com::sun::star::uno::XInterface xInterface, [in] any aAny,
123							 [in] sequence< TestElement > aSequence,
124							 [in] TestData aStruct );
125	/**
126	 * inout parameter test
127	 *
128	 * @return aStruct. The out parameter contain the values, that were previously set
129	 *         by setValues or (if not called before) default constructed values.
130	 *
131	 */
132	TestData setValues2( [inout] boolean bBool, [inout] char cChar, [inout] byte nByte,
133						 [inout] short nShort, [inout] unsigned short nUShort,
134						 [inout] long nLong, [inout] unsigned long nULong,
135						 [inout] hyper nHyper, [inout] unsigned hyper nUHyper,
136						 [inout] float fFloat, [inout] double fDouble,
137						 [inout] TestEnum eEnum, [inout] string aString,
138						 [inout] com::sun::star::uno::XInterface xInterface, [inout] any aAny,
139						 [inout] sequence< TestElement > aSequence,
140						 [inout] TestData aStruct );
141
142	/**
143	 * out parameter test
144	 */
145	TestData getValues( [out] boolean bBool, [out] char cChar, [out] byte nByte,
146						[out] short nShort, [out] unsigned short nUShort,
147						[out] long nLong, [out] unsigned long nULong,
148						[out] hyper nHyper, [out] unsigned hyper nUHyper,
149						[out] float fFloat, [out] double fDouble,
150						[out] TestEnum eEnum, [out] string aString,
151						[out] com::sun::star::uno::XInterface xInterface, [out] any aAny,
152						[out] sequence< TestElement > aSequence,
153						[out] TestData aStruct );
154
155	[attribute] boolean					 Bool;
156	[attribute] byte					 Byte;
157	[attribute] char					 Char;
158	[attribute] short					 Short;
159	[attribute] unsigned short			 UShort;
160	[attribute] long					 Long;
161	[attribute] unsigned long			 ULong;
162	[attribute] hyper					 Hyper;
163	[attribute] unsigned hyper			 UHyper;
164	[attribute] float					 Float;
165	[attribute] double					 Double;
166	[attribute] TestEnum				 Enum;
167	[attribute] string					 String;
168	[attribute] com::sun::star::uno::XInterface Interface;
169	[attribute] any						 Any;
170	[attribute] sequence< TestElement >	 Sequence;
171	[attribute] TestData				 Struct;
172
173
174	/***
175	 * This method returns the parameter value.
176	 * Method to extensivly test anys.
177	 ****/
178	any transportAny( [in] any value );
179
180	/***
181	 * methods to check sequence of calls. Call call() and callOneway
182	 * in an arbitrary sequence. Increase the callId for every call.
183	 * The testobject sets an error flag.
184
185		@see testSequencePassed
186	 ***/
187	void call( [in] long nCallId, [in] long nWaitMUSEC );
188	[oneway] void callOneway( [in] long nCallId, [in] long nWaitMUSEC );
189	boolean sequenceOfCallTestPassed();
190
191	/****
192	 * methods to check, if threads thread identity is holded.
193	 *
194	 ***/
195	void startRecursiveCall( [in] XRecursiveCall xCall , [in] long nToCall );
196};
197
198
199/**
200 * Inherting from monster; adds raiseException(), attribute raising RuntimeException.
201 */
202published interface XBridgeTest : XBridgeTestBase
203{
204	/**
205	 * the exception struct returned has to be filled with given arguments.
206	 * return value is for dummy.
207	 */
208	TestData raiseException( [in] short ArgumentPosition,
209							 [in] string Message,
210							 [in] com::sun::star::uno::XInterface Context )
211		raises( com::sun::star::lang::IllegalArgumentException );
212
213
214	/**
215	 * Throws runtime exception.
216	 * check remote bridges handle exceptions during oneway calls properly.
217	 * Note that on client side the execption may fly or not. When it flies, it should
218	 * have the proper message and context.
219	 ***/
220	[oneway] void raiseRuntimeExceptionOneway(	[in] string Message,
221												[in] com::sun::star::uno::XInterface Context );
222
223    /**
224	 * raises runtime exception;
225	 * the exception struct returned has to be filled with formerly set test data.
226	 */
227	[attribute] long					 RuntimeException;
228};
229
230/** Extended tests with sequences.
231 */
232published interface XBridgeTest2 : XBridgeTest
233{
234    sequence< boolean > setSequenceBool( [in] sequence< boolean > aSeq);
235    sequence< char > setSequenceChar( [in] sequence< char > aSeq);
236    sequence< byte> setSequenceByte( [in] sequence< byte > aSeq);
237    sequence< short> setSequenceShort( [in] sequence< short > aSeq);
238    sequence< unsigned short > setSequenceUShort( [in] sequence< unsigned short > aSeq);
239    sequence< long > setSequenceLong( [in] sequence< long > aSeq);
240    sequence< unsigned long > setSequenceULong( [in] sequence< unsigned long > aSeq);
241    sequence< hyper > setSequenceHyper( [in] sequence< hyper > aSeq);
242    sequence< unsigned hyper > setSequenceUHyper( [in] sequence< unsigned hyper > aSeq);
243    sequence< float > setSequenceFloat( [in] sequence< float > aSeq);
244    sequence< double > setSequenceDouble( [in] sequence< double > aSeq);
245    sequence< TestEnum > setSequenceEnum( [in] sequence< TestEnum > aSeq);
246    sequence< string > setSequenceString( [in] sequence< string > aString);
247    sequence< com::sun::star::uno::XInterface > setSequenceXInterface(
248        [in] sequence< com::sun::star::uno::XInterface > aSeq);
249    sequence< any > setSequenceAny( [in] sequence< any > aSeq);
250    sequence< TestElement > setSequenceStruct( [in] sequence< TestElement > aSeq);
251
252    sequence< sequence< long > > setDim2( [in] sequence< sequence< long > > aSeq);
253    sequence< sequence < sequence < long > > > setDim3(
254        [in] sequence< sequence < sequence < long > > > aSeq);
255
256    void setSequencesInOut( [inout] sequence< boolean > aSeqBoolean,
257                       [inout] sequence< char > aSeqChar,
258                       [inout] sequence< byte > aSeqByte,
259                       [inout] sequence< short > aSeqShort,
260                       [inout] sequence< unsigned short> aSeqUShort,
261                       [inout] sequence< long > aSeqLong,
262                       [inout] sequence< unsigned long > aSeqULong,
263                       [inout] sequence< hyper > aSeqHyper,
264                       [inout] sequence< unsigned hyper > aSeqUHyper,
265                       [inout] sequence< float > aSeqFloat,
266                       [inout] sequence< double > aSeqDouble,
267                       [inout] sequence< TestEnum > aSeqEnum,
268                       [inout] sequence< string > aSeqString,
269                       [inout] sequence< com::sun::star::uno::XInterface > aSeqXInterface,
270                       [inout] sequence< any > aSeqAny,
271                       [inout] sequence< sequence< long > > aSeqDim2,
272                       [inout] sequence< sequence < sequence < long > > > aSeqDim3);
273
274    void setSequencesOut( [out] sequence< boolean > aSeqBoolean,
275                       [out] sequence< char > aSeqChar,
276                       [out] sequence< byte > aSeqByte,
277                       [out] sequence< short > aSeqShort,
278                       [out] sequence< unsigned short> aSeqUShort,
279                       [out] sequence< long > aSeqLong,
280                       [out] sequence< unsigned long > aSeqULong,
281                       [out] sequence< hyper > aSeqHyper,
282                       [out] sequence< unsigned hyper > aSeqUHyper,
283                       [out] sequence< float > aSeqFloat,
284                       [out] sequence< double > aSeqDouble,
285                       [out] sequence< TestEnum > aSeqEnum,
286                       [out] sequence< string > aSeqString,
287                       [out] sequence< com::sun::star::uno::XInterface > aSeqXInterface,
288                       [out] sequence< any > aSeqAny,
289                       [out] sequence< sequence< long > > aSeqDim2,
290                       [out] sequence< sequence < sequence < long > > > aSeqDim3);
291
292
293};
294//=============================================================================
295
296};
297};
298};
299};
300};
301
302#endif
303