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