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