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