tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / extensions / test / ole / cpnt / cpnt.cxx
blobec7bac088b599498c10c42fcb6c225ff23bc0417
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #if !defined WIN32_LEAN_AND_MEAN
21 # define WIN32_LEAN_AND_MEAN
22 #endif
23 #include <windows.h>
24 #include <atlbase.h>
25 #include <stdio.h>
26 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
27 #include <com/sun/star/registry/XRegistryKey.hpp>
28 #include <comphelper/diagnose_ex.hxx>
29 #include <uno/environment.h>
30 #include <comphelper/processfactory.hxx>
31 #include <cppuhelper/factory.hxx>
32 // OPTIONAL is a constant in com.sun.star.beans.PropertyAttributes but it must be
33 // undef'd in some header files
34 #define OPTIONAL OPTIONAL
35 #include <com/sun/star/beans/PropertyAttribute.hpp>
36 #include <com/sun/star/script/XInvocation.hpp>
37 #include <com/sun/star/reflection/theCoreReflection.hpp>
38 #include <com/sun/star/reflection/XIdlReflection.hpp>
39 #include <com/sun/star/lang/XEventListener.hpp>
41 #include <cppuhelper/implbase.hxx>
42 #include <com/sun/star/uno/Reference.h>
43 #include <rtl/ustring.h>
44 #include <com/sun/star/uno/Reference.hxx>
45 #include <oletest/XTestSequence.hpp>
46 #include <oletest/XTestStruct.hpp>
47 #include <oletest/XTestOther.hpp>
48 #include <oletest/XTestInterfaces.hpp>
49 #include <oletest/XSimple.hpp>
50 #include <oletest/XSimple2.hpp>
51 #include <oletest/XSimple3.hpp>
52 #include <oletest/XTestInParameters.hpp>
53 #include <oletest/XIdentity.hpp>
54 #include <com/sun/star/beans/Property.hpp>
55 using namespace cppu;
56 using namespace osl;
57 using namespace oletest;
58 using namespace com::sun::star::uno;
59 using namespace com::sun::star::lang;
60 using namespace com::sun::star::beans;
61 using namespace com::sun::star::registry;
62 using namespace com::sun::star::script;
63 using namespace com::sun::star::reflection;
66 #define IMPL_NAME L"oletest.OleTestImpl" // oletest.OleTestImpl in applicat.rdb
67 #define SERVICE_NAME L"oletest.OleTest"
68 #define KEY1 L"/oletest.OleTestImpl/UNO/SERVICES"
69 #define KEY2 L"oletest.OleTest"
71 class OComponent : public WeakImplHelper<
72 XTestSequence, XTestStruct, XTestOther, XTestInterfaces,
73 XSimple, XTestInParameters, XIdentity >
75 Reference<XInterface> m_xIntIdentity;
76 sal_Int32 m_arrayConstructor;
77 Reference<XMultiServiceFactory> m_rFactory;
79 Sequence<sal_Int8> m_seqByte;
80 Sequence<float> m_seqFloat;
81 Sequence<double> m_seqDouble;
82 Sequence<sal_Bool> m_seqBool;
83 Sequence<sal_Int16> m_seqShort;
84 Sequence<sal_uInt16> m_seqUShort;
85 Sequence<sal_Int32> m_seqLong;
86 Sequence<sal_uInt32> m_seqULong;
87 Sequence<sal_Unicode> m_seqChar;
88 Sequence<OUString> m_seqString;
89 Sequence<Any> m_seqAny;
90 Sequence<Type> m_seqType;
91 Sequence<Sequence< sal_Int32> > m_seq1;
92 Sequence<Sequence< Sequence< sal_Int32> > > m_seq2;
93 Any m_any;
94 Type m_type;
95 Sequence<Reference< XInterface > > m_seqxInterface;
97 sal_Int8 m_int8;
98 sal_uInt8 m_uint8;
99 sal_Int16 m_int16;
100 sal_uInt16 m_uint16;
101 sal_Int32 m_int32;
102 sal_uInt32 m_uint32;
103 sal_Int64 m_int64;
104 sal_uInt64 m_uint64;
105 float m_float;
106 double m_double;
107 OUString m_string;
108 sal_Unicode m_char;
109 sal_Bool m_bool;
110 Reference<XInterface> m_xinterface;
112 sal_Int8 m_attr_int8;
113 sal_uInt8 m_attr_uint8;
114 sal_Int16 m_attr_int16;
115 sal_uInt16 m_attr_uint16;
116 sal_Int32 m_attr_int32;
117 sal_uInt32 m_attr_uint32;
118 sal_Int64 m_attr_int64;
119 sal_uInt64 m_attr_uint64;
120 float m_attr_float;
121 double m_attr_double;
122 OUString m_attr_string;
123 sal_Unicode m_attr_char;
124 sal_Bool m_attr_bool;
125 Any m_attr_any;
126 Type m_attr_type;
127 Reference<XInterface> m_attr_xinterface;
128 Reference<XInvocation> m_attr_xinvocation;
130 public:
131 OComponent( const Reference<XMultiServiceFactory> & rFactory ) :
132 m_rFactory( rFactory ), m_arrayConstructor(0) {}
133 ~OComponent();
134 public: // XTestSequence
135 virtual Sequence<sal_Int8> SAL_CALL methodByte(const Sequence< sal_Int8 >& aSeq) throw( RuntimeException );
136 virtual Sequence<float> SAL_CALL methodFloat(const Sequence< float >& aSeq) throw( RuntimeException );
137 virtual Sequence< double > SAL_CALL methodDouble(const Sequence< double >& aSeq) throw( RuntimeException);
138 virtual Sequence< sal_Bool > SAL_CALL methodBool(const Sequence< sal_Bool >& aSeq) throw( RuntimeException );
139 virtual Sequence< sal_Int16 > SAL_CALL methodShort(const Sequence< sal_Int16 >& aSeq) throw( RuntimeException );
140 virtual Sequence< sal_uInt16 > SAL_CALL methodUShort(const Sequence< sal_uInt16 >& aSeq) throw( RuntimeException );
141 virtual Sequence< sal_Int32 > SAL_CALL methodLong(const Sequence< sal_Int32 >& aSeq) throw( RuntimeException) ;
142 virtual Sequence< sal_uInt32 > SAL_CALL methodULong(const Sequence< sal_uInt32 >& aSeq) throw( RuntimeException );
143 virtual Sequence< OUString > SAL_CALL methodString(const Sequence< OUString >& aSeq) throw( RuntimeException );
144 virtual Sequence< sal_Unicode > SAL_CALL methodChar(const Sequence< sal_Unicode >& aSeq) throw( RuntimeException );
145 virtual Sequence< Any > SAL_CALL methodAny(const Sequence< Any >& aSeq) throw( RuntimeException );
146 virtual Sequence< Type > SAL_CALL methodType(const Sequence< Type >& aSeq) throw( RuntimeException );
147 virtual Sequence< Reference< XInterface > > SAL_CALL methodXInterface( const Sequence< Reference< XInterface > >& aSeq ) throw(RuntimeException) ;
148 virtual Sequence< Sequence< sal_Int32 > > SAL_CALL methodSequence(const Sequence< Sequence< sal_Int32 > >& aSeq) throw( RuntimeException );
149 virtual Sequence< Sequence< Sequence< sal_Int32 > > > SAL_CALL methodSequence2(const Sequence< Sequence< Sequence< sal_Int32 > > >& aSeq) throw( RuntimeException );
150 virtual Sequence< Reference<XEventListener> > SAL_CALL methodXEventListeners( const Sequence<Reference<XEventListener> >& aSeq) throw( RuntimeException);
151 virtual Sequence< Sequence<Reference<XEventListener > > > SAL_CALL methodXEventListenersMul( const Sequence<Sequence<Reference<XEventListener > > >& aSeq ) throw (RuntimeException);
153 virtual Sequence< sal_Int8 > SAL_CALL getAttrByte() throw( RuntimeException );
154 virtual void SAL_CALL setAttrByte(const Sequence< sal_Int8 >& AttrByte_) throw( RuntimeException );
155 virtual Sequence< float > SAL_CALL getAttrFloat() throw( RuntimeException) ;
156 virtual void SAL_CALL setAttrFloat(const Sequence< float >& AttrFloat_) throw( RuntimeException );
157 virtual Sequence< double > SAL_CALL getAttrDouble() throw( RuntimeException) ;
158 virtual void SAL_CALL setAttrDouble(const Sequence< double >& AttrDouble_) throw( RuntimeException );
159 virtual Sequence< sal_Bool > SAL_CALL getAttrBool() throw( RuntimeException );
160 virtual void SAL_CALL setAttrBool(const Sequence< sal_Bool >& AttrBool_) throw( RuntimeException );
161 virtual Sequence< sal_Int16 > SAL_CALL getAttrShort() throw( RuntimeException );
162 virtual void SAL_CALL setAttrShort(const Sequence< sal_Int16 >& AttrShort_) throw( RuntimeException );
163 virtual Sequence< sal_uInt16 > SAL_CALL getAttrUShort() throw( RuntimeException );
164 virtual void SAL_CALL setAttrUShort(const Sequence< sal_uInt16 >& AttrUShort_) throw( RuntimeException );
165 virtual Sequence< sal_Int32 > SAL_CALL getAttrLong() throw( RuntimeException );
166 virtual void SAL_CALL setAttrLong(const Sequence< sal_Int32 >& AttrLong_) throw( RuntimeException );
167 virtual Sequence< sal_uInt32 > SAL_CALL getAttrULong() throw( RuntimeException );
168 virtual void SAL_CALL setAttrULong(const Sequence< sal_uInt32 >& AttrULong_) throw( RuntimeException );
169 virtual Sequence< OUString > SAL_CALL getAttrString() throw(RuntimeException );
170 virtual void SAL_CALL setAttrString(const Sequence< OUString >& AttrString_) throw( RuntimeException );
171 virtual Sequence< sal_Unicode > SAL_CALL getAttrChar() throw( RuntimeException );
172 virtual void SAL_CALL setAttrChar(const Sequence< sal_Unicode >& AttrChar_) throw( RuntimeException );
173 virtual Sequence< Any > SAL_CALL getAttrAny() throw( RuntimeException );
174 virtual void SAL_CALL setAttrAny(const Sequence< Any >& AttrAny_) throw( RuntimeException );
175 virtual Sequence< Type > SAL_CALL getAttrType() throw( RuntimeException );
176 virtual void SAL_CALL setAttrType( const Sequence< Type >& _attrtype ) throw (RuntimeException);
177 virtual Sequence< Sequence< sal_Int32 > > SAL_CALL getAttrSequence() throw( RuntimeException );
178 virtual void SAL_CALL setAttrSequence(const Sequence< Sequence< sal_Int32 > >& AttrSequence_) throw( RuntimeException );
179 virtual Sequence< Sequence< Sequence< sal_Int32 > > > SAL_CALL getAttrSequence2() throw( RuntimeException );
180 virtual void SAL_CALL setAttrSequence2(const Sequence< Sequence< Sequence< sal_Int32 > > >& AttrSequence2_) throw ( RuntimeException );
181 virtual Sequence< Reference< XInterface > > SAL_CALL getAttrXInterface() throw(RuntimeException);
182 virtual void SAL_CALL setAttrXInterface( const Sequence< Reference< XInterface > >& _attrxinterface ) throw(RuntimeException);
184 virtual ::sal_Int8 SAL_CALL getAByte() throw (RuntimeException);
185 virtual void SAL_CALL setAByte( ::sal_Int8 _abyte ) throw (RuntimeException);
186 virtual float SAL_CALL getAFloat() throw (RuntimeException);
187 virtual void SAL_CALL setAFloat( float _afloat ) throw (RuntimeException);
188 virtual double SAL_CALL getADouble() throw (RuntimeException);
189 virtual void SAL_CALL setADouble( double _adouble ) throw (RuntimeException);
190 virtual sal_Bool SAL_CALL getABool() throw (RuntimeException);
191 virtual void SAL_CALL setABool( sal_Bool _abool ) throw (RuntimeException);
192 virtual ::sal_Int16 SAL_CALL getAShort() throw (RuntimeException);
193 virtual void SAL_CALL setAShort( ::sal_Int16 _ashort ) throw (RuntimeException);
194 virtual ::sal_uInt16 SAL_CALL getAUShort() throw (RuntimeException);
195 virtual void SAL_CALL setAUShort( ::sal_uInt16 _aushort ) throw (RuntimeException);
196 virtual ::sal_Int32 SAL_CALL getALong() throw (RuntimeException);
197 virtual void SAL_CALL setALong( ::sal_Int32 _along ) throw (RuntimeException);
198 virtual ::sal_uInt32 SAL_CALL getAULong() throw (RuntimeException);
199 virtual void SAL_CALL setAULong( ::sal_uInt32 _aulong ) throw (RuntimeException);
200 virtual OUString SAL_CALL getAString() throw (RuntimeException);
201 virtual void SAL_CALL setAString( const OUString& _astring ) throw (RuntimeException);
202 virtual ::sal_Unicode SAL_CALL getAChar() throw (RuntimeException);
203 virtual void SAL_CALL setAChar( ::sal_Unicode _achar ) throw (RuntimeException);
204 virtual Any SAL_CALL getAAny() throw (RuntimeException);
205 virtual void SAL_CALL setAAny( const Any& _aany ) throw (RuntimeException);
206 virtual Type SAL_CALL getAType() throw (RuntimeException);
207 virtual void SAL_CALL setAType( const Type& _atype ) throw (RuntimeException);
208 virtual Reference< XInterface > SAL_CALL getAXInterface() throw (RuntimeException);
209 virtual void SAL_CALL setAXInterface( const Reference<XInterface >& _axinterface ) throw (RuntimeException);
210 virtual Reference<XInvocation > SAL_CALL getAXInvocation() throw (RuntimeException);
211 virtual void SAL_CALL setAXInvocation( const Reference< XInvocation >& _axinvocation ) throw (RuntimeException);
213 virtual void SAL_CALL testout_methodByte(sal_Int8& rOut) throw( RuntimeException );
214 virtual void SAL_CALL testout_methodFloat(float& rOut) throw( RuntimeException );
215 virtual void SAL_CALL testout_methodDouble(double& rOut) throw( RuntimeException );
216 virtual void SAL_CALL testout_methodBool(sal_Bool& rOut) throw( RuntimeException );
217 virtual void SAL_CALL testout_methodShort(sal_Int16& rOut) throw( RuntimeException );
218 virtual void SAL_CALL testout_methodUShort(sal_uInt16& rOut) throw( RuntimeException );
219 virtual void SAL_CALL testout_methodLong(sal_Int32& rOut) throw( RuntimeException );
220 virtual void SAL_CALL testout_methodULong(sal_uInt32& rOut) throw( RuntimeException );
221 virtual void SAL_CALL testout_methodHyper(sal_Int64& rOut) throw( RuntimeException );
222 virtual void SAL_CALL testout_methodUHyper(sal_uInt64& rOut) throw( RuntimeException );
223 virtual void SAL_CALL testout_methodString(OUString& rOut) throw( RuntimeException );
224 virtual void SAL_CALL testout_methodChar(sal_Unicode& rOut) throw( RuntimeException );
225 virtual void SAL_CALL testout_methodAny(Any& rOut) throw( RuntimeException );
226 virtual void SAL_CALL testout_methodType(Type& rOut) throw( RuntimeException );
227 virtual void SAL_CALL testout_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException );
228 virtual void SAL_CALL testout_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException );
229 virtual void SAL_CALL testout_methodMulParams1(sal_Int32& rout1, sal_Int32& rout2) throw( RuntimeException );
230 virtual void SAL_CALL testout_methodMulParams2(sal_Int32& rout1, sal_Int32& rout2, OUString& rout3) throw( RuntimeException );
231 virtual void SAL_CALL testout_methodMulParams3(const OUString& sin, OUString& sout) throw( RuntimeException );
232 virtual void SAL_CALL testout_methodMulParams4( float in1, float& out1, sal_Int32 in2, sal_Int32& out2, sal_Int32 in3 ) throw(RuntimeException);
233 virtual void SAL_CALL testout_methodXInterface( Reference< XInterface >& rOut ) throw(RuntimeException);
235 virtual void SAL_CALL testinout_methodByte(sal_Int8& rOut) throw( RuntimeException );
236 virtual void SAL_CALL testinout_methodFloat(float& rOut) throw( RuntimeException );
237 virtual void SAL_CALL testinout_methodDouble(double& rOut) throw( RuntimeException );
238 virtual void SAL_CALL testinout_methodBool(sal_Bool& rOut) throw( RuntimeException );
239 virtual void SAL_CALL testinout_methodShort(sal_Int16& rOut) throw( RuntimeException );
240 virtual void SAL_CALL testinout_methodUShort(sal_uInt16& rOut) throw( RuntimeException );
241 virtual void SAL_CALL testinout_methodLong(sal_Int32& rOut) throw( RuntimeException );
242 virtual void SAL_CALL testinout_methodULong(sal_uInt32& rOut) throw( RuntimeException );
243 virtual void SAL_CALL testinout_methodHyper(sal_Int64& rOut) throw( RuntimeException );
244 virtual void SAL_CALL testinout_methodUHyper(sal_uInt64& rOut) throw( RuntimeException );
245 virtual void SAL_CALL testinout_methodString(OUString& rOut) throw( RuntimeException );
246 virtual void SAL_CALL testinout_methodChar(sal_Unicode& rOut) throw( RuntimeException );
247 virtual void SAL_CALL testinout_methodAny(Any& rOut) throw( RuntimeException );
248 virtual void SAL_CALL testinout_methodType(Type& rOut) throw( RuntimeException );
249 virtual void SAL_CALL testinout_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException );
250 virtual void SAL_CALL testinout_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException );
251 virtual void SAL_CALL testinout_methodXInterface( Reference< XInvocation >& rOut ) throw(RuntimeException);
252 virtual void SAL_CALL testinout_methodXInterface2( Reference< XInterface > & rOut) throw( RuntimeException);
253 virtual Any SAL_CALL methodAnyTest1(const Any& rIn) throw( RuntimeException ) ;
254 virtual Any SAL_CALL getAttrAny2() throw( RuntimeException ) ;
255 virtual void SAL_CALL setAttrAny2(const Any& AttrAny2_) throw( RuntimeException ) ;
258 // XTestStruct
259 virtual void SAL_CALL methodStruct(const Property& aProp) throw( RuntimeException );
261 virtual Property SAL_CALL retMethodStruct() throw( RuntimeException );
263 virtual Property SAL_CALL getAttrStruct() throw( RuntimeException );
264 virtual void SAL_CALL setAttrStruct(const Property& AttrStruct_) throw( RuntimeException );
265 virtual Property SAL_CALL methodStruct2( const Property& aProp ) throw (RuntimeException);
267 // XTestOther
268 virtual void SAL_CALL other_methodAnyIn(const Any& rAny) throw( RuntimeException );
269 virtual void SAL_CALL other_methodAnyOut(Any& rAny) throw( RuntimeException );
270 virtual Any SAL_CALL other_methodAnyRet() throw( RuntimeException );
271 virtual void SAL_CALL in_float( float val) throw ( RuntimeException);
272 virtual Any SAL_CALL other_methodAny( const Any& rAny, const OUString& typeInAny )
273 throw (RuntimeException);
275 // XTestInParameters
276 virtual sal_Int8 SAL_CALL in_methodByte( sal_Int8 rIn ) throw (RuntimeException);
277 virtual float SAL_CALL in_methodFloat( float rIn ) throw (RuntimeException);
278 virtual double SAL_CALL in_methodDouble( double rIn ) throw (RuntimeException);
279 virtual sal_Bool SAL_CALL in_methodBool( sal_Bool rIn ) throw (RuntimeException);
280 virtual sal_Int16 SAL_CALL in_methodShort( sal_Int16 rIn ) throw (RuntimeException);
281 virtual sal_uInt16 SAL_CALL in_methodUShort( sal_uInt16 rIn ) throw (RuntimeException);
282 virtual sal_Int32 SAL_CALL in_methodLong( sal_Int32 rIn ) throw (RuntimeException);
283 virtual sal_uInt32 SAL_CALL in_methodULong( sal_uInt32 rIn ) throw (RuntimeException);
284 virtual sal_Int64 SAL_CALL in_methodHyper( sal_Int64 rIn ) throw (RuntimeException);
285 virtual sal_uInt64 SAL_CALL in_methodUHyper( sal_uInt64 rIn ) throw (RuntimeException);
286 virtual OUString SAL_CALL in_methodString( const OUString& rIn ) throw (RuntimeException);
287 virtual sal_Unicode SAL_CALL in_methodChar( sal_Unicode rIn ) throw (RuntimeException);
288 virtual Any SAL_CALL in_methodAny( const Any& rIn ) throw (RuntimeException);
289 virtual Type SAL_CALL in_methodType( const Type& rIn ) throw (RuntimeException);
290 virtual Reference<XInterface> SAL_CALL in_methodXInterface( const Reference< XInterface >& rIn ) throw (RuntimeException);
291 virtual Reference<XInvocation > SAL_CALL in_methodInvocation( const Reference< XInvocation >& inv ) throw (RuntimeException);
292 virtual SimpleStruct SAL_CALL in_methodStruct( const SimpleStruct& aStruct ) throw (RuntimeException);
293 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);
295 // XTestInterfaces --------------------------------------------------------------------------
296 virtual void SAL_CALL testInterface( const Reference< XCallback >& xCallback, sal_Int32 mode ) throw(RuntimeException);
297 virtual void SAL_CALL testInterface2( const Reference< XSimple >& xSimple, sal_Int32 mode ) throw(RuntimeException);
298 // XSimple --------------------------------------------------------------------------
299 void SAL_CALL func( const OUString &message) throw(css::uno::RuntimeException);
300 OUString SAL_CALL getName() throw(css::uno::RuntimeException);
302 // XIdentity
303 virtual void SAL_CALL setObject( const Reference< XInterface >& val ) throw (RuntimeException);
304 virtual sal_Bool SAL_CALL isSame( const Reference< XInterface >& val ) throw (RuntimeException);
305 virtual Reference< XInterface > SAL_CALL getThis( ) throw (RuntimeException);
308 class EventListener: public WeakImplHelper<XEventListener>
310 public:
311 EventListener(): bCalled( sal_False)
313 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) throw (RuntimeException);
315 sal_Bool bCalled;
319 OComponent::~OComponent()
324 // functions ==============================================================================
326 Reference<XInterface> SAL_CALL OComponent_CreateInstance( const Reference<XMultiServiceFactory> & rSMgr ) throw(RuntimeException)
328 // Reference<XInterface> xService(static_cast<XWeak*>(new OComponent( rSMgr )), UNO_QUERY);
329 OComponent* o= new OComponent( rSMgr );
330 Reference<XInterface> xService(static_cast<XIdentity*>(o), UNO_QUERY);
331 return xService;
334 Sequence<OUString> OComponent_getSupportedServiceNames()
336 Sequence<OUString> aRet { SERVICE_NAME;//ODataInputStream_getImplementationName() };
338 return aRet;
342 extern "C" sal_Bool SAL_CALL component_writeInfo( void * /*pServiceManager*/, void * pRegistryKey )
344 if(pRegistryKey)
348 Reference<XRegistryKey> xNewKey =
349 reinterpret_cast<XRegistryKey*>( pRegistryKey)->createKey(KEY1);
350 xNewKey->createKey( KEY2);
351 return sal_True;
354 catch(InvalidRegistryException &)
356 TOOLS_WARN_EXCEPTION("extensions.olebridge", "");
359 return sal_False;
362 extern "C" SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
363 const char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
365 static void * pRet= NULL;
366 if( ! pRet)
368 OUString aImplName( OUString::createFromAscii( pImplName ) );
369 if (pServiceManager && aImplName.equals( IMPL_NAME ))
371 Reference<XMultiServiceFactory> xMulFac(
372 reinterpret_cast< XMultiServiceFactory*>(pServiceManager));
374 Sequence<OUString> seqServiceNames;
375 Reference<XSingleServiceFactory> xFactory = createOneInstanceFactory( xMulFac, SERVICE_NAME,
376 OComponent_CreateInstance, seqServiceNames);
378 if (xFactory.is())
380 xFactory->acquire();
381 pRet = xFactory.get();
385 return pRet;
389 // XTestSequence ============================================================================
390 Sequence<sal_Int8> SAL_CALL OComponent::methodByte(const Sequence< sal_Int8 >& aSeq) throw( RuntimeException )
392 sal_Int8 _x;
393 for( const auto& i : aSeq.getConstArray() ){
394 _x= i;
396 return aSeq;
398 Sequence<float> SAL_CALL OComponent::methodFloat(const Sequence< float>& aSeq) throw( RuntimeException )
400 float _x;
401 for( const auto& i : aSeq.getConstArray() ){
402 _x= i;
404 return aSeq;
406 Sequence<double> SAL_CALL OComponent::methodDouble(const Sequence< double >& aSeq) throw( RuntimeException)
408 double _x;
409 for( const auto& i : aSeq.getConstArray() ){
410 _x= i;
412 return aSeq;
414 Sequence< sal_Bool > SAL_CALL OComponent::methodBool(const Sequence< sal_Bool >& aSeq) throw( RuntimeException)
416 sal_Bool _x;
417 for( const auto& i : aSeq.getConstArray() ){
418 _x= i;
420 return aSeq;
422 Sequence< sal_Int16 > SAL_CALL OComponent::methodShort(const Sequence< sal_Int16 >& aSeq) throw( RuntimeException )
424 sal_Int16 _x;
425 for( const auto& i : aSeq.getConstArray() ){
426 _x= i;
428 return aSeq;
430 Sequence< sal_uInt16 > SAL_CALL OComponent::methodUShort(const Sequence< sal_uInt16 >& aSeq) throw( RuntimeException )
432 sal_uInt16 _x;
433 for( const auto& i : aSeq.getConstArray() ){
434 _x= i;
436 return aSeq;
438 Sequence< sal_Int32 > SAL_CALL OComponent::methodLong(const Sequence< sal_Int32 >& aSeq) throw( RuntimeException)
440 sal_Int32 _x;
441 for( const auto& i : aSeq.getConstArray() ){
442 _x= i;
444 return aSeq;
446 Sequence< sal_uInt32 > SAL_CALL OComponent::methodULong(const Sequence< sal_uInt32 >& aSeq) throw( RuntimeException)
448 sal_uInt32 _x;
449 for( const auto& i : aSeq.getConstArray() ){
450 _x= i;
452 return aSeq;
454 Sequence< OUString > SAL_CALL OComponent::methodString(const Sequence< OUString >& aSeq) throw( RuntimeException)
456 OUString _x;
457 for( const auto& i : aSeq.getConstArray() ){
458 _x= i;
460 return aSeq;
462 Sequence< sal_Unicode > SAL_CALL OComponent::methodChar(const Sequence< sal_Unicode >& aSeq) throw( RuntimeException)
464 sal_Unicode _x;
465 for( const auto& i : aSeq.getConstArray() ){
466 _x= i;
468 return aSeq;
470 Sequence< Any > SAL_CALL OComponent::methodAny(const Sequence< Any >& aSeq) throw( RuntimeException)
472 Any _x;
473 for( const auto& i : aSeq.getConstArray() ){
474 _x= i;
475 TypeClass _t= _x.getValueTypeClass();
476 if( _t== TypeClass_STRING)
477 OUString s(* (rtl_uString**)_x.getValue());
479 return aSeq;
483 Sequence< Type > SAL_CALL OComponent::methodType(const Sequence< Type >& aSeq) throw( RuntimeException )
485 Type _x;
486 for( const auto& i : aSeq.getConstArray() ){
487 _x= i;
489 return aSeq;
492 Sequence< Reference< XInterface > > SAL_CALL OComponent::methodXInterface( const Sequence< Reference< XInterface > >& aSeq ) throw(RuntimeException)
494 for( sal_Int32 i= 0; i < aSeq.getLength(); i++)
496 Reference<XInterface> xInt= aSeq[i];
497 Reference<XEventListener> xList( xInt, UNO_QUERY);
498 if( xList.is())
499 xList->disposing( EventObject());
501 return aSeq;
504 Sequence< Sequence< sal_Int32 > > SAL_CALL OComponent::methodSequence(const Sequence< Sequence< sal_Int32 > >& aSeq) throw( RuntimeException)
506 sal_Int32 value;
507 for( sal_Int16 i= 0; i < aSeq.getLength(); i++){
508 const Sequence<sal_Int32>& rseq2= aSeq.getConstArray()[i];
509 for (sal_Int16 j= 0; j < rseq2.getLength(); j++){
510 value= rseq2.getConstArray()[j];
513 return aSeq;
515 Sequence< Sequence< Sequence< sal_Int32 > > > SAL_CALL OComponent::methodSequence2(const Sequence< Sequence< Sequence< sal_Int32 > > >& aSeq)
516 throw( RuntimeException )
518 sal_Int32 value;
519 sal_Int32 len= aSeq.getLength();
520 for( sal_Int16 i= 0; i < aSeq.getLength(); i++){
521 const Sequence< Sequence<sal_Int32> >& rseq2= aSeq.getConstArray()[i];
522 len= rseq2.getLength();
524 for (sal_Int16 j= 0; j < rseq2.getLength(); j++){
525 const Sequence<sal_Int32> & rseq3= rseq2.getConstArray()[j];
526 len= rseq3.getLength();
528 for (sal_Int16 k= 0; k < rseq3.getLength(); k++)
529 value= rseq3.getConstArray()[k];
532 return aSeq;
535 Sequence< Reference< XEventListener> > SAL_CALL OComponent::methodXEventListeners( const Sequence< Reference <XEventListener> >& aSeq) throw( RuntimeException)
537 Reference<XEventListener> listener;
538 for( int i= 0; i < aSeq.getLength(); i++)
540 listener= aSeq[i];
542 listener->disposing( EventObject() );
545 return aSeq;
548 Sequence< Sequence<Reference<XEventListener > > > SAL_CALL OComponent::methodXEventListenersMul( const Sequence<Sequence<Reference<XEventListener > > >& aSeq ) throw (RuntimeException)
550 Reference<XEventListener> listener;
551 for( int i= 0; i < aSeq.getLength(); i++)
553 Sequence<Reference<XEventListener> > seqInner= aSeq[i];
554 for( int j= 0; j < seqInner.getLength(); j++)
556 listener= seqInner[j];
557 listener->disposing( EventObject() );
560 return aSeq;
564 Sequence< sal_Int8 > SAL_CALL OComponent::getAttrByte() throw( RuntimeException)
566 return m_seqByte;
568 void SAL_CALL OComponent::setAttrByte(const Sequence< sal_Int8 >& AttrByte_) throw( RuntimeException )
570 m_seqByte= AttrByte_;
572 Sequence< float > SAL_CALL OComponent::getAttrFloat() throw( RuntimeException )
574 return m_seqFloat;
576 void SAL_CALL OComponent::setAttrFloat(const Sequence< float >& AttrFloat_) throw( RuntimeException )
578 m_seqFloat= AttrFloat_;
581 Sequence< double > SAL_CALL OComponent::getAttrDouble() throw( RuntimeException )
583 return m_seqDouble;
585 void SAL_CALL OComponent::setAttrDouble(const Sequence< double >& AttrDouble_) throw( RuntimeException )
587 m_seqDouble= AttrDouble_;
590 Sequence< sal_Bool > SAL_CALL OComponent::getAttrBool() throw( RuntimeException)
592 return m_seqBool;
595 void SAL_CALL OComponent::setAttrBool(const Sequence< sal_Bool >& AttrBool_) throw (RuntimeException )
597 m_seqBool= AttrBool_;
600 Sequence< sal_Int16 > SAL_CALL OComponent::getAttrShort() throw( RuntimeException)
602 return m_seqShort;
604 void SAL_CALL OComponent::setAttrShort(const Sequence< sal_Int16 >& AttrShort_) throw( RuntimeException )
606 m_seqShort= AttrShort_;
609 Sequence< sal_uInt16 > SAL_CALL OComponent::getAttrUShort() throw( RuntimeException )
611 return m_seqUShort;
613 void SAL_CALL OComponent::setAttrUShort(const Sequence< sal_uInt16 >& AttrUShort_) throw( RuntimeException )
615 m_seqUShort= AttrUShort_;
618 Sequence< sal_Int32 > SAL_CALL OComponent::getAttrLong() throw( RuntimeException)
620 return m_seqLong;
622 void SAL_CALL OComponent::setAttrLong(const Sequence< sal_Int32 >& AttrLong_) throw( RuntimeException )
624 m_seqLong= AttrLong_;
627 Sequence< sal_uInt32 > SAL_CALL OComponent::getAttrULong() throw( RuntimeException )
629 return m_seqULong;
631 void SAL_CALL OComponent::setAttrULong(const Sequence< sal_uInt32 >& AttrULong_) throw( RuntimeException )
633 m_seqULong= AttrULong_;
636 Sequence< OUString > SAL_CALL OComponent::getAttrString() throw( RuntimeException )
638 return m_seqString;
640 void SAL_CALL OComponent::setAttrString(const Sequence< OUString >& AttrString_) throw( RuntimeException )
642 m_seqString= AttrString_;
645 Sequence< sal_Unicode > SAL_CALL OComponent::getAttrChar() throw( RuntimeException )
647 return m_seqChar;
649 void SAL_CALL OComponent::setAttrChar(const Sequence< sal_Unicode >& AttrChar_) throw( RuntimeException)
651 m_seqChar= AttrChar_;
654 Sequence< Any > SAL_CALL OComponent::getAttrAny() throw( RuntimeException)
656 return m_seqAny;
658 void SAL_CALL OComponent::setAttrAny(const Sequence< Any >& AttrAny_) throw( RuntimeException )
660 m_seqAny= AttrAny_;
663 Sequence< Type > SAL_CALL OComponent::getAttrType() throw( RuntimeException )
665 return m_seqType;
668 void SAL_CALL OComponent::setAttrType( const Sequence< Type >& AttrType_) throw( RuntimeException )
670 m_seqType = AttrType_;
674 Sequence< Sequence< sal_Int32 > > SAL_CALL OComponent::getAttrSequence() throw( RuntimeException)
676 return m_seq1;
678 void SAL_CALL OComponent::setAttrSequence(const Sequence< Sequence< sal_Int32 > >& AttrSequence) throw(RuntimeException )
680 sal_Int32 x= 0;
681 for( sal_Int32 i=0; i < AttrSequence.getLength(); i++)
683 Sequence< sal_Int32 > seq= AttrSequence[i];
685 for ( sal_Int32 j=0; j < seq.getLength(); j++)
687 x= seq[j];
691 m_seq1= AttrSequence;
694 Sequence< Sequence< Sequence< sal_Int32 > > > SAL_CALL OComponent::getAttrSequence2() throw( RuntimeException )
696 return m_seq2;
698 void SAL_CALL OComponent::setAttrSequence2(const Sequence< Sequence< Sequence< sal_Int32 > > >& AttrSequence2_)
699 throw( RuntimeException )
701 m_seq2= AttrSequence2_;
704 Sequence< Reference< XInterface > > SAL_CALL OComponent::getAttrXInterface() throw(RuntimeException)
706 return m_seqxInterface;
708 void SAL_CALL OComponent::setAttrXInterface( const Sequence< Reference< XInterface > >& _attrxinterface ) throw(RuntimeException)
710 m_seqxInterface= _attrxinterface;
714 ::sal_Int8 SAL_CALL OComponent::getAByte() throw (RuntimeException)
716 return m_attr_int8;
719 void SAL_CALL OComponent::setAByte( ::sal_Int8 _abyte ) throw (RuntimeException)
721 m_attr_int8 = _abyte;
724 float SAL_CALL OComponent::getAFloat() throw (RuntimeException)
726 return m_attr_float;
729 void SAL_CALL OComponent::setAFloat( float _afloat ) throw (RuntimeException)
731 m_attr_float = _afloat;
734 double SAL_CALL OComponent::getADouble() throw (RuntimeException)
736 return m_attr_double;
739 void SAL_CALL OComponent::setADouble( double _adouble ) throw (RuntimeException)
741 m_attr_double = _adouble;
744 sal_Bool SAL_CALL OComponent::getABool() throw (RuntimeException)
746 return m_attr_bool;
749 void SAL_CALL OComponent::setABool( sal_Bool _abool ) throw (RuntimeException)
751 m_attr_bool = _abool;
754 ::sal_Int16 SAL_CALL OComponent::getAShort() throw (RuntimeException)
756 return m_attr_int16;
759 void SAL_CALL OComponent::setAShort( ::sal_Int16 _ashort ) throw (RuntimeException)
761 m_attr_int16 = _ashort;
764 ::sal_uInt16 SAL_CALL OComponent::getAUShort() throw (RuntimeException)
766 return m_attr_uint16;
769 void SAL_CALL OComponent::setAUShort( ::sal_uInt16 _aushort ) throw (RuntimeException)
771 m_attr_uint16 = _aushort;
774 ::sal_Int32 SAL_CALL OComponent::getALong() throw (RuntimeException)
776 return m_attr_int32;
779 void SAL_CALL OComponent::setALong( ::sal_Int32 _along ) throw (RuntimeException)
781 m_attr_int32 = _along;
784 ::sal_uInt32 SAL_CALL OComponent::getAULong() throw (RuntimeException)
786 return m_attr_uint32;
789 void SAL_CALL OComponent::setAULong( ::sal_uInt32 _aulong ) throw (RuntimeException)
791 m_attr_uint32 = _aulong;
794 OUString SAL_CALL OComponent::getAString() throw (RuntimeException)
796 return m_attr_string;
799 void SAL_CALL OComponent::setAString( const OUString& _astring ) throw (RuntimeException)
801 m_attr_string = _astring;
804 ::sal_Unicode SAL_CALL OComponent::getAChar() throw (RuntimeException)
806 return m_attr_char;
809 void SAL_CALL OComponent::setAChar( ::sal_Unicode _achar ) throw (RuntimeException)
811 m_attr_char = _achar;
814 Any SAL_CALL OComponent::getAAny() throw (RuntimeException)
816 return m_attr_any;
819 void SAL_CALL OComponent::setAAny( const Any& _aany ) throw (RuntimeException)
821 m_attr_any = _aany;
824 Type SAL_CALL OComponent::getAType() throw (RuntimeException)
826 return m_attr_type;
829 void SAL_CALL OComponent::setAType( const Type& _atype ) throw (RuntimeException)
831 m_attr_type = _atype;
834 Reference< XInterface > SAL_CALL OComponent::getAXInterface() throw (RuntimeException)
836 return m_attr_xinterface;
839 void SAL_CALL OComponent::setAXInterface( const Reference<XInterface >& _axinterface ) throw (RuntimeException)
841 m_attr_xinterface = _axinterface;
844 Reference<XInvocation > SAL_CALL OComponent::getAXInvocation() throw (RuntimeException)
846 return m_attr_xinvocation;
849 void SAL_CALL OComponent::setAXInvocation( const Reference< XInvocation >& _axinvocation ) throw (RuntimeException)
851 m_attr_xinvocation = _axinvocation;
854 void SAL_CALL OComponent::testout_methodByte(sal_Int8& rOut) throw( RuntimeException )
856 rOut= m_int8;
858 void SAL_CALL OComponent::testout_methodFloat(float& rOut) throw( RuntimeException )
860 rOut= m_float;
862 void SAL_CALL OComponent::testout_methodDouble(double& rOut) throw( RuntimeException )
864 rOut= m_double;
867 void SAL_CALL OComponent::testout_methodBool(sal_Bool& rOut) throw( RuntimeException )
869 rOut= m_bool;
871 void SAL_CALL OComponent::testout_methodShort(sal_Int16& rOut) throw( RuntimeException )
873 rOut= m_int16;
875 void SAL_CALL OComponent::testout_methodUShort(sal_uInt16& rOut) throw( RuntimeException )
877 rOut= m_uint16;
879 void SAL_CALL OComponent::testout_methodLong(sal_Int32& rOut) throw( RuntimeException )
881 rOut = m_int32;
883 void SAL_CALL OComponent::testout_methodULong(sal_uInt32& rOut) throw( RuntimeException )
885 rOut= m_uint32;
887 void SAL_CALL OComponent::testout_methodHyper(sal_Int64& rOut) throw( RuntimeException )
889 rOut = m_int64;
892 void SAL_CALL OComponent::testout_methodUHyper(sal_uInt64& rOut) throw( RuntimeException )
894 rOut = m_uint64;
897 void SAL_CALL OComponent::testout_methodString(OUString& rOut) throw( RuntimeException )
899 rOut= m_string;
901 void SAL_CALL OComponent::testout_methodChar(sal_Unicode& rOut) throw( RuntimeException )
903 rOut= m_char;
905 void SAL_CALL OComponent::testout_methodAny(Any& rOut) throw( RuntimeException)
907 rOut = m_any;
910 void SAL_CALL OComponent::testout_methodType(Type& rOut) throw( RuntimeException )
912 rOut = m_type;
915 void SAL_CALL OComponent::testout_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException)
917 rOut.realloc(10);
918 for( sal_Int16 i= 0; i < rOut.getLength(); i++) rOut.getArray()[i]= i;
920 void SAL_CALL OComponent::testout_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException )
922 rOut.realloc( 10);
923 for( sal_Int16 i= 0; i < rOut.getLength(); i++){
924 Sequence<sal_Int32>& rseq2= rOut.getArray()[i];
925 rseq2.realloc( 10);
926 for (sal_Int16 j= 0; j < rseq2.getLength(); j++){
927 rseq2.getArray()[j]= j;
931 void SAL_CALL OComponent::testout_methodMulParams1(sal_Int32& rout1, sal_Int32& rout2) throw( RuntimeException )
933 rout1= 999;
934 rout2= 1111;
936 void SAL_CALL OComponent::testout_methodMulParams2(sal_Int32& rout1, sal_Int32& rout2, OUString& rout3) throw( RuntimeException )
938 rout1= 1111;
939 rout2= 1222;
940 rout3= L" another string";
942 void SAL_CALL OComponent::testout_methodMulParams3(const OUString&, OUString& sout) throw( RuntimeException )
944 sout= L"Out Hallo!";
946 void SAL_CALL OComponent::testout_methodMulParams4( float in1, float& out1, sal_Int32 in2, sal_Int32& out2, sal_Int32 ) throw(RuntimeException)
948 out1= in1 + 1;
949 out2= in2 + 1;
952 void SAL_CALL OComponent::testout_methodXInterface( Reference< XInterface >& rOut ) throw(RuntimeException)
954 rOut = m_xinterface;
957 // XTestInParameters ------------------------------------------------------------
958 sal_Int8 SAL_CALL OComponent::in_methodByte( sal_Int8 rIn ) throw (RuntimeException)
960 m_int8 = rIn;
961 return rIn;
963 float SAL_CALL OComponent::in_methodFloat( float rIn ) throw (RuntimeException)
965 m_float = rIn;
966 return rIn;
968 double SAL_CALL OComponent::in_methodDouble( double rIn ) throw (RuntimeException)
970 m_double = rIn;
971 return rIn;
973 sal_Bool SAL_CALL OComponent::in_methodBool( sal_Bool rIn ) throw (RuntimeException)
975 m_bool = rIn;
976 return rIn;
978 sal_Int16 SAL_CALL OComponent::in_methodShort( sal_Int16 rIn ) throw (RuntimeException)
980 m_int16 = rIn;
981 return rIn;
983 sal_uInt16 SAL_CALL OComponent::in_methodUShort( sal_uInt16 rIn ) throw (RuntimeException)
985 m_uint16 = rIn;
986 return rIn;
988 sal_Int32 SAL_CALL OComponent::in_methodLong( sal_Int32 rIn ) throw (RuntimeException)
990 m_int32 = rIn;
991 return rIn;
993 sal_uInt32 SAL_CALL OComponent::in_methodULong( sal_uInt32 rIn ) throw (RuntimeException)
995 m_uint32 = rIn;
996 return rIn;
998 sal_Int64 SAL_CALL OComponent::in_methodHyper( sal_Int64 rIn ) throw (RuntimeException)
1000 m_int64 = rIn;
1001 return rIn;
1004 sal_uInt64 SAL_CALL OComponent::in_methodUHyper( sal_uInt64 rIn ) throw (RuntimeException)
1006 m_uint64 = rIn;
1007 return rIn;
1010 OUString SAL_CALL OComponent::in_methodString( const OUString& rIn ) throw (RuntimeException)
1012 m_string = rIn;
1013 return rIn;
1015 sal_Unicode SAL_CALL OComponent::in_methodChar( sal_Unicode rIn ) throw (RuntimeException)
1017 m_char = rIn;
1018 return rIn;
1020 Any SAL_CALL OComponent::in_methodAny( const Any& rIn ) throw (RuntimeException)
1022 m_any = rIn;
1023 return rIn;
1026 Type SAL_CALL OComponent::in_methodType( const Type& rIn ) throw (RuntimeException)
1028 m_type = rIn;
1029 return rIn;
1032 Reference<XInvocation > SAL_CALL OComponent::in_methodInvocation( const Reference< XInvocation >& inv )
1033 throw (RuntimeException)
1035 //We expect the invocation results from a conversion of VBasicEventListener.VBEventListener
1036 //which implements XEventListener
1037 // extensions/test/ole/EventListenerSample
1038 EventObject event( Reference<XInterface>(static_cast<XTestInParameters*>(this),UNO_QUERY));
1039 Any anyParam;
1040 anyParam <<= event;
1041 Sequence<Any> params( &anyParam, 1);
1042 Sequence<sal_Int16> outIndex;
1043 Sequence<Any> outParams;
1044 try{
1045 inv->invoke( OUString("disposing"),
1046 params, outIndex, outParams);
1047 }catch(IllegalArgumentException &) {
1049 catch(CannotConvertException &){
1051 catch(InvocationTargetException&) {
1053 return inv;
1055 Reference<XInterface> SAL_CALL OComponent::in_methodXInterface( const Reference<XInterface >& rIn ) throw (RuntimeException)
1057 m_xinterface = rIn;
1058 return rIn;
1061 SimpleStruct SAL_CALL OComponent::in_methodStruct( const SimpleStruct& aStruct )
1062 throw (RuntimeException)
1064 SimpleStruct& s= const_cast<SimpleStruct&>(aStruct);
1065 s.message= s.message + OUString(
1066 "This string was set in OleTest");
1067 return aStruct;
1069 void SAL_CALL OComponent::in_methodAll(
1070 sal_Int8, float, double, sal_Bool, sal_Int16, sal_uInt16,
1071 sal_Int32, sal_uInt32, const OUString&, sal_Unicode,
1072 const Any&, const Type&, const Reference<XInvocation>&) throw (RuntimeException)
1076 // INOUT -----------------------------------------------------------------------------------
1077 void SAL_CALL OComponent::testinout_methodByte(sal_Int8& rOut) throw( RuntimeException )
1079 std::swap( m_int8, rOut );
1081 void SAL_CALL OComponent::testinout_methodFloat(float& rOut) throw( RuntimeException )
1083 std::swap( m_float, rOut );
1085 void SAL_CALL OComponent::testinout_methodDouble(double& rOut) throw( RuntimeException )
1087 std::swap( m_double, rOut );
1089 void SAL_CALL OComponent::testinout_methodBool(sal_Bool& rOut) throw( RuntimeException )
1091 std::swap( m_bool, rOut );
1093 void SAL_CALL OComponent::testinout_methodShort(sal_Int16& rOut) throw( RuntimeException )
1095 std::swap( m_int16, rOut );
1097 void SAL_CALL OComponent::testinout_methodUShort(sal_uInt16& rOut) throw( RuntimeException )
1099 std::swap( m_uint16, rOut );
1101 void SAL_CALL OComponent::testinout_methodLong(sal_Int32& rOut) throw( RuntimeException )
1103 std::swap( m_int32, rOut );
1105 void SAL_CALL OComponent::testinout_methodULong(sal_uInt32& rOut) throw( RuntimeException )
1107 std::swap( m_uint32, rOut );
1109 void SAL_CALL OComponent::testinout_methodHyper(sal_Int64& rOut) throw( RuntimeException )
1111 std::swap( m_int64, rOut );
1113 void SAL_CALL OComponent::testinout_methodUHyper(sal_uInt64& rOut) throw( RuntimeException )
1115 std::swap( m_uint64, rOut );
1117 void SAL_CALL OComponent::testinout_methodString(OUString& rOut) throw( RuntimeException )
1119 std::swap( m_string, rOut );
1121 void SAL_CALL OComponent::testinout_methodChar(sal_Unicode& rOut) throw( RuntimeException)
1123 std::swap( m_char, rOut );
1125 void SAL_CALL OComponent::testinout_methodAny(Any& rOut) throw( RuntimeException)
1127 std::swap( m_any, rOut );
1129 void SAL_CALL OComponent::testinout_methodType(Type& rOut) throw( RuntimeException)
1131 std::swap( m_type, rOut );
1134 void SAL_CALL OComponent::testinout_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException)
1137 sal_Int32* arr= rOut.getArray();
1138 for ( sal_Int32 i=0; i < rOut.getLength(); i++)
1140 rOut.getArray()[i] += 1;
1143 void SAL_CALL OComponent::testinout_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException )
1145 for( sal_Int32 i=0; i < rOut.getLength(); i++)
1147 Sequence< sal_Int32 >& seq= rOut.getArray()[i];
1149 for ( sal_Int32 j=0; j < seq.getLength(); j++)
1151 seq.getArray()[j] += seq.getArray()[j];
1156 // The parameter should implement XInvocation and a Property "value"
1157 void SAL_CALL OComponent::testinout_methodXInterface( Reference< XInvocation >& rOut ) throw(RuntimeException)
1159 Any any;
1160 any= rOut->getValue( OUString( L"value"));
1161 OUString _s;
1162 any >>= _s;
1163 OUString string(L"out");
1164 any <<= string;
1165 rOut->setValue( OUString(L"value"), any);
1167 any= rOut->getValue( OUString( L"value"));
1168 any >>= _s;
1172 void SAL_CALL OComponent::testinout_methodXInterface2( Reference< XInterface > & rOut) throw( RuntimeException)
1174 Reference<XInterface> tmp = rOut;
1175 rOut = m_xinterface;
1176 m_xinterface = tmp;
1178 Any SAL_CALL OComponent::methodAnyTest1(const Any& rIn) throw( RuntimeException )
1180 return rIn;
1182 Any SAL_CALL OComponent::getAttrAny2() throw( RuntimeException )
1184 return m_any;
1186 void SAL_CALL OComponent::setAttrAny2(const Any& AttrAny2_) throw( RuntimeException )
1188 m_any= AttrAny2_;
1192 // XTestStruct =======================================================================================
1194 void SAL_CALL OComponent::methodStruct(const Property& aProp) throw( RuntimeException )
1196 char buff[1024];
1197 buff[0]= 0;
1198 sprintf( buff,"Property::Attribute : %d \n Property::Handle : %d \n Property::Name : %S",
1199 aProp.Attributes, aProp.Handle, (const sal_Unicode*)aProp.Name);
1200 MessageBox( NULL, A2T(buff), _T("OleTest: methodStruct"), MB_OK);
1203 Property SAL_CALL OComponent::retMethodStruct() throw( RuntimeException )
1205 Property a(L"OleTest_Property", 255, cppu::UnoType<XInterface>::get(), PropertyAttribute::MAYBEVOID |
1206 PropertyAttribute::BOUND | PropertyAttribute::CONSTRAINED |
1207 PropertyAttribute::TRANSIENT | PropertyAttribute::READONLY |
1208 PropertyAttribute::MAYBEAMBIGUOUS | PropertyAttribute::MAYBEDEFAULT );
1209 return a;
1212 Property SAL_CALL OComponent::getAttrStruct() throw( RuntimeException)
1214 Property a(L"OleTest_Property", 255, cppu::UnoType<XInterface>::get(), PropertyAttribute::MAYBEVOID |
1215 PropertyAttribute::BOUND | PropertyAttribute::CONSTRAINED |
1216 PropertyAttribute::TRANSIENT | PropertyAttribute::READONLY |
1217 PropertyAttribute::MAYBEAMBIGUOUS | PropertyAttribute::MAYBEDEFAULT );
1218 return a;
1222 void SAL_CALL OComponent::setAttrStruct(const Property& AttrStruct_) throw( RuntimeException )
1224 char buff[1024];
1225 buff[0]= 0;
1226 sprintf( buff,"Property::Attribute : %d \n Property::Handle : %d \n Property::Name : %S",
1227 AttrStruct_.Attributes, AttrStruct_.Handle, (const sal_Unicode*)AttrStruct_.Name);
1228 // MessageBox( NULL, A2T(buff), _T("OleTest: setAttrStruct"), MB_OK);
1231 Property SAL_CALL OComponent::methodStruct2( const Property& aProp ) throw (RuntimeException)
1233 return aProp;
1236 // XTestOther ==================================================================================
1237 void SAL_CALL OComponent::other_methodAnyIn(const Any& ) throw( RuntimeException )
1240 void SAL_CALL OComponent::other_methodAnyOut(Any& rAny) throw( RuntimeException )
1242 rAny <<= OUString(L"Ein Any");
1245 Any SAL_CALL OComponent::other_methodAnyRet() throw(RuntimeException )
1247 Any a;
1248 a <<= OUString(L"Ein Any");
1249 return a;
1251 void SAL_CALL OComponent::in_float( float val) throw ( RuntimeException)
1253 USES_CONVERSION;
1254 char buff[256];
1255 sprintf( buff, "parameter : %f", val);
1256 MessageBox( NULL, A2T(buff), _T("OleTest"), MB_OK);
1258 Any SAL_CALL OComponent::other_methodAny( const Any& rAny, const OUString& typeInAny )
1259 throw (RuntimeException)
1261 Type expectedType;
1262 typelib_TypeDescription * pDesc= NULL;
1263 typelib_typedescription_getByName( &pDesc, typeInAny.pData );
1264 if( pDesc)
1266 expectedType = Type( pDesc->pWeakRef );
1267 typelib_typedescription_release( pDesc);
1269 if (rAny.getValueType() != expectedType)
1270 throw RuntimeException();
1272 return rAny;
1275 // XTestInterfaces -------------------------------------------------------------------------------------
1276 void SAL_CALL OComponent::testInterface( const Reference< XCallback >& xCallback, sal_Int32 mode ) throw(RuntimeException)
1278 USES_CONVERSION;
1279 sal_Int32 i=0;
1280 OUString aString;
1281 char buff[1024];
1283 Reference<XSimple> xSimple;
1284 SimpleStruct aSimpleStruct;
1285 SimpleEnum aSimpleEnum;
1286 Sequence<Any> seqAny;
1287 Sequence< sal_Int8 > seqByte;
1288 Any outAny;
1289 sal_Bool aBool;
1290 sal_Unicode aChar;
1291 float aFloat;
1292 double aDouble;
1293 sal_Int8 aByte;
1294 sal_Int16 aShort;
1295 sal_Int32 aLong;
1297 switch( mode)
1299 case 1:
1300 xCallback->func1(); break;
1301 case 2:
1302 xSimple= xCallback->returnInterface();
1303 xSimple->func(L"XCallback::returnInterface");
1304 break;
1307 case 3:
1308 xCallback->outInterface( xSimple);
1309 sprintf( buff, "XCallback::outInterface, value: %x", xSimple.get());
1310 MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1311 xSimple->func(L"XCallback::outInterface works");
1312 break;
1313 case 4:
1314 xCallback->outStruct( aSimpleStruct);
1315 sprintf( buff,"XCallback::outStruct, SimpleStruct::message: %s", OLE2A( aSimpleStruct.message));
1316 MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1317 break;
1318 case 5:
1319 xCallback->outEnum( aSimpleEnum);
1320 sprintf( buff,"XCallback::outEnum, SimpleEnum: %d", aSimpleEnum);
1321 MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1322 break;
1323 case 6:
1324 xCallback->outSeqAny( seqAny);
1325 sprintf( buff,"XCallback::outSeqAny, length: %d )", seqAny.getLength());
1326 MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1327 for( i=0; i < seqAny.getLength(); i++)
1329 Any any= seqAny[i];
1330 if( any.getValueTypeClass() == TypeClass_STRING)
1332 any >>= aString;
1333 OutputDebugStringW( aString);
1337 break;
1338 case 7:
1339 xCallback->outAny( outAny);
1340 if( outAny.getValueTypeClass() == TypeClass_STRING)
1341 outAny >>= aString;
1342 sprintf( buff,"XCallback::outAny, Any : %s", W2A( aString));
1343 MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1344 break;
1345 case 8:
1346 xCallback->outBool( aBool);
1347 sprintf( buff,"XCallback::outBool, value: %d", aBool);
1348 MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1349 break;
1350 case 9:
1351 xCallback->outChar( aChar);
1352 sprintf( buff,"XCallback::outChar, value: %C", aChar);
1353 MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1354 break;
1355 case 10:
1356 xCallback->outString( aString);
1357 sprintf( buff,"XCallback::outString, value: %s", W2A( aString));
1358 MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1359 break;
1360 case 11:
1361 xCallback->outFloat( aFloat);
1362 sprintf( buff,"XCallback::outFloat, value: %f", aFloat);
1363 MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1364 break;
1365 case 12:
1366 xCallback->outDouble( aDouble);
1367 sprintf( buff,"XCallback::outDouble, value: %f", aDouble);
1368 MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1369 break;
1370 case 13:
1371 xCallback->outByte( aByte);
1372 sprintf( buff,"XCallback::outByte, value: %d", aByte);
1373 MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1374 break;
1375 case 14:
1376 xCallback->outShort( aShort);
1377 sprintf( buff,"XCallback::outShort, value: %d", aShort);
1378 MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1379 break;
1380 case 15:
1381 xCallback->outLong( aLong);
1382 sprintf( buff,"XCallback::outLong, value: %d", aLong);
1383 MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1384 break;
1385 case 18:
1386 case 19:
1387 case 30:
1390 long outLong= 0;
1391 xCallback->outValuesMixed( 1111, outLong, OUString( L"in string") );
1393 sprintf( buff, "oletest.testInterface: outValue: %d", outLong);
1394 MessageBox( NULL, A2T(buff), _T("OleTest"), MB_OK);
1395 break;
1398 case 31:
1400 Reference< XSimple > xSimple;
1401 SimpleStruct aSimpleStruct;
1402 SimpleEnum aSimpleEnum;
1403 Sequence<Any> seqAny;
1404 Any aAny;
1405 sal_Bool aBool;
1406 sal_Unicode aChar;
1407 OUString aString;
1408 float aFloat;
1409 double aDouble;
1410 sal_Int8 aByte;
1411 sal_Int16 aShort;
1412 sal_Int32 aLong;
1413 xCallback->outValuesAll( xSimple, aSimpleStruct, aSimpleEnum, seqAny, aAny, aBool,
1414 aChar, aString,
1415 aFloat, aDouble,
1416 aByte,
1417 aShort, aLong);
1419 MessageBox( NULL, _T("XCallback::outValuesAll returned"), _T("OleTest::testInterface"), MB_OK);
1420 break;
1422 case 32:
1425 xCallback->outSeqByte( seqByte);
1426 sprintf( buff,"XCallback::outSeqAny, length: %d )", seqAny.getLength());
1427 MessageBox( NULL, A2T(buff), _T("OleTest out parameter"), MB_OK);
1428 for( i=0; i < seqAny.getLength(); i++)
1430 Any any= seqAny[i];
1431 if( any.getValueTypeClass() == TypeClass_STRING)
1433 any >>= aString;
1434 OutputDebugStringW( aString);
1437 break;
1439 // ############################################################################
1440 // IN OUT parameter
1441 // ############################################################################
1442 case 100:
1444 Reference<XSimple> xSimple= static_cast<XSimple*>(this);
1445 xCallback->inoutInterface( xSimple);
1446 xSimple->func(L"XSimple called from OleTest");
1447 break;
1449 case 101:
1451 Reference<XIdlReflection> xRefl( theCoreReflection::get(comphelper::getComponentContext(m_rFactory)) );
1452 Reference<XIdlClass> xClass= xRefl->forName(L"oletest.SimpleStruct");
1453 Any any;
1454 if( xClass.is())
1455 xClass->createObject( any);
1457 if( any.getValueTypeClass() == TypeClass_STRUCT)
1459 SimpleStruct* pStruct= ( SimpleStruct*) any.getValue();
1460 pStruct->message= "This struct was created in OleTest";
1462 SimpleStruct aStruct;
1463 any >>= aStruct;
1464 xCallback->inoutStruct( aStruct);
1465 // a Struct should now contain a different message
1466 MessageBox( NULL, W2T(aStruct.message), _T("OleTest in out parameter"), MB_OK);
1469 break;
1471 case 102:
1473 SimpleEnum aEnum= SimpleEnum_B;
1474 xCallback->inoutEnum( aEnum);
1475 char buff[1024];
1476 sprintf( buff, "Enum: %d", aEnum);
1477 MessageBox( NULL, A2T(buff), _T("OleTest in out parameter"), MB_OK);
1478 break;
1480 case 103:
1482 Any arAny[3];
1483 arAny[0] <<= OUString( L"string 0");
1484 arAny[1] <<= OUString( L"string 1");
1485 arAny[2] <<= OUString( L"string 2");
1487 Sequence< Any >seqAny( arAny, 3);
1488 xCallback->inoutSeqAny( seqAny);
1489 char buff[1023];
1490 sprintf( buff, "Sequence length: %d", seqAny.getLength());
1491 MessageBox( NULL,A2T(buff) , _T("OleTest in out parameter"), MB_OK);
1493 for( int i=0; i < seqAny.getLength(); i++)
1495 Any any;
1496 any <<= seqAny[i];
1497 if(any.getValueTypeClass() == TypeClass_STRING)
1499 OUString str;
1500 any >>= str;
1505 break;
1507 case 104:
1509 Any any;
1510 OUString s(L" OleTest");
1511 any <<= s;
1512 xCallback->inoutAny(any);
1513 if( any.getValueTypeClass() == TypeClass_STRING)
1515 OUString s= *( rtl_uString**) any.getValue();
1516 MessageBox( NULL, W2T( s), _T("OleTest: inout value any"), MB_OK);
1518 break;
1520 case 105:
1522 sal_Bool b= sal_True;
1523 xCallback->inoutBool( b);
1524 char buff[1024];
1525 sprintf( buff, "out value bool: %d", b);
1526 MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK);
1527 break;
1529 case 106:
1531 sal_Unicode uc= L'A';
1532 xCallback->inoutChar( uc);
1533 char buff[1024];
1534 sprintf( buff, "out value sal_Unicode: %C", uc);
1535 MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK);
1536 break;
1538 case 107:
1540 OUString s(L"OleTest");
1541 xCallback->inoutString( s);
1542 char buff[1024];
1543 sprintf( buff, "out value string: %S", s.getStr());
1544 MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK);
1545 break;
1547 case 108:
1549 float f= 3.14f;
1550 xCallback->inoutFloat(f);
1551 char buff[1024];
1552 sprintf( buff, "out value float: %f", f);
1553 MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK);
1554 break;
1556 case 109:
1558 double f= 3.145;
1559 xCallback->inoutDouble( f);
1560 char buff[1024];
1561 sprintf( buff, "out value double: %g", f);
1562 MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK);
1563 break;
1565 case 110:
1567 sal_Int8 aByte= 0xf;
1568 xCallback->inoutByte( aByte);
1569 char buff[1024];
1570 sprintf( buff, "out value sal_Int8: %d", aByte);
1571 MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK);
1572 break;
1574 case 111:
1576 sal_Int16 aShort= 0xff;
1577 xCallback->inoutShort( aShort);
1578 char buff[1024];
1579 sprintf( buff, "out value sal_Int16: %d", aShort);
1580 MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK);
1581 break;
1583 case 112:
1585 sal_Int32 aLong= 0xfffe;
1586 xCallback->inoutLong( aLong);
1587 char buff[1024];
1588 sprintf( buff, "out value sal_Int32: %d", aLong);
1589 MessageBox( NULL, A2T( buff), _T("OleTest in out parameter"), MB_OK);
1590 break;
1592 case 120:
1594 Reference<XSimple> aXSimple= static_cast<XSimple*>(this);
1596 SimpleStruct aStruct;
1597 Reference<XIdlReflection> xRefl( m_rFactory->createInstance(L"com.sun.star.reflection.CoreReflection"), UNO_QUERY);
1598 if( xRefl.is())
1600 Reference<XIdlClass> xClass= xRefl->forName(L"oletest.SimpleStruct");
1601 Any any;
1602 if( xClass.is())
1603 xClass->createObject( any);
1605 if( any.getValueTypeClass() == TypeClass_STRUCT)
1607 SimpleStruct* pStruct= ( SimpleStruct*) any.getValue();
1608 pStruct->message= "This struct was created in OleTest";
1609 any >>= aStruct;
1613 SimpleEnum aEnum= SimpleEnum_B;
1615 Sequence< Any > aSeq;
1616 Any arAny[3];
1617 arAny[0] <<= OUString( L"string 0");
1618 arAny[1] <<= OUString( L"string 1");
1619 arAny[2] <<= OUString( L"string 2");
1620 aSeq = Sequence< Any >( arAny, 3);
1622 Any aAny;
1623 OUString s(L" OleTest");
1624 aAny <<= s;
1626 sal_Bool aBool= sal_True;
1627 sal_Unicode aChar= L'A';
1628 OUString aString( L"OleTest");
1629 float aFloat=3.14f;
1630 double aDouble= 3.145;
1631 sal_Int8 aByte= 0xf;
1632 sal_Int16 aShort= 0xff;
1633 sal_Int32 aLong= 0xffe;
1635 xCallback->inoutValuesAll( aXSimple, aStruct, aEnum, aSeq,
1636 aAny, aBool, aChar, aString, aFloat, aDouble,
1637 aByte, aShort, aLong );
1639 aXSimple->func(L"XSimple called from OleTest");
1640 MessageBox( NULL, W2T(aStruct.message), _T("OleTest"), MB_OK);
1642 for( int i=0; i < aSeq.getLength(); i++)
1644 Any any;
1645 any <<= aSeq[i];
1646 if(any.getValueTypeClass() == TypeClass_STRING)
1648 OUString str;
1649 any >>= str;
1653 break;
1656 // ############################################################################
1657 // IN parameter
1658 // ############################################################################
1660 case 200:
1662 xCallback->inValues( L'a', 0xffffL, OUString(L" a string from OleTest"));
1663 break;
1664 case 201:
1666 sal_Int8 arbyte[3]= { 1,2,3};
1667 Sequence< sal_Int8 > seq( arbyte, 3);
1668 xCallback->inSeqByte( seq);
1669 break;
1671 case 202:
1673 const int LISTENERS= 3;
1674 Reference<XEventListener> arListeners[LISTENERS];
1675 EventObject arEvents[LISTENERS];
1677 for( int i= 0; i < LISTENERS; i++)
1679 Reference<XInterface> aList= static_cast<XWeak*>( new EventListener());
1680 arListeners[i].set( aList, UNO_QUERY);
1683 xCallback->inSeqXEventListener(Sequence<Reference<XEventListener> > (arListeners, LISTENERS),
1684 Sequence<EventObject>(arEvents, LISTENERS));
1685 break;
1688 // ############################################################################
1689 // Call a COM object that has not been passed as parameter to a UNO component and
1690 // hence no type information is available in the COM wrapper
1691 // ############################################################################
1692 case 300:
1694 Reference<XInterface> xIntFact = m_rFactory->createInstance(L"com.sun.star.bridge.oleautomation.Factory");
1696 Reference<XMultiServiceFactory> oleFact(xIntFact, UNO_QUERY);
1698 Reference<XInterface> xIntCallback= oleFact->createInstance(L"XCallback_Impl.Callback");
1699 Reference<XInvocation> xInv( xIntCallback, UNO_QUERY);
1700 Sequence<sal_Int16> seqIndices;
1701 Sequence<Any> seqOutParams;
1702 xInv->invoke( OUString( L"outValuesAll"), Sequence<Any>(), seqIndices, seqOutParams);
1704 if( seqOutParams.getLength() == 12)
1706 Reference<XSimple> xSimple= *(XSimple**)seqOutParams[0].getValue();
1707 xSimple->func( L"Call from OleTest on XSimple");
1708 SimpleStruct aStruct;
1709 seqOutParams[1] >>= aStruct;
1710 SimpleEnum aEnum= *(SimpleEnum*)seqOutParams[2].getValue();
1712 Sequence<Any> seqAny;
1713 seqOutParams[3] >>= seqAny;
1714 for( int i=0; i<seqAny.getLength(); i++)
1716 OUString _s;
1717 seqAny[i] >>= _s;
1720 Any _any= *(Any*)seqOutParams[4].getValue();
1721 sal_Bool _bool= *(sal_Bool*)seqOutParams[5].getValue();
1722 sal_Unicode _char= *( sal_Unicode*) seqOutParams[6].getValue();
1723 OUString _str= *( rtl_uString**)seqOutParams[7].getValue();
1725 float _f= *( float*)seqOutParams[8].getValue();
1726 double _d= *( double*) seqOutParams[9].getValue();
1727 sal_Int8 _byte= *( sal_Int8*) seqOutParams[10].getValue();
1728 sal_Int16 _short= *( sal_Int16*) seqOutParams[11].getValue();
1730 sal_Int32 _long= *( sal_Int32*) seqOutParams[12].getValue();
1733 break;
1735 case 301:
1736 // in / out parameter
1738 Reference<XInterface> xIntFact = m_rFactory->createInstance(L"com.sun.star.bridge.oleautomation.Factory");
1740 Reference<XMultiServiceFactory> oleFact(xIntFact, UNO_QUERY);
1742 Reference<XInterface> xIntCallback= oleFact->createInstance(L"XCallback_Impl.Callback");
1743 Reference<XInvocation> xInv( xIntCallback, UNO_QUERY);
1744 Sequence<sal_Int16> seqIndices;
1745 Sequence<Any> seqOutParams;
1748 Any arAny[13];
1749 Reference<XSimple> xSimple= static_cast<XSimple*>( this);
1751 arAny[0] <<= xSimple;
1752 SimpleStruct aStruct;
1753 Reference<XIdlReflection> xRefl( m_rFactory->createInstance(L"com.sun.star.reflection.CoreReflection"), UNO_QUERY);
1754 if( xRefl.is())
1756 Reference<XIdlClass> xClass= xRefl->forName(L"oletest.SimpleStruct");
1757 Any any;
1758 if( xClass.is())
1759 xClass->createObject( any);
1761 if( any.getValueTypeClass() == TypeClass_STRUCT)
1763 SimpleStruct* pStruct= ( SimpleStruct*) any.getValue();
1764 pStruct->message = "This struct was created in OleTest";
1765 any >>= aStruct;
1768 arAny[1] <<= aStruct;
1769 arAny[2] <<= SimpleEnum_C;
1771 Any arSeqAny[3];
1772 arSeqAny[0] <<= OUString( L"string 0");
1773 arSeqAny[1] <<= OUString( L"string 1");
1774 arSeqAny[2] <<= OUString( L"string 2");
1776 arAny[3] <<= Sequence< Any >( arAny, 3);
1778 OUString str(L" Ein Any param");
1779 arAny[4] <<= str;
1780 arAny[5] <<= sal_False;
1781 arAny[6] <<= L'B';
1782 OUString stringParam(L" a string parameter");
1783 arAny[7] <<= stringParam;
1784 float _float= 3.14f;
1785 arAny[8] <<= _float;
1786 double _double= 3.145;
1787 arAny[9] <<= _double;
1788 sal_Int8 _byte= -1;
1789 arAny[10] <<= _byte;
1790 sal_Int16 _short= -1;
1791 arAny[11] <<= _short;
1792 sal_Int32 _long= -1;
1793 arAny[12] <<= _long;
1795 Sequence<Any> params( arAny, 13);
1797 xInv->invoke( OUString( L"inoutValuesAll"), params, seqIndices, seqOutParams);
1799 if( seqOutParams.getLength() == 12)
1801 Reference<XSimple> xSimple= *(XSimple**)seqOutParams[0].getValue();
1802 xSimple->func( L"Call from OleTest on XSimple");
1803 SimpleStruct aStruct;
1804 seqOutParams[1] >>= aStruct;
1805 SimpleEnum aEnum= *(SimpleEnum*)seqOutParams[2].getValue();
1807 Sequence<Any> seqAny;
1808 seqOutParams[3] >>= seqAny;
1809 for( int i=0; i<seqAny.getLength(); i++)
1811 OUString _s;
1812 seqAny[i] >>= _s;
1815 Any _any= *(Any*)seqOutParams[4].getValue();
1816 sal_Bool _bool= *(sal_Bool*)seqOutParams[5].getValue();
1817 sal_Unicode _char= *( sal_Unicode*) seqOutParams[6].getValue();
1818 OUString _str= *( rtl_uString**)seqOutParams[7].getValue();
1820 float _f= *( float*)seqOutParams[8].getValue();
1821 double _d= *( double*) seqOutParams[9].getValue();
1822 sal_Int8 _byte= *( sal_Int8*) seqOutParams[10].getValue();
1823 sal_Int16 _short= *( sal_Int16*) seqOutParams[11].getValue();
1825 sal_Int32 _long= *( sal_Int32*) seqOutParams[12].getValue();
1828 break;
1830 case 303:
1832 Reference<XInterface> xIntFact = m_rFactory->createInstance(
1833 L"com.sun.star.bridge.oleautomation.Factory");
1835 Reference<XMultiServiceFactory> oleFact(xIntFact, UNO_QUERY);
1837 Reference<XInterface> xIntCallback= oleFact->createInstance(L"XCallback_Impl.Callback");
1838 Reference<XInvocation> xInv( xIntCallback, UNO_QUERY);
1839 Sequence<sal_Int16> seqIndices;
1840 Sequence<Any> seqOutParams;
1842 Any arAny[3];
1843 sal_Unicode aChar=L'a';
1844 arAny[0] <<= aChar;
1845 sal_Int32 aLong= 0xffffffff;
1846 arAny[1] <<= aLong;
1847 OUString aString(L" a string parameter");
1848 arAny[2] <<= aString;
1850 xInv->invoke( OUString( L"inValues"), Sequence<Any>(arAny,3), seqIndices, seqOutParams);
1852 break;
1854 // ############################################################################
1855 // Attributes
1856 // ############################################################################
1858 case 400:
1859 Reference<XSimple> simple= xCallback->getsimple();
1860 simple->func(L"OleTest calls on XSimple");
1861 break;
1868 void SAL_CALL OComponent::setObject( const Reference< XInterface >& val ) throw (RuntimeException)
1870 m_xIntIdentity= val;
1873 sal_Bool SAL_CALL OComponent::isSame( const Reference< XInterface >& val ) throw (RuntimeException)
1875 if( m_xIntIdentity == val)
1876 return sal_True;
1877 else
1878 return sal_False;
1881 Reference< XInterface > SAL_CALL OComponent::getThis( ) throw (RuntimeException)
1883 Reference<XInterface> ret(static_cast<XIdentity*>(this), UNO_QUERY);
1884 return ret;
1887 void SAL_CALL EventListener::disposing( const css::lang::EventObject& ) throw (RuntimeException)
1889 bCalled= sal_True;
1892 // XSimple --------------------------------------------------------------------------
1893 void SAL_CALL OComponent::func( const OUString &message)throw(css::uno::RuntimeException)
1895 USES_CONVERSION;
1897 MessageBox( NULL, W2T( message.getStr()), _T("OleTest: XSimple::func"), MB_OK);
1899 // XSimple --------------------------------------------------------------------------
1900 OUString SAL_CALL OComponent::getName()throw(css::uno::RuntimeException)
1902 return L"XSimple";
1904 void SAL_CALL OComponent::testInterface2( const Reference< XSimple >& xSimple, sal_Int32 mode ) throw(RuntimeException)
1906 switch( mode)
1908 case 0:
1910 xSimple->func( L"OleTest is calling XSimple");
1911 Reference<XSimple2> xSimple2( xSimple, UNO_QUERY);
1912 if( xSimple2.is())
1913 xSimple2->func2( L"OleTest is calling XSimple2");
1914 Reference<XSimple3> xSimple3( xSimple, UNO_QUERY);
1915 if( xSimple3.is())
1916 xSimple3->func3( L"OleTest is calling XSimple3");
1918 break;
1923 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */