update dev300-m58
[ooovba.git] / testtools / source / bridgetest / cppobj.cxx
blob6fa8e48e748d1f0b9549bc675cae6c14834baeff
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cppobj.cxx,v $
10 * $Revision: 1.15 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_testtools.hxx"
33 #include <stdio.h>
35 #include "cppu/unotype.hxx"
36 #include <osl/diagnose.h>
37 #include "osl/diagnose.hxx"
38 #include <osl/thread.h>
39 #include <osl/mutex.hxx>
40 #include <osl/time.h>
42 #include <cppuhelper/implbase3.hxx>
43 #include <cppuhelper/factory.hxx>
44 #include "cppuhelper/exc_hlp.hxx"
45 #include "cppuhelper/compbase_ex.hxx"
46 #include <com/sun/star/lang/XServiceInfo.hpp>
47 #include <com/sun/star/lang/XComponent.hpp>
48 #include <com/sun/star/registry/XRegistryKey.hpp>
49 #include "com/sun/star/uno/Any.hxx"
50 #include "com/sun/star/uno/RuntimeException.hpp"
51 #include "com/sun/star/uno/Sequence.hxx"
53 #include "test/testtools/bridgetest/Constructors.hpp"
54 #include "test/testtools/bridgetest/Constructors2.hpp"
55 #include "test/testtools/bridgetest/TestPolyStruct.hpp"
56 #include "test/testtools/bridgetest/TestPolyStruct2.hpp"
57 #include "test/testtools/bridgetest/XBridgeTest2.hpp"
58 #include "test/testtools/bridgetest/XMulti.hpp"
60 #include "currentcontextchecker.hxx"
61 #include "multi.hxx"
63 using namespace rtl;
64 using namespace osl;
65 using namespace cppu;
66 using namespace com::sun::star::uno;
67 using namespace com::sun::star::lang;
68 using namespace com::sun::star::registry;
69 using namespace test::testtools::bridgetest;
71 #define SERVICENAME "com.sun.star.test.bridge.CppTestObject"
72 #define IMPLNAME "com.sun.star.comp.bridge.CppTestObject"
74 namespace bridge_object
77 //--------------------------------------------------------------------------------------------------
78 inline static Sequence< OUString > getSupportedServiceNames()
80 OUString aName( RTL_CONSTASCII_USTRINGPARAM(SERVICENAME) );
81 return Sequence< OUString >( &aName, 1 );
84 //==================================================================================================
85 static void assign( TestElement & rData,
86 sal_Bool bBool, sal_Unicode cChar, sal_Int8 nByte,
87 sal_Int16 nShort, sal_uInt16 nUShort,
88 sal_Int32 nLong, sal_uInt32 nULong,
89 sal_Int64 nHyper, sal_uInt64 nUHyper,
90 float fFloat, double fDouble,
91 TestEnum eEnum, const ::rtl::OUString& rStr,
92 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest,
93 const ::com::sun::star::uno::Any& rAny )
95 rData.Bool = bBool;
96 rData.Char = cChar;
97 rData.Byte = nByte;
98 rData.Short = nShort;
99 rData.UShort = nUShort;
100 rData.Long = nLong;
101 rData.ULong = nULong;
102 rData.Hyper = nHyper;
103 rData.UHyper = nUHyper;
104 rData.Float = fFloat;
105 rData.Double = fDouble;
106 rData.Enum = eEnum;
107 rData.String = rStr;
108 rData.Interface = xTest;
109 rData.Any = rAny;
111 //==================================================================================================
112 static void assign( TestData & rData,
113 sal_Bool bBool, sal_Unicode cChar, sal_Int8 nByte,
114 sal_Int16 nShort, sal_uInt16 nUShort,
115 sal_Int32 nLong, sal_uInt32 nULong,
116 sal_Int64 nHyper, sal_uInt64 nUHyper,
117 float fFloat, double fDouble,
118 TestEnum eEnum, const ::rtl::OUString& rStr,
119 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest,
120 const ::com::sun::star::uno::Any& rAny,
121 const com::sun::star::uno::Sequence< TestElement >& rSequence )
123 assign( (TestElement &)rData,
124 bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper, nUHyper, fFloat, fDouble,
125 eEnum, rStr, xTest, rAny );
126 rData.Sequence = rSequence;
129 //==================================================================================================
130 class Test_Impl :
131 protected osl::DebugBase<Test_Impl>,
132 public WeakImplHelper3< XBridgeTest2, XServiceInfo , XRecursiveCall >
134 TestData _aData, _aStructData;
135 sal_Int32 m_nLastCallId;
136 sal_Bool m_bFirstCall;
137 sal_Bool m_bSequenceOfCallTestPassed;
138 Mutex m_mutex;
140 Sequence<sal_Bool> _arBool;
141 Sequence<sal_Unicode> _arChar;
142 Sequence<sal_Int8> _arByte;
143 Sequence<sal_Int16> _arShort;
144 Sequence<sal_uInt16> _arUShort;
145 Sequence<sal_Int32> _arLong;
146 Sequence<sal_uInt32> _arULong;
147 Sequence<sal_Int64> _arHyper;
148 Sequence<sal_uInt64> _arUHyper;
149 Sequence<OUString> _arString;
150 Sequence<float> _arFloat;
151 Sequence<double> _arDouble;
152 Sequence<TestEnum> _arEnum;
153 Sequence<Reference<XInterface> > _arObject;
154 Sequence<Sequence<sal_Int32> > _arLong2;
155 Sequence<Sequence<Sequence<sal_Int32> > > _arLong3;
156 Sequence<Any> _arAny;
157 Sequence<TestElement> _arStruct;
159 public:
160 Test_Impl() : m_nLastCallId( 0 ),
161 m_bFirstCall( sal_True ),
162 m_bSequenceOfCallTestPassed( sal_True )
164 virtual ~Test_Impl()
166 OSL_TRACE( "> scalar Test_Impl dtor <\n" );
169 void SAL_CALL acquire() throw ()
171 OWeakObject::acquire();
173 void SAL_CALL release() throw ()
175 OWeakObject::release();
178 // XServiceInfo
179 virtual OUString SAL_CALL getImplementationName() throw (RuntimeException);
180 virtual sal_Bool SAL_CALL supportsService( const OUString & rServiceName ) throw (RuntimeException);
181 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw (RuntimeException);
183 // XLBTestBase
184 virtual void SAL_CALL setValues( sal_Bool bBool, sal_Unicode cChar, sal_Int8 nByte,
185 sal_Int16 nShort, sal_uInt16 nUShort,
186 sal_Int32 nLong, sal_uInt32 nULong,
187 sal_Int64 nHyper, sal_uInt64 nUHyper,
188 float fFloat, double fDouble,
189 TestEnum eEnum, const ::rtl::OUString& rStr,
190 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest,
191 const ::com::sun::star::uno::Any& rAny,
192 const ::com::sun::star::uno::Sequence<TestElement >& rSequence,
193 const TestData& rStruct )
194 throw(com::sun::star::uno::RuntimeException);
196 virtual TestData SAL_CALL setValues2( sal_Bool& bBool, sal_Unicode& cChar, sal_Int8& nByte,
197 sal_Int16& nShort, sal_uInt16& nUShort,
198 sal_Int32& nLong, sal_uInt32& nULong,
199 sal_Int64& nHyper, sal_uInt64& nUHyper,
200 float& fFloat, double& fDouble,
201 TestEnum& eEnum, rtl::OUString& rStr,
202 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest,
203 ::com::sun::star::uno::Any& rAny,
204 ::com::sun::star::uno::Sequence<TestElement >& rSequence,
205 TestData& rStruct )
206 throw(com::sun::star::uno::RuntimeException);
208 virtual TestData SAL_CALL getValues( sal_Bool& bBool, sal_Unicode& cChar, sal_Int8& nByte,
209 sal_Int16& nShort, sal_uInt16& nUShort,
210 sal_Int32& nLong, sal_uInt32& nULong,
211 sal_Int64& nHyper, sal_uInt64& nUHyper,
212 float& fFloat, double& fDouble,
213 TestEnum& eEnum, rtl::OUString& rStr,
214 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest,
215 ::com::sun::star::uno::Any& rAny,
216 ::com::sun::star::uno::Sequence< TestElement >& rSequence,
217 TestData& rStruct )
218 throw(com::sun::star::uno::RuntimeException);
220 virtual sal_Bool SAL_CALL getBool() throw(com::sun::star::uno::RuntimeException)
221 { return _aData.Bool; }
222 virtual sal_Int8 SAL_CALL getByte() throw(com::sun::star::uno::RuntimeException)
223 { return _aData.Byte; }
224 virtual sal_Unicode SAL_CALL getChar() throw(com::sun::star::uno::RuntimeException)
225 { return _aData.Char; }
226 virtual sal_Int16 SAL_CALL getShort() throw(com::sun::star::uno::RuntimeException)
227 { return _aData.Short; }
228 virtual sal_uInt16 SAL_CALL getUShort() throw(com::sun::star::uno::RuntimeException)
229 { return _aData.UShort; }
230 virtual sal_Int32 SAL_CALL getLong() throw(com::sun::star::uno::RuntimeException)
231 { return _aData.Long; }
232 virtual sal_uInt32 SAL_CALL getULong() throw(com::sun::star::uno::RuntimeException)
233 { return _aData.ULong; }
234 virtual sal_Int64 SAL_CALL getHyper() throw(com::sun::star::uno::RuntimeException)
235 { return _aData.Hyper; }
236 virtual sal_uInt64 SAL_CALL getUHyper() throw(com::sun::star::uno::RuntimeException)
237 { return _aData.UHyper; }
238 virtual float SAL_CALL getFloat() throw(com::sun::star::uno::RuntimeException)
239 { return _aData.Float; }
240 virtual double SAL_CALL getDouble() throw(com::sun::star::uno::RuntimeException)
241 { return _aData.Double; }
242 virtual TestEnum SAL_CALL getEnum() throw(com::sun::star::uno::RuntimeException)
243 { return _aData.Enum; }
244 virtual rtl::OUString SAL_CALL getString() throw(com::sun::star::uno::RuntimeException)
245 { return _aData.String; }
246 virtual com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getInterface( ) throw(com::sun::star::uno::RuntimeException)
247 { return _aData.Interface; }
248 virtual com::sun::star::uno::Any SAL_CALL getAny() throw(com::sun::star::uno::RuntimeException)
249 { return _aData.Any; }
250 virtual com::sun::star::uno::Sequence< TestElement > SAL_CALL getSequence() throw(com::sun::star::uno::RuntimeException)
251 { return _aData.Sequence; }
252 virtual TestData SAL_CALL getStruct() throw(com::sun::star::uno::RuntimeException)
253 { return _aStructData; }
255 virtual void SAL_CALL setBool( sal_Bool _bool ) throw(::com::sun::star::uno::RuntimeException)
256 { _aData.Bool = _bool; }
257 virtual void SAL_CALL setByte( sal_Int8 _byte ) throw(::com::sun::star::uno::RuntimeException)
258 { _aData.Byte = _byte; }
259 virtual void SAL_CALL setChar( sal_Unicode _char ) throw(::com::sun::star::uno::RuntimeException)
260 { _aData.Char = _char; }
261 virtual void SAL_CALL setShort( sal_Int16 _short ) throw(::com::sun::star::uno::RuntimeException)
262 { _aData.Short = _short; }
263 virtual void SAL_CALL setUShort( sal_uInt16 _ushort ) throw(::com::sun::star::uno::RuntimeException)
264 { _aData.UShort = _ushort; }
265 virtual void SAL_CALL setLong( sal_Int32 _long ) throw(::com::sun::star::uno::RuntimeException)
266 { _aData.Long = _long; }
267 virtual void SAL_CALL setULong( sal_uInt32 _ulong ) throw(::com::sun::star::uno::RuntimeException)
268 { _aData.ULong = _ulong; }
269 virtual void SAL_CALL setHyper( sal_Int64 _hyper ) throw(::com::sun::star::uno::RuntimeException)
270 { _aData.Hyper = _hyper; }
271 virtual void SAL_CALL setUHyper( sal_uInt64 _uhyper ) throw(::com::sun::star::uno::RuntimeException)
272 { _aData.UHyper = _uhyper; }
273 virtual void SAL_CALL setFloat( float _float ) throw(::com::sun::star::uno::RuntimeException)
274 { _aData.Float = _float; }
275 virtual void SAL_CALL setDouble( double _double ) throw(::com::sun::star::uno::RuntimeException)
276 { _aData.Double = _double; }
277 virtual void SAL_CALL setEnum( TestEnum _enum ) throw(::com::sun::star::uno::RuntimeException)
278 { _aData.Enum = _enum; }
279 virtual void SAL_CALL setString( const ::rtl::OUString& _string ) throw(::com::sun::star::uno::RuntimeException)
280 { _aData.String = _string; }
281 virtual void SAL_CALL setInterface( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _interface ) throw(::com::sun::star::uno::RuntimeException)
282 { _aData.Interface = _interface; }
283 virtual void SAL_CALL setAny( const ::com::sun::star::uno::Any& _any ) throw(::com::sun::star::uno::RuntimeException)
284 { _aData.Any = _any; }
285 virtual void SAL_CALL setSequence( const ::com::sun::star::uno::Sequence<TestElement >& _sequence ) throw(::com::sun::star::uno::RuntimeException)
286 { _aData.Sequence = _sequence; }
287 virtual void SAL_CALL setStruct( const TestData& _struct ) throw(::com::sun::star::uno::RuntimeException)
288 { _aStructData = _struct; }
290 virtual sal_Int32 SAL_CALL getRaiseAttr1() throw (RuntimeException)
291 { throw RuntimeException(); }
293 virtual void SAL_CALL setRaiseAttr1(sal_Int32)
294 throw (IllegalArgumentException, RuntimeException)
295 { throw IllegalArgumentException(); }
297 virtual sal_Int32 SAL_CALL getRaiseAttr2()
298 throw (IllegalArgumentException, RuntimeException)
299 { throw IllegalArgumentException(); }
301 virtual TestPolyStruct< sal_Bool > SAL_CALL transportPolyBoolean(
302 TestPolyStruct< sal_Bool > const & arg) throw (RuntimeException)
303 { return arg; }
305 virtual void SAL_CALL transportPolyHyper(TestPolyStruct< sal_Int64 > &)
306 throw (RuntimeException) {}
308 virtual void SAL_CALL transportPolySequence(
309 TestPolyStruct< Sequence< Any > > const & arg1,
310 TestPolyStruct< Sequence< Any > > & arg2) throw (RuntimeException)
311 { arg2 = arg1; }
313 virtual TestPolyStruct< sal_Int32 > SAL_CALL getNullPolyLong()
314 throw (RuntimeException)
315 { return TestPolyStruct< sal_Int32 >(0); /* work around MS compiler bug */ }
317 virtual TestPolyStruct< rtl::OUString > SAL_CALL getNullPolyString()
318 throw (RuntimeException)
319 { return TestPolyStruct< rtl::OUString >(); }
321 virtual TestPolyStruct< Type > SAL_CALL getNullPolyType()
322 throw (RuntimeException)
323 { return TestPolyStruct< Type >(); }
325 virtual TestPolyStruct< Any > SAL_CALL getNullPolyAny()
326 throw (RuntimeException)
327 { return TestPolyStruct< Any >(); }
329 virtual TestPolyStruct< Sequence< sal_Bool > > SAL_CALL
330 getNullPolySequence() throw (RuntimeException)
331 { return TestPolyStruct< Sequence< sal_Bool > >(); }
333 virtual TestPolyStruct< TestEnum > SAL_CALL getNullPolyEnum()
334 throw (RuntimeException)
335 { return TestPolyStruct< TestEnum >(
336 test::testtools::bridgetest::TestEnum_TEST);
337 /* work around MS compiler bug */ }
339 virtual TestPolyStruct< TestBadEnum > SAL_CALL getNullPolyBadEnum()
340 throw (RuntimeException)
341 { return TestPolyStruct< TestBadEnum >(
342 test::testtools::bridgetest::TestBadEnum_M);
343 /* explicitly instantiate with default enumerator */ }
345 virtual TestPolyStruct< TestStruct > SAL_CALL getNullPolyStruct()
346 throw (RuntimeException)
347 { return TestPolyStruct< TestStruct >(); }
349 virtual TestPolyStruct< Reference< XBridgeTestBase > > SAL_CALL
350 getNullPolyInterface() throw (RuntimeException)
351 { return TestPolyStruct< Reference< XBridgeTestBase > >(); }
353 virtual ::com::sun::star::uno::Any SAL_CALL transportAny(
354 const ::com::sun::star::uno::Any& value )
355 throw(::com::sun::star::uno::RuntimeException);
357 virtual void SAL_CALL call( sal_Int32 nCallId, sal_Int32 nWaitMUSEC )
358 throw(::com::sun::star::uno::RuntimeException);
359 virtual void SAL_CALL callOneway( sal_Int32 nCallId, sal_Int32 nWaitMUSEC )
360 throw(::com::sun::star::uno::RuntimeException);
361 virtual sal_Bool SAL_CALL sequenceOfCallTestPassed( )
362 throw(::com::sun::star::uno::RuntimeException);
363 virtual void SAL_CALL startRecursiveCall(
364 const ::com::sun::star::uno::Reference< XRecursiveCall >& xCall, sal_Int32 nToCall )
365 throw(::com::sun::star::uno::RuntimeException);
367 virtual Reference< XMulti > SAL_CALL getMulti() throw (RuntimeException);
369 virtual rtl::OUString SAL_CALL testMulti(Reference< XMulti > const & multi)
370 throw (RuntimeException);
372 public: // XBridgeTest
373 virtual TestData SAL_CALL raiseException( sal_Int16 nArgumentPos, const OUString & rMsg, const Reference< XInterface > & xCOntext )
374 throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
376 virtual void SAL_CALL raiseRuntimeExceptionOneway(
377 const ::rtl::OUString& Message, const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Context )
378 throw(::com::sun::star::uno::RuntimeException);
380 virtual sal_Int32 SAL_CALL getRuntimeException() throw(::com::sun::star::uno::RuntimeException);
381 virtual void SAL_CALL setRuntimeException( sal_Int32 _runtimeexception ) throw(::com::sun::star::uno::RuntimeException);
383 // XBridgeTest2
384 virtual Sequence< sal_Bool > SAL_CALL setSequenceBool(
385 const Sequence< sal_Bool >& aSeq ) throw (RuntimeException);
386 virtual Sequence< sal_Unicode > SAL_CALL setSequenceChar(
387 const Sequence< sal_Unicode >& aSeq ) throw (RuntimeException);
388 virtual Sequence< sal_Int8 > SAL_CALL setSequenceByte(
389 const Sequence< sal_Int8 >& aSeq ) throw (RuntimeException);
390 virtual Sequence< sal_Int16 > SAL_CALL setSequenceShort(
391 const Sequence< sal_Int16 >& aSeq ) throw (RuntimeException);
392 virtual Sequence< sal_uInt16 > SAL_CALL setSequenceUShort(
393 const Sequence< sal_uInt16 >& aSeq ) throw (RuntimeException);
394 virtual Sequence< sal_Int32 > SAL_CALL setSequenceLong(
395 const Sequence< sal_Int32 >& aSeq ) throw (RuntimeException);
396 virtual Sequence< sal_uInt32 > SAL_CALL setSequenceULong(
397 const Sequence< sal_uInt32 >& aSeq ) throw (RuntimeException);
398 virtual Sequence< sal_Int64 > SAL_CALL setSequenceHyper(
399 const Sequence< sal_Int64 >& aSeq ) throw (RuntimeException);
400 virtual Sequence< sal_uInt64 > SAL_CALL setSequenceUHyper(
401 const Sequence< sal_uInt64 >& aSeq ) throw (RuntimeException);
402 virtual Sequence< float > SAL_CALL setSequenceFloat(
403 const Sequence< float >& aSeq ) throw (RuntimeException);
404 virtual Sequence< double > SAL_CALL setSequenceDouble(
405 const Sequence< double >& aSeq ) throw (RuntimeException);
406 virtual Sequence< TestEnum > SAL_CALL setSequenceEnum(
407 const Sequence< TestEnum >& aSeq ) throw (RuntimeException) ;
408 virtual Sequence< OUString > SAL_CALL setSequenceString(
409 const Sequence< OUString >& aString ) throw (RuntimeException);
410 virtual Sequence< Reference< XInterface > > SAL_CALL setSequenceXInterface(
411 const Sequence< Reference< XInterface > >& aSeq )
412 throw (RuntimeException);
413 virtual Sequence<Any > SAL_CALL setSequenceAny(
414 const Sequence<Any >& aSeq ) throw (RuntimeException);
415 virtual Sequence<TestElement > SAL_CALL setSequenceStruct(
416 const Sequence< TestElement >& aSeq ) throw (RuntimeException);
417 virtual Sequence< Sequence< sal_Int32 > > SAL_CALL setDim2(
418 const Sequence<Sequence< sal_Int32 > >& aSeq ) throw (RuntimeException);
419 virtual Sequence< Sequence< Sequence< sal_Int32 > > > SAL_CALL setDim3(
420 const Sequence< Sequence< Sequence< sal_Int32 > > >& aSeq )
421 throw (RuntimeException);
422 virtual void SAL_CALL setSequencesInOut(Sequence< sal_Bool >& aSeqBoolean,
423 Sequence< sal_Unicode >& aSeqChar,
424 Sequence< sal_Int8 >& aSeqByte,
425 Sequence< sal_Int16 >& aSeqShort,
426 Sequence< sal_uInt16 >& aSeqUShort,
427 Sequence< sal_Int32 >& aSeqLong,
428 Sequence< sal_uInt32 >& aSeqULong,
429 Sequence< sal_Int64 >& aSeqHyper,
430 Sequence< sal_uInt64 >& aSeqUHyper,
431 Sequence< float >& aSeqFloat,
432 Sequence< double >& aSeqDouble,
433 Sequence< TestEnum >& aSeqTestEnum,
434 Sequence< OUString >& aSeqString,
435 Sequence<Reference<XInterface > >& aSeqXInterface,
436 Sequence< Any >& aSeqAny,
437 Sequence< Sequence< sal_Int32 > >& aSeqDim2,
438 Sequence< Sequence< Sequence< sal_Int32 > > >& aSeqDim3 )
439 throw (RuntimeException);
440 virtual void SAL_CALL setSequencesOut( Sequence< sal_Bool >& aSeqBoolean,
441 Sequence< sal_Unicode >& aSeqChar,
442 Sequence< sal_Int8 >& aSeqByte,
443 Sequence< sal_Int16 >& aSeqShort,
444 Sequence< sal_uInt16 >& aSeqUShort,
445 Sequence< sal_Int32 >& aSeqLong,
446 Sequence< sal_uInt32 >& aSeqULong,
447 Sequence< sal_Int64 >& aSeqHyper,
448 Sequence< sal_uInt64 >& aSeqUHyper,
449 Sequence< float >& aSeqFloat,
450 Sequence< double >& aSeqDouble,
451 Sequence< TestEnum >& aSeqEnum,
452 Sequence< OUString >& aSeqString,
453 Sequence< Reference< XInterface > >& aSeqXInterface,
454 Sequence< Any >& aSeqAny,
455 Sequence< Sequence< sal_Int32 > >& aSeqDim2,
456 Sequence< Sequence< Sequence< sal_Int32 > > >& aSeqDim3 )
457 throw (RuntimeException);
458 virtual void SAL_CALL testConstructorsService(
459 Reference< XComponentContext > const & context)
460 throw (RuntimeException);
461 virtual Reference< XCurrentContextChecker > SAL_CALL
462 getCurrentContextChecker()
463 throw (RuntimeException);
465 public:
466 virtual void SAL_CALL callRecursivly( const ::com::sun::star::uno::Reference< XRecursiveCall >& xCall, sal_Int32 nToCall ) throw(::com::sun::star::uno::RuntimeException);
469 //Dummy class for XComponent implementation
470 class Dummy : protected osl::DebugBase<Dummy>,
471 public WeakComponentImplHelperBase
473 public:
474 Dummy(): WeakComponentImplHelperBase(*Mutex::getGlobalMutex()){}
477 //__________________________________________________________________________________________________
478 Any Test_Impl::transportAny( const Any & value ) throw ( ::com::sun::star::uno::RuntimeException)
480 return value;
483 //__________________________________________________________________________________________________
484 void Test_Impl::call( sal_Int32 nCallId , sal_Int32 nWaitMUSEC ) throw(::com::sun::star::uno::RuntimeException)
486 TimeValue value = { nWaitMUSEC / 1000000 , nWaitMUSEC * 1000 };
487 osl_waitThread( &value );
488 if( m_bFirstCall )
490 m_bFirstCall = sal_False;
492 else
494 m_bSequenceOfCallTestPassed = m_bSequenceOfCallTestPassed && (nCallId > m_nLastCallId);
496 m_nLastCallId = nCallId;
499 //__________________________________________________________________________________________________
500 void Test_Impl::callOneway( sal_Int32 nCallId , sal_Int32 nWaitMUSEC ) throw (::com::sun::star::uno::RuntimeException)
502 TimeValue value = { nWaitMUSEC / 1000000 , nWaitMUSEC * 1000 };
503 osl_waitThread( &value );
504 m_bSequenceOfCallTestPassed = m_bSequenceOfCallTestPassed && (nCallId > m_nLastCallId);
505 m_nLastCallId = nCallId;
508 //__________________________________________________________________________________________________
509 sal_Bool Test_Impl::sequenceOfCallTestPassed() throw (::com::sun::star::uno::RuntimeException)
511 return m_bSequenceOfCallTestPassed;
514 //__________________________________________________________________________________________________
515 void SAL_CALL Test_Impl::startRecursiveCall(
516 const ::com::sun::star::uno::Reference< XRecursiveCall >& xCall, sal_Int32 nToCall )
517 throw(::com::sun::star::uno::RuntimeException)
519 MutexGuard guard( m_mutex );
520 if( nToCall )
522 nToCall --;
523 xCall->callRecursivly( this , nToCall );
528 void SAL_CALL Test_Impl::callRecursivly(
529 const ::com::sun::star::uno::Reference< XRecursiveCall >& xCall,
530 sal_Int32 nToCall )
531 throw(::com::sun::star::uno::RuntimeException)
533 MutexGuard guard( m_mutex );
534 if( nToCall )
536 nToCall --;
537 xCall->callRecursivly( this , nToCall );
541 Reference< XMulti > Test_Impl::getMulti() throw (RuntimeException) {
542 return new testtools::bridgetest::Multi;
545 rtl::OUString Test_Impl::testMulti(Reference< XMulti > const & multi)
546 throw (RuntimeException)
548 return testtools::bridgetest::testMulti(multi);
551 //__________________________________________________________________________________________________
552 void Test_Impl::setValues( sal_Bool bBool, sal_Unicode cChar, sal_Int8 nByte,
553 sal_Int16 nShort, sal_uInt16 nUShort,
554 sal_Int32 nLong, sal_uInt32 nULong,
555 sal_Int64 nHyper, sal_uInt64 nUHyper,
556 float fFloat, double fDouble,
557 TestEnum eEnum, const ::rtl::OUString& rStr,
558 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest,
559 const ::com::sun::star::uno::Any& rAny,
560 const ::com::sun::star::uno::Sequence<TestElement >& rSequence,
561 const TestData& rStruct )
562 throw(com::sun::star::uno::RuntimeException)
564 assign( _aData,
565 bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper, nUHyper, fFloat, fDouble,
566 eEnum, rStr, xTest, rAny, rSequence );
567 _aStructData = rStruct;
569 //__________________________________________________________________________________________________
570 TestData Test_Impl::setValues2( sal_Bool& bBool, sal_Unicode& cChar, sal_Int8& nByte,
571 sal_Int16& nShort, sal_uInt16& nUShort,
572 sal_Int32& nLong, sal_uInt32& nULong,
573 sal_Int64& nHyper, sal_uInt64& nUHyper,
574 float& fFloat, double& fDouble,
575 TestEnum& eEnum, rtl::OUString& rStr,
576 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest,
577 ::com::sun::star::uno::Any& rAny,
578 ::com::sun::star::uno::Sequence<TestElement >& rSequence,
579 TestData& rStruct )
580 throw(com::sun::star::uno::RuntimeException)
582 assign( _aData,
583 bBool, cChar, nByte, nShort, nUShort, nLong, nULong, nHyper, nUHyper, fFloat, fDouble,
584 eEnum, rStr, xTest, rAny, rSequence );
585 _aStructData = rStruct;
587 TestElement elem = rSequence[ 0 ];
588 rSequence[ 0 ] = rSequence[ 1 ];
589 rSequence[ 1 ] = elem;
591 return _aStructData;
593 //__________________________________________________________________________________________________
594 TestData Test_Impl::getValues( sal_Bool& bBool, sal_Unicode& cChar, sal_Int8& nByte,
595 sal_Int16& nShort, sal_uInt16& nUShort,
596 sal_Int32& nLong, sal_uInt32& nULong,
597 sal_Int64& nHyper, sal_uInt64& nUHyper,
598 float& fFloat, double& fDouble,
599 TestEnum& eEnum, rtl::OUString& rStr,
600 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xTest,
601 ::com::sun::star::uno::Any& rAny,
602 ::com::sun::star::uno::Sequence<TestElement >& rSequence,
603 TestData& rStruct )
604 throw(com::sun::star::uno::RuntimeException)
606 bBool = _aData.Bool;
607 cChar = _aData.Char;
608 nByte = _aData.Byte;
609 nShort = _aData.Short;
610 nUShort = _aData.UShort;
611 nLong = _aData.Long;
612 nULong = _aData.ULong;
613 nHyper = _aData.Hyper;
614 nUHyper = _aData.UHyper;
615 fFloat = _aData.Float;
616 fDouble = _aData.Double;
617 eEnum = _aData.Enum;
618 rStr = _aData.String;
619 xTest = _aData.Interface;
620 rAny = _aData.Any;
621 rSequence = _aData.Sequence;
622 rStruct = _aStructData;
623 return _aStructData;
625 //__________________________________________________________________________________________________
626 TestData Test_Impl::raiseException( sal_Int16 nArgumentPos, const OUString & rMsg, const Reference< XInterface > & xContext )
627 throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
629 IllegalArgumentException aExc;
630 aExc.ArgumentPosition = nArgumentPos;
631 aExc.Message = _aData.String = rMsg;
632 aExc.Context = _aData.Interface = xContext;
633 throw aExc;
636 void Test_Impl::raiseRuntimeExceptionOneway( const OUString & rMsg, const Reference< XInterface > & xContext )
637 throw(::com::sun::star::uno::RuntimeException)
639 RuntimeException aExc;
640 aExc.Message = _aData.String = rMsg;
641 aExc.Context = _aData.Interface = xContext;
642 throw aExc;
645 void dothrow2( RuntimeException e )
647 throw e;
649 void dothrow( RuntimeException const & e )
651 #if defined _MSC_VER
652 // currently only for MSVC:
653 // just to test whether all bridges fall back to a RuntimeException
654 // in case of a thrown non-UNO exception:
657 throw ::std::bad_alloc();
659 catch (...)
663 Any a( getCaughtException() );
664 RuntimeException exc;
665 OSL_VERIFY( a >>= exc );
666 OSL_TRACE(
667 OUStringToOString(
668 exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
670 catch (...) // never throws anything
672 fprintf( stderr, "\ngetCaughtException() failed!\n" );
673 exit( 1 );
676 #endif
677 dothrow2( e );
679 //______________________________________________________________________________
680 sal_Int32 Test_Impl::getRuntimeException()
681 throw (RuntimeException)
685 dothrow( RuntimeException( _aData.String, _aData.Interface ) );
687 catch (Exception &)
689 Any a( getCaughtException() );
690 throwException( a );
692 return 0; // for dummy
694 //__________________________________________________________________________________________________
695 void Test_Impl::setRuntimeException( sal_Int32 ) throw(::com::sun::star::uno::RuntimeException)
697 RuntimeException aExc;
698 aExc.Message = _aData.String;
699 aExc.Context = _aData.Interface;
700 throwException( makeAny( aExc ) );
703 // XBridgeTest2 -------------------------------------------------------------
704 Sequence< sal_Bool > SAL_CALL Test_Impl::setSequenceBool(
705 const Sequence< sal_Bool >& aSeq ) throw (RuntimeException)
707 _arBool = aSeq;
708 return aSeq;
711 Sequence< sal_Unicode > SAL_CALL Test_Impl::setSequenceChar(
712 const Sequence< sal_Unicode >& aSeq ) throw (RuntimeException)
714 _arChar = aSeq;
715 return aSeq;
718 Sequence< sal_Int8 > SAL_CALL Test_Impl::setSequenceByte(
719 const Sequence< sal_Int8 >& aSeq ) throw (RuntimeException)
721 _arByte = aSeq;
722 return aSeq;
725 Sequence< sal_Int16 > SAL_CALL Test_Impl::setSequenceShort(
726 const Sequence< sal_Int16 >& aSeq ) throw (RuntimeException)
728 _arShort = aSeq;
729 return aSeq;
732 Sequence< sal_uInt16 > SAL_CALL Test_Impl::setSequenceUShort(
733 const Sequence< sal_uInt16 >& aSeq ) throw (RuntimeException)
735 _arUShort = aSeq;
736 return aSeq;
739 Sequence< sal_Int32 > SAL_CALL Test_Impl::setSequenceLong(
740 const Sequence< sal_Int32 >& aSeq ) throw (RuntimeException)
742 _arLong = aSeq;
743 return aSeq;
746 Sequence< sal_uInt32 > SAL_CALL Test_Impl::setSequenceULong(
747 const Sequence< sal_uInt32 >& aSeq ) throw (RuntimeException)
749 _arULong = aSeq;
750 return aSeq;
753 Sequence< sal_Int64 > SAL_CALL Test_Impl::setSequenceHyper(
754 const Sequence< sal_Int64 >& aSeq ) throw (RuntimeException)
756 _arHyper = aSeq;
757 return aSeq;
760 Sequence< sal_uInt64 > SAL_CALL Test_Impl::setSequenceUHyper(
761 const Sequence< sal_uInt64 >& aSeq ) throw (RuntimeException)
763 _arUHyper = aSeq;
764 return aSeq;
767 Sequence< float > SAL_CALL Test_Impl::setSequenceFloat(
768 const Sequence< float >& aSeq ) throw (RuntimeException)
770 _arFloat = aSeq;
771 return aSeq;
774 Sequence< double > SAL_CALL Test_Impl::setSequenceDouble(
775 const Sequence< double >& aSeq ) throw (RuntimeException)
777 _arDouble = aSeq;
778 return aSeq;
781 Sequence< TestEnum > SAL_CALL Test_Impl::setSequenceEnum(
782 const Sequence< TestEnum >& aSeq ) throw (RuntimeException)
784 _arEnum = aSeq;
785 return aSeq;
788 Sequence< OUString > SAL_CALL Test_Impl::setSequenceString(
789 const Sequence< OUString >& aSeq ) throw (RuntimeException)
791 _arString = aSeq;
792 return aSeq;
795 Sequence< Reference< XInterface > > SAL_CALL Test_Impl::setSequenceXInterface(
796 const Sequence< Reference< XInterface > >& aSeq )
797 throw (RuntimeException)
799 _arObject = aSeq;
800 return aSeq;
803 Sequence<Any > SAL_CALL Test_Impl::setSequenceAny(
804 const Sequence<Any >& aSeq ) throw (RuntimeException)
806 _arAny = aSeq;
807 return aSeq;
810 Sequence<TestElement > SAL_CALL Test_Impl::setSequenceStruct(
811 const Sequence< TestElement >& aSeq ) throw (RuntimeException)
813 _arStruct = aSeq;
814 return aSeq;
817 Sequence< Sequence< sal_Int32 > > SAL_CALL Test_Impl::setDim2(
818 const Sequence<Sequence< sal_Int32 > >& aSeq ) throw (RuntimeException)
820 _arLong2 = aSeq;
821 return aSeq;
824 Sequence< Sequence< Sequence< sal_Int32 > > > SAL_CALL Test_Impl::setDim3(
825 const Sequence< Sequence< Sequence< sal_Int32 > > >& aSeq )
826 throw (RuntimeException)
828 _arLong3 = aSeq;
829 return aSeq;
832 void SAL_CALL Test_Impl::setSequencesInOut(Sequence< sal_Bool >& aSeqBoolean,
833 Sequence< sal_Unicode >& aSeqChar,
834 Sequence< sal_Int8 >& aSeqByte,
835 Sequence< sal_Int16 >& aSeqShort,
836 Sequence< sal_uInt16 >& aSeqUShort,
837 Sequence< sal_Int32 >& aSeqLong,
838 Sequence< sal_uInt32 >& aSeqULong,
839 Sequence< sal_Int64 >& aSeqHyper,
840 Sequence< sal_uInt64 >& aSeqUHyper,
841 Sequence< float >& aSeqFloat,
842 Sequence< double >& aSeqDouble,
843 Sequence< TestEnum >& aSeqTestEnum,
844 Sequence< OUString >& aSeqString,
845 Sequence<Reference<XInterface > >& aSeqXInterface,
846 Sequence< Any >& aSeqAny,
847 Sequence< Sequence< sal_Int32 > >& aSeqDim2,
848 Sequence< Sequence< Sequence< sal_Int32 > > >& aSeqDim3 )
849 throw (RuntimeException)
851 _arBool = aSeqBoolean;
852 _arChar = aSeqChar;
853 _arByte = aSeqByte;
854 _arShort = aSeqShort;
855 _arUShort = aSeqUShort;
856 _arLong = aSeqLong;
857 _arULong = aSeqULong;
858 _arHyper = aSeqHyper;
859 _arUHyper = aSeqUHyper;
860 _arFloat = aSeqFloat;
861 _arDouble = aSeqDouble;
862 _arEnum = aSeqTestEnum;
863 _arString = aSeqString;
864 _arObject = aSeqXInterface;
865 _arAny = aSeqAny;
866 _arLong2 = aSeqDim2;
867 _arLong3 = aSeqDim3;
870 void SAL_CALL Test_Impl::setSequencesOut( Sequence< sal_Bool >& aSeqBoolean,
871 Sequence< sal_Unicode >& aSeqChar,
872 Sequence< sal_Int8 >& aSeqByte,
873 Sequence< sal_Int16 >& aSeqShort,
874 Sequence< sal_uInt16 >& aSeqUShort,
875 Sequence< sal_Int32 >& aSeqLong,
876 Sequence< sal_uInt32 >& aSeqULong,
877 Sequence< sal_Int64 >& aSeqHyper,
878 Sequence< sal_uInt64 >& aSeqUHyper,
879 Sequence< float >& aSeqFloat,
880 Sequence< double >& aSeqDouble,
881 Sequence< TestEnum >& aSeqEnum,
882 Sequence< OUString >& aSeqString,
883 Sequence< Reference< XInterface > >& aSeqXInterface,
884 Sequence< Any >& aSeqAny,
885 Sequence< Sequence< sal_Int32 > >& aSeqDim2,
886 Sequence< Sequence< Sequence< sal_Int32 > > >& aSeqDim3 )
887 throw (RuntimeException)
889 aSeqBoolean = _arBool;
890 aSeqChar = _arChar;
891 aSeqByte = _arByte;
892 aSeqShort = _arShort;
893 aSeqUShort = _arUShort;
894 aSeqLong = _arLong;
895 aSeqULong = _arULong;
896 aSeqHyper = _arHyper;
897 aSeqUHyper = _arUHyper;
898 aSeqFloat = _arFloat;
899 aSeqDouble = _arDouble;
900 aSeqEnum = _arEnum;
901 aSeqString = _arString;
902 aSeqXInterface = _arObject;
903 aSeqAny = _arAny;
904 aSeqDim2 = _arLong2;
905 aSeqDim3 = _arLong3;
908 void Test_Impl::testConstructorsService(
909 Reference< XComponentContext > const & context) throw (RuntimeException)
911 Sequence< sal_Bool > arg14(1); arg14[0] = true;
912 Sequence< sal_Int8 > arg15(1); arg15[0] = SAL_MIN_INT8;
913 Sequence< sal_Int16 > arg16(1); arg16[0] = SAL_MIN_INT16;
914 Sequence< sal_uInt16 > arg17(1); arg17[0] = SAL_MAX_UINT16;
915 Sequence< sal_Int32 > arg18(1); arg18[0] = SAL_MIN_INT32;
916 Sequence< sal_uInt32 > arg19(1); arg19[0] = SAL_MAX_UINT32;
917 Sequence< sal_Int64 > arg20(1); arg20[0] = SAL_MIN_INT64;
918 Sequence< sal_uInt64 > arg21(1); arg21[0] = SAL_MAX_UINT64;
919 Sequence< float > arg22(1); arg22[0] = 0.123f;
920 Sequence< double > arg23(1); arg23[0] = 0.456;
921 Sequence< sal_Unicode > arg24(1); arg24[0] = 'X';
922 Sequence< OUString > arg25(1);
923 arg25[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("test"));
924 Sequence< Type > arg26(1); arg26[0] = UnoType< Any >::get();
925 Sequence< Any > arg27(1); arg27[0] <<= true;
926 Sequence< Sequence< sal_Bool > > arg28(1);
927 arg28[0] = Sequence< sal_Bool >(1); arg28[0][0] = true;
928 Sequence< Sequence< Any > > arg29(1); arg29[0] = Sequence< Any >(1);
929 arg29[0][0] <<= true;
930 Sequence< TestEnum > arg30(1); arg30[0] = TestEnum_TWO;
931 Sequence< TestStruct > arg31(1); arg31[0].member = 10;
932 Sequence< TestPolyStruct< sal_Bool > > arg32(1); arg32[0].member = true;
933 Sequence< TestPolyStruct< Any > > arg33(1); arg33[0].member <<= true;
934 Sequence< Reference< XInterface > > arg34(1);
935 Constructors::create1(context,
936 true,
937 SAL_MIN_INT8,
938 SAL_MIN_INT16,
939 SAL_MAX_UINT16,
940 SAL_MIN_INT32,
941 SAL_MAX_UINT32,
942 SAL_MIN_INT64,
943 SAL_MAX_UINT64,
944 0.123f,
945 0.456,
946 'X',
947 OUString(RTL_CONSTASCII_USTRINGPARAM("test")),
948 UnoType< Any >::get(),
949 makeAny(true),
950 arg14,
951 arg15,
952 arg16,
953 arg17,
954 arg18,
955 arg19,
956 arg20,
957 arg21,
958 arg22,
959 arg23,
960 arg24,
961 arg25,
962 arg26,
963 arg27,
964 arg28,
965 arg29,
966 arg30,
967 arg31,
968 arg32,
969 arg33,
970 arg34,
971 TestEnum_TWO,
972 TestStruct(10),
973 TestPolyStruct< sal_Bool >(true),
974 TestPolyStruct< Any >(makeAny(true)),
975 Reference< XInterface >(0));
976 Sequence< Any > args(40);
977 args[0] <<= true;
978 args[1] <<= SAL_MIN_INT8;
979 args[2] <<= SAL_MIN_INT16;
980 args[3] <<= SAL_MAX_UINT16;
981 args[4] <<= SAL_MIN_INT32;
982 args[5] <<= SAL_MAX_UINT32;
983 args[6] <<= SAL_MIN_INT64;
984 args[7] <<= SAL_MAX_UINT64;
985 args[8] <<= 0.123f;
986 args[9] <<= 0.456;
987 sal_Unicode arg10c = 'X';
988 args[10].setValue(&arg10c, UnoType< UnoCharType >::get());
989 args[11] <<= OUString(RTL_CONSTASCII_USTRINGPARAM("test"));
990 args[12] <<= UnoType< Any >::get();
991 args[13] <<= true;
992 args[14] <<= arg14;
993 args[15] <<= arg15;
994 args[16] <<= arg16;
995 args[17] <<= arg17;
996 args[18] <<= arg18;
997 args[19] <<= arg19;
998 args[20] <<= arg20;
999 args[21] <<= arg21;
1000 args[22] <<= arg22;
1001 args[23] <<= arg23;
1002 args[24].setValue(&arg24, UnoType< UnoSequenceType< UnoCharType > >::get());
1003 args[25] <<= arg25;
1004 args[26] <<= arg26;
1005 args[27] <<= arg27;
1006 args[28] <<= arg28;
1007 args[29] <<= arg29;
1008 args[30] <<= arg30;
1009 args[31] <<= arg31;
1010 args[32] <<= arg32;
1011 args[33] <<= arg33;
1012 args[34] <<= arg34;
1013 args[35] <<= TestEnum_TWO;
1014 args[36] <<= TestStruct(10);
1015 args[37] <<= TestPolyStruct< sal_Bool >(true);
1016 args[38] <<= TestPolyStruct< Any >(makeAny(true));
1017 args[39] <<= Reference< XInterface >(0);
1018 Constructors::create2(context, args);
1020 Sequence<Type> argSeq1(1); argSeq1[0] = cppu::UnoType<sal_Int32>::get();
1021 Sequence<Reference<XInterface> > argSeq2(1); argSeq2[0] = static_cast<XComponent*>(new Dummy());
1022 Sequence<Reference<XComponent> > argSeq2a(1); argSeq2a[0] = static_cast<XComponent*>(new Dummy());
1024 Sequence<TestPolyStruct2<sal_Unicode, Sequence<Any> > > argSeq3(1);
1025 argSeq3[0] = TestPolyStruct2<sal_Unicode, Sequence<Any> >('X', arg27);
1026 Sequence<TestPolyStruct2<TestPolyStruct<sal_Unicode>, Sequence<Any> > > argSeq4(1);
1027 argSeq4[0] = TestPolyStruct2<TestPolyStruct<sal_Unicode>, Sequence<Any> >(
1028 TestPolyStruct<sal_Unicode>('X'), arg27);
1029 Sequence<Sequence<sal_Int32> > argSeq5(1);
1030 argSeq5[0] = Sequence<sal_Int32>(1); argSeq5[0][0] = SAL_MIN_INT32;
1031 Sequence<TestPolyStruct<sal_Int32> > argSeq6(1);
1032 argSeq6[0] = TestPolyStruct<sal_Int32>(SAL_MIN_INT32);
1033 Sequence<TestPolyStruct<TestPolyStruct2<sal_Unicode, Any> > > argSeq7(1);
1034 argSeq7[0] = TestPolyStruct<TestPolyStruct2<sal_Unicode, Any> >(
1035 TestPolyStruct2<sal_Unicode, Any>('X', Any(true)));
1036 Sequence<TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>,OUString> > > argSeq8(1);
1037 argSeq8[0] = TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>,OUString> > (
1038 TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>,OUString>(
1039 TestPolyStruct2<sal_Unicode, Any>('X', Any(true)), OUString(RTL_CONSTASCII_USTRINGPARAM("test"))));
1040 Sequence<TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> > > > argSeq9(1);
1041 argSeq9[0] = TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> > >(
1042 OUString(RTL_CONSTASCII_USTRINGPARAM("test")), TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> >(
1043 'X', TestPolyStruct<Any>(Any(true))));
1044 Sequence<TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>, TestPolyStruct<sal_Unicode> > > argSeq10(1);
1045 argSeq10[0] = TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>, TestPolyStruct<sal_Unicode> >(
1046 TestPolyStruct2<sal_Unicode, Any>('X', Any(true)), TestPolyStruct<sal_Unicode>('X'));
1047 Sequence<Sequence<TestPolyStruct<sal_Unicode > > > argSeq11(1);
1048 argSeq11[0] = Sequence<TestPolyStruct<sal_Unicode > >(1);
1049 argSeq11[0][0] = TestPolyStruct<sal_Unicode>('X');
1050 Sequence<Sequence<TestPolyStruct<TestPolyStruct2<sal_Unicode,Any> > > > argSeq12(1);
1051 argSeq12[0] = Sequence<TestPolyStruct<TestPolyStruct2<sal_Unicode,Any> > >(1);
1052 argSeq12[0][0] = TestPolyStruct<TestPolyStruct2<sal_Unicode,Any> >(
1053 TestPolyStruct2<sal_Unicode,Any>('X', Any(true)));
1054 Sequence<Sequence<TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>,OUString> > > > argSeq13(1);
1055 argSeq13[0] = Sequence<TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>,OUString> > >(1);
1056 argSeq13[0][0] = TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>,OUString> >(
1057 TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>,OUString>(
1058 TestPolyStruct2<sal_Unicode,Any>('X', Any(true)), OUString(RTL_CONSTASCII_USTRINGPARAM("test"))));
1059 Sequence<Sequence<TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> > > > > argSeq14(1);
1060 argSeq14[0] = Sequence<TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> > > >(1);
1061 argSeq14[0][0] = TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> > >(
1062 OUString(RTL_CONSTASCII_USTRINGPARAM("test")), TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> >(
1063 'X', TestPolyStruct<Any>(Any(true))));
1064 Sequence<Sequence<TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>, TestPolyStruct<sal_Unicode> > > > argSeq15(1);
1065 argSeq15[0] = Sequence<TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>, TestPolyStruct<sal_Unicode> > >(1);
1066 argSeq15[0][0] = TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>, TestPolyStruct<sal_Unicode> >(
1067 TestPolyStruct2<sal_Unicode,Any>('X',Any(true)), TestPolyStruct<sal_Unicode>('X'));
1069 Constructors2::create1(
1070 context,
1071 TestPolyStruct<Type>(cppu::UnoType<sal_Int32>::get()),
1072 TestPolyStruct<Any>(Any(true)),
1073 TestPolyStruct<sal_Bool>(true),
1074 TestPolyStruct<sal_Int8>(SAL_MIN_INT8),
1075 TestPolyStruct<sal_Int16>(SAL_MIN_INT16),
1076 TestPolyStruct<sal_Int32>(SAL_MIN_INT32),
1077 TestPolyStruct<sal_Int64>(SAL_MIN_INT64),
1078 TestPolyStruct<sal_Unicode>('X'),
1079 TestPolyStruct<OUString>(OUString(RTL_CONSTASCII_USTRINGPARAM("test"))),
1080 TestPolyStruct<float>(0.123f),
1081 TestPolyStruct<double>(0.456),
1082 TestPolyStruct<Reference<XInterface> >(static_cast<XBridgeTest2*>(this)),
1083 TestPolyStruct<Reference<XComponent> >(static_cast<XComponent*>(new Dummy())),
1084 TestPolyStruct<TestEnum>(TestEnum_TWO),
1085 TestPolyStruct<TestPolyStruct2<sal_Unicode, Any> >(
1086 TestPolyStruct2<sal_Unicode, Any>('X', Any(true))),
1087 TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>,OUString> > (
1088 TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>,OUString>(
1089 TestPolyStruct2<sal_Unicode, Any>('X', Any(true)), OUString(RTL_CONSTASCII_USTRINGPARAM("test")))),
1090 TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode,TestPolyStruct<Any> > >(
1091 OUString(RTL_CONSTASCII_USTRINGPARAM("test")),
1092 TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> >('X', TestPolyStruct<Any>(Any(true)))),
1093 TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>, TestPolyStruct<sal_Unicode> >(
1094 TestPolyStruct2<sal_Unicode, Any>('X', Any(true)),
1095 TestPolyStruct<sal_Unicode>('X')),
1096 TestPolyStruct<Sequence<Type> >(argSeq1),
1097 TestPolyStruct<Sequence<Any> >(arg27),
1098 TestPolyStruct<Sequence<sal_Bool> >(arg14),
1099 TestPolyStruct<Sequence<sal_Int8> >(arg15),
1100 TestPolyStruct<Sequence<sal_Int16> >(arg16),
1101 TestPolyStruct<Sequence<sal_Int32> >(arg18),
1102 TestPolyStruct<Sequence<sal_Int64> >(arg20),
1103 TestPolyStruct<Sequence<sal_Unicode> >(arg24),
1104 TestPolyStruct<Sequence<OUString> >(arg25),
1105 TestPolyStruct<Sequence<float> >(arg22),
1106 TestPolyStruct<Sequence<double> >(arg23),
1107 TestPolyStruct<Sequence<Reference<XInterface> > >(argSeq2),
1108 TestPolyStruct<Sequence<Reference<XComponent> > >(argSeq2a),
1109 TestPolyStruct<Sequence<TestEnum> >(arg30),
1110 TestPolyStruct<Sequence<TestPolyStruct2<sal_Unicode, Sequence<Any> > > >(argSeq3),
1111 TestPolyStruct<Sequence<TestPolyStruct2<TestPolyStruct<sal_Unicode>, Sequence<Any> > > > (argSeq4),
1112 TestPolyStruct<Sequence<Sequence<sal_Int32> > >(argSeq5),
1113 argSeq6,
1114 argSeq7,
1115 argSeq8,
1116 argSeq9,
1117 argSeq10,
1118 argSeq11,
1119 argSeq12,
1120 argSeq13,
1121 argSeq14,
1122 argSeq15);
1125 Reference< XCurrentContextChecker > Test_Impl::getCurrentContextChecker()
1126 throw (RuntimeException)
1128 return new testtools::bridgetest::CurrentContextChecker;
1131 // XServiceInfo
1132 //__________________________________________________________________________________________________
1133 OUString Test_Impl::getImplementationName()
1134 throw (RuntimeException)
1136 return OUString( RTL_CONSTASCII_USTRINGPARAM(IMPLNAME) );
1138 //__________________________________________________________________________________________________
1139 sal_Bool Test_Impl::supportsService( const OUString & rServiceName )
1140 throw (RuntimeException)
1142 const Sequence< OUString > & rSNL = getSupportedServiceNames();
1143 const OUString * pArray = rSNL.getConstArray();
1144 for ( sal_Int32 nPos = rSNL.getLength(); nPos--; )
1146 if (pArray[nPos] == rServiceName)
1147 return sal_True;
1149 return sal_False;
1151 //__________________________________________________________________________________________________
1152 Sequence< OUString > Test_Impl::getSupportedServiceNames()
1153 throw (RuntimeException)
1155 return bridge_object::getSupportedServiceNames();
1158 // ...
1160 //==================================================================================================
1161 static Reference< XInterface > SAL_CALL Test_Impl_create( const Reference< XMultiServiceFactory > & )
1163 return Reference< XInterface >( (XBridgeTest *)new Test_Impl() );
1168 extern "C"
1170 //==================================================================================================
1171 void SAL_CALL component_getImplementationEnvironment(
1172 const sal_Char ** ppEnvTypeName, uno_Environment ** )
1174 *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
1176 //==================================================================================================
1177 sal_Bool SAL_CALL component_writeInfo( void *, void * pRegistryKey )
1179 if (pRegistryKey)
1183 Reference< XRegistryKey > xNewKey(
1184 reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey(
1185 OUString( RTL_CONSTASCII_USTRINGPARAM("/" IMPLNAME "/UNO/SERVICES") ) ) );
1186 xNewKey->createKey( OUString( RTL_CONSTASCII_USTRINGPARAM(SERVICENAME) ) );
1188 return sal_True;
1190 catch (InvalidRegistryException &)
1192 OSL_ENSURE( sal_False, "### InvalidRegistryException!" );
1195 return sal_False;
1197 //==================================================================================================
1198 void * SAL_CALL component_getFactory(
1199 const sal_Char * pImplName, void * pServiceManager, void * )
1201 void * pRet = 0;
1203 if (pServiceManager && rtl_str_compare( pImplName, IMPLNAME ) == 0)
1205 Reference< XSingleServiceFactory > xFactory( createSingleFactory(
1206 reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
1207 OUString( RTL_CONSTASCII_USTRINGPARAM(IMPLNAME) ),
1208 bridge_object::Test_Impl_create,
1209 bridge_object::getSupportedServiceNames() ) );
1211 if (xFactory.is())
1213 xFactory->acquire();
1214 pRet = xFactory.get();
1218 return pRet;