1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cpnt.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_extensions.hxx"
36 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
37 #include <com/sun/star/registry/XRegistryKey.hpp>
38 #include <osl/diagnose.h>
39 #include <uno/environment.h>
40 #include <cppuhelper/factory.hxx>
41 // OPTIONAL is a constant in com.sun.star.beans.PropertyAttributes but it must be
42 // undef'd in some header files
43 #define OPTIONAL OPTIONAL
44 #include <com/sun/star/beans/PropertyAttribute.hpp>
45 #include <com/sun/star/script/XInvocation.hpp>
46 #include <com/sun/star/reflection/XIdlReflection.hpp>
47 #include <com/sun/star/lang/XEventListener.hpp>
49 #include <cppuhelper/implbase7.hxx>
50 #include <cppuhelper/implbase1.hxx>
51 #include <com/sun/star/uno/Reference.h>
52 #include <rtl/ustring.h>
53 #include <com/sun/star/uno/Reference.hxx>
54 #include <oletest/XTestSequence.hpp>
55 #include <oletest/XTestStruct.hpp>
56 #include <oletest/XTestOther.hpp>
57 #include <oletest/XTestInterfaces.hpp>
58 #include <oletest/XSimple.hpp>
59 #include <oletest/XSimple2.hpp>
60 #include <oletest/XSimple3.hpp>
61 #include <oletest/XTestInParameters.hpp>
62 //#include <oletest/XTestOutParameters.hpp>
63 #include <oletest/XIdentity.hpp>
64 #include <com/sun/star/beans/Property.hpp>
67 using namespace oletest
;
69 using namespace com::sun::star::uno
;
70 using namespace com::sun::star::lang
;
71 using namespace com::sun::star::beans
;
72 using namespace com::sun::star::registry
;
73 using namespace com::sun::star::script
;
74 using namespace com::sun::star::reflection
;
77 #define IMPL_NAME L"oletest.OleTestImpl" // oletest.OleTestImpl in applicat.rdb
78 #define SERVICE_NAME L"oletest.OleTest"
79 #define KEY1 L"/oletest.OleTestImpl/UNO/SERVICES"
80 #define KEY2 L"oletest.OleTest"
82 class OComponent
: public WeakImplHelper7
<
83 XTestSequence
, XTestStruct
, XTestOther
, XTestInterfaces
,
84 XSimple
, XTestInParameters
, XIdentity
>
86 Reference
<XInterface
> m_xIntIdentity
;
87 sal_Int32 m_arrayConstructor
;
88 Reference
<XMultiServiceFactory
> m_rFactory
;
90 Sequence
<sal_Int8
> m_seqByte
;
91 Sequence
<float> m_seqFloat
;
92 Sequence
<double> m_seqDouble
;
93 Sequence
<sal_Bool
> m_seqBool
;
94 Sequence
<sal_Int16
> m_seqShort
;
95 Sequence
<sal_uInt16
> m_seqUShort
;
96 Sequence
<sal_Int32
> m_seqLong
;
97 Sequence
<sal_uInt32
> m_seqULong
;
98 Sequence
<sal_Unicode
> m_seqChar
;
99 Sequence
<OUString
> m_seqString
;
100 Sequence
<Any
> m_seqAny
;
101 Sequence
<Type
> m_seqType
;
102 Sequence
<Sequence
< sal_Int32
> > m_seq1
;
103 Sequence
<Sequence
< Sequence
< sal_Int32
> > > m_seq2
;
106 Sequence
<Reference
< XInterface
> > m_seqxInterface
;
121 Reference
<XInterface
> m_xinterface
;
123 sal_Int8 m_attr_int8
;
124 sal_uInt8 m_attr_uint8
;
125 sal_Int16 m_attr_int16
;
126 sal_uInt16 m_attr_uint16
;
127 sal_Int32 m_attr_int32
;
128 sal_uInt32 m_attr_uint32
;
129 sal_Int64 m_attr_int64
;
130 sal_uInt64 m_attr_uint64
;
132 double m_attr_double
;
133 OUString m_attr_string
;
134 sal_Unicode m_attr_char
;
135 sal_Bool m_attr_bool
;
138 Reference
<XInterface
> m_attr_xinterface
;
139 Reference
<XInvocation
> m_attr_xinvocation
;
142 OComponent( const Reference
<XMultiServiceFactory
> & rFactory
) :
143 m_rFactory( rFactory
), m_arrayConstructor(0) {}
145 public: // XTestSequence
146 virtual Sequence
<sal_Int8
> SAL_CALL
methodByte(const Sequence
< sal_Int8
>& aSeq
) throw( RuntimeException
);
147 virtual Sequence
<float> SAL_CALL
methodFloat(const Sequence
< float >& aSeq
) throw( RuntimeException
);
148 virtual Sequence
< double > SAL_CALL
methodDouble(const Sequence
< double >& aSeq
) throw( RuntimeException
);
149 virtual Sequence
< sal_Bool
> SAL_CALL
methodBool(const Sequence
< sal_Bool
>& aSeq
) throw( RuntimeException
);
150 virtual Sequence
< sal_Int16
> SAL_CALL
methodShort(const Sequence
< sal_Int16
>& aSeq
) throw( RuntimeException
);
151 virtual Sequence
< sal_uInt16
> SAL_CALL
methodUShort(const Sequence
< sal_uInt16
>& aSeq
) throw( RuntimeException
);
152 virtual Sequence
< sal_Int32
> SAL_CALL
methodLong(const Sequence
< sal_Int32
>& aSeq
) throw( RuntimeException
) ;
153 virtual Sequence
< sal_uInt32
> SAL_CALL
methodULong(const Sequence
< sal_uInt32
>& aSeq
) throw( RuntimeException
);
154 virtual Sequence
< OUString
> SAL_CALL
methodString(const Sequence
< OUString
>& aSeq
) throw( RuntimeException
);
155 virtual Sequence
< sal_Unicode
> SAL_CALL
methodChar(const Sequence
< sal_Unicode
>& aSeq
) throw( RuntimeException
);
156 virtual Sequence
< Any
> SAL_CALL
methodAny(const Sequence
< Any
>& aSeq
) throw( RuntimeException
);
157 virtual Sequence
< Type
> SAL_CALL
methodType(const Sequence
< Type
>& aSeq
) throw( RuntimeException
);
158 virtual Sequence
< Reference
< XInterface
> > SAL_CALL
methodXInterface( const Sequence
< Reference
< XInterface
> >& aSeq
) throw(RuntimeException
) ;
159 virtual Sequence
< Sequence
< sal_Int32
> > SAL_CALL
methodSequence(const Sequence
< Sequence
< sal_Int32
> >& aSeq
) throw( RuntimeException
);
160 virtual Sequence
< Sequence
< Sequence
< sal_Int32
> > > SAL_CALL
methodSequence2(const Sequence
< Sequence
< Sequence
< sal_Int32
> > >& aSeq
) throw( RuntimeException
);
161 virtual Sequence
< Reference
<XEventListener
> > SAL_CALL
methodXEventListeners( const Sequence
<Reference
<XEventListener
> >& aSeq
) throw( RuntimeException
);
162 virtual Sequence
< Sequence
<Reference
<XEventListener
> > > SAL_CALL
methodXEventListenersMul( const Sequence
<Sequence
<Reference
<XEventListener
> > >& aSeq
) throw (RuntimeException
);
164 virtual Sequence
< sal_Int8
> SAL_CALL
getAttrByte(void) throw( RuntimeException
);
165 virtual void SAL_CALL
setAttrByte(const Sequence
< sal_Int8
>& AttrByte_
) throw( RuntimeException
);
166 virtual Sequence
< float > SAL_CALL
getAttrFloat(void) throw( RuntimeException
) ;
167 virtual void SAL_CALL
setAttrFloat(const Sequence
< float >& AttrFloat_
) throw( RuntimeException
);
168 virtual Sequence
< double > SAL_CALL
getAttrDouble(void) throw( RuntimeException
) ;
169 virtual void SAL_CALL
setAttrDouble(const Sequence
< double >& AttrDouble_
) throw( RuntimeException
);
170 virtual Sequence
< sal_Bool
> SAL_CALL
getAttrBool(void) throw( RuntimeException
);
171 virtual void SAL_CALL
setAttrBool(const Sequence
< sal_Bool
>& AttrBool_
) throw( RuntimeException
);
172 virtual Sequence
< sal_Int16
> SAL_CALL
getAttrShort(void) throw( RuntimeException
);
173 virtual void SAL_CALL
setAttrShort(const Sequence
< sal_Int16
>& AttrShort_
) throw( RuntimeException
);
174 virtual Sequence
< sal_uInt16
> SAL_CALL
getAttrUShort(void) throw( RuntimeException
);
175 virtual void SAL_CALL
setAttrUShort(const Sequence
< sal_uInt16
>& AttrUShort_
) throw( RuntimeException
);
176 virtual Sequence
< sal_Int32
> SAL_CALL
getAttrLong(void) throw( RuntimeException
);
177 virtual void SAL_CALL
setAttrLong(const Sequence
< sal_Int32
>& AttrLong_
) throw( RuntimeException
);
178 virtual Sequence
< sal_uInt32
> SAL_CALL
getAttrULong(void) throw( RuntimeException
);
179 virtual void SAL_CALL
setAttrULong(const Sequence
< sal_uInt32
>& AttrULong_
) throw( RuntimeException
);
180 virtual Sequence
< OUString
> SAL_CALL
getAttrString(void) throw(RuntimeException
);
181 virtual void SAL_CALL
setAttrString(const Sequence
< OUString
>& AttrString_
) throw( RuntimeException
);
182 virtual Sequence
< sal_Unicode
> SAL_CALL
getAttrChar(void) throw( RuntimeException
);
183 virtual void SAL_CALL
setAttrChar(const Sequence
< sal_Unicode
>& AttrChar_
) throw( RuntimeException
);
184 virtual Sequence
< Any
> SAL_CALL
getAttrAny(void) throw( RuntimeException
);
185 virtual void SAL_CALL
setAttrAny(const Sequence
< Any
>& AttrAny_
) throw( RuntimeException
);
186 virtual Sequence
< Type
> SAL_CALL
getAttrType(void) throw( RuntimeException
);
187 virtual void SAL_CALL
setAttrType( const Sequence
< Type
>& _attrtype
) throw (RuntimeException
);
188 virtual Sequence
< Sequence
< sal_Int32
> > SAL_CALL
getAttrSequence(void) throw( RuntimeException
);
189 virtual void SAL_CALL
setAttrSequence(const Sequence
< Sequence
< sal_Int32
> >& AttrSequence_
) throw( RuntimeException
);
190 virtual Sequence
< Sequence
< Sequence
< sal_Int32
> > > SAL_CALL
getAttrSequence2(void) throw( RuntimeException
);
191 virtual void SAL_CALL
setAttrSequence2(const Sequence
< Sequence
< Sequence
< sal_Int32
> > >& AttrSequence2_
) throw ( RuntimeException
);
192 virtual Sequence
< Reference
< XInterface
> > SAL_CALL
getAttrXInterface() throw(RuntimeException
);
193 virtual void SAL_CALL
setAttrXInterface( const Sequence
< Reference
< XInterface
> >& _attrxinterface
) throw(RuntimeException
);
195 virtual ::sal_Int8 SAL_CALL
getAByte() throw (RuntimeException
);
196 virtual void SAL_CALL
setAByte( ::sal_Int8 _abyte
) throw (RuntimeException
);
197 virtual float SAL_CALL
getAFloat() throw (RuntimeException
);
198 virtual void SAL_CALL
setAFloat( float _afloat
) throw (RuntimeException
);
199 virtual double SAL_CALL
getADouble() throw (RuntimeException
);
200 virtual void SAL_CALL
setADouble( double _adouble
) throw (RuntimeException
);
201 virtual ::sal_Bool SAL_CALL
getABool() throw (RuntimeException
);
202 virtual void SAL_CALL
setABool( ::sal_Bool _abool
) throw (RuntimeException
);
203 virtual ::sal_Int16 SAL_CALL
getAShort() throw (RuntimeException
);
204 virtual void SAL_CALL
setAShort( ::sal_Int16 _ashort
) throw (RuntimeException
);
205 virtual ::sal_uInt16 SAL_CALL
getAUShort() throw (RuntimeException
);
206 virtual void SAL_CALL
setAUShort( ::sal_uInt16 _aushort
) throw (RuntimeException
);
207 virtual ::sal_Int32 SAL_CALL
getALong() throw (RuntimeException
);
208 virtual void SAL_CALL
setALong( ::sal_Int32 _along
) throw (RuntimeException
);
209 virtual ::sal_uInt32 SAL_CALL
getAULong() throw (RuntimeException
);
210 virtual void SAL_CALL
setAULong( ::sal_uInt32 _aulong
) throw (RuntimeException
);
211 virtual ::rtl::OUString SAL_CALL
getAString() throw (RuntimeException
);
212 virtual void SAL_CALL
setAString( const ::rtl::OUString
& _astring
) throw (RuntimeException
);
213 virtual ::sal_Unicode SAL_CALL
getAChar() throw (RuntimeException
);
214 virtual void SAL_CALL
setAChar( ::sal_Unicode _achar
) throw (RuntimeException
);
215 virtual Any SAL_CALL
getAAny() throw (RuntimeException
);
216 virtual void SAL_CALL
setAAny( const Any
& _aany
) throw (RuntimeException
);
217 virtual Type SAL_CALL
getAType() throw (RuntimeException
);
218 virtual void SAL_CALL
setAType( const Type
& _atype
) throw (RuntimeException
);
219 virtual Reference
< XInterface
> SAL_CALL
getAXInterface() throw (RuntimeException
);
220 virtual void SAL_CALL
setAXInterface( const Reference
<XInterface
>& _axinterface
) throw (RuntimeException
);
221 virtual Reference
<XInvocation
> SAL_CALL
getAXInvocation() throw (RuntimeException
);
222 virtual void SAL_CALL
setAXInvocation( const Reference
< XInvocation
>& _axinvocation
) throw (RuntimeException
);
224 virtual void SAL_CALL
testout_methodByte(sal_Int8
& rOut
) throw( RuntimeException
);
225 virtual void SAL_CALL
testout_methodFloat(float& rOut
) throw( RuntimeException
);
226 virtual void SAL_CALL
testout_methodDouble(double& rOut
) throw( RuntimeException
);
227 virtual void SAL_CALL
testout_methodBool(sal_Bool
& rOut
) throw( RuntimeException
);
228 virtual void SAL_CALL
testout_methodShort(sal_Int16
& rOut
) throw( RuntimeException
);
229 virtual void SAL_CALL
testout_methodUShort(sal_uInt16
& rOut
) throw( RuntimeException
);
230 virtual void SAL_CALL
testout_methodLong(sal_Int32
& rOut
) throw( RuntimeException
);
231 virtual void SAL_CALL
testout_methodULong(sal_uInt32
& rOut
) throw( RuntimeException
);
232 virtual void SAL_CALL
testout_methodHyper(sal_Int64
& rOut
) throw( RuntimeException
);
233 virtual void SAL_CALL
testout_methodUHyper(sal_uInt64
& rOut
) throw( RuntimeException
);
234 virtual void SAL_CALL
testout_methodString(OUString
& rOut
) throw( RuntimeException
);
235 virtual void SAL_CALL
testout_methodChar(sal_Unicode
& rOut
) throw( RuntimeException
);
236 virtual void SAL_CALL
testout_methodAny(Any
& rOut
) throw( RuntimeException
);
237 virtual void SAL_CALL
testout_methodType(Type
& rOut
) throw( RuntimeException
);
238 virtual void SAL_CALL
testout_methodSequence(Sequence
< sal_Int32
>& rOut
) throw( RuntimeException
);
239 virtual void SAL_CALL
testout_methodSequence2(Sequence
< Sequence
< sal_Int32
> >& rOut
) throw( RuntimeException
);
240 virtual void SAL_CALL
testout_methodMulParams1(sal_Int32
& rout1
, sal_Int32
& rout2
) throw( RuntimeException
);
241 virtual void SAL_CALL
testout_methodMulParams2(sal_Int32
& rout1
, sal_Int32
& rout2
, OUString
& rout3
) throw( RuntimeException
);
242 virtual void SAL_CALL
testout_methodMulParams3(const OUString
& sin
, OUString
& sout
) throw( RuntimeException
);
243 virtual void SAL_CALL
testout_methodMulParams4( float in1
, float& out1
, sal_Int32 in2
, sal_Int32
& out2
, sal_Int32 in3
) throw(RuntimeException
);
244 virtual void SAL_CALL
testout_methodXInterface( Reference
< XInterface
>& rOut
) throw(RuntimeException
);
246 virtual void SAL_CALL
testinout_methodByte(sal_Int8
& rOut
) throw( RuntimeException
);
247 virtual void SAL_CALL
testinout_methodFloat(float& rOut
) throw( RuntimeException
);
248 virtual void SAL_CALL
testinout_methodDouble(double& rOut
) throw( RuntimeException
);
249 virtual void SAL_CALL
testinout_methodBool(sal_Bool
& rOut
) throw( RuntimeException
);
250 virtual void SAL_CALL
testinout_methodShort(sal_Int16
& rOut
) throw( RuntimeException
);
251 virtual void SAL_CALL
testinout_methodUShort(sal_uInt16
& rOut
) throw( RuntimeException
);
252 virtual void SAL_CALL
testinout_methodLong(sal_Int32
& rOut
) throw( RuntimeException
);
253 virtual void SAL_CALL
testinout_methodULong(sal_uInt32
& rOut
) throw( RuntimeException
);
254 virtual void SAL_CALL
testinout_methodHyper(sal_Int64
& rOut
) throw( RuntimeException
);
255 virtual void SAL_CALL
testinout_methodUHyper(sal_uInt64
& rOut
) throw( RuntimeException
);
256 virtual void SAL_CALL
testinout_methodString(OUString
& rOut
) throw( RuntimeException
);
257 virtual void SAL_CALL
testinout_methodChar(sal_Unicode
& rOut
) throw( RuntimeException
);
258 virtual void SAL_CALL
testinout_methodAny(Any
& rOut
) throw( RuntimeException
);
259 virtual void SAL_CALL
testinout_methodType(Type
& rOut
) throw( RuntimeException
);
260 virtual void SAL_CALL
testinout_methodSequence(Sequence
< sal_Int32
>& rOut
) throw( RuntimeException
);
261 virtual void SAL_CALL
testinout_methodSequence2(Sequence
< Sequence
< sal_Int32
> >& rOut
) throw( RuntimeException
);
262 virtual void SAL_CALL
testinout_methodXInterface( Reference
< XInvocation
>& rOut
) throw(RuntimeException
);
263 virtual void SAL_CALL
testinout_methodXInterface2( Reference
< XInterface
> & rOut
) throw( RuntimeException
);
264 virtual Any SAL_CALL
methodAnyTest1(const Any
& rIn
) throw( RuntimeException
) ;
265 virtual Any SAL_CALL
getAttrAny2(void) throw( RuntimeException
) ;
266 virtual void SAL_CALL
setAttrAny2(const Any
& AttrAny2_
) throw( RuntimeException
) ;
270 virtual void SAL_CALL
methodStruct(const Property
& aProp
) throw( RuntimeException
);
272 virtual Property SAL_CALL
retMethodStruct(void) throw( RuntimeException
);
274 virtual Property SAL_CALL
getAttrStruct(void) throw( RuntimeException
);
275 virtual void SAL_CALL
setAttrStruct(const Property
& AttrStruct_
) throw( RuntimeException
);
276 virtual Property SAL_CALL
methodStruct2( const Property
& aProp
) throw (RuntimeException
);
279 virtual void SAL_CALL
other_methodAnyIn(const Any
& rAny
) throw( RuntimeException
);
280 virtual void SAL_CALL
other_methodAnyOut(Any
& rAny
) throw( RuntimeException
);
281 virtual Any SAL_CALL
other_methodAnyRet(void) throw( RuntimeException
);
282 virtual void SAL_CALL
in_float( float val
) throw ( RuntimeException
);
283 virtual Any SAL_CALL
other_methodAny( const Any
& rAny
, const OUString
& typeInAny
)
284 throw (RuntimeException
);
287 // XTestOutParameters ------------------------------------------------------------------------
288 // virtual void SAL_CALL out_test(sal_Int8 rIn) throw( RuntimeException );
290 // virtual void SAL_CALL out_methodByte(sal_Int8& rOut) throw( RuntimeException );
291 // virtual void SAL_CALL out_methodFloat(float& rOut) throw( RuntimeException );
292 // virtual void SAL_CALL out_methodDouble(double& rOut) throw( RuntimeException );
293 // virtual void SAL_CALL out_methodBool(sal_Bool& rOut) throw( RuntimeException );
294 // virtual void SAL_CALL out_methodShort(sal_Int16& rOut) throw( RuntimeException );
295 // virtual void SAL_CALL out_methodUShort(sal_uInt16& rOut) throw( RuntimeException );
296 // virtual void SAL_CALL out_methodLong(sal_Int32& rOut) throw( RuntimeException );
297 // virtual void SAL_CALL out_methodULong(sal_uInt32& rOut) throw( RuntimeException );
298 // virtual void SAL_CALL out_methodHyper(sal_Int64& rOut) throw( RuntimeException );
299 // virtual void SAL_CALL out_methodUHyper(sal_uInt64& rOut) throw( RuntimeException );
300 // virtual void SAL_CALL out_methodString(OUString& rOut) throw( RuntimeException );
301 // virtual void SAL_CALL out_methodChar(sal_Unicode& rOut) throw( RuntimeException );
302 // virtual void SAL_CALL out_methodAny(Any& rOut) throw( RuntimeException );
303 // virtual void SAL_CALL out_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException );
304 // virtual void SAL_CALL out_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException );
305 // virtual void SAL_CALL out_methodMulParams1(sal_Int32& rout1, sal_Int32& rout2) throw( RuntimeException );
306 // virtual void SAL_CALL out_methodMulParams2(sal_Int32& rout1, sal_Int32& rout2, OUString& rout3) throw( RuntimeException );
307 // virtual void SAL_CALL out_methodMulParams3(const OUString& sin, OUString& sout) throw( RuntimeException );
310 virtual sal_Int8 SAL_CALL
in_methodByte( sal_Int8 rIn
) throw (RuntimeException
);
311 virtual float SAL_CALL
in_methodFloat( float rIn
) throw (RuntimeException
);
312 virtual double SAL_CALL
in_methodDouble( double rIn
) throw (RuntimeException
);
313 virtual sal_Bool SAL_CALL
in_methodBool( sal_Bool rIn
) throw (RuntimeException
);
314 virtual sal_Int16 SAL_CALL
in_methodShort( sal_Int16 rIn
) throw (RuntimeException
);
315 virtual sal_uInt16 SAL_CALL
in_methodUShort( sal_uInt16 rIn
) throw (RuntimeException
);
316 virtual sal_Int32 SAL_CALL
in_methodLong( sal_Int32 rIn
) throw (RuntimeException
);
317 virtual sal_uInt32 SAL_CALL
in_methodULong( sal_uInt32 rIn
) throw (RuntimeException
);
318 virtual sal_Int64 SAL_CALL
in_methodHyper( sal_Int64 rIn
) throw (RuntimeException
);
319 virtual sal_uInt64 SAL_CALL
in_methodUHyper( sal_uInt64 rIn
) throw (RuntimeException
);
320 virtual OUString SAL_CALL
in_methodString( const OUString
& rIn
) throw (RuntimeException
);
321 virtual sal_Unicode SAL_CALL
in_methodChar( sal_Unicode rIn
) throw (RuntimeException
);
322 virtual Any SAL_CALL
in_methodAny( const Any
& rIn
) throw (RuntimeException
);
323 virtual Type SAL_CALL
in_methodType( const Type
& rIn
) throw (RuntimeException
);
324 virtual Reference
<XInterface
> SAL_CALL
in_methodXInterface( const Reference
< XInterface
>& rIn
) throw (RuntimeException
);
325 virtual Reference
<XInvocation
> SAL_CALL
in_methodInvocation( const Reference
< XInvocation
>& inv
) throw (RuntimeException
);
326 virtual SimpleStruct SAL_CALL
in_methodStruct( const SimpleStruct
& aStruct
) throw (RuntimeException
);
327 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
);
329 // XTestInterfaces --------------------------------------------------------------------------
330 virtual void SAL_CALL
testInterface( const Reference
< XCallback
>& xCallback
, sal_Int32 mode
) throw(RuntimeException
);
331 virtual void SAL_CALL
testInterface2( const Reference
< XSimple
>& xSimple
, sal_Int32 mode
) throw(RuntimeException
);
332 // XSimple --------------------------------------------------------------------------
333 void SAL_CALL
func( const OUString
&message
) throw(::com::sun::star::uno::RuntimeException
);
334 OUString SAL_CALL
getName() throw(::com::sun::star::uno::RuntimeException
);
337 virtual void SAL_CALL
setObject( const Reference
< XInterface
>& val
) throw (RuntimeException
);
338 virtual sal_Bool SAL_CALL
isSame( const Reference
< XInterface
>& val
) throw (RuntimeException
);
339 virtual Reference
< XInterface
> SAL_CALL
getThis( ) throw (RuntimeException
);
342 class EventListener
: public WeakImplHelper1
<XEventListener
>
345 EventListener::EventListener(): bCalled( sal_False
)
347 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw (RuntimeException
);
353 OComponent::~OComponent()
358 // Funktions ==============================================================================
360 Reference
<XInterface
> SAL_CALL
OComponent_CreateInstance( const Reference
<XMultiServiceFactory
> & rSMgr
) throw(RuntimeException
)
362 // Reference<XInterface> xService(static_cast<XWeak*>(new OComponent( rSMgr )), UNO_QUERY);
363 OComponent
* o
= new OComponent( rSMgr
);
364 Reference
<XInterface
> xService(static_cast<XIdentity
*>(o
), UNO_QUERY
);
368 Sequence
<OUString
> OComponent_getSupportedServiceNames(void)
370 Sequence
<OUString
> aRet(1);
371 aRet
.getArray()[0] = SERVICE_NAME
;//ODataInputStream_getImplementationName();
377 extern "C" sal_Bool SAL_CALL
component_writeInfo( void * /*pServiceManager*/, void * pRegistryKey
)
383 Reference
<XRegistryKey
> xNewKey
=
384 reinterpret_cast<XRegistryKey
*>( pRegistryKey
)->createKey(KEY1
);
385 xNewKey
->createKey( KEY2
);
389 catch(InvalidRegistryException
&)
391 OSL_ENSURE( sal_False
, "### InvalidRegistryException!\n");
397 extern "C" void * SAL_CALL
component_getFactory(
398 const sal_Char
* pImplName
, void * pServiceManager
, void * /*pRegistryKey*/ )
400 static void * pRet
= NULL
;
403 OUString
aImplName( OUString::createFromAscii( pImplName
) );
404 if (pServiceManager
&& aImplName
.equals( IMPL_NAME
))
406 Reference
<XMultiServiceFactory
> xMulFac(
407 reinterpret_cast< XMultiServiceFactory
*>(pServiceManager
));
409 Sequence
<OUString
> seqServiceNames
;
410 Reference
<XSingleServiceFactory
> xFactory
= createOneInstanceFactory( xMulFac
, SERVICE_NAME
,
411 OComponent_CreateInstance
, seqServiceNames
);
416 pRet
= xFactory
.get();
423 extern "C" void SAL_CALL
component_getImplementationEnvironment(
424 const sal_Char
** ppEnvTypeName
, uno_Environment
** )
426 *ppEnvTypeName
= CPPU_CURRENT_LANGUAGE_BINDING_NAME
;
430 // XTestSequence ============================================================================
431 Sequence
<sal_Int8
> SAL_CALL
OComponent::methodByte(const Sequence
< sal_Int8
>& aSeq
) throw( RuntimeException
)
434 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
435 _x
= aSeq
.getConstArray()[i
];
439 Sequence
<float> SAL_CALL
OComponent::methodFloat(const Sequence
< float>& aSeq
) throw( RuntimeException
)
442 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
443 _x
= aSeq
.getConstArray()[i
];
447 Sequence
<double> SAL_CALL
OComponent::methodDouble(const Sequence
< double >& aSeq
) throw( RuntimeException
)
450 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
451 _x
= aSeq
.getConstArray()[i
];
455 Sequence
< sal_Bool
> SAL_CALL
OComponent::methodBool(const Sequence
< sal_Bool
>& aSeq
) throw( RuntimeException
)
458 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
459 _x
= aSeq
.getConstArray()[i
];
463 Sequence
< sal_Int16
> SAL_CALL
OComponent::methodShort(const Sequence
< sal_Int16
>& aSeq
) throw( RuntimeException
)
466 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
467 _x
= aSeq
.getConstArray()[i
];
471 Sequence
< sal_uInt16
> SAL_CALL
OComponent::methodUShort(const Sequence
< sal_uInt16
>& aSeq
) throw( RuntimeException
)
474 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
475 _x
= aSeq
.getConstArray()[i
];
479 Sequence
< sal_Int32
> SAL_CALL
OComponent::methodLong(const Sequence
< sal_Int32
>& aSeq
) throw( RuntimeException
)
482 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++) {
483 _x
= aSeq
.getConstArray()[i
];
487 Sequence
< sal_uInt32
> SAL_CALL
OComponent::methodULong(const Sequence
< sal_uInt32
>& aSeq
) throw( RuntimeException
)
490 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
491 _x
= aSeq
.getConstArray()[i
];
495 Sequence
< OUString
> SAL_CALL
OComponent::methodString(const Sequence
< OUString
>& aSeq
) throw( RuntimeException
)
498 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++) {
499 _x
= aSeq
.getConstArray()[i
];
503 Sequence
< sal_Unicode
> SAL_CALL
OComponent::methodChar(const Sequence
< sal_Unicode
>& aSeq
) throw( RuntimeException
)
506 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
507 _x
= aSeq
.getConstArray()[i
];
511 Sequence
< Any
> SAL_CALL
OComponent::methodAny(const Sequence
< Any
>& aSeq
) throw( RuntimeException
)
514 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
515 _x
= aSeq
.getConstArray()[i
];
516 TypeClass _t
= _x
.getValueTypeClass();
517 if( _t
== TypeClass_STRING
)
518 OUString
s(* (rtl_uString
**)_x
.getValue());
524 Sequence
< Type
> SAL_CALL
OComponent::methodType(const Sequence
< Type
>& aSeq
) throw( RuntimeException
)
527 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
528 _x
= aSeq
.getConstArray()[i
];
532 //Sequence< Reference< XInterface> > SAL_CALL methodXInterface ( const Sequence< Reference < XInterface> >& aSeq)
533 // throw (RuntimeException)
534 Sequence
< Reference
< XInterface
> > SAL_CALL
OComponent::methodXInterface( const Sequence
< Reference
< XInterface
> >& aSeq
) throw(RuntimeException
)
536 for( sal_Int32 i
= 0; i
< aSeq
.getLength(); i
++)
538 Reference
<XInterface
> xInt
= aSeq
[i
];
539 Reference
<XEventListener
> xList( xInt
, UNO_QUERY
);
541 xList
->disposing( EventObject());
546 Sequence
< Sequence
< sal_Int32
> > SAL_CALL
OComponent::methodSequence(const Sequence
< Sequence
< sal_Int32
> >& aSeq
) throw( RuntimeException
)
549 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
550 const Sequence
<sal_Int32
>& rseq2
= aSeq
.getConstArray()[i
];
551 for (sal_Int16 j
= 0; j
< rseq2
.getLength(); j
++){
552 value
= rseq2
.getConstArray()[j
];
557 Sequence
< Sequence
< Sequence
< sal_Int32
> > > SAL_CALL
OComponent::methodSequence2(const Sequence
< Sequence
< Sequence
< sal_Int32
> > >& aSeq
)
558 throw( RuntimeException
)
561 sal_Int32 len
= aSeq
.getLength();
562 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
563 const Sequence
< Sequence
<sal_Int32
> >& rseq2
= aSeq
.getConstArray()[i
];
564 len
= rseq2
.getLength();
566 for (sal_Int16 j
= 0; j
< rseq2
.getLength(); j
++){
567 const Sequence
<sal_Int32
> & rseq3
= rseq2
.getConstArray()[j
];
568 len
= rseq3
.getLength();
570 for (sal_Int16 k
= 0; k
< rseq3
.getLength(); k
++)
571 value
= rseq3
.getConstArray()[k
];
577 Sequence
< Reference
< XEventListener
> > SAL_CALL
OComponent::methodXEventListeners( const Sequence
< Reference
<XEventListener
> >& aSeq
) throw( RuntimeException
)
579 Reference
<XEventListener
> listener
;
580 for( int i
= 0; i
< aSeq
.getLength(); i
++)
584 listener
->disposing( EventObject() );
590 Sequence
< Sequence
<Reference
<XEventListener
> > > SAL_CALL
OComponent::methodXEventListenersMul( const Sequence
<Sequence
<Reference
<XEventListener
> > >& aSeq
) throw (RuntimeException
)
592 Reference
<XEventListener
> listener
;
593 for( int i
= 0; i
< aSeq
.getLength(); i
++)
595 Sequence
<Reference
<XEventListener
> > seqInner
= aSeq
[i
];
596 for( int j
= 0; j
< seqInner
.getLength(); j
++)
598 listener
= seqInner
[j
];
599 listener
->disposing( EventObject() );
605 //---------------------------------------------------------------------------------------------
607 Sequence
< sal_Int8
> SAL_CALL
OComponent::getAttrByte(void) throw( RuntimeException
)
611 void SAL_CALL
OComponent::setAttrByte(const Sequence
< sal_Int8
>& AttrByte_
) throw( RuntimeException
)
613 m_seqByte
= AttrByte_
;
615 Sequence
< float > SAL_CALL
OComponent::getAttrFloat(void) throw( RuntimeException
)
619 void SAL_CALL
OComponent::setAttrFloat(const Sequence
< float >& AttrFloat_
) throw( RuntimeException
)
621 m_seqFloat
= AttrFloat_
;
624 Sequence
< double > SAL_CALL
OComponent::getAttrDouble(void) throw( RuntimeException
)
628 void SAL_CALL
OComponent::setAttrDouble(const Sequence
< double >& AttrDouble_
) throw( RuntimeException
)
630 m_seqDouble
= AttrDouble_
;
633 Sequence
< sal_Bool
> SAL_CALL
OComponent::getAttrBool(void) throw( RuntimeException
)
638 void SAL_CALL
OComponent::setAttrBool(const Sequence
< sal_Bool
>& AttrBool_
) throw (RuntimeException
)
640 m_seqBool
= AttrBool_
;
643 Sequence
< sal_Int16
> SAL_CALL
OComponent::getAttrShort(void) throw( RuntimeException
)
647 void SAL_CALL
OComponent::setAttrShort(const Sequence
< sal_Int16
>& AttrShort_
) throw( RuntimeException
)
649 m_seqShort
= AttrShort_
;
652 Sequence
< sal_uInt16
> SAL_CALL
OComponent::getAttrUShort(void) throw( RuntimeException
)
656 void SAL_CALL
OComponent::setAttrUShort(const Sequence
< sal_uInt16
>& AttrUShort_
) throw( RuntimeException
)
658 m_seqUShort
= AttrUShort_
;
661 Sequence
< sal_Int32
> SAL_CALL
OComponent::getAttrLong(void) throw( RuntimeException
)
665 void SAL_CALL
OComponent::setAttrLong(const Sequence
< sal_Int32
>& AttrLong_
) throw( RuntimeException
)
667 m_seqLong
= AttrLong_
;
670 Sequence
< sal_uInt32
> SAL_CALL
OComponent::getAttrULong(void) throw( RuntimeException
)
674 void SAL_CALL
OComponent::setAttrULong(const Sequence
< sal_uInt32
>& AttrULong_
) throw( RuntimeException
)
676 m_seqULong
= AttrULong_
;
679 Sequence
< OUString
> SAL_CALL
OComponent::getAttrString(void) throw( RuntimeException
)
683 void SAL_CALL
OComponent::setAttrString(const Sequence
< OUString
>& AttrString_
) throw( RuntimeException
)
685 m_seqString
= AttrString_
;
688 Sequence
< sal_Unicode
> SAL_CALL
OComponent::getAttrChar(void) throw( RuntimeException
)
692 void SAL_CALL
OComponent::setAttrChar(const Sequence
< sal_Unicode
>& AttrChar_
) throw( RuntimeException
)
694 m_seqChar
= AttrChar_
;
697 Sequence
< Any
> SAL_CALL
OComponent::getAttrAny(void) throw( RuntimeException
)
701 void SAL_CALL
OComponent::setAttrAny(const Sequence
< Any
>& AttrAny_
) throw( RuntimeException
)
706 Sequence
< Type
> SAL_CALL
OComponent::getAttrType(void) throw( RuntimeException
)
711 void SAL_CALL
OComponent::setAttrType( const Sequence
< Type
>& AttrType_
) throw( RuntimeException
)
713 m_seqType
= AttrType_
;
717 Sequence
< Sequence
< sal_Int32
> > SAL_CALL
OComponent::getAttrSequence(void) throw( RuntimeException
)
721 void SAL_CALL
OComponent::setAttrSequence(const Sequence
< Sequence
< sal_Int32
> >& AttrSequence
) throw(RuntimeException
)
724 for( sal_Int32 i
=0; i
< AttrSequence
.getLength(); i
++)
726 Sequence
< sal_Int32
> seq
= AttrSequence
[i
];
728 for ( sal_Int32 j
=0; j
< seq
.getLength(); j
++)
734 m_seq1
= AttrSequence
;
737 Sequence
< Sequence
< Sequence
< sal_Int32
> > > SAL_CALL
OComponent::getAttrSequence2(void) throw( RuntimeException
)
741 void SAL_CALL
OComponent::setAttrSequence2(const Sequence
< Sequence
< Sequence
< sal_Int32
> > >& AttrSequence2_
)
742 throw( RuntimeException
)
744 m_seq2
= AttrSequence2_
;
747 Sequence
< Reference
< XInterface
> > SAL_CALL
OComponent::getAttrXInterface() throw(RuntimeException
)
749 return m_seqxInterface
;
751 void SAL_CALL
OComponent::setAttrXInterface( const Sequence
< Reference
< XInterface
> >& _attrxinterface
) throw(RuntimeException
)
753 m_seqxInterface
= _attrxinterface
;
756 // ----------------------------------------------------------------------------
758 ::sal_Int8 SAL_CALL
OComponent::getAByte() throw (RuntimeException
)
763 void SAL_CALL
OComponent::setAByte( ::sal_Int8 _abyte
) throw (RuntimeException
)
765 m_attr_int8
= _abyte
;
768 float SAL_CALL
OComponent::getAFloat() throw (RuntimeException
)
773 void SAL_CALL
OComponent::setAFloat( float _afloat
) throw (RuntimeException
)
775 m_attr_float
= _afloat
;
778 double SAL_CALL
OComponent::getADouble() throw (RuntimeException
)
780 return m_attr_double
;
783 void SAL_CALL
OComponent::setADouble( double _adouble
) throw (RuntimeException
)
785 m_attr_double
= _adouble
;
788 ::sal_Bool SAL_CALL
OComponent::getABool() throw (RuntimeException
)
793 void SAL_CALL
OComponent::setABool( ::sal_Bool _abool
) throw (RuntimeException
)
795 m_attr_bool
= _abool
;
798 ::sal_Int16 SAL_CALL
OComponent::getAShort() throw (RuntimeException
)
803 void SAL_CALL
OComponent::setAShort( ::sal_Int16 _ashort
) throw (RuntimeException
)
805 m_attr_int16
= _ashort
;
808 ::sal_uInt16 SAL_CALL
OComponent::getAUShort() throw (RuntimeException
)
810 return m_attr_uint16
;
813 void SAL_CALL
OComponent::setAUShort( ::sal_uInt16 _aushort
) throw (RuntimeException
)
815 m_attr_uint16
= _aushort
;
818 ::sal_Int32 SAL_CALL
OComponent::getALong() throw (RuntimeException
)
823 void SAL_CALL
OComponent::setALong( ::sal_Int32 _along
) throw (RuntimeException
)
825 m_attr_int32
= _along
;
828 ::sal_uInt32 SAL_CALL
OComponent::getAULong() throw (RuntimeException
)
830 return m_attr_uint32
;;
833 void SAL_CALL
OComponent::setAULong( ::sal_uInt32 _aulong
) throw (RuntimeException
)
835 m_attr_uint32
= _aulong
;
838 ::rtl::OUString SAL_CALL
OComponent::getAString() throw (RuntimeException
)
840 return m_attr_string
;
843 void SAL_CALL
OComponent::setAString( const ::rtl::OUString
& _astring
) throw (RuntimeException
)
845 m_attr_string
= _astring
;
848 ::sal_Unicode SAL_CALL
OComponent::getAChar() throw (RuntimeException
)
853 void SAL_CALL
OComponent::setAChar( ::sal_Unicode _achar
) throw (RuntimeException
)
855 m_attr_char
= _achar
;
858 Any SAL_CALL
OComponent::getAAny() throw (RuntimeException
)
863 void SAL_CALL
OComponent::setAAny( const Any
& _aany
) throw (RuntimeException
)
868 Type SAL_CALL
OComponent::getAType() throw (RuntimeException
)
873 void SAL_CALL
OComponent::setAType( const Type
& _atype
) throw (RuntimeException
)
875 m_attr_type
= _atype
;
878 Reference
< XInterface
> SAL_CALL
OComponent::getAXInterface() throw (RuntimeException
)
880 return m_attr_xinterface
;
883 void SAL_CALL
OComponent::setAXInterface( const Reference
<XInterface
>& _axinterface
) throw (RuntimeException
)
885 m_attr_xinterface
= _axinterface
;
888 Reference
<XInvocation
> SAL_CALL
OComponent::getAXInvocation() throw (RuntimeException
)
890 return m_attr_xinvocation
;
893 void SAL_CALL
OComponent::setAXInvocation( const Reference
< XInvocation
>& _axinvocation
) throw (RuntimeException
)
895 m_attr_xinvocation
= _axinvocation
;
897 //-----------------------------------------------------------------------------------
898 void SAL_CALL
OComponent::testout_methodByte(sal_Int8
& rOut
) throw( RuntimeException
)
902 void SAL_CALL
OComponent::testout_methodFloat(float& rOut
) throw( RuntimeException
)
906 void SAL_CALL
OComponent::testout_methodDouble(double& rOut
) throw( RuntimeException
)
911 void SAL_CALL
OComponent::testout_methodBool(sal_Bool
& rOut
) throw( RuntimeException
)
915 void SAL_CALL
OComponent::testout_methodShort(sal_Int16
& rOut
) throw( RuntimeException
)
919 void SAL_CALL
OComponent::testout_methodUShort(sal_uInt16
& rOut
) throw( RuntimeException
)
923 void SAL_CALL
OComponent::testout_methodLong(sal_Int32
& rOut
) throw( RuntimeException
)
927 void SAL_CALL
OComponent::testout_methodULong(sal_uInt32
& rOut
) throw( RuntimeException
)
931 void SAL_CALL
OComponent::testout_methodHyper(sal_Int64
& rOut
) throw( RuntimeException
)
936 void SAL_CALL
OComponent::testout_methodUHyper(sal_uInt64
& rOut
) throw( RuntimeException
)
941 void SAL_CALL
OComponent::testout_methodString(OUString
& rOut
) throw( RuntimeException
)
945 void SAL_CALL
OComponent::testout_methodChar(sal_Unicode
& rOut
) throw( RuntimeException
)
949 void SAL_CALL
OComponent::testout_methodAny(Any
& rOut
) throw( RuntimeException
)
954 void SAL_CALL
OComponent::testout_methodType(Type
& rOut
) throw( RuntimeException
)
959 void SAL_CALL
OComponent::testout_methodSequence(Sequence
< sal_Int32
>& rOut
) throw( RuntimeException
)
962 for( sal_Int16 i
= 0; i
< rOut
.getLength(); i
++) rOut
.getArray()[i
]= i
;
964 void SAL_CALL
OComponent::testout_methodSequence2(Sequence
< Sequence
< sal_Int32
> >& rOut
) throw( RuntimeException
)
967 for( sal_Int16 i
= 0; i
< rOut
.getLength(); i
++){
968 Sequence
<sal_Int32
>& rseq2
= rOut
.getArray()[i
];
970 for (sal_Int16 j
= 0; j
< rseq2
.getLength(); j
++){
971 rseq2
.getArray()[j
]= j
;
975 void SAL_CALL
OComponent::testout_methodMulParams1(sal_Int32
& rout1
, sal_Int32
& rout2
) throw( RuntimeException
)
980 void SAL_CALL
OComponent::testout_methodMulParams2(sal_Int32
& rout1
, sal_Int32
& rout2
, OUString
& rout3
) throw( RuntimeException
)
984 rout3
= L
" another string";
986 void SAL_CALL
OComponent::testout_methodMulParams3(const OUString
&, OUString
& sout
) throw( RuntimeException
)
990 void SAL_CALL
OComponent::testout_methodMulParams4( float in1
, float& out1
, sal_Int32 in2
, sal_Int32
& out2
, sal_Int32
) throw(RuntimeException
)
996 void SAL_CALL
OComponent::testout_methodXInterface( Reference
< XInterface
>& rOut
) throw(RuntimeException
)
999 // OUString string( L"Property Any");
1000 // m_any <<= string;
1001 // rOut= Reference<XInterface> (static_cast<XTestSequence*>(this), UNO_QUERY);
1004 // XTestInParameters ------------------------------------------------------------
1005 sal_Int8 SAL_CALL
OComponent::in_methodByte( sal_Int8 rIn
) throw (RuntimeException
)
1010 float SAL_CALL
OComponent::in_methodFloat( float rIn
) throw (RuntimeException
)
1015 double SAL_CALL
OComponent::in_methodDouble( double rIn
) throw (RuntimeException
)
1020 sal_Bool SAL_CALL
OComponent::in_methodBool( sal_Bool rIn
) throw (RuntimeException
)
1025 sal_Int16 SAL_CALL
OComponent::in_methodShort( sal_Int16 rIn
) throw (RuntimeException
)
1030 sal_uInt16 SAL_CALL
OComponent::in_methodUShort( sal_uInt16 rIn
) throw (RuntimeException
)
1035 sal_Int32 SAL_CALL
OComponent::in_methodLong( sal_Int32 rIn
) throw (RuntimeException
)
1040 sal_uInt32 SAL_CALL
OComponent::in_methodULong( sal_uInt32 rIn
) throw (RuntimeException
)
1045 sal_Int64 SAL_CALL
OComponent::in_methodHyper( sal_Int64 rIn
) throw (RuntimeException
)
1051 sal_uInt64 SAL_CALL
OComponent::in_methodUHyper( sal_uInt64 rIn
) throw (RuntimeException
)
1057 OUString SAL_CALL
OComponent::in_methodString( const OUString
& rIn
) throw (RuntimeException
)
1062 sal_Unicode SAL_CALL
OComponent::in_methodChar( sal_Unicode rIn
) throw (RuntimeException
)
1067 Any SAL_CALL
OComponent::in_methodAny( const Any
& rIn
) throw (RuntimeException
)
1073 Type SAL_CALL
OComponent::in_methodType( const Type
& rIn
) throw (RuntimeException
)
1079 Reference
<XInvocation
> SAL_CALL
OComponent::in_methodInvocation( const Reference
< XInvocation
>& inv
)
1080 throw (RuntimeException
)
1082 //We expect the invocation results from a conversion of VBasicEventListener.VBEventListener
1083 //which implements XEventListener
1084 // extensions/test/ole/EventListenerSample
1085 EventObject
event( Reference
<XInterface
>(static_cast<XTestInParameters
*>(this),UNO_QUERY
));
1088 Sequence
<Any
> params( &anyParam
, 1);
1089 Sequence
<sal_Int16
> outIndex
;
1090 Sequence
<Any
> outParams
;
1092 inv
->invoke( OUString(RTL_CONSTASCII_USTRINGPARAM("disposing")),
1093 params
, outIndex
, outParams
);
1094 }catch(IllegalArgumentException
&) {
1096 catch(CannotConvertException
&){
1098 catch(InvocationTargetException
&) {
1102 Reference
<XInterface
> SAL_CALL
OComponent::in_methodXInterface( const Reference
<XInterface
>& rIn
) throw (RuntimeException
)
1108 SimpleStruct SAL_CALL
OComponent::in_methodStruct( const SimpleStruct
& aStruct
)
1109 throw (RuntimeException
)
1111 SimpleStruct
& s
= const_cast<SimpleStruct
&>(aStruct
);
1112 s
.message
= s
.message
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
1113 "This string was set in OleTest"));
1116 void SAL_CALL
OComponent::in_methodAll(
1117 sal_Int8
, float, double, sal_Bool
, sal_Int16
, sal_uInt16
,
1118 sal_Int32
, sal_uInt32
, const OUString
&, sal_Unicode
,
1119 const Any
&, const Type
&, const Reference
<XInvocation
>&) throw (RuntimeException
)
1123 // INOUT -----------------------------------------------------------------------------------
1124 void SAL_CALL
OComponent::testinout_methodByte(sal_Int8
& rOut
) throw( RuntimeException
)
1126 sal_Int8 tmp
= rOut
;
1130 void SAL_CALL
OComponent::testinout_methodFloat(float& rOut
) throw( RuntimeException
)
1137 void SAL_CALL
OComponent::testinout_methodDouble(double& rOut
) throw( RuntimeException
)
1143 void SAL_CALL
OComponent::testinout_methodBool(sal_Bool
& rOut
) throw( RuntimeException
)
1145 sal_Bool tmp
= rOut
;
1149 void SAL_CALL
OComponent::testinout_methodShort(sal_Int16
& rOut
) throw( RuntimeException
)
1151 sal_Int16 tmp
= rOut
;
1155 void SAL_CALL
OComponent::testinout_methodUShort(sal_uInt16
& rOut
) throw( RuntimeException
)
1157 sal_uInt16 tmp
= rOut
;
1161 void SAL_CALL
OComponent::testinout_methodLong(sal_Int32
& rOut
) throw( RuntimeException
)
1163 sal_Int32 tmp
= rOut
;
1167 void SAL_CALL
OComponent::testinout_methodULong(sal_uInt32
& rOut
) throw( RuntimeException
)
1169 sal_uInt32 tmp
= rOut
;
1173 void SAL_CALL
OComponent::testinout_methodHyper(sal_Int64
& rOut
) throw( RuntimeException
)
1175 sal_Int64 tmp
= rOut
;
1180 void SAL_CALL
OComponent::testinout_methodUHyper(sal_uInt64
& rOut
) throw( RuntimeException
)
1182 sal_uInt64 tmp
= rOut
;
1187 void SAL_CALL
OComponent::testinout_methodString(OUString
& rOut
) throw( RuntimeException
)
1189 OUString tmp
= rOut
;
1193 void SAL_CALL
OComponent::testinout_methodChar(sal_Unicode
& rOut
) throw( RuntimeException
)
1195 sal_Unicode tmp
= rOut
;
1199 void SAL_CALL
OComponent::testinout_methodAny(Any
& rOut
) throw( RuntimeException
)
1205 void SAL_CALL
OComponent::testinout_methodType(Type
& rOut
) throw( RuntimeException
)
1213 void SAL_CALL
OComponent::testinout_methodSequence(Sequence
< sal_Int32
>& rOut
) throw( RuntimeException
)
1216 sal_Int32
* arr
= rOut
.getArray();
1217 for ( sal_Int32 i
=0; i
< rOut
.getLength(); i
++)
1219 rOut
.getArray()[i
] += 1;
1222 void SAL_CALL
OComponent::testinout_methodSequence2(Sequence
< Sequence
< sal_Int32
> >& rOut
) throw( RuntimeException
)
1224 for( sal_Int32 i
=0; i
< rOut
.getLength(); i
++)
1226 Sequence
< sal_Int32
>& seq
= rOut
.getArray()[i
];
1228 for ( sal_Int32 j
=0; j
< seq
.getLength(); j
++)
1230 seq
.getArray()[j
] += seq
.getArray()[j
];
1235 // The parameter should implement XInvocation and a Property "value"
1236 void SAL_CALL
OComponent::testinout_methodXInterface( Reference
< XInvocation
>& rOut
) throw(RuntimeException
)
1239 any
= rOut
->getValue( OUString( L
"value"));
1242 OUString
string(L
"out");
1244 rOut
->setValue( OUString(L
"value"), any
);
1246 any
= rOut
->getValue( OUString( L
"value"));
1251 void SAL_CALL
OComponent::testinout_methodXInterface2( Reference
< XInterface
> & rOut
) throw( RuntimeException
)
1253 Reference
<XInterface
> tmp
= rOut
;
1254 rOut
= m_xinterface
;
1256 // Reference<XTestSequence> xTest( rOut, UNO_QUERY);
1259 // Any any= xTest->getAttrAny2();
1262 // OUString string= _s + OUString((L" this string was written in the UNO component to the inout pararmeter"));
1264 // xTest->setAttrAny2( any);
1268 Any SAL_CALL
OComponent::methodAnyTest1(const Any
& rIn
) throw( RuntimeException
)
1272 Any SAL_CALL
OComponent::getAttrAny2(void) throw( RuntimeException
)
1276 void SAL_CALL
OComponent::setAttrAny2(const Any
& AttrAny2_
) throw( RuntimeException
)
1283 // XTestStruct =======================================================================================
1285 void SAL_CALL
OComponent::methodStruct(const Property
& aProp
) throw( RuntimeException
)
1289 sprintf( buff
,"Property::Attribute : %d \n Property::Handle : %d \n Property::Name : %S",
1290 aProp
.Attributes
, aProp
.Handle
, (const sal_Unicode
*)aProp
.Name
);
1291 MessageBox( NULL
, A2T(buff
), _T("OleTest: methodStruct"), MB_OK
);
1294 Property SAL_CALL
OComponent::retMethodStruct(void) throw( RuntimeException
)
1296 Property
a(L
"OleTest_Property", 255, getCppuType( (Reference
<XInterface
>*)0), PropertyAttribute::MAYBEVOID
|
1297 PropertyAttribute::BOUND
| PropertyAttribute::CONSTRAINED
|
1298 PropertyAttribute::TRANSIENT
| PropertyAttribute::READONLY
|
1299 PropertyAttribute::MAYBEAMBIGUOUS
| PropertyAttribute::MAYBEDEFAULT
);
1303 Property SAL_CALL
OComponent::getAttrStruct(void) throw( RuntimeException
)
1305 Property
a(L
"OleTest_Property", 255, getCppuType( (Reference
<XInterface
>*)0), PropertyAttribute::MAYBEVOID
|
1306 PropertyAttribute::BOUND
| PropertyAttribute::CONSTRAINED
|
1307 PropertyAttribute::TRANSIENT
| PropertyAttribute::READONLY
|
1308 PropertyAttribute::MAYBEAMBIGUOUS
| PropertyAttribute::MAYBEDEFAULT
);
1313 void SAL_CALL
OComponent::setAttrStruct(const Property
& AttrStruct_
) throw( RuntimeException
)
1317 sprintf( buff
,"Property::Attribute : %d \n Property::Handle : %d \n Property::Name : %S",
1318 AttrStruct_
.Attributes
, AttrStruct_
.Handle
, (const sal_Unicode
*)AttrStruct_
.Name
);
1319 // MessageBox( NULL, A2T(buff), _T("OleTest: setAttrStruct"), MB_OK);
1322 Property SAL_CALL
OComponent::methodStruct2( const Property
& aProp
) throw (RuntimeException
)
1327 // XTestOther ==================================================================================
1328 void SAL_CALL
OComponent::other_methodAnyIn(const Any
& ) throw( RuntimeException
)
1331 void SAL_CALL
OComponent::other_methodAnyOut(Any
& rAny
) throw( RuntimeException
)
1333 rAny
<<= OUString(L
"Ein Any");
1336 Any SAL_CALL
OComponent::other_methodAnyRet(void) throw(RuntimeException
)
1339 a
<<= OUString(L
"Ein Any");
1342 void SAL_CALL
OComponent::in_float( float val
) throw ( RuntimeException
)
1346 sprintf( buff
, "parameter : %f", val
);
1347 MessageBox( NULL
, A2T(buff
), _T("OleTest"), MB_OK
);
1349 Any SAL_CALL
OComponent::other_methodAny( const Any
& rAny
, const OUString
& typeInAny
)
1350 throw (RuntimeException
)
1353 typelib_TypeDescription
* pDesc
= NULL
;
1354 typelib_typedescription_getByName( &pDesc
, typeInAny
.pData
);
1357 expectedType
= Type( pDesc
->pWeakRef
);
1358 typelib_typedescription_release( pDesc
);
1360 if (rAny
.getValueType() != expectedType
)
1361 throw RuntimeException();
1366 // XTestOutParameters ============================================================================
1367 // void SAL_CALL OComponent::out_test(sal_Int8 rIn) throw( RuntimeException )
1371 // void SAL_CALL OComponent::out_methodByte(sal_Int8& rOut) throw( RuntimeException )
1376 // void SAL_CALL OComponent::out_methodDouble(double& rOut) throw( RuntimeException )
1380 // void SAL_CALL OComponent::out_methodFloat(float& rOut) throw( RuntimeException )
1384 // void SAL_CALL OComponent::out_methodBool(sal_Bool& rOut) throw( RuntimeException )
1388 // void SAL_CALL OComponent::out_methodShort(sal_Int16& rOut) throw( RuntimeException )
1392 // void SAL_CALL OComponent::out_methodUShort(sal_uInt16& rOut) throw( RuntimeException )
1396 // void SAL_CALL OComponent::out_methodLong(sal_Int32& rOut) throw( RuntimeException )
1401 // void SAL_CALL OComponent::out_methodULong(sal_uInt32& rOut) throw( RuntimeException )
1405 // void SAL_CALL OComponent::out_methodHyper(sal_Int64& rOut) throw( RuntimeException )
1410 // void SAL_CALL OComponent::out_methodUHyper(sal_uInt64& rOut) throw( RuntimeException )
1414 // void SAL_CALL OComponent::out_methodString(OUString& rOut) throw( RuntimeException )
1416 // rOut= L"I'm a string";
1418 // void SAL_CALL OComponent::out_methodChar(sal_Unicode& rOut) throw( RuntimeException )
1422 // void SAL_CALL OComponent::out_methodAny(Any& rOut) throw( RuntimeException)
1425 // a <<= OUString( L"Hi");
1428 // void SAL_CALL OComponent::out_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException )
1430 // Sequence< sal_Int32 > aseq(10);
1431 // for( sal_Int16 i= 0; i < aseq.getLength(); i++) aseq.getArray()[i]= i;
1434 // void SAL_CALL OComponent::out_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException )
1436 // rOut= Sequence< Sequence< sal_Int32 > >();
1438 // void SAL_CALL OComponent::out_methodMulParams1(sal_Int32& rout1, sal_Int32& rout2) throw( RuntimeException )
1443 // void SAL_CALL OComponent::out_methodMulParams2(sal_Int32& rout1, sal_Int32& rout2, OUString& rout3) throw( RuntimeException )
1447 // rout3= L"this is a neet little string";
1449 // void SAL_CALL OComponent::out_methodMulParams3(const OUString& sin, OUString& sout) throw( RuntimeException )
1451 // sout= L"this is a neet little string";
1454 // XTestInterfaces -------------------------------------------------------------------------------------
1455 void SAL_CALL
OComponent::testInterface( const Reference
< XCallback
>& xCallback
, sal_Int32 mode
) throw(RuntimeException
)
1462 Reference
<XSimple
> xSimple
;
1463 SimpleStruct aSimpleStruct
;
1464 SimpleEnum aSimpleEnum
;
1465 Sequence
<Any
> seqAny
;
1466 Sequence
< sal_Int8
> seqByte
;
1475 // sal_uInt16 aUShort;
1476 // sal_uInt32 aULong;
1481 xCallback
->func1(); break;
1483 xSimple
= xCallback
->returnInterface();
1484 xSimple
->func(L
"XCallback::returnInterface");
1489 xCallback
->outInterface( xSimple
);
1490 sprintf( buff
, "XCallback::outInterface, value: %x", xSimple
.get());
1491 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1492 xSimple
->func(L
"XCallback::outInterface works");
1495 xCallback
->outStruct( aSimpleStruct
);
1496 sprintf( buff
,"XCallback::outStruct, SimpleStruct::message: %s", OLE2A( aSimpleStruct
.message
));
1497 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1500 xCallback
->outEnum( aSimpleEnum
);
1501 sprintf( buff
,"XCallback::outEnum, SimpleEnum: %d", aSimpleEnum
);
1502 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1505 xCallback
->outSeqAny( seqAny
);
1506 sprintf( buff
,"XCallback::outSeqAny, length: %d )", seqAny
.getLength());
1507 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1508 for( i
=0; i
< seqAny
.getLength(); i
++)
1511 if( any
.getValueTypeClass() == TypeClass_STRING
)
1514 OutputDebugStringW( aString
);
1520 xCallback
->outAny( outAny
);
1521 if( outAny
.getValueTypeClass() == TypeClass_STRING
)
1523 sprintf( buff
,"XCallback::outAny, Any : %s", W2A( aString
));
1524 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1527 xCallback
->outBool( aBool
);
1528 sprintf( buff
,"XCallback::outBool, value: %d", aBool
);
1529 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1532 xCallback
->outChar( aChar
);
1533 sprintf( buff
,"XCallback::outChar, value: %C", aChar
);
1534 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1537 xCallback
->outString( aString
);
1538 sprintf( buff
,"XCallback::outString, value: %s", W2A( aString
));
1539 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1542 xCallback
->outFloat( aFloat
);
1543 sprintf( buff
,"XCallback::outFloat, value: %f", aFloat
);
1544 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1547 xCallback
->outDouble( aDouble
);
1548 sprintf( buff
,"XCallback::outDouble, value: %f", aDouble
);
1549 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1552 xCallback
->outByte( aByte
);
1553 sprintf( buff
,"XCallback::outByte, value: %d", aByte
);
1554 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1557 xCallback
->outShort( aShort
);
1558 sprintf( buff
,"XCallback::outShort, value: %d", aShort
);
1559 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1562 xCallback
->outLong( aLong
);
1563 sprintf( buff
,"XCallback::outLong, value: %d", aLong
);
1564 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1572 xCallback
->outValuesMixed( 1111, outLong
, OUString( L
"in string") );
1574 sprintf( buff
, "oletest.testInterface: outValue: %d", outLong
);
1575 MessageBox( NULL
, A2T(buff
), _T("OleTest"), MB_OK
);
1581 Reference
< XSimple
> xSimple
;
1582 SimpleStruct aSimpleStruct
;
1583 SimpleEnum aSimpleEnum
;
1584 Sequence
<Any
> seqAny
;
1594 // sal_uInt16 aUShort;
1595 // sal_uInt32 aULong;
1596 xCallback
->outValuesAll( xSimple
, aSimpleStruct
, aSimpleEnum
, seqAny
, aAny
, aBool
,
1602 MessageBox( NULL
, _T("XCallback::outValuesAll returned"), _T("OleTest::testInterface"), MB_OK
);
1608 xCallback
->outSeqByte( seqByte
);
1609 sprintf( buff
,"XCallback::outSeqAny, length: %d )", seqAny
.getLength());
1610 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1611 for( i
=0; i
< seqAny
.getLength(); i
++)
1614 if( any
.getValueTypeClass() == TypeClass_STRING
)
1617 OutputDebugStringW( aString
);
1622 // ############################################################################
1624 // ############################################################################
1627 Reference
<XSimple
> xSimple
= static_cast<XSimple
*>(this);
1628 xCallback
->inoutInterface( xSimple
);
1629 xSimple
->func(L
"XSimple called from OleTest");
1634 Reference
<XIdlReflection
> xRefl( m_rFactory
->createInstance(L
"com.sun.star.reflection.CoreReflection"), UNO_QUERY
);
1637 Reference
<XIdlClass
> xClass
= xRefl
->forName(L
"oletest.SimpleStruct");
1640 xClass
->createObject( any
);
1642 if( any
.getValueTypeClass() == TypeClass_STRUCT
)
1644 SimpleStruct
* pStruct
= ( SimpleStruct
*) any
.getValue();
1645 pStruct
->message
= OUString::createFromAscii("This struct was created in OleTest");
1647 SimpleStruct aStruct
;
1649 xCallback
->inoutStruct( aStruct
);
1650 // a Struct should now contain a different message
1651 MessageBox( NULL
, W2T(aStruct
.message
), _T("OleTest in out parameter"), MB_OK
);
1659 SimpleEnum aEnum
= SimpleEnum_B
;
1660 xCallback
->inoutEnum( aEnum
);
1662 sprintf( buff
, "Enum: %d", aEnum
);
1663 MessageBox( NULL
, A2T(buff
), _T("OleTest in out parameter"), MB_OK
);
1669 arAny
[0] <<= OUString( L
"string 0");
1670 arAny
[1] <<= OUString( L
"string 1");
1671 arAny
[2] <<= OUString( L
"string 2");
1673 Sequence
< Any
>seqAny( arAny
, 3);
1674 xCallback
->inoutSeqAny( seqAny
);
1676 sprintf( buff
, "Sequence length: %d", seqAny
.getLength());
1677 MessageBox( NULL
,A2T(buff
) , _T("OleTest in out parameter"), MB_OK
);
1679 for( int i
=0; i
< seqAny
.getLength(); i
++)
1683 if(any
.getValueTypeClass() == TypeClass_STRING
)
1696 OUString
s(L
" OleTest");
1698 xCallback
->inoutAny(any
);
1699 if( any
.getValueTypeClass() == TypeClass_STRING
)
1701 OUString s
= *( rtl_uString
**) any
.getValue();
1702 MessageBox( NULL
, W2T( s
), _T("OleTest: inout value any"), MB_OK
);
1708 sal_Bool b
= sal_True
;
1709 xCallback
->inoutBool( b
);
1711 sprintf( buff
, "out value bool: %d", b
);
1712 MessageBox( NULL
, A2T( buff
), _T("OleTest in out parameter"), MB_OK
);
1717 sal_Unicode uc
= L
'A';
1718 xCallback
->inoutChar( uc
);
1720 sprintf( buff
, "out value sal_Unicode: %C", uc
);
1721 MessageBox( NULL
, A2T( buff
), _T("OleTest in out parameter"), MB_OK
);
1726 OUString
s(L
"OleTest");
1727 xCallback
->inoutString( s
);
1729 sprintf( buff
, "out value string: %S", s
.getStr());
1730 MessageBox( NULL
, A2T( buff
), _T("OleTest in out parameter"), MB_OK
);
1736 xCallback
->inoutFloat(f
);
1738 sprintf( buff
, "out value float: %f", f
);
1739 MessageBox( NULL
, A2T( buff
), _T("OleTest in out parameter"), MB_OK
);
1745 xCallback
->inoutDouble( f
);
1747 sprintf( buff
, "out value double: %g", f
);
1748 MessageBox( NULL
, A2T( buff
), _T("OleTest in out parameter"), MB_OK
);
1753 sal_Int8 aByte
= 0xf;
1754 xCallback
->inoutByte( aByte
);
1756 sprintf( buff
, "out value sal_Int8: %d", aByte
);
1757 MessageBox( NULL
, A2T( buff
), _T("OleTest in out parameter"), MB_OK
);
1762 sal_Int16 aShort
= 0xff;
1763 xCallback
->inoutShort( aShort
);
1765 sprintf( buff
, "out value sal_Int16: %d", aShort
);
1766 MessageBox( NULL
, A2T( buff
), _T("OleTest in out parameter"), MB_OK
);
1771 sal_Int32 aLong
= 0xfffe;
1772 xCallback
->inoutLong( aLong
);
1774 sprintf( buff
, "out value sal_Int32: %d", aLong
);
1775 MessageBox( NULL
, A2T( buff
), _T("OleTest in out parameter"), MB_OK
);
1780 Reference
<XSimple
> aXSimple
= static_cast<XSimple
*>(this);
1782 SimpleStruct aStruct
;
1783 Reference
<XIdlReflection
> xRefl( m_rFactory
->createInstance(L
"com.sun.star.reflection.CoreReflection"), UNO_QUERY
);
1786 Reference
<XIdlClass
> xClass
= xRefl
->forName(L
"oletest.SimpleStruct");
1789 xClass
->createObject( any
);
1791 if( any
.getValueTypeClass() == TypeClass_STRUCT
)
1793 SimpleStruct
* pStruct
= ( SimpleStruct
*) any
.getValue();
1794 pStruct
->message
= OUString::createFromAscii("This struct was created in OleTest");
1799 SimpleEnum aEnum
= SimpleEnum_B
;
1801 Sequence
< Any
> aSeq
;
1803 arAny
[0] <<= OUString( L
"string 0");
1804 arAny
[1] <<= OUString( L
"string 1");
1805 arAny
[2] <<= OUString( L
"string 2");
1806 aSeq
= Sequence
< Any
>( arAny
, 3);
1809 OUString
s(L
" OleTest");
1812 sal_Bool aBool
= sal_True
;
1813 sal_Unicode aChar
= L
'A';
1814 OUString
aString( L
"OleTest");
1816 double aDouble
= 3.145;
1817 sal_Int8 aByte
= 0xf;
1818 sal_Int16 aShort
= 0xff;
1819 sal_Int32 aLong
= 0xffe;
1821 xCallback
->inoutValuesAll( aXSimple
, aStruct
, aEnum
, aSeq
,
1822 aAny
, aBool
, aChar
, aString
, aFloat
, aDouble
,
1823 aByte
, aShort
, aLong
);
1825 aXSimple
->func(L
"XSimple called from OleTest");
1826 MessageBox( NULL
, W2T(aStruct
.message
), _T("OleTest"), MB_OK
);
1828 for( int i
=0; i
< aSeq
.getLength(); i
++)
1832 if(any
.getValueTypeClass() == TypeClass_STRING
)
1842 // ############################################################################
1844 // ############################################################################
1848 xCallback
->inValues( L
'a', 0xffffL
, OUString(L
" a string from OleTest"));
1852 sal_Int8 arbyte
[3]= { 1,2,3};
1853 Sequence
< sal_Int8
> seq( arbyte
, 3);
1854 xCallback
->inSeqByte( seq
);
1859 const int LISTENERS
= 3;
1860 Reference
<XEventListener
> arListeners
[LISTENERS
];
1861 EventObject arEvents
[LISTENERS
];
1863 for( int i
= 0; i
< LISTENERS
; i
++)
1865 Reference
<XInterface
> aList
= static_cast<XWeak
*>( new EventListener());
1866 arListeners
[i
]= Reference
<XEventListener
>( aList
, UNO_QUERY
);
1869 xCallback
->inSeqXEventListener(Sequence
<Reference
<XEventListener
> > (arListeners
, LISTENERS
),
1870 Sequence
<EventObject
>(arEvents
, LISTENERS
));
1874 // ############################################################################
1875 // Call a COM object that has not been passed as parameter to a UNO component and
1876 // hence no type information are available in the COM wrapper
1877 // ############################################################################
1880 Reference
<XInterface
> xIntFact
= m_rFactory
->createInstance(L
"com.sun.star.bridge.oleautomation.Factory");
1882 Reference
<XMultiServiceFactory
> oleFact(xIntFact
, UNO_QUERY
);
1884 Reference
<XInterface
> xIntCallback
= oleFact
->createInstance(L
"XCallback_Impl.Callback");
1885 Reference
<XInvocation
> xInv( xIntCallback
, UNO_QUERY
);
1886 //Any SAL_CALL invoke( const OUString& aFunctionName, const Sequence<Any >& aParams,Sequence< sal_Int16 >& aOutParamIndex,
1887 // Sequence<Any >& aOutParam );
1888 Sequence
<sal_Int16
> seqIndizes
;
1889 Sequence
<Any
> seqOutParams
;
1890 xInv
->invoke( OUString( L
"outValuesAll"), Sequence
<Any
>(), seqIndizes
, seqOutParams
);
1892 // void outValuesAll( [out] oletest::XSimple outInterface,
1893 // [out] SimpleStruct outStruct ,
1894 // [out] SimpleEnum outEnum,
1895 // [out] sequence<any> outSeqAny,
1896 // [out] any outAny,
1897 // [out] boolean outBool,
1898 // [out] char outChar,
1899 // [out] string outString,
1900 // [out] float outFloat,
1901 // [out] double outDouble,
1902 // [out] byte outByte,
1903 // [out] short outShort,
1904 // [out] long outLong);
1905 if( seqOutParams
.getLength() == 12)
1907 Reference
<XSimple
> xSimple
= *(XSimple
**)seqOutParams
[0].getValue();
1908 xSimple
->func( L
"Call from OleTest on XSimple");
1909 SimpleStruct aStruct
;
1910 seqOutParams
[1] >>= aStruct
;
1911 SimpleEnum aEnum
= *(SimpleEnum
*)seqOutParams
[2].getValue();
1913 Sequence
<Any
> seqAny
;
1914 seqOutParams
[3] >>= seqAny
;
1915 for( int i
=0; i
<seqAny
.getLength(); i
++)
1921 Any _any
= *(Any
*)seqOutParams
[4].getValue();
1922 sal_Bool _bool
= *(sal_Bool
*)seqOutParams
[5].getValue();
1923 sal_Unicode _char
= *( sal_Unicode
*) seqOutParams
[6].getValue();
1924 OUString _str
= *( rtl_uString
**)seqOutParams
[7].getValue();
1926 float _f
= *( float*)seqOutParams
[8].getValue();
1927 double _d
= *( double*) seqOutParams
[9].getValue();
1928 sal_Int8 _byte
= *( sal_Int8
*) seqOutParams
[10].getValue();
1929 sal_Int16 _short
= *( sal_Int16
*) seqOutParams
[11].getValue();
1931 sal_Int32 _long
= *( sal_Int32
*) seqOutParams
[12].getValue();
1937 // in / out parameter
1939 Reference
<XInterface
> xIntFact
= m_rFactory
->createInstance(L
"com.sun.star.bridge.oleautomation.Factory");
1941 Reference
<XMultiServiceFactory
> oleFact(xIntFact
, UNO_QUERY
);
1943 Reference
<XInterface
> xIntCallback
= oleFact
->createInstance(L
"XCallback_Impl.Callback");
1944 Reference
<XInvocation
> xInv( xIntCallback
, UNO_QUERY
);
1945 Sequence
<sal_Int16
> seqIndizes
;
1946 Sequence
<Any
> seqOutParams
;
1950 Reference
<XSimple
> xSimple
= static_cast<XSimple
*>( this);
1952 arAny
[0] <<= xSimple
;
1953 SimpleStruct aStruct
;
1954 Reference
<XIdlReflection
> xRefl( m_rFactory
->createInstance(L
"com.sun.star.reflection.CoreReflection"), UNO_QUERY
);
1957 Reference
<XIdlClass
> xClass
= xRefl
->forName(L
"oletest.SimpleStruct");
1960 xClass
->createObject( any
);
1962 if( any
.getValueTypeClass() == TypeClass_STRUCT
)
1964 SimpleStruct
* pStruct
= ( SimpleStruct
*) any
.getValue();
1965 pStruct
->message
= OUString::createFromAscii("This struct was created in OleTest");
1969 arAny
[1] <<= aStruct
;
1970 arAny
[2] <<= SimpleEnum_C
;
1973 arSeqAny
[0] <<= OUString( L
"string 0");
1974 arSeqAny
[1] <<= OUString( L
"string 1");
1975 arSeqAny
[2] <<= OUString( L
"string 2");
1977 arAny
[3] <<= Sequence
< Any
>( arAny
, 3);
1979 OUString
str(L
" Ein Any param");
1981 arAny
[5] <<= sal_False
;
1983 OUString
stringParam(L
" a string parameter");
1984 arAny
[7] <<= stringParam
;
1985 float _float
= 3.14f
;
1986 arAny
[8] <<= _float
;
1987 double _double
= 3.145;
1988 arAny
[9] <<= _double
;
1990 arAny
[10] <<= _byte
;
1991 sal_Int16 _short
= -1;
1992 arAny
[11] <<= _short
;
1993 sal_Int32 _long
= -1;
1994 arAny
[12] <<= _long
;
1996 Sequence
<Any
> params( arAny
, 13);
1998 xInv
->invoke( OUString( L
"inoutValuesAll"), params
, seqIndizes
, seqOutParams
);
2000 if( seqOutParams
.getLength() == 12)
2002 Reference
<XSimple
> xSimple
= *(XSimple
**)seqOutParams
[0].getValue();
2003 xSimple
->func( L
"Call from OleTest on XSimple");
2004 SimpleStruct aStruct
;
2005 seqOutParams
[1] >>= aStruct
;
2006 SimpleEnum aEnum
= *(SimpleEnum
*)seqOutParams
[2].getValue();
2008 Sequence
<Any
> seqAny
;
2009 seqOutParams
[3] >>= seqAny
;
2010 for( int i
=0; i
<seqAny
.getLength(); i
++)
2016 Any _any
= *(Any
*)seqOutParams
[4].getValue();
2017 sal_Bool _bool
= *(sal_Bool
*)seqOutParams
[5].getValue();
2018 sal_Unicode _char
= *( sal_Unicode
*) seqOutParams
[6].getValue();
2019 OUString _str
= *( rtl_uString
**)seqOutParams
[7].getValue();
2021 float _f
= *( float*)seqOutParams
[8].getValue();
2022 double _d
= *( double*) seqOutParams
[9].getValue();
2023 sal_Int8 _byte
= *( sal_Int8
*) seqOutParams
[10].getValue();
2024 sal_Int16 _short
= *( sal_Int16
*) seqOutParams
[11].getValue();
2026 sal_Int32 _long
= *( sal_Int32
*) seqOutParams
[12].getValue();
2033 // void inValues( [in] char aChar, [in] long aLong, [in] string aString);
2035 Reference
<XInterface
> xIntFact
= m_rFactory
->createInstance(
2036 L
"com.sun.star.bridge.oleautomation.Factory");
2038 Reference
<XMultiServiceFactory
> oleFact(xIntFact
, UNO_QUERY
);
2040 Reference
<XInterface
> xIntCallback
= oleFact
->createInstance(L
"XCallback_Impl.Callback");
2041 Reference
<XInvocation
> xInv( xIntCallback
, UNO_QUERY
);
2042 Sequence
<sal_Int16
> seqIndizes
;
2043 Sequence
<Any
> seqOutParams
;
2046 sal_Unicode aChar
=L
'a';
2048 sal_Int32 aLong
= 0xffffffff;
2050 OUString
aString(L
" a string parameter");
2051 arAny
[2] <<= aString
;
2053 xInv
->invoke( OUString( L
"inValues"), Sequence
<Any
>(arAny
,3), seqIndizes
, seqOutParams
);
2057 // ############################################################################
2059 // ############################################################################
2062 Reference
<XSimple
> simple
= xCallback
->getsimple();
2063 simple
->func(L
"OleTest calls on XSimple");
2073 void SAL_CALL
OComponent::setObject( const Reference
< XInterface
>& val
) throw (RuntimeException
)
2075 m_xIntIdentity
= val
;
2078 sal_Bool SAL_CALL
OComponent::isSame( const Reference
< XInterface
>& val
) throw (RuntimeException
)
2080 if( m_xIntIdentity
== val
)
2086 Reference
< XInterface
> SAL_CALL
OComponent::getThis( ) throw (RuntimeException
)
2088 // return Reference<XInterface>(static_cast<XIdentity*>(this), UNO_QUERY);
2089 Reference
<XInterface
> ret(static_cast<XIdentity
*>(this), UNO_QUERY
);
2093 void SAL_CALL
EventListener::disposing( const ::com::sun::star::lang::EventObject
& ) throw (RuntimeException
)
2098 // XSimple --------------------------------------------------------------------------
2099 void SAL_CALL
OComponent::func( const OUString
&message
)throw(::com::sun::star::uno::RuntimeException
)
2103 MessageBox( NULL
, W2T( message
.getStr()), _T("OleTest: XSimple::func"), MB_OK
);
2105 // XSimple --------------------------------------------------------------------------
2106 OUString SAL_CALL
OComponent::getName()throw(::com::sun::star::uno::RuntimeException
)
2110 void SAL_CALL
OComponent::testInterface2( const Reference
< XSimple
>& xSimple
, sal_Int32 mode
) throw(RuntimeException
)
2116 xSimple
->func( L
"OleTest is calling XSimple");
2117 Reference
<XSimple2
> xSimple2( xSimple
, UNO_QUERY
);
2119 xSimple2
->func2( L
"OleTest is calling XSimple2");
2120 Reference
<XSimple3
> xSimple3( xSimple
, UNO_QUERY
);
2122 xSimple3
->func3( L
"OleTest is calling XSimple3");