1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
26 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
27 #include <com/sun/star/registry/XRegistryKey.hpp>
28 #include <osl/diagnose.h>
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>
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
;
95 Sequence
<Reference
< XInterface
> > m_seqxInterface
;
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
;
121 double m_attr_double
;
122 OUString m_attr_string
;
123 sal_Unicode m_attr_char
;
124 sal_Bool m_attr_bool
;
127 Reference
<XInterface
> m_attr_xinterface
;
128 Reference
<XInvocation
> m_attr_xinvocation
;
131 OComponent( const Reference
<XMultiServiceFactory
> & rFactory
) :
132 m_rFactory( rFactory
), m_arrayConstructor(0) {}
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
) ;
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
);
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
);
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
);
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
>
311 EventListener(): bCalled( sal_False
)
313 virtual void SAL_CALL
disposing( const css::lang::EventObject
& Source
) throw (RuntimeException
);
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
);
334 Sequence
<OUString
> OComponent_getSupportedServiceNames()
336 Sequence
<OUString
> aRet
{ SERVICE_NAME
;//ODataInputStream_getImplementationName() };
342 extern "C" sal_Bool SAL_CALL
component_writeInfo( void * /*pServiceManager*/, void * pRegistryKey
)
348 Reference
<XRegistryKey
> xNewKey
=
349 reinterpret_cast<XRegistryKey
*>( pRegistryKey
)->createKey(KEY1
);
350 xNewKey
->createKey( KEY2
);
354 catch(InvalidRegistryException
&)
356 OSL_FAIL( "### InvalidRegistryException!");
362 extern "C" SAL_DLLPUBLIC_EXPORT
void * SAL_CALL
component_getFactory(
363 const sal_Char
* pImplName
, void * pServiceManager
, void * /*pRegistryKey*/ )
365 static void * pRet
= NULL
;
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
);
381 pRet
= xFactory
.get();
389 // XTestSequence ============================================================================
390 Sequence
<sal_Int8
> SAL_CALL
OComponent::methodByte(const Sequence
< sal_Int8
>& aSeq
) throw( RuntimeException
)
393 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
394 _x
= aSeq
.getConstArray()[i
];
398 Sequence
<float> SAL_CALL
OComponent::methodFloat(const Sequence
< float>& aSeq
) throw( RuntimeException
)
401 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
402 _x
= aSeq
.getConstArray()[i
];
406 Sequence
<double> SAL_CALL
OComponent::methodDouble(const Sequence
< double >& aSeq
) throw( RuntimeException
)
409 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
410 _x
= aSeq
.getConstArray()[i
];
414 Sequence
< sal_Bool
> SAL_CALL
OComponent::methodBool(const Sequence
< sal_Bool
>& aSeq
) throw( RuntimeException
)
417 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
418 _x
= aSeq
.getConstArray()[i
];
422 Sequence
< sal_Int16
> SAL_CALL
OComponent::methodShort(const Sequence
< sal_Int16
>& aSeq
) throw( RuntimeException
)
425 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
426 _x
= aSeq
.getConstArray()[i
];
430 Sequence
< sal_uInt16
> SAL_CALL
OComponent::methodUShort(const Sequence
< sal_uInt16
>& aSeq
) throw( RuntimeException
)
433 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
434 _x
= aSeq
.getConstArray()[i
];
438 Sequence
< sal_Int32
> SAL_CALL
OComponent::methodLong(const Sequence
< sal_Int32
>& aSeq
) throw( RuntimeException
)
441 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++) {
442 _x
= aSeq
.getConstArray()[i
];
446 Sequence
< sal_uInt32
> SAL_CALL
OComponent::methodULong(const Sequence
< sal_uInt32
>& aSeq
) throw( RuntimeException
)
449 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
450 _x
= aSeq
.getConstArray()[i
];
454 Sequence
< OUString
> SAL_CALL
OComponent::methodString(const Sequence
< OUString
>& aSeq
) throw( RuntimeException
)
457 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++) {
458 _x
= aSeq
.getConstArray()[i
];
462 Sequence
< sal_Unicode
> SAL_CALL
OComponent::methodChar(const Sequence
< sal_Unicode
>& aSeq
) throw( RuntimeException
)
465 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
466 _x
= aSeq
.getConstArray()[i
];
470 Sequence
< Any
> SAL_CALL
OComponent::methodAny(const Sequence
< Any
>& aSeq
) throw( RuntimeException
)
473 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
474 _x
= aSeq
.getConstArray()[i
];
475 TypeClass _t
= _x
.getValueTypeClass();
476 if( _t
== TypeClass_STRING
)
477 OUString
s(* (rtl_uString
**)_x
.getValue());
483 Sequence
< Type
> SAL_CALL
OComponent::methodType(const Sequence
< Type
>& aSeq
) throw( RuntimeException
)
486 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
487 _x
= aSeq
.getConstArray()[i
];
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
);
499 xList
->disposing( EventObject());
504 Sequence
< Sequence
< sal_Int32
> > SAL_CALL
OComponent::methodSequence(const Sequence
< Sequence
< sal_Int32
> >& aSeq
) throw( RuntimeException
)
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
];
515 Sequence
< Sequence
< Sequence
< sal_Int32
> > > SAL_CALL
OComponent::methodSequence2(const Sequence
< Sequence
< Sequence
< sal_Int32
> > >& aSeq
)
516 throw( RuntimeException
)
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
];
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
++)
542 listener
->disposing( EventObject() );
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() );
564 Sequence
< sal_Int8
> SAL_CALL
OComponent::getAttrByte() throw( RuntimeException
)
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
)
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
)
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
)
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
)
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
)
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
)
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
)
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
)
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
)
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
)
658 void SAL_CALL
OComponent::setAttrAny(const Sequence
< Any
>& AttrAny_
) throw( RuntimeException
)
663 Sequence
< Type
> SAL_CALL
OComponent::getAttrType() throw( RuntimeException
)
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
)
678 void SAL_CALL
OComponent::setAttrSequence(const Sequence
< Sequence
< sal_Int32
> >& AttrSequence
) throw(RuntimeException
)
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
++)
691 m_seq1
= AttrSequence
;
694 Sequence
< Sequence
< Sequence
< sal_Int32
> > > SAL_CALL
OComponent::getAttrSequence2() throw( RuntimeException
)
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
)
719 void SAL_CALL
OComponent::setAByte( ::sal_Int8 _abyte
) throw (RuntimeException
)
721 m_attr_int8
= _abyte
;
724 float SAL_CALL
OComponent::getAFloat() throw (RuntimeException
)
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
)
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
)
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
)
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
)
809 void SAL_CALL
OComponent::setAChar( ::sal_Unicode _achar
) throw (RuntimeException
)
811 m_attr_char
= _achar
;
814 Any SAL_CALL
OComponent::getAAny() throw (RuntimeException
)
819 void SAL_CALL
OComponent::setAAny( const Any
& _aany
) throw (RuntimeException
)
824 Type SAL_CALL
OComponent::getAType() throw (RuntimeException
)
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
)
858 void SAL_CALL
OComponent::testout_methodFloat(float& rOut
) throw( RuntimeException
)
862 void SAL_CALL
OComponent::testout_methodDouble(double& rOut
) throw( RuntimeException
)
867 void SAL_CALL
OComponent::testout_methodBool(sal_Bool
& rOut
) throw( RuntimeException
)
871 void SAL_CALL
OComponent::testout_methodShort(sal_Int16
& rOut
) throw( RuntimeException
)
875 void SAL_CALL
OComponent::testout_methodUShort(sal_uInt16
& rOut
) throw( RuntimeException
)
879 void SAL_CALL
OComponent::testout_methodLong(sal_Int32
& rOut
) throw( RuntimeException
)
883 void SAL_CALL
OComponent::testout_methodULong(sal_uInt32
& rOut
) throw( RuntimeException
)
887 void SAL_CALL
OComponent::testout_methodHyper(sal_Int64
& rOut
) throw( RuntimeException
)
892 void SAL_CALL
OComponent::testout_methodUHyper(sal_uInt64
& rOut
) throw( RuntimeException
)
897 void SAL_CALL
OComponent::testout_methodString(OUString
& rOut
) throw( RuntimeException
)
901 void SAL_CALL
OComponent::testout_methodChar(sal_Unicode
& rOut
) throw( RuntimeException
)
905 void SAL_CALL
OComponent::testout_methodAny(Any
& rOut
) throw( RuntimeException
)
910 void SAL_CALL
OComponent::testout_methodType(Type
& rOut
) throw( RuntimeException
)
915 void SAL_CALL
OComponent::testout_methodSequence(Sequence
< sal_Int32
>& rOut
) throw( RuntimeException
)
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
)
923 for( sal_Int16 i
= 0; i
< rOut
.getLength(); i
++){
924 Sequence
<sal_Int32
>& rseq2
= rOut
.getArray()[i
];
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
)
936 void SAL_CALL
OComponent::testout_methodMulParams2(sal_Int32
& rout1
, sal_Int32
& rout2
, OUString
& rout3
) throw( RuntimeException
)
940 rout3
= L
" another string";
942 void SAL_CALL
OComponent::testout_methodMulParams3(const OUString
&, OUString
& sout
) throw( RuntimeException
)
946 void SAL_CALL
OComponent::testout_methodMulParams4( float in1
, float& out1
, sal_Int32 in2
, sal_Int32
& out2
, sal_Int32
) throw(RuntimeException
)
952 void SAL_CALL
OComponent::testout_methodXInterface( Reference
< XInterface
>& rOut
) throw(RuntimeException
)
957 // XTestInParameters ------------------------------------------------------------
958 sal_Int8 SAL_CALL
OComponent::in_methodByte( sal_Int8 rIn
) throw (RuntimeException
)
963 float SAL_CALL
OComponent::in_methodFloat( float rIn
) throw (RuntimeException
)
968 double SAL_CALL
OComponent::in_methodDouble( double rIn
) throw (RuntimeException
)
973 sal_Bool SAL_CALL
OComponent::in_methodBool( sal_Bool rIn
) throw (RuntimeException
)
978 sal_Int16 SAL_CALL
OComponent::in_methodShort( sal_Int16 rIn
) throw (RuntimeException
)
983 sal_uInt16 SAL_CALL
OComponent::in_methodUShort( sal_uInt16 rIn
) throw (RuntimeException
)
988 sal_Int32 SAL_CALL
OComponent::in_methodLong( sal_Int32 rIn
) throw (RuntimeException
)
993 sal_uInt32 SAL_CALL
OComponent::in_methodULong( sal_uInt32 rIn
) throw (RuntimeException
)
998 sal_Int64 SAL_CALL
OComponent::in_methodHyper( sal_Int64 rIn
) throw (RuntimeException
)
1004 sal_uInt64 SAL_CALL
OComponent::in_methodUHyper( sal_uInt64 rIn
) throw (RuntimeException
)
1010 OUString SAL_CALL
OComponent::in_methodString( const OUString
& rIn
) throw (RuntimeException
)
1015 sal_Unicode SAL_CALL
OComponent::in_methodChar( sal_Unicode rIn
) throw (RuntimeException
)
1020 Any SAL_CALL
OComponent::in_methodAny( const Any
& rIn
) throw (RuntimeException
)
1026 Type SAL_CALL
OComponent::in_methodType( const Type
& rIn
) throw (RuntimeException
)
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
));
1041 Sequence
<Any
> params( &anyParam
, 1);
1042 Sequence
<sal_Int16
> outIndex
;
1043 Sequence
<Any
> outParams
;
1045 inv
->invoke( OUString("disposing"),
1046 params
, outIndex
, outParams
);
1047 }catch(IllegalArgumentException
&) {
1049 catch(CannotConvertException
&){
1051 catch(InvocationTargetException
&) {
1055 Reference
<XInterface
> SAL_CALL
OComponent::in_methodXInterface( const Reference
<XInterface
>& rIn
) throw (RuntimeException
)
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");
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 sal_Int8 tmp
= rOut
;
1083 void SAL_CALL
OComponent::testinout_methodFloat(float& rOut
) throw( RuntimeException
)
1090 void SAL_CALL
OComponent::testinout_methodDouble(double& rOut
) throw( RuntimeException
)
1096 void SAL_CALL
OComponent::testinout_methodBool(sal_Bool
& rOut
) throw( RuntimeException
)
1098 sal_Bool tmp
= rOut
;
1102 void SAL_CALL
OComponent::testinout_methodShort(sal_Int16
& rOut
) throw( RuntimeException
)
1104 sal_Int16 tmp
= rOut
;
1108 void SAL_CALL
OComponent::testinout_methodUShort(sal_uInt16
& rOut
) throw( RuntimeException
)
1110 sal_uInt16 tmp
= rOut
;
1114 void SAL_CALL
OComponent::testinout_methodLong(sal_Int32
& rOut
) throw( RuntimeException
)
1116 sal_Int32 tmp
= rOut
;
1120 void SAL_CALL
OComponent::testinout_methodULong(sal_uInt32
& rOut
) throw( RuntimeException
)
1122 sal_uInt32 tmp
= rOut
;
1126 void SAL_CALL
OComponent::testinout_methodHyper(sal_Int64
& rOut
) throw( RuntimeException
)
1128 sal_Int64 tmp
= rOut
;
1133 void SAL_CALL
OComponent::testinout_methodUHyper(sal_uInt64
& rOut
) throw( RuntimeException
)
1135 sal_uInt64 tmp
= rOut
;
1140 void SAL_CALL
OComponent::testinout_methodString(OUString
& rOut
) throw( RuntimeException
)
1142 OUString tmp
= rOut
;
1146 void SAL_CALL
OComponent::testinout_methodChar(sal_Unicode
& rOut
) throw( RuntimeException
)
1148 sal_Unicode tmp
= rOut
;
1152 void SAL_CALL
OComponent::testinout_methodAny(Any
& rOut
) throw( RuntimeException
)
1158 void SAL_CALL
OComponent::testinout_methodType(Type
& rOut
) throw( RuntimeException
)
1166 void SAL_CALL
OComponent::testinout_methodSequence(Sequence
< sal_Int32
>& rOut
) throw( RuntimeException
)
1169 sal_Int32
* arr
= rOut
.getArray();
1170 for ( sal_Int32 i
=0; i
< rOut
.getLength(); i
++)
1172 rOut
.getArray()[i
] += 1;
1175 void SAL_CALL
OComponent::testinout_methodSequence2(Sequence
< Sequence
< sal_Int32
> >& rOut
) throw( RuntimeException
)
1177 for( sal_Int32 i
=0; i
< rOut
.getLength(); i
++)
1179 Sequence
< sal_Int32
>& seq
= rOut
.getArray()[i
];
1181 for ( sal_Int32 j
=0; j
< seq
.getLength(); j
++)
1183 seq
.getArray()[j
] += seq
.getArray()[j
];
1188 // The parameter should implement XInvocation and a Property "value"
1189 void SAL_CALL
OComponent::testinout_methodXInterface( Reference
< XInvocation
>& rOut
) throw(RuntimeException
)
1192 any
= rOut
->getValue( OUString( L
"value"));
1195 OUString
string(L
"out");
1197 rOut
->setValue( OUString(L
"value"), any
);
1199 any
= rOut
->getValue( OUString( L
"value"));
1204 void SAL_CALL
OComponent::testinout_methodXInterface2( Reference
< XInterface
> & rOut
) throw( RuntimeException
)
1206 Reference
<XInterface
> tmp
= rOut
;
1207 rOut
= m_xinterface
;
1210 Any SAL_CALL
OComponent::methodAnyTest1(const Any
& rIn
) throw( RuntimeException
)
1214 Any SAL_CALL
OComponent::getAttrAny2() throw( RuntimeException
)
1218 void SAL_CALL
OComponent::setAttrAny2(const Any
& AttrAny2_
) throw( RuntimeException
)
1224 // XTestStruct =======================================================================================
1226 void SAL_CALL
OComponent::methodStruct(const Property
& aProp
) throw( RuntimeException
)
1230 sprintf( buff
,"Property::Attribute : %d \n Property::Handle : %d \n Property::Name : %S",
1231 aProp
.Attributes
, aProp
.Handle
, (const sal_Unicode
*)aProp
.Name
);
1232 MessageBox( NULL
, A2T(buff
), _T("OleTest: methodStruct"), MB_OK
);
1235 Property SAL_CALL
OComponent::retMethodStruct() throw( RuntimeException
)
1237 Property
a(L
"OleTest_Property", 255, cppu::UnoType
<XInterface
>::get(), PropertyAttribute::MAYBEVOID
|
1238 PropertyAttribute::BOUND
| PropertyAttribute::CONSTRAINED
|
1239 PropertyAttribute::TRANSIENT
| PropertyAttribute::READONLY
|
1240 PropertyAttribute::MAYBEAMBIGUOUS
| PropertyAttribute::MAYBEDEFAULT
);
1244 Property SAL_CALL
OComponent::getAttrStruct() throw( RuntimeException
)
1246 Property
a(L
"OleTest_Property", 255, cppu::UnoType
<XInterface
>::get(), PropertyAttribute::MAYBEVOID
|
1247 PropertyAttribute::BOUND
| PropertyAttribute::CONSTRAINED
|
1248 PropertyAttribute::TRANSIENT
| PropertyAttribute::READONLY
|
1249 PropertyAttribute::MAYBEAMBIGUOUS
| PropertyAttribute::MAYBEDEFAULT
);
1254 void SAL_CALL
OComponent::setAttrStruct(const Property
& AttrStruct_
) throw( RuntimeException
)
1258 sprintf( buff
,"Property::Attribute : %d \n Property::Handle : %d \n Property::Name : %S",
1259 AttrStruct_
.Attributes
, AttrStruct_
.Handle
, (const sal_Unicode
*)AttrStruct_
.Name
);
1260 // MessageBox( NULL, A2T(buff), _T("OleTest: setAttrStruct"), MB_OK);
1263 Property SAL_CALL
OComponent::methodStruct2( const Property
& aProp
) throw (RuntimeException
)
1268 // XTestOther ==================================================================================
1269 void SAL_CALL
OComponent::other_methodAnyIn(const Any
& ) throw( RuntimeException
)
1272 void SAL_CALL
OComponent::other_methodAnyOut(Any
& rAny
) throw( RuntimeException
)
1274 rAny
<<= OUString(L
"Ein Any");
1277 Any SAL_CALL
OComponent::other_methodAnyRet() throw(RuntimeException
)
1280 a
<<= OUString(L
"Ein Any");
1283 void SAL_CALL
OComponent::in_float( float val
) throw ( RuntimeException
)
1287 sprintf( buff
, "parameter : %f", val
);
1288 MessageBox( NULL
, A2T(buff
), _T("OleTest"), MB_OK
);
1290 Any SAL_CALL
OComponent::other_methodAny( const Any
& rAny
, const OUString
& typeInAny
)
1291 throw (RuntimeException
)
1294 typelib_TypeDescription
* pDesc
= NULL
;
1295 typelib_typedescription_getByName( &pDesc
, typeInAny
.pData
);
1298 expectedType
= Type( pDesc
->pWeakRef
);
1299 typelib_typedescription_release( pDesc
);
1301 if (rAny
.getValueType() != expectedType
)
1302 throw RuntimeException();
1307 // XTestInterfaces -------------------------------------------------------------------------------------
1308 void SAL_CALL
OComponent::testInterface( const Reference
< XCallback
>& xCallback
, sal_Int32 mode
) throw(RuntimeException
)
1315 Reference
<XSimple
> xSimple
;
1316 SimpleStruct aSimpleStruct
;
1317 SimpleEnum aSimpleEnum
;
1318 Sequence
<Any
> seqAny
;
1319 Sequence
< sal_Int8
> seqByte
;
1332 xCallback
->func1(); break;
1334 xSimple
= xCallback
->returnInterface();
1335 xSimple
->func(L
"XCallback::returnInterface");
1340 xCallback
->outInterface( xSimple
);
1341 sprintf( buff
, "XCallback::outInterface, value: %x", xSimple
.get());
1342 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1343 xSimple
->func(L
"XCallback::outInterface works");
1346 xCallback
->outStruct( aSimpleStruct
);
1347 sprintf( buff
,"XCallback::outStruct, SimpleStruct::message: %s", OLE2A( aSimpleStruct
.message
));
1348 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1351 xCallback
->outEnum( aSimpleEnum
);
1352 sprintf( buff
,"XCallback::outEnum, SimpleEnum: %d", aSimpleEnum
);
1353 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1356 xCallback
->outSeqAny( seqAny
);
1357 sprintf( buff
,"XCallback::outSeqAny, length: %d )", seqAny
.getLength());
1358 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1359 for( i
=0; i
< seqAny
.getLength(); i
++)
1362 if( any
.getValueTypeClass() == TypeClass_STRING
)
1365 OutputDebugStringW( aString
);
1371 xCallback
->outAny( outAny
);
1372 if( outAny
.getValueTypeClass() == TypeClass_STRING
)
1374 sprintf( buff
,"XCallback::outAny, Any : %s", W2A( aString
));
1375 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1378 xCallback
->outBool( aBool
);
1379 sprintf( buff
,"XCallback::outBool, value: %d", aBool
);
1380 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1383 xCallback
->outChar( aChar
);
1384 sprintf( buff
,"XCallback::outChar, value: %C", aChar
);
1385 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1388 xCallback
->outString( aString
);
1389 sprintf( buff
,"XCallback::outString, value: %s", W2A( aString
));
1390 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1393 xCallback
->outFloat( aFloat
);
1394 sprintf( buff
,"XCallback::outFloat, value: %f", aFloat
);
1395 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1398 xCallback
->outDouble( aDouble
);
1399 sprintf( buff
,"XCallback::outDouble, value: %f", aDouble
);
1400 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1403 xCallback
->outByte( aByte
);
1404 sprintf( buff
,"XCallback::outByte, value: %d", aByte
);
1405 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1408 xCallback
->outShort( aShort
);
1409 sprintf( buff
,"XCallback::outShort, value: %d", aShort
);
1410 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1413 xCallback
->outLong( aLong
);
1414 sprintf( buff
,"XCallback::outLong, value: %d", aLong
);
1415 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1423 xCallback
->outValuesMixed( 1111, outLong
, OUString( L
"in string") );
1425 sprintf( buff
, "oletest.testInterface: outValue: %d", outLong
);
1426 MessageBox( NULL
, A2T(buff
), _T("OleTest"), MB_OK
);
1432 Reference
< XSimple
> xSimple
;
1433 SimpleStruct aSimpleStruct
;
1434 SimpleEnum aSimpleEnum
;
1435 Sequence
<Any
> seqAny
;
1445 xCallback
->outValuesAll( xSimple
, aSimpleStruct
, aSimpleEnum
, seqAny
, aAny
, aBool
,
1451 MessageBox( NULL
, _T("XCallback::outValuesAll returned"), _T("OleTest::testInterface"), MB_OK
);
1457 xCallback
->outSeqByte( seqByte
);
1458 sprintf( buff
,"XCallback::outSeqAny, length: %d )", seqAny
.getLength());
1459 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1460 for( i
=0; i
< seqAny
.getLength(); i
++)
1463 if( any
.getValueTypeClass() == TypeClass_STRING
)
1466 OutputDebugStringW( aString
);
1471 // ############################################################################
1473 // ############################################################################
1476 Reference
<XSimple
> xSimple
= static_cast<XSimple
*>(this);
1477 xCallback
->inoutInterface( xSimple
);
1478 xSimple
->func(L
"XSimple called from OleTest");
1483 Reference
<XIdlReflection
> xRefl( theCoreReflection::get(comphelper::getComponentContext(m_rFactory
)) );
1484 Reference
<XIdlClass
> xClass
= xRefl
->forName(L
"oletest.SimpleStruct");
1487 xClass
->createObject( any
);
1489 if( any
.getValueTypeClass() == TypeClass_STRUCT
)
1491 SimpleStruct
* pStruct
= ( SimpleStruct
*) any
.getValue();
1492 pStruct
->message
= "This struct was created in OleTest";
1494 SimpleStruct aStruct
;
1496 xCallback
->inoutStruct( aStruct
);
1497 // a Struct should now contain a different message
1498 MessageBox( NULL
, W2T(aStruct
.message
), _T("OleTest in out parameter"), MB_OK
);
1505 SimpleEnum aEnum
= SimpleEnum_B
;
1506 xCallback
->inoutEnum( aEnum
);
1508 sprintf( buff
, "Enum: %d", aEnum
);
1509 MessageBox( NULL
, A2T(buff
), _T("OleTest in out parameter"), MB_OK
);
1515 arAny
[0] <<= OUString( L
"string 0");
1516 arAny
[1] <<= OUString( L
"string 1");
1517 arAny
[2] <<= OUString( L
"string 2");
1519 Sequence
< Any
>seqAny( arAny
, 3);
1520 xCallback
->inoutSeqAny( seqAny
);
1522 sprintf( buff
, "Sequence length: %d", seqAny
.getLength());
1523 MessageBox( NULL
,A2T(buff
) , _T("OleTest in out parameter"), MB_OK
);
1525 for( int i
=0; i
< seqAny
.getLength(); i
++)
1529 if(any
.getValueTypeClass() == TypeClass_STRING
)
1542 OUString
s(L
" OleTest");
1544 xCallback
->inoutAny(any
);
1545 if( any
.getValueTypeClass() == TypeClass_STRING
)
1547 OUString s
= *( rtl_uString
**) any
.getValue();
1548 MessageBox( NULL
, W2T( s
), _T("OleTest: inout value any"), MB_OK
);
1554 sal_Bool b
= sal_True
;
1555 xCallback
->inoutBool( b
);
1557 sprintf( buff
, "out value bool: %d", b
);
1558 MessageBox( NULL
, A2T( buff
), _T("OleTest in out parameter"), MB_OK
);
1563 sal_Unicode uc
= L
'A';
1564 xCallback
->inoutChar( uc
);
1566 sprintf( buff
, "out value sal_Unicode: %C", uc
);
1567 MessageBox( NULL
, A2T( buff
), _T("OleTest in out parameter"), MB_OK
);
1572 OUString
s(L
"OleTest");
1573 xCallback
->inoutString( s
);
1575 sprintf( buff
, "out value string: %S", s
.getStr());
1576 MessageBox( NULL
, A2T( buff
), _T("OleTest in out parameter"), MB_OK
);
1582 xCallback
->inoutFloat(f
);
1584 sprintf( buff
, "out value float: %f", f
);
1585 MessageBox( NULL
, A2T( buff
), _T("OleTest in out parameter"), MB_OK
);
1591 xCallback
->inoutDouble( f
);
1593 sprintf( buff
, "out value double: %g", f
);
1594 MessageBox( NULL
, A2T( buff
), _T("OleTest in out parameter"), MB_OK
);
1599 sal_Int8 aByte
= 0xf;
1600 xCallback
->inoutByte( aByte
);
1602 sprintf( buff
, "out value sal_Int8: %d", aByte
);
1603 MessageBox( NULL
, A2T( buff
), _T("OleTest in out parameter"), MB_OK
);
1608 sal_Int16 aShort
= 0xff;
1609 xCallback
->inoutShort( aShort
);
1611 sprintf( buff
, "out value sal_Int16: %d", aShort
);
1612 MessageBox( NULL
, A2T( buff
), _T("OleTest in out parameter"), MB_OK
);
1617 sal_Int32 aLong
= 0xfffe;
1618 xCallback
->inoutLong( aLong
);
1620 sprintf( buff
, "out value sal_Int32: %d", aLong
);
1621 MessageBox( NULL
, A2T( buff
), _T("OleTest in out parameter"), MB_OK
);
1626 Reference
<XSimple
> aXSimple
= static_cast<XSimple
*>(this);
1628 SimpleStruct aStruct
;
1629 Reference
<XIdlReflection
> xRefl( m_rFactory
->createInstance(L
"com.sun.star.reflection.CoreReflection"), UNO_QUERY
);
1632 Reference
<XIdlClass
> xClass
= xRefl
->forName(L
"oletest.SimpleStruct");
1635 xClass
->createObject( any
);
1637 if( any
.getValueTypeClass() == TypeClass_STRUCT
)
1639 SimpleStruct
* pStruct
= ( SimpleStruct
*) any
.getValue();
1640 pStruct
->message
= "This struct was created in OleTest";
1645 SimpleEnum aEnum
= SimpleEnum_B
;
1647 Sequence
< Any
> aSeq
;
1649 arAny
[0] <<= OUString( L
"string 0");
1650 arAny
[1] <<= OUString( L
"string 1");
1651 arAny
[2] <<= OUString( L
"string 2");
1652 aSeq
= Sequence
< Any
>( arAny
, 3);
1655 OUString
s(L
" OleTest");
1658 sal_Bool aBool
= sal_True
;
1659 sal_Unicode aChar
= L
'A';
1660 OUString
aString( L
"OleTest");
1662 double aDouble
= 3.145;
1663 sal_Int8 aByte
= 0xf;
1664 sal_Int16 aShort
= 0xff;
1665 sal_Int32 aLong
= 0xffe;
1667 xCallback
->inoutValuesAll( aXSimple
, aStruct
, aEnum
, aSeq
,
1668 aAny
, aBool
, aChar
, aString
, aFloat
, aDouble
,
1669 aByte
, aShort
, aLong
);
1671 aXSimple
->func(L
"XSimple called from OleTest");
1672 MessageBox( NULL
, W2T(aStruct
.message
), _T("OleTest"), MB_OK
);
1674 for( int i
=0; i
< aSeq
.getLength(); i
++)
1678 if(any
.getValueTypeClass() == TypeClass_STRING
)
1688 // ############################################################################
1690 // ############################################################################
1694 xCallback
->inValues( L
'a', 0xffffL
, OUString(L
" a string from OleTest"));
1698 sal_Int8 arbyte
[3]= { 1,2,3};
1699 Sequence
< sal_Int8
> seq( arbyte
, 3);
1700 xCallback
->inSeqByte( seq
);
1705 const int LISTENERS
= 3;
1706 Reference
<XEventListener
> arListeners
[LISTENERS
];
1707 EventObject arEvents
[LISTENERS
];
1709 for( int i
= 0; i
< LISTENERS
; i
++)
1711 Reference
<XInterface
> aList
= static_cast<XWeak
*>( new EventListener());
1712 arListeners
[i
].set( aList
, UNO_QUERY
);
1715 xCallback
->inSeqXEventListener(Sequence
<Reference
<XEventListener
> > (arListeners
, LISTENERS
),
1716 Sequence
<EventObject
>(arEvents
, LISTENERS
));
1720 // ############################################################################
1721 // Call a COM object that has not been passed as parameter to a UNO component and
1722 // hence no type information is available in the COM wrapper
1723 // ############################################################################
1726 Reference
<XInterface
> xIntFact
= m_rFactory
->createInstance(L
"com.sun.star.bridge.oleautomation.Factory");
1728 Reference
<XMultiServiceFactory
> oleFact(xIntFact
, UNO_QUERY
);
1730 Reference
<XInterface
> xIntCallback
= oleFact
->createInstance(L
"XCallback_Impl.Callback");
1731 Reference
<XInvocation
> xInv( xIntCallback
, UNO_QUERY
);
1732 Sequence
<sal_Int16
> seqIndices
;
1733 Sequence
<Any
> seqOutParams
;
1734 xInv
->invoke( OUString( L
"outValuesAll"), Sequence
<Any
>(), seqIndices
, seqOutParams
);
1736 if( seqOutParams
.getLength() == 12)
1738 Reference
<XSimple
> xSimple
= *(XSimple
**)seqOutParams
[0].getValue();
1739 xSimple
->func( L
"Call from OleTest on XSimple");
1740 SimpleStruct aStruct
;
1741 seqOutParams
[1] >>= aStruct
;
1742 SimpleEnum aEnum
= *(SimpleEnum
*)seqOutParams
[2].getValue();
1744 Sequence
<Any
> seqAny
;
1745 seqOutParams
[3] >>= seqAny
;
1746 for( int i
=0; i
<seqAny
.getLength(); i
++)
1752 Any _any
= *(Any
*)seqOutParams
[4].getValue();
1753 sal_Bool _bool
= *(sal_Bool
*)seqOutParams
[5].getValue();
1754 sal_Unicode _char
= *( sal_Unicode
*) seqOutParams
[6].getValue();
1755 OUString _str
= *( rtl_uString
**)seqOutParams
[7].getValue();
1757 float _f
= *( float*)seqOutParams
[8].getValue();
1758 double _d
= *( double*) seqOutParams
[9].getValue();
1759 sal_Int8 _byte
= *( sal_Int8
*) seqOutParams
[10].getValue();
1760 sal_Int16 _short
= *( sal_Int16
*) seqOutParams
[11].getValue();
1762 sal_Int32 _long
= *( sal_Int32
*) seqOutParams
[12].getValue();
1768 // in / out parameter
1770 Reference
<XInterface
> xIntFact
= m_rFactory
->createInstance(L
"com.sun.star.bridge.oleautomation.Factory");
1772 Reference
<XMultiServiceFactory
> oleFact(xIntFact
, UNO_QUERY
);
1774 Reference
<XInterface
> xIntCallback
= oleFact
->createInstance(L
"XCallback_Impl.Callback");
1775 Reference
<XInvocation
> xInv( xIntCallback
, UNO_QUERY
);
1776 Sequence
<sal_Int16
> seqIndices
;
1777 Sequence
<Any
> seqOutParams
;
1781 Reference
<XSimple
> xSimple
= static_cast<XSimple
*>( this);
1783 arAny
[0] <<= xSimple
;
1784 SimpleStruct aStruct
;
1785 Reference
<XIdlReflection
> xRefl( m_rFactory
->createInstance(L
"com.sun.star.reflection.CoreReflection"), UNO_QUERY
);
1788 Reference
<XIdlClass
> xClass
= xRefl
->forName(L
"oletest.SimpleStruct");
1791 xClass
->createObject( any
);
1793 if( any
.getValueTypeClass() == TypeClass_STRUCT
)
1795 SimpleStruct
* pStruct
= ( SimpleStruct
*) any
.getValue();
1796 pStruct
->message
= "This struct was created in OleTest";
1800 arAny
[1] <<= aStruct
;
1801 arAny
[2] <<= SimpleEnum_C
;
1804 arSeqAny
[0] <<= OUString( L
"string 0");
1805 arSeqAny
[1] <<= OUString( L
"string 1");
1806 arSeqAny
[2] <<= OUString( L
"string 2");
1808 arAny
[3] <<= Sequence
< Any
>( arAny
, 3);
1810 OUString
str(L
" Ein Any param");
1812 arAny
[5] <<= sal_False
;
1814 OUString
stringParam(L
" a string parameter");
1815 arAny
[7] <<= stringParam
;
1816 float _float
= 3.14f
;
1817 arAny
[8] <<= _float
;
1818 double _double
= 3.145;
1819 arAny
[9] <<= _double
;
1821 arAny
[10] <<= _byte
;
1822 sal_Int16 _short
= -1;
1823 arAny
[11] <<= _short
;
1824 sal_Int32 _long
= -1;
1825 arAny
[12] <<= _long
;
1827 Sequence
<Any
> params( arAny
, 13);
1829 xInv
->invoke( OUString( L
"inoutValuesAll"), params
, seqIndices
, seqOutParams
);
1831 if( seqOutParams
.getLength() == 12)
1833 Reference
<XSimple
> xSimple
= *(XSimple
**)seqOutParams
[0].getValue();
1834 xSimple
->func( L
"Call from OleTest on XSimple");
1835 SimpleStruct aStruct
;
1836 seqOutParams
[1] >>= aStruct
;
1837 SimpleEnum aEnum
= *(SimpleEnum
*)seqOutParams
[2].getValue();
1839 Sequence
<Any
> seqAny
;
1840 seqOutParams
[3] >>= seqAny
;
1841 for( int i
=0; i
<seqAny
.getLength(); i
++)
1847 Any _any
= *(Any
*)seqOutParams
[4].getValue();
1848 sal_Bool _bool
= *(sal_Bool
*)seqOutParams
[5].getValue();
1849 sal_Unicode _char
= *( sal_Unicode
*) seqOutParams
[6].getValue();
1850 OUString _str
= *( rtl_uString
**)seqOutParams
[7].getValue();
1852 float _f
= *( float*)seqOutParams
[8].getValue();
1853 double _d
= *( double*) seqOutParams
[9].getValue();
1854 sal_Int8 _byte
= *( sal_Int8
*) seqOutParams
[10].getValue();
1855 sal_Int16 _short
= *( sal_Int16
*) seqOutParams
[11].getValue();
1857 sal_Int32 _long
= *( sal_Int32
*) seqOutParams
[12].getValue();
1864 Reference
<XInterface
> xIntFact
= m_rFactory
->createInstance(
1865 L
"com.sun.star.bridge.oleautomation.Factory");
1867 Reference
<XMultiServiceFactory
> oleFact(xIntFact
, UNO_QUERY
);
1869 Reference
<XInterface
> xIntCallback
= oleFact
->createInstance(L
"XCallback_Impl.Callback");
1870 Reference
<XInvocation
> xInv( xIntCallback
, UNO_QUERY
);
1871 Sequence
<sal_Int16
> seqIndices
;
1872 Sequence
<Any
> seqOutParams
;
1875 sal_Unicode aChar
=L
'a';
1877 sal_Int32 aLong
= 0xffffffff;
1879 OUString
aString(L
" a string parameter");
1880 arAny
[2] <<= aString
;
1882 xInv
->invoke( OUString( L
"inValues"), Sequence
<Any
>(arAny
,3), seqIndices
, seqOutParams
);
1886 // ############################################################################
1888 // ############################################################################
1891 Reference
<XSimple
> simple
= xCallback
->getsimple();
1892 simple
->func(L
"OleTest calls on XSimple");
1900 void SAL_CALL
OComponent::setObject( const Reference
< XInterface
>& val
) throw (RuntimeException
)
1902 m_xIntIdentity
= val
;
1905 sal_Bool SAL_CALL
OComponent::isSame( const Reference
< XInterface
>& val
) throw (RuntimeException
)
1907 if( m_xIntIdentity
== val
)
1913 Reference
< XInterface
> SAL_CALL
OComponent::getThis( ) throw (RuntimeException
)
1915 Reference
<XInterface
> ret(static_cast<XIdentity
*>(this), UNO_QUERY
);
1919 void SAL_CALL
EventListener::disposing( const css::lang::EventObject
& ) throw (RuntimeException
)
1924 // XSimple --------------------------------------------------------------------------
1925 void SAL_CALL
OComponent::func( const OUString
&message
)throw(css::uno::RuntimeException
)
1929 MessageBox( NULL
, W2T( message
.getStr()), _T("OleTest: XSimple::func"), MB_OK
);
1931 // XSimple --------------------------------------------------------------------------
1932 OUString SAL_CALL
OComponent::getName()throw(css::uno::RuntimeException
)
1936 void SAL_CALL
OComponent::testInterface2( const Reference
< XSimple
>& xSimple
, sal_Int32 mode
) throw(RuntimeException
)
1942 xSimple
->func( L
"OleTest is calling XSimple");
1943 Reference
<XSimple2
> xSimple2( xSimple
, UNO_QUERY
);
1945 xSimple2
->func2( L
"OleTest is calling XSimple2");
1946 Reference
<XSimple3
> xSimple3( xSimple
, UNO_QUERY
);
1948 xSimple3
->func3( L
"OleTest is calling XSimple3");
1955 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */