xref: /AOO41X/main/extensions/test/ole/cpnt/cpnt.cxx (revision 2a97ec55f1442d65917e8c8b82a55ab76c9ff676)
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_extensions.hxx"
26 #include <windows.h>
27 #include <atlbase.h>
28 #include <stdio.h>
29 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
30 #include <com/sun/star/registry/XRegistryKey.hpp>
31 #include <osl/diagnose.h>
32 #include <uno/environment.h>
33 #include <cppuhelper/factory.hxx>
34 // OPTIONAL is a constant in com.sun.star.beans.PropertyAttributes but it must be
35 // undef'd in some header files
36 #define OPTIONAL OPTIONAL
37 #include <com/sun/star/beans/PropertyAttribute.hpp>
38 #include <com/sun/star/script/XInvocation.hpp>
39 #include <com/sun/star/reflection/XIdlReflection.hpp>
40 #include <com/sun/star/lang/XEventListener.hpp>
41 
42 #include <cppuhelper/implbase7.hxx>
43 #include <cppuhelper/implbase1.hxx>
44 #include <com/sun/star/uno/Reference.h>
45 #include <rtl/ustring.h>
46 #include <com/sun/star/uno/Reference.hxx>
47 #include <oletest/XTestSequence.hpp>
48 #include <oletest/XTestStruct.hpp>
49 #include <oletest/XTestOther.hpp>
50 #include <oletest/XTestInterfaces.hpp>
51 #include <oletest/XSimple.hpp>
52 #include <oletest/XSimple2.hpp>
53 #include <oletest/XSimple3.hpp>
54 #include <oletest/XTestInParameters.hpp>
55 //#include <oletest/XTestOutParameters.hpp>
56 #include <oletest/XIdentity.hpp>
57 #include <com/sun/star/beans/Property.hpp>
58 using namespace cppu;
59 using namespace osl;
60 using namespace oletest;
61 using namespace rtl;
62 using namespace com::sun::star::uno;
63 using namespace com::sun::star::lang;
64 using namespace com::sun::star::beans;
65 using namespace com::sun::star::registry;
66 using namespace com::sun::star::script;
67 using namespace com::sun::star::reflection;
68 
69 
70 #define IMPL_NAME L"oletest.OleTestImpl"  // oletest.OleTestImpl in applicat.rdb
71 #define SERVICE_NAME L"oletest.OleTest"
72 #define KEY1 L"/oletest.OleTestImpl/UNO/SERVICES"
73 #define KEY2 L"oletest.OleTest"
74 
75 class OComponent : public WeakImplHelper7<
76          XTestSequence, XTestStruct, XTestOther, XTestInterfaces,
77                    XSimple, XTestInParameters, XIdentity >
78 {
79     Reference<XInterface> m_xIntIdentity;
80     sal_Int32 m_arrayConstructor;
81     Reference<XMultiServiceFactory> m_rFactory;
82 
83     Sequence<sal_Int8> m_seqByte;
84     Sequence<float> m_seqFloat;
85     Sequence<double> m_seqDouble;
86     Sequence<sal_Bool> m_seqBool;
87     Sequence<sal_Int16> m_seqShort;
88     Sequence<sal_uInt16> m_seqUShort;
89     Sequence<sal_Int32> m_seqLong;
90     Sequence<sal_uInt32> m_seqULong;
91     Sequence<sal_Unicode> m_seqChar;
92     Sequence<OUString> m_seqString;
93     Sequence<Any> m_seqAny;
94     Sequence<Type> m_seqType;
95     Sequence<Sequence< sal_Int32> > m_seq1;
96     Sequence<Sequence< Sequence< sal_Int32> > > m_seq2;
97     Any m_any;
98     Type m_type;
99     Sequence<Reference< XInterface > > m_seqxInterface;
100 
101     sal_Int8 m_int8;
102     sal_uInt8 m_uint8;
103     sal_Int16 m_int16;
104     sal_uInt16 m_uint16;
105     sal_Int32 m_int32;
106     sal_uInt32 m_uint32;
107     sal_Int64 m_int64;
108     sal_uInt64 m_uint64;
109     float m_float;
110     double m_double;
111     OUString m_string;
112     sal_Unicode m_char;
113     sal_Bool m_bool;
114     Reference<XInterface> m_xinterface;
115 
116     sal_Int8 m_attr_int8;
117     sal_uInt8 m_attr_uint8;
118     sal_Int16 m_attr_int16;
119     sal_uInt16 m_attr_uint16;
120     sal_Int32 m_attr_int32;
121     sal_uInt32 m_attr_uint32;
122     sal_Int64 m_attr_int64;
123     sal_uInt64 m_attr_uint64;
124     float m_attr_float;
125     double m_attr_double;
126     OUString m_attr_string;
127     sal_Unicode m_attr_char;
128     sal_Bool m_attr_bool;
129     Any m_attr_any;
130     Type m_attr_type;
131     Reference<XInterface> m_attr_xinterface;
132     Reference<XInvocation> m_attr_xinvocation;
133 
134 public:
OComponent(const Reference<XMultiServiceFactory> & rFactory)135     OComponent( const Reference<XMultiServiceFactory> & rFactory ) :
136       m_rFactory( rFactory ), m_arrayConstructor(0) {}
137     ~OComponent();
138 public: // XTestSequence
139     virtual Sequence<sal_Int8> SAL_CALL methodByte(const Sequence< sal_Int8 >& aSeq) throw( RuntimeException );
140     virtual Sequence<float> SAL_CALL methodFloat(const Sequence< float >& aSeq) throw( RuntimeException );
141     virtual Sequence< double > SAL_CALL methodDouble(const Sequence< double >& aSeq) throw( RuntimeException);
142     virtual Sequence< sal_Bool > SAL_CALL methodBool(const Sequence< sal_Bool >& aSeq) throw( RuntimeException );
143     virtual Sequence< sal_Int16 > SAL_CALL methodShort(const Sequence< sal_Int16 >& aSeq) throw( RuntimeException );
144     virtual Sequence< sal_uInt16 > SAL_CALL methodUShort(const Sequence< sal_uInt16 >& aSeq) throw( RuntimeException );
145     virtual Sequence< sal_Int32 > SAL_CALL methodLong(const Sequence< sal_Int32 >& aSeq) throw( RuntimeException) ;
146     virtual Sequence< sal_uInt32 > SAL_CALL methodULong(const Sequence< sal_uInt32 >& aSeq) throw( RuntimeException );
147     virtual Sequence< OUString > SAL_CALL methodString(const Sequence< OUString >& aSeq) throw( RuntimeException );
148     virtual Sequence< sal_Unicode > SAL_CALL methodChar(const Sequence< sal_Unicode >& aSeq) throw( RuntimeException );
149     virtual Sequence< Any > SAL_CALL methodAny(const Sequence< Any >& aSeq) throw( RuntimeException );
150     virtual Sequence< Type > SAL_CALL methodType(const Sequence< Type >& aSeq) throw( RuntimeException );
151     virtual Sequence< Reference< XInterface > > SAL_CALL methodXInterface( const Sequence< Reference< XInterface > >& aSeq ) throw(RuntimeException) ;
152     virtual Sequence< Sequence< sal_Int32 > > SAL_CALL methodSequence(const Sequence< Sequence< sal_Int32 > >& aSeq) throw( RuntimeException );
153     virtual Sequence< Sequence< Sequence< sal_Int32 > > > SAL_CALL methodSequence2(const Sequence< Sequence< Sequence< sal_Int32 > > >& aSeq) throw( RuntimeException );
154     virtual Sequence< Reference<XEventListener> > SAL_CALL methodXEventListeners( const Sequence<Reference<XEventListener> >& aSeq) throw( RuntimeException);
155     virtual Sequence< Sequence<Reference<XEventListener > > > SAL_CALL methodXEventListenersMul( const Sequence<Sequence<Reference<XEventListener > > >& aSeq ) throw (RuntimeException);
156 
157     virtual Sequence< sal_Int8 > SAL_CALL getAttrByte(void) throw( RuntimeException );
158     virtual void SAL_CALL setAttrByte(const Sequence< sal_Int8 >& AttrByte_) throw( RuntimeException );
159     virtual Sequence< float > SAL_CALL getAttrFloat(void)  throw( RuntimeException) ;
160     virtual void SAL_CALL setAttrFloat(const Sequence< float >& AttrFloat_) throw( RuntimeException );
161     virtual Sequence< double > SAL_CALL getAttrDouble(void)  throw( RuntimeException) ;
162     virtual void SAL_CALL setAttrDouble(const Sequence< double >& AttrDouble_) throw( RuntimeException );
163     virtual Sequence< sal_Bool > SAL_CALL getAttrBool(void)  throw( RuntimeException );
164     virtual void SAL_CALL setAttrBool(const Sequence< sal_Bool >& AttrBool_) throw( RuntimeException );
165     virtual Sequence< sal_Int16 > SAL_CALL getAttrShort(void)  throw( RuntimeException );
166     virtual void SAL_CALL setAttrShort(const Sequence< sal_Int16 >& AttrShort_) throw( RuntimeException );
167     virtual Sequence< sal_uInt16 > SAL_CALL getAttrUShort(void)  throw( RuntimeException );
168     virtual void SAL_CALL setAttrUShort(const Sequence< sal_uInt16 >& AttrUShort_) throw( RuntimeException );
169     virtual Sequence< sal_Int32 > SAL_CALL getAttrLong(void)  throw( RuntimeException );
170     virtual void SAL_CALL setAttrLong(const Sequence< sal_Int32 >& AttrLong_) throw( RuntimeException );
171     virtual Sequence< sal_uInt32 > SAL_CALL getAttrULong(void)  throw( RuntimeException );
172     virtual void SAL_CALL setAttrULong(const Sequence< sal_uInt32 >& AttrULong_) throw( RuntimeException );
173     virtual Sequence< OUString > SAL_CALL getAttrString(void)  throw(RuntimeException );
174     virtual void SAL_CALL setAttrString(const Sequence< OUString >& AttrString_) throw( RuntimeException );
175     virtual Sequence< sal_Unicode > SAL_CALL getAttrChar(void)  throw( RuntimeException );
176     virtual void SAL_CALL setAttrChar(const Sequence< sal_Unicode >& AttrChar_) throw( RuntimeException );
177     virtual Sequence< Any > SAL_CALL getAttrAny(void)  throw( RuntimeException );
178     virtual void SAL_CALL setAttrAny(const Sequence< Any >& AttrAny_) throw( RuntimeException );
179     virtual Sequence< Type > SAL_CALL getAttrType(void)  throw( RuntimeException );
180     virtual void SAL_CALL setAttrType( const Sequence< Type >& _attrtype ) throw (RuntimeException);
181     virtual Sequence< Sequence< sal_Int32 > > SAL_CALL getAttrSequence(void) throw( RuntimeException );
182     virtual void SAL_CALL  setAttrSequence(const Sequence< Sequence< sal_Int32 > >& AttrSequence_) throw( RuntimeException );
183     virtual Sequence< Sequence< Sequence< sal_Int32 > > > SAL_CALL getAttrSequence2(void)  throw( RuntimeException );
184     virtual void SAL_CALL setAttrSequence2(const Sequence< Sequence< Sequence< sal_Int32 > > >& AttrSequence2_) throw ( RuntimeException );
185     virtual Sequence< Reference< XInterface > > SAL_CALL getAttrXInterface() throw(RuntimeException);
186     virtual void SAL_CALL setAttrXInterface( const Sequence< Reference< XInterface > >& _attrxinterface ) throw(RuntimeException);
187 
188     virtual ::sal_Int8 SAL_CALL getAByte() throw (RuntimeException);
189     virtual void SAL_CALL setAByte( ::sal_Int8 _abyte ) throw (RuntimeException);
190     virtual float SAL_CALL getAFloat() throw (RuntimeException);
191     virtual void SAL_CALL setAFloat( float _afloat ) throw (RuntimeException);
192     virtual double SAL_CALL getADouble() throw (RuntimeException);
193     virtual void SAL_CALL setADouble( double _adouble ) throw (RuntimeException);
194     virtual ::sal_Bool SAL_CALL getABool() throw (RuntimeException);
195     virtual void SAL_CALL setABool( ::sal_Bool _abool ) throw (RuntimeException);
196     virtual ::sal_Int16 SAL_CALL getAShort() throw (RuntimeException);
197     virtual void SAL_CALL setAShort( ::sal_Int16 _ashort ) throw (RuntimeException);
198     virtual ::sal_uInt16 SAL_CALL getAUShort() throw (RuntimeException);
199     virtual void SAL_CALL setAUShort( ::sal_uInt16 _aushort ) throw (RuntimeException);
200     virtual ::sal_Int32 SAL_CALL getALong() throw (RuntimeException);
201     virtual void SAL_CALL setALong( ::sal_Int32 _along ) throw (RuntimeException);
202     virtual ::sal_uInt32 SAL_CALL getAULong() throw (RuntimeException);
203     virtual void SAL_CALL setAULong( ::sal_uInt32 _aulong ) throw (RuntimeException);
204     virtual ::rtl::OUString SAL_CALL getAString() throw (RuntimeException);
205     virtual void SAL_CALL setAString( const ::rtl::OUString& _astring ) throw (RuntimeException);
206     virtual ::sal_Unicode SAL_CALL getAChar() throw (RuntimeException);
207     virtual void SAL_CALL setAChar( ::sal_Unicode _achar ) throw (RuntimeException);
208     virtual Any SAL_CALL getAAny() throw (RuntimeException);
209     virtual void SAL_CALL setAAny( const Any& _aany ) throw (RuntimeException);
210     virtual Type SAL_CALL getAType() throw (RuntimeException);
211     virtual void SAL_CALL setAType( const Type& _atype ) throw (RuntimeException);
212     virtual Reference< XInterface > SAL_CALL getAXInterface() throw (RuntimeException);
213     virtual void SAL_CALL setAXInterface( const Reference<XInterface >& _axinterface ) throw (RuntimeException);
214     virtual Reference<XInvocation > SAL_CALL getAXInvocation() throw (RuntimeException);
215     virtual void SAL_CALL setAXInvocation( const Reference< XInvocation >& _axinvocation ) throw (RuntimeException);
216 
217     virtual void SAL_CALL testout_methodByte(sal_Int8& rOut) throw( RuntimeException );
218     virtual void SAL_CALL testout_methodFloat(float& rOut) throw( RuntimeException );
219     virtual void SAL_CALL testout_methodDouble(double& rOut) throw( RuntimeException );
220     virtual void SAL_CALL testout_methodBool(sal_Bool& rOut) throw( RuntimeException );
221     virtual void SAL_CALL testout_methodShort(sal_Int16& rOut) throw( RuntimeException );
222     virtual void SAL_CALL testout_methodUShort(sal_uInt16& rOut) throw( RuntimeException );
223     virtual void SAL_CALL testout_methodLong(sal_Int32& rOut) throw( RuntimeException );
224     virtual void SAL_CALL testout_methodULong(sal_uInt32& rOut) throw( RuntimeException );
225     virtual void SAL_CALL testout_methodHyper(sal_Int64& rOut) throw( RuntimeException );
226     virtual void SAL_CALL testout_methodUHyper(sal_uInt64& rOut) throw( RuntimeException );
227     virtual void SAL_CALL testout_methodString(OUString& rOut) throw( RuntimeException );
228     virtual void SAL_CALL testout_methodChar(sal_Unicode& rOut) throw( RuntimeException );
229     virtual void SAL_CALL testout_methodAny(Any& rOut) throw( RuntimeException );
230     virtual void SAL_CALL testout_methodType(Type& rOut) throw( RuntimeException );
231     virtual void SAL_CALL testout_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException );
232     virtual void SAL_CALL testout_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException );
233     virtual void SAL_CALL testout_methodMulParams1(sal_Int32& rout1, sal_Int32& rout2) throw( RuntimeException );
234     virtual void SAL_CALL testout_methodMulParams2(sal_Int32& rout1, sal_Int32& rout2, OUString& rout3) throw( RuntimeException );
235     virtual void SAL_CALL testout_methodMulParams3(const OUString& sin, OUString& sout) throw( RuntimeException );
236     virtual void SAL_CALL testout_methodMulParams4( float in1, float& out1, sal_Int32 in2, sal_Int32& out2, sal_Int32 in3 ) throw(RuntimeException);
237     virtual void SAL_CALL testout_methodXInterface( Reference< XInterface >& rOut ) throw(RuntimeException);
238 
239     virtual void SAL_CALL testinout_methodByte(sal_Int8& rOut) throw( RuntimeException );
240     virtual void SAL_CALL testinout_methodFloat(float& rOut) throw( RuntimeException );
241     virtual void SAL_CALL testinout_methodDouble(double& rOut) throw( RuntimeException );
242     virtual void SAL_CALL testinout_methodBool(sal_Bool& rOut) throw( RuntimeException );
243     virtual void SAL_CALL testinout_methodShort(sal_Int16& rOut) throw( RuntimeException );
244     virtual void SAL_CALL testinout_methodUShort(sal_uInt16& rOut) throw( RuntimeException );
245     virtual void SAL_CALL testinout_methodLong(sal_Int32& rOut) throw( RuntimeException );
246     virtual void SAL_CALL testinout_methodULong(sal_uInt32& rOut) throw( RuntimeException );
247     virtual void SAL_CALL testinout_methodHyper(sal_Int64& rOut) throw( RuntimeException );
248     virtual void SAL_CALL testinout_methodUHyper(sal_uInt64& rOut) throw( RuntimeException );
249     virtual void SAL_CALL testinout_methodString(OUString& rOut) throw( RuntimeException );
250     virtual void SAL_CALL testinout_methodChar(sal_Unicode& rOut) throw( RuntimeException );
251     virtual void SAL_CALL testinout_methodAny(Any& rOut) throw( RuntimeException );
252     virtual void SAL_CALL testinout_methodType(Type& rOut) throw( RuntimeException );
253     virtual void SAL_CALL testinout_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException );
254     virtual void SAL_CALL testinout_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException );
255     virtual void SAL_CALL testinout_methodXInterface( Reference< XInvocation >& rOut ) throw(RuntimeException);
256     virtual void SAL_CALL testinout_methodXInterface2( Reference< XInterface > & rOut) throw( RuntimeException);
257     virtual Any SAL_CALL methodAnyTest1(const Any& rIn) throw( RuntimeException ) ;
258     virtual Any SAL_CALL getAttrAny2(void) throw( RuntimeException ) ;
259     virtual void SAL_CALL setAttrAny2(const Any& AttrAny2_) throw( RuntimeException ) ;
260 
261 
262     // XTestStruct
263     virtual void SAL_CALL methodStruct(const Property& aProp) throw( RuntimeException );
264 
265     virtual Property SAL_CALL retMethodStruct(void) throw( RuntimeException );
266 
267     virtual Property SAL_CALL  getAttrStruct(void) throw( RuntimeException );
268     virtual void SAL_CALL setAttrStruct(const Property& AttrStruct_) throw( RuntimeException );
269     virtual Property SAL_CALL methodStruct2( const Property& aProp ) throw (RuntimeException);
270 
271     // XTestOther
272     virtual void SAL_CALL other_methodAnyIn(const Any& rAny) throw( RuntimeException );
273     virtual void SAL_CALL other_methodAnyOut(Any& rAny) throw( RuntimeException );
274     virtual Any SAL_CALL other_methodAnyRet(void) throw( RuntimeException );
275     virtual void SAL_CALL in_float( float val) throw ( RuntimeException);
276     virtual Any SAL_CALL other_methodAny( const Any& rAny, const OUString& typeInAny )
277         throw (RuntimeException);
278 
279 
280     // XTestOutParameters ------------------------------------------------------------------------
281 //     virtual void SAL_CALL out_test(sal_Int8 rIn) throw( RuntimeException );
282 
283 //  virtual void SAL_CALL out_methodByte(sal_Int8& rOut) throw( RuntimeException );
284 //  virtual void SAL_CALL out_methodFloat(float& rOut) throw( RuntimeException );
285 //  virtual void SAL_CALL out_methodDouble(double& rOut) throw( RuntimeException );
286 //  virtual void SAL_CALL out_methodBool(sal_Bool& rOut) throw( RuntimeException );
287 //  virtual void SAL_CALL out_methodShort(sal_Int16& rOut) throw( RuntimeException );
288 //  virtual void SAL_CALL out_methodUShort(sal_uInt16& rOut) throw( RuntimeException );
289 //  virtual void SAL_CALL out_methodLong(sal_Int32& rOut) throw( RuntimeException );
290 //  virtual void SAL_CALL out_methodULong(sal_uInt32& rOut) throw( RuntimeException );
291 //  virtual void SAL_CALL out_methodHyper(sal_Int64& rOut) throw( RuntimeException );
292 //  virtual void SAL_CALL out_methodUHyper(sal_uInt64& rOut) throw( RuntimeException );
293 //     virtual void SAL_CALL out_methodString(OUString& rOut) throw( RuntimeException );
294 //  virtual void SAL_CALL out_methodChar(sal_Unicode& rOut) throw( RuntimeException );
295 //  virtual void SAL_CALL out_methodAny(Any& rOut) throw( RuntimeException );
296 //  virtual void SAL_CALL out_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException );
297 //  virtual void SAL_CALL out_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException );
298 //     virtual void SAL_CALL out_methodMulParams1(sal_Int32& rout1, sal_Int32& rout2) throw( RuntimeException );
299 //     virtual void SAL_CALL out_methodMulParams2(sal_Int32& rout1, sal_Int32& rout2, OUString& rout3) throw( RuntimeException );
300 //     virtual void SAL_CALL out_methodMulParams3(const OUString& sin, OUString& sout) throw( RuntimeException );
301 
302     // XTestInParameters
303     virtual sal_Int8 SAL_CALL in_methodByte( sal_Int8 rIn ) throw (RuntimeException);
304     virtual float SAL_CALL in_methodFloat( float rIn ) throw (RuntimeException);
305     virtual double SAL_CALL in_methodDouble( double rIn ) throw (RuntimeException);
306     virtual sal_Bool SAL_CALL in_methodBool( sal_Bool rIn ) throw (RuntimeException);
307     virtual sal_Int16 SAL_CALL in_methodShort( sal_Int16 rIn ) throw (RuntimeException);
308     virtual sal_uInt16 SAL_CALL in_methodUShort( sal_uInt16 rIn ) throw (RuntimeException);
309     virtual sal_Int32 SAL_CALL in_methodLong( sal_Int32 rIn ) throw (RuntimeException);
310     virtual sal_uInt32 SAL_CALL in_methodULong( sal_uInt32 rIn ) throw (RuntimeException);
311     virtual sal_Int64 SAL_CALL in_methodHyper( sal_Int64 rIn ) throw (RuntimeException);
312     virtual sal_uInt64 SAL_CALL in_methodUHyper( sal_uInt64 rIn ) throw (RuntimeException);
313     virtual OUString SAL_CALL in_methodString( const OUString& rIn ) throw (RuntimeException);
314     virtual sal_Unicode SAL_CALL in_methodChar( sal_Unicode rIn ) throw (RuntimeException);
315     virtual Any SAL_CALL in_methodAny( const Any& rIn ) throw (RuntimeException);
316     virtual Type SAL_CALL in_methodType( const Type& rIn ) throw (RuntimeException);
317     virtual Reference<XInterface> SAL_CALL in_methodXInterface( const Reference< XInterface >& rIn ) throw (RuntimeException);
318     virtual Reference<XInvocation > SAL_CALL in_methodInvocation( const Reference< XInvocation >& inv ) throw (RuntimeException);
319     virtual SimpleStruct SAL_CALL in_methodStruct( const SimpleStruct& aStruct ) throw (RuntimeException);
320     virtual void SAL_CALL in_methodAll( sal_Int8 b, float f, double d, sal_Bool boo, sal_Int16 sh, sal_uInt16 us, sal_Int32 l, sal_uInt32 ul, const OUString& s, sal_Unicode c, const Any& a, const Type& t, const Reference<XInvocation>& inv ) throw (RuntimeException);
321 
322     // XTestInterfaces --------------------------------------------------------------------------
323     virtual void SAL_CALL testInterface(  const Reference< XCallback >& xCallback, sal_Int32 mode ) throw(RuntimeException);
324     virtual void SAL_CALL testInterface2(  const Reference< XSimple >& xSimple, sal_Int32 mode ) throw(RuntimeException);
325     // XSimple --------------------------------------------------------------------------
326     void SAL_CALL func( const OUString &message) throw(::com::sun::star::uno::RuntimeException);
327     OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
328 
329     // XIdentity
330     virtual void SAL_CALL setObject( const Reference< XInterface >& val ) throw (RuntimeException);
331     virtual sal_Bool SAL_CALL isSame( const Reference< XInterface >& val ) throw (RuntimeException);
332     virtual Reference< XInterface > SAL_CALL getThis(  ) throw (RuntimeException);
333 };
334 
335 class EventListener: public WeakImplHelper1<XEventListener>
336 {
337 public:
EventListener()338     EventListener::EventListener(): bCalled( sal_False)
339         {}
340     virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (RuntimeException);
341 
342     sal_Bool bCalled;
343 };
344 
345 
~OComponent()346 OComponent::~OComponent()
347 {
348 }
349 
350 
351 // Funktions ==============================================================================
352 
OComponent_CreateInstance(const Reference<XMultiServiceFactory> & rSMgr)353 Reference<XInterface> SAL_CALL OComponent_CreateInstance( const Reference<XMultiServiceFactory> & rSMgr ) throw(RuntimeException)
354 {
355 //  Reference<XInterface> xService(static_cast<XWeak*>(new OComponent( rSMgr )), UNO_QUERY);
356     OComponent* o= new OComponent( rSMgr );
357     Reference<XInterface> xService(static_cast<XIdentity*>(o), UNO_QUERY);
358     return xService;
359 }
360 
OComponent_getSupportedServiceNames(void)361 Sequence<OUString> OComponent_getSupportedServiceNames(void)
362 {
363     Sequence<OUString> aRet(1);
364     aRet.getArray()[0] = SERVICE_NAME;//ODataInputStream_getImplementationName();
365 
366     return aRet;
367 }
368 
369 
component_writeInfo(void *,void * pRegistryKey)370 extern "C" sal_Bool SAL_CALL component_writeInfo(   void * /*pServiceManager*/, void * pRegistryKey )
371 {
372     if(pRegistryKey)
373     {
374         try
375         {
376             Reference<XRegistryKey> xNewKey =
377                 reinterpret_cast<XRegistryKey*>( pRegistryKey)->createKey(KEY1);
378             xNewKey->createKey( KEY2);
379             return sal_True;
380 
381         }
382         catch(InvalidRegistryException &)
383         {
384             OSL_ENSURE( sal_False, "### InvalidRegistryException!\n");
385         }
386     }
387     return sal_False;
388 }
389 
component_getFactory(const sal_Char * pImplName,void * pServiceManager,void *)390 extern "C" void * SAL_CALL component_getFactory(
391     const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
392 {
393     static void * pRet= NULL;
394     if( ! pRet)
395     {
396         OUString aImplName( OUString::createFromAscii( pImplName ) );
397         if (pServiceManager && aImplName.equals(  IMPL_NAME  ))
398         {
399             Reference<XMultiServiceFactory> xMulFac(
400                 reinterpret_cast< XMultiServiceFactory*>(pServiceManager));
401 
402             Sequence<OUString> seqServiceNames;
403             Reference<XSingleServiceFactory> xFactory = createOneInstanceFactory( xMulFac, SERVICE_NAME,
404                                         OComponent_CreateInstance, seqServiceNames);
405 
406             if (xFactory.is())
407             {
408                 xFactory->acquire();
409                 pRet = xFactory.get();
410             }
411         }
412     }
413     return  pRet;
414 }
415 
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)416 extern "C" void SAL_CALL component_getImplementationEnvironment(
417     const sal_Char ** ppEnvTypeName, uno_Environment ** )
418 {
419     *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
420 }
421 
422 
423 // XTestSequence ============================================================================
methodByte(const Sequence<sal_Int8> & aSeq)424 Sequence<sal_Int8> SAL_CALL OComponent::methodByte(const Sequence< sal_Int8 >& aSeq) throw( RuntimeException )
425 {
426     sal_Int8 _x;
427     for( sal_Int16 i= 0; i < aSeq.getLength(); i++){
428         _x= aSeq.getConstArray()[i];
429     }
430     return aSeq;
431 }
methodFloat(const Sequence<float> & aSeq)432 Sequence<float> SAL_CALL OComponent::methodFloat(const Sequence< float>& aSeq) throw( RuntimeException )
433 {
434     float _x;
435     for( sal_Int16 i= 0; i < aSeq.getLength(); i++){
436         _x= aSeq.getConstArray()[i];
437     }
438     return aSeq;
439 }
methodDouble(const Sequence<double> & aSeq)440 Sequence<double> SAL_CALL OComponent::methodDouble(const Sequence< double >& aSeq) throw( RuntimeException)
441 {
442     double _x;
443     for( sal_Int16 i= 0; i < aSeq.getLength(); i++){
444         _x= aSeq.getConstArray()[i];
445     }
446     return aSeq;
447 }
methodBool(const Sequence<sal_Bool> & aSeq)448 Sequence< sal_Bool > SAL_CALL OComponent::methodBool(const Sequence< sal_Bool >& aSeq) throw( RuntimeException)
449 {
450     sal_Bool _x;
451     for( sal_Int16 i= 0; i < aSeq.getLength(); i++){
452         _x= aSeq.getConstArray()[i];
453     }
454     return aSeq;
455 }
methodShort(const Sequence<sal_Int16> & aSeq)456 Sequence< sal_Int16 > SAL_CALL OComponent::methodShort(const Sequence< sal_Int16 >& aSeq) throw( RuntimeException )
457 {
458     sal_Int16 _x;
459     for( sal_Int16 i= 0; i < aSeq.getLength(); i++){
460         _x= aSeq.getConstArray()[i];
461     }
462     return aSeq;
463 }
methodUShort(const Sequence<sal_uInt16> & aSeq)464 Sequence< sal_uInt16 > SAL_CALL OComponent::methodUShort(const Sequence< sal_uInt16 >& aSeq) throw( RuntimeException )
465 {
466     sal_uInt16 _x;
467     for( sal_Int16 i= 0; i < aSeq.getLength(); i++){
468         _x= aSeq.getConstArray()[i];
469     }
470     return aSeq;
471 }
methodLong(const Sequence<sal_Int32> & aSeq)472 Sequence< sal_Int32 > SAL_CALL OComponent::methodLong(const Sequence< sal_Int32 >& aSeq) throw( RuntimeException)
473 {
474     sal_Int32 _x;
475     for( sal_Int16 i= 0; i < aSeq.getLength(); i++)  {
476         _x= aSeq.getConstArray()[i];
477     }
478     return aSeq;
479 }
methodULong(const Sequence<sal_uInt32> & aSeq)480 Sequence< sal_uInt32 > SAL_CALL OComponent::methodULong(const Sequence< sal_uInt32 >& aSeq) throw( RuntimeException)
481 {
482     sal_uInt32 _x;
483     for( sal_Int16 i= 0; i < aSeq.getLength(); i++){
484         _x= aSeq.getConstArray()[i];
485     }
486     return aSeq;
487 }
methodString(const Sequence<OUString> & aSeq)488 Sequence< OUString > SAL_CALL OComponent::methodString(const Sequence< OUString >& aSeq) throw( RuntimeException)
489 {
490     OUString _x;
491     for( sal_Int16 i= 0; i < aSeq.getLength(); i++) {
492         _x= aSeq.getConstArray()[i];
493     }
494     return aSeq;
495 }
methodChar(const Sequence<sal_Unicode> & aSeq)496 Sequence< sal_Unicode > SAL_CALL OComponent::methodChar(const Sequence< sal_Unicode >& aSeq) throw( RuntimeException)
497 {
498     sal_Unicode _x;
499     for( sal_Int16 i= 0; i < aSeq.getLength(); i++){
500         _x= aSeq.getConstArray()[i];
501     }
502     return aSeq;
503 }
methodAny(const Sequence<Any> & aSeq)504 Sequence< Any > SAL_CALL OComponent::methodAny(const Sequence< Any >& aSeq) throw( RuntimeException)
505 {
506     Any _x;
507     for( sal_Int16 i= 0; i < aSeq.getLength(); i++){
508         _x= aSeq.getConstArray()[i];
509         TypeClass _t= _x.getValueTypeClass();
510         if( _t== TypeClass_STRING)
511             OUString s(* (rtl_uString**)_x.getValue());
512     }
513     return aSeq;
514 
515 }
516 
methodType(const Sequence<Type> & aSeq)517 Sequence< Type > SAL_CALL OComponent::methodType(const Sequence< Type >& aSeq) throw( RuntimeException )
518 {
519     Type _x;
520     for( sal_Int16 i= 0; i < aSeq.getLength(); i++){
521         _x= aSeq.getConstArray()[i];
522     }
523     return aSeq;
524 }
525 //Sequence< Reference< XInterface> > SAL_CALL methodXInterface ( const Sequence< Reference < XInterface> >& aSeq)
526 //  throw (RuntimeException)
methodXInterface(const Sequence<Reference<XInterface>> & aSeq)527 Sequence< Reference< XInterface > > SAL_CALL OComponent::methodXInterface( const Sequence< Reference< XInterface > >& aSeq ) throw(RuntimeException)
528 {
529     for( sal_Int32 i= 0; i < aSeq.getLength(); i++)
530     {
531         Reference<XInterface> xInt= aSeq[i];
532         Reference<XEventListener> xList( xInt, UNO_QUERY);
533         if( xList.is())
534             xList->disposing( EventObject());
535     }
536     return aSeq;
537 }
538 
methodSequence(const Sequence<Sequence<sal_Int32>> & aSeq)539 Sequence< Sequence< sal_Int32 > > SAL_CALL OComponent::methodSequence(const Sequence< Sequence< sal_Int32 > >& aSeq) throw( RuntimeException)
540 {
541     sal_Int32 value;
542     for( sal_Int16 i= 0; i < aSeq.getLength(); i++){
543         const Sequence<sal_Int32>& rseq2= aSeq.getConstArray()[i];
544         for (sal_Int16 j= 0; j < rseq2.getLength(); j++){
545             value= rseq2.getConstArray()[j];
546         }
547     }
548     return aSeq;
549 }
methodSequence2(const Sequence<Sequence<Sequence<sal_Int32>>> & aSeq)550 Sequence< Sequence< Sequence< sal_Int32 > > > SAL_CALL OComponent::methodSequence2(const Sequence< Sequence< Sequence< sal_Int32 > > >& aSeq)
551     throw( RuntimeException )
552 {
553     sal_Int32 value;
554     sal_Int32 len= aSeq.getLength();
555     for( sal_Int16 i= 0; i < aSeq.getLength(); i++){
556         const Sequence< Sequence<sal_Int32> >& rseq2= aSeq.getConstArray()[i];
557         len= rseq2.getLength();
558 
559         for (sal_Int16 j= 0; j < rseq2.getLength(); j++){
560             const Sequence<sal_Int32> & rseq3= rseq2.getConstArray()[j];
561             len= rseq3.getLength();
562 
563             for (sal_Int16 k= 0; k < rseq3.getLength(); k++)
564                 value= rseq3.getConstArray()[k];
565         }
566     }
567     return aSeq;
568 }
569 
methodXEventListeners(const Sequence<Reference<XEventListener>> & aSeq)570 Sequence< Reference< XEventListener> > SAL_CALL OComponent::methodXEventListeners( const Sequence< Reference <XEventListener> >& aSeq) throw( RuntimeException)
571 {
572     Reference<XEventListener> listener;
573     for( int i= 0; i < aSeq.getLength(); i++)
574     {
575         listener= aSeq[i];
576 
577         listener->disposing( EventObject() );
578     }
579 
580     return aSeq;
581 }
582 
methodXEventListenersMul(const Sequence<Sequence<Reference<XEventListener>>> & aSeq)583 Sequence< Sequence<Reference<XEventListener > > > SAL_CALL OComponent::methodXEventListenersMul( const Sequence<Sequence<Reference<XEventListener > > >& aSeq ) throw (RuntimeException)
584 {
585     Reference<XEventListener> listener;
586     for( int i= 0; i < aSeq.getLength(); i++)
587     {
588         Sequence<Reference<XEventListener> > seqInner= aSeq[i];
589         for( int j= 0; j < seqInner.getLength(); j++)
590         {
591             listener= seqInner[j];
592             listener->disposing( EventObject() );
593         }
594     }
595     return aSeq;
596 }
597 
598 //---------------------------------------------------------------------------------------------
599 
getAttrByte(void)600 Sequence< sal_Int8 > SAL_CALL OComponent::getAttrByte(void) throw( RuntimeException)
601 {
602     return m_seqByte;
603 }
setAttrByte(const Sequence<sal_Int8> & AttrByte_)604 void SAL_CALL OComponent::setAttrByte(const Sequence< sal_Int8 >& AttrByte_) throw( RuntimeException )
605 {
606     m_seqByte= AttrByte_;
607 }
getAttrFloat(void)608 Sequence< float > SAL_CALL OComponent::getAttrFloat(void)  throw( RuntimeException )
609 {
610     return m_seqFloat;
611 }
setAttrFloat(const Sequence<float> & AttrFloat_)612 void SAL_CALL OComponent::setAttrFloat(const Sequence< float >& AttrFloat_) throw( RuntimeException )
613 {
614     m_seqFloat= AttrFloat_;
615 }
616 
getAttrDouble(void)617 Sequence< double > SAL_CALL OComponent::getAttrDouble(void)  throw( RuntimeException )
618 {
619     return m_seqDouble;
620 }
setAttrDouble(const Sequence<double> & AttrDouble_)621 void SAL_CALL OComponent::setAttrDouble(const Sequence< double >& AttrDouble_) throw( RuntimeException )
622 {
623     m_seqDouble= AttrDouble_;
624 }
625 
getAttrBool(void)626 Sequence< sal_Bool > SAL_CALL OComponent::getAttrBool(void)  throw( RuntimeException)
627 {
628     return m_seqBool;
629 }
630 
setAttrBool(const Sequence<sal_Bool> & AttrBool_)631 void SAL_CALL OComponent::setAttrBool(const Sequence< sal_Bool >& AttrBool_) throw (RuntimeException )
632 {
633     m_seqBool= AttrBool_;
634 }
635 
getAttrShort(void)636 Sequence< sal_Int16 > SAL_CALL OComponent::getAttrShort(void)  throw( RuntimeException)
637 {
638     return m_seqShort;
639 }
setAttrShort(const Sequence<sal_Int16> & AttrShort_)640 void SAL_CALL OComponent::setAttrShort(const Sequence< sal_Int16 >& AttrShort_) throw( RuntimeException )
641 {
642     m_seqShort= AttrShort_;
643 }
644 
getAttrUShort(void)645 Sequence< sal_uInt16 > SAL_CALL OComponent::getAttrUShort(void) throw( RuntimeException )
646 {
647     return m_seqUShort;
648 }
setAttrUShort(const Sequence<sal_uInt16> & AttrUShort_)649 void SAL_CALL OComponent::setAttrUShort(const Sequence< sal_uInt16 >& AttrUShort_) throw( RuntimeException )
650 {
651     m_seqUShort= AttrUShort_;
652 }
653 
getAttrLong(void)654 Sequence< sal_Int32 > SAL_CALL OComponent::getAttrLong(void)  throw( RuntimeException)
655 {
656     return m_seqLong;
657 }
setAttrLong(const Sequence<sal_Int32> & AttrLong_)658 void SAL_CALL OComponent::setAttrLong(const Sequence< sal_Int32 >& AttrLong_) throw( RuntimeException )
659 {
660     m_seqLong= AttrLong_;
661 }
662 
getAttrULong(void)663 Sequence< sal_uInt32 > SAL_CALL OComponent::getAttrULong(void)  throw( RuntimeException )
664 {
665     return m_seqULong;
666 }
setAttrULong(const Sequence<sal_uInt32> & AttrULong_)667 void SAL_CALL OComponent::setAttrULong(const Sequence< sal_uInt32 >& AttrULong_) throw( RuntimeException )
668 {
669     m_seqULong= AttrULong_;
670 }
671 
getAttrString(void)672 Sequence< OUString > SAL_CALL OComponent::getAttrString(void)  throw( RuntimeException )
673 {
674     return m_seqString;
675 }
setAttrString(const Sequence<OUString> & AttrString_)676 void SAL_CALL OComponent::setAttrString(const Sequence< OUString >& AttrString_) throw( RuntimeException )
677 {
678     m_seqString= AttrString_;
679 }
680 
getAttrChar(void)681 Sequence< sal_Unicode > SAL_CALL OComponent::getAttrChar(void)  throw( RuntimeException )
682 {
683     return m_seqChar;
684 }
setAttrChar(const Sequence<sal_Unicode> & AttrChar_)685 void SAL_CALL OComponent::setAttrChar(const Sequence< sal_Unicode >& AttrChar_) throw( RuntimeException)
686 {
687     m_seqChar= AttrChar_;
688 }
689 
getAttrAny(void)690 Sequence< Any > SAL_CALL OComponent::getAttrAny(void) throw( RuntimeException)
691 {
692     return m_seqAny;
693 }
setAttrAny(const Sequence<Any> & AttrAny_)694 void SAL_CALL OComponent::setAttrAny(const Sequence< Any >& AttrAny_) throw( RuntimeException )
695 {
696     m_seqAny= AttrAny_;
697 }
698 
getAttrType(void)699 Sequence< Type > SAL_CALL OComponent::getAttrType(void)  throw( RuntimeException )
700 {
701     return m_seqType;
702 }
703 
setAttrType(const Sequence<Type> & AttrType_)704 void SAL_CALL OComponent::setAttrType( const Sequence< Type >& AttrType_) throw( RuntimeException )
705 {
706     m_seqType = AttrType_;
707 }
708 
709 
getAttrSequence(void)710 Sequence< Sequence< sal_Int32 > > SAL_CALL OComponent::getAttrSequence(void)  throw( RuntimeException)
711 {
712     return m_seq1;
713 }
setAttrSequence(const Sequence<Sequence<sal_Int32>> & AttrSequence)714 void SAL_CALL OComponent::setAttrSequence(const Sequence< Sequence< sal_Int32 > >& AttrSequence) throw(RuntimeException )
715 {
716     sal_Int32 x= 0;
717     for( sal_Int32 i=0; i < AttrSequence.getLength(); i++)
718     {
719          Sequence< sal_Int32 > seq= AttrSequence[i];
720 
721         for ( sal_Int32 j=0; j < seq.getLength(); j++)
722         {
723             x= seq[j];
724         }
725     }
726 
727     m_seq1= AttrSequence;
728 }
729 
getAttrSequence2(void)730 Sequence< Sequence< Sequence< sal_Int32 > > > SAL_CALL OComponent::getAttrSequence2(void)  throw( RuntimeException )
731 {
732     return m_seq2;
733 }
setAttrSequence2(const Sequence<Sequence<Sequence<sal_Int32>>> & AttrSequence2_)734 void SAL_CALL OComponent::setAttrSequence2(const Sequence< Sequence< Sequence< sal_Int32 > > >& AttrSequence2_)
735     throw( RuntimeException )
736 {
737     m_seq2= AttrSequence2_;
738 }
739 
getAttrXInterface()740 Sequence< Reference< XInterface > > SAL_CALL OComponent::getAttrXInterface() throw(RuntimeException)
741 {
742     return m_seqxInterface;
743 }
setAttrXInterface(const Sequence<Reference<XInterface>> & _attrxinterface)744 void SAL_CALL OComponent::setAttrXInterface( const Sequence< Reference< XInterface > >& _attrxinterface ) throw(RuntimeException)
745 {
746     m_seqxInterface= _attrxinterface;
747 }
748 
749 // ----------------------------------------------------------------------------
750 
getAByte()751 ::sal_Int8 SAL_CALL OComponent::getAByte() throw (RuntimeException)
752 {
753     return m_attr_int8;
754 }
755 
setAByte(::sal_Int8 _abyte)756 void SAL_CALL OComponent::setAByte( ::sal_Int8 _abyte ) throw (RuntimeException)
757 {
758     m_attr_int8 = _abyte;
759 }
760 
getAFloat()761 float SAL_CALL OComponent::getAFloat() throw (RuntimeException)
762 {
763     return m_attr_float;
764 }
765 
setAFloat(float _afloat)766 void SAL_CALL OComponent::setAFloat( float _afloat ) throw (RuntimeException)
767 {
768     m_attr_float = _afloat;
769 }
770 
getADouble()771 double SAL_CALL OComponent::getADouble() throw (RuntimeException)
772 {
773     return m_attr_double;
774 }
775 
setADouble(double _adouble)776 void SAL_CALL OComponent::setADouble( double _adouble ) throw (RuntimeException)
777 {
778     m_attr_double = _adouble;
779 }
780 
getABool()781 ::sal_Bool SAL_CALL OComponent::getABool() throw (RuntimeException)
782 {
783     return m_attr_bool;
784 }
785 
setABool(::sal_Bool _abool)786 void SAL_CALL OComponent::setABool( ::sal_Bool _abool ) throw (RuntimeException)
787 {
788     m_attr_bool = _abool;
789 }
790 
getAShort()791 ::sal_Int16 SAL_CALL OComponent::getAShort() throw (RuntimeException)
792 {
793     return m_attr_int16;
794 }
795 
setAShort(::sal_Int16 _ashort)796 void SAL_CALL OComponent::setAShort( ::sal_Int16 _ashort ) throw (RuntimeException)
797 {
798     m_attr_int16 = _ashort;
799 }
800 
getAUShort()801 ::sal_uInt16 SAL_CALL OComponent::getAUShort() throw (RuntimeException)
802 {
803     return m_attr_uint16;
804 }
805 
setAUShort(::sal_uInt16 _aushort)806 void SAL_CALL OComponent::setAUShort( ::sal_uInt16 _aushort ) throw (RuntimeException)
807 {
808     m_attr_uint16 = _aushort;
809 }
810 
getALong()811 ::sal_Int32 SAL_CALL OComponent::getALong() throw (RuntimeException)
812 {
813     return m_attr_int32;
814 }
815 
setALong(::sal_Int32 _along)816 void SAL_CALL OComponent::setALong( ::sal_Int32 _along ) throw (RuntimeException)
817 {
818     m_attr_int32 = _along;
819 }
820 
getAULong()821 ::sal_uInt32 SAL_CALL OComponent::getAULong() throw (RuntimeException)
822 {
823     return m_attr_uint32;;
824 }
825 
setAULong(::sal_uInt32 _aulong)826 void SAL_CALL OComponent::setAULong( ::sal_uInt32 _aulong ) throw (RuntimeException)
827 {
828     m_attr_uint32 = _aulong;
829 }
830 
getAString()831 ::rtl::OUString SAL_CALL OComponent::getAString() throw (RuntimeException)
832 {
833     return m_attr_string;
834 }
835 
setAString(const::rtl::OUString & _astring)836 void SAL_CALL OComponent::setAString( const ::rtl::OUString& _astring ) throw (RuntimeException)
837 {
838     m_attr_string = _astring;
839 }
840 
getAChar()841 ::sal_Unicode SAL_CALL OComponent::getAChar() throw (RuntimeException)
842 {
843     return m_attr_char;
844 }
845 
setAChar(::sal_Unicode _achar)846 void SAL_CALL OComponent::setAChar( ::sal_Unicode _achar ) throw (RuntimeException)
847 {
848     m_attr_char = _achar;
849 }
850 
getAAny()851 Any SAL_CALL OComponent::getAAny() throw (RuntimeException)
852 {
853     return m_attr_any;
854 }
855 
setAAny(const Any & _aany)856 void SAL_CALL OComponent::setAAny( const Any& _aany ) throw (RuntimeException)
857 {
858     m_attr_any = _aany;
859 }
860 
getAType()861 Type SAL_CALL OComponent::getAType() throw (RuntimeException)
862 {
863     return m_attr_type;
864 }
865 
setAType(const Type & _atype)866 void SAL_CALL OComponent::setAType( const Type& _atype ) throw (RuntimeException)
867 {
868     m_attr_type = _atype;
869 }
870 
getAXInterface()871 Reference< XInterface > SAL_CALL OComponent::getAXInterface() throw (RuntimeException)
872 {
873     return m_attr_xinterface;
874 }
875 
setAXInterface(const Reference<XInterface> & _axinterface)876 void SAL_CALL OComponent::setAXInterface( const Reference<XInterface >& _axinterface ) throw (RuntimeException)
877 {
878     m_attr_xinterface = _axinterface;
879 }
880 
getAXInvocation()881 Reference<XInvocation > SAL_CALL OComponent::getAXInvocation() throw (RuntimeException)
882 {
883     return m_attr_xinvocation;
884 }
885 
setAXInvocation(const Reference<XInvocation> & _axinvocation)886 void SAL_CALL OComponent::setAXInvocation( const Reference< XInvocation >& _axinvocation ) throw (RuntimeException)
887 {
888     m_attr_xinvocation = _axinvocation;
889 }
890 //-----------------------------------------------------------------------------------
testout_methodByte(sal_Int8 & rOut)891 void SAL_CALL OComponent::testout_methodByte(sal_Int8& rOut) throw( RuntimeException )
892 {
893     rOut= m_int8;
894 }
testout_methodFloat(float & rOut)895 void SAL_CALL OComponent::testout_methodFloat(float& rOut) throw( RuntimeException )
896 {
897     rOut= m_float;
898 }
testout_methodDouble(double & rOut)899 void SAL_CALL OComponent::testout_methodDouble(double& rOut) throw( RuntimeException )
900 {
901     rOut= m_double;
902 }
903 
testout_methodBool(sal_Bool & rOut)904 void SAL_CALL OComponent::testout_methodBool(sal_Bool& rOut) throw( RuntimeException )
905 {
906     rOut= m_bool;
907 }
testout_methodShort(sal_Int16 & rOut)908 void SAL_CALL OComponent::testout_methodShort(sal_Int16& rOut) throw( RuntimeException )
909 {
910     rOut= m_int16;
911 }
testout_methodUShort(sal_uInt16 & rOut)912 void SAL_CALL OComponent::testout_methodUShort(sal_uInt16& rOut) throw( RuntimeException )
913 {
914     rOut= m_uint16;
915 }
testout_methodLong(sal_Int32 & rOut)916 void SAL_CALL OComponent::testout_methodLong(sal_Int32& rOut) throw( RuntimeException )
917 {
918     rOut = m_int32;
919 }
testout_methodULong(sal_uInt32 & rOut)920 void SAL_CALL OComponent::testout_methodULong(sal_uInt32& rOut) throw( RuntimeException )
921 {
922     rOut= m_uint32;
923 }
testout_methodHyper(sal_Int64 & rOut)924 void SAL_CALL OComponent::testout_methodHyper(sal_Int64& rOut) throw( RuntimeException )
925 {
926     rOut = m_int64;
927 }
928 
testout_methodUHyper(sal_uInt64 & rOut)929 void SAL_CALL OComponent::testout_methodUHyper(sal_uInt64& rOut) throw( RuntimeException )
930 {
931     rOut = m_uint64;
932 }
933 
testout_methodString(OUString & rOut)934 void SAL_CALL OComponent::testout_methodString(OUString& rOut) throw( RuntimeException )
935 {
936     rOut= m_string;
937 }
testout_methodChar(sal_Unicode & rOut)938 void SAL_CALL OComponent::testout_methodChar(sal_Unicode& rOut) throw( RuntimeException )
939 {
940     rOut= m_char;
941 }
testout_methodAny(Any & rOut)942 void SAL_CALL OComponent::testout_methodAny(Any& rOut) throw( RuntimeException)
943 {
944     rOut = m_any;
945 }
946 
testout_methodType(Type & rOut)947 void SAL_CALL OComponent::testout_methodType(Type& rOut) throw( RuntimeException )
948 {
949     rOut = m_type;
950 }
951 
testout_methodSequence(Sequence<sal_Int32> & rOut)952 void SAL_CALL OComponent::testout_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException)
953 {
954     rOut.realloc(10);
955     for( sal_Int16 i= 0; i < rOut.getLength(); i++) rOut.getArray()[i]= i;
956 }
testout_methodSequence2(Sequence<Sequence<sal_Int32>> & rOut)957 void SAL_CALL OComponent::testout_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException )
958 {
959     rOut.realloc( 10);
960     for( sal_Int16 i= 0; i < rOut.getLength(); i++){
961         Sequence<sal_Int32>& rseq2= rOut.getArray()[i];
962         rseq2.realloc( 10);
963         for (sal_Int16 j= 0; j < rseq2.getLength(); j++){
964             rseq2.getArray()[j]= j;
965         }
966     }
967 }
testout_methodMulParams1(sal_Int32 & rout1,sal_Int32 & rout2)968 void SAL_CALL OComponent::testout_methodMulParams1(sal_Int32& rout1, sal_Int32& rout2) throw( RuntimeException )
969 {
970     rout1= 999;
971     rout2= 1111;
972 }
testout_methodMulParams2(sal_Int32 & rout1,sal_Int32 & rout2,OUString & rout3)973 void SAL_CALL OComponent::testout_methodMulParams2(sal_Int32& rout1, sal_Int32& rout2, OUString& rout3) throw( RuntimeException )
974 {
975     rout1= 1111;
976     rout2= 1222;
977     rout3= L" another string";
978 }
testout_methodMulParams3(const OUString &,OUString & sout)979 void SAL_CALL OComponent::testout_methodMulParams3(const OUString&, OUString& sout) throw( RuntimeException )
980 {
981     sout= L"Out Hallo!";
982 }
testout_methodMulParams4(float in1,float & out1,sal_Int32 in2,sal_Int32 & out2,sal_Int32)983 void SAL_CALL OComponent::testout_methodMulParams4( float in1, float& out1, sal_Int32 in2, sal_Int32& out2, sal_Int32 ) throw(RuntimeException)
984 {
985     out1= in1 + 1;
986     out2= in2 + 1;
987 }
988 
testout_methodXInterface(Reference<XInterface> & rOut)989 void SAL_CALL OComponent::testout_methodXInterface( Reference< XInterface >& rOut ) throw(RuntimeException)
990 {
991     rOut = m_xinterface;
992 //  OUString string( L"Property Any");
993 //  m_any <<= string;
994 //  rOut=  Reference<XInterface> (static_cast<XTestSequence*>(this), UNO_QUERY);
995 }
996 
997 // XTestInParameters ------------------------------------------------------------
in_methodByte(sal_Int8 rIn)998 sal_Int8 SAL_CALL OComponent::in_methodByte( sal_Int8 rIn ) throw (RuntimeException)
999 {
1000     m_int8 = rIn;
1001     return rIn;
1002 }
in_methodFloat(float rIn)1003 float SAL_CALL OComponent::in_methodFloat( float rIn ) throw (RuntimeException)
1004 {
1005     m_float = rIn;
1006     return rIn;
1007 }
in_methodDouble(double rIn)1008 double SAL_CALL OComponent::in_methodDouble( double rIn ) throw (RuntimeException)
1009 {
1010     m_double = rIn;
1011     return rIn;
1012 }
in_methodBool(sal_Bool rIn)1013 sal_Bool SAL_CALL OComponent::in_methodBool( sal_Bool rIn ) throw (RuntimeException)
1014 {
1015     m_bool = rIn;
1016     return rIn;
1017 }
in_methodShort(sal_Int16 rIn)1018 sal_Int16 SAL_CALL OComponent::in_methodShort( sal_Int16 rIn ) throw (RuntimeException)
1019 {
1020     m_int16 = rIn;
1021     return rIn;
1022 }
in_methodUShort(sal_uInt16 rIn)1023 sal_uInt16 SAL_CALL OComponent::in_methodUShort( sal_uInt16 rIn ) throw (RuntimeException)
1024 {
1025     m_uint16 = rIn;
1026     return rIn;
1027 }
in_methodLong(sal_Int32 rIn)1028 sal_Int32 SAL_CALL OComponent::in_methodLong( sal_Int32 rIn ) throw (RuntimeException)
1029 {
1030     m_int32 = rIn;
1031     return rIn;
1032 }
in_methodULong(sal_uInt32 rIn)1033 sal_uInt32 SAL_CALL OComponent::in_methodULong( sal_uInt32 rIn ) throw (RuntimeException)
1034 {
1035     m_uint32 = rIn;
1036     return rIn;
1037 }
in_methodHyper(sal_Int64 rIn)1038 sal_Int64 SAL_CALL OComponent::in_methodHyper( sal_Int64 rIn ) throw (RuntimeException)
1039 {
1040     m_int64 = rIn;
1041     return rIn;
1042 }
1043 
in_methodUHyper(sal_uInt64 rIn)1044 sal_uInt64 SAL_CALL OComponent::in_methodUHyper( sal_uInt64 rIn ) throw (RuntimeException)
1045 {
1046     m_uint64 = rIn;
1047     return rIn;
1048 }
1049 
in_methodString(const OUString & rIn)1050 OUString SAL_CALL OComponent::in_methodString( const OUString& rIn ) throw (RuntimeException)
1051 {
1052     m_string = rIn;
1053     return rIn;
1054 }
in_methodChar(sal_Unicode rIn)1055 sal_Unicode SAL_CALL OComponent::in_methodChar( sal_Unicode rIn ) throw (RuntimeException)
1056 {
1057     m_char = rIn;
1058     return rIn;
1059 }
in_methodAny(const Any & rIn)1060 Any SAL_CALL OComponent::in_methodAny( const Any& rIn ) throw (RuntimeException)
1061 {
1062     m_any = rIn;
1063     return rIn;
1064 }
1065 
in_methodType(const Type & rIn)1066 Type SAL_CALL OComponent::in_methodType( const Type& rIn ) throw (RuntimeException)
1067 {
1068     m_type = rIn;
1069     return rIn;
1070 }
1071 
in_methodInvocation(const Reference<XInvocation> & inv)1072 Reference<XInvocation > SAL_CALL OComponent::in_methodInvocation( const Reference< XInvocation >& inv )
1073         throw (RuntimeException)
1074 {
1075     //We expect the invocation results from a conversion of VBasicEventListener.VBEventListener
1076 //which implements XEventListener
1077     // extensions/test/ole/EventListenerSample
1078     EventObject event( Reference<XInterface>(static_cast<XTestInParameters*>(this),UNO_QUERY));
1079     Any anyParam;
1080     anyParam <<= event;
1081     Sequence<Any> params( &anyParam, 1);
1082     Sequence<sal_Int16> outIndex;
1083     Sequence<Any> outParams;
1084     try{
1085     inv->invoke( OUString(RTL_CONSTASCII_USTRINGPARAM("disposing")),
1086                 params, outIndex, outParams);
1087     }catch(IllegalArgumentException &) {
1088     }
1089     catch(CannotConvertException &){
1090     }
1091     catch(InvocationTargetException&) {
1092     }
1093     return inv;
1094 }
in_methodXInterface(const Reference<XInterface> & rIn)1095 Reference<XInterface> SAL_CALL OComponent::in_methodXInterface( const Reference<XInterface >& rIn ) throw (RuntimeException)
1096 {
1097     m_xinterface = rIn;
1098     return rIn;
1099 }
1100 
in_methodStruct(const SimpleStruct & aStruct)1101 SimpleStruct SAL_CALL OComponent::in_methodStruct( const SimpleStruct& aStruct )
1102         throw (RuntimeException)
1103 {
1104     SimpleStruct& s= const_cast<SimpleStruct&>(aStruct);
1105     s.message= s.message + OUString(RTL_CONSTASCII_USTRINGPARAM(
1106         "This string was set in OleTest"));
1107     return aStruct;
1108 }
in_methodAll(sal_Int8,float,double,sal_Bool,sal_Int16,sal_uInt16,sal_Int32,sal_uInt32,const OUString &,sal_Unicode,const Any &,const Type &,const Reference<XInvocation> &)1109 void SAL_CALL OComponent::in_methodAll(
1110     sal_Int8, float, double, sal_Bool, sal_Int16, sal_uInt16,
1111     sal_Int32, sal_uInt32, const OUString&, sal_Unicode,
1112     const Any&, const Type&, const Reference<XInvocation>&) throw (RuntimeException)
1113 {
1114 }
1115 
1116 // INOUT -----------------------------------------------------------------------------------
testinout_methodByte(sal_Int8 & rOut)1117 void SAL_CALL OComponent::testinout_methodByte(sal_Int8& rOut) throw( RuntimeException )
1118 {
1119     sal_Int8 tmp = rOut;
1120     rOut = m_int8;
1121     m_int8 = tmp;
1122 }
testinout_methodFloat(float & rOut)1123 void SAL_CALL OComponent::testinout_methodFloat(float& rOut) throw( RuntimeException )
1124 {
1125     float tmp = rOut;
1126     rOut = m_float;
1127     m_float = tmp;
1128 }
1129 
testinout_methodDouble(double & rOut)1130 void SAL_CALL OComponent::testinout_methodDouble(double& rOut) throw( RuntimeException )
1131 {
1132     double tmp = rOut;
1133     rOut = m_double;
1134     m_double = tmp;
1135 }
testinout_methodBool(sal_Bool & rOut)1136 void SAL_CALL OComponent::testinout_methodBool(sal_Bool& rOut) throw( RuntimeException )
1137 {
1138     sal_Bool tmp = rOut;
1139     rOut = m_bool;
1140     m_bool = tmp;
1141 }
testinout_methodShort(sal_Int16 & rOut)1142 void SAL_CALL OComponent::testinout_methodShort(sal_Int16& rOut) throw( RuntimeException )
1143 {
1144     sal_Int16 tmp= rOut;
1145     rOut = m_int16;
1146     m_int16 = tmp;
1147 }
testinout_methodUShort(sal_uInt16 & rOut)1148 void SAL_CALL OComponent::testinout_methodUShort(sal_uInt16& rOut) throw( RuntimeException )
1149 {
1150     sal_uInt16 tmp = rOut;
1151     rOut = m_uint16;
1152     m_uint16 = tmp;
1153 }
testinout_methodLong(sal_Int32 & rOut)1154 void SAL_CALL OComponent::testinout_methodLong(sal_Int32& rOut) throw( RuntimeException )
1155 {
1156     sal_Int32 tmp = rOut;
1157     rOut = m_int32;
1158     m_int32 = tmp;
1159 }
testinout_methodULong(sal_uInt32 & rOut)1160 void SAL_CALL OComponent::testinout_methodULong(sal_uInt32& rOut) throw( RuntimeException )
1161 {
1162     sal_uInt32 tmp = rOut;
1163     rOut = m_uint32;
1164     m_uint32 = tmp;
1165 }
testinout_methodHyper(sal_Int64 & rOut)1166 void SAL_CALL OComponent::testinout_methodHyper(sal_Int64& rOut) throw( RuntimeException )
1167 {
1168     sal_Int64 tmp = rOut;
1169     rOut = m_int64;
1170     m_int64 = tmp;
1171 }
1172 
testinout_methodUHyper(sal_uInt64 & rOut)1173 void SAL_CALL OComponent::testinout_methodUHyper(sal_uInt64& rOut) throw( RuntimeException )
1174 {
1175     sal_uInt64 tmp = rOut;
1176     rOut = m_uint64;
1177     m_uint64 = tmp;
1178 }
1179 
testinout_methodString(OUString & rOut)1180 void SAL_CALL OComponent::testinout_methodString(OUString& rOut) throw( RuntimeException )
1181 {
1182     OUString tmp = rOut;
1183     rOut = m_string;
1184     m_string = tmp;
1185 }
testinout_methodChar(sal_Unicode & rOut)1186 void SAL_CALL OComponent::testinout_methodChar(sal_Unicode& rOut) throw( RuntimeException)
1187 {
1188     sal_Unicode tmp = rOut;
1189     rOut = m_char;
1190     m_char = tmp;
1191 }
testinout_methodAny(Any & rOut)1192 void SAL_CALL OComponent::testinout_methodAny(Any& rOut) throw( RuntimeException)
1193 {
1194     Any tmp = rOut;
1195     rOut = m_any;
1196     m_any = tmp;
1197 }
testinout_methodType(Type & rOut)1198 void SAL_CALL OComponent::testinout_methodType(Type& rOut) throw( RuntimeException)
1199 {
1200     Type tmp = rOut;
1201     rOut = m_type;
1202     m_type = tmp;
1203 }
1204 
1205 
testinout_methodSequence(Sequence<sal_Int32> & rOut)1206 void SAL_CALL OComponent::testinout_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException)
1207 {
1208 
1209     sal_Int32* arr= rOut.getArray();
1210     for ( sal_Int32 i=0; i < rOut.getLength(); i++)
1211     {
1212         rOut.getArray()[i] += 1;
1213     }
1214 }
testinout_methodSequence2(Sequence<Sequence<sal_Int32>> & rOut)1215 void SAL_CALL OComponent::testinout_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException )
1216 {
1217     for( sal_Int32 i=0; i < rOut.getLength(); i++)
1218     {
1219         Sequence< sal_Int32 >& seq= rOut.getArray()[i];
1220 
1221         for ( sal_Int32 j=0; j < seq.getLength(); j++)
1222         {
1223             seq.getArray()[j] += seq.getArray()[j];
1224         }
1225     }
1226 }
1227 
1228 // The parameter should implement XInvocation and a Property "value"
testinout_methodXInterface(Reference<XInvocation> & rOut)1229 void SAL_CALL OComponent::testinout_methodXInterface( Reference< XInvocation >& rOut ) throw(RuntimeException)
1230 {
1231         Any any;
1232         any= rOut->getValue( OUString( L"value"));
1233         OUString _s;
1234         any >>= _s;
1235         OUString string(L"out");
1236         any <<= string;
1237         rOut->setValue( OUString(L"value"), any);
1238 
1239         any= rOut->getValue( OUString( L"value"));
1240         any >>= _s;
1241 
1242 }
1243 
testinout_methodXInterface2(Reference<XInterface> & rOut)1244 void SAL_CALL OComponent::testinout_methodXInterface2( Reference< XInterface > & rOut) throw( RuntimeException)
1245 {
1246     Reference<XInterface> tmp = rOut;
1247     rOut = m_xinterface;
1248     m_xinterface = tmp;
1249 //  Reference<XTestSequence> xTest( rOut, UNO_QUERY);
1250 //  if( xTest.is())
1251 //  {
1252 //      Any any= xTest->getAttrAny2();
1253 //      OUString _s;
1254 //      any >>= _s;
1255 //      OUString string= _s + OUString((L" this string was written in the UNO component to the inout pararmeter"));
1256 //      any <<= string;
1257 //      xTest->setAttrAny2( any);
1258 //  }
1259 
1260 }
methodAnyTest1(const Any & rIn)1261 Any SAL_CALL OComponent::methodAnyTest1(const Any& rIn) throw( RuntimeException )
1262 {
1263     return rIn;
1264 }
getAttrAny2(void)1265 Any SAL_CALL OComponent::getAttrAny2(void)  throw( RuntimeException )
1266 {
1267     return m_any;
1268 }
setAttrAny2(const Any & AttrAny2_)1269 void SAL_CALL OComponent::setAttrAny2(const Any& AttrAny2_) throw( RuntimeException )
1270 {
1271     m_any= AttrAny2_;
1272 }
1273 
1274 
1275 
1276 // XTestStruct =======================================================================================
1277 
methodStruct(const Property & aProp)1278 void SAL_CALL OComponent::methodStruct(const Property& aProp) throw( RuntimeException )
1279 {
1280     char buff[1024];
1281     buff[0]= 0;
1282     sprintf( buff,"Property::Attribute : %d \n Property::Handle : %d \n Property::Name : %S",
1283         aProp.Attributes, aProp.Handle, (const sal_Unicode*)aProp.Name);
1284     MessageBox( NULL, A2T(buff), _T("OleTest: methodStruct"), MB_OK);
1285 }
1286 
retMethodStruct(void)1287 Property SAL_CALL OComponent::retMethodStruct(void) throw( RuntimeException )
1288 {
1289     Property a(L"OleTest_Property", 255, getCppuType( (Reference<XInterface>*)0), PropertyAttribute::MAYBEVOID |
1290         PropertyAttribute::BOUND | PropertyAttribute::CONSTRAINED |
1291         PropertyAttribute::TRANSIENT | PropertyAttribute::READONLY |
1292         PropertyAttribute::MAYBEAMBIGUOUS | PropertyAttribute::MAYBEDEFAULT );
1293     return a;
1294 }
1295 
getAttrStruct(void)1296 Property SAL_CALL OComponent::getAttrStruct(void) throw( RuntimeException)
1297 {
1298     Property a(L"OleTest_Property", 255, getCppuType( (Reference<XInterface>*)0), PropertyAttribute::MAYBEVOID |
1299         PropertyAttribute::BOUND | PropertyAttribute::CONSTRAINED |
1300         PropertyAttribute::TRANSIENT | PropertyAttribute::READONLY |
1301         PropertyAttribute::MAYBEAMBIGUOUS | PropertyAttribute::MAYBEDEFAULT );
1302     return a;
1303 
1304 }
1305 
setAttrStruct(const Property & AttrStruct_)1306 void SAL_CALL OComponent::setAttrStruct(const Property& AttrStruct_) throw( RuntimeException )
1307 {
1308     char buff[1024];
1309     buff[0]= 0;
1310     sprintf( buff,"Property::Attribute : %d \n Property::Handle : %d \n Property::Name : %S",
1311         AttrStruct_.Attributes, AttrStruct_.Handle, (const sal_Unicode*)AttrStruct_.Name);
1312 //  MessageBox( NULL, A2T(buff), _T("OleTest: setAttrStruct"), MB_OK);
1313 }
1314 
methodStruct2(const Property & aProp)1315 Property SAL_CALL OComponent::methodStruct2( const Property& aProp ) throw (RuntimeException)
1316 {
1317     return aProp;
1318 }
1319 
1320 // XTestOther ==================================================================================
other_methodAnyIn(const Any &)1321 void SAL_CALL OComponent::other_methodAnyIn(const Any& ) throw( RuntimeException )
1322 {
1323 }
other_methodAnyOut(Any & rAny)1324 void SAL_CALL OComponent::other_methodAnyOut(Any& rAny) throw( RuntimeException )
1325 {
1326     rAny <<= OUString(L"Ein Any");
1327 }
1328 
other_methodAnyRet(void)1329 Any SAL_CALL OComponent::other_methodAnyRet(void) throw(RuntimeException )
1330 {
1331     Any a;
1332     a <<= OUString(L"Ein Any");
1333     return a;
1334 }
in_float(float val)1335 void SAL_CALL OComponent::in_float( float val) throw ( RuntimeException)
1336 {
1337     USES_CONVERSION;
1338     char buff[256];
1339     sprintf( buff, "parameter : %f", val);
1340     MessageBox( NULL, A2T(buff), _T("OleTest"), MB_OK);
1341 }
other_methodAny(const Any & rAny,const OUString & typeInAny)1342 Any SAL_CALL OComponent::other_methodAny( const Any& rAny, const OUString& typeInAny )
1343         throw (RuntimeException)
1344 {
1345     Type expectedType;
1346     typelib_TypeDescription * pDesc= NULL;
1347     typelib_typedescription_getByName( &pDesc, typeInAny.pData );
1348     if( pDesc)
1349     {
1350         expectedType = Type( pDesc->pWeakRef );
1351         typelib_typedescription_release( pDesc);
1352     }
1353     if (rAny.getValueType() != expectedType)
1354         throw RuntimeException();
1355 
1356     return rAny;
1357 }
1358 
1359 // XTestOutParameters ============================================================================
1360 // void SAL_CALL OComponent::out_test(sal_Int8 rIn) throw( RuntimeException )
1361 // {
1362 // }
1363 
1364 // void SAL_CALL OComponent::out_methodByte(sal_Int8& rOut) throw( RuntimeException )
1365 // {
1366 //  rOut= 100;
1367 // }
1368 
1369 // void SAL_CALL OComponent::out_methodDouble(double& rOut) throw( RuntimeException )
1370 // {
1371 //  rOut= 3.14;
1372 // }
1373 // void SAL_CALL OComponent::out_methodFloat(float& rOut) throw( RuntimeException )
1374 // {
1375 //  rOut= 3.14;
1376 // }
1377 // void SAL_CALL OComponent::out_methodBool(sal_Bool& rOut) throw( RuntimeException )
1378 // {
1379 //  rOut= sal_True;
1380 // }
1381 // void SAL_CALL OComponent::out_methodShort(sal_Int16& rOut) throw( RuntimeException )
1382 // {
1383 //  rOut= -100;
1384 // }
1385 // void SAL_CALL OComponent::out_methodUShort(sal_uInt16& rOut) throw( RuntimeException )
1386 // {
1387 //  rOut= 100;
1388 // }
1389 // void SAL_CALL OComponent::out_methodLong(sal_Int32& rOut) throw( RuntimeException )
1390 // {
1391 //  rOut= -100;
1392 // }
1393 
1394 // void SAL_CALL OComponent::out_methodULong(sal_uInt32& rOut) throw( RuntimeException )
1395 // {
1396 //  rOut= 100;
1397 // }
1398 // void SAL_CALL OComponent::out_methodHyper(sal_Int64& rOut) throw( RuntimeException )
1399 // {
1400 
1401 // }
1402 
1403 // void SAL_CALL OComponent::out_methodUHyper(sal_uInt64& rOut) throw( RuntimeException )
1404 // {
1405 // }
1406 
1407 // void SAL_CALL OComponent::out_methodString(OUString& rOut) throw( RuntimeException )
1408 // {
1409 //  rOut= L"I'm a string";
1410 // }
1411 // void SAL_CALL OComponent::out_methodChar(sal_Unicode& rOut) throw( RuntimeException )
1412 // {
1413 //  rOut= 'A';
1414 // }
1415 // void SAL_CALL OComponent::out_methodAny(Any& rOut) throw( RuntimeException)
1416 // {
1417 //  Any a;
1418 //     a <<= OUString( L"Hi");
1419 //  rOut= a;
1420 // }
1421 // void SAL_CALL OComponent::out_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException )
1422 // {
1423 //  Sequence< sal_Int32 > aseq(10);
1424 //  for( sal_Int16 i= 0; i < aseq.getLength(); i++) aseq.getArray()[i]= i;
1425 //  rOut= aseq;
1426 // }
1427 // void SAL_CALL OComponent::out_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException )
1428 // {
1429 //  rOut= Sequence< Sequence< sal_Int32 > >();
1430 // }
1431 // void SAL_CALL OComponent::out_methodMulParams1(sal_Int32& rout1, sal_Int32& rout2) throw( RuntimeException )
1432 // {
1433 //  rout1= 111;
1434 //  rout2= 222;
1435 // }
1436 // void SAL_CALL OComponent::out_methodMulParams2(sal_Int32& rout1, sal_Int32& rout2, OUString& rout3) throw( RuntimeException )
1437 // {
1438 //  rout1= 111;
1439 //  rout2= 222;
1440 //  rout3= L"this is a neet little string";
1441 // }
1442 // void SAL_CALL OComponent::out_methodMulParams3(const OUString& sin, OUString& sout) throw( RuntimeException )
1443 // {
1444 //  sout= L"this is a neet little string";
1445 // }
1446 
1447 // XTestInterfaces -------------------------------------------------------------------------------------
testInterface(const Reference<XCallback> & xCallback,sal_Int32 mode)1448 void SAL_CALL OComponent::testInterface(  const Reference< XCallback >& xCallback, sal_Int32 mode ) throw(RuntimeException)
1449 {
1450     USES_CONVERSION;
1451     sal_Int32 i=0;
1452     OUString aString;
1453     char buff[1024];
1454 
1455     Reference<XSimple> xSimple;
1456     SimpleStruct aSimpleStruct;
1457     SimpleEnum aSimpleEnum;
1458     Sequence<Any> seqAny;
1459     Sequence< sal_Int8 > seqByte;
1460     Any outAny;
1461     sal_Bool aBool;
1462     sal_Unicode aChar;
1463     float aFloat;
1464     double aDouble;
1465     sal_Int8 aByte;
1466     sal_Int16 aShort;
1467     sal_Int32 aLong;
1468 //  sal_uInt16 aUShort;
1469 //  sal_uInt32 aULong;
1470 
1471     switch( mode)
1472     {
1473     case 1:
1474          xCallback->func1(); break;
1475     case 2:
1476         xSimple=    xCallback->returnInterface();
1477         xSimple->func(L"XCallback::returnInterface");
1478         break;
1479 
1480 
1481     case 3:
1482         xCallback->outInterface( xSimple);
1483         sprintf( buff, "XCallback::outInterface, value: %x", xSimple.get());
1484         MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1485         xSimple->func(L"XCallback::outInterface works");
1486         break;
1487     case 4:
1488          xCallback->outStruct( aSimpleStruct);
1489          sprintf( buff,"XCallback::outStruct, SimpleStruct::message: %s", OLE2A( aSimpleStruct.message));
1490          MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1491          break;
1492     case 5:
1493         xCallback->outEnum( aSimpleEnum);
1494         sprintf( buff,"XCallback::outEnum, SimpleEnum: %d", aSimpleEnum);
1495         MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1496         break;
1497     case 6:
1498         xCallback->outSeqAny( seqAny);
1499         sprintf( buff,"XCallback::outSeqAny, length: %d )", seqAny.getLength());
1500         MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1501         for( i=0; i < seqAny.getLength(); i++)
1502         {
1503             Any any= seqAny[i];
1504             if( any.getValueTypeClass() == TypeClass_STRING)
1505             {
1506                 any >>= aString;
1507                 OutputDebugStringW( aString);
1508             }
1509 
1510         }
1511         break;
1512     case 7:
1513         xCallback->outAny( outAny);
1514         if( outAny.getValueTypeClass() == TypeClass_STRING)
1515             outAny >>= aString;
1516         sprintf( buff,"XCallback::outAny, Any : %s", W2A( aString));
1517         MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1518         break;
1519     case 8:
1520         xCallback->outBool( aBool);
1521         sprintf( buff,"XCallback::outBool, value: %d", aBool);
1522         MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1523         break;
1524     case 9:
1525         xCallback->outChar( aChar);
1526         sprintf( buff,"XCallback::outChar, value: %C", aChar);
1527         MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1528         break;
1529     case 10:
1530         xCallback->outString( aString);
1531         sprintf( buff,"XCallback::outString, value: %s", W2A( aString));
1532         MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1533         break;
1534     case 11:
1535         xCallback->outFloat( aFloat);
1536         sprintf( buff,"XCallback::outFloat, value: %f", aFloat);
1537         MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1538         break;
1539     case 12:
1540         xCallback->outDouble( aDouble);
1541         sprintf( buff,"XCallback::outDouble, value: %f", aDouble);
1542         MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1543         break;
1544     case 13:
1545         xCallback->outByte( aByte);
1546         sprintf( buff,"XCallback::outByte, value: %d", aByte);
1547         MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1548         break;
1549     case 14:
1550         xCallback->outShort( aShort);
1551         sprintf( buff,"XCallback::outShort, value: %d", aShort);
1552         MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1553         break;
1554     case 15:
1555         xCallback->outLong( aLong);
1556         sprintf( buff,"XCallback::outLong, value: %d", aLong);
1557         MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1558         break;
1559     case 18:
1560     case 19:
1561     case 30:
1562         {
1563 
1564             long outLong= 0;
1565             xCallback->outValuesMixed( 1111, outLong, OUString( L"in string") );
1566 
1567             sprintf( buff, "oletest.testInterface: outValue: %d", outLong);
1568             MessageBox( NULL, A2T(buff), _T("OleTest"), MB_OK);
1569             break;
1570         }
1571 
1572     case 31:
1573         {
1574             Reference< XSimple > xSimple;
1575             SimpleStruct aSimpleStruct;
1576             SimpleEnum aSimpleEnum;
1577             Sequence<Any> seqAny;
1578             Any         aAny;
1579             sal_Bool    aBool;
1580             sal_Unicode aChar;
1581             OUString    aString;
1582             float       aFloat;
1583             double      aDouble;
1584             sal_Int8    aByte;
1585             sal_Int16   aShort;
1586             sal_Int32   aLong;
1587 //          sal_uInt16  aUShort;
1588 //          sal_uInt32  aULong;
1589             xCallback->outValuesAll( xSimple, aSimpleStruct, aSimpleEnum, seqAny, aAny, aBool,
1590                 aChar, aString,
1591             aFloat, aDouble,
1592             aByte,
1593             aShort, aLong);
1594 
1595             MessageBox( NULL, _T("XCallback::outValuesAll returned"), _T("OleTest::testInterface"), MB_OK);
1596             break;
1597         }
1598     case 32:
1599         {
1600 
1601             xCallback->outSeqByte( seqByte);
1602             sprintf( buff,"XCallback::outSeqAny, length: %d )", seqAny.getLength());
1603             MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1604             for( i=0; i < seqAny.getLength(); i++)
1605             {
1606                 Any any= seqAny[i];
1607                 if( any.getValueTypeClass() == TypeClass_STRING)
1608                 {
1609                     any >>= aString;
1610                     OutputDebugStringW( aString);
1611                 }
1612             }
1613             break;
1614         }
1615         // ############################################################################
1616         // IN OUT parameter
1617         // ############################################################################
1618     case 100:
1619         {
1620             Reference<XSimple> xSimple= static_cast<XSimple*>(this);
1621             xCallback->inoutInterface( xSimple);
1622             xSimple->func(L"XSimple called from OleTest");
1623             break;
1624         }
1625     case 101:
1626         {
1627         Reference<XIdlReflection> xRefl( m_rFactory->createInstance(L"com.sun.star.reflection.CoreReflection"), UNO_QUERY);
1628         if( xRefl.is())
1629         {
1630             Reference<XIdlClass> xClass= xRefl->forName(L"oletest.SimpleStruct");
1631             Any any;
1632             if( xClass.is())
1633                 xClass->createObject( any);
1634 
1635             if( any.getValueTypeClass() == TypeClass_STRUCT)
1636             {
1637                 SimpleStruct* pStruct= ( SimpleStruct*) any.getValue();
1638                 pStruct->message= OUString::createFromAscii("This struct was created in OleTest");
1639 
1640                 SimpleStruct aStruct;
1641                 any >>= aStruct;
1642                 xCallback->inoutStruct( aStruct);
1643                 // a Struct should now contain a different message
1644                 MessageBox( NULL, W2T(aStruct.message), _T("OleTest in out parameter"), MB_OK);
1645             }
1646 
1647         }
1648         break;
1649         }
1650     case 102:
1651         {
1652         SimpleEnum aEnum= SimpleEnum_B;
1653         xCallback->inoutEnum( aEnum);
1654         char buff[1024];
1655         sprintf( buff, "Enum: %d", aEnum);
1656         MessageBox( NULL, A2T(buff), _T("OleTest in out parameter"), MB_OK);
1657         break;
1658         }
1659     case 103:
1660         {
1661             Any arAny[3];
1662             arAny[0] <<= OUString( L"string 0");
1663             arAny[1] <<= OUString( L"string 1");
1664             arAny[2] <<= OUString( L"string 2");
1665 
1666             Sequence< Any >seqAny( arAny, 3);
1667             xCallback->inoutSeqAny( seqAny);
1668             char buff[1023];
1669             sprintf( buff, "Sequence length: %d", seqAny.getLength());
1670             MessageBox( NULL,A2T(buff) , _T("OleTest in out parameter"), MB_OK);
1671 
1672             for( int i=0; i < seqAny.getLength(); i++)
1673             {
1674                 Any any;
1675                 any <<= seqAny[i];
1676                 if(any.getValueTypeClass() == TypeClass_STRING)
1677                 {
1678                     OUString str;
1679                     any >>= str;
1680 
1681                 }
1682             }
1683 
1684         break;
1685         }
1686     case 104:
1687         {
1688             Any any;
1689             OUString s(L" OleTest");
1690             any <<= s;
1691             xCallback->inoutAny(any);
1692             if( any.getValueTypeClass() == TypeClass_STRING)
1693             {
1694                 OUString s= *( rtl_uString**) any.getValue();
1695                 MessageBox( NULL, W2T( s), _T("OleTest: inout value any"), MB_OK);
1696             }
1697         break;
1698         }
1699     case 105:
1700         {
1701         sal_Bool b= sal_True;
1702         xCallback->inoutBool( b);
1703         char buff[1024];
1704         sprintf( buff, "out value bool: %d", b);
1705         MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK);
1706             break;
1707         }
1708     case 106:
1709         {
1710             sal_Unicode uc= L'A';
1711             xCallback->inoutChar( uc);
1712             char buff[1024];
1713             sprintf( buff, "out value sal_Unicode: %C", uc);
1714             MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK);
1715             break;
1716         }
1717     case 107:
1718         {
1719             OUString s(L"OleTest");
1720             xCallback->inoutString( s);
1721             char buff[1024];
1722             sprintf( buff, "out value string: %S", s.getStr());
1723             MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK);
1724             break;
1725         }
1726     case 108:
1727         {
1728             float f= 3.14f;
1729             xCallback->inoutFloat(f);
1730             char buff[1024];
1731             sprintf( buff, "out value float: %f", f);
1732             MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK);
1733             break;
1734         }
1735     case 109:
1736         {
1737             double f= 3.145;
1738             xCallback->inoutDouble( f);
1739             char buff[1024];
1740             sprintf( buff, "out value double: %g", f);
1741             MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK);
1742             break;
1743         }
1744     case 110:
1745         {
1746             sal_Int8 aByte= 0xf;
1747             xCallback->inoutByte( aByte);
1748             char buff[1024];
1749             sprintf( buff, "out value sal_Int8: %d", aByte);
1750             MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK);
1751             break;
1752         }
1753     case 111:
1754         {
1755             sal_Int16 aShort= 0xff;
1756             xCallback->inoutShort( aShort);
1757             char buff[1024];
1758             sprintf( buff, "out value sal_Int16: %d", aShort);
1759             MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK);
1760             break;
1761         }
1762     case 112:
1763         {
1764             sal_Int32 aLong= 0xfffe;
1765             xCallback->inoutLong( aLong);
1766             char buff[1024];
1767             sprintf( buff, "out value sal_Int32: %d", aLong);
1768             MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK);
1769             break;
1770         }
1771     case 120:
1772         {
1773         Reference<XSimple> aXSimple= static_cast<XSimple*>(this);
1774 
1775         SimpleStruct aStruct;
1776         Reference<XIdlReflection> xRefl( m_rFactory->createInstance(L"com.sun.star.reflection.CoreReflection"), UNO_QUERY);
1777         if( xRefl.is())
1778         {
1779             Reference<XIdlClass> xClass= xRefl->forName(L"oletest.SimpleStruct");
1780             Any any;
1781             if( xClass.is())
1782                 xClass->createObject( any);
1783 
1784             if( any.getValueTypeClass() == TypeClass_STRUCT)
1785             {
1786                 SimpleStruct* pStruct= ( SimpleStruct*) any.getValue();
1787                 pStruct->message= OUString::createFromAscii("This struct was created in OleTest");
1788                 any >>= aStruct;
1789             }
1790         }
1791 
1792         SimpleEnum aEnum= SimpleEnum_B;
1793 
1794         Sequence< Any > aSeq;
1795         Any arAny[3];
1796         arAny[0] <<= OUString( L"string 0");
1797         arAny[1] <<= OUString( L"string 1");
1798         arAny[2] <<= OUString( L"string 2");
1799         aSeq = Sequence< Any >( arAny, 3);
1800 
1801         Any aAny;
1802         OUString s(L" OleTest");
1803         aAny <<= s;
1804 
1805         sal_Bool aBool= sal_True;
1806         sal_Unicode aChar= L'A';
1807         OUString aString( L"OleTest");
1808         float aFloat=3.14f;
1809         double aDouble= 3.145;
1810         sal_Int8 aByte= 0xf;
1811         sal_Int16 aShort= 0xff;
1812         sal_Int32 aLong= 0xffe;
1813 
1814         xCallback->inoutValuesAll( aXSimple, aStruct, aEnum, aSeq,
1815             aAny, aBool, aChar, aString,  aFloat, aDouble,
1816             aByte, aShort,  aLong );
1817 
1818         aXSimple->func(L"XSimple called from OleTest");
1819         MessageBox( NULL, W2T(aStruct.message), _T("OleTest"), MB_OK);
1820 
1821         for( int i=0; i < aSeq.getLength(); i++)
1822         {
1823             Any any;
1824             any <<= aSeq[i];
1825             if(any.getValueTypeClass() == TypeClass_STRING)
1826             {
1827                 OUString str;
1828                 any >>= str;
1829 
1830             }
1831         }
1832         break;
1833         }
1834 
1835     // ############################################################################
1836     // IN parameter
1837     // ############################################################################
1838 
1839     case 200:
1840 
1841         xCallback->inValues( L'a', 0xffffL, OUString(L" a string from OleTest"));
1842         break;
1843     case 201:
1844     {
1845         sal_Int8 arbyte[3]= { 1,2,3};
1846         Sequence< sal_Int8 > seq( arbyte, 3);
1847         xCallback->inSeqByte( seq);
1848         break;
1849     }
1850     case 202:
1851     {
1852         const int LISTENERS= 3;
1853         Reference<XEventListener> arListeners[LISTENERS];
1854         EventObject arEvents[LISTENERS];
1855 
1856         for( int i= 0; i < LISTENERS; i++)
1857         {
1858             Reference<XInterface> aList= static_cast<XWeak*>( new EventListener());
1859             arListeners[i]= Reference<XEventListener>( aList, UNO_QUERY);
1860         }
1861 
1862         xCallback->inSeqXEventListener(Sequence<Reference<XEventListener> > (arListeners, LISTENERS),
1863                                        Sequence<EventObject>(arEvents, LISTENERS));
1864         break;
1865     }
1866 
1867     // ############################################################################
1868     // Call a COM object that has not been passed as parameter to a UNO component and
1869     // hence no type information are available in the COM wrapper
1870     // ############################################################################
1871     case 300:
1872         {
1873             Reference<XInterface> xIntFact = m_rFactory->createInstance(L"com.sun.star.bridge.oleautomation.Factory");
1874 
1875             Reference<XMultiServiceFactory> oleFact(xIntFact, UNO_QUERY);
1876 
1877             Reference<XInterface> xIntCallback= oleFact->createInstance(L"XCallback_Impl.Callback");
1878             Reference<XInvocation> xInv( xIntCallback, UNO_QUERY);
1879 //Any SAL_CALL invoke( const OUString& aFunctionName, const Sequence<Any >& aParams,Sequence< sal_Int16 >& aOutParamIndex,
1880 //          Sequence<Any >& aOutParam );
1881             Sequence<sal_Int16> seqIndizes;
1882             Sequence<Any> seqOutParams;
1883             xInv->invoke( OUString( L"outValuesAll"), Sequence<Any>(), seqIndizes, seqOutParams);
1884 
1885 //          void outValuesAll( [out] oletest::XSimple outInterface,
1886 //                     [out] SimpleStruct outStruct ,
1887 //                     [out] SimpleEnum outEnum,
1888 //                     [out] sequence<any> outSeqAny,
1889 //                     [out] any outAny,
1890 //                     [out] boolean outBool,
1891 //                     [out] char outChar,
1892 //                     [out] string outString,
1893 //                     [out] float outFloat,
1894 //                     [out] double outDouble,
1895 //                     [out] byte   outByte,
1896 //                     [out] short outShort,
1897 //                     [out] long outLong);
1898             if( seqOutParams.getLength() == 12)
1899             {
1900                 Reference<XSimple> xSimple= *(XSimple**)seqOutParams[0].getValue();
1901                 xSimple->func( L"Call from OleTest on XSimple");
1902                 SimpleStruct aStruct;
1903                 seqOutParams[1] >>= aStruct;
1904                 SimpleEnum aEnum= *(SimpleEnum*)seqOutParams[2].getValue();
1905 
1906                 Sequence<Any> seqAny;
1907                 seqOutParams[3] >>= seqAny;
1908                 for( int i=0; i<seqAny.getLength(); i++)
1909                 {
1910                     OUString _s;
1911                     seqAny[i] >>= _s;
1912                 }
1913 
1914                 Any _any= *(Any*)seqOutParams[4].getValue();
1915                 sal_Bool _bool= *(sal_Bool*)seqOutParams[5].getValue();
1916                 sal_Unicode _char= *( sal_Unicode*) seqOutParams[6].getValue();
1917                 OUString _str= *( rtl_uString**)seqOutParams[7].getValue();
1918 
1919                 float _f= *( float*)seqOutParams[8].getValue();
1920                 double _d= *( double*) seqOutParams[9].getValue();
1921                 sal_Int8 _byte= *( sal_Int8*) seqOutParams[10].getValue();
1922                 sal_Int16 _short= *( sal_Int16*) seqOutParams[11].getValue();
1923 
1924                 sal_Int32 _long= *( sal_Int32*) seqOutParams[12].getValue();
1925 
1926             }
1927             break;
1928         }
1929     case 301:
1930         // in / out parameter
1931         {
1932             Reference<XInterface> xIntFact = m_rFactory->createInstance(L"com.sun.star.bridge.oleautomation.Factory");
1933 
1934             Reference<XMultiServiceFactory> oleFact(xIntFact, UNO_QUERY);
1935 
1936             Reference<XInterface> xIntCallback= oleFact->createInstance(L"XCallback_Impl.Callback");
1937             Reference<XInvocation> xInv( xIntCallback, UNO_QUERY);
1938             Sequence<sal_Int16> seqIndizes;
1939             Sequence<Any> seqOutParams;
1940 
1941 
1942             Any arAny[13];
1943             Reference<XSimple> xSimple= static_cast<XSimple*>( this);
1944 
1945             arAny[0] <<=  xSimple;
1946             SimpleStruct aStruct;
1947             Reference<XIdlReflection> xRefl( m_rFactory->createInstance(L"com.sun.star.reflection.CoreReflection"), UNO_QUERY);
1948             if( xRefl.is())
1949             {
1950                 Reference<XIdlClass> xClass= xRefl->forName(L"oletest.SimpleStruct");
1951                 Any any;
1952                 if( xClass.is())
1953                     xClass->createObject( any);
1954 
1955                 if( any.getValueTypeClass() == TypeClass_STRUCT)
1956                 {
1957                     SimpleStruct* pStruct= ( SimpleStruct*) any.getValue();
1958                     pStruct->message= OUString::createFromAscii("This struct was created in OleTest");
1959                     any >>= aStruct;
1960                 }
1961             }
1962             arAny[1] <<= aStruct;
1963             arAny[2] <<= SimpleEnum_C;
1964 
1965             Any arSeqAny[3];
1966             arSeqAny[0] <<= OUString( L"string 0");
1967             arSeqAny[1] <<= OUString( L"string 1");
1968             arSeqAny[2] <<= OUString( L"string 2");
1969 
1970             arAny[3] <<=  Sequence< Any >( arAny, 3);
1971 
1972             OUString str(L" Ein Any param");
1973             arAny[4] <<= str;
1974             arAny[5] <<= sal_False;
1975             arAny[6] <<= L'B';
1976             OUString stringParam(L" a string parameter");
1977             arAny[7] <<= stringParam;
1978             float _float= 3.14f;
1979             arAny[8] <<= _float;
1980             double _double= 3.145;
1981             arAny[9] <<= _double;
1982             sal_Int8 _byte= -1;
1983             arAny[10] <<= _byte;
1984             sal_Int16 _short= -1;
1985             arAny[11] <<= _short;
1986             sal_Int32 _long= -1;
1987             arAny[12] <<= _long;
1988 //
1989             Sequence<Any> params( arAny, 13);
1990 
1991             xInv->invoke( OUString( L"inoutValuesAll"), params, seqIndizes, seqOutParams);
1992 
1993             if( seqOutParams.getLength() == 12)
1994             {
1995                 Reference<XSimple> xSimple= *(XSimple**)seqOutParams[0].getValue();
1996                 xSimple->func( L"Call from OleTest on XSimple");
1997                 SimpleStruct aStruct;
1998                 seqOutParams[1] >>= aStruct;
1999                 SimpleEnum aEnum= *(SimpleEnum*)seqOutParams[2].getValue();
2000 
2001                 Sequence<Any> seqAny;
2002                 seqOutParams[3] >>= seqAny;
2003                 for( int i=0; i<seqAny.getLength(); i++)
2004                 {
2005                     OUString _s;
2006                     seqAny[i] >>= _s;
2007                 }
2008 
2009                 Any _any= *(Any*)seqOutParams[4].getValue();
2010                 sal_Bool _bool= *(sal_Bool*)seqOutParams[5].getValue();
2011                 sal_Unicode _char= *( sal_Unicode*) seqOutParams[6].getValue();
2012                 OUString _str= *( rtl_uString**)seqOutParams[7].getValue();
2013 
2014                 float _f= *( float*)seqOutParams[8].getValue();
2015                 double _d= *( double*) seqOutParams[9].getValue();
2016                 sal_Int8 _byte= *( sal_Int8*) seqOutParams[10].getValue();
2017                 sal_Int16 _short= *( sal_Int16*) seqOutParams[11].getValue();
2018 
2019                 sal_Int32 _long= *( sal_Int32*) seqOutParams[12].getValue();
2020 
2021             }
2022             break;
2023         }
2024     case 303:
2025         // in parameter
2026 //  void inValues( [in] char aChar, [in] long aLong, [in] string aString);
2027         {
2028             Reference<XInterface> xIntFact = m_rFactory->createInstance(
2029                 L"com.sun.star.bridge.oleautomation.Factory");
2030 
2031             Reference<XMultiServiceFactory> oleFact(xIntFact, UNO_QUERY);
2032 
2033             Reference<XInterface> xIntCallback= oleFact->createInstance(L"XCallback_Impl.Callback");
2034             Reference<XInvocation> xInv( xIntCallback, UNO_QUERY);
2035             Sequence<sal_Int16> seqIndizes;
2036             Sequence<Any> seqOutParams;
2037 
2038             Any arAny[3];
2039             sal_Unicode aChar=L'a';
2040             arAny[0] <<= aChar;
2041             sal_Int32 aLong= 0xffffffff;
2042             arAny[1] <<= aLong;
2043             OUString aString(L" a string parameter");
2044             arAny[2] <<= aString;
2045 
2046             xInv->invoke( OUString( L"inValues"), Sequence<Any>(arAny,3), seqIndizes, seqOutParams);
2047 
2048             break;
2049         }
2050     // ############################################################################
2051     // Attributes
2052     // ############################################################################
2053 
2054     case 400:
2055         Reference<XSimple> simple=  xCallback->getsimple();
2056         simple->func(L"OleTest calls on XSimple");
2057         break;
2058 
2059 
2060 
2061 
2062     }
2063 
2064 }
2065 
setObject(const Reference<XInterface> & val)2066 void SAL_CALL OComponent::setObject( const Reference< XInterface >& val ) throw (RuntimeException)
2067 {
2068     m_xIntIdentity= val;
2069 }
2070 
isSame(const Reference<XInterface> & val)2071 sal_Bool SAL_CALL OComponent::isSame( const Reference< XInterface >& val ) throw (RuntimeException)
2072 {
2073     if( m_xIntIdentity == val)
2074         return sal_True;
2075     else
2076         return sal_False;
2077 }
2078 
getThis()2079 Reference< XInterface > SAL_CALL OComponent::getThis(  ) throw (RuntimeException)
2080 {
2081 //    return Reference<XInterface>(static_cast<XIdentity*>(this), UNO_QUERY);
2082     Reference<XInterface> ret(static_cast<XIdentity*>(this), UNO_QUERY);
2083     return ret;
2084 }
2085 
disposing(const::com::sun::star::lang::EventObject &)2086 void SAL_CALL EventListener::disposing( const ::com::sun::star::lang::EventObject& ) throw (RuntimeException)
2087 {
2088     bCalled= sal_True;
2089 }
2090 
2091 // XSimple --------------------------------------------------------------------------
func(const OUString & message)2092 void SAL_CALL OComponent::func( const OUString &message)throw(::com::sun::star::uno::RuntimeException)
2093 {
2094     USES_CONVERSION;
2095 
2096     MessageBox( NULL, W2T( message.getStr()), _T("OleTest: XSimple::func"), MB_OK);
2097 }
2098 // XSimple --------------------------------------------------------------------------
getName()2099 OUString SAL_CALL OComponent::getName()throw(::com::sun::star::uno::RuntimeException)
2100 {
2101     return L"XSimple";
2102 }
testInterface2(const Reference<XSimple> & xSimple,sal_Int32 mode)2103 void SAL_CALL OComponent::testInterface2(  const Reference< XSimple >& xSimple, sal_Int32 mode ) throw(RuntimeException)
2104 {
2105     switch( mode)
2106     {
2107     case 0:
2108         {
2109         xSimple->func( L"OleTest is calling XSimple");
2110         Reference<XSimple2> xSimple2( xSimple, UNO_QUERY);
2111         if( xSimple2.is())
2112             xSimple2->func2( L"OleTest is calling XSimple2");
2113         Reference<XSimple3> xSimple3( xSimple, UNO_QUERY);
2114         if( xSimple3.is())
2115             xSimple3->func3( L"OleTest is calling XSimple3");
2116 
2117         break;
2118         }
2119     }
2120 }
2121