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