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