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