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