1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_extensions.hxx"
33 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
34 #include <com/sun/star/registry/XRegistryKey.hpp>
35 #include <osl/diagnose.h>
36 #include <uno/environment.h>
37 #include <cppuhelper/factory.hxx>
38 // OPTIONAL is a constant in com.sun.star.beans.PropertyAttributes but it must be
39 // undef'd in some header files
40 #define OPTIONAL OPTIONAL
41 #include <com/sun/star/beans/PropertyAttribute.hpp>
42 #include <com/sun/star/script/XInvocation.hpp>
43 #include <com/sun/star/reflection/XIdlReflection.hpp>
44 #include <com/sun/star/lang/XEventListener.hpp>
46 #include <cppuhelper/implbase7.hxx>
47 #include <cppuhelper/implbase1.hxx>
48 #include <com/sun/star/uno/Reference.h>
49 #include <rtl/ustring.h>
50 #include <com/sun/star/uno/Reference.hxx>
51 #include <oletest/XTestSequence.hpp>
52 #include <oletest/XTestStruct.hpp>
53 #include <oletest/XTestOther.hpp>
54 #include <oletest/XTestInterfaces.hpp>
55 #include <oletest/XSimple.hpp>
56 #include <oletest/XSimple2.hpp>
57 #include <oletest/XSimple3.hpp>
58 #include <oletest/XTestInParameters.hpp>
59 //#include <oletest/XTestOutParameters.hpp>
60 #include <oletest/XIdentity.hpp>
61 #include <com/sun/star/beans/Property.hpp>
64 using namespace oletest
;
66 using namespace com::sun::star::uno
;
67 using namespace com::sun::star::lang
;
68 using namespace com::sun::star::beans
;
69 using namespace com::sun::star::registry
;
70 using namespace com::sun::star::script
;
71 using namespace com::sun::star::reflection
;
74 #define IMPL_NAME L"oletest.OleTestImpl" // oletest.OleTestImpl in applicat.rdb
75 #define SERVICE_NAME L"oletest.OleTest"
76 #define KEY1 L"/oletest.OleTestImpl/UNO/SERVICES"
77 #define KEY2 L"oletest.OleTest"
79 class OComponent
: public WeakImplHelper7
<
80 XTestSequence
, XTestStruct
, XTestOther
, XTestInterfaces
,
81 XSimple
, XTestInParameters
, XIdentity
>
83 Reference
<XInterface
> m_xIntIdentity
;
84 sal_Int32 m_arrayConstructor
;
85 Reference
<XMultiServiceFactory
> m_rFactory
;
87 Sequence
<sal_Int8
> m_seqByte
;
88 Sequence
<float> m_seqFloat
;
89 Sequence
<double> m_seqDouble
;
90 Sequence
<sal_Bool
> m_seqBool
;
91 Sequence
<sal_Int16
> m_seqShort
;
92 Sequence
<sal_uInt16
> m_seqUShort
;
93 Sequence
<sal_Int32
> m_seqLong
;
94 Sequence
<sal_uInt32
> m_seqULong
;
95 Sequence
<sal_Unicode
> m_seqChar
;
96 Sequence
<OUString
> m_seqString
;
97 Sequence
<Any
> m_seqAny
;
98 Sequence
<Type
> m_seqType
;
99 Sequence
<Sequence
< sal_Int32
> > m_seq1
;
100 Sequence
<Sequence
< Sequence
< sal_Int32
> > > m_seq2
;
103 Sequence
<Reference
< XInterface
> > m_seqxInterface
;
118 Reference
<XInterface
> m_xinterface
;
120 sal_Int8 m_attr_int8
;
121 sal_uInt8 m_attr_uint8
;
122 sal_Int16 m_attr_int16
;
123 sal_uInt16 m_attr_uint16
;
124 sal_Int32 m_attr_int32
;
125 sal_uInt32 m_attr_uint32
;
126 sal_Int64 m_attr_int64
;
127 sal_uInt64 m_attr_uint64
;
129 double m_attr_double
;
130 OUString m_attr_string
;
131 sal_Unicode m_attr_char
;
132 sal_Bool m_attr_bool
;
135 Reference
<XInterface
> m_attr_xinterface
;
136 Reference
<XInvocation
> m_attr_xinvocation
;
139 OComponent( const Reference
<XMultiServiceFactory
> & rFactory
) :
140 m_rFactory( rFactory
), m_arrayConstructor(0) {}
142 public: // XTestSequence
143 virtual Sequence
<sal_Int8
> SAL_CALL
methodByte(const Sequence
< sal_Int8
>& aSeq
) throw( RuntimeException
);
144 virtual Sequence
<float> SAL_CALL
methodFloat(const Sequence
< float >& aSeq
) throw( RuntimeException
);
145 virtual Sequence
< double > SAL_CALL
methodDouble(const Sequence
< double >& aSeq
) throw( RuntimeException
);
146 virtual Sequence
< sal_Bool
> SAL_CALL
methodBool(const Sequence
< sal_Bool
>& aSeq
) throw( RuntimeException
);
147 virtual Sequence
< sal_Int16
> SAL_CALL
methodShort(const Sequence
< sal_Int16
>& aSeq
) throw( RuntimeException
);
148 virtual Sequence
< sal_uInt16
> SAL_CALL
methodUShort(const Sequence
< sal_uInt16
>& aSeq
) throw( RuntimeException
);
149 virtual Sequence
< sal_Int32
> SAL_CALL
methodLong(const Sequence
< sal_Int32
>& aSeq
) throw( RuntimeException
) ;
150 virtual Sequence
< sal_uInt32
> SAL_CALL
methodULong(const Sequence
< sal_uInt32
>& aSeq
) throw( RuntimeException
);
151 virtual Sequence
< OUString
> SAL_CALL
methodString(const Sequence
< OUString
>& aSeq
) throw( RuntimeException
);
152 virtual Sequence
< sal_Unicode
> SAL_CALL
methodChar(const Sequence
< sal_Unicode
>& aSeq
) throw( RuntimeException
);
153 virtual Sequence
< Any
> SAL_CALL
methodAny(const Sequence
< Any
>& aSeq
) throw( RuntimeException
);
154 virtual Sequence
< Type
> SAL_CALL
methodType(const Sequence
< Type
>& aSeq
) throw( RuntimeException
);
155 virtual Sequence
< Reference
< XInterface
> > SAL_CALL
methodXInterface( const Sequence
< Reference
< XInterface
> >& aSeq
) throw(RuntimeException
) ;
156 virtual Sequence
< Sequence
< sal_Int32
> > SAL_CALL
methodSequence(const Sequence
< Sequence
< sal_Int32
> >& aSeq
) throw( RuntimeException
);
157 virtual Sequence
< Sequence
< Sequence
< sal_Int32
> > > SAL_CALL
methodSequence2(const Sequence
< Sequence
< Sequence
< sal_Int32
> > >& aSeq
) throw( RuntimeException
);
158 virtual Sequence
< Reference
<XEventListener
> > SAL_CALL
methodXEventListeners( const Sequence
<Reference
<XEventListener
> >& aSeq
) throw( RuntimeException
);
159 virtual Sequence
< Sequence
<Reference
<XEventListener
> > > SAL_CALL
methodXEventListenersMul( const Sequence
<Sequence
<Reference
<XEventListener
> > >& aSeq
) throw (RuntimeException
);
161 virtual Sequence
< sal_Int8
> SAL_CALL
getAttrByte(void) throw( RuntimeException
);
162 virtual void SAL_CALL
setAttrByte(const Sequence
< sal_Int8
>& AttrByte_
) throw( RuntimeException
);
163 virtual Sequence
< float > SAL_CALL
getAttrFloat(void) throw( RuntimeException
) ;
164 virtual void SAL_CALL
setAttrFloat(const Sequence
< float >& AttrFloat_
) throw( RuntimeException
);
165 virtual Sequence
< double > SAL_CALL
getAttrDouble(void) throw( RuntimeException
) ;
166 virtual void SAL_CALL
setAttrDouble(const Sequence
< double >& AttrDouble_
) throw( RuntimeException
);
167 virtual Sequence
< sal_Bool
> SAL_CALL
getAttrBool(void) throw( RuntimeException
);
168 virtual void SAL_CALL
setAttrBool(const Sequence
< sal_Bool
>& AttrBool_
) throw( RuntimeException
);
169 virtual Sequence
< sal_Int16
> SAL_CALL
getAttrShort(void) throw( RuntimeException
);
170 virtual void SAL_CALL
setAttrShort(const Sequence
< sal_Int16
>& AttrShort_
) throw( RuntimeException
);
171 virtual Sequence
< sal_uInt16
> SAL_CALL
getAttrUShort(void) throw( RuntimeException
);
172 virtual void SAL_CALL
setAttrUShort(const Sequence
< sal_uInt16
>& AttrUShort_
) throw( RuntimeException
);
173 virtual Sequence
< sal_Int32
> SAL_CALL
getAttrLong(void) throw( RuntimeException
);
174 virtual void SAL_CALL
setAttrLong(const Sequence
< sal_Int32
>& AttrLong_
) throw( RuntimeException
);
175 virtual Sequence
< sal_uInt32
> SAL_CALL
getAttrULong(void) throw( RuntimeException
);
176 virtual void SAL_CALL
setAttrULong(const Sequence
< sal_uInt32
>& AttrULong_
) throw( RuntimeException
);
177 virtual Sequence
< OUString
> SAL_CALL
getAttrString(void) throw(RuntimeException
);
178 virtual void SAL_CALL
setAttrString(const Sequence
< OUString
>& AttrString_
) throw( RuntimeException
);
179 virtual Sequence
< sal_Unicode
> SAL_CALL
getAttrChar(void) throw( RuntimeException
);
180 virtual void SAL_CALL
setAttrChar(const Sequence
< sal_Unicode
>& AttrChar_
) throw( RuntimeException
);
181 virtual Sequence
< Any
> SAL_CALL
getAttrAny(void) throw( RuntimeException
);
182 virtual void SAL_CALL
setAttrAny(const Sequence
< Any
>& AttrAny_
) throw( RuntimeException
);
183 virtual Sequence
< Type
> SAL_CALL
getAttrType(void) throw( RuntimeException
);
184 virtual void SAL_CALL
setAttrType( const Sequence
< Type
>& _attrtype
) throw (RuntimeException
);
185 virtual Sequence
< Sequence
< sal_Int32
> > SAL_CALL
getAttrSequence(void) throw( RuntimeException
);
186 virtual void SAL_CALL
setAttrSequence(const Sequence
< Sequence
< sal_Int32
> >& AttrSequence_
) throw( RuntimeException
);
187 virtual Sequence
< Sequence
< Sequence
< sal_Int32
> > > SAL_CALL
getAttrSequence2(void) throw( RuntimeException
);
188 virtual void SAL_CALL
setAttrSequence2(const Sequence
< Sequence
< Sequence
< sal_Int32
> > >& AttrSequence2_
) throw ( RuntimeException
);
189 virtual Sequence
< Reference
< XInterface
> > SAL_CALL
getAttrXInterface() throw(RuntimeException
);
190 virtual void SAL_CALL
setAttrXInterface( const Sequence
< Reference
< XInterface
> >& _attrxinterface
) throw(RuntimeException
);
192 virtual ::sal_Int8 SAL_CALL
getAByte() throw (RuntimeException
);
193 virtual void SAL_CALL
setAByte( ::sal_Int8 _abyte
) throw (RuntimeException
);
194 virtual float SAL_CALL
getAFloat() throw (RuntimeException
);
195 virtual void SAL_CALL
setAFloat( float _afloat
) throw (RuntimeException
);
196 virtual double SAL_CALL
getADouble() throw (RuntimeException
);
197 virtual void SAL_CALL
setADouble( double _adouble
) throw (RuntimeException
);
198 virtual ::sal_Bool SAL_CALL
getABool() throw (RuntimeException
);
199 virtual void SAL_CALL
setABool( ::sal_Bool _abool
) throw (RuntimeException
);
200 virtual ::sal_Int16 SAL_CALL
getAShort() throw (RuntimeException
);
201 virtual void SAL_CALL
setAShort( ::sal_Int16 _ashort
) throw (RuntimeException
);
202 virtual ::sal_uInt16 SAL_CALL
getAUShort() throw (RuntimeException
);
203 virtual void SAL_CALL
setAUShort( ::sal_uInt16 _aushort
) throw (RuntimeException
);
204 virtual ::sal_Int32 SAL_CALL
getALong() throw (RuntimeException
);
205 virtual void SAL_CALL
setALong( ::sal_Int32 _along
) throw (RuntimeException
);
206 virtual ::sal_uInt32 SAL_CALL
getAULong() throw (RuntimeException
);
207 virtual void SAL_CALL
setAULong( ::sal_uInt32 _aulong
) throw (RuntimeException
);
208 virtual ::rtl::OUString SAL_CALL
getAString() throw (RuntimeException
);
209 virtual void SAL_CALL
setAString( const ::rtl::OUString
& _astring
) throw (RuntimeException
);
210 virtual ::sal_Unicode SAL_CALL
getAChar() throw (RuntimeException
);
211 virtual void SAL_CALL
setAChar( ::sal_Unicode _achar
) throw (RuntimeException
);
212 virtual Any SAL_CALL
getAAny() throw (RuntimeException
);
213 virtual void SAL_CALL
setAAny( const Any
& _aany
) throw (RuntimeException
);
214 virtual Type SAL_CALL
getAType() throw (RuntimeException
);
215 virtual void SAL_CALL
setAType( const Type
& _atype
) throw (RuntimeException
);
216 virtual Reference
< XInterface
> SAL_CALL
getAXInterface() throw (RuntimeException
);
217 virtual void SAL_CALL
setAXInterface( const Reference
<XInterface
>& _axinterface
) throw (RuntimeException
);
218 virtual Reference
<XInvocation
> SAL_CALL
getAXInvocation() throw (RuntimeException
);
219 virtual void SAL_CALL
setAXInvocation( const Reference
< XInvocation
>& _axinvocation
) throw (RuntimeException
);
221 virtual void SAL_CALL
testout_methodByte(sal_Int8
& rOut
) throw( RuntimeException
);
222 virtual void SAL_CALL
testout_methodFloat(float& rOut
) throw( RuntimeException
);
223 virtual void SAL_CALL
testout_methodDouble(double& rOut
) throw( RuntimeException
);
224 virtual void SAL_CALL
testout_methodBool(sal_Bool
& rOut
) throw( RuntimeException
);
225 virtual void SAL_CALL
testout_methodShort(sal_Int16
& rOut
) throw( RuntimeException
);
226 virtual void SAL_CALL
testout_methodUShort(sal_uInt16
& rOut
) throw( RuntimeException
);
227 virtual void SAL_CALL
testout_methodLong(sal_Int32
& rOut
) throw( RuntimeException
);
228 virtual void SAL_CALL
testout_methodULong(sal_uInt32
& rOut
) throw( RuntimeException
);
229 virtual void SAL_CALL
testout_methodHyper(sal_Int64
& rOut
) throw( RuntimeException
);
230 virtual void SAL_CALL
testout_methodUHyper(sal_uInt64
& rOut
) throw( RuntimeException
);
231 virtual void SAL_CALL
testout_methodString(OUString
& rOut
) throw( RuntimeException
);
232 virtual void SAL_CALL
testout_methodChar(sal_Unicode
& rOut
) throw( RuntimeException
);
233 virtual void SAL_CALL
testout_methodAny(Any
& rOut
) throw( RuntimeException
);
234 virtual void SAL_CALL
testout_methodType(Type
& rOut
) throw( RuntimeException
);
235 virtual void SAL_CALL
testout_methodSequence(Sequence
< sal_Int32
>& rOut
) throw( RuntimeException
);
236 virtual void SAL_CALL
testout_methodSequence2(Sequence
< Sequence
< sal_Int32
> >& rOut
) throw( RuntimeException
);
237 virtual void SAL_CALL
testout_methodMulParams1(sal_Int32
& rout1
, sal_Int32
& rout2
) throw( RuntimeException
);
238 virtual void SAL_CALL
testout_methodMulParams2(sal_Int32
& rout1
, sal_Int32
& rout2
, OUString
& rout3
) throw( RuntimeException
);
239 virtual void SAL_CALL
testout_methodMulParams3(const OUString
& sin
, OUString
& sout
) throw( RuntimeException
);
240 virtual void SAL_CALL
testout_methodMulParams4( float in1
, float& out1
, sal_Int32 in2
, sal_Int32
& out2
, sal_Int32 in3
) throw(RuntimeException
);
241 virtual void SAL_CALL
testout_methodXInterface( Reference
< XInterface
>& rOut
) throw(RuntimeException
);
243 virtual void SAL_CALL
testinout_methodByte(sal_Int8
& rOut
) throw( RuntimeException
);
244 virtual void SAL_CALL
testinout_methodFloat(float& rOut
) throw( RuntimeException
);
245 virtual void SAL_CALL
testinout_methodDouble(double& rOut
) throw( RuntimeException
);
246 virtual void SAL_CALL
testinout_methodBool(sal_Bool
& rOut
) throw( RuntimeException
);
247 virtual void SAL_CALL
testinout_methodShort(sal_Int16
& rOut
) throw( RuntimeException
);
248 virtual void SAL_CALL
testinout_methodUShort(sal_uInt16
& rOut
) throw( RuntimeException
);
249 virtual void SAL_CALL
testinout_methodLong(sal_Int32
& rOut
) throw( RuntimeException
);
250 virtual void SAL_CALL
testinout_methodULong(sal_uInt32
& rOut
) throw( RuntimeException
);
251 virtual void SAL_CALL
testinout_methodHyper(sal_Int64
& rOut
) throw( RuntimeException
);
252 virtual void SAL_CALL
testinout_methodUHyper(sal_uInt64
& rOut
) throw( RuntimeException
);
253 virtual void SAL_CALL
testinout_methodString(OUString
& rOut
) throw( RuntimeException
);
254 virtual void SAL_CALL
testinout_methodChar(sal_Unicode
& rOut
) throw( RuntimeException
);
255 virtual void SAL_CALL
testinout_methodAny(Any
& rOut
) throw( RuntimeException
);
256 virtual void SAL_CALL
testinout_methodType(Type
& rOut
) throw( RuntimeException
);
257 virtual void SAL_CALL
testinout_methodSequence(Sequence
< sal_Int32
>& rOut
) throw( RuntimeException
);
258 virtual void SAL_CALL
testinout_methodSequence2(Sequence
< Sequence
< sal_Int32
> >& rOut
) throw( RuntimeException
);
259 virtual void SAL_CALL
testinout_methodXInterface( Reference
< XInvocation
>& rOut
) throw(RuntimeException
);
260 virtual void SAL_CALL
testinout_methodXInterface2( Reference
< XInterface
> & rOut
) throw( RuntimeException
);
261 virtual Any SAL_CALL
methodAnyTest1(const Any
& rIn
) throw( RuntimeException
) ;
262 virtual Any SAL_CALL
getAttrAny2(void) throw( RuntimeException
) ;
263 virtual void SAL_CALL
setAttrAny2(const Any
& AttrAny2_
) throw( RuntimeException
) ;
267 virtual void SAL_CALL
methodStruct(const Property
& aProp
) throw( RuntimeException
);
269 virtual Property SAL_CALL
retMethodStruct(void) throw( RuntimeException
);
271 virtual Property SAL_CALL
getAttrStruct(void) throw( RuntimeException
);
272 virtual void SAL_CALL
setAttrStruct(const Property
& AttrStruct_
) throw( RuntimeException
);
273 virtual Property SAL_CALL
methodStruct2( const Property
& aProp
) throw (RuntimeException
);
276 virtual void SAL_CALL
other_methodAnyIn(const Any
& rAny
) throw( RuntimeException
);
277 virtual void SAL_CALL
other_methodAnyOut(Any
& rAny
) throw( RuntimeException
);
278 virtual Any SAL_CALL
other_methodAnyRet(void) throw( RuntimeException
);
279 virtual void SAL_CALL
in_float( float val
) throw ( RuntimeException
);
280 virtual Any SAL_CALL
other_methodAny( const Any
& rAny
, const OUString
& typeInAny
)
281 throw (RuntimeException
);
284 // XTestOutParameters ------------------------------------------------------------------------
285 // virtual void SAL_CALL out_test(sal_Int8 rIn) throw( RuntimeException );
287 // virtual void SAL_CALL out_methodByte(sal_Int8& rOut) throw( RuntimeException );
288 // virtual void SAL_CALL out_methodFloat(float& rOut) throw( RuntimeException );
289 // virtual void SAL_CALL out_methodDouble(double& rOut) throw( RuntimeException );
290 // virtual void SAL_CALL out_methodBool(sal_Bool& rOut) throw( RuntimeException );
291 // virtual void SAL_CALL out_methodShort(sal_Int16& rOut) throw( RuntimeException );
292 // virtual void SAL_CALL out_methodUShort(sal_uInt16& rOut) throw( RuntimeException );
293 // virtual void SAL_CALL out_methodLong(sal_Int32& rOut) throw( RuntimeException );
294 // virtual void SAL_CALL out_methodULong(sal_uInt32& rOut) throw( RuntimeException );
295 // virtual void SAL_CALL out_methodHyper(sal_Int64& rOut) throw( RuntimeException );
296 // virtual void SAL_CALL out_methodUHyper(sal_uInt64& rOut) throw( RuntimeException );
297 // virtual void SAL_CALL out_methodString(OUString& rOut) throw( RuntimeException );
298 // virtual void SAL_CALL out_methodChar(sal_Unicode& rOut) throw( RuntimeException );
299 // virtual void SAL_CALL out_methodAny(Any& rOut) throw( RuntimeException );
300 // virtual void SAL_CALL out_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException );
301 // virtual void SAL_CALL out_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException );
302 // virtual void SAL_CALL out_methodMulParams1(sal_Int32& rout1, sal_Int32& rout2) throw( RuntimeException );
303 // virtual void SAL_CALL out_methodMulParams2(sal_Int32& rout1, sal_Int32& rout2, OUString& rout3) throw( RuntimeException );
304 // virtual void SAL_CALL out_methodMulParams3(const OUString& sin, OUString& sout) throw( RuntimeException );
307 virtual sal_Int8 SAL_CALL
in_methodByte( sal_Int8 rIn
) throw (RuntimeException
);
308 virtual float SAL_CALL
in_methodFloat( float rIn
) throw (RuntimeException
);
309 virtual double SAL_CALL
in_methodDouble( double rIn
) throw (RuntimeException
);
310 virtual sal_Bool SAL_CALL
in_methodBool( sal_Bool rIn
) throw (RuntimeException
);
311 virtual sal_Int16 SAL_CALL
in_methodShort( sal_Int16 rIn
) throw (RuntimeException
);
312 virtual sal_uInt16 SAL_CALL
in_methodUShort( sal_uInt16 rIn
) throw (RuntimeException
);
313 virtual sal_Int32 SAL_CALL
in_methodLong( sal_Int32 rIn
) throw (RuntimeException
);
314 virtual sal_uInt32 SAL_CALL
in_methodULong( sal_uInt32 rIn
) throw (RuntimeException
);
315 virtual sal_Int64 SAL_CALL
in_methodHyper( sal_Int64 rIn
) throw (RuntimeException
);
316 virtual sal_uInt64 SAL_CALL
in_methodUHyper( sal_uInt64 rIn
) throw (RuntimeException
);
317 virtual OUString SAL_CALL
in_methodString( const OUString
& rIn
) throw (RuntimeException
);
318 virtual sal_Unicode SAL_CALL
in_methodChar( sal_Unicode rIn
) throw (RuntimeException
);
319 virtual Any SAL_CALL
in_methodAny( const Any
& rIn
) throw (RuntimeException
);
320 virtual Type SAL_CALL
in_methodType( const Type
& rIn
) throw (RuntimeException
);
321 virtual Reference
<XInterface
> SAL_CALL
in_methodXInterface( const Reference
< XInterface
>& rIn
) throw (RuntimeException
);
322 virtual Reference
<XInvocation
> SAL_CALL
in_methodInvocation( const Reference
< XInvocation
>& inv
) throw (RuntimeException
);
323 virtual SimpleStruct SAL_CALL
in_methodStruct( const SimpleStruct
& aStruct
) throw (RuntimeException
);
324 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
);
326 // XTestInterfaces --------------------------------------------------------------------------
327 virtual void SAL_CALL
testInterface( const Reference
< XCallback
>& xCallback
, sal_Int32 mode
) throw(RuntimeException
);
328 virtual void SAL_CALL
testInterface2( const Reference
< XSimple
>& xSimple
, sal_Int32 mode
) throw(RuntimeException
);
329 // XSimple --------------------------------------------------------------------------
330 void SAL_CALL
func( const OUString
&message
) throw(::com::sun::star::uno::RuntimeException
);
331 OUString SAL_CALL
getName() throw(::com::sun::star::uno::RuntimeException
);
334 virtual void SAL_CALL
setObject( const Reference
< XInterface
>& val
) throw (RuntimeException
);
335 virtual sal_Bool SAL_CALL
isSame( const Reference
< XInterface
>& val
) throw (RuntimeException
);
336 virtual Reference
< XInterface
> SAL_CALL
getThis( ) throw (RuntimeException
);
339 class EventListener
: public WeakImplHelper1
<XEventListener
>
342 EventListener::EventListener(): bCalled( sal_False
)
344 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw (RuntimeException
);
350 OComponent::~OComponent()
355 // Funktions ==============================================================================
357 Reference
<XInterface
> SAL_CALL
OComponent_CreateInstance( const Reference
<XMultiServiceFactory
> & rSMgr
) throw(RuntimeException
)
359 // Reference<XInterface> xService(static_cast<XWeak*>(new OComponent( rSMgr )), UNO_QUERY);
360 OComponent
* o
= new OComponent( rSMgr
);
361 Reference
<XInterface
> xService(static_cast<XIdentity
*>(o
), UNO_QUERY
);
365 Sequence
<OUString
> OComponent_getSupportedServiceNames(void)
367 Sequence
<OUString
> aRet(1);
368 aRet
.getArray()[0] = SERVICE_NAME
;//ODataInputStream_getImplementationName();
374 extern "C" sal_Bool SAL_CALL
component_writeInfo( void * /*pServiceManager*/, void * pRegistryKey
)
380 Reference
<XRegistryKey
> xNewKey
=
381 reinterpret_cast<XRegistryKey
*>( pRegistryKey
)->createKey(KEY1
);
382 xNewKey
->createKey( KEY2
);
386 catch(InvalidRegistryException
&)
388 OSL_ENSURE( sal_False
, "### InvalidRegistryException!\n");
394 extern "C" void * SAL_CALL
component_getFactory(
395 const sal_Char
* pImplName
, void * pServiceManager
, void * /*pRegistryKey*/ )
397 static void * pRet
= NULL
;
400 OUString
aImplName( OUString::createFromAscii( pImplName
) );
401 if (pServiceManager
&& aImplName
.equals( IMPL_NAME
))
403 Reference
<XMultiServiceFactory
> xMulFac(
404 reinterpret_cast< XMultiServiceFactory
*>(pServiceManager
));
406 Sequence
<OUString
> seqServiceNames
;
407 Reference
<XSingleServiceFactory
> xFactory
= createOneInstanceFactory( xMulFac
, SERVICE_NAME
,
408 OComponent_CreateInstance
, seqServiceNames
);
413 pRet
= xFactory
.get();
420 extern "C" void SAL_CALL
component_getImplementationEnvironment(
421 const sal_Char
** ppEnvTypeName
, uno_Environment
** )
423 *ppEnvTypeName
= CPPU_CURRENT_LANGUAGE_BINDING_NAME
;
427 // XTestSequence ============================================================================
428 Sequence
<sal_Int8
> SAL_CALL
OComponent::methodByte(const Sequence
< sal_Int8
>& aSeq
) throw( RuntimeException
)
431 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
432 _x
= aSeq
.getConstArray()[i
];
436 Sequence
<float> SAL_CALL
OComponent::methodFloat(const Sequence
< float>& aSeq
) throw( RuntimeException
)
439 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
440 _x
= aSeq
.getConstArray()[i
];
444 Sequence
<double> SAL_CALL
OComponent::methodDouble(const Sequence
< double >& aSeq
) throw( RuntimeException
)
447 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
448 _x
= aSeq
.getConstArray()[i
];
452 Sequence
< sal_Bool
> SAL_CALL
OComponent::methodBool(const Sequence
< sal_Bool
>& aSeq
) throw( RuntimeException
)
455 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
456 _x
= aSeq
.getConstArray()[i
];
460 Sequence
< sal_Int16
> SAL_CALL
OComponent::methodShort(const Sequence
< sal_Int16
>& aSeq
) throw( RuntimeException
)
463 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
464 _x
= aSeq
.getConstArray()[i
];
468 Sequence
< sal_uInt16
> SAL_CALL
OComponent::methodUShort(const Sequence
< sal_uInt16
>& aSeq
) throw( RuntimeException
)
471 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
472 _x
= aSeq
.getConstArray()[i
];
476 Sequence
< sal_Int32
> SAL_CALL
OComponent::methodLong(const Sequence
< sal_Int32
>& aSeq
) throw( RuntimeException
)
479 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++) {
480 _x
= aSeq
.getConstArray()[i
];
484 Sequence
< sal_uInt32
> SAL_CALL
OComponent::methodULong(const Sequence
< sal_uInt32
>& aSeq
) throw( RuntimeException
)
487 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
488 _x
= aSeq
.getConstArray()[i
];
492 Sequence
< OUString
> SAL_CALL
OComponent::methodString(const Sequence
< OUString
>& aSeq
) throw( RuntimeException
)
495 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++) {
496 _x
= aSeq
.getConstArray()[i
];
500 Sequence
< sal_Unicode
> SAL_CALL
OComponent::methodChar(const Sequence
< sal_Unicode
>& aSeq
) throw( RuntimeException
)
503 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
504 _x
= aSeq
.getConstArray()[i
];
508 Sequence
< Any
> SAL_CALL
OComponent::methodAny(const Sequence
< Any
>& aSeq
) throw( RuntimeException
)
511 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
512 _x
= aSeq
.getConstArray()[i
];
513 TypeClass _t
= _x
.getValueTypeClass();
514 if( _t
== TypeClass_STRING
)
515 OUString
s(* (rtl_uString
**)_x
.getValue());
521 Sequence
< Type
> SAL_CALL
OComponent::methodType(const Sequence
< Type
>& aSeq
) throw( RuntimeException
)
524 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
525 _x
= aSeq
.getConstArray()[i
];
529 //Sequence< Reference< XInterface> > SAL_CALL methodXInterface ( const Sequence< Reference < XInterface> >& aSeq)
530 // throw (RuntimeException)
531 Sequence
< Reference
< XInterface
> > SAL_CALL
OComponent::methodXInterface( const Sequence
< Reference
< XInterface
> >& aSeq
) throw(RuntimeException
)
533 for( sal_Int32 i
= 0; i
< aSeq
.getLength(); i
++)
535 Reference
<XInterface
> xInt
= aSeq
[i
];
536 Reference
<XEventListener
> xList( xInt
, UNO_QUERY
);
538 xList
->disposing( EventObject());
543 Sequence
< Sequence
< sal_Int32
> > SAL_CALL
OComponent::methodSequence(const Sequence
< Sequence
< sal_Int32
> >& aSeq
) throw( RuntimeException
)
546 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
547 const Sequence
<sal_Int32
>& rseq2
= aSeq
.getConstArray()[i
];
548 for (sal_Int16 j
= 0; j
< rseq2
.getLength(); j
++){
549 value
= rseq2
.getConstArray()[j
];
554 Sequence
< Sequence
< Sequence
< sal_Int32
> > > SAL_CALL
OComponent::methodSequence2(const Sequence
< Sequence
< Sequence
< sal_Int32
> > >& aSeq
)
555 throw( RuntimeException
)
558 sal_Int32 len
= aSeq
.getLength();
559 for( sal_Int16 i
= 0; i
< aSeq
.getLength(); i
++){
560 const Sequence
< Sequence
<sal_Int32
> >& rseq2
= aSeq
.getConstArray()[i
];
561 len
= rseq2
.getLength();
563 for (sal_Int16 j
= 0; j
< rseq2
.getLength(); j
++){
564 const Sequence
<sal_Int32
> & rseq3
= rseq2
.getConstArray()[j
];
565 len
= rseq3
.getLength();
567 for (sal_Int16 k
= 0; k
< rseq3
.getLength(); k
++)
568 value
= rseq3
.getConstArray()[k
];
574 Sequence
< Reference
< XEventListener
> > SAL_CALL
OComponent::methodXEventListeners( const Sequence
< Reference
<XEventListener
> >& aSeq
) throw( RuntimeException
)
576 Reference
<XEventListener
> listener
;
577 for( int i
= 0; i
< aSeq
.getLength(); i
++)
581 listener
->disposing( EventObject() );
587 Sequence
< Sequence
<Reference
<XEventListener
> > > SAL_CALL
OComponent::methodXEventListenersMul( const Sequence
<Sequence
<Reference
<XEventListener
> > >& aSeq
) throw (RuntimeException
)
589 Reference
<XEventListener
> listener
;
590 for( int i
= 0; i
< aSeq
.getLength(); i
++)
592 Sequence
<Reference
<XEventListener
> > seqInner
= aSeq
[i
];
593 for( int j
= 0; j
< seqInner
.getLength(); j
++)
595 listener
= seqInner
[j
];
596 listener
->disposing( EventObject() );
602 //---------------------------------------------------------------------------------------------
604 Sequence
< sal_Int8
> SAL_CALL
OComponent::getAttrByte(void) throw( RuntimeException
)
608 void SAL_CALL
OComponent::setAttrByte(const Sequence
< sal_Int8
>& AttrByte_
) throw( RuntimeException
)
610 m_seqByte
= AttrByte_
;
612 Sequence
< float > SAL_CALL
OComponent::getAttrFloat(void) throw( RuntimeException
)
616 void SAL_CALL
OComponent::setAttrFloat(const Sequence
< float >& AttrFloat_
) throw( RuntimeException
)
618 m_seqFloat
= AttrFloat_
;
621 Sequence
< double > SAL_CALL
OComponent::getAttrDouble(void) throw( RuntimeException
)
625 void SAL_CALL
OComponent::setAttrDouble(const Sequence
< double >& AttrDouble_
) throw( RuntimeException
)
627 m_seqDouble
= AttrDouble_
;
630 Sequence
< sal_Bool
> SAL_CALL
OComponent::getAttrBool(void) throw( RuntimeException
)
635 void SAL_CALL
OComponent::setAttrBool(const Sequence
< sal_Bool
>& AttrBool_
) throw (RuntimeException
)
637 m_seqBool
= AttrBool_
;
640 Sequence
< sal_Int16
> SAL_CALL
OComponent::getAttrShort(void) throw( RuntimeException
)
644 void SAL_CALL
OComponent::setAttrShort(const Sequence
< sal_Int16
>& AttrShort_
) throw( RuntimeException
)
646 m_seqShort
= AttrShort_
;
649 Sequence
< sal_uInt16
> SAL_CALL
OComponent::getAttrUShort(void) throw( RuntimeException
)
653 void SAL_CALL
OComponent::setAttrUShort(const Sequence
< sal_uInt16
>& AttrUShort_
) throw( RuntimeException
)
655 m_seqUShort
= AttrUShort_
;
658 Sequence
< sal_Int32
> SAL_CALL
OComponent::getAttrLong(void) throw( RuntimeException
)
662 void SAL_CALL
OComponent::setAttrLong(const Sequence
< sal_Int32
>& AttrLong_
) throw( RuntimeException
)
664 m_seqLong
= AttrLong_
;
667 Sequence
< sal_uInt32
> SAL_CALL
OComponent::getAttrULong(void) throw( RuntimeException
)
671 void SAL_CALL
OComponent::setAttrULong(const Sequence
< sal_uInt32
>& AttrULong_
) throw( RuntimeException
)
673 m_seqULong
= AttrULong_
;
676 Sequence
< OUString
> SAL_CALL
OComponent::getAttrString(void) throw( RuntimeException
)
680 void SAL_CALL
OComponent::setAttrString(const Sequence
< OUString
>& AttrString_
) throw( RuntimeException
)
682 m_seqString
= AttrString_
;
685 Sequence
< sal_Unicode
> SAL_CALL
OComponent::getAttrChar(void) throw( RuntimeException
)
689 void SAL_CALL
OComponent::setAttrChar(const Sequence
< sal_Unicode
>& AttrChar_
) throw( RuntimeException
)
691 m_seqChar
= AttrChar_
;
694 Sequence
< Any
> SAL_CALL
OComponent::getAttrAny(void) throw( RuntimeException
)
698 void SAL_CALL
OComponent::setAttrAny(const Sequence
< Any
>& AttrAny_
) throw( RuntimeException
)
703 Sequence
< Type
> SAL_CALL
OComponent::getAttrType(void) throw( RuntimeException
)
708 void SAL_CALL
OComponent::setAttrType( const Sequence
< Type
>& AttrType_
) throw( RuntimeException
)
710 m_seqType
= AttrType_
;
714 Sequence
< Sequence
< sal_Int32
> > SAL_CALL
OComponent::getAttrSequence(void) throw( RuntimeException
)
718 void SAL_CALL
OComponent::setAttrSequence(const Sequence
< Sequence
< sal_Int32
> >& AttrSequence
) throw(RuntimeException
)
721 for( sal_Int32 i
=0; i
< AttrSequence
.getLength(); i
++)
723 Sequence
< sal_Int32
> seq
= AttrSequence
[i
];
725 for ( sal_Int32 j
=0; j
< seq
.getLength(); j
++)
731 m_seq1
= AttrSequence
;
734 Sequence
< Sequence
< Sequence
< sal_Int32
> > > SAL_CALL
OComponent::getAttrSequence2(void) throw( RuntimeException
)
738 void SAL_CALL
OComponent::setAttrSequence2(const Sequence
< Sequence
< Sequence
< sal_Int32
> > >& AttrSequence2_
)
739 throw( RuntimeException
)
741 m_seq2
= AttrSequence2_
;
744 Sequence
< Reference
< XInterface
> > SAL_CALL
OComponent::getAttrXInterface() throw(RuntimeException
)
746 return m_seqxInterface
;
748 void SAL_CALL
OComponent::setAttrXInterface( const Sequence
< Reference
< XInterface
> >& _attrxinterface
) throw(RuntimeException
)
750 m_seqxInterface
= _attrxinterface
;
753 // ----------------------------------------------------------------------------
755 ::sal_Int8 SAL_CALL
OComponent::getAByte() throw (RuntimeException
)
760 void SAL_CALL
OComponent::setAByte( ::sal_Int8 _abyte
) throw (RuntimeException
)
762 m_attr_int8
= _abyte
;
765 float SAL_CALL
OComponent::getAFloat() throw (RuntimeException
)
770 void SAL_CALL
OComponent::setAFloat( float _afloat
) throw (RuntimeException
)
772 m_attr_float
= _afloat
;
775 double SAL_CALL
OComponent::getADouble() throw (RuntimeException
)
777 return m_attr_double
;
780 void SAL_CALL
OComponent::setADouble( double _adouble
) throw (RuntimeException
)
782 m_attr_double
= _adouble
;
785 ::sal_Bool SAL_CALL
OComponent::getABool() throw (RuntimeException
)
790 void SAL_CALL
OComponent::setABool( ::sal_Bool _abool
) throw (RuntimeException
)
792 m_attr_bool
= _abool
;
795 ::sal_Int16 SAL_CALL
OComponent::getAShort() throw (RuntimeException
)
800 void SAL_CALL
OComponent::setAShort( ::sal_Int16 _ashort
) throw (RuntimeException
)
802 m_attr_int16
= _ashort
;
805 ::sal_uInt16 SAL_CALL
OComponent::getAUShort() throw (RuntimeException
)
807 return m_attr_uint16
;
810 void SAL_CALL
OComponent::setAUShort( ::sal_uInt16 _aushort
) throw (RuntimeException
)
812 m_attr_uint16
= _aushort
;
815 ::sal_Int32 SAL_CALL
OComponent::getALong() throw (RuntimeException
)
820 void SAL_CALL
OComponent::setALong( ::sal_Int32 _along
) throw (RuntimeException
)
822 m_attr_int32
= _along
;
825 ::sal_uInt32 SAL_CALL
OComponent::getAULong() throw (RuntimeException
)
827 return m_attr_uint32
;;
830 void SAL_CALL
OComponent::setAULong( ::sal_uInt32 _aulong
) throw (RuntimeException
)
832 m_attr_uint32
= _aulong
;
835 ::rtl::OUString SAL_CALL
OComponent::getAString() throw (RuntimeException
)
837 return m_attr_string
;
840 void SAL_CALL
OComponent::setAString( const ::rtl::OUString
& _astring
) throw (RuntimeException
)
842 m_attr_string
= _astring
;
845 ::sal_Unicode SAL_CALL
OComponent::getAChar() throw (RuntimeException
)
850 void SAL_CALL
OComponent::setAChar( ::sal_Unicode _achar
) throw (RuntimeException
)
852 m_attr_char
= _achar
;
855 Any SAL_CALL
OComponent::getAAny() throw (RuntimeException
)
860 void SAL_CALL
OComponent::setAAny( const Any
& _aany
) throw (RuntimeException
)
865 Type SAL_CALL
OComponent::getAType() throw (RuntimeException
)
870 void SAL_CALL
OComponent::setAType( const Type
& _atype
) throw (RuntimeException
)
872 m_attr_type
= _atype
;
875 Reference
< XInterface
> SAL_CALL
OComponent::getAXInterface() throw (RuntimeException
)
877 return m_attr_xinterface
;
880 void SAL_CALL
OComponent::setAXInterface( const Reference
<XInterface
>& _axinterface
) throw (RuntimeException
)
882 m_attr_xinterface
= _axinterface
;
885 Reference
<XInvocation
> SAL_CALL
OComponent::getAXInvocation() throw (RuntimeException
)
887 return m_attr_xinvocation
;
890 void SAL_CALL
OComponent::setAXInvocation( const Reference
< XInvocation
>& _axinvocation
) throw (RuntimeException
)
892 m_attr_xinvocation
= _axinvocation
;
894 //-----------------------------------------------------------------------------------
895 void SAL_CALL
OComponent::testout_methodByte(sal_Int8
& rOut
) throw( RuntimeException
)
899 void SAL_CALL
OComponent::testout_methodFloat(float& rOut
) throw( RuntimeException
)
903 void SAL_CALL
OComponent::testout_methodDouble(double& rOut
) throw( RuntimeException
)
908 void SAL_CALL
OComponent::testout_methodBool(sal_Bool
& rOut
) throw( RuntimeException
)
912 void SAL_CALL
OComponent::testout_methodShort(sal_Int16
& rOut
) throw( RuntimeException
)
916 void SAL_CALL
OComponent::testout_methodUShort(sal_uInt16
& rOut
) throw( RuntimeException
)
920 void SAL_CALL
OComponent::testout_methodLong(sal_Int32
& rOut
) throw( RuntimeException
)
924 void SAL_CALL
OComponent::testout_methodULong(sal_uInt32
& rOut
) throw( RuntimeException
)
928 void SAL_CALL
OComponent::testout_methodHyper(sal_Int64
& rOut
) throw( RuntimeException
)
933 void SAL_CALL
OComponent::testout_methodUHyper(sal_uInt64
& rOut
) throw( RuntimeException
)
938 void SAL_CALL
OComponent::testout_methodString(OUString
& rOut
) throw( RuntimeException
)
942 void SAL_CALL
OComponent::testout_methodChar(sal_Unicode
& rOut
) throw( RuntimeException
)
946 void SAL_CALL
OComponent::testout_methodAny(Any
& rOut
) throw( RuntimeException
)
951 void SAL_CALL
OComponent::testout_methodType(Type
& rOut
) throw( RuntimeException
)
956 void SAL_CALL
OComponent::testout_methodSequence(Sequence
< sal_Int32
>& rOut
) throw( RuntimeException
)
959 for( sal_Int16 i
= 0; i
< rOut
.getLength(); i
++) rOut
.getArray()[i
]= i
;
961 void SAL_CALL
OComponent::testout_methodSequence2(Sequence
< Sequence
< sal_Int32
> >& rOut
) throw( RuntimeException
)
964 for( sal_Int16 i
= 0; i
< rOut
.getLength(); i
++){
965 Sequence
<sal_Int32
>& rseq2
= rOut
.getArray()[i
];
967 for (sal_Int16 j
= 0; j
< rseq2
.getLength(); j
++){
968 rseq2
.getArray()[j
]= j
;
972 void SAL_CALL
OComponent::testout_methodMulParams1(sal_Int32
& rout1
, sal_Int32
& rout2
) throw( RuntimeException
)
977 void SAL_CALL
OComponent::testout_methodMulParams2(sal_Int32
& rout1
, sal_Int32
& rout2
, OUString
& rout3
) throw( RuntimeException
)
981 rout3
= L
" another string";
983 void SAL_CALL
OComponent::testout_methodMulParams3(const OUString
&, OUString
& sout
) throw( RuntimeException
)
987 void SAL_CALL
OComponent::testout_methodMulParams4( float in1
, float& out1
, sal_Int32 in2
, sal_Int32
& out2
, sal_Int32
) throw(RuntimeException
)
993 void SAL_CALL
OComponent::testout_methodXInterface( Reference
< XInterface
>& rOut
) throw(RuntimeException
)
996 // OUString string( L"Property Any");
998 // rOut= Reference<XInterface> (static_cast<XTestSequence*>(this), UNO_QUERY);
1001 // XTestInParameters ------------------------------------------------------------
1002 sal_Int8 SAL_CALL
OComponent::in_methodByte( sal_Int8 rIn
) throw (RuntimeException
)
1007 float SAL_CALL
OComponent::in_methodFloat( float rIn
) throw (RuntimeException
)
1012 double SAL_CALL
OComponent::in_methodDouble( double rIn
) throw (RuntimeException
)
1017 sal_Bool SAL_CALL
OComponent::in_methodBool( sal_Bool rIn
) throw (RuntimeException
)
1022 sal_Int16 SAL_CALL
OComponent::in_methodShort( sal_Int16 rIn
) throw (RuntimeException
)
1027 sal_uInt16 SAL_CALL
OComponent::in_methodUShort( sal_uInt16 rIn
) throw (RuntimeException
)
1032 sal_Int32 SAL_CALL
OComponent::in_methodLong( sal_Int32 rIn
) throw (RuntimeException
)
1037 sal_uInt32 SAL_CALL
OComponent::in_methodULong( sal_uInt32 rIn
) throw (RuntimeException
)
1042 sal_Int64 SAL_CALL
OComponent::in_methodHyper( sal_Int64 rIn
) throw (RuntimeException
)
1048 sal_uInt64 SAL_CALL
OComponent::in_methodUHyper( sal_uInt64 rIn
) throw (RuntimeException
)
1054 OUString SAL_CALL
OComponent::in_methodString( const OUString
& rIn
) throw (RuntimeException
)
1059 sal_Unicode SAL_CALL
OComponent::in_methodChar( sal_Unicode rIn
) throw (RuntimeException
)
1064 Any SAL_CALL
OComponent::in_methodAny( const Any
& rIn
) throw (RuntimeException
)
1070 Type SAL_CALL
OComponent::in_methodType( const Type
& rIn
) throw (RuntimeException
)
1076 Reference
<XInvocation
> SAL_CALL
OComponent::in_methodInvocation( const Reference
< XInvocation
>& inv
)
1077 throw (RuntimeException
)
1079 //We expect the invocation results from a conversion of VBasicEventListener.VBEventListener
1080 //which implements XEventListener
1081 // extensions/test/ole/EventListenerSample
1082 EventObject
event( Reference
<XInterface
>(static_cast<XTestInParameters
*>(this),UNO_QUERY
));
1085 Sequence
<Any
> params( &anyParam
, 1);
1086 Sequence
<sal_Int16
> outIndex
;
1087 Sequence
<Any
> outParams
;
1089 inv
->invoke( OUString(RTL_CONSTASCII_USTRINGPARAM("disposing")),
1090 params
, outIndex
, outParams
);
1091 }catch(IllegalArgumentException
&) {
1093 catch(CannotConvertException
&){
1095 catch(InvocationTargetException
&) {
1099 Reference
<XInterface
> SAL_CALL
OComponent::in_methodXInterface( const Reference
<XInterface
>& rIn
) throw (RuntimeException
)
1105 SimpleStruct SAL_CALL
OComponent::in_methodStruct( const SimpleStruct
& aStruct
)
1106 throw (RuntimeException
)
1108 SimpleStruct
& s
= const_cast<SimpleStruct
&>(aStruct
);
1109 s
.message
= s
.message
+ OUString(RTL_CONSTASCII_USTRINGPARAM(
1110 "This string was set in OleTest"));
1113 void SAL_CALL
OComponent::in_methodAll(
1114 sal_Int8
, float, double, sal_Bool
, sal_Int16
, sal_uInt16
,
1115 sal_Int32
, sal_uInt32
, const OUString
&, sal_Unicode
,
1116 const Any
&, const Type
&, const Reference
<XInvocation
>&) throw (RuntimeException
)
1120 // INOUT -----------------------------------------------------------------------------------
1121 void SAL_CALL
OComponent::testinout_methodByte(sal_Int8
& rOut
) throw( RuntimeException
)
1123 sal_Int8 tmp
= rOut
;
1127 void SAL_CALL
OComponent::testinout_methodFloat(float& rOut
) throw( RuntimeException
)
1134 void SAL_CALL
OComponent::testinout_methodDouble(double& rOut
) throw( RuntimeException
)
1140 void SAL_CALL
OComponent::testinout_methodBool(sal_Bool
& rOut
) throw( RuntimeException
)
1142 sal_Bool tmp
= rOut
;
1146 void SAL_CALL
OComponent::testinout_methodShort(sal_Int16
& rOut
) throw( RuntimeException
)
1148 sal_Int16 tmp
= rOut
;
1152 void SAL_CALL
OComponent::testinout_methodUShort(sal_uInt16
& rOut
) throw( RuntimeException
)
1154 sal_uInt16 tmp
= rOut
;
1158 void SAL_CALL
OComponent::testinout_methodLong(sal_Int32
& rOut
) throw( RuntimeException
)
1160 sal_Int32 tmp
= rOut
;
1164 void SAL_CALL
OComponent::testinout_methodULong(sal_uInt32
& rOut
) throw( RuntimeException
)
1166 sal_uInt32 tmp
= rOut
;
1170 void SAL_CALL
OComponent::testinout_methodHyper(sal_Int64
& rOut
) throw( RuntimeException
)
1172 sal_Int64 tmp
= rOut
;
1177 void SAL_CALL
OComponent::testinout_methodUHyper(sal_uInt64
& rOut
) throw( RuntimeException
)
1179 sal_uInt64 tmp
= rOut
;
1184 void SAL_CALL
OComponent::testinout_methodString(OUString
& rOut
) throw( RuntimeException
)
1186 OUString tmp
= rOut
;
1190 void SAL_CALL
OComponent::testinout_methodChar(sal_Unicode
& rOut
) throw( RuntimeException
)
1192 sal_Unicode tmp
= rOut
;
1196 void SAL_CALL
OComponent::testinout_methodAny(Any
& rOut
) throw( RuntimeException
)
1202 void SAL_CALL
OComponent::testinout_methodType(Type
& rOut
) throw( RuntimeException
)
1210 void SAL_CALL
OComponent::testinout_methodSequence(Sequence
< sal_Int32
>& rOut
) throw( RuntimeException
)
1213 sal_Int32
* arr
= rOut
.getArray();
1214 for ( sal_Int32 i
=0; i
< rOut
.getLength(); i
++)
1216 rOut
.getArray()[i
] += 1;
1219 void SAL_CALL
OComponent::testinout_methodSequence2(Sequence
< Sequence
< sal_Int32
> >& rOut
) throw( RuntimeException
)
1221 for( sal_Int32 i
=0; i
< rOut
.getLength(); i
++)
1223 Sequence
< sal_Int32
>& seq
= rOut
.getArray()[i
];
1225 for ( sal_Int32 j
=0; j
< seq
.getLength(); j
++)
1227 seq
.getArray()[j
] += seq
.getArray()[j
];
1232 // The parameter should implement XInvocation and a Property "value"
1233 void SAL_CALL
OComponent::testinout_methodXInterface( Reference
< XInvocation
>& rOut
) throw(RuntimeException
)
1236 any
= rOut
->getValue( OUString( L
"value"));
1239 OUString
string(L
"out");
1241 rOut
->setValue( OUString(L
"value"), any
);
1243 any
= rOut
->getValue( OUString( L
"value"));
1248 void SAL_CALL
OComponent::testinout_methodXInterface2( Reference
< XInterface
> & rOut
) throw( RuntimeException
)
1250 Reference
<XInterface
> tmp
= rOut
;
1251 rOut
= m_xinterface
;
1253 // Reference<XTestSequence> xTest( rOut, UNO_QUERY);
1256 // Any any= xTest->getAttrAny2();
1259 // OUString string= _s + OUString((L" this string was written in the UNO component to the inout pararmeter"));
1261 // xTest->setAttrAny2( any);
1265 Any SAL_CALL
OComponent::methodAnyTest1(const Any
& rIn
) throw( RuntimeException
)
1269 Any SAL_CALL
OComponent::getAttrAny2(void) throw( RuntimeException
)
1273 void SAL_CALL
OComponent::setAttrAny2(const Any
& AttrAny2_
) throw( RuntimeException
)
1280 // XTestStruct =======================================================================================
1282 void SAL_CALL
OComponent::methodStruct(const Property
& aProp
) throw( RuntimeException
)
1286 sprintf( buff
,"Property::Attribute : %d \n Property::Handle : %d \n Property::Name : %S",
1287 aProp
.Attributes
, aProp
.Handle
, (const sal_Unicode
*)aProp
.Name
);
1288 MessageBox( NULL
, A2T(buff
), _T("OleTest: methodStruct"), MB_OK
);
1291 Property SAL_CALL
OComponent::retMethodStruct(void) throw( RuntimeException
)
1293 Property
a(L
"OleTest_Property", 255, getCppuType( (Reference
<XInterface
>*)0), PropertyAttribute::MAYBEVOID
|
1294 PropertyAttribute::BOUND
| PropertyAttribute::CONSTRAINED
|
1295 PropertyAttribute::TRANSIENT
| PropertyAttribute::READONLY
|
1296 PropertyAttribute::MAYBEAMBIGUOUS
| PropertyAttribute::MAYBEDEFAULT
);
1300 Property SAL_CALL
OComponent::getAttrStruct(void) throw( RuntimeException
)
1302 Property
a(L
"OleTest_Property", 255, getCppuType( (Reference
<XInterface
>*)0), PropertyAttribute::MAYBEVOID
|
1303 PropertyAttribute::BOUND
| PropertyAttribute::CONSTRAINED
|
1304 PropertyAttribute::TRANSIENT
| PropertyAttribute::READONLY
|
1305 PropertyAttribute::MAYBEAMBIGUOUS
| PropertyAttribute::MAYBEDEFAULT
);
1310 void SAL_CALL
OComponent::setAttrStruct(const Property
& AttrStruct_
) throw( RuntimeException
)
1314 sprintf( buff
,"Property::Attribute : %d \n Property::Handle : %d \n Property::Name : %S",
1315 AttrStruct_
.Attributes
, AttrStruct_
.Handle
, (const sal_Unicode
*)AttrStruct_
.Name
);
1316 // MessageBox( NULL, A2T(buff), _T("OleTest: setAttrStruct"), MB_OK);
1319 Property SAL_CALL
OComponent::methodStruct2( const Property
& aProp
) throw (RuntimeException
)
1324 // XTestOther ==================================================================================
1325 void SAL_CALL
OComponent::other_methodAnyIn(const Any
& ) throw( RuntimeException
)
1328 void SAL_CALL
OComponent::other_methodAnyOut(Any
& rAny
) throw( RuntimeException
)
1330 rAny
<<= OUString(L
"Ein Any");
1333 Any SAL_CALL
OComponent::other_methodAnyRet(void) throw(RuntimeException
)
1336 a
<<= OUString(L
"Ein Any");
1339 void SAL_CALL
OComponent::in_float( float val
) throw ( RuntimeException
)
1343 sprintf( buff
, "parameter : %f", val
);
1344 MessageBox( NULL
, A2T(buff
), _T("OleTest"), MB_OK
);
1346 Any SAL_CALL
OComponent::other_methodAny( const Any
& rAny
, const OUString
& typeInAny
)
1347 throw (RuntimeException
)
1350 typelib_TypeDescription
* pDesc
= NULL
;
1351 typelib_typedescription_getByName( &pDesc
, typeInAny
.pData
);
1354 expectedType
= Type( pDesc
->pWeakRef
);
1355 typelib_typedescription_release( pDesc
);
1357 if (rAny
.getValueType() != expectedType
)
1358 throw RuntimeException();
1363 // XTestOutParameters ============================================================================
1364 // void SAL_CALL OComponent::out_test(sal_Int8 rIn) throw( RuntimeException )
1368 // void SAL_CALL OComponent::out_methodByte(sal_Int8& rOut) throw( RuntimeException )
1373 // void SAL_CALL OComponent::out_methodDouble(double& rOut) throw( RuntimeException )
1377 // void SAL_CALL OComponent::out_methodFloat(float& rOut) throw( RuntimeException )
1381 // void SAL_CALL OComponent::out_methodBool(sal_Bool& rOut) throw( RuntimeException )
1385 // void SAL_CALL OComponent::out_methodShort(sal_Int16& rOut) throw( RuntimeException )
1389 // void SAL_CALL OComponent::out_methodUShort(sal_uInt16& rOut) throw( RuntimeException )
1393 // void SAL_CALL OComponent::out_methodLong(sal_Int32& rOut) throw( RuntimeException )
1398 // void SAL_CALL OComponent::out_methodULong(sal_uInt32& rOut) throw( RuntimeException )
1402 // void SAL_CALL OComponent::out_methodHyper(sal_Int64& rOut) throw( RuntimeException )
1407 // void SAL_CALL OComponent::out_methodUHyper(sal_uInt64& rOut) throw( RuntimeException )
1411 // void SAL_CALL OComponent::out_methodString(OUString& rOut) throw( RuntimeException )
1413 // rOut= L"I'm a string";
1415 // void SAL_CALL OComponent::out_methodChar(sal_Unicode& rOut) throw( RuntimeException )
1419 // void SAL_CALL OComponent::out_methodAny(Any& rOut) throw( RuntimeException)
1422 // a <<= OUString( L"Hi");
1425 // void SAL_CALL OComponent::out_methodSequence(Sequence< sal_Int32 >& rOut) throw( RuntimeException )
1427 // Sequence< sal_Int32 > aseq(10);
1428 // for( sal_Int16 i= 0; i < aseq.getLength(); i++) aseq.getArray()[i]= i;
1431 // void SAL_CALL OComponent::out_methodSequence2(Sequence< Sequence< sal_Int32 > >& rOut) throw( RuntimeException )
1433 // rOut= Sequence< Sequence< sal_Int32 > >();
1435 // void SAL_CALL OComponent::out_methodMulParams1(sal_Int32& rout1, sal_Int32& rout2) throw( RuntimeException )
1440 // void SAL_CALL OComponent::out_methodMulParams2(sal_Int32& rout1, sal_Int32& rout2, OUString& rout3) throw( RuntimeException )
1444 // rout3= L"this is a neet little string";
1446 // void SAL_CALL OComponent::out_methodMulParams3(const OUString& sin, OUString& sout) throw( RuntimeException )
1448 // sout= L"this is a neet little string";
1451 // XTestInterfaces -------------------------------------------------------------------------------------
1452 void SAL_CALL
OComponent::testInterface( const Reference
< XCallback
>& xCallback
, sal_Int32 mode
) throw(RuntimeException
)
1459 Reference
<XSimple
> xSimple
;
1460 SimpleStruct aSimpleStruct
;
1461 SimpleEnum aSimpleEnum
;
1462 Sequence
<Any
> seqAny
;
1463 Sequence
< sal_Int8
> seqByte
;
1472 // sal_uInt16 aUShort;
1473 // sal_uInt32 aULong;
1478 xCallback
->func1(); break;
1480 xSimple
= xCallback
->returnInterface();
1481 xSimple
->func(L
"XCallback::returnInterface");
1486 xCallback
->outInterface( xSimple
);
1487 sprintf( buff
, "XCallback::outInterface, value: %x", xSimple
.get());
1488 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1489 xSimple
->func(L
"XCallback::outInterface works");
1492 xCallback
->outStruct( aSimpleStruct
);
1493 sprintf( buff
,"XCallback::outStruct, SimpleStruct::message: %s", OLE2A( aSimpleStruct
.message
));
1494 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1497 xCallback
->outEnum( aSimpleEnum
);
1498 sprintf( buff
,"XCallback::outEnum, SimpleEnum: %d", aSimpleEnum
);
1499 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1502 xCallback
->outSeqAny( seqAny
);
1503 sprintf( buff
,"XCallback::outSeqAny, length: %d )", seqAny
.getLength());
1504 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1505 for( i
=0; i
< seqAny
.getLength(); i
++)
1508 if( any
.getValueTypeClass() == TypeClass_STRING
)
1511 OutputDebugStringW( aString
);
1517 xCallback
->outAny( outAny
);
1518 if( outAny
.getValueTypeClass() == TypeClass_STRING
)
1520 sprintf( buff
,"XCallback::outAny, Any : %s", W2A( aString
));
1521 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1524 xCallback
->outBool( aBool
);
1525 sprintf( buff
,"XCallback::outBool, value: %d", aBool
);
1526 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1529 xCallback
->outChar( aChar
);
1530 sprintf( buff
,"XCallback::outChar, value: %C", aChar
);
1531 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1534 xCallback
->outString( aString
);
1535 sprintf( buff
,"XCallback::outString, value: %s", W2A( aString
));
1536 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1539 xCallback
->outFloat( aFloat
);
1540 sprintf( buff
,"XCallback::outFloat, value: %f", aFloat
);
1541 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1544 xCallback
->outDouble( aDouble
);
1545 sprintf( buff
,"XCallback::outDouble, value: %f", aDouble
);
1546 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1549 xCallback
->outByte( aByte
);
1550 sprintf( buff
,"XCallback::outByte, value: %d", aByte
);
1551 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1554 xCallback
->outShort( aShort
);
1555 sprintf( buff
,"XCallback::outShort, value: %d", aShort
);
1556 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1559 xCallback
->outLong( aLong
);
1560 sprintf( buff
,"XCallback::outLong, value: %d", aLong
);
1561 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1569 xCallback
->outValuesMixed( 1111, outLong
, OUString( L
"in string") );
1571 sprintf( buff
, "oletest.testInterface: outValue: %d", outLong
);
1572 MessageBox( NULL
, A2T(buff
), _T("OleTest"), MB_OK
);
1578 Reference
< XSimple
> xSimple
;
1579 SimpleStruct aSimpleStruct
;
1580 SimpleEnum aSimpleEnum
;
1581 Sequence
<Any
> seqAny
;
1591 // sal_uInt16 aUShort;
1592 // sal_uInt32 aULong;
1593 xCallback
->outValuesAll( xSimple
, aSimpleStruct
, aSimpleEnum
, seqAny
, aAny
, aBool
,
1599 MessageBox( NULL
, _T("XCallback::outValuesAll returned"), _T("OleTest::testInterface"), MB_OK
);
1605 xCallback
->outSeqByte( seqByte
);
1606 sprintf( buff
,"XCallback::outSeqAny, length: %d )", seqAny
.getLength());
1607 MessageBox( NULL
, A2T(buff
), _T("OleTest out parameter"), MB_OK
);
1608 for( i
=0; i
< seqAny
.getLength(); i
++)
1611 if( any
.getValueTypeClass() == TypeClass_STRING
)
1614 OutputDebugStringW( aString
);
1619 // ############################################################################
1621 // ############################################################################
1624 Reference
<XSimple
> xSimple
= static_cast<XSimple
*>(this);
1625 xCallback
->inoutInterface( xSimple
);
1626 xSimple
->func(L
"XSimple called from OleTest");
1631 Reference
<XIdlReflection
> xRefl( m_rFactory
->createInstance(L
"com.sun.star.reflection.CoreReflection"), UNO_QUERY
);
1634 Reference
<XIdlClass
> xClass
= xRefl
->forName(L
"oletest.SimpleStruct");
1637 xClass
->createObject( any
);
1639 if( any
.getValueTypeClass() == TypeClass_STRUCT
)
1641 SimpleStruct
* pStruct
= ( SimpleStruct
*) any
.getValue();
1642 pStruct
->message
= OUString::createFromAscii("This struct was created in OleTest");
1644 SimpleStruct aStruct
;
1646 xCallback
->inoutStruct( aStruct
);
1647 // a Struct should now contain a different message
1648 MessageBox( NULL
, W2T(aStruct
.message
), _T("OleTest in out parameter"), MB_OK
);
1656 SimpleEnum aEnum
= SimpleEnum_B
;
1657 xCallback
->inoutEnum( aEnum
);
1659 sprintf( buff
, "Enum: %d", aEnum
);
1660 MessageBox( NULL
, A2T(buff
), _T("OleTest in out parameter"), MB_OK
);
1666 arAny
[0] <<= OUString( L
"string 0");
1667 arAny
[1] <<= OUString( L
"string 1");
1668 arAny
[2] <<= OUString( L
"string 2");
1670 Sequence
< Any
>seqAny( arAny
, 3);
1671 xCallback
->inoutSeqAny( seqAny
);
1673 sprintf( buff
, "Sequence length: %d", seqAny
.getLength());
1674 MessageBox( NULL
,A2T(buff
) , _T("OleTest in out parameter"), MB_OK
);
1676 for( int i
=0; i
< seqAny
.getLength(); i
++)
1680 if(any
.getValueTypeClass() == TypeClass_STRING
)
1693 OUString
s(L
" OleTest");
1695 xCallback
->inoutAny(any
);
1696 if( any
.getValueTypeClass() == TypeClass_STRING
)
1698 OUString s
= *( rtl_uString
**) any
.getValue();
1699 MessageBox( NULL
, W2T( s
), _T("OleTest: inout value any"), MB_OK
);
1705 sal_Bool b
= sal_True
;
1706 xCallback
->inoutBool( b
);
1708 sprintf( buff
, "out value bool: %d", b
);
1709 MessageBox( NULL
, A2T( buff
), _T("OleTest in out parameter"), MB_OK
);
1714 sal_Unicode uc
= L
'A';
1715 xCallback
->inoutChar( uc
);
1717 sprintf( buff
, "out value sal_Unicode: %C", uc
);
1718 MessageBox( NULL
, A2T( buff
), _T("OleTest in out parameter"), MB_OK
);
1723 OUString
s(L
"OleTest");
1724 xCallback
->inoutString( s
);
1726 sprintf( buff
, "out value string: %S", s
.getStr());
1727 MessageBox( NULL
, A2T( buff
), _T("OleTest in out parameter"), MB_OK
);
1733 xCallback
->inoutFloat(f
);
1735 sprintf( buff
, "out value float: %f", f
);
1736 MessageBox( NULL
, A2T( buff
), _T("OleTest in out parameter"), MB_OK
);
1742 xCallback
->inoutDouble( f
);
1744 sprintf( buff
, "out value double: %g", f
);
1745 MessageBox( NULL
, A2T( buff
), _T("OleTest in out parameter"), MB_OK
);
1750 sal_Int8 aByte
= 0xf;
1751 xCallback
->inoutByte( aByte
);
1753 sprintf( buff
, "out value sal_Int8: %d", aByte
);
1754 MessageBox( NULL
, A2T( buff
), _T("OleTest in out parameter"), MB_OK
);
1759 sal_Int16 aShort
= 0xff;
1760 xCallback
->inoutShort( aShort
);
1762 sprintf( buff
, "out value sal_Int16: %d", aShort
);
1763 MessageBox( NULL
, A2T( buff
), _T("OleTest in out parameter"), MB_OK
);
1768 sal_Int32 aLong
= 0xfffe;
1769 xCallback
->inoutLong( aLong
);
1771 sprintf( buff
, "out value sal_Int32: %d", aLong
);
1772 MessageBox( NULL
, A2T( buff
), _T("OleTest in out parameter"), MB_OK
);
1777 Reference
<XSimple
> aXSimple
= static_cast<XSimple
*>(this);
1779 SimpleStruct aStruct
;
1780 Reference
<XIdlReflection
> xRefl( m_rFactory
->createInstance(L
"com.sun.star.reflection.CoreReflection"), UNO_QUERY
);
1783 Reference
<XIdlClass
> xClass
= xRefl
->forName(L
"oletest.SimpleStruct");
1786 xClass
->createObject( any
);
1788 if( any
.getValueTypeClass() == TypeClass_STRUCT
)
1790 SimpleStruct
* pStruct
= ( SimpleStruct
*) any
.getValue();
1791 pStruct
->message
= OUString::createFromAscii("This struct was created in OleTest");
1796 SimpleEnum aEnum
= SimpleEnum_B
;
1798 Sequence
< Any
> aSeq
;
1800 arAny
[0] <<= OUString( L
"string 0");
1801 arAny
[1] <<= OUString( L
"string 1");
1802 arAny
[2] <<= OUString( L
"string 2");
1803 aSeq
= Sequence
< Any
>( arAny
, 3);
1806 OUString
s(L
" OleTest");
1809 sal_Bool aBool
= sal_True
;
1810 sal_Unicode aChar
= L
'A';
1811 OUString
aString( L
"OleTest");
1813 double aDouble
= 3.145;
1814 sal_Int8 aByte
= 0xf;
1815 sal_Int16 aShort
= 0xff;
1816 sal_Int32 aLong
= 0xffe;
1818 xCallback
->inoutValuesAll( aXSimple
, aStruct
, aEnum
, aSeq
,
1819 aAny
, aBool
, aChar
, aString
, aFloat
, aDouble
,
1820 aByte
, aShort
, aLong
);
1822 aXSimple
->func(L
"XSimple called from OleTest");
1823 MessageBox( NULL
, W2T(aStruct
.message
), _T("OleTest"), MB_OK
);
1825 for( int i
=0; i
< aSeq
.getLength(); i
++)
1829 if(any
.getValueTypeClass() == TypeClass_STRING
)
1839 // ############################################################################
1841 // ############################################################################
1845 xCallback
->inValues( L
'a', 0xffffL
, OUString(L
" a string from OleTest"));
1849 sal_Int8 arbyte
[3]= { 1,2,3};
1850 Sequence
< sal_Int8
> seq( arbyte
, 3);
1851 xCallback
->inSeqByte( seq
);
1856 const int LISTENERS
= 3;
1857 Reference
<XEventListener
> arListeners
[LISTENERS
];
1858 EventObject arEvents
[LISTENERS
];
1860 for( int i
= 0; i
< LISTENERS
; i
++)
1862 Reference
<XInterface
> aList
= static_cast<XWeak
*>( new EventListener());
1863 arListeners
[i
]= Reference
<XEventListener
>( aList
, UNO_QUERY
);
1866 xCallback
->inSeqXEventListener(Sequence
<Reference
<XEventListener
> > (arListeners
, LISTENERS
),
1867 Sequence
<EventObject
>(arEvents
, LISTENERS
));
1871 // ############################################################################
1872 // Call a COM object that has not been passed as parameter to a UNO component and
1873 // hence no type information are available in the COM wrapper
1874 // ############################################################################
1877 Reference
<XInterface
> xIntFact
= m_rFactory
->createInstance(L
"com.sun.star.bridge.oleautomation.Factory");
1879 Reference
<XMultiServiceFactory
> oleFact(xIntFact
, UNO_QUERY
);
1881 Reference
<XInterface
> xIntCallback
= oleFact
->createInstance(L
"XCallback_Impl.Callback");
1882 Reference
<XInvocation
> xInv( xIntCallback
, UNO_QUERY
);
1883 //Any SAL_CALL invoke( const OUString& aFunctionName, const Sequence<Any >& aParams,Sequence< sal_Int16 >& aOutParamIndex,
1884 // Sequence<Any >& aOutParam );
1885 Sequence
<sal_Int16
> seqIndizes
;
1886 Sequence
<Any
> seqOutParams
;
1887 xInv
->invoke( OUString( L
"outValuesAll"), Sequence
<Any
>(), seqIndizes
, seqOutParams
);
1889 // void outValuesAll( [out] oletest::XSimple outInterface,
1890 // [out] SimpleStruct outStruct ,
1891 // [out] SimpleEnum outEnum,
1892 // [out] sequence<any> outSeqAny,
1893 // [out] any outAny,
1894 // [out] boolean outBool,
1895 // [out] char outChar,
1896 // [out] string outString,
1897 // [out] float outFloat,
1898 // [out] double outDouble,
1899 // [out] byte outByte,
1900 // [out] short outShort,
1901 // [out] long outLong);
1902 if( seqOutParams
.getLength() == 12)
1904 Reference
<XSimple
> xSimple
= *(XSimple
**)seqOutParams
[0].getValue();
1905 xSimple
->func( L
"Call from OleTest on XSimple");
1906 SimpleStruct aStruct
;
1907 seqOutParams
[1] >>= aStruct
;
1908 SimpleEnum aEnum
= *(SimpleEnum
*)seqOutParams
[2].getValue();
1910 Sequence
<Any
> seqAny
;
1911 seqOutParams
[3] >>= seqAny
;
1912 for( int i
=0; i
<seqAny
.getLength(); i
++)
1918 Any _any
= *(Any
*)seqOutParams
[4].getValue();
1919 sal_Bool _bool
= *(sal_Bool
*)seqOutParams
[5].getValue();
1920 sal_Unicode _char
= *( sal_Unicode
*) seqOutParams
[6].getValue();
1921 OUString _str
= *( rtl_uString
**)seqOutParams
[7].getValue();
1923 float _f
= *( float*)seqOutParams
[8].getValue();
1924 double _d
= *( double*) seqOutParams
[9].getValue();
1925 sal_Int8 _byte
= *( sal_Int8
*) seqOutParams
[10].getValue();
1926 sal_Int16 _short
= *( sal_Int16
*) seqOutParams
[11].getValue();
1928 sal_Int32 _long
= *( sal_Int32
*) seqOutParams
[12].getValue();
1934 // in / out parameter
1936 Reference
<XInterface
> xIntFact
= m_rFactory
->createInstance(L
"com.sun.star.bridge.oleautomation.Factory");
1938 Reference
<XMultiServiceFactory
> oleFact(xIntFact
, UNO_QUERY
);
1940 Reference
<XInterface
> xIntCallback
= oleFact
->createInstance(L
"XCallback_Impl.Callback");
1941 Reference
<XInvocation
> xInv( xIntCallback
, UNO_QUERY
);
1942 Sequence
<sal_Int16
> seqIndizes
;
1943 Sequence
<Any
> seqOutParams
;
1947 Reference
<XSimple
> xSimple
= static_cast<XSimple
*>( this);
1949 arAny
[0] <<= xSimple
;
1950 SimpleStruct aStruct
;
1951 Reference
<XIdlReflection
> xRefl( m_rFactory
->createInstance(L
"com.sun.star.reflection.CoreReflection"), UNO_QUERY
);
1954 Reference
<XIdlClass
> xClass
= xRefl
->forName(L
"oletest.SimpleStruct");
1957 xClass
->createObject( any
);
1959 if( any
.getValueTypeClass() == TypeClass_STRUCT
)
1961 SimpleStruct
* pStruct
= ( SimpleStruct
*) any
.getValue();
1962 pStruct
->message
= OUString::createFromAscii("This struct was created in OleTest");
1966 arAny
[1] <<= aStruct
;
1967 arAny
[2] <<= SimpleEnum_C
;
1970 arSeqAny
[0] <<= OUString( L
"string 0");
1971 arSeqAny
[1] <<= OUString( L
"string 1");
1972 arSeqAny
[2] <<= OUString( L
"string 2");
1974 arAny
[3] <<= Sequence
< Any
>( arAny
, 3);
1976 OUString
str(L
" Ein Any param");
1978 arAny
[5] <<= sal_False
;
1980 OUString
stringParam(L
" a string parameter");
1981 arAny
[7] <<= stringParam
;
1982 float _float
= 3.14f
;
1983 arAny
[8] <<= _float
;
1984 double _double
= 3.145;
1985 arAny
[9] <<= _double
;
1987 arAny
[10] <<= _byte
;
1988 sal_Int16 _short
= -1;
1989 arAny
[11] <<= _short
;
1990 sal_Int32 _long
= -1;
1991 arAny
[12] <<= _long
;
1993 Sequence
<Any
> params( arAny
, 13);
1995 xInv
->invoke( OUString( L
"inoutValuesAll"), params
, seqIndizes
, seqOutParams
);
1997 if( seqOutParams
.getLength() == 12)
1999 Reference
<XSimple
> xSimple
= *(XSimple
**)seqOutParams
[0].getValue();
2000 xSimple
->func( L
"Call from OleTest on XSimple");
2001 SimpleStruct aStruct
;
2002 seqOutParams
[1] >>= aStruct
;
2003 SimpleEnum aEnum
= *(SimpleEnum
*)seqOutParams
[2].getValue();
2005 Sequence
<Any
> seqAny
;
2006 seqOutParams
[3] >>= seqAny
;
2007 for( int i
=0; i
<seqAny
.getLength(); i
++)
2013 Any _any
= *(Any
*)seqOutParams
[4].getValue();
2014 sal_Bool _bool
= *(sal_Bool
*)seqOutParams
[5].getValue();
2015 sal_Unicode _char
= *( sal_Unicode
*) seqOutParams
[6].getValue();
2016 OUString _str
= *( rtl_uString
**)seqOutParams
[7].getValue();
2018 float _f
= *( float*)seqOutParams
[8].getValue();
2019 double _d
= *( double*) seqOutParams
[9].getValue();
2020 sal_Int8 _byte
= *( sal_Int8
*) seqOutParams
[10].getValue();
2021 sal_Int16 _short
= *( sal_Int16
*) seqOutParams
[11].getValue();
2023 sal_Int32 _long
= *( sal_Int32
*) seqOutParams
[12].getValue();
2030 // void inValues( [in] char aChar, [in] long aLong, [in] string aString);
2032 Reference
<XInterface
> xIntFact
= m_rFactory
->createInstance(
2033 L
"com.sun.star.bridge.oleautomation.Factory");
2035 Reference
<XMultiServiceFactory
> oleFact(xIntFact
, UNO_QUERY
);
2037 Reference
<XInterface
> xIntCallback
= oleFact
->createInstance(L
"XCallback_Impl.Callback");
2038 Reference
<XInvocation
> xInv( xIntCallback
, UNO_QUERY
);
2039 Sequence
<sal_Int16
> seqIndizes
;
2040 Sequence
<Any
> seqOutParams
;
2043 sal_Unicode aChar
=L
'a';
2045 sal_Int32 aLong
= 0xffffffff;
2047 OUString
aString(L
" a string parameter");
2048 arAny
[2] <<= aString
;
2050 xInv
->invoke( OUString( L
"inValues"), Sequence
<Any
>(arAny
,3), seqIndizes
, seqOutParams
);
2054 // ############################################################################
2056 // ############################################################################
2059 Reference
<XSimple
> simple
= xCallback
->getsimple();
2060 simple
->func(L
"OleTest calls on XSimple");
2070 void SAL_CALL
OComponent::setObject( const Reference
< XInterface
>& val
) throw (RuntimeException
)
2072 m_xIntIdentity
= val
;
2075 sal_Bool SAL_CALL
OComponent::isSame( const Reference
< XInterface
>& val
) throw (RuntimeException
)
2077 if( m_xIntIdentity
== val
)
2083 Reference
< XInterface
> SAL_CALL
OComponent::getThis( ) throw (RuntimeException
)
2085 // return Reference<XInterface>(static_cast<XIdentity*>(this), UNO_QUERY);
2086 Reference
<XInterface
> ret(static_cast<XIdentity
*>(this), UNO_QUERY
);
2090 void SAL_CALL
EventListener::disposing( const ::com::sun::star::lang::EventObject
& ) throw (RuntimeException
)
2095 // XSimple --------------------------------------------------------------------------
2096 void SAL_CALL
OComponent::func( const OUString
&message
)throw(::com::sun::star::uno::RuntimeException
)
2100 MessageBox( NULL
, W2T( message
.getStr()), _T("OleTest: XSimple::func"), MB_OK
);
2102 // XSimple --------------------------------------------------------------------------
2103 OUString SAL_CALL
OComponent::getName()throw(::com::sun::star::uno::RuntimeException
)
2107 void SAL_CALL
OComponent::testInterface2( const Reference
< XSimple
>& xSimple
, sal_Int32 mode
) throw(RuntimeException
)
2113 xSimple
->func( L
"OleTest is calling XSimple");
2114 Reference
<XSimple2
> xSimple2( xSimple
, UNO_QUERY
);
2116 xSimple2
->func2( L
"OleTest is calling XSimple2");
2117 Reference
<XSimple3
> xSimple3( xSimple
, UNO_QUERY
);
2119 xSimple3
->func3( L
"OleTest is calling XSimple3");