bump product version to 4.1.6.2
[LibreOffice.git] / testtools / source / bridgetest / cppobj.cxx
blobe9133b2faf46db56de87178598a49ad58d6a61cf
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <stdio.h>
22 #include "cppu/unotype.hxx"
23 #include <osl/diagnose.h>
24 #include "osl/diagnose.hxx"
25 #include <osl/thread.h>
26 #include <osl/mutex.hxx>
27 #include <osl/time.h>
29 #include <cppuhelper/implbase3.hxx>
30 #include <cppuhelper/factory.hxx>
31 #include "cppuhelper/exc_hlp.hxx"
32 #include "cppuhelper/compbase_ex.hxx"
33 #include <com/sun/star/lang/XServiceInfo.hpp>
34 #include <com/sun/star/lang/XComponent.hpp>
35 #include "com/sun/star/uno/Any.hxx"
36 #include "com/sun/star/uno/RuntimeException.hpp"
37 #include "com/sun/star/uno/Sequence.hxx"
39 #include "test/testtools/bridgetest/Constructors.hpp"
40 #include "test/testtools/bridgetest/Constructors2.hpp"
41 #include "test/testtools/bridgetest/TestPolyStruct.hpp"
42 #include "test/testtools/bridgetest/TestPolyStruct2.hpp"
43 #include "test/testtools/bridgetest/XBridgeTest2.hpp"
44 #include "test/testtools/bridgetest/XMulti.hpp"
46 #include "currentcontextchecker.hxx"
47 #include "multi.hxx"
49 using namespace osl;
50 using namespace cppu;
51 using namespace com::sun::star::uno;
52 using namespace com::sun::star::lang;
53 using namespace com::sun::star::registry;
54 using namespace test::testtools::bridgetest;
57 #define SERVICENAME "com.sun.star.test.bridge.CppTestObject"
58 #define IMPLNAME "com.sun.star.comp.bridge.CppTestObject"
60 namespace bridge_object
63 //--------------------------------------------------------------------------------------------------
64 inline static Sequence< OUString > getSupportedServiceNames()
66 OUString aName( SERVICENAME );
67 return Sequence< OUString >( &aName, 1 );
70 //==================================================================================================
71 static void assign( TestElement & rData,
72 sal_Bool bBool, sal_Unicode cChar, sal_Int8 nByte,
73 sal_Int16 nShort, sal_uInt16 nUShort,
74 sal_Int32 nLong, sal_uInt32 nULong,
75 sal_Int64 nHyper, sal_uInt64 nUHyper,
76 float fFloat, double fDouble,
77 TestEnum eEnum, const OUString& rStr,
78 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest,
79 const ::com::sun::star::uno::Any& rAny )
81 rData.Bool = bBool;
82 rData.Char = cChar;
83 rData.Byte = nByte;
84 rData.Short = nShort;
85 rData.UShort = nUShort;
86 rData.Long = nLong;
87 rData.ULong = nULong;
88 rData.Hyper = nHyper;
89 rData.UHyper = nUHyper;
90 rData.Float = fFloat;
91 rData.Double = fDouble;
92 rData.Enum = eEnum;
93 rData.String = rStr;
94 rData.Interface = xTest;
95 rData.Any = rAny;
97 //==================================================================================================
98 static void assign( TestData & rData,
99 sal_Bool bBool, sal_Unicode cChar, sal_Int8 nByte,
100 sal_Int16 nShort, sal_uInt16 nUShort,
101 sal_Int32 nLong, sal_uInt32 nULong,
102 sal_Int64 nHyper, sal_uInt64 nUHyper,
103 float fFloat, double fDouble,
104 TestEnum eEnum, const OUString& rStr,
105 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest,
106 const ::com::sun::star::uno::Any& rAny,
107 const com::sun::star::uno::Sequence< TestElement >& rSequence )
109 assign( (TestElement &)rData,
110 bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper, nUHyper, fFloat, fDouble,
111 eEnum, rStr, xTest, rAny );
112 rData.Sequence = rSequence;
115 //==================================================================================================
116 class Test_Impl :
117 public osl::DebugBase<Test_Impl>,
118 public WeakImplHelper3< XBridgeTest2, XServiceInfo , XRecursiveCall >
120 TestData _aData, _aStructData;
121 sal_Int32 m_nLastCallId;
122 bool m_bFirstCall;
123 bool m_bSequenceOfCallTestPassed;
124 Mutex m_mutex;
126 Sequence<sal_Bool> _arBool;
127 Sequence<sal_Unicode> _arChar;
128 Sequence<sal_Int8> _arByte;
129 Sequence<sal_Int16> _arShort;
130 Sequence<sal_uInt16> _arUShort;
131 Sequence<sal_Int32> _arLong;
132 Sequence<sal_uInt32> _arULong;
133 Sequence<sal_Int64> _arHyper;
134 Sequence<sal_uInt64> _arUHyper;
135 Sequence<OUString> _arString;
136 Sequence<float> _arFloat;
137 Sequence<double> _arDouble;
138 Sequence<TestEnum> _arEnum;
139 Sequence<Reference<XInterface> > _arObject;
140 Sequence<Sequence<sal_Int32> > _arLong2;
141 Sequence<Sequence<Sequence<sal_Int32> > > _arLong3;
142 Sequence<Any> _arAny;
143 Sequence<TestElement> _arStruct;
145 public:
146 Test_Impl() : m_nLastCallId( 0 ),
147 m_bFirstCall( true ),
148 m_bSequenceOfCallTestPassed( true )
150 virtual ~Test_Impl()
152 OSL_TRACE( "> scalar Test_Impl dtor <" );
155 void SAL_CALL acquire() throw ()
157 OWeakObject::acquire();
159 void SAL_CALL release() throw ()
161 OWeakObject::release();
164 // XServiceInfo
165 virtual OUString SAL_CALL getImplementationName() throw (RuntimeException);
166 virtual sal_Bool SAL_CALL supportsService( const OUString & rServiceName ) throw (RuntimeException);
167 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (RuntimeException);
169 // XLBTestBase
170 virtual void SAL_CALL setValues( sal_Bool bBool, sal_Unicode cChar, sal_Int8 nByte,
171 sal_Int16 nShort, sal_uInt16 nUShort,
172 sal_Int32 nLong, sal_uInt32 nULong,
173 sal_Int64 nHyper, sal_uInt64 nUHyper,
174 float fFloat, double fDouble,
175 TestEnum eEnum, const OUString& rStr,
176 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest,
177 const ::com::sun::star::uno::Any& rAny,
178 const ::com::sun::star::uno::Sequence<TestElement >& rSequence,
179 const TestData& rStruct )
180 throw(com::sun::star::uno::RuntimeException);
182 virtual TestData SAL_CALL setValues2( sal_Bool& bBool, sal_Unicode& cChar, sal_Int8& nByte,
183 sal_Int16& nShort, sal_uInt16& nUShort,
184 sal_Int32& nLong, sal_uInt32& nULong,
185 sal_Int64& nHyper, sal_uInt64& nUHyper,
186 float& fFloat, double& fDouble,
187 TestEnum& eEnum, OUString& rStr,
188 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest,
189 ::com::sun::star::uno::Any& rAny,
190 ::com::sun::star::uno::Sequence<TestElement >& rSequence,
191 TestData& rStruct )
192 throw(com::sun::star::uno::RuntimeException);
194 virtual TestData SAL_CALL getValues( sal_Bool& bBool, sal_Unicode& cChar, sal_Int8& nByte,
195 sal_Int16& nShort, sal_uInt16& nUShort,
196 sal_Int32& nLong, sal_uInt32& nULong,
197 sal_Int64& nHyper, sal_uInt64& nUHyper,
198 float& fFloat, double& fDouble,
199 TestEnum& eEnum, OUString& rStr,
200 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest,
201 ::com::sun::star::uno::Any& rAny,
202 ::com::sun::star::uno::Sequence< TestElement >& rSequence,
203 TestData& rStruct )
204 throw(com::sun::star::uno::RuntimeException);
206 virtual SmallStruct SAL_CALL echoSmallStruct(const SmallStruct& rStruct) throw(com::sun::star::uno::RuntimeException)
207 { return rStruct; }
208 virtual MediumStruct SAL_CALL echoMediumStruct(const MediumStruct& rStruct) throw(com::sun::star::uno::RuntimeException)
209 { return rStruct; }
210 virtual BigStruct SAL_CALL echoBigStruct(const BigStruct& rStruct) throw(com::sun::star::uno::RuntimeException)
211 { return rStruct; }
212 virtual TwoFloats SAL_CALL echoTwoFloats(const TwoFloats& rStruct) throw(com::sun::star::uno::RuntimeException)
213 { return rStruct; }
214 virtual FourFloats SAL_CALL echoFourFloats(const FourFloats& rStruct) throw(com::sun::star::uno::RuntimeException)
215 { return rStruct; }
216 virtual MixedFloatAndInteger SAL_CALL echoMixedFloatAndInteger(const MixedFloatAndInteger& rStruct) throw(com::sun::star::uno::RuntimeException)
217 { return rStruct; }
218 virtual ThreeByteStruct SAL_CALL echoThreeByteStruct(const ThreeByteStruct& rStruct) throw(com::sun::star::uno::RuntimeException)
219 { return rStruct; }
220 virtual sal_Int32 SAL_CALL testPPCAlignment( sal_Int64, sal_Int64, sal_Int32, sal_Int64, sal_Int32 i2 ) throw(com::sun::star::uno::RuntimeException)
221 { return i2; }
222 virtual double SAL_CALL testTenDoubles( double d1, double d2, double d3, double d4, double d5, double d6, double d7, double d8, double d9, double d10 ) throw(com::sun::star::uno::RuntimeException)
223 { return d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10; }
224 virtual sal_Bool SAL_CALL getBool() throw(com::sun::star::uno::RuntimeException)
225 { return _aData.Bool; }
226 virtual sal_Int8 SAL_CALL getByte() throw(com::sun::star::uno::RuntimeException)
227 { return _aData.Byte; }
228 virtual sal_Unicode SAL_CALL getChar() throw(com::sun::star::uno::RuntimeException)
229 { return _aData.Char; }
230 virtual sal_Int16 SAL_CALL getShort() throw(com::sun::star::uno::RuntimeException)
231 { return _aData.Short; }
232 virtual sal_uInt16 SAL_CALL getUShort() throw(com::sun::star::uno::RuntimeException)
233 { return _aData.UShort; }
234 virtual sal_Int32 SAL_CALL getLong() throw(com::sun::star::uno::RuntimeException)
235 { return _aData.Long; }
236 virtual sal_uInt32 SAL_CALL getULong() throw(com::sun::star::uno::RuntimeException)
237 { return _aData.ULong; }
238 virtual sal_Int64 SAL_CALL getHyper() throw(com::sun::star::uno::RuntimeException)
239 { return _aData.Hyper; }
240 virtual sal_uInt64 SAL_CALL getUHyper() throw(com::sun::star::uno::RuntimeException)
241 { return _aData.UHyper; }
242 virtual float SAL_CALL getFloat() throw(com::sun::star::uno::RuntimeException)
243 { return _aData.Float; }
244 virtual double SAL_CALL getDouble() throw(com::sun::star::uno::RuntimeException)
245 { return _aData.Double; }
246 virtual TestEnum SAL_CALL getEnum() throw(com::sun::star::uno::RuntimeException)
247 { return _aData.Enum; }
248 virtual OUString SAL_CALL getString() throw(com::sun::star::uno::RuntimeException)
249 { return _aData.String; }
250 virtual com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getInterface( ) throw(com::sun::star::uno::RuntimeException)
251 { return _aData.Interface; }
252 virtual com::sun::star::uno::Any SAL_CALL getAny() throw(com::sun::star::uno::RuntimeException)
253 { return _aData.Any; }
254 virtual com::sun::star::uno::Sequence< TestElement > SAL_CALL getSequence() throw(com::sun::star::uno::RuntimeException)
255 { return _aData.Sequence; }
256 virtual TestData SAL_CALL getStruct() throw(com::sun::star::uno::RuntimeException)
257 { return _aStructData; }
259 virtual void SAL_CALL setBool( sal_Bool _bool ) throw(::com::sun::star::uno::RuntimeException)
260 { _aData.Bool = _bool; }
261 virtual void SAL_CALL setByte( sal_Int8 _byte ) throw(::com::sun::star::uno::RuntimeException)
262 { _aData.Byte = _byte; }
263 virtual void SAL_CALL setChar( sal_Unicode _char ) throw(::com::sun::star::uno::RuntimeException)
264 { _aData.Char = _char; }
265 virtual void SAL_CALL setShort( sal_Int16 _short ) throw(::com::sun::star::uno::RuntimeException)
266 { _aData.Short = _short; }
267 virtual void SAL_CALL setUShort( sal_uInt16 _ushort ) throw(::com::sun::star::uno::RuntimeException)
268 { _aData.UShort = _ushort; }
269 virtual void SAL_CALL setLong( sal_Int32 _long ) throw(::com::sun::star::uno::RuntimeException)
270 { _aData.Long = _long; }
271 virtual void SAL_CALL setULong( sal_uInt32 _ulong ) throw(::com::sun::star::uno::RuntimeException)
272 { _aData.ULong = _ulong; }
273 virtual void SAL_CALL setHyper( sal_Int64 _hyper ) throw(::com::sun::star::uno::RuntimeException)
274 { _aData.Hyper = _hyper; }
275 virtual void SAL_CALL setUHyper( sal_uInt64 _uhyper ) throw(::com::sun::star::uno::RuntimeException)
276 { _aData.UHyper = _uhyper; }
277 virtual void SAL_CALL setFloat( float _float ) throw(::com::sun::star::uno::RuntimeException)
278 { _aData.Float = _float; }
279 virtual void SAL_CALL setDouble( double _double ) throw(::com::sun::star::uno::RuntimeException)
280 { _aData.Double = _double; }
281 virtual void SAL_CALL setEnum( TestEnum _enum ) throw(::com::sun::star::uno::RuntimeException)
282 { _aData.Enum = _enum; }
283 virtual void SAL_CALL setString( const OUString& _string ) throw(::com::sun::star::uno::RuntimeException)
284 { _aData.String = _string; }
285 virtual void SAL_CALL setInterface( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _interface ) throw(::com::sun::star::uno::RuntimeException)
286 { _aData.Interface = _interface; }
287 virtual void SAL_CALL setAny( const ::com::sun::star::uno::Any& _any ) throw(::com::sun::star::uno::RuntimeException)
288 { _aData.Any = _any; }
289 virtual void SAL_CALL setSequence( const ::com::sun::star::uno::Sequence<TestElement >& _sequence ) throw(::com::sun::star::uno::RuntimeException)
290 { _aData.Sequence = _sequence; }
291 virtual void SAL_CALL setStruct( const TestData& _struct ) throw(::com::sun::star::uno::RuntimeException)
292 { _aStructData = _struct; }
294 virtual sal_Int32 SAL_CALL getRaiseAttr1() throw (RuntimeException)
295 { throw RuntimeException(); }
297 virtual void SAL_CALL setRaiseAttr1(sal_Int32)
298 throw (IllegalArgumentException, RuntimeException)
299 { throw IllegalArgumentException(); }
301 virtual sal_Int32 SAL_CALL getRaiseAttr2()
302 throw (IllegalArgumentException, RuntimeException)
303 { throw IllegalArgumentException(); }
305 virtual TestPolyStruct< sal_Bool > SAL_CALL transportPolyBoolean(
306 TestPolyStruct< sal_Bool > const & arg) throw (RuntimeException)
307 { return arg; }
309 virtual void SAL_CALL transportPolyHyper(TestPolyStruct< sal_Int64 > &)
310 throw (RuntimeException) {}
312 virtual void SAL_CALL transportPolySequence(
313 TestPolyStruct< Sequence< Any > > const & arg1,
314 TestPolyStruct< Sequence< Any > > & arg2) throw (RuntimeException)
315 { arg2 = arg1; }
317 virtual TestPolyStruct< sal_Int32 > SAL_CALL getNullPolyLong()
318 throw (RuntimeException)
319 { return TestPolyStruct< sal_Int32 >(0); /* work around MS compiler bug */ }
321 virtual TestPolyStruct< OUString > SAL_CALL getNullPolyString()
322 throw (RuntimeException)
323 { return TestPolyStruct< OUString >(); }
325 virtual TestPolyStruct< Type > SAL_CALL getNullPolyType()
326 throw (RuntimeException)
327 { return TestPolyStruct< Type >(); }
329 virtual TestPolyStruct< Any > SAL_CALL getNullPolyAny()
330 throw (RuntimeException)
331 { return TestPolyStruct< Any >(); }
333 virtual TestPolyStruct< Sequence< sal_Bool > > SAL_CALL
334 getNullPolySequence() throw (RuntimeException)
335 { return TestPolyStruct< Sequence< sal_Bool > >(); }
337 virtual TestPolyStruct< TestEnum > SAL_CALL getNullPolyEnum()
338 throw (RuntimeException)
339 { return TestPolyStruct< TestEnum >(
340 test::testtools::bridgetest::TestEnum_TEST);
341 /* work around MS compiler bug */ }
343 virtual TestPolyStruct< TestBadEnum > SAL_CALL getNullPolyBadEnum()
344 throw (RuntimeException)
345 { return TestPolyStruct< TestBadEnum >(
346 test::testtools::bridgetest::TestBadEnum_M);
347 /* explicitly instantiate with default enumerator */ }
349 virtual TestPolyStruct< TestStruct > SAL_CALL getNullPolyStruct()
350 throw (RuntimeException)
351 { return TestPolyStruct< TestStruct >(); }
353 virtual TestPolyStruct< Reference< XBridgeTestBase > > SAL_CALL
354 getNullPolyInterface() throw (RuntimeException)
355 { return TestPolyStruct< Reference< XBridgeTestBase > >(); }
357 virtual ::com::sun::star::uno::Any SAL_CALL transportAny(
358 const ::com::sun::star::uno::Any& value )
359 throw(::com::sun::star::uno::RuntimeException);
361 virtual void SAL_CALL call( sal_Int32 nCallId, sal_Int32 nWaitMUSEC )
362 throw(::com::sun::star::uno::RuntimeException);
363 virtual void SAL_CALL callOneway( sal_Int32 nCallId, sal_Int32 nWaitMUSEC )
364 throw(::com::sun::star::uno::RuntimeException);
365 virtual sal_Bool SAL_CALL sequenceOfCallTestPassed( )
366 throw(::com::sun::star::uno::RuntimeException);
367 virtual void SAL_CALL startRecursiveCall(
368 const ::com::sun::star::uno::Reference< XRecursiveCall >& xCall, sal_Int32 nToCall )
369 throw(::com::sun::star::uno::RuntimeException);
371 virtual Reference< XMulti > SAL_CALL getMulti() throw (RuntimeException);
373 virtual OUString SAL_CALL testMulti(Reference< XMulti > const & multi)
374 throw (RuntimeException);
376 public: // XBridgeTest
377 virtual TestData SAL_CALL raiseException( sal_Int16 nArgumentPos, const OUString & rMsg, const Reference< XInterface > & xCOntext )
378 throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
380 virtual void SAL_CALL raiseRuntimeExceptionOneway(
381 const OUString& Message, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Context )
382 throw(::com::sun::star::uno::RuntimeException);
384 virtual sal_Int32 SAL_CALL getRuntimeException() throw(::com::sun::star::uno::RuntimeException);
385 virtual void SAL_CALL setRuntimeException( sal_Int32 _runtimeexception ) throw(::com::sun::star::uno::RuntimeException);
387 // XBridgeTest2
388 virtual Sequence< sal_Bool > SAL_CALL setSequenceBool(
389 const Sequence< sal_Bool >& aSeq ) throw (RuntimeException);
390 virtual Sequence< sal_Unicode > SAL_CALL setSequenceChar(
391 const Sequence< sal_Unicode >& aSeq ) throw (RuntimeException);
392 virtual Sequence< sal_Int8 > SAL_CALL setSequenceByte(
393 const Sequence< sal_Int8 >& aSeq ) throw (RuntimeException);
394 virtual Sequence< sal_Int16 > SAL_CALL setSequenceShort(
395 const Sequence< sal_Int16 >& aSeq ) throw (RuntimeException);
396 virtual Sequence< sal_uInt16 > SAL_CALL setSequenceUShort(
397 const Sequence< sal_uInt16 >& aSeq ) throw (RuntimeException);
398 virtual Sequence< sal_Int32 > SAL_CALL setSequenceLong(
399 const Sequence< sal_Int32 >& aSeq ) throw (RuntimeException);
400 virtual Sequence< sal_uInt32 > SAL_CALL setSequenceULong(
401 const Sequence< sal_uInt32 >& aSeq ) throw (RuntimeException);
402 virtual Sequence< sal_Int64 > SAL_CALL setSequenceHyper(
403 const Sequence< sal_Int64 >& aSeq ) throw (RuntimeException);
404 virtual Sequence< sal_uInt64 > SAL_CALL setSequenceUHyper(
405 const Sequence< sal_uInt64 >& aSeq ) throw (RuntimeException);
406 virtual Sequence< float > SAL_CALL setSequenceFloat(
407 const Sequence< float >& aSeq ) throw (RuntimeException);
408 virtual Sequence< double > SAL_CALL setSequenceDouble(
409 const Sequence< double >& aSeq ) throw (RuntimeException);
410 virtual Sequence< TestEnum > SAL_CALL setSequenceEnum(
411 const Sequence< TestEnum >& aSeq ) throw (RuntimeException) ;
412 virtual Sequence< OUString > SAL_CALL setSequenceString(
413 const Sequence< OUString >& aString ) throw (RuntimeException);
414 virtual Sequence< Reference< XInterface > > SAL_CALL setSequenceXInterface(
415 const Sequence< Reference< XInterface > >& aSeq )
416 throw (RuntimeException);
417 virtual Sequence<Any > SAL_CALL setSequenceAny(
418 const Sequence<Any >& aSeq ) throw (RuntimeException);
419 virtual Sequence<TestElement > SAL_CALL setSequenceStruct(
420 const Sequence< TestElement >& aSeq ) throw (RuntimeException);
421 virtual Sequence< Sequence< sal_Int32 > > SAL_CALL setDim2(
422 const Sequence<Sequence< sal_Int32 > >& aSeq ) throw (RuntimeException);
423 virtual Sequence< Sequence< Sequence< sal_Int32 > > > SAL_CALL setDim3(
424 const Sequence< Sequence< Sequence< sal_Int32 > > >& aSeq )
425 throw (RuntimeException);
426 virtual void SAL_CALL setSequencesInOut(Sequence< sal_Bool >& aSeqBoolean,
427 Sequence< sal_Unicode >& aSeqChar,
428 Sequence< sal_Int8 >& aSeqByte,
429 Sequence< sal_Int16 >& aSeqShort,
430 Sequence< sal_uInt16 >& aSeqUShort,
431 Sequence< sal_Int32 >& aSeqLong,
432 Sequence< sal_uInt32 >& aSeqULong,
433 Sequence< sal_Int64 >& aSeqHyper,
434 Sequence< sal_uInt64 >& aSeqUHyper,
435 Sequence< float >& aSeqFloat,
436 Sequence< double >& aSeqDouble,
437 Sequence< TestEnum >& aSeqTestEnum,
438 Sequence< OUString >& aSeqString,
439 Sequence<Reference<XInterface > >& aSeqXInterface,
440 Sequence< Any >& aSeqAny,
441 Sequence< Sequence< sal_Int32 > >& aSeqDim2,
442 Sequence< Sequence< Sequence< sal_Int32 > > >& aSeqDim3 )
443 throw (RuntimeException);
444 virtual void SAL_CALL setSequencesOut( Sequence< sal_Bool >& aSeqBoolean,
445 Sequence< sal_Unicode >& aSeqChar,
446 Sequence< sal_Int8 >& aSeqByte,
447 Sequence< sal_Int16 >& aSeqShort,
448 Sequence< sal_uInt16 >& aSeqUShort,
449 Sequence< sal_Int32 >& aSeqLong,
450 Sequence< sal_uInt32 >& aSeqULong,
451 Sequence< sal_Int64 >& aSeqHyper,
452 Sequence< sal_uInt64 >& aSeqUHyper,
453 Sequence< float >& aSeqFloat,
454 Sequence< double >& aSeqDouble,
455 Sequence< TestEnum >& aSeqEnum,
456 Sequence< OUString >& aSeqString,
457 Sequence< Reference< XInterface > >& aSeqXInterface,
458 Sequence< Any >& aSeqAny,
459 Sequence< Sequence< sal_Int32 > >& aSeqDim2,
460 Sequence< Sequence< Sequence< sal_Int32 > > >& aSeqDim3 )
461 throw (RuntimeException);
462 virtual void SAL_CALL testConstructorsService(
463 Reference< XComponentContext > const & context)
464 throw (RuntimeException);
465 virtual Reference< XCurrentContextChecker > SAL_CALL
466 getCurrentContextChecker()
467 throw (RuntimeException);
469 public:
470 virtual void SAL_CALL callRecursivly( const ::com::sun::star::uno::Reference< XRecursiveCall >& xCall, sal_Int32 nToCall ) throw(::com::sun::star::uno::RuntimeException);
473 //Dummy class for XComponent implementation
474 class Dummy : public osl::DebugBase<Dummy>,
475 public WeakComponentImplHelperBase
477 public:
478 Dummy(): WeakComponentImplHelperBase(*Mutex::getGlobalMutex()){}
481 //__________________________________________________________________________________________________
482 Any Test_Impl::transportAny( const Any & value ) throw ( ::com::sun::star::uno::RuntimeException)
484 return value;
487 //__________________________________________________________________________________________________
489 namespace {
491 void wait(sal_Int32 microSeconds) {
492 OSL_ASSERT(microSeconds >= 0 && microSeconds <= SAL_MAX_INT32 / 1000);
493 TimeValue t = {
494 static_cast< sal_uInt32 >(microSeconds / 1000000),
495 static_cast< sal_uInt32 >(microSeconds * 1000) };
496 osl_waitThread(&t);
501 void Test_Impl::call( sal_Int32 nCallId , sal_Int32 nWaitMUSEC ) throw(::com::sun::star::uno::RuntimeException)
503 wait(nWaitMUSEC);
504 if( m_bFirstCall )
506 m_bFirstCall = false;
508 else
510 m_bSequenceOfCallTestPassed = m_bSequenceOfCallTestPassed && (nCallId > m_nLastCallId);
512 m_nLastCallId = nCallId;
515 //__________________________________________________________________________________________________
516 void Test_Impl::callOneway( sal_Int32 nCallId , sal_Int32 nWaitMUSEC ) throw (::com::sun::star::uno::RuntimeException)
518 wait(nWaitMUSEC);
519 m_bSequenceOfCallTestPassed = m_bSequenceOfCallTestPassed && (nCallId > m_nLastCallId);
520 m_nLastCallId = nCallId;
523 //__________________________________________________________________________________________________
524 sal_Bool Test_Impl::sequenceOfCallTestPassed() throw (::com::sun::star::uno::RuntimeException)
526 return m_bSequenceOfCallTestPassed;
529 //__________________________________________________________________________________________________
530 void SAL_CALL Test_Impl::startRecursiveCall(
531 const ::com::sun::star::uno::Reference< XRecursiveCall >& xCall, sal_Int32 nToCall )
532 throw(::com::sun::star::uno::RuntimeException)
534 MutexGuard guard( m_mutex );
535 if( nToCall )
537 nToCall --;
538 xCall->callRecursivly( this , nToCall );
543 void SAL_CALL Test_Impl::callRecursivly(
544 const ::com::sun::star::uno::Reference< XRecursiveCall >& xCall,
545 sal_Int32 nToCall )
546 throw(::com::sun::star::uno::RuntimeException)
548 MutexGuard guard( m_mutex );
549 if( nToCall )
551 nToCall --;
552 xCall->callRecursivly( this , nToCall );
556 Reference< XMulti > Test_Impl::getMulti() throw (RuntimeException) {
557 return new testtools::bridgetest::Multi;
560 OUString Test_Impl::testMulti(Reference< XMulti > const & multi)
561 throw (RuntimeException)
563 return testtools::bridgetest::testMulti(multi);
566 //__________________________________________________________________________________________________
567 void Test_Impl::setValues( sal_Bool bBool, sal_Unicode cChar, sal_Int8 nByte,
568 sal_Int16 nShort, sal_uInt16 nUShort,
569 sal_Int32 nLong, sal_uInt32 nULong,
570 sal_Int64 nHyper, sal_uInt64 nUHyper,
571 float fFloat, double fDouble,
572 TestEnum eEnum, const OUString& rStr,
573 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest,
574 const ::com::sun::star::uno::Any& rAny,
575 const ::com::sun::star::uno::Sequence<TestElement >& rSequence,
576 const TestData& rStruct )
577 throw(com::sun::star::uno::RuntimeException)
579 assign( _aData,
580 bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper, nUHyper, fFloat, fDouble,
581 eEnum, rStr, xTest, rAny, rSequence );
582 _aStructData = rStruct;
584 //__________________________________________________________________________________________________
585 TestData Test_Impl::setValues2( sal_Bool& bBool, sal_Unicode& cChar, sal_Int8& nByte,
586 sal_Int16& nShort, sal_uInt16& nUShort,
587 sal_Int32& nLong, sal_uInt32& nULong,
588 sal_Int64& nHyper, sal_uInt64& nUHyper,
589 float& fFloat, double& fDouble,
590 TestEnum& eEnum, OUString& rStr,
591 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest,
592 ::com::sun::star::uno::Any& rAny,
593 ::com::sun::star::uno::Sequence<TestElement >& rSequence,
594 TestData& rStruct )
595 throw(com::sun::star::uno::RuntimeException)
597 assign( _aData,
598 bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper, nUHyper, fFloat, fDouble,
599 eEnum, rStr, xTest, rAny, rSequence );
600 _aStructData = rStruct;
602 TestElement elem = rSequence[ 0 ];
603 rSequence[ 0 ] = rSequence[ 1 ];
604 rSequence[ 1 ] = elem;
606 return _aStructData;
608 //__________________________________________________________________________________________________
609 TestData Test_Impl::getValues( sal_Bool& bBool, sal_Unicode& cChar, sal_Int8& nByte,
610 sal_Int16& nShort, sal_uInt16& nUShort,
611 sal_Int32& nLong, sal_uInt32& nULong,
612 sal_Int64& nHyper, sal_uInt64& nUHyper,
613 float& fFloat, double& fDouble,
614 TestEnum& eEnum, OUString& rStr,
615 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest,
616 ::com::sun::star::uno::Any& rAny,
617 ::com::sun::star::uno::Sequence<TestElement >& rSequence,
618 TestData& rStruct )
619 throw(com::sun::star::uno::RuntimeException)
621 bBool = _aData.Bool;
622 cChar = _aData.Char;
623 nByte = _aData.Byte;
624 nShort = _aData.Short;
625 nUShort = _aData.UShort;
626 nLong = _aData.Long;
627 nULong = _aData.ULong;
628 nHyper = _aData.Hyper;
629 nUHyper = _aData.UHyper;
630 fFloat = _aData.Float;
631 fDouble = _aData.Double;
632 eEnum = _aData.Enum;
633 rStr = _aData.String;
634 xTest = _aData.Interface;
635 rAny = _aData.Any;
636 rSequence = _aData.Sequence;
637 rStruct = _aStructData;
638 return _aStructData;
640 //__________________________________________________________________________________________________
641 TestData Test_Impl::raiseException( sal_Int16 nArgumentPos, const OUString & rMsg, const Reference< XInterface > & xContext )
642 throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
644 IllegalArgumentException aExc;
645 aExc.ArgumentPosition = nArgumentPos;
646 aExc.Message = _aData.String = rMsg;
647 aExc.Context = _aData.Interface = xContext;
648 throw aExc;
651 void Test_Impl::raiseRuntimeExceptionOneway( const OUString & rMsg, const Reference< XInterface > & xContext )
652 throw(::com::sun::star::uno::RuntimeException)
654 RuntimeException aExc;
655 aExc.Message = _aData.String = rMsg;
656 aExc.Context = _aData.Interface = xContext;
657 throw aExc;
660 void dothrow2( RuntimeException e )
662 throw e;
664 void dothrow( RuntimeException const & e )
666 #if defined _MSC_VER
667 // currently only for MSVC:
668 // just to test whether all bridges fall back to a RuntimeException
669 // in case of a thrown non-UNO exception:
672 throw ::std::bad_alloc();
674 catch (...)
678 Any a( getCaughtException() );
679 RuntimeException exc;
680 OSL_VERIFY( a >>= exc );
681 OSL_TRACE(
682 OUStringToOString(
683 exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
685 catch (...) // never throws anything
687 fprintf( stderr, "\ngetCaughtException() failed!\n" );
688 exit( 1 );
691 #endif
692 dothrow2( e );
694 //______________________________________________________________________________
695 sal_Int32 Test_Impl::getRuntimeException()
696 throw (RuntimeException)
700 dothrow( RuntimeException( _aData.String, _aData.Interface ) );
702 catch (Exception &)
704 Any a( getCaughtException() );
705 throwException( a );
707 return 0; // for dummy
709 //__________________________________________________________________________________________________
710 void Test_Impl::setRuntimeException( sal_Int32 ) throw(::com::sun::star::uno::RuntimeException)
712 RuntimeException aExc;
713 aExc.Message = _aData.String;
714 aExc.Context = _aData.Interface;
715 throwException( makeAny( aExc ) );
718 // XBridgeTest2 -------------------------------------------------------------
719 Sequence< sal_Bool > SAL_CALL Test_Impl::setSequenceBool(
720 const Sequence< sal_Bool >& aSeq ) throw (RuntimeException)
722 _arBool = aSeq;
723 return aSeq;
726 Sequence< sal_Unicode > SAL_CALL Test_Impl::setSequenceChar(
727 const Sequence< sal_Unicode >& aSeq ) throw (RuntimeException)
729 _arChar = aSeq;
730 return aSeq;
733 Sequence< sal_Int8 > SAL_CALL Test_Impl::setSequenceByte(
734 const Sequence< sal_Int8 >& aSeq ) throw (RuntimeException)
736 _arByte = aSeq;
737 return aSeq;
740 Sequence< sal_Int16 > SAL_CALL Test_Impl::setSequenceShort(
741 const Sequence< sal_Int16 >& aSeq ) throw (RuntimeException)
743 _arShort = aSeq;
744 return aSeq;
747 Sequence< sal_uInt16 > SAL_CALL Test_Impl::setSequenceUShort(
748 const Sequence< sal_uInt16 >& aSeq ) throw (RuntimeException)
750 _arUShort = aSeq;
751 return aSeq;
754 Sequence< sal_Int32 > SAL_CALL Test_Impl::setSequenceLong(
755 const Sequence< sal_Int32 >& aSeq ) throw (RuntimeException)
757 _arLong = aSeq;
758 return aSeq;
761 Sequence< sal_uInt32 > SAL_CALL Test_Impl::setSequenceULong(
762 const Sequence< sal_uInt32 >& aSeq ) throw (RuntimeException)
764 _arULong = aSeq;
765 return aSeq;
768 Sequence< sal_Int64 > SAL_CALL Test_Impl::setSequenceHyper(
769 const Sequence< sal_Int64 >& aSeq ) throw (RuntimeException)
771 _arHyper = aSeq;
772 return aSeq;
775 Sequence< sal_uInt64 > SAL_CALL Test_Impl::setSequenceUHyper(
776 const Sequence< sal_uInt64 >& aSeq ) throw (RuntimeException)
778 _arUHyper = aSeq;
779 return aSeq;
782 Sequence< float > SAL_CALL Test_Impl::setSequenceFloat(
783 const Sequence< float >& aSeq ) throw (RuntimeException)
785 _arFloat = aSeq;
786 return aSeq;
789 Sequence< double > SAL_CALL Test_Impl::setSequenceDouble(
790 const Sequence< double >& aSeq ) throw (RuntimeException)
792 _arDouble = aSeq;
793 return aSeq;
796 Sequence< TestEnum > SAL_CALL Test_Impl::setSequenceEnum(
797 const Sequence< TestEnum >& aSeq ) throw (RuntimeException)
799 _arEnum = aSeq;
800 return aSeq;
803 Sequence< OUString > SAL_CALL Test_Impl::setSequenceString(
804 const Sequence< OUString >& aSeq ) throw (RuntimeException)
806 _arString = aSeq;
807 return aSeq;
810 Sequence< Reference< XInterface > > SAL_CALL Test_Impl::setSequenceXInterface(
811 const Sequence< Reference< XInterface > >& aSeq )
812 throw (RuntimeException)
814 _arObject = aSeq;
815 return aSeq;
818 Sequence<Any > SAL_CALL Test_Impl::setSequenceAny(
819 const Sequence<Any >& aSeq ) throw (RuntimeException)
821 _arAny = aSeq;
822 return aSeq;
825 Sequence<TestElement > SAL_CALL Test_Impl::setSequenceStruct(
826 const Sequence< TestElement >& aSeq ) throw (RuntimeException)
828 _arStruct = aSeq;
829 return aSeq;
832 Sequence< Sequence< sal_Int32 > > SAL_CALL Test_Impl::setDim2(
833 const Sequence<Sequence< sal_Int32 > >& aSeq ) throw (RuntimeException)
835 _arLong2 = aSeq;
836 return aSeq;
839 Sequence< Sequence< Sequence< sal_Int32 > > > SAL_CALL Test_Impl::setDim3(
840 const Sequence< Sequence< Sequence< sal_Int32 > > >& aSeq )
841 throw (RuntimeException)
843 _arLong3 = aSeq;
844 return aSeq;
847 void SAL_CALL Test_Impl::setSequencesInOut(Sequence< sal_Bool >& aSeqBoolean,
848 Sequence< sal_Unicode >& aSeqChar,
849 Sequence< sal_Int8 >& aSeqByte,
850 Sequence< sal_Int16 >& aSeqShort,
851 Sequence< sal_uInt16 >& aSeqUShort,
852 Sequence< sal_Int32 >& aSeqLong,
853 Sequence< sal_uInt32 >& aSeqULong,
854 Sequence< sal_Int64 >& aSeqHyper,
855 Sequence< sal_uInt64 >& aSeqUHyper,
856 Sequence< float >& aSeqFloat,
857 Sequence< double >& aSeqDouble,
858 Sequence< TestEnum >& aSeqTestEnum,
859 Sequence< OUString >& aSeqString,
860 Sequence<Reference<XInterface > >& aSeqXInterface,
861 Sequence< Any >& aSeqAny,
862 Sequence< Sequence< sal_Int32 > >& aSeqDim2,
863 Sequence< Sequence< Sequence< sal_Int32 > > >& aSeqDim3 )
864 throw (RuntimeException)
866 _arBool = aSeqBoolean;
867 _arChar = aSeqChar;
868 _arByte = aSeqByte;
869 _arShort = aSeqShort;
870 _arUShort = aSeqUShort;
871 _arLong = aSeqLong;
872 _arULong = aSeqULong;
873 _arHyper = aSeqHyper;
874 _arUHyper = aSeqUHyper;
875 _arFloat = aSeqFloat;
876 _arDouble = aSeqDouble;
877 _arEnum = aSeqTestEnum;
878 _arString = aSeqString;
879 _arObject = aSeqXInterface;
880 _arAny = aSeqAny;
881 _arLong2 = aSeqDim2;
882 _arLong3 = aSeqDim3;
885 void SAL_CALL Test_Impl::setSequencesOut( Sequence< sal_Bool >& aSeqBoolean,
886 Sequence< sal_Unicode >& aSeqChar,
887 Sequence< sal_Int8 >& aSeqByte,
888 Sequence< sal_Int16 >& aSeqShort,
889 Sequence< sal_uInt16 >& aSeqUShort,
890 Sequence< sal_Int32 >& aSeqLong,
891 Sequence< sal_uInt32 >& aSeqULong,
892 Sequence< sal_Int64 >& aSeqHyper,
893 Sequence< sal_uInt64 >& aSeqUHyper,
894 Sequence< float >& aSeqFloat,
895 Sequence< double >& aSeqDouble,
896 Sequence< TestEnum >& aSeqEnum,
897 Sequence< OUString >& aSeqString,
898 Sequence< Reference< XInterface > >& aSeqXInterface,
899 Sequence< Any >& aSeqAny,
900 Sequence< Sequence< sal_Int32 > >& aSeqDim2,
901 Sequence< Sequence< Sequence< sal_Int32 > > >& aSeqDim3 )
902 throw (RuntimeException)
904 aSeqBoolean = _arBool;
905 aSeqChar = _arChar;
906 aSeqByte = _arByte;
907 aSeqShort = _arShort;
908 aSeqUShort = _arUShort;
909 aSeqLong = _arLong;
910 aSeqULong = _arULong;
911 aSeqHyper = _arHyper;
912 aSeqUHyper = _arUHyper;
913 aSeqFloat = _arFloat;
914 aSeqDouble = _arDouble;
915 aSeqEnum = _arEnum;
916 aSeqString = _arString;
917 aSeqXInterface = _arObject;
918 aSeqAny = _arAny;
919 aSeqDim2 = _arLong2;
920 aSeqDim3 = _arLong3;
923 void Test_Impl::testConstructorsService(
924 Reference< XComponentContext > const & context) throw (RuntimeException)
926 Sequence< sal_Bool > arg14(1); arg14[0] = true;
927 Sequence< sal_Int8 > arg15(1); arg15[0] = SAL_MIN_INT8;
928 Sequence< sal_Int16 > arg16(1); arg16[0] = SAL_MIN_INT16;
929 Sequence< sal_uInt16 > arg17(1); arg17[0] = SAL_MAX_UINT16;
930 Sequence< sal_Int32 > arg18(1); arg18[0] = SAL_MIN_INT32;
931 Sequence< sal_uInt32 > arg19(1); arg19[0] = SAL_MAX_UINT32;
932 Sequence< sal_Int64 > arg20(1); arg20[0] = SAL_MIN_INT64;
933 Sequence< sal_uInt64 > arg21(1); arg21[0] = SAL_MAX_UINT64;
934 Sequence< float > arg22(1); arg22[0] = 0.123f;
935 Sequence< double > arg23(1); arg23[0] = 0.456;
936 Sequence< sal_Unicode > arg24(1); arg24[0] = 'X';
937 Sequence< OUString > arg25(1);
938 arg25[0] = OUString("test");
939 Sequence< Type > arg26(1); arg26[0] = UnoType< Any >::get();
940 Sequence< Any > arg27(1); arg27[0] <<= true;
941 Sequence< Sequence< sal_Bool > > arg28(1);
942 arg28[0] = Sequence< sal_Bool >(1); arg28[0][0] = true;
943 Sequence< Sequence< Any > > arg29(1); arg29[0] = Sequence< Any >(1);
944 arg29[0][0] <<= true;
945 Sequence< TestEnum > arg30(1); arg30[0] = TestEnum_TWO;
946 Sequence< TestStruct > arg31(1); arg31[0].member = 10;
947 Sequence< TestPolyStruct< sal_Bool > > arg32(1); arg32[0].member = true;
948 Sequence< TestPolyStruct< Any > > arg33(1); arg33[0].member <<= true;
949 Sequence< Reference< XInterface > > arg34(1);
950 Constructors::create1(context,
951 true,
952 SAL_MIN_INT8,
953 SAL_MIN_INT16,
954 SAL_MAX_UINT16,
955 SAL_MIN_INT32,
956 SAL_MAX_UINT32,
957 SAL_MIN_INT64,
958 SAL_MAX_UINT64,
959 0.123f,
960 0.456,
961 'X',
962 OUString("test"),
963 UnoType< Any >::get(),
964 makeAny(true),
965 arg14,
966 arg15,
967 arg16,
968 arg17,
969 arg18,
970 arg19,
971 arg20,
972 arg21,
973 arg22,
974 arg23,
975 arg24,
976 arg25,
977 arg26,
978 arg27,
979 arg28,
980 arg29,
981 arg30,
982 arg31,
983 arg32,
984 arg33,
985 arg34,
986 TestEnum_TWO,
987 TestStruct(10),
988 TestPolyStruct< sal_Bool >(true),
989 TestPolyStruct< Any >(makeAny(true)),
990 Reference< XInterface >(0));
991 Sequence< Any > args(40);
992 args[0] <<= true;
993 args[1] <<= SAL_MIN_INT8;
994 args[2] <<= SAL_MIN_INT16;
995 args[3] <<= SAL_MAX_UINT16;
996 args[4] <<= SAL_MIN_INT32;
997 args[5] <<= SAL_MAX_UINT32;
998 args[6] <<= SAL_MIN_INT64;
999 args[7] <<= SAL_MAX_UINT64;
1000 args[8] <<= 0.123f;
1001 args[9] <<= 0.456;
1002 sal_Unicode arg10c = 'X';
1003 args[10].setValue(&arg10c, UnoType< UnoCharType >::get());
1004 args[11] <<= OUString("test");
1005 args[12] <<= UnoType< Any >::get();
1006 args[13] <<= true;
1007 args[14] <<= arg14;
1008 args[15] <<= arg15;
1009 args[16] <<= arg16;
1010 args[17] <<= arg17;
1011 args[18] <<= arg18;
1012 args[19] <<= arg19;
1013 args[20] <<= arg20;
1014 args[21] <<= arg21;
1015 args[22] <<= arg22;
1016 args[23] <<= arg23;
1017 args[24].setValue(&arg24, UnoType< UnoSequenceType< UnoCharType > >::get());
1018 args[25] <<= arg25;
1019 args[26] <<= arg26;
1020 args[27] <<= arg27;
1021 args[28] <<= arg28;
1022 args[29] <<= arg29;
1023 args[30] <<= arg30;
1024 args[31] <<= arg31;
1025 args[32] <<= arg32;
1026 args[33] <<= arg33;
1027 args[34] <<= arg34;
1028 args[35] <<= TestEnum_TWO;
1029 args[36] <<= TestStruct(10);
1030 args[37] <<= TestPolyStruct< sal_Bool >(true);
1031 args[38] <<= TestPolyStruct< Any >(makeAny(true));
1032 args[39] <<= Reference< XInterface >(0);
1033 Constructors::create2(context, args);
1035 Sequence<Type> argSeq1(1); argSeq1[0] = cppu::UnoType<sal_Int32>::get();
1036 Sequence<Reference<XInterface> > argSeq2(1); argSeq2[0] = static_cast<XComponent*>(new Dummy());
1037 Sequence<Reference<XComponent> > argSeq2a(1); argSeq2a[0] = static_cast<XComponent*>(new Dummy());
1039 Sequence<TestPolyStruct2<sal_Unicode, Sequence<Any> > > argSeq3(1);
1040 argSeq3[0] = TestPolyStruct2<sal_Unicode, Sequence<Any> >('X', arg27);
1041 Sequence<TestPolyStruct2<TestPolyStruct<sal_Unicode>, Sequence<Any> > > argSeq4(1);
1042 argSeq4[0] = TestPolyStruct2<TestPolyStruct<sal_Unicode>, Sequence<Any> >(
1043 TestPolyStruct<sal_Unicode>('X'), arg27);
1044 Sequence<Sequence<sal_Int32> > argSeq5(1);
1045 argSeq5[0] = Sequence<sal_Int32>(1); argSeq5[0][0] = SAL_MIN_INT32;
1046 Sequence<TestPolyStruct<sal_Int32> > argSeq6(1);
1047 argSeq6[0] = TestPolyStruct<sal_Int32>(SAL_MIN_INT32);
1048 Sequence<TestPolyStruct<TestPolyStruct2<sal_Unicode, Any> > > argSeq7(1);
1049 argSeq7[0] = TestPolyStruct<TestPolyStruct2<sal_Unicode, Any> >(
1050 TestPolyStruct2<sal_Unicode, Any>('X', Any(true)));
1051 Sequence<TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>,OUString> > > argSeq8(1);
1052 argSeq8[0] = TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>,OUString> > (
1053 TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>,OUString>(
1054 TestPolyStruct2<sal_Unicode, Any>('X', Any(true)), OUString("test")));
1055 Sequence<TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> > > > argSeq9(1);
1056 argSeq9[0] = TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> > >(
1057 OUString("test"), TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> >(
1058 'X', TestPolyStruct<Any>(Any(true))));
1059 Sequence<TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>, TestPolyStruct<sal_Unicode> > > argSeq10(1);
1060 argSeq10[0] = TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>, TestPolyStruct<sal_Unicode> >(
1061 TestPolyStruct2<sal_Unicode, Any>('X', Any(true)), TestPolyStruct<sal_Unicode>('X'));
1062 Sequence<Sequence<TestPolyStruct<sal_Unicode > > > argSeq11(1);
1063 argSeq11[0] = Sequence<TestPolyStruct<sal_Unicode > >(1);
1064 argSeq11[0][0] = TestPolyStruct<sal_Unicode>('X');
1065 Sequence<Sequence<TestPolyStruct<TestPolyStruct2<sal_Unicode,Any> > > > argSeq12(1);
1066 argSeq12[0] = Sequence<TestPolyStruct<TestPolyStruct2<sal_Unicode,Any> > >(1);
1067 argSeq12[0][0] = TestPolyStruct<TestPolyStruct2<sal_Unicode,Any> >(
1068 TestPolyStruct2<sal_Unicode,Any>('X', Any(true)));
1069 Sequence<Sequence<TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>,OUString> > > > argSeq13(1);
1070 argSeq13[0] = Sequence<TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>,OUString> > >(1);
1071 argSeq13[0][0] = TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>,OUString> >(
1072 TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>,OUString>(
1073 TestPolyStruct2<sal_Unicode,Any>('X', Any(true)), OUString("test")));
1074 Sequence<Sequence<TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> > > > > argSeq14(1);
1075 argSeq14[0] = Sequence<TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> > > >(1);
1076 argSeq14[0][0] = TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> > >(
1077 OUString("test"), TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> >(
1078 'X', TestPolyStruct<Any>(Any(true))));
1079 Sequence<Sequence<TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>, TestPolyStruct<sal_Unicode> > > > argSeq15(1);
1080 argSeq15[0] = Sequence<TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>, TestPolyStruct<sal_Unicode> > >(1);
1081 argSeq15[0][0] = TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>, TestPolyStruct<sal_Unicode> >(
1082 TestPolyStruct2<sal_Unicode,Any>('X',Any(true)), TestPolyStruct<sal_Unicode>('X'));
1084 Constructors2::create1(
1085 context,
1086 TestPolyStruct<Type>(cppu::UnoType<sal_Int32>::get()),
1087 TestPolyStruct<Any>(Any(true)),
1088 TestPolyStruct<sal_Bool>(true),
1089 TestPolyStruct<sal_Int8>(SAL_MIN_INT8),
1090 TestPolyStruct<sal_Int16>(SAL_MIN_INT16),
1091 TestPolyStruct<sal_Int32>(SAL_MIN_INT32),
1092 TestPolyStruct<sal_Int64>(SAL_MIN_INT64),
1093 TestPolyStruct<sal_Unicode>('X'),
1094 TestPolyStruct<OUString>(OUString("test")),
1095 TestPolyStruct<float>(0.123f),
1096 TestPolyStruct<double>(0.456),
1097 TestPolyStruct<Reference<XInterface> >(static_cast<XBridgeTest2*>(this)),
1098 TestPolyStruct<Reference<XComponent> >(static_cast<XComponent*>(new Dummy())),
1099 TestPolyStruct<TestEnum>(TestEnum_TWO),
1100 TestPolyStruct<TestPolyStruct2<sal_Unicode, Any> >(
1101 TestPolyStruct2<sal_Unicode, Any>('X', Any(true))),
1102 TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>,OUString> > (
1103 TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>,OUString>(
1104 TestPolyStruct2<sal_Unicode, Any>('X', Any(true)), OUString("test"))),
1105 TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode,TestPolyStruct<Any> > >(
1106 OUString("test"),
1107 TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> >('X', TestPolyStruct<Any>(Any(true)))),
1108 TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>, TestPolyStruct<sal_Unicode> >(
1109 TestPolyStruct2<sal_Unicode, Any>('X', Any(true)),
1110 TestPolyStruct<sal_Unicode>('X')),
1111 TestPolyStruct<Sequence<Type> >(argSeq1),
1112 TestPolyStruct<Sequence<Any> >(arg27),
1113 TestPolyStruct<Sequence<sal_Bool> >(arg14),
1114 TestPolyStruct<Sequence<sal_Int8> >(arg15),
1115 TestPolyStruct<Sequence<sal_Int16> >(arg16),
1116 TestPolyStruct<Sequence<sal_Int32> >(arg18),
1117 TestPolyStruct<Sequence<sal_Int64> >(arg20),
1118 TestPolyStruct<Sequence<sal_Unicode> >(arg24),
1119 TestPolyStruct<Sequence<OUString> >(arg25),
1120 TestPolyStruct<Sequence<float> >(arg22),
1121 TestPolyStruct<Sequence<double> >(arg23),
1122 TestPolyStruct<Sequence<Reference<XInterface> > >(argSeq2),
1123 TestPolyStruct<Sequence<Reference<XComponent> > >(argSeq2a),
1124 TestPolyStruct<Sequence<TestEnum> >(arg30),
1125 TestPolyStruct<Sequence<TestPolyStruct2<sal_Unicode, Sequence<Any> > > >(argSeq3),
1126 TestPolyStruct<Sequence<TestPolyStruct2<TestPolyStruct<sal_Unicode>, Sequence<Any> > > > (argSeq4),
1127 TestPolyStruct<Sequence<Sequence<sal_Int32> > >(argSeq5),
1128 argSeq6,
1129 argSeq7,
1130 argSeq8,
1131 argSeq9,
1132 argSeq10,
1133 argSeq11,
1134 argSeq12,
1135 argSeq13,
1136 argSeq14,
1137 argSeq15);
1140 Reference< XCurrentContextChecker > Test_Impl::getCurrentContextChecker()
1141 throw (RuntimeException)
1143 return new testtools::bridgetest::CurrentContextChecker;
1146 // XServiceInfo
1147 //__________________________________________________________________________________________________
1148 OUString Test_Impl::getImplementationName()
1149 throw (RuntimeException)
1151 return OUString( IMPLNAME );
1153 //__________________________________________________________________________________________________
1154 sal_Bool Test_Impl::supportsService( const OUString & rServiceName )
1155 throw (RuntimeException)
1157 const Sequence< OUString > & rSNL = getSupportedServiceNames();
1158 const OUString * pArray = rSNL.getConstArray();
1159 for ( sal_Int32 nPos = rSNL.getLength(); nPos--; )
1161 if (pArray[nPos] == rServiceName)
1162 return sal_True;
1164 return sal_False;
1166 //__________________________________________________________________________________________________
1167 Sequence< OUString > Test_Impl::getSupportedServiceNames()
1168 throw (RuntimeException)
1170 return bridge_object::getSupportedServiceNames();
1173 // ...
1175 //==================================================================================================
1176 static Reference< XInterface > SAL_CALL Test_Impl_create(
1177 SAL_UNUSED_PARAMETER const Reference< XMultiServiceFactory > & )
1179 return Reference< XInterface >( (XBridgeTest *)new Test_Impl() );
1184 extern "C"
1186 SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
1187 const sal_Char * pImplName, SAL_UNUSED_PARAMETER void * pServiceManager,
1188 SAL_UNUSED_PARAMETER void * )
1190 void * pRet = 0;
1192 if (pServiceManager && rtl_str_compare( pImplName, IMPLNAME ) == 0)
1194 Reference< XSingleServiceFactory > xFactory( createSingleFactory(
1195 reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
1196 OUString( IMPLNAME ),
1197 bridge_object::Test_Impl_create,
1198 bridge_object::getSupportedServiceNames() ) );
1200 if (xFactory.is())
1202 xFactory->acquire();
1203 pRet = xFactory.get();
1207 return pRet;
1211 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */