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