xref: /aoo4110/main/stoc/test/testintrosp.cxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_stoc.hxx"
26 
27 #include <sal/main.h>
28 #include <cppuhelper/implbase1.hxx>
29 #include <cppuhelper/implbase4.hxx>
30 #include <cppuhelper/servicefactory.hxx>
31 #include <osl/diagnose.h>
32 
33 //#include <vos/dynload.hxx>
34 
35 #include <ModuleA/XIntroTest.hpp>
36 #include <com/sun/star/beans/XPropertySet.hpp>
37 #include <com/sun/star/beans/XIntrospection.hpp>
38 #include <com/sun/star/beans/PropertyAttribute.hpp>
39 #include <com/sun/star/beans/PropertyConcept.hpp>
40 #include <com/sun/star/beans/MethodConcept.hpp>
41 #include <com/sun/star/beans/XExactName.hpp>
42 #include <com/sun/star/container/XElementAccess.hpp>
43 #include <com/sun/star/container/XNameAccess.hpp>
44 #include <com/sun/star/container/XIndexAccess.hpp>
45 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
46 #include <com/sun/star/reflection/XIdlReflection.hpp>
47 //#include <com/sun/star/registry/XSimpleRegistry.hpp>
48 #include <com/sun/star/registry/XImplementationRegistration.hpp>
49 #include <com/sun/star/lang/XComponent.hpp>
50 
51 #include <stdio.h>
52 #include <string.h>
53 
54 
55 using namespace rtl;
56 using namespace cppu;
57 //using namespace vos;
58 using namespace ModuleA;
59 //using namespace ModuleB;
60 //using namespace ModuleC;
61 //using namespace ModuleA::ModuleB;
62 using namespace com::sun::star::uno;
63 using namespace com::sun::star::lang;
64 using namespace com::sun::star::beans;
65 using namespace com::sun::star::registry;
66 using namespace com::sun::star::reflection;
67 using namespace com::sun::star::container;
68 using namespace com::sun::star::beans::PropertyAttribute;
69 
70 
71 typedef WeakImplHelper4< XIntroTest, XPropertySet, XNameAccess, XIndexAccess > ImplIntroTestHelper;
72 typedef WeakImplHelper1< XPropertySetInfo > ImplPropertySetInfoHelper;
73 
74 
75 #define DEFAULT_INDEX_ACCESS_COUNT	10
76 #define DEFAULT_NAME_ACCESS_COUNT	5
77 
78 #if OSL_DEBUG_LEVEL > 0
79 #define TEST_ENSHURE(c, m)   OSL_ENSURE(c, m)
80 #else
81 #define TEST_ENSHURE(c, m)   OSL_VERIFY(c)
82 #endif
83 
84 //class IntroTestWritelnOutput;
85 
86 
87 
88 //**************************************************************
89 //*** Hilfs-Funktion, um vom Type eine XIdlClass zu bekommen ***
90 //**************************************************************
TypeToIdlClass(const Type & rType,const Reference<XMultiServiceFactory> & xMgr)91 Reference<XIdlClass> TypeToIdlClass( const Type& rType, const Reference< XMultiServiceFactory > & xMgr )
92 {
93 	static Reference< XIdlReflection > xRefl;
94 
95 	// void als Default-Klasse eintragen
96 	Reference<XIdlClass> xRetClass;
97 	typelib_TypeDescription * pTD = 0;
98 	rType.getDescription( &pTD );
99 	if( pTD )
100 	{
101 		OUString sOWName( pTD->pTypeName );
102 		if( !xRefl.is() )
103 		{
104 			xRefl = Reference< XIdlReflection >( xMgr->createInstance(
105 				OUString::createFromAscii("com.sun.star.reflection.CoreReflection") ), UNO_QUERY );
106 			OSL_ENSURE( xRefl.is(), "### no corereflection!" );
107 		}
108 		xRetClass = xRefl->forName( sOWName );
109 	}
110 	return xRetClass;
111 }
112 
113 
114 //****************************************************
115 //*** Hilfs-Funktion, um Any als UString auszugeben ***
116 //****************************************************
117 // ACHTUNG: Kann mal an eine zentrale Stelle uebernommen werden
118 // Wird zunaechst nur fuer einfache Datentypen ausgefuehrt
119 
AnyToString(const Any & aValue,sal_Bool bIncludeType,const Reference<XMultiServiceFactory> & xMgr)120 OUString AnyToString( const Any& aValue, sal_Bool bIncludeType, const Reference< XMultiServiceFactory > & xMgr )
121 {
122 	Type aValType = aValue.getValueType();
123 	TypeClass eType = aValType.getTypeClass();
124 	char pBuffer[50];
125 
126 	OUString aRetStr;
127 	switch( eType )
128 	{
129 		case TypeClass_TYPE:			aRetStr = OUString::createFromAscii("TYPE TYPE");				break;
130 		case TypeClass_INTERFACE:		aRetStr = OUString::createFromAscii("TYPE INTERFACE");		break;
131 		case TypeClass_SERVICE:			aRetStr = OUString::createFromAscii("TYPE SERVICE");			break;
132 		case TypeClass_STRUCT:			aRetStr = OUString::createFromAscii("TYPE STRUCT");			break;
133 		case TypeClass_TYPEDEF:			aRetStr = OUString::createFromAscii("TYPE TYPEDEF");			break;
134 		case TypeClass_UNION:			aRetStr = OUString::createFromAscii("TYPE UNION");			break;
135 		case TypeClass_ENUM:			aRetStr = OUString::createFromAscii("TYPE ENUM");				break;
136 		case TypeClass_EXCEPTION:		aRetStr = OUString::createFromAscii("TYPE EXCEPTION");		break;
137 		case TypeClass_ARRAY:			aRetStr = OUString::createFromAscii("TYPE ARRAY");			break;
138 		case TypeClass_SEQUENCE:		aRetStr = OUString::createFromAscii("TYPE SEQUENCE");			break;
139 		case TypeClass_VOID:			aRetStr = OUString::createFromAscii("TYPE void");				break;
140 		case TypeClass_ANY:				aRetStr = OUString::createFromAscii("TYPE any");				break;
141 		case TypeClass_UNKNOWN:			aRetStr = OUString::createFromAscii("TYPE unknown");			break;
142 		case TypeClass_BOOLEAN:
143 		{
144 			sal_Bool b = *(sal_Bool*)aValue.getValue();
145 			//aRet.setValue( &b, getCppuBooleanType() );
146 			//aValue >>= b;
147 			aRetStr = OUString::valueOf( b );
148 			break;
149 		}
150 		case TypeClass_CHAR:
151 		{
152 			sal_Unicode c = *(sal_Unicode*)aValue.getValue();
153 			//aValue >>= c;
154 			//getCppuCharType()
155 			aRetStr = OUString::valueOf( c );
156 			break;
157 		}
158 		case TypeClass_STRING:
159 		{
160 			aValue >>= aRetStr;
161 			break;
162 		}
163 		case TypeClass_FLOAT:
164 		{
165 			float f(0.0);
166 			aValue >>= f;
167             snprintf( pBuffer, sizeof( pBuffer ), "%f", f );
168 			aRetStr = OUString( pBuffer, strlen( pBuffer ), RTL_TEXTENCODING_ASCII_US );
169 			break;
170 		}
171 		case TypeClass_DOUBLE:
172 		{
173 			double d(0.0);
174 			aValue >>= d;
175             snprintf( pBuffer, sizeof( pBuffer ), "%f", d );
176 			aRetStr = OUString( pBuffer, strlen( pBuffer ), RTL_TEXTENCODING_ASCII_US );
177 			break;
178 		}
179 		case TypeClass_BYTE:
180 		{
181 			sal_Int8 n(0);
182 			aValue >>= n;
183 			aRetStr = OUString::valueOf( (sal_Int32) n );
184 			break;
185 		}
186 		case TypeClass_SHORT:
187 		{
188 			sal_Int16 n(0);
189 			aValue >>= n;
190 			aRetStr = OUString::valueOf( (sal_Int32) n );
191 			break;
192 		}
193 		case TypeClass_LONG:
194 		{
195 			sal_Int32 n(0);
196 			aValue >>= n;
197 			aRetStr = OUString::valueOf( n );
198 			break;
199 		}
200 		/*
201 		case TypeClass_HYPER:
202 		{
203 			aRetStr = L"TYPE HYPER";
204 			break;
205 		}
206 		case TypeClass_UNSIGNED_SHORT:
207 		{
208 			aRetStr = StringToUString(WSString(aValue.getUINT16()), CHARSET_SYSTEM);
209 			break;
210 		}
211 		case TypeClass_UNSIGNED_LONG:
212 		{
213 			aRetStr = StringToUString(WSString(aValue.getUINT32()), CHARSET_SYSTEM);
214 			break;
215 		}
216 		case TypeClass_UNSIGNED_HYPER:
217 		{
218 			aRetStr = L"TYPE UNSIGNED_HYPER";
219 			break;
220 		}
221 		*/
222 	default: ;
223 	}
224 
225 	if( bIncludeType )
226 	{
227 		Reference< XIdlClass > xIdlClass = TypeToIdlClass( aValType, xMgr );
228 		aRetStr = aRetStr + OUString( OUString::createFromAscii(" (Typ: ") ) + xIdlClass->getName() + OUString::createFromAscii(")");
229 	}
230 	return aRetStr;
231 }
232 
233 /*
234 // Hilfs-Funktion, um ein UString in einen Any zu konvertieren
235 UsrAny StringToAny( UString aStr, TypeClass eTargetType )
236 {
237 	UsrAny aRetAny;
238 	switch( eTargetType )
239 	{
240 		case TypeClass_INTERFACE:		break;
241 		case TypeClass_SERVICE:			break;
242 		case TypeClass_STRUCT:			break;
243 		case TypeClass_TYPEDEF:			break;
244 		case TypeClass_UNION:			break;
245 		case TypeClass_ENUM:			break;
246 		case TypeClass_EXCEPTION:		break;
247 		case TypeClass_ARRAY:			break;
248 		case TypeClass_SEQUENCE:		break;
249 		case TypeClass_VOID:			break;
250 		case TypeClass_ANY:				break;
251 		case TypeClass_UNKNOWN:			break;
252 		case TypeClass_BOOLEAN:			aRetAny.setBOOL( short(aStr)!=0 );	break;
253 		case TypeClass_CHAR:			aRetAny.setChar( char(aStr) );		break;
254 		case TypeClass_STRING:			aRetAny.setString( aStr );			break;
255 		case TypeClass_FLOAT:			aRetAny.setFloat( (float)strtod( aStr.GetStr(), NULL ) );	break;
256 		case TypeClass_DOUBLE:			aRetAny.setDouble( strtod( aStr.GetStr(), NULL ) );	break;
257 		case TypeClass_BYTE:			aRetAny.setBYTE( BYTE(short(aStr)) );	break;
258 		case TypeClass_SHORT:			aRetAny.setINT16( short(aStr) );	break;
259 		case TypeClass_LONG:			aRetAny.setINT32( long(aStr) );		break;
260 		case TypeClass_HYPER:			break;
261 		case TypeClass_UNSIGNED_SHORT:	aRetAny.setUINT16( USHORT(aStr) );	break;
262 		case TypeClass_UNSIGNED_LONG:	aRetAny.setUINT32( ULONG(aStr) );	break;
263 		case TypeClass_UNSIGNED_HYPER:	break;
264 	}
265 	return aRetAny;
266 }
267 */
268 
269 
270 //*****************************************
271 //*** XPropertySetInfo fuer Test-Klasse ***
272 //*****************************************
273 
274 class ImplPropertySetInfo : public ImplPropertySetInfoHelper
275 {
276  	friend class ImplIntroTest;
277 
278   	Reference< XMultiServiceFactory > mxMgr;
279 
280 public:
ImplPropertySetInfo(const Reference<XMultiServiceFactory> & xMgr)281 	ImplPropertySetInfo( const Reference< XMultiServiceFactory > & xMgr )
282 		: mxMgr( xMgr ) {}
283 		//: mxMgr( xMgr ), ImplPropertySetInfoHelper( xMgr ) {}
284 
285 /*
286 	// Methoden von XInterface
287 	virtual sal_Bool	SAL_CALL queryInterface( const Uik & rUik, Any & ifc ) throw( RuntimeException );
288 	virtual void		SAL_CALL acquire() throw() { OWeakObject::acquire(); }
289 	virtual void		SAL_CALL release() throw() { OWeakObject::release(); }
290 	//ALT: sal_Bool queryInterface( Uik aUik, Reference<XInterface> & rOut );
291 */
292 
293     // Methods of XPropertySetInfo
294     virtual Sequence< Property > SAL_CALL getProperties(  )
295 		throw(RuntimeException);
296     virtual Property SAL_CALL getPropertyByName( const OUString& aName )
297 		throw(UnknownPropertyException, RuntimeException);
298     virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name )
299 		throw(RuntimeException);
300     //virtual Sequence< Property > SAL_CALL getProperties(void) throw( RuntimeException );
301     //virtual Property SAL_CALL getPropertyByName(const OUString& Name) throw( RuntimeException );
302     //virtual sal_Bool SAL_CALL hasPropertyByName(const OUString& Name) throw( RuntimeException );
303 };
304 
305 
306 /*
307 // Methoden von XInterface
308 sal_Bool SAL_CALL ImplPropertySetInfo::queryInterface( const Uik & rUik, Any & ifc )
309 	throw( RuntimeException )
310 {
311 	// PropertySet-Implementation
312 	if( com::sun::star::uno::queryInterface( rUik, ifc,
313 											 SAL_STATIC_CAST(XPropertySetInfo*, this) ) )
314 		return sal_True;
315 
316 	return OWeakObject::queryInterface( rUik, ifc );
317 }
318 
319 sal_Bool ImplPropertySetInfo::queryInterface( Uik aUik, Reference<XInterface> & rOut )
320 {
321 	if( aUik == XPropertySetInfo::getSmartUik() )
322 		rOut = (XPropertySetInfo *)this;
323 	else
324 		UsrObject::queryInterface( aUik, rOut );
325 	return rOut.is();
326 }
327 */
328 
getProperties(void)329 Sequence< Property > ImplPropertySetInfo::getProperties(void)
330 	throw( RuntimeException )
331 {
332 	static Sequence<Property> * pSeq = NULL;
333 
334 	if( !pSeq )
335 	{
336 		// die Informationen f�r die Properties "Width", "Height" und "Name" anlegen
337 		pSeq = new Sequence<Property>( 3 );
338 		Property * pAry = pSeq->getArray();
339 
340 		pAry[0].Name = OUString::createFromAscii("Factor");
341 		pAry[0].Handle = -1;
342 		pAry[0].Type = getCppuType( (double*) NULL );
343 		//pAry[0].Type = TypeToIdlClass( getCppuType( (double*) NULL ), mxMgr );
344 		//pAry[0].Type = Double_getReflection()->getIdlClass();
345 		pAry[0].Attributes = BOUND | TRANSIENT;
346 
347 		pAry[1].Name = OUString::createFromAscii("MyCount");
348 		pAry[1].Handle = -1;
349 		pAry[1].Type = getCppuType( (sal_Int32*) NULL );
350 		//pAry[1].Type = TypeToIdlClass( getCppuType( (sal_Int32*) NULL ), mxMgr );
351 		//pAry[1].Type = INT32_getReflection()->getIdlClass();
352 		pAry[1].Attributes = BOUND | TRANSIENT;
353 
354 		pAry[2].Name = OUString::createFromAscii("Info");
355 		pAry[2].Handle = -1;
356 		pAry[2].Type = getCppuType( (OUString*) NULL );
357 		//pAry[2].Type = TypeToIdlClass( getCppuType( (OUString*) NULL ), mxMgr );
358 		//pAry[2].Type = OUString_getReflection()->getIdlClass();
359 		pAry[2].Attributes = TRANSIENT;
360 	}
361 	// Die Information �ber alle drei Properties liefern.
362 	return *pSeq;
363 }
364 
getPropertyByName(const OUString & Name)365 Property ImplPropertySetInfo::getPropertyByName(const OUString& Name)
366 	throw( UnknownPropertyException, RuntimeException )
367 {
368 	Sequence<Property> aSeq = getProperties();
369 	const Property * pAry = aSeq.getConstArray();
370 
371 	for( sal_Int32 i = aSeq.getLength(); i--; )
372 	{
373 		if( pAry[i].Name == Name )
374 			return pAry[i];
375 	}
376 	// Property unbekannt, also leere liefern
377 	return Property();
378 }
379 
hasPropertyByName(const OUString & Name)380 sal_Bool ImplPropertySetInfo::hasPropertyByName(const OUString& Name)
381 	throw( RuntimeException )
382 {
383 	Sequence<Property> aSeq = getProperties();
384 	const Property * pAry = aSeq.getConstArray();
385 
386 	for( sal_Int32 i = aSeq.getLength(); i--; )
387 	{
388 		if( pAry[i].Name == Name )
389 			return sal_True;
390 	}
391 	// Property unbekannt, also leere liefern
392 	return sal_False;
393 }
394 
395 
396 
397 
398 //*****************************************************************
399 
400 
401 
402 class ImplIntroTest : public ImplIntroTestHelper
403 {
404   	Reference< XMultiServiceFactory > mxMgr;
405 
406 	friend class ImplPropertySetInfo;
407 
408 	// Properties fuer das PropertySet
409 	Any aAnyArray[10];
410 
411 	// Optionale Schnittstelle fuer die writeln-Ausgabe
412 	//IntroTestWritelnOutput* m_pOutput;
413 
414 	Reference< XPropertySetInfo > m_xMyInfo;
415 
416 	OUString m_ObjectName;
417 
418 	sal_Int16 m_nMarkusAge;
419 	sal_Int16 m_nMarkusChildrenCount;
420 
421 	long m_lDroenk;
422 	sal_Int16 m_nBla;
423 	sal_Int16 m_nBlub;
424 	sal_Int16 m_nGulp;
425 	sal_Int16 m_nLaber;
426 	TypeClass eTypeClass;
427 	Sequence< OUString > aStringSeq;
428 	Sequence< Sequence< Sequence< sal_Int16 > > > aMultSeq;
429 	Reference< XIntroTest > m_xIntroTest;
430 
431 	// Daten fuer NameAccess
432 	Reference< XIntroTest >* pNameAccessTab;
433 
434 	// Daten fuer IndexAccess
435 	Reference< XIntroTest >* pIndexAccessTab;
436 	sal_Int16 iIndexAccessCount;
437 
438 	// struct-Properties
439     Property m_aFirstStruct;
440     PropertyValue m_aSecondStruct;
441 
442 	// Listener merken (zunaechst einfach, nur einen pro Property)
443 	Reference< XPropertyChangeListener > aPropChangeListener;
444 	OUString aPropChangeListenerStr;
445 	Reference< XVetoableChangeListener > aVetoPropChangeListener;
446 	OUString aVetoPropChangeListenerStr;
447 
448 	void Init( void );
449 
450 public:
ImplIntroTest(const Reference<XMultiServiceFactory> & xMgr)451 	ImplIntroTest( const Reference< XMultiServiceFactory > & xMgr )
452 		: mxMgr( xMgr )
453 		//: mxMgr( xMgr ), ImplIntroTestHelper( xMgr )
454 	{
455 		Init();
456 	}
457 
458 	/*
459 	ImplIntroTest( IntroTestWritelnOutput* pOutput_ )
460 	{
461 		Init();
462 		m_pOutput = pOutput_;
463 	}
464 	*/
465 
466 	//SMART_UNO_DECLARATION(ImplIntroTest,UsrObject);
467 
468 	//BOOL queryInterface( Uik aUik, Reference< XInterface > & rOut );
469 	//Reference< XIdlClass > getIdlClass();
470 
471 	// Trotz virtual inline, um Schreibarbeit zu sparen (nur fuer Testzwecke)
472 	// XPropertySet
473     virtual Reference< XPropertySetInfo > SAL_CALL getPropertySetInfo(  )
474 		throw(RuntimeException);
475     virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const Any& aValue )
476 		throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException);
477     virtual Any SAL_CALL getPropertyValue( const OUString& PropertyName )
478 		throw(UnknownPropertyException, WrappedTargetException, RuntimeException);
addPropertyChangeListener(const OUString &,const Reference<XPropertyChangeListener> &)479     virtual void SAL_CALL addPropertyChangeListener( const OUString& /*aPropertyName*/, const Reference< XPropertyChangeListener >& /*xListener*/ )
480 		throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
481 			{}
removePropertyChangeListener(const OUString &,const Reference<XPropertyChangeListener> &)482     virtual void SAL_CALL removePropertyChangeListener( const OUString& /*aPropertyName*/, const Reference< XPropertyChangeListener >& /*aListener*/ )
483 		throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
484 			{}
addVetoableChangeListener(const OUString &,const Reference<XVetoableChangeListener> &)485     virtual void SAL_CALL addVetoableChangeListener( const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener >& /*aListener*/ )
486 		throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
487 			{}
removeVetoableChangeListener(const OUString &,const Reference<XVetoableChangeListener> &)488     virtual void SAL_CALL removeVetoableChangeListener( const OUString& /*PropertyName*/, const Reference< XVetoableChangeListener >& /*aListener*/ )
489 		throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
490 			{}
491 
492 	/*
493     virtual void setIndexedPropertyValue(const OUString& aPropertyName, INT32 nIndex, const Any& aValue) {}
494     virtual Any getIndexedPropertyValue(const UString& aPropertyName, INT32 nIndex) const { return Any(); }
495     virtual void addPropertyChangeListener(const UString& aPropertyName, const XPropertyChangeListenerRef& aListener)
496 		THROWS( (UnknownPropertyException, WrappedTargetException, UsrSystemException) ) {}
497     virtual void removePropertyChangeListener(const UString& aPropertyName, const XPropertyChangeListenerRef& aListener)
498 		THROWS( (UnknownPropertyException, WrappedTargetException, UsrSystemException) ) {}
499     virtual void addVetoableChangeListener(const UString& aPropertyName, const XVetoableChangeListenerRef& aListener)
500 		THROWS( (UnknownPropertyException, WrappedTargetException, UsrSystemException) ) {}
501     virtual void removeVetoableChangeListener(const UString& aPropertyName, const XVetoableChangeListenerRef& aListener)
502 		THROWS( (UnknownPropertyException, WrappedTargetException, UsrSystemException) ) {}
503 		*/
504 
505 	// XIntroTest-Methoden
506     // Attributes
getObjectName()507     virtual OUString SAL_CALL getObjectName() throw(RuntimeException)
508 		{ return m_ObjectName; }
setObjectName(const OUString & _objectname)509     virtual void SAL_CALL setObjectName( const OUString& _objectname ) throw(RuntimeException)
510 		{ m_ObjectName = _objectname; }
511     virtual OUString SAL_CALL getFirstName()
512 		throw(RuntimeException);
getLastName()513     virtual OUString SAL_CALL getLastName() throw(RuntimeException)
514 		{ return OUString( OUString::createFromAscii("Meyer") ); }
getAge()515     virtual sal_Int16 SAL_CALL getAge() throw(RuntimeException)
516 		{ return m_nMarkusAge; }
getChildrenCount()517     virtual sal_Int16 SAL_CALL getChildrenCount() throw(RuntimeException)
518 		{ return m_nMarkusChildrenCount; }
setChildrenCount(sal_Int16 _childrencount)519     virtual void SAL_CALL setChildrenCount( sal_Int16 _childrencount ) throw(RuntimeException)
520 		{ m_nMarkusChildrenCount = _childrencount; }
getFirstStruct()521     virtual Property SAL_CALL getFirstStruct() throw(RuntimeException)
522 		{ return m_aFirstStruct; }
setFirstStruct(const Property & _firststruct)523     virtual void SAL_CALL setFirstStruct( const Property& _firststruct ) throw(RuntimeException)
524 		{ m_aFirstStruct = _firststruct; }
getSecondStruct()525     virtual PropertyValue SAL_CALL getSecondStruct() throw(RuntimeException)
526 		{ return m_aSecondStruct; }
setSecondStruct(const PropertyValue & _secondstruct)527     virtual void SAL_CALL setSecondStruct( const PropertyValue& _secondstruct ) throw(RuntimeException)
528 		{ m_aSecondStruct = _secondstruct; }
529 
530     // Methods
531     virtual void SAL_CALL writeln( const OUString& Text )
532 		throw(RuntimeException);
getDroenk()533     virtual sal_Int32 SAL_CALL getDroenk(  ) throw(RuntimeException)
534 		{ return m_lDroenk; }
535     virtual Reference< ::ModuleA::XIntroTest > SAL_CALL getIntroTest(  ) throw(RuntimeException);
getUps(sal_Int32 l)536     virtual sal_Int32 SAL_CALL getUps( sal_Int32 l ) throw(RuntimeException)
537 		{ return 2*l; }
setDroenk(sal_Int32 l)538     virtual void SAL_CALL setDroenk( sal_Int32 l ) throw(RuntimeException)
539 		{ m_lDroenk = l; }
getBla()540     virtual sal_Int16 SAL_CALL getBla(  ) throw(RuntimeException)
541 		{ return m_nBla; }
setBla(sal_Int32 n)542     virtual void SAL_CALL setBla( sal_Int32 n ) throw(RuntimeException)
543 		{ m_nBla = (sal_Int16)n; }
getBlub()544     virtual sal_Int16 SAL_CALL getBlub(  ) throw(RuntimeException)
545 		{ return m_nBlub; }
setBlub(sal_Int16 n)546     virtual void SAL_CALL setBlub( sal_Int16 n ) throw(RuntimeException)
547 		{ m_nBlub = n; }
getGulp()548     virtual sal_Int16 SAL_CALL getGulp(  ) throw(RuntimeException)
549 		{ return m_nGulp; }
setGulp(sal_Int16 n)550     virtual sal_Int16 SAL_CALL setGulp( sal_Int16 n ) throw(RuntimeException)
551 		{ m_nGulp = n; return 1; }
getTypeClass(sal_Int16)552     virtual TypeClass SAL_CALL getTypeClass( sal_Int16 /*n*/ ) throw(RuntimeException)
553 		{ return eTypeClass; }
setTypeClass(TypeClass t,double,double)554     virtual void SAL_CALL setTypeClass( TypeClass t, double /*d1*/, double /*d2*/ ) throw(RuntimeException)
555 		{ eTypeClass = t; }
getStrings()556     virtual Sequence< OUString > SAL_CALL getStrings(  ) throw(RuntimeException)
557 		{ return aStringSeq; }
setStrings(const Sequence<OUString> & Strings)558     virtual void SAL_CALL setStrings( const Sequence< OUString >& Strings ) throw(RuntimeException)
559 		{ aStringSeq = Strings; }
setStringsPerMethod(const Sequence<OUString> & Strings,sal_Int16)560     virtual void SAL_CALL setStringsPerMethod( const Sequence< OUString >& Strings, sal_Int16 /*n*/ ) throw(RuntimeException)
561 		{ aStringSeq = Strings; }
getMultiSequence()562     virtual Sequence< Sequence< Sequence< sal_Int16 > > > SAL_CALL getMultiSequence(  ) throw(RuntimeException)
563 		{ return aMultSeq; }
setMultiSequence(const Sequence<Sequence<Sequence<sal_Int16>>> & Seq)564     virtual void SAL_CALL setMultiSequence( const Sequence< Sequence< Sequence< sal_Int16 > > >& Seq ) throw(RuntimeException)
565 		{ aMultSeq = Seq; }
566     virtual void SAL_CALL addPropertiesChangeListener( const Sequence< OUString >& PropertyNames, const Reference< XPropertiesChangeListener >& Listener )
567 		throw(RuntimeException);
568     virtual void SAL_CALL removePropertiesChangeListener( const Reference< XPropertiesChangeListener >& Listener )
569 		throw(RuntimeException);
570 
571 
572     // Methods of XElementAccess
573     virtual Type SAL_CALL getElementType(  )
574 		throw(RuntimeException);
575     virtual sal_Bool SAL_CALL hasElements(  )
576 		throw(RuntimeException);
577     //virtual XIdlClassRef getElementType(void) constTHROWS( (UsrSystemException) );
578     //virtual BOOL hasElements(void) const THROWS( (UsrSystemException) );
579 
580 	// XNameAccess-Methoden
581     // Methods
582     virtual Any SAL_CALL getByName( const OUString& aName )
583 		throw(NoSuchElementException, WrappedTargetException, RuntimeException);
584     virtual Sequence< OUString > SAL_CALL getElementNames(  )
585 		throw(RuntimeException);
586     virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
587 		throw(RuntimeException);
588     //virtual Any getByName(const UString& Name) const
589 		//THROWS( (NoSuchElementException, WrappedTargetException, UsrSystemException) );
590     //virtual Sequence<UString> getElementNames(void) const THROWS( (UsrSystemException) );
591     //virtual BOOL hasByName(const UString& Name) const THROWS( (UsrSystemException) );
592 
593 	// XIndexAccess-Methoden
594     // Methods
595     virtual sal_Int32 SAL_CALL getCount(  )
596 		throw(RuntimeException);
597     virtual Any SAL_CALL getByIndex( sal_Int32 Index )
598 		throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException);
599     //virtual INT32 getCount(void) const THROWS( (UsrSystemException) );
600     //virtual Any getByIndex(INT32 Index) const
601 		//THROWS( (IndexOutOfBoundsException, WrappedTargetException, UsrSystemException) );
602 };
603 
604 //SMART_UNO_IMPLEMENTATION(ImplIntroTest,UsrObject)
605 
Init(void)606 void ImplIntroTest::Init( void )
607 {
608 	// Eindeutigen Namen verpassen
609 	static sal_Int32 nObjCount = 0;
610 	OUString aName( OUString::createFromAscii("IntroTest-Obj Nr. ") );
611 	aName += OUString::valueOf( nObjCount );
612 	setObjectName( aName );
613 
614 	// Properties initialisieren
615 	aAnyArray[0] <<= 3.14;
616 	aAnyArray[1] <<= (sal_Int32)42;
617 	aAnyArray[2] <<= OUString( OUString::createFromAscii("Hallo") );
618 
619 	// Output-Interface
620 	//m_pOutput = NULL;
621 
622 	// Einmal fuer den internen Gebrauch die PropertySetInfo abholen
623 	m_xMyInfo = getPropertySetInfo();
624 	m_xMyInfo->acquire();		// sonst raucht es am Programm-Ende ab
625 
626 	m_nMarkusAge = 33;
627 	m_nMarkusChildrenCount = 2;
628 
629 	m_lDroenk = 314;
630 	m_nBla = 42;
631 	m_nBlub = 111;
632 	m_nGulp = 99;
633 	m_nLaber = 1;
634 	eTypeClass = TypeClass_INTERFACE;
635 
636 	// String-Sequence intitialisieren
637 	aStringSeq.realloc( 3 );
638 	OUString* pStr = aStringSeq.getArray();
639 	pStr[ 0 ] = OUString( OUString::createFromAscii("String 0") );
640 	pStr[ 1 ] = OUString( OUString::createFromAscii("String 1") );
641 	pStr[ 2 ] = OUString( OUString::createFromAscii("String 2") );
642 
643     // structs initialisieren
644     m_aFirstStruct.Name = OUString::createFromAscii("FirstStruct-Name");
645     m_aFirstStruct.Handle = 77777;
646     //XIdlClassRef Type;
647     m_aFirstStruct.Attributes = -222;
648 
649     //XInterfaceRef Source;
650 	Any Value;
651 	Value <<= 2.718281828459;
652     m_aSecondStruct.Value = Value;
653     //XIdlClassRef ListenerType;
654     m_aSecondStruct.State = PropertyState_DIRECT_VALUE;
655 
656 	// IndexAccess
657 	iIndexAccessCount = DEFAULT_INDEX_ACCESS_COUNT;
658 	pIndexAccessTab = NULL;
659 	pNameAccessTab = NULL;
660 }
661 
662 /*
663 BOOL ImplIntroTest::queryInterface( Uik aUik, XInterfaceRef & rOut )
664 {
665 	if( aUik == XIntroTest::getSmartUik() )
666 		rOut = (XIntroTest*)this;
667 	else if( aUik == XPropertySet::getSmartUik() )
668 		rOut = (XPropertySet*)this;
669 	else if( aUik == XNameAccess::getSmartUik() )
670 		rOut = (XNameAccess*)this;
671 	else if( aUik == XIndexAccess::getSmartUik() )
672 		rOut = (XIndexAccess*)this;
673 	else if( aUik == ((XElementAccess*)NULL)->getSmartUik() )
674 		rOut = (XElementAccess*)(XIndexAccess *)this;
675 	else
676 		UsrObject::queryInterface( aUik, rOut );
677 	return rOut.is();
678 }
679 
680 XIdlClassRef ImplIntroTest::getIdlClass()
681 {
682 	static XIdlClassRef xClass = createStandardClass( L"ImplIntroTest",
683 		UsrObject::getUsrObjectIdlClass(), 4,
684 			XIntroTest_getReflection(),
685 			XPropertySet_getReflection(),
686 			XNameAccess_getReflection(),
687 			XIndexAccess_getReflection() );
688 	return xClass;
689 }
690 */
691 
getPropertySetInfo()692 Reference< XPropertySetInfo > ImplIntroTest::getPropertySetInfo()
693 	throw(RuntimeException)
694 {
695 	static ImplPropertySetInfo aInfo( mxMgr );
696 	// Alle Objekt haben die gleichen Properties, deshalb kann
697 	// die Info f�r alle gleich sein
698 	return &aInfo;
699 
700 	//if( m_xMyInfo == NULL )
701 	//	((ImplIntroTest*)this)->m_xMyInfo = new ImplPropertySetInfo( this );
702 	//return m_xMyInfo;
703 }
704 
setPropertyValue(const OUString & aPropertyName,const Any & aValue)705 void ImplIntroTest::setPropertyValue( const OUString& aPropertyName, const Any& aValue )
706 	throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException)
707 //void ImplIntroTest::setPropertyValue( const UString& aPropertyName, const Any& aValue )
708 //	THROWS( (UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, UsrSystemException) )
709 {
710 	if( aPropChangeListener.is() && aPropertyName == aPropChangeListenerStr )
711 	{
712 		PropertyChangeEvent aEvt;
713 		aEvt.Source = (OWeakObject*)this;
714 		aEvt.PropertyName = aPropertyName;
715 		aEvt.PropertyHandle = 0L;
716 		//aEvt.OldValue;
717 		//aEvt.NewValue;
718 		//aEvt.PropagationId;
719 		aPropChangeListener->propertyChange( aEvt );
720 	}
721 	if( aVetoPropChangeListener.is() && aPropertyName == aVetoPropChangeListenerStr )
722 	{
723 		PropertyChangeEvent aEvt;
724 		aEvt.Source = (OWeakObject*)this;
725 		aEvt.PropertyName = aVetoPropChangeListenerStr;
726 		aEvt.PropertyHandle = 0L;
727 		//aEvt.OldValue;
728 		//aEvt.NewValue;
729 		//aEvt.PropagationId;
730 		aVetoPropChangeListener->vetoableChange( aEvt );
731 	}
732 
733 	Sequence<Property> aPropSeq = m_xMyInfo->getProperties();
734 	sal_Int32 nLen = aPropSeq.getLength();
735 	for( sal_Int32 i = 0 ; i < nLen ; i++ )
736 	{
737 		Property aProp = aPropSeq.getArray()[ i ];
738 		if( aProp.Name == aPropertyName )
739 			aAnyArray[i] = aValue;
740 	}
741 }
742 
getPropertyValue(const OUString & PropertyName)743 Any ImplIntroTest::getPropertyValue( const OUString& PropertyName )
744 	throw(UnknownPropertyException, WrappedTargetException, RuntimeException)
745 //Any ImplIntroTest::getPropertyValue(const UString& aPropertyName) const
746 	//THROWS( (UnknownPropertyException, WrappedTargetException, UsrSystemException) )
747 {
748 	Sequence<Property> aPropSeq = m_xMyInfo->getProperties();
749 	sal_Int32 nLen = aPropSeq.getLength();
750 	for( sal_Int32 i = 0 ; i < nLen ; i++ )
751 	{
752 		Property aProp = aPropSeq.getArray()[ i ];
753 		if( aProp.Name == PropertyName )
754 			return aAnyArray[i];
755 	}
756 	return Any();
757 }
758 
getFirstName(void)759 OUString ImplIntroTest::getFirstName(void)
760 	throw(RuntimeException)
761 {
762 	return OUString( OUString::createFromAscii("Markus") );
763 }
764 
writeln(const OUString & Text)765 void ImplIntroTest::writeln( const OUString& Text )
766 	throw(RuntimeException)
767 {
768 	OString aStr( Text.getStr(), Text.getLength(), RTL_TEXTENCODING_ASCII_US );
769 
770 	// Haben wir ein Output?
771 	//if( m_pOutput )
772 	//{
773 		//m_pOutput->doWriteln( TextStr );
774 	//}
775 	// Sonst einfach rausbraten
776 	//else
777 	{
778 		printf( "%s", aStr.getStr() );
779 	}
780 }
781 
getIntroTest()782 Reference< XIntroTest > ImplIntroTest::getIntroTest()
783 	throw(RuntimeException)
784 //XIntroTestRef ImplIntroTest::getIntroTest(void) THROWS( (UsrSystemException) )
785 {
786 	if( !m_xIntroTest.is() )
787 		m_xIntroTest = new ImplIntroTest( mxMgr );
788 	return m_xIntroTest;
789 }
790 
791 // Methoden von XElementAccess
getElementType()792 Type ImplIntroTest::getElementType(  )
793 	throw(RuntimeException)
794 //XIdlClassRef ImplIntroTest::getElementType(void) const THROWS( (UsrSystemException) )
795 {
796 	// TODO
797 	Type aRetType;
798 	return aRetType;
799 	//return Reference< XIdlClass >();
800 	//return Void_getReflection()->getIdlClass();
801 }
802 
hasElements()803 sal_Bool ImplIntroTest::hasElements(  )
804 	throw(RuntimeException)
805 //BOOL ImplIntroTest::hasElements(void) const THROWS( (UsrSystemException) )
806 {
807 	return sal_True;
808 }
809 
810 // XNameAccess-Methoden
getIndexForName(const OUString & ItemName)811 sal_Int32 getIndexForName( const OUString& ItemName )
812 {
813 	OUString aLeftStr = ItemName.copy( 0, 4 );
814 	if( aLeftStr == OUString::createFromAscii("Item") )
815 	{
816 		// TODO
817 		OUString aNumStr = ItemName.copy( 4 );
818 		//sal_Int32 iIndex = (INT32)UStringToString( aNumStr, CHARSET_SYSTEM );
819 		//if( iIndex < DEFAULT_NAME_ACCESS_COUNT )
820 			//return iIndex;
821 	}
822 	return -1;
823 }
824 
825 
getByName(const OUString & aName)826 Any ImplIntroTest::getByName( const OUString& aName )
827 	throw(NoSuchElementException, WrappedTargetException, RuntimeException)
828 //Any ImplIntroTest::getByName(const UString& Name) const
829 	//THROWS( (NoSuchElementException, WrappedTargetException, UsrSystemException) )
830 {
831 	Any aRetAny;
832 
833 	if( !pNameAccessTab  )
834 		((ImplIntroTest*)this)->pNameAccessTab  = new Reference< XIntroTest >[ DEFAULT_NAME_ACCESS_COUNT ];
835 
836 	sal_Int32 iIndex = getIndexForName( aName );
837 	if( iIndex != -1 )
838 	{
839 		if( !pNameAccessTab[iIndex].is() )
840 		{
841 			ImplIntroTest* p = new ImplIntroTest( mxMgr );
842 			OUString aName2( OUString::createFromAscii("IntroTest by Name-Access, Index = ") );
843 			aName2 += OUString::valueOf( iIndex );
844 			//aName2 = aName2 + StringToUString( String( iIndex ), CHARSET_SYSTEM );
845 			p->setObjectName( aName2 );
846 			pNameAccessTab[iIndex] = p;
847 		}
848 
849 		Reference< XIntroTest > xRet = pNameAccessTab[iIndex];
850 		aRetAny = makeAny( xRet );
851 
852 		//aRetAny.set( &xRet, XIntroTest_getReflection() );
853 		//return (UsrObject*)(XIntroTest*)pNameAccessTab[iIndex];
854 	}
855 	return aRetAny;
856 }
857 
getElementNames()858 Sequence< OUString > ImplIntroTest::getElementNames(  )
859 	throw(RuntimeException)
860 //Sequence<UString> ImplIntroTest::getElementNames(void) const THROWS( (UsrSystemException) )
861 {
862 	Sequence<OUString> aStrSeq( DEFAULT_NAME_ACCESS_COUNT );
863 	OUString* pStr = aStrSeq.getArray();
864 	for( sal_Int32 i = 0 ; i < DEFAULT_NAME_ACCESS_COUNT ; i++ )
865 	{
866 		OUString aName( OUString::createFromAscii("Item") );
867 		aName += OUString::valueOf( i );
868 		//aName = aName + StringToUString( i, CHARSET_SYSTEM );
869 		pStr[i] = aName;
870 	}
871 	return aStrSeq;
872 }
873 
hasByName(const OUString & aName)874 sal_Bool ImplIntroTest::hasByName( const OUString& aName )
875 	throw(RuntimeException)
876 //BOOL ImplIntroTest::hasByName(const UString& Name) const THROWS( (UsrSystemException) )
877 {
878 	return ( getIndexForName( aName ) != -1 );
879 }
880 
881 // XIndexAccess-Methoden
getCount()882 sal_Int32 ImplIntroTest::getCount(  )
883 	throw(RuntimeException)
884 //sal_Int32 ImplIntroTest::getCount(void) const THROWS( (UsrSystemException) )
885 {
886 	return iIndexAccessCount;
887 }
888 
getByIndex(sal_Int32 Index)889 Any ImplIntroTest::getByIndex( sal_Int32 Index )
890 	throw(IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
891 //Any ImplIntroTest::getByIndex( sal_Int32 Index ) const
892 	//THROWS( (IndexOutOfBoundsException, WrappedTargetException, UsrSystemException) )
893 {
894 	Any aRetAny;
895 
896 	if( !pIndexAccessTab )
897 		((ImplIntroTest*)this)->pIndexAccessTab = new Reference< XIntroTest >[ iIndexAccessCount ];
898 
899 	if( Index < iIndexAccessCount )
900 	{
901 		if( !pNameAccessTab[Index].is() )
902 		{
903 			ImplIntroTest* p = new ImplIntroTest( mxMgr );
904 			OUString aName( OUString::createFromAscii("IntroTest by Index-Access, Index = ") );
905 			aName += OUString::valueOf( Index );
906 			//aName = aName + StringToUString( String( iIndex ), CHARSET_SYSTEM );
907 			p->setObjectName( aName );
908 			pIndexAccessTab[Index] = p;
909 		}
910 		Reference< XIntroTest > xRet = pIndexAccessTab[Index];
911 		aRetAny = makeAny( xRet );
912 	}
913 	return aRetAny;
914 }
915 
addPropertiesChangeListener(const Sequence<OUString> &,const Reference<XPropertiesChangeListener> &)916 void ImplIntroTest::addPropertiesChangeListener( const Sequence< OUString >& /*PropertyNames*/,
917 												 const Reference< XPropertiesChangeListener >& /*Listener*/ )
918 		throw(RuntimeException)
919 //void ImplIntroTest::addPropertiesChangeListener
920 //(const Sequence< UString >& PropertyNames, const XPropertiesChangeListenerRef& Listener)
921 	//THROWS( (UsrSystemException) )
922 {
923 }
924 
removePropertiesChangeListener(const Reference<XPropertiesChangeListener> &)925 void ImplIntroTest::removePropertiesChangeListener
926 ( const Reference< XPropertiesChangeListener >& /*Listener*/ )
927 		throw(RuntimeException)
928 //void ImplIntroTest::removePropertiesChangeListener(const XPropertiesChangeListenerRef& Listener)
929 	//THROWS( (UsrSystemException) )
930 {
931 }
932 
933 
934 
935 struct DefItem
936 {
937 	char const * pName;
938 	sal_Int32 nConcept;
939 };
940 
941 // Spezial-Wert fuer Method-Concept, um "normale" Funktionen kennzeichnen zu koennen
942 #define  MethodConcept_NORMAL_IMPL		0x80000000
943 
944 
945 // Test-Objekt liefern
getIntrospectionTestObject(const Reference<XMultiServiceFactory> & xMgr)946 Any getIntrospectionTestObject( const Reference< XMultiServiceFactory > & xMgr )
947 {
948 	Any aObjAny;
949 	Reference< XIntroTest > xTestObj = new ImplIntroTest( xMgr );
950 	aObjAny.setValue( &xTestObj, ::getCppuType( (const Reference< XIntroTest > *)0 ) );
951 	return aObjAny;
952 }
953 
test_introsp(Reference<XMultiServiceFactory> xMgr,Reference<XIdlReflection>,Reference<XIntrospection> xIntrospection)954 static sal_Bool test_introsp( Reference< XMultiServiceFactory > xMgr,
955 							  Reference< XIdlReflection > /*xRefl*/, Reference< XIntrospection > xIntrospection )
956 {
957 	DefItem pPropertyDefs[] =
958 	{
959 		{ "Factor", PropertyConcept::PROPERTYSET },
960 		{ "MyCount", PropertyConcept::PROPERTYSET },
961 		{ "Info", PropertyConcept::PROPERTYSET },
962 		{ "ObjectName", PropertyConcept::ATTRIBUTES },
963 		{ "FirstName", PropertyConcept::ATTRIBUTES },
964 		{ "LastName", PropertyConcept::ATTRIBUTES },
965 		{ "Age", PropertyConcept::ATTRIBUTES },
966 		{ "ChildrenCount", PropertyConcept::ATTRIBUTES },
967 		{ "FirstStruct", PropertyConcept::ATTRIBUTES },
968 		{ "SecondStruct", PropertyConcept::ATTRIBUTES },
969 		{ "Droenk", PropertyConcept::METHODS },
970 		{ "IntroTest", PropertyConcept::METHODS },
971 		{ "Bla", PropertyConcept::METHODS },
972 		{ "Blub", PropertyConcept::METHODS },
973 		{ "Gulp", PropertyConcept::METHODS },
974 		{ "Strings", PropertyConcept::METHODS },
975 		{ "MultiSequence", PropertyConcept::METHODS },
976 		{ "PropertySetInfo", PropertyConcept::METHODS },
977 		{ "ElementType", PropertyConcept::METHODS },
978 		{ "ElementNames", PropertyConcept::METHODS },
979 		{ "Count", PropertyConcept::METHODS },
980 		{ "Types", PropertyConcept::METHODS },
981 		{ "ImplementationId", PropertyConcept::METHODS },
982 		{ NULL, 0 }
983 	};
984 
985 	// Tabelle der Property-Namen, die gefunden werden muessen
986 // 	char* pDemandedPropNames[] =
987 // 	{
988 // 		"Factor",
989 // 		"MyCount",
990 // 		"Info",
991 // 		"ObjectName",
992 // 		"FirstName",
993 // 		"LastName",
994 // 		"Age",
995 // 		"ChildrenCount",
996 // 		"FirstStruct",
997 // 		"SecondStruct",
998 // 		"Droenk",
999 // 		"IntroTest",
1000 // 		"Bla",
1001 // 		"Blub",
1002 // 		"Gulp",
1003 // 		"Strings",
1004 // 		"MultiSequence",
1005 // 		"PropertySetInfo",
1006 // 		"ElementType",
1007 // 		"ElementNames",
1008 // 		"Count",
1009 // 		"Types"
1010 // 		"ImplementationId"
1011 // 	};
1012 
1013 	char const * pDemandedPropVals[] =
1014 	{
1015 		"3.140000",
1016 		"42",
1017 		"Hallo",
1018 		"IntroTest-Obj Nr. 0",
1019 		"Markus",
1020 		"Meyer",
1021 		"33",
1022 		"2",
1023 		"TYPE STRUCT",
1024 		"TYPE STRUCT",
1025 		"314",
1026 		"TYPE INTERFACE",
1027 		"42",
1028 		"111",
1029 		"99",
1030 		"TYPE SEQUENCE",
1031 		"TYPE SEQUENCE",
1032 		"TYPE INTERFACE",
1033 		"TYPE TYPE",
1034 		"TYPE SEQUENCE",
1035 		"10",
1036 		"TYPE SEQUENCE",
1037 		"TYPE SEQUENCE",
1038 	};
1039 
1040 	char const * pDemandedModifiedPropVals[] =
1041 	{
1042 		"4.140000",
1043 		"43",
1044 		"Hallo (Modified!)",
1045 		"IntroTest-Obj Nr. 0 (Modified!)",
1046 		"Markus",
1047 		"Meyer",
1048 		"33",
1049 		"3",
1050 		"Wert wurde nicht modifiziert",
1051 		"Wert wurde nicht modifiziert",
1052 		"315",
1053 		"Wert wurde nicht modifiziert",
1054 		"42",
1055 		"112",
1056 		"99",
1057 		"Wert wurde nicht modifiziert",
1058 		"Wert wurde nicht modifiziert",
1059 		"Wert wurde nicht modifiziert",
1060 		"Wert wurde nicht modifiziert",
1061 		"Wert wurde nicht modifiziert",
1062 		"10",
1063 		"Wert wurde nicht modifiziert"
1064 		"Wert wurde nicht modifiziert"
1065 	};
1066 
1067 	char const * pDemandedPropTypes[] =
1068 	{
1069 		"double",
1070 		"long",
1071 		"string",
1072 		"string",
1073 		"string",
1074 		"string",
1075 		"short",
1076 		"short",
1077 		"com.sun.star.beans.Property",
1078 		"com.sun.star.beans.PropertyValue",
1079 		"long",
1080 		"ModuleA.XIntroTest",
1081 		"short",
1082 		"short",
1083 		"short",
1084 		"[]string",
1085 		"[][][]short",
1086 		"com.sun.star.beans.XPropertySetInfo",
1087 		"type",
1088 		"[]string",
1089 		"long",
1090 		"[]type",
1091 		"[]byte",
1092 	};
1093 	//is() nDemandedPropCount = 22;
1094 
1095 
1096 	DefItem pMethodDefs[] =
1097 	{
1098 		{ "queryInterface", MethodConcept_NORMAL_IMPL },
1099 		{ "acquire", MethodConcept::DANGEROUS },
1100 		{ "release", MethodConcept::DANGEROUS },
1101 		{ "writeln", MethodConcept_NORMAL_IMPL },
1102 		{ "getDroenk", MethodConcept::PROPERTY },
1103 		{ "getIntroTest", MethodConcept::PROPERTY },
1104 		{ "getUps", MethodConcept_NORMAL_IMPL },
1105 		{ "setDroenk", MethodConcept::PROPERTY },
1106 		{ "getBla", MethodConcept::PROPERTY },
1107 		{ "setBla", MethodConcept_NORMAL_IMPL },
1108 		{ "getBlub", MethodConcept::PROPERTY },
1109 		{ "setBlub", MethodConcept::PROPERTY },
1110 		{ "getGulp", MethodConcept::PROPERTY },
1111 		{ "setGulp", MethodConcept_NORMAL_IMPL },
1112 		{ "getTypeClass", MethodConcept_NORMAL_IMPL },
1113 		{ "setTypeClass", MethodConcept_NORMAL_IMPL },
1114 		{ "getStrings", MethodConcept::PROPERTY },
1115 		{ "setStrings", MethodConcept::PROPERTY },
1116 		{ "setStringsPerMethod", MethodConcept_NORMAL_IMPL },
1117 		{ "getMultiSequence", MethodConcept::PROPERTY },
1118 		{ "setMultiSequence", MethodConcept::PROPERTY },
1119 		{ "addPropertiesChangeListener", MethodConcept::LISTENER },
1120 		{ "removePropertiesChangeListener", MethodConcept::LISTENER },
1121 		{ "getPropertySetInfo", MethodConcept::PROPERTY },
1122 		{ "setPropertyValue", MethodConcept_NORMAL_IMPL },
1123 		{ "getPropertyValue", MethodConcept_NORMAL_IMPL },
1124 		{ "addPropertyChangeListener", MethodConcept::LISTENER },
1125 		{ "removePropertyChangeListener", MethodConcept::LISTENER },
1126 		{ "addVetoableChangeListener", MethodConcept::LISTENER },
1127 		{ "removeVetoableChangeListener", MethodConcept::LISTENER },
1128 		{ "getElementType", MethodConcept::PROPERTY | MethodConcept::NAMECONTAINER| MethodConcept::INDEXCONTAINER | MethodConcept::ENUMERATION  },
1129 		{ "hasElements", MethodConcept::NAMECONTAINER | MethodConcept::INDEXCONTAINER | MethodConcept::ENUMERATION },
1130 		{ "getByName", MethodConcept::NAMECONTAINER },
1131 		{ "getElementNames", MethodConcept::PROPERTY | MethodConcept::NAMECONTAINER },
1132 		{ "hasByName", MethodConcept::NAMECONTAINER },
1133 		{ "getCount", MethodConcept::PROPERTY | MethodConcept::INDEXCONTAINER },
1134 		{ "getByIndex", MethodConcept::INDEXCONTAINER },
1135 		{ "getTypes", MethodConcept::PROPERTY },
1136 		{ "getImplementationId", MethodConcept::PROPERTY },
1137 		{ "queryAdapter", MethodConcept_NORMAL_IMPL },
1138 		{ NULL, 0 }
1139 	};
1140 
1141 	OString aErrorStr;
1142 
1143 	//******************************************************
1144 
1145 	// Test-Objekt anlegen
1146 	Any aObjAny = getIntrospectionTestObject( xMgr );
1147 
1148 	// Introspection-Service holen
1149 	//Reference< XMultiServiceFactory > xServiceManager(getProcessServiceManager(), USR_QUERY);
1150 	//Reference< XIntrospection > xIntrospection( xMgr->createInstance(L"com.sun.star.beans.Introspection"), UNO_QUERY );
1151 	//TEST_ENSHURE( xIntrospection.is(), "Creation of introspection instance failed" );
1152 	//if( !xIntrospection.is() )
1153 		//return sal_False;
1154 
1155 	// und unspecten
1156 	Reference< XIntrospectionAccess > xAccess = xIntrospection->inspect( aObjAny );
1157 	xAccess = xIntrospection->inspect( aObjAny );
1158 	xAccess = xIntrospection->inspect( aObjAny );
1159 	TEST_ENSHURE( xAccess.is(), "introspection failed, no XIntrospectionAccess returned" );
1160 	if( !xAccess.is() )
1161 		return sal_False;
1162 
1163 	// Ergebnis der Introspection pruefen
1164 
1165 	// XPropertySet-UIK ermitteln
1166 	Type aType = getCppuType( (Reference< XPropertySet >*) NULL );
1167 	//typelib_InterfaceTypeDescription* pTypeDesc = NULL;
1168 	//aType.getDescription( (typelib_TypeDescription**)&pTypeDesc );
1169 	//Uik aPropertySetUik = *(Uik*)&pTypeDesc->aUik;
1170 	//typelib_typedescription_release( (typelib_TypeDescription*)pTypeDesc );
1171 
1172 	Reference< XInterface > xPropSetIface = xAccess->queryAdapter( aType );
1173 	//Reference< XInterface > xPropSetIface = xAccess->queryAdapter( aPropertySetUik );
1174 	Reference< XPropertySet > xPropSet( xPropSetIface, UNO_QUERY );
1175 	//XPropertySetRef xPropSet = (XPropertySet*)xPropSetIface->
1176 	//	queryInterface( XPropertySet::getSmartUik() );
1177 	TEST_ENSHURE( xPropSet.is(), "Could not get XPropertySet by queryAdapter()" );
1178 
1179 	// XExactName
1180 	Reference< XExactName > xExactName( xAccess, UNO_QUERY );
1181 	TEST_ENSHURE( xExactName.is(), "Introspection unterstuetzt kein ExactName" );
1182 
1183 	// Schleife ueber alle Kombinationen von Concepts
1184 	for( sal_Int32 nConcepts = 0 ; nConcepts < 16 ; nConcepts++ )
1185 	{
1186 //printf( "*******************************************************\n" );
1187 //printf( "nConcepts = %ld\n", nConcepts );
1188 
1189 		// Wieviele Properties sollten es sein
1190 		sal_Int32 nDemandedPropCount = 0;
1191 		sal_Int32 iList = 0;
1192 		while( pPropertyDefs[ iList ].pName )
1193 		{
1194 			if( pPropertyDefs[ iList ].nConcept & nConcepts )
1195 				nDemandedPropCount++;
1196 			iList++;
1197 		}
1198 
1199 		if( xPropSet.is() )
1200 		{
1201 			Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
1202 			//Sequence<Property> aRetSeq = xPropSetInfo->getProperties();
1203 			Sequence<Property> aRetSeq = xAccess->getProperties( nConcepts );
1204 
1205 			sal_Int32 nLen = aRetSeq.getLength();
1206 
1207 			aErrorStr  = "Expected to find ";
1208 			aErrorStr += OString::valueOf( nDemandedPropCount );
1209 			aErrorStr += " properties but found ";
1210 			aErrorStr += OString::valueOf( nLen );
1211 			TEST_ENSHURE( nLen == nDemandedPropCount, aErrorStr.getStr() );
1212 
1213 			// cout << "**********************************\n";
1214 			// cout << "*** Ergebnis der Introspection ***\n";
1215 			// cout << "**********************************\n";
1216 			// cout << "\nIntrospection hat " << nLen << " Properties gefunden:\n";
1217 
1218 			const Property* pProps = aRetSeq.getConstArray();
1219 			Any aPropVal;
1220 			sal_Int32 i;
1221 			iList = 0;
1222 			for( i = 0 ; i < nLen ; i++ )
1223 			{
1224 				const Property aProp = pProps[ i ];
1225 
1226 				// Naechste Passende Methode in der Liste suchen
1227 				while( pPropertyDefs[ iList ].pName )
1228 				{
1229 					if( pPropertyDefs[ iList ].nConcept & nConcepts )
1230 						break;
1231 					iList++;
1232 				}
1233 				sal_Int32 iDemanded = iList;
1234 				iList++;
1235 
1236 				OUString aPropName = aProp.Name;
1237 				OString aNameStr( aPropName.getStr(), aPropName.getLength(), RTL_TEXTENCODING_ASCII_US );
1238 					//UStringToString(aPropName, CHARSET_SYSTEM);
1239 
1240 //printf( "Property = %s\n", aNameStr.getStr() );
1241 
1242 				OString aDemandedName = pPropertyDefs[ iDemanded ].pName;
1243 				//OString aDemandedName = pDemandedPropNames[ i ];
1244 				aErrorStr  = "Expected property \"";
1245 				aErrorStr += aDemandedName;
1246 				aErrorStr += "\", found \"";
1247 				aErrorStr += aNameStr;
1248 				aErrorStr += "\"";
1249 				TEST_ENSHURE( aNameStr == aDemandedName, aErrorStr.getStr() );
1250 				// cout << "Property " << (i+1) << ": \"" << (const char*)UStringToString(aPropName, CHARSET_SYSTEM) << "\"";
1251 
1252 
1253 				Type aPropType = aProp.Type;
1254 				OString aTypeNameStr( OUStringToOString(aPropType.getTypeName(), RTL_TEXTENCODING_ASCII_US) );
1255 				//Reference< XIdlClass > xPropType = aProp.Type;
1256 				//OString aTypeNameStr( xPropType->getName(), xPropType->getName().getLength(), RTL_TEXTENCODING_ASCII_US );
1257 				OString aDemandedTypeNameStr = pDemandedPropTypes[ iDemanded ];
1258 				//OString aDemandedTypeNameStr = pDemandedPropTypes[ i ];
1259 				aErrorStr  = "Property \"";
1260 				aErrorStr += aDemandedName;
1261 				aErrorStr += "\", expected type >";
1262 				aErrorStr += aDemandedTypeNameStr;
1263 				aErrorStr += "< found type >";
1264 				aErrorStr += aTypeNameStr;
1265 				aErrorStr += "<";
1266 				TEST_ENSHURE( aTypeNameStr == aDemandedTypeNameStr, aErrorStr.getStr() );
1267 				// cout << " (Prop-Typ: " << (const char*)UStringToString(xPropType->getName(), CHARSET_SYSTEM) << ")";
1268 
1269 				// Wert des Property lesen und ausgeben
1270 				aPropVal = xPropSet->getPropertyValue( aPropName );
1271 				// cout << "\n\tWert = " << (const char*)UStringToString(AnyToString( aPropVal, sal_True ), CHARSET_SYSTEM);
1272 
1273 				OString aValStr = OUStringToOString( AnyToString( aPropVal, sal_False, xMgr ), RTL_TEXTENCODING_ASCII_US );
1274 				OString aDemandedValStr = pDemandedPropVals[ iDemanded ];
1275 				//OString aDemandedValStr = pDemandedPropVals[ i ];
1276 				aErrorStr  = "Property \"";
1277 				aErrorStr += aDemandedName;
1278 				aErrorStr += "\", expected val >";
1279 				aErrorStr += aDemandedValStr;
1280 				aErrorStr += "< found val >";
1281 				aErrorStr += aValStr;
1282 				aErrorStr += "<";
1283 				TEST_ENSHURE( aValStr == aDemandedValStr, aErrorStr.getStr() );
1284 
1285 				// Wert pruefen und typgerecht modifizieren
1286 				TypeClass eType = aPropVal.getValueType().getTypeClass();
1287 				//Reference< XIdlClass > xIdlClass = aPropVal.getReflection()->getIdlClass();
1288 				//TypeClass eType = xIdlClass->getTypeClass();
1289 				Any aNewVal;
1290 				sal_Bool bModify = sal_True;
1291 				switch( eType )
1292 				{
1293 					case TypeClass_STRING:
1294 					{
1295 						OUString aStr;
1296 						aPropVal >>= aStr;
1297 						//OString aStr = aPropVal.getString();
1298 						aStr = aStr + OUString::createFromAscii(" (Modified!)");
1299 						aNewVal <<= aStr;
1300 						break;
1301 					}
1302 					case TypeClass_DOUBLE:
1303 					{
1304 						double d(0.0);
1305 						aPropVal >>= d;
1306 						aNewVal <<= d + 1.0;
1307 						break;
1308 					}
1309 					case TypeClass_SHORT:
1310 					{
1311 						sal_Int16 n(0);
1312 						aPropVal >>= n;
1313 						aNewVal <<= sal_Int16( n + 1 );
1314 						break;
1315 					}
1316 					case TypeClass_LONG:
1317 					{
1318 						sal_Int32 n(0);
1319 						aPropVal >>= n;
1320 						aNewVal <<= sal_Int32( n + 1 );
1321 						break;
1322 					}
1323 					default:
1324 						bModify = sal_False;
1325 						break;
1326 				}
1327 
1328 				// Modifizieren nur beim letzten Durchlauf
1329 				if( nConcepts == 15 )
1330 				{
1331 					// XExactName pruefen, dafuer alles gross machen
1332 					// (Introspection ist mit LowerCase implementiert, also anders machen)
1333 					OUString aUpperUStr = aPropName.toAsciiUpperCase();
1334 					OUString aExactName = xExactName->getExactName( aUpperUStr );
1335 					if( aExactName != aPropName )
1336 					{
1337 						aErrorStr  = "Property \"";
1338 						aErrorStr += OUStringToOString( aPropName, RTL_TEXTENCODING_ASCII_US );
1339 						aErrorStr += "\", not found as \"";
1340 						aErrorStr += OUStringToOString(aUpperUStr, RTL_TEXTENCODING_ASCII_US );
1341 						aErrorStr += "\" using XExactName";
1342 						TEST_ENSHURE( sal_False, aErrorStr.getStr() );
1343 					}
1344 				}
1345 				else
1346 				{
1347 					bModify = sal_False;
1348 				}
1349 
1350 				// Neuen Wert setzen, wieder lesen und ausgeben
1351 				if( bModify )
1352 				{
1353 					// cout.flush();
1354 
1355 					// 1.7.1999, UnknownPropertyException bei ReadOnly-Properties abfangen
1356 					try
1357 					{
1358 						xPropSet->setPropertyValue( aPropName, aNewVal );
1359 					}
1360 					catch(UnknownPropertyException e1)
1361 					{
1362 					}
1363 
1364 					aPropVal = xPropSet->getPropertyValue( aPropName );
1365 					// cout << "\n\tModifizierter Wert = " << (const char*) UStringToString(AnyToString( aPropVal, sal_True ), CHARSET_SYSTEM) << "\n";
1366 
1367 					OUString aStr = AnyToString( aPropVal, sal_False, xMgr );
1368 					OString aModifiedValStr = OUStringToOString( aStr, RTL_TEXTENCODING_ASCII_US );
1369 					OString aDemandedModifiedValStr = pDemandedModifiedPropVals[ i ];
1370 					aErrorStr  = "Property \"";
1371 					aErrorStr += aDemandedName;
1372 					aErrorStr += "\", expected modified val >";
1373 					aErrorStr += aDemandedModifiedValStr;
1374 					aErrorStr += "< found val >";
1375 					aErrorStr += aModifiedValStr;
1376 					aErrorStr += "<";
1377 					TEST_ENSHURE( aModifiedValStr == aDemandedModifiedValStr, aErrorStr.getStr() );
1378 				}
1379 				else
1380 				{
1381 					// cout << "\n\tWert wurde nicht modifiziert\n";
1382 				}
1383 
1384 				// Checken, ob alle Properties auch einzeln gefunden werden
1385 				aErrorStr  = "property \"";
1386 				aErrorStr += aDemandedName;
1387 				aErrorStr += "\" not found with hasProperty()";
1388 				OUString aWDemandedName = OStringToOUString(aDemandedName, RTL_TEXTENCODING_ASCII_US );
1389 				sal_Bool bProperty = xAccess->hasProperty( aWDemandedName, nConcepts );
1390 				//sal_Bool bProperty = xAccess->hasProperty( aWDemandedName, PropertyConcept::ALL - PropertyConcept::DANGEROUS );
1391 				TEST_ENSHURE( bProperty, aErrorStr.getStr() );
1392 
1393 				aErrorStr  = "property \"";
1394 				aErrorStr += aDemandedName;
1395 				aErrorStr += "\" not equal to same Property in sequence returned by getProperties()";
1396 				try
1397 				{
1398 					Property aGetProp = xAccess->getProperty( aWDemandedName, nConcepts );
1399 					//Property aGetProp = xAccess->getProperty( aWDemandedName, PropertyConcept::ALL );
1400 					//TEST_ENSHURE( aGetProp == aProp , aErrorStr.getStr() );
1401 				}
1402 				catch (RuntimeException e1)
1403 				{
1404 					aErrorStr  = "property \"";
1405 					aErrorStr += aDemandedName;
1406 					aErrorStr += "\", exception was thrown when trying getProperty()";
1407 					TEST_ENSHURE( sal_False, aErrorStr.getStr() );
1408 				}
1409 
1410 			}
1411 		}
1412 	}
1413 
1414 	// Schleife ueber alle Kombinationen von Concepts
1415 	for( sal_Int32 nConcepts = 0 ; nConcepts < 128 ; nConcepts++ )
1416 	{
1417 //printf( "*******************************************************\n" );
1418 //printf( "nConcepts = %ld\n", nConcepts );
1419 
1420 		// Das 2^6-Bit steht fuer "den Rest"
1421 		sal_Int32 nRealConcepts = nConcepts;
1422 		if( nConcepts & 0x40 )
1423 			nRealConcepts |= (0xFFFFFFFF - 0x3F);
1424 
1425 		// Wieviele Methoden sollten es sein
1426 		sal_Int32 nDemandedMethCount = 0;
1427 		sal_Int32 iList = 0;
1428 		while( pMethodDefs[ iList ].pName )
1429 		{
1430 			if( pMethodDefs[ iList ].nConcept & nRealConcepts )
1431 				nDemandedMethCount++;
1432 			iList++;
1433 		}
1434 
1435 		// Methoden-Array ausgeben
1436 		//aMethodSeq = xAccess->getMethods
1437 		Sequence< Reference< XIdlMethod > > aMethodSeq = xAccess->getMethods( nRealConcepts );
1438 		//Sequence<XIdlMethodRef> aMethodSeq = xAccess->getMethods
1439 		//	( MethodConcept::ALL - MethodConcept::DANGEROUS - MethodConcept::PROPERTY );
1440 		sal_Int32 nLen = aMethodSeq.getLength();
1441 		// cout << "\n\n*** Methoden ***\n";
1442 		// cout << "Introspection hat " << nLen << " Methoden gefunden:\n";
1443 
1444 		aErrorStr  = "Expected to find ";
1445 		aErrorStr += OString::valueOf( nDemandedMethCount );
1446 		aErrorStr += " methods but found ";
1447 		aErrorStr += OString::valueOf( nLen );
1448 		TEST_ENSHURE( nLen == nDemandedMethCount, aErrorStr.getStr() );
1449 
1450 		const Reference< XIdlMethod >* pMethods = aMethodSeq.getConstArray();
1451 		sal_Int32 i;
1452 		iList = 0;
1453 
1454 		for( i = 0 ; i < nLen ; i++ )
1455 		{
1456 			// Methode ansprechen
1457 			const Reference< XIdlMethod >& rxMethod = pMethods[i];
1458 
1459 			// Methode ausgeben
1460 			OUString aMethName = rxMethod->getName();
1461 			OString aNameStr = OUStringToOString(aMethName, RTL_TEXTENCODING_ASCII_US );
1462 
1463 //printf( "Method = %s\n", aNameStr.getStr() );
1464 
1465 			// Naechste Passende Methode in der Liste suchen
1466 			while( pMethodDefs[ iList ].pName )
1467 			{
1468 				if( pMethodDefs[ iList ].nConcept & nRealConcepts )
1469 					break;
1470 				iList++;
1471 			}
1472 			OString aDemandedName = pMethodDefs[ iList ].pName;
1473 			iList++;
1474 
1475 			//OString aDemandedName = pDemandedMethNames[ i ];
1476 			aErrorStr  = "Expected method \"";
1477 			aErrorStr += aDemandedName;
1478 			aErrorStr += "\", found \"";
1479 			aErrorStr += aNameStr;
1480 			aErrorStr += "\"";
1481 			TEST_ENSHURE( aNameStr == aDemandedName, aErrorStr.getStr() );
1482 			// cout << "Methode " << (i+1) << ": " << (const char*) UStringToString(rxMethod->getReturnType()->getName(), CHARSET_SYSTEM)
1483 			//	 << " " << (const char*) UStringToString(rxMethod->getName(), CHARSET_SYSTEM) << "( ";
1484 
1485 			// Checken, ob alle Methoden auch einzeln gefunden werden
1486 			aErrorStr  = "method \"";
1487 			aErrorStr += aDemandedName;
1488 			aErrorStr += "\" not found with hasMethod()";
1489 			OUString aWDemandedName = OStringToOUString(aDemandedName, RTL_TEXTENCODING_ASCII_US );
1490 			sal_Bool bMethod = xAccess->hasMethod( aWDemandedName, nRealConcepts );
1491 			//sal_Bool bMethod = xAccess->hasMethod( aWDemandedName, MethodConcept::ALL );
1492 			TEST_ENSHURE( bMethod, aErrorStr.getStr() );
1493 
1494 			aErrorStr  = "method \"";
1495 			aErrorStr += aDemandedName;
1496 			aErrorStr += "\" not equal to same method in sequence returned by getMethods()";
1497 			try
1498 			{
1499 				Reference< XIdlMethod > xGetMethod = xAccess->getMethod( aWDemandedName, nRealConcepts );
1500 				//XIdlMethodRef xGetMethod = xAccess->getMethod( aWDemandedName, MethodConcept::ALL );
1501 				TEST_ENSHURE( xGetMethod == rxMethod , aErrorStr.getStr() );
1502 			}
1503 			catch (RuntimeException e1)
1504 			{
1505 				aErrorStr  = "method \"";
1506 				aErrorStr += aDemandedName;
1507 				aErrorStr += "\", exception was thrown when trying getMethod()";
1508 				TEST_ENSHURE( sal_False, aErrorStr.getStr() );
1509 			}
1510 		}
1511 	}
1512 
1513 	// Listener-Klassen ausgeben
1514 	Sequence< Type > aClassSeq = xAccess->getSupportedListeners();
1515 	sal_Int32 nLen = aClassSeq.getLength();
1516 	// cout << "\n\n*** Anmeldbare Listener ***\n";
1517 	// cout << "Introspection hat " << nLen << " Listener gefunden:\n";
1518 
1519 	const Type* pListeners = aClassSeq.getConstArray();
1520 	for( sal_Int32 i = 0 ; i < nLen ; i++ )
1521 	{
1522 		// Methode ansprechen
1523 		const Type& aListenerType = pListeners[i];
1524 
1525 		// Namen besorgen
1526 		OUString aListenerClassName = aListenerType.getTypeName();
1527 		// cout << "Listener " << (i+1) << ": " << (const char*)UStringToString(aListenerClassName, CHARSET_SYSTEM) << "\n";
1528 	}
1529 
1530 
1531 	// Performance bei hasMethod testen.
1532 	//CheckMethodPerformance( xAccess, "queryInterface", 100000 );
1533 	//CheckMethodPerformance( xAccess, "getIdlClasses", 100000 );
1534 
1535 	// cout.flush();
1536 
1537 
1538 
1539 
1540 	return sal_True;
1541 }
1542 
1543 
SAL_IMPLEMENT_MAIN()1544 SAL_IMPLEMENT_MAIN()
1545 {
1546 	Reference< XMultiServiceFactory > xMgr( createRegistryServiceFactory( OUString::createFromAscii("stoctest.rdb") ) );
1547 
1548 	sal_Bool bSucc = sal_False;
1549 	try
1550 	{
1551 		Reference< XImplementationRegistration > xImplReg(
1552 			xMgr->createInstance( OUString::createFromAscii("com.sun.star.registry.ImplementationRegistration") ), UNO_QUERY );
1553 		OSL_ENSURE( xImplReg.is(), "### no impl reg!" );
1554 
1555 		// Register services
1556 		OUString libName( RTL_CONSTASCII_USTRINGPARAM(
1557                               "reflection.uno" SAL_DLLEXTENSION) );
1558 //  		ORealDynamicLoader::computeLibraryName( OUString::createFromAscii("corefl"), libName);
1559 		fprintf(stderr, "1\n" );
1560 		xImplReg->registerImplementation(OUString::createFromAscii("com.sun.star.loader.SharedLibrary"),
1561 										 libName, Reference< XSimpleRegistry >() );
1562 		fprintf(stderr, "2\n" );
1563 		Reference< XIdlReflection > xRefl( xMgr->createInstance( OUString::createFromAscii("com.sun.star.reflection.CoreReflection") ), UNO_QUERY );
1564 		OSL_ENSURE( xRefl.is(), "### no corereflection!" );
1565 
1566 		// Introspection
1567 		libName = OUString::createFromAscii(
1568             "introspection.uno" SAL_DLLEXTENSION);
1569 //  		ORealDynamicLoader::computeLibraryName( OUString::createFromAscii("insp"), libName);
1570 		fprintf(stderr, "3\n" );
1571 		xImplReg->registerImplementation(OUString::createFromAscii("com.sun.star.loader.SharedLibrary"),
1572 										 libName, Reference< XSimpleRegistry >() );
1573 		fprintf(stderr, "4\n" );
1574 		Reference< XIntrospection > xIntrosp( xMgr->createInstance( OUString::createFromAscii("com.sun.star.beans.Introspection") ), UNO_QUERY );
1575 		OSL_ENSURE( xRefl.is(), "### no corereflection!" );
1576 
1577 		fprintf(stderr, "before test_introsp\n" );
1578 		bSucc = test_introsp( xMgr, xRefl, xIntrosp );
1579 		fprintf(stderr, "after test_introsp\n" );
1580 		//bSucc = test_corefl( xRefl );
1581 	}
1582 	catch (Exception & rExc)
1583 	{
1584 		OSL_ENSURE( sal_False, "### exception occured!" );
1585 		OString aMsg( OUStringToOString( rExc.Message, RTL_TEXTENCODING_ASCII_US ) );
1586 		OSL_TRACE( "### exception occured: " );
1587 		OSL_TRACE( aMsg.getStr() );
1588 		OSL_TRACE( "\n" );
1589 	}
1590 
1591 	Reference< XComponent >( xMgr, UNO_QUERY )->dispose();
1592 
1593 	printf( "testintrosp %s !\n", (bSucc ? "succeeded" : "failed") );
1594 	return (bSucc ? 0 : -1);
1595 }
1596 
1597 
1598 
1599 
1600 
1601 
1602 
1603 //*****************************
1604 //*** TEST-Implementationen ***
1605 //*****************************
1606 // Bleibt auf Dauer nicht drin, dient als exportierbare Test-Klasse
1607 // z.B. fuer Basic-Anbindung
1608 
1609 
1610 
1611 
1612 
1613 
1614