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 1 : inline static Sequence< OUString > getSupportedServiceNames()
66 : {
67 1 : OUString aName( SERVICENAME );
68 1 : return Sequence< OUString >( &aName, 1 );
69 : }
70 :
71 :
72 2 : static void assign( TestElement & rData,
73 : 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 2 : rData.Bool = bBool;
83 2 : rData.Char = cChar;
84 2 : rData.Byte = nByte;
85 2 : rData.Short = nShort;
86 2 : rData.UShort = nUShort;
87 2 : rData.Long = nLong;
88 2 : rData.ULong = nULong;
89 2 : rData.Hyper = nHyper;
90 2 : rData.UHyper = nUHyper;
91 2 : rData.Float = fFloat;
92 2 : rData.Double = fDouble;
93 2 : rData.Enum = eEnum;
94 2 : rData.String = rStr;
95 2 : rData.Interface = xTest;
96 2 : rData.Any = rAny;
97 2 : }
98 :
99 2 : static void assign( TestData & rData,
100 : 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 2 : eEnum, rStr, xTest, rAny );
113 2 : rData.Sequence = rSequence;
114 2 : }
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 1 : Test_Impl() : m_nLastCallId( 0 ),
148 : m_bFirstCall( true ),
149 1 : m_bSequenceOfCallTestPassed( true )
150 1 : {}
151 2 : virtual ~Test_Impl()
152 1 : {
153 : OSL_TRACE( "> scalar Test_Impl dtor <" );
154 2 : }
155 :
156 42 : void SAL_CALL acquire() throw () SAL_OVERRIDE
157 : {
158 42 : OWeakObject::acquire();
159 42 : }
160 42 : void SAL_CALL release() throw () SAL_OVERRIDE
161 : {
162 42 : OWeakObject::release();
163 42 : }
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 1 : virtual SmallStruct SAL_CALL echoSmallStruct(const SmallStruct& rStruct) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
208 1 : { return rStruct; }
209 1 : virtual MediumStruct SAL_CALL echoMediumStruct(const MediumStruct& rStruct) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
210 1 : { return rStruct; }
211 1 : virtual BigStruct SAL_CALL echoBigStruct(const BigStruct& rStruct) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
212 1 : { return rStruct; }
213 1 : virtual TwoFloats SAL_CALL echoTwoFloats(const TwoFloats& rStruct) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
214 1 : { return rStruct; }
215 1 : virtual FourFloats SAL_CALL echoFourFloats(const FourFloats& rStruct) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
216 1 : { return rStruct; }
217 1 : virtual MixedFloatAndInteger SAL_CALL echoMixedFloatAndInteger(const MixedFloatAndInteger& rStruct) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
218 1 : { return rStruct; }
219 1 : virtual ThreeByteStruct SAL_CALL echoThreeByteStruct(const ThreeByteStruct& rStruct) throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
220 1 : { return rStruct; }
221 1 : 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 1 : { return i2; }
223 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, std::exception) SAL_OVERRIDE
224 1 : { return d1 + d2 + d3 + d4 + d5 + d6 + d7 + d8 + d9 + d10; }
225 1 : virtual sal_Bool SAL_CALL getBool() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
226 1 : { return _aData.Bool; }
227 1 : virtual sal_Int8 SAL_CALL getByte() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
228 1 : { return _aData.Byte; }
229 1 : virtual sal_Unicode SAL_CALL getChar() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
230 1 : { return _aData.Char; }
231 1 : virtual sal_Int16 SAL_CALL getShort() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
232 1 : { return _aData.Short; }
233 1 : virtual sal_uInt16 SAL_CALL getUShort() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
234 1 : { return _aData.UShort; }
235 1 : virtual sal_Int32 SAL_CALL getLong() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
236 1 : { return _aData.Long; }
237 1 : virtual sal_uInt32 SAL_CALL getULong() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
238 1 : { return _aData.ULong; }
239 1 : virtual sal_Int64 SAL_CALL getHyper() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
240 1 : { return _aData.Hyper; }
241 1 : virtual sal_uInt64 SAL_CALL getUHyper() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
242 1 : { return _aData.UHyper; }
243 1 : virtual float SAL_CALL getFloat() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
244 1 : { return _aData.Float; }
245 1 : virtual double SAL_CALL getDouble() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
246 1 : { return _aData.Double; }
247 1 : virtual TestEnum SAL_CALL getEnum() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
248 1 : { return _aData.Enum; }
249 1 : virtual OUString SAL_CALL getString() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
250 1 : { return _aData.String; }
251 7 : 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 7 : { return _aData.Interface; }
253 1 : virtual com::sun::star::uno::Any SAL_CALL getAny() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
254 1 : { return _aData.Any; }
255 1 : virtual com::sun::star::uno::Sequence< TestElement > SAL_CALL getSequence() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
256 1 : { return _aData.Sequence; }
257 1 : virtual TestData SAL_CALL getStruct() throw(com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
258 1 : { return _aStructData; }
259 :
260 1 : virtual void SAL_CALL setBool( sal_Bool _bool ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
261 1 : { _aData.Bool = _bool; }
262 1 : virtual void SAL_CALL setByte( sal_Int8 _byte ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
263 1 : { _aData.Byte = _byte; }
264 1 : virtual void SAL_CALL setChar( sal_Unicode _char ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
265 1 : { _aData.Char = _char; }
266 1 : virtual void SAL_CALL setShort( sal_Int16 _short ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
267 1 : { _aData.Short = _short; }
268 1 : virtual void SAL_CALL setUShort( sal_uInt16 _ushort ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
269 1 : { _aData.UShort = _ushort; }
270 1 : virtual void SAL_CALL setLong( sal_Int32 _long ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
271 1 : { _aData.Long = _long; }
272 1 : virtual void SAL_CALL setULong( sal_uInt32 _ulong ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
273 1 : { _aData.ULong = _ulong; }
274 1 : virtual void SAL_CALL setHyper( sal_Int64 _hyper ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
275 1 : { _aData.Hyper = _hyper; }
276 1 : virtual void SAL_CALL setUHyper( sal_uInt64 _uhyper ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
277 1 : { _aData.UHyper = _uhyper; }
278 1 : virtual void SAL_CALL setFloat( float _float ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
279 1 : { _aData.Float = _float; }
280 1 : virtual void SAL_CALL setDouble( double _double ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
281 1 : { _aData.Double = _double; }
282 1 : virtual void SAL_CALL setEnum( TestEnum _enum ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
283 1 : { _aData.Enum = _enum; }
284 1 : virtual void SAL_CALL setString( const OUString& _string ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
285 1 : { _aData.String = _string; }
286 1 : 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 1 : { _aData.Interface = _interface; }
288 1 : virtual void SAL_CALL setAny( const ::com::sun::star::uno::Any& _any ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
289 1 : { _aData.Any = _any; }
290 1 : virtual void SAL_CALL setSequence( const ::com::sun::star::uno::Sequence<TestElement >& _sequence ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
291 1 : { _aData.Sequence = _sequence; }
292 1 : virtual void SAL_CALL setStruct( const TestData& _struct ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE
293 1 : { _aStructData = _struct; }
294 :
295 1 : virtual sal_Int32 SAL_CALL getRaiseAttr1() throw (RuntimeException, std::exception) SAL_OVERRIDE
296 1 : { throw RuntimeException(); }
297 :
298 1 : virtual void SAL_CALL setRaiseAttr1(sal_Int32)
299 : throw (IllegalArgumentException, RuntimeException, std::exception) SAL_OVERRIDE
300 1 : { throw IllegalArgumentException(); }
301 :
302 1 : virtual sal_Int32 SAL_CALL getRaiseAttr2()
303 : throw (IllegalArgumentException, RuntimeException, std::exception) SAL_OVERRIDE
304 1 : { throw IllegalArgumentException(); }
305 :
306 1 : virtual TestPolyStruct< sal_Bool > SAL_CALL transportPolyBoolean(
307 : TestPolyStruct< sal_Bool > const & arg) throw (RuntimeException, std::exception) SAL_OVERRIDE
308 1 : { return arg; }
309 :
310 1 : virtual void SAL_CALL transportPolyHyper(TestPolyStruct< sal_Int64 > &)
311 1 : throw (RuntimeException, std::exception) SAL_OVERRIDE {}
312 :
313 1 : virtual void SAL_CALL transportPolySequence(
314 : TestPolyStruct< Sequence< Any > > const & arg1,
315 : TestPolyStruct< Sequence< Any > > & arg2) throw (RuntimeException, std::exception) SAL_OVERRIDE
316 1 : { arg2 = arg1; }
317 :
318 1 : virtual TestPolyStruct< sal_Int32 > SAL_CALL getNullPolyLong()
319 : throw (RuntimeException, std::exception) SAL_OVERRIDE
320 1 : { return TestPolyStruct< sal_Int32 >(0); /* work around MS compiler bug */ }
321 :
322 1 : virtual TestPolyStruct< OUString > SAL_CALL getNullPolyString()
323 : throw (RuntimeException, std::exception) SAL_OVERRIDE
324 1 : { return TestPolyStruct< OUString >(); }
325 :
326 1 : virtual TestPolyStruct< Type > SAL_CALL getNullPolyType()
327 : throw (RuntimeException, std::exception) SAL_OVERRIDE
328 1 : { return TestPolyStruct< Type >(); }
329 :
330 1 : virtual TestPolyStruct< Any > SAL_CALL getNullPolyAny()
331 : throw (RuntimeException, std::exception) SAL_OVERRIDE
332 1 : { return TestPolyStruct< Any >(); }
333 :
334 : virtual TestPolyStruct< Sequence< sal_Bool > > SAL_CALL
335 1 : getNullPolySequence() throw (RuntimeException, std::exception) SAL_OVERRIDE
336 1 : { return TestPolyStruct< Sequence< sal_Bool > >(); }
337 :
338 1 : virtual TestPolyStruct< TestEnum > SAL_CALL getNullPolyEnum()
339 : throw (RuntimeException, std::exception) SAL_OVERRIDE
340 : { return TestPolyStruct< TestEnum >(
341 1 : test::testtools::bridgetest::TestEnum_TEST);
342 : /* work around MS compiler bug */ }
343 :
344 1 : virtual TestPolyStruct< TestBadEnum > SAL_CALL getNullPolyBadEnum()
345 : throw (RuntimeException, std::exception) SAL_OVERRIDE
346 : { return TestPolyStruct< TestBadEnum >(
347 1 : test::testtools::bridgetest::TestBadEnum_M);
348 : /* explicitly instantiate with default enumerator */ }
349 :
350 1 : virtual TestPolyStruct< TestStruct > SAL_CALL getNullPolyStruct()
351 : throw (RuntimeException, std::exception) SAL_OVERRIDE
352 1 : { return TestPolyStruct< TestStruct >(); }
353 :
354 : virtual TestPolyStruct< Reference< XBridgeTestBase > > SAL_CALL
355 1 : getNullPolyInterface() throw (RuntimeException, std::exception) SAL_OVERRIDE
356 1 : { 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 6 : class Dummy : public osl::DebugBase<Dummy>,
476 : public WeakComponentImplHelperBase
477 : {
478 : public:
479 3 : Dummy(): WeakComponentImplHelperBase(*Mutex::getGlobalMutex()){}
480 :
481 : };
482 :
483 14 : Any Test_Impl::transportAny( const Any & value ) throw ( ::com::sun::star::uno::RuntimeException, std::exception)
484 : {
485 14 : return value;
486 : }
487 :
488 :
489 :
490 : namespace {
491 :
492 55 : void wait(sal_Int32 microSeconds) {
493 : OSL_ASSERT(microSeconds >= 0 && microSeconds <= SAL_MAX_INT32 / 1000);
494 : TimeValue t = {
495 55 : static_cast< sal_uInt32 >(microSeconds / 1000000),
496 55 : static_cast< sal_uInt32 >(microSeconds * 1000) };
497 55 : osl_waitThread(&t);
498 55 : }
499 :
500 : }
501 :
502 10 : void Test_Impl::call( sal_Int32 nCallId , sal_Int32 nWaitMUSEC ) throw(::com::sun::star::uno::RuntimeException, std::exception)
503 : {
504 10 : wait(nWaitMUSEC);
505 10 : if( m_bFirstCall )
506 : {
507 1 : m_bFirstCall = false;
508 : }
509 : else
510 : {
511 9 : m_bSequenceOfCallTestPassed = m_bSequenceOfCallTestPassed && (nCallId > m_nLastCallId);
512 : }
513 10 : m_nLastCallId = nCallId;
514 10 : }
515 :
516 :
517 45 : void Test_Impl::callOneway( sal_Int32 nCallId , sal_Int32 nWaitMUSEC ) throw (::com::sun::star::uno::RuntimeException, std::exception)
518 : {
519 45 : wait(nWaitMUSEC);
520 45 : m_bSequenceOfCallTestPassed = m_bSequenceOfCallTestPassed && (nCallId > m_nLastCallId);
521 45 : m_nLastCallId = nCallId;
522 45 : }
523 :
524 :
525 1 : sal_Bool Test_Impl::sequenceOfCallTestPassed() throw (::com::sun::star::uno::RuntimeException, std::exception)
526 : {
527 1 : return m_bSequenceOfCallTestPassed;
528 : }
529 :
530 :
531 1 : 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 1 : MutexGuard guard( m_mutex );
536 1 : if( nToCall )
537 : {
538 1 : nToCall --;
539 1 : xCall->callRecursivly( this , nToCall );
540 1 : }
541 1 : }
542 :
543 :
544 25 : 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 25 : MutexGuard guard( m_mutex );
550 25 : if( nToCall )
551 : {
552 24 : nToCall --;
553 24 : xCall->callRecursivly( this , nToCall );
554 25 : }
555 25 : }
556 :
557 1 : Reference< XMulti > Test_Impl::getMulti() throw (RuntimeException, std::exception) {
558 1 : return new testtools::bridgetest::Multi;
559 : }
560 :
561 1 : OUString Test_Impl::testMulti(Reference< XMulti > const & multi)
562 : throw (RuntimeException, std::exception)
563 : {
564 1 : return testtools::bridgetest::testMulti(multi);
565 : }
566 :
567 :
568 1 : 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 1 : eEnum, rStr, xTest, rAny, rSequence );
583 1 : _aStructData = rStruct;
584 1 : }
585 :
586 1 : 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 1 : eEnum, rStr, xTest, rAny, rSequence );
601 1 : _aStructData = rStruct;
602 :
603 1 : TestElement elem = rSequence[ 0 ];
604 1 : rSequence[ 0 ] = rSequence[ 1 ];
605 1 : rSequence[ 1 ] = elem;
606 :
607 1 : return _aStructData;
608 : }
609 :
610 2 : 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 2 : bBool = _aData.Bool;
623 2 : cChar = _aData.Char;
624 2 : nByte = _aData.Byte;
625 2 : nShort = _aData.Short;
626 2 : nUShort = _aData.UShort;
627 2 : nLong = _aData.Long;
628 2 : nULong = _aData.ULong;
629 2 : nHyper = _aData.Hyper;
630 2 : nUHyper = _aData.UHyper;
631 2 : fFloat = _aData.Float;
632 2 : fDouble = _aData.Double;
633 2 : eEnum = _aData.Enum;
634 2 : rStr = _aData.String;
635 2 : xTest = _aData.Interface;
636 2 : rAny = _aData.Any;
637 2 : rSequence = _aData.Sequence;
638 2 : rStruct = _aStructData;
639 2 : return _aStructData;
640 : }
641 :
642 1 : 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 1 : IllegalArgumentException aExc;
646 1 : aExc.ArgumentPosition = nArgumentPos;
647 1 : aExc.Message = _aData.String = rMsg;
648 1 : aExc.Context = _aData.Interface = xContext;
649 1 : throw aExc;
650 : }
651 :
652 1 : void Test_Impl::raiseRuntimeExceptionOneway( const OUString & rMsg, const Reference< XInterface > & xContext )
653 : throw(::com::sun::star::uno::RuntimeException, std::exception)
654 : {
655 1 : RuntimeException aExc;
656 1 : aExc.Message = _aData.String = rMsg;
657 1 : aExc.Context = _aData.Interface = xContext;
658 1 : throw aExc;
659 : }
660 :
661 1 : void dothrow2(const RuntimeException& e)
662 : {
663 1 : throw e;
664 : }
665 1 : void dothrow(const RuntimeException& 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 1 : dothrow2( e );
694 0 : }
695 :
696 1 : sal_Int32 Test_Impl::getRuntimeException()
697 : throw (RuntimeException, std::exception)
698 : {
699 : try
700 : {
701 2 : dothrow( RuntimeException( _aData.String, _aData.Interface ) );
702 : }
703 1 : catch (Exception &)
704 : {
705 1 : Any a( getCaughtException() );
706 2 : throwException( a );
707 : }
708 0 : return 0; // for dummy
709 : }
710 :
711 1 : void Test_Impl::setRuntimeException( sal_Int32 ) throw(::com::sun::star::uno::RuntimeException, std::exception)
712 : {
713 1 : RuntimeException aExc;
714 1 : aExc.Message = _aData.String;
715 1 : aExc.Context = _aData.Interface;
716 2 : throwException( makeAny( aExc ) );
717 0 : }
718 :
719 : // XBridgeTest2 -------------------------------------------------------------
720 2 : Sequence< sal_Bool > SAL_CALL Test_Impl::setSequenceBool(
721 : const Sequence< sal_Bool >& aSeq ) throw (RuntimeException, std::exception)
722 : {
723 2 : _arBool = aSeq;
724 2 : return aSeq;
725 : }
726 :
727 2 : Sequence< sal_Unicode > SAL_CALL Test_Impl::setSequenceChar(
728 : const Sequence< sal_Unicode >& aSeq ) throw (RuntimeException, std::exception)
729 : {
730 2 : _arChar = aSeq;
731 2 : return aSeq;
732 : }
733 :
734 2 : Sequence< sal_Int8 > SAL_CALL Test_Impl::setSequenceByte(
735 : const Sequence< sal_Int8 >& aSeq ) throw (RuntimeException, std::exception)
736 : {
737 2 : _arByte = aSeq;
738 2 : return aSeq;
739 : }
740 :
741 2 : Sequence< sal_Int16 > SAL_CALL Test_Impl::setSequenceShort(
742 : const Sequence< sal_Int16 >& aSeq ) throw (RuntimeException, std::exception)
743 : {
744 2 : _arShort = aSeq;
745 2 : return aSeq;
746 : }
747 :
748 2 : Sequence< sal_uInt16 > SAL_CALL Test_Impl::setSequenceUShort(
749 : const Sequence< sal_uInt16 >& aSeq ) throw (RuntimeException, std::exception)
750 : {
751 2 : _arUShort = aSeq;
752 2 : return aSeq;
753 : }
754 :
755 2 : Sequence< sal_Int32 > SAL_CALL Test_Impl::setSequenceLong(
756 : const Sequence< sal_Int32 >& aSeq ) throw (RuntimeException, std::exception)
757 : {
758 2 : _arLong = aSeq;
759 2 : return aSeq;
760 : }
761 :
762 2 : Sequence< sal_uInt32 > SAL_CALL Test_Impl::setSequenceULong(
763 : const Sequence< sal_uInt32 >& aSeq ) throw (RuntimeException, std::exception)
764 : {
765 2 : _arULong = aSeq;
766 2 : return aSeq;
767 : }
768 :
769 2 : Sequence< sal_Int64 > SAL_CALL Test_Impl::setSequenceHyper(
770 : const Sequence< sal_Int64 >& aSeq ) throw (RuntimeException, std::exception)
771 : {
772 2 : _arHyper = aSeq;
773 2 : return aSeq;
774 : }
775 :
776 2 : Sequence< sal_uInt64 > SAL_CALL Test_Impl::setSequenceUHyper(
777 : const Sequence< sal_uInt64 >& aSeq ) throw (RuntimeException, std::exception)
778 : {
779 2 : _arUHyper = aSeq;
780 2 : return aSeq;
781 : }
782 :
783 2 : Sequence< float > SAL_CALL Test_Impl::setSequenceFloat(
784 : const Sequence< float >& aSeq ) throw (RuntimeException, std::exception)
785 : {
786 2 : _arFloat = aSeq;
787 2 : return aSeq;
788 : }
789 :
790 2 : Sequence< double > SAL_CALL Test_Impl::setSequenceDouble(
791 : const Sequence< double >& aSeq ) throw (RuntimeException, std::exception)
792 : {
793 2 : _arDouble = aSeq;
794 2 : return aSeq;
795 : }
796 :
797 2 : Sequence< TestEnum > SAL_CALL Test_Impl::setSequenceEnum(
798 : const Sequence< TestEnum >& aSeq ) throw (RuntimeException, std::exception)
799 : {
800 2 : _arEnum = aSeq;
801 2 : return aSeq;
802 : }
803 :
804 2 : Sequence< OUString > SAL_CALL Test_Impl::setSequenceString(
805 : const Sequence< OUString >& aSeq ) throw (RuntimeException, std::exception)
806 : {
807 2 : _arString = aSeq;
808 2 : return aSeq;
809 : }
810 :
811 2 : Sequence< Reference< XInterface > > SAL_CALL Test_Impl::setSequenceXInterface(
812 : const Sequence< Reference< XInterface > >& aSeq )
813 : throw (RuntimeException, std::exception)
814 : {
815 2 : _arObject = aSeq;
816 2 : return aSeq;
817 : }
818 :
819 2 : Sequence<Any > SAL_CALL Test_Impl::setSequenceAny(
820 : const Sequence<Any >& aSeq ) throw (RuntimeException, std::exception)
821 : {
822 2 : _arAny = aSeq;
823 2 : return aSeq;
824 : }
825 :
826 2 : Sequence<TestElement > SAL_CALL Test_Impl::setSequenceStruct(
827 : const Sequence< TestElement >& aSeq ) throw (RuntimeException, std::exception)
828 : {
829 2 : _arStruct = aSeq;
830 2 : return aSeq;
831 : }
832 :
833 2 : Sequence< Sequence< sal_Int32 > > SAL_CALL Test_Impl::setDim2(
834 : const Sequence<Sequence< sal_Int32 > >& aSeq ) throw (RuntimeException, std::exception)
835 : {
836 2 : _arLong2 = aSeq;
837 2 : return aSeq;
838 : }
839 :
840 2 : 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 2 : _arLong3 = aSeq;
845 2 : return aSeq;
846 : }
847 :
848 1 : 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 1 : _arBool = aSeqBoolean;
868 1 : _arChar = aSeqChar;
869 1 : _arByte = aSeqByte;
870 1 : _arShort = aSeqShort;
871 1 : _arUShort = aSeqUShort;
872 1 : _arLong = aSeqLong;
873 1 : _arULong = aSeqULong;
874 1 : _arHyper = aSeqHyper;
875 1 : _arUHyper = aSeqUHyper;
876 1 : _arFloat = aSeqFloat;
877 1 : _arDouble = aSeqDouble;
878 1 : _arEnum = aSeqTestEnum;
879 1 : _arString = aSeqString;
880 1 : _arObject = aSeqXInterface;
881 1 : _arAny = aSeqAny;
882 1 : _arLong2 = aSeqDim2;
883 1 : _arLong3 = aSeqDim3;
884 1 : }
885 :
886 1 : 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 1 : aSeqBoolean = _arBool;
906 1 : aSeqChar = _arChar;
907 1 : aSeqByte = _arByte;
908 1 : aSeqShort = _arShort;
909 1 : aSeqUShort = _arUShort;
910 1 : aSeqLong = _arLong;
911 1 : aSeqULong = _arULong;
912 1 : aSeqHyper = _arHyper;
913 1 : aSeqUHyper = _arUHyper;
914 1 : aSeqFloat = _arFloat;
915 1 : aSeqDouble = _arDouble;
916 1 : aSeqEnum = _arEnum;
917 1 : aSeqString = _arString;
918 1 : aSeqXInterface = _arObject;
919 1 : aSeqAny = _arAny;
920 1 : aSeqDim2 = _arLong2;
921 1 : aSeqDim3 = _arLong3;
922 1 : }
923 :
924 1 : void Test_Impl::testConstructorsService(
925 : Reference< XComponentContext > const & context) throw (RuntimeException, std::exception)
926 : {
927 1 : Sequence< sal_Bool > arg14(1); arg14[0] = true;
928 2 : Sequence< sal_Int8 > arg15(1); arg15[0] = SAL_MIN_INT8;
929 2 : Sequence< sal_Int16 > arg16(1); arg16[0] = SAL_MIN_INT16;
930 2 : Sequence< sal_uInt16 > arg17(1); arg17[0] = SAL_MAX_UINT16;
931 2 : Sequence< sal_Int32 > arg18(1); arg18[0] = SAL_MIN_INT32;
932 2 : Sequence< sal_uInt32 > arg19(1); arg19[0] = SAL_MAX_UINT32;
933 2 : Sequence< sal_Int64 > arg20(1); arg20[0] = SAL_MIN_INT64;
934 2 : Sequence< sal_uInt64 > arg21(1); arg21[0] = SAL_MAX_UINT64;
935 2 : Sequence< float > arg22(1); arg22[0] = 0.123f;
936 2 : Sequence< double > arg23(1); arg23[0] = 0.456;
937 2 : Sequence< sal_Unicode > arg24(1); arg24[0] = 'X';
938 2 : Sequence< OUString > arg25(1);
939 1 : arg25[0] = "test";
940 2 : Sequence< Type > arg26(1); arg26[0] = UnoType< Any >::get();
941 2 : Sequence< Any > arg27(1); arg27[0] <<= true;
942 2 : Sequence< Sequence< sal_Bool > > arg28(1);
943 1 : arg28[0] = Sequence< sal_Bool >(1); arg28[0][0] = true;
944 2 : Sequence< Sequence< Any > > arg29(1); arg29[0] = Sequence< Any >(1);
945 1 : arg29[0][0] <<= true;
946 2 : Sequence< TestEnum > arg30(1); arg30[0] = TestEnum_TWO;
947 2 : Sequence< TestStruct > arg31(1); arg31[0].member = 10;
948 2 : Sequence< TestPolyStruct< sal_Bool > > arg32(1); arg32[0].member = true;
949 2 : Sequence< TestPolyStruct< Any > > arg33(1); arg33[0].member <<= true;
950 2 : 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 1 : 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 2 : Reference< XInterface >(0));
992 2 : Sequence< Any > args(40);
993 1 : args[0] <<= true;
994 1 : args[1] <<= SAL_MIN_INT8;
995 1 : args[2] <<= SAL_MIN_INT16;
996 1 : args[3] <<= SAL_MAX_UINT16;
997 1 : args[4] <<= SAL_MIN_INT32;
998 1 : args[5] <<= SAL_MAX_UINT32;
999 1 : args[6] <<= SAL_MIN_INT64;
1000 1 : args[7] <<= SAL_MAX_UINT64;
1001 1 : args[8] <<= 0.123f;
1002 1 : args[9] <<= 0.456;
1003 1 : sal_Unicode arg10c = 'X';
1004 1 : args[10].setValue(&arg10c, UnoType< UnoCharType >::get());
1005 1 : args[11] <<= OUString("test");
1006 1 : args[12] <<= UnoType< Any >::get();
1007 1 : args[13] <<= true;
1008 1 : args[14] <<= arg14;
1009 1 : args[15] <<= arg15;
1010 1 : args[16] <<= arg16;
1011 1 : args[17] <<= arg17;
1012 1 : args[18] <<= arg18;
1013 1 : args[19] <<= arg19;
1014 1 : args[20] <<= arg20;
1015 1 : args[21] <<= arg21;
1016 1 : args[22] <<= arg22;
1017 1 : args[23] <<= arg23;
1018 1 : args[24].setValue(&arg24, UnoType< UnoSequenceType< UnoCharType > >::get());
1019 1 : args[25] <<= arg25;
1020 1 : args[26] <<= arg26;
1021 1 : args[27] <<= arg27;
1022 1 : args[28] <<= arg28;
1023 1 : args[29] <<= arg29;
1024 1 : args[30] <<= arg30;
1025 1 : args[31] <<= arg31;
1026 1 : args[32] <<= arg32;
1027 1 : args[33] <<= arg33;
1028 1 : args[34] <<= arg34;
1029 1 : args[35] <<= TestEnum_TWO;
1030 1 : args[36] <<= TestStruct(10);
1031 1 : args[37] <<= TestPolyStruct< sal_Bool >(true);
1032 1 : args[38] <<= TestPolyStruct< Any >(makeAny(true));
1033 1 : args[39] <<= Reference< XInterface >(0);
1034 1 : Constructors::create2(context, args);
1035 :
1036 2 : Sequence<Type> argSeq1(1); argSeq1[0] = cppu::UnoType<sal_Int32>::get();
1037 2 : Sequence<Reference<XInterface> > argSeq2(1); argSeq2[0] = static_cast<XComponent*>(new Dummy());
1038 2 : Sequence<Reference<XComponent> > argSeq2a(1); argSeq2a[0] = static_cast<XComponent*>(new Dummy());
1039 :
1040 2 : Sequence<TestPolyStruct2<sal_Unicode, Sequence<Any> > > argSeq3(1);
1041 1 : argSeq3[0] = TestPolyStruct2<sal_Unicode, Sequence<Any> >('X', arg27);
1042 2 : Sequence<TestPolyStruct2<TestPolyStruct<sal_Unicode>, Sequence<Any> > > argSeq4(1);
1043 2 : argSeq4[0] = TestPolyStruct2<TestPolyStruct<sal_Unicode>, Sequence<Any> >(
1044 1 : TestPolyStruct<sal_Unicode>('X'), arg27);
1045 2 : Sequence<Sequence<sal_Int32> > argSeq5(1);
1046 1 : argSeq5[0] = Sequence<sal_Int32>(1); argSeq5[0][0] = SAL_MIN_INT32;
1047 2 : Sequence<TestPolyStruct<sal_Int32> > argSeq6(1);
1048 1 : argSeq6[0] = TestPolyStruct<sal_Int32>(SAL_MIN_INT32);
1049 2 : Sequence<TestPolyStruct<TestPolyStruct2<sal_Unicode, Any> > > argSeq7(1);
1050 2 : argSeq7[0] = TestPolyStruct<TestPolyStruct2<sal_Unicode, Any> >(
1051 1 : TestPolyStruct2<sal_Unicode, Any>('X', Any(true)));
1052 2 : Sequence<TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>,OUString> > > argSeq8(1);
1053 2 : argSeq8[0] = TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>,OUString> > (
1054 : TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>,OUString>(
1055 1 : TestPolyStruct2<sal_Unicode, Any>('X', Any(true)), OUString("test")));
1056 2 : Sequence<TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> > > > argSeq9(1);
1057 2 : argSeq9[0] = TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> > >(
1058 : OUString("test"), TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> >(
1059 1 : 'X', TestPolyStruct<Any>(Any(true))));
1060 2 : Sequence<TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>, TestPolyStruct<sal_Unicode> > > argSeq10(1);
1061 2 : argSeq10[0] = TestPolyStruct2<TestPolyStruct2<sal_Unicode, Any>, TestPolyStruct<sal_Unicode> >(
1062 1 : TestPolyStruct2<sal_Unicode, Any>('X', Any(true)), TestPolyStruct<sal_Unicode>('X'));
1063 2 : Sequence<Sequence<TestPolyStruct<sal_Unicode > > > argSeq11(1);
1064 1 : argSeq11[0] = Sequence<TestPolyStruct<sal_Unicode > >(1);
1065 1 : argSeq11[0][0] = TestPolyStruct<sal_Unicode>('X');
1066 2 : Sequence<Sequence<TestPolyStruct<TestPolyStruct2<sal_Unicode,Any> > > > argSeq12(1);
1067 1 : argSeq12[0] = Sequence<TestPolyStruct<TestPolyStruct2<sal_Unicode,Any> > >(1);
1068 2 : argSeq12[0][0] = TestPolyStruct<TestPolyStruct2<sal_Unicode,Any> >(
1069 1 : TestPolyStruct2<sal_Unicode,Any>('X', Any(true)));
1070 2 : Sequence<Sequence<TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>,OUString> > > > argSeq13(1);
1071 1 : argSeq13[0] = Sequence<TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>,OUString> > >(1);
1072 2 : argSeq13[0][0] = TestPolyStruct<TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>,OUString> >(
1073 : TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>,OUString>(
1074 1 : TestPolyStruct2<sal_Unicode,Any>('X', Any(true)), OUString("test")));
1075 2 : Sequence<Sequence<TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> > > > > argSeq14(1);
1076 1 : argSeq14[0] = Sequence<TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> > > >(1);
1077 2 : argSeq14[0][0] = TestPolyStruct2<OUString, TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> > >(
1078 : OUString("test"), TestPolyStruct2<sal_Unicode, TestPolyStruct<Any> >(
1079 1 : 'X', TestPolyStruct<Any>(Any(true))));
1080 2 : Sequence<Sequence<TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>, TestPolyStruct<sal_Unicode> > > > argSeq15(1);
1081 1 : argSeq15[0] = Sequence<TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>, TestPolyStruct<sal_Unicode> > >(1);
1082 2 : argSeq15[0][0] = TestPolyStruct2<TestPolyStruct2<sal_Unicode,Any>, TestPolyStruct<sal_Unicode> >(
1083 1 : TestPolyStruct2<sal_Unicode,Any>('X',Any(true)), TestPolyStruct<sal_Unicode>('X'));
1084 :
1085 : Constructors2::create1(
1086 : context,
1087 1 : 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 1 : 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 4 : argSeq15);
1139 1 : }
1140 :
1141 4 : Reference< XCurrentContextChecker > Test_Impl::getCurrentContextChecker()
1142 : throw (RuntimeException, std::exception)
1143 : {
1144 4 : 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 1 : static Reference< XInterface > SAL_CALL Test_Impl_create(
1171 : SAL_UNUSED_PARAMETER const Reference< XMultiServiceFactory > & )
1172 : {
1173 1 : return Reference< XInterface >( static_cast<XBridgeTest *>(new Test_Impl()) );
1174 : }
1175 :
1176 : }
1177 :
1178 : extern "C"
1179 : {
1180 1 : 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 1 : void * pRet = 0;
1185 :
1186 1 : if (pServiceManager && rtl_str_compare( pImplName, IMPLNAME ) == 0)
1187 : {
1188 : Reference< XSingleServiceFactory > xFactory( createSingleFactory(
1189 : static_cast< XMultiServiceFactory * >( pServiceManager ),
1190 : OUString( IMPLNAME ),
1191 : bridge_object::Test_Impl_create,
1192 1 : bridge_object::getSupportedServiceNames() ) );
1193 :
1194 1 : if (xFactory.is())
1195 : {
1196 1 : xFactory->acquire();
1197 1 : pRet = xFactory.get();
1198 1 : }
1199 : }
1200 :
1201 1 : return pRet;
1202 : }
1203 : }
1204 :
1205 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|