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