1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_stoc.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <string.h>
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir // Schalter fuer Introspection-Caching
34*cdf0e10cSrcweir #ifndef OS2
35*cdf0e10cSrcweir #define USE_INTROSPECTION_CACHE
36*cdf0e10cSrcweir #endif
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir #ifdef USE_INTROSPECTION_CACHE
39*cdf0e10cSrcweir #define INTROSPECTION_CACHE_MAX_SIZE 100
40*cdf0e10cSrcweir #endif
41*cdf0e10cSrcweir #include <osl/diagnose.h>
42*cdf0e10cSrcweir #include <osl/mutex.hxx>
43*cdf0e10cSrcweir #include <osl/thread.h>
44*cdf0e10cSrcweir #include <cppuhelper/queryinterface.hxx>
45*cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
46*cdf0e10cSrcweir #include <cppuhelper/component.hxx>
47*cdf0e10cSrcweir #include <cppuhelper/factory.hxx>
48*cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx>
49*cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx>
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir #include <com/sun/star/uno/DeploymentException.hpp>
52*cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp>
53*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
54*cdf0e10cSrcweir #include <com/sun/star/lang/XServiceInfo.hpp>
55*cdf0e10cSrcweir #include <com/sun/star/lang/XEventListener.hpp>
56*cdf0e10cSrcweir #include <com/sun/star/reflection/XIdlReflection.hpp>
57*cdf0e10cSrcweir #include <com/sun/star/reflection/XIdlClassProvider.hpp>
58*cdf0e10cSrcweir #include <com/sun/star/reflection/XIdlClass.hpp>
59*cdf0e10cSrcweir #include <com/sun/star/reflection/XIdlField2.hpp>
60*cdf0e10cSrcweir #include <com/sun/star/beans/UnknownPropertyException.hpp>
61*cdf0e10cSrcweir #include <com/sun/star/beans/Property.hpp>
62*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
63*cdf0e10cSrcweir #include <com/sun/star/beans/XFastPropertySet.hpp>
64*cdf0e10cSrcweir #include <com/sun/star/beans/XIntrospection.hpp>
65*cdf0e10cSrcweir #include <com/sun/star/beans/XIntrospectionAccess.hpp>
66*cdf0e10cSrcweir #include <com/sun/star/beans/XMaterialHolder.hpp>
67*cdf0e10cSrcweir #include <com/sun/star/beans/XExactName.hpp>
68*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp>
69*cdf0e10cSrcweir #include <com/sun/star/beans/PropertyConcept.hpp>
70*cdf0e10cSrcweir #include <com/sun/star/beans/MethodConcept.hpp>
71*cdf0e10cSrcweir #include <com/sun/star/container/XNameContainer.hpp>
72*cdf0e10cSrcweir #include <com/sun/star/container/XIndexContainer.hpp>
73*cdf0e10cSrcweir #include <com/sun/star/container/XEnumerationAccess.hpp>
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
76*cdf0e10cSrcweir #include <rtl/ref.hxx>
77*cdf0e10cSrcweir #include <rtl/strbuf.hxx>
78*cdf0e10cSrcweir #include <hash_map>
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir using namespace com::sun::star::uno;
81*cdf0e10cSrcweir using namespace com::sun::star::lang;
82*cdf0e10cSrcweir using namespace com::sun::star::reflection;
83*cdf0e10cSrcweir using namespace com::sun::star::container;
84*cdf0e10cSrcweir using namespace com::sun::star::registry;
85*cdf0e10cSrcweir using namespace com::sun::star::beans;
86*cdf0e10cSrcweir using namespace com::sun::star::beans::PropertyAttribute;
87*cdf0e10cSrcweir using namespace com::sun::star::beans::PropertyConcept;
88*cdf0e10cSrcweir using namespace com::sun::star::beans::MethodConcept;
89*cdf0e10cSrcweir using namespace cppu;
90*cdf0e10cSrcweir using namespace osl;
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir #define IMPLEMENTATION_NAME "com.sun.star.comp.stoc.Introspection"
93*cdf0e10cSrcweir #define SERVICE_NAME		"com.sun.star.beans.Introspection"
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir namespace stoc_inspect
96*cdf0e10cSrcweir {
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir typedef WeakImplHelper3< XIntrospectionAccess, XMaterialHolder, XExactName > IntrospectionAccessHelper;
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir //==================================================================================================
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir // Spezial-Wert fuer Method-Concept, um "normale" Funktionen kennzeichnen zu koennen
104*cdf0e10cSrcweir #define  MethodConcept_NORMAL_IMPL		0x80000000
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir // Methode zur Feststellung, ob eine Klasse von einer anderen abgeleitet ist
108*cdf0e10cSrcweir sal_Bool isDerivedFrom( Reference<XIdlClass> xToTestClass, Reference<XIdlClass> xDerivedFromClass )
109*cdf0e10cSrcweir {
110*cdf0e10cSrcweir 	Sequence< Reference<XIdlClass> > aClassesSeq = xToTestClass->getSuperclasses();
111*cdf0e10cSrcweir 	const Reference<XIdlClass>* pClassesArray = aClassesSeq.getConstArray();
112*cdf0e10cSrcweir 	sal_Int32 nSuperClassCount = aClassesSeq.getLength();
113*cdf0e10cSrcweir 	sal_Int32 i;
114*cdf0e10cSrcweir 	for( i = 0 ; i < nSuperClassCount ; i++ )
115*cdf0e10cSrcweir 	{
116*cdf0e10cSrcweir 		const Reference<XIdlClass>& rxClass = pClassesArray[i];
117*cdf0e10cSrcweir 		if( xDerivedFromClass->equals( rxClass ) )
118*cdf0e10cSrcweir 		{
119*cdf0e10cSrcweir 			// Treffer
120*cdf0e10cSrcweir 			return sal_True;
121*cdf0e10cSrcweir 		}
122*cdf0e10cSrcweir 		else
123*cdf0e10cSrcweir 		{
124*cdf0e10cSrcweir 			// Rekursiv weitersuchen
125*cdf0e10cSrcweir 			return isDerivedFrom( rxClass, xDerivedFromClass );
126*cdf0e10cSrcweir 		}
127*cdf0e10cSrcweir 	}
128*cdf0e10cSrcweir 	return sal_False;
129*cdf0e10cSrcweir }
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir //========================================================================
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir // *** Klassifizierung der Properties (kein enum, um Sequence verwenden zu koennen) ***
134*cdf0e10cSrcweir // Properties aus einem PropertySet-Interface
135*cdf0e10cSrcweir #define MAP_PROPERTY_SET	0
136*cdf0e10cSrcweir // Properties aus Fields
137*cdf0e10cSrcweir #define MAP_FIELD			1
138*cdf0e10cSrcweir // Properties, die durch get/set-Methoden beschrieben werden
139*cdf0e10cSrcweir #define MAP_GETSET			2
140*cdf0e10cSrcweir // Properties, die nur eine set-Methode haben
141*cdf0e10cSrcweir #define MAP_SETONLY			3
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir // Schrittweite, in der die Groesse der Sequences angepasst wird
145*cdf0e10cSrcweir #define ARRAY_SIZE_STEP		20
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir //**************************************
150*cdf0e10cSrcweir //*** IntrospectionAccessStatic_Impl ***
151*cdf0e10cSrcweir //**************************************
152*cdf0e10cSrcweir // Entspricht dem alten IntrospectionAccessImpl, bildet jetzt den statischen
153*cdf0e10cSrcweir // Anteil des neuen Instanz-bezogenen ImplIntrospectionAccess
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir // ACHTUNG !!! Von Hand refcounten !!!
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir // Hashtable fuer die Suche nach Namen
159*cdf0e10cSrcweir struct hashName_Impl
160*cdf0e10cSrcweir {
161*cdf0e10cSrcweir 	size_t operator()(const ::rtl::OUString Str) const
162*cdf0e10cSrcweir 	{
163*cdf0e10cSrcweir 		return (size_t)Str.hashCode();
164*cdf0e10cSrcweir 	}
165*cdf0e10cSrcweir };
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir struct eqName_Impl
168*cdf0e10cSrcweir {
169*cdf0e10cSrcweir 	sal_Bool operator()(const ::rtl::OUString Str1, const ::rtl::OUString Str2) const
170*cdf0e10cSrcweir 	{
171*cdf0e10cSrcweir 		return ( Str1 == Str2 );
172*cdf0e10cSrcweir 	}
173*cdf0e10cSrcweir };
174*cdf0e10cSrcweir 
175*cdf0e10cSrcweir typedef std::hash_map
176*cdf0e10cSrcweir <
177*cdf0e10cSrcweir     ::rtl::OUString,
178*cdf0e10cSrcweir 	sal_Int32,
179*cdf0e10cSrcweir 	hashName_Impl,
180*cdf0e10cSrcweir 	eqName_Impl
181*cdf0e10cSrcweir >
182*cdf0e10cSrcweir IntrospectionNameMap;
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir // Hashtable zur Zuordnung der exakten Namen zu den zu Lower-Case
186*cdf0e10cSrcweir // konvertierten Namen, dient zur Unterst�tzung von XExactName
187*cdf0e10cSrcweir typedef std::hash_map
188*cdf0e10cSrcweir <
189*cdf0e10cSrcweir     ::rtl::OUString,
190*cdf0e10cSrcweir     ::rtl::OUString,
191*cdf0e10cSrcweir 	hashName_Impl,
192*cdf0e10cSrcweir 	eqName_Impl
193*cdf0e10cSrcweir >
194*cdf0e10cSrcweir LowerToExactNameMap;
195*cdf0e10cSrcweir 
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir class ImplIntrospectionAccess;
198*cdf0e10cSrcweir class IntrospectionAccessStatic_Impl
199*cdf0e10cSrcweir {
200*cdf0e10cSrcweir 	friend class ImplIntrospection;
201*cdf0e10cSrcweir 	friend class ImplIntrospectionAccess;
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir 	// CoreReflection halten
204*cdf0e10cSrcweir 	Reference< XIdlReflection > mxCoreReflection;
205*cdf0e10cSrcweir 
206*cdf0e10cSrcweir 	// InterfaceSequences, um Zusatz-Infos zu einer Property speichern zu koennen.
207*cdf0e10cSrcweir 	// z.B. das Field bei MAP_FIELD, die get/set-Methoden bei MAP_GETSET usw.
208*cdf0e10cSrcweir 	Sequence< Reference<XInterface> > aInterfaceSeq1;
209*cdf0e10cSrcweir 	Sequence< Reference<XInterface> > aInterfaceSeq2;
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir 	// Hashtables fuer die Namen
212*cdf0e10cSrcweir 	IntrospectionNameMap maPropertyNameMap;
213*cdf0e10cSrcweir 	IntrospectionNameMap maMethodNameMap;
214*cdf0e10cSrcweir 	LowerToExactNameMap  maLowerToExactNameMap;
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir 	// Sequence aller Properties, auch zum Liefern aus getProperties()
217*cdf0e10cSrcweir 	Sequence<Property> maAllPropertySeq;
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir 	// Mapping der Properties auf Zugriffs-Arten
220*cdf0e10cSrcweir 	Sequence<sal_Int16> maMapTypeSeq;
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir 	// Klassifizierung der gefundenen Methoden
223*cdf0e10cSrcweir 	Sequence<sal_Int32> maPropertyConceptSeq;
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir 	// Anzahl der Properties
226*cdf0e10cSrcweir 	sal_Int32 mnPropCount;
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir 	// Anzahl der Properties, die den jeweiligen Konzepten zugeordnet sind
229*cdf0e10cSrcweir 	//sal_Int32 mnDangerousPropCount;
230*cdf0e10cSrcweir 	sal_Int32 mnPropertySetPropCount;
231*cdf0e10cSrcweir 	sal_Int32 mnAttributePropCount;
232*cdf0e10cSrcweir 	sal_Int32 mnMethodPropCount;
233*cdf0e10cSrcweir 
234*cdf0e10cSrcweir 	// Flag, ob ein FastPropertySet unterstuetzt wird
235*cdf0e10cSrcweir 	sal_Bool mbFastPropSet;
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir 	// Original-Handles eines FastPropertySets
238*cdf0e10cSrcweir 	sal_Int32* mpOrgPropertyHandleArray;
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir 	// MethodSequence, die alle Methoden aufnimmt
241*cdf0e10cSrcweir 	Sequence< Reference<XIdlMethod> > maAllMethodSeq;
242*cdf0e10cSrcweir 
243*cdf0e10cSrcweir 	// Klassifizierung der gefundenen Methoden
244*cdf0e10cSrcweir 	Sequence<sal_Int32> maMethodConceptSeq;
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir 	// Anzahl der Methoden
247*cdf0e10cSrcweir 	sal_Int32 mnMethCount;
248*cdf0e10cSrcweir 
249*cdf0e10cSrcweir 	// Sequence der Listener, die angemeldet werden koennen
250*cdf0e10cSrcweir 	Sequence< Type > maSupportedListenerSeq;
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir 	// BaseInit (soll spaeter in der Applikation erfolgen!)
253*cdf0e10cSrcweir 	void BaseInit( void );
254*cdf0e10cSrcweir 
255*cdf0e10cSrcweir 	// Hilfs-Methoden zur Groessen-Anpassung der Sequences
256*cdf0e10cSrcweir 	void checkPropertyArraysSize
257*cdf0e10cSrcweir 	(
258*cdf0e10cSrcweir 		Property*& rpAllPropArray,
259*cdf0e10cSrcweir 		sal_Int16*& rpMapTypeArray,
260*cdf0e10cSrcweir 		sal_Int32*& rpPropertyConceptArray,
261*cdf0e10cSrcweir 		sal_Int32 iNextIndex
262*cdf0e10cSrcweir 	);
263*cdf0e10cSrcweir 	void checkInterfaceArraySize( Sequence< Reference<XInterface> >& rSeq, Reference<XInterface>*& rpInterfaceArray,
264*cdf0e10cSrcweir 		sal_Int32 iNextIndex );
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir 	// RefCount
267*cdf0e10cSrcweir 	sal_Int32 nRefCount;
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir 
270*cdf0e10cSrcweir public:
271*cdf0e10cSrcweir 	IntrospectionAccessStatic_Impl( Reference< XIdlReflection > xCoreReflection_ );
272*cdf0e10cSrcweir 	~IntrospectionAccessStatic_Impl()
273*cdf0e10cSrcweir 	{
274*cdf0e10cSrcweir 		delete[] mpOrgPropertyHandleArray;
275*cdf0e10cSrcweir 	}
276*cdf0e10cSrcweir 	sal_Int32 getPropertyIndex( const ::rtl::OUString& aPropertyName ) const;
277*cdf0e10cSrcweir 	sal_Int32 getMethodIndex( const ::rtl::OUString& aMethodName ) const;
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir 	void acquire() { nRefCount++; }
280*cdf0e10cSrcweir 	void release()
281*cdf0e10cSrcweir 	{
282*cdf0e10cSrcweir 		nRefCount--;
283*cdf0e10cSrcweir 		if( nRefCount <= 0 )
284*cdf0e10cSrcweir 			delete this;
285*cdf0e10cSrcweir 	}
286*cdf0e10cSrcweir 
287*cdf0e10cSrcweir 	// Methoden von XIntrospectionAccess (ALT, jetzt nur Impl)
288*cdf0e10cSrcweir 	void setPropertyValue(const Any& obj, const ::rtl::OUString& aPropertyName, const Any& aValue) const;
289*cdf0e10cSrcweir //	void setPropertyValue(Any& obj, const ::rtl::OUString& aPropertyName, const Any& aValue) const;
290*cdf0e10cSrcweir 	Any getPropertyValue(const Any& obj, const ::rtl::OUString& aPropertyName) const;
291*cdf0e10cSrcweir 	void setPropertyValueByIndex(const Any& obj, sal_Int32 nIndex, const Any& aValue) const;
292*cdf0e10cSrcweir //	void setPropertyValueByIndex(Any& obj, sal_Int32 nIndex, const Any& aValue) const;
293*cdf0e10cSrcweir 	Any getPropertyValueByIndex(const Any& obj, sal_Int32 nIndex) const;
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir 	Sequence<Property> getProperties(void) const						{ return maAllPropertySeq; }
296*cdf0e10cSrcweir 	Sequence< Reference<XIdlMethod> > getMethods(void) const			{ return maAllMethodSeq; }
297*cdf0e10cSrcweir 	Sequence< Type > getSupportedListeners(void) const					{ return maSupportedListenerSeq; }
298*cdf0e10cSrcweir 	Sequence<sal_Int32> getPropertyConcepts(void) const					{ return maPropertyConceptSeq; }
299*cdf0e10cSrcweir 	Sequence<sal_Int32> getMethodConcepts(void) const					{ return maMethodConceptSeq; }
300*cdf0e10cSrcweir };
301*cdf0e10cSrcweir 
302*cdf0e10cSrcweir 
303*cdf0e10cSrcweir // Ctor
304*cdf0e10cSrcweir IntrospectionAccessStatic_Impl::IntrospectionAccessStatic_Impl( Reference< XIdlReflection > xCoreReflection_ )
305*cdf0e10cSrcweir 	: mxCoreReflection( xCoreReflection_ )
306*cdf0e10cSrcweir {
307*cdf0e10cSrcweir 	aInterfaceSeq1.realloc( ARRAY_SIZE_STEP );
308*cdf0e10cSrcweir 	aInterfaceSeq2.realloc( ARRAY_SIZE_STEP );
309*cdf0e10cSrcweir 
310*cdf0e10cSrcweir 	// Property-Daten
311*cdf0e10cSrcweir 	maAllPropertySeq.realloc( ARRAY_SIZE_STEP );
312*cdf0e10cSrcweir 	maMapTypeSeq.realloc( ARRAY_SIZE_STEP );
313*cdf0e10cSrcweir 	maPropertyConceptSeq.realloc( ARRAY_SIZE_STEP );
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir 	mbFastPropSet = sal_False;
316*cdf0e10cSrcweir 	mpOrgPropertyHandleArray = NULL;
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir 	mnPropCount = 0;
319*cdf0e10cSrcweir 	//mnDangerousPropCount = 0;
320*cdf0e10cSrcweir 	mnPropertySetPropCount = 0;
321*cdf0e10cSrcweir 	mnAttributePropCount = 0;
322*cdf0e10cSrcweir 	mnMethodPropCount = 0;
323*cdf0e10cSrcweir 
324*cdf0e10cSrcweir 	// Method-Daten
325*cdf0e10cSrcweir 	mnMethCount = 0;
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir 	// Eigenens RefCounting
328*cdf0e10cSrcweir 	nRefCount = 0;
329*cdf0e10cSrcweir }
330*cdf0e10cSrcweir 
331*cdf0e10cSrcweir // Von Hand refcounten !!!
332*cdf0e10cSrcweir 
333*cdf0e10cSrcweir 
334*cdf0e10cSrcweir sal_Int32 IntrospectionAccessStatic_Impl::getPropertyIndex( const ::rtl::OUString& aPropertyName ) const
335*cdf0e10cSrcweir {
336*cdf0e10cSrcweir 	sal_Int32 iHashResult = -1;
337*cdf0e10cSrcweir 	IntrospectionAccessStatic_Impl* pThis = (IntrospectionAccessStatic_Impl*)this;
338*cdf0e10cSrcweir 	IntrospectionNameMap::iterator aIt = pThis->maPropertyNameMap.find( aPropertyName );
339*cdf0e10cSrcweir 	if( !( aIt == pThis->maPropertyNameMap.end() ) )
340*cdf0e10cSrcweir 		iHashResult = (*aIt).second;
341*cdf0e10cSrcweir 	return iHashResult;
342*cdf0e10cSrcweir }
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir sal_Int32 IntrospectionAccessStatic_Impl::getMethodIndex( const ::rtl::OUString& aMethodName ) const
345*cdf0e10cSrcweir {
346*cdf0e10cSrcweir 	sal_Int32 iHashResult = -1;
347*cdf0e10cSrcweir 	IntrospectionAccessStatic_Impl* pThis = (IntrospectionAccessStatic_Impl*)this;
348*cdf0e10cSrcweir 	IntrospectionNameMap::iterator aIt = pThis->maMethodNameMap.find( aMethodName );
349*cdf0e10cSrcweir 	if( !( aIt == pThis->maMethodNameMap.end() ) )
350*cdf0e10cSrcweir 	{
351*cdf0e10cSrcweir 		iHashResult = (*aIt).second;
352*cdf0e10cSrcweir 	}
353*cdf0e10cSrcweir 	// #95159 Check if full qualified name matches
354*cdf0e10cSrcweir 	else
355*cdf0e10cSrcweir 	{
356*cdf0e10cSrcweir 		sal_Int32 nSearchFrom = aMethodName.getLength();
357*cdf0e10cSrcweir 		nSearchFrom = aMethodName.getLength();
358*cdf0e10cSrcweir 		while( true )
359*cdf0e10cSrcweir 		{
360*cdf0e10cSrcweir 			// Strategy: Search back until the first '_' is found
361*cdf0e10cSrcweir 			sal_Int32 nFound = aMethodName.lastIndexOf( '_', nSearchFrom );
362*cdf0e10cSrcweir 			if( nFound == -1 )
363*cdf0e10cSrcweir 				break;
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir 		    ::rtl::OUString aPureMethodName = aMethodName.copy( nFound + 1 );
366*cdf0e10cSrcweir 
367*cdf0e10cSrcweir 			aIt = pThis->maMethodNameMap.find( aPureMethodName );
368*cdf0e10cSrcweir 			if( !( aIt == pThis->maMethodNameMap.end() ) )
369*cdf0e10cSrcweir 			{
370*cdf0e10cSrcweir 				// Check if it can be a type?
371*cdf0e10cSrcweir 				// Problem: Does not work if package names contain _ ?!
372*cdf0e10cSrcweir 			    ::rtl::OUString aStr = aMethodName.copy( 0, nFound );
373*cdf0e10cSrcweir 			    ::rtl::OUString aTypeName = aStr.replace( '_', '.' );
374*cdf0e10cSrcweir 				Reference< XIdlClass > xClass = mxCoreReflection->forName( aTypeName );
375*cdf0e10cSrcweir 				if( xClass.is() )
376*cdf0e10cSrcweir 				{
377*cdf0e10cSrcweir 					// If this is a valid class it could be the right method
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir 					// Could be the right method, type has to be checked
380*cdf0e10cSrcweir 					iHashResult = (*aIt).second;
381*cdf0e10cSrcweir 
382*cdf0e10cSrcweir 					const Reference<XIdlMethod>* pMethods = maAllMethodSeq.getConstArray();
383*cdf0e10cSrcweir 					const Reference<XIdlMethod> xMethod = pMethods[ iHashResult ];
384*cdf0e10cSrcweir 
385*cdf0e10cSrcweir 					Reference< XIdlClass > xMethClass = xMethod->getDeclaringClass();
386*cdf0e10cSrcweir 					if( xClass->equals( xMethClass ) )
387*cdf0e10cSrcweir 					{
388*cdf0e10cSrcweir 						break;
389*cdf0e10cSrcweir 					}
390*cdf0e10cSrcweir 					else
391*cdf0e10cSrcweir 					{
392*cdf0e10cSrcweir 						iHashResult = -1;
393*cdf0e10cSrcweir 
394*cdf0e10cSrcweir 						// Could also be another method with the same name
395*cdf0e10cSrcweir 						// Iterate over all methods
396*cdf0e10cSrcweir 						sal_Int32 nLen = maAllMethodSeq.getLength();
397*cdf0e10cSrcweir 						for( int i = 0 ; i < nLen ; ++i )
398*cdf0e10cSrcweir 						{
399*cdf0e10cSrcweir 							const Reference<XIdlMethod> xMethod2 = pMethods[ i ];
400*cdf0e10cSrcweir 
401*cdf0e10cSrcweir 						    ::rtl::OUString aTestClassName = xMethod2->getDeclaringClass()->getName();
402*cdf0e10cSrcweir 						    ::rtl::OUString aTestMethodName = xMethod2->getName();
403*cdf0e10cSrcweir 
404*cdf0e10cSrcweir 							if( xMethod2->getName() == aPureMethodName )
405*cdf0e10cSrcweir 							{
406*cdf0e10cSrcweir 								Reference< XIdlClass > xMethClass2 = xMethod2->getDeclaringClass();
407*cdf0e10cSrcweir 
408*cdf0e10cSrcweir 								if( xClass->equals( xMethClass2 ) )
409*cdf0e10cSrcweir 								{
410*cdf0e10cSrcweir 									iHashResult = i;
411*cdf0e10cSrcweir 									break;
412*cdf0e10cSrcweir 								}
413*cdf0e10cSrcweir 							}
414*cdf0e10cSrcweir 						}
415*cdf0e10cSrcweir 
416*cdf0e10cSrcweir 						if( iHashResult != -1 )
417*cdf0e10cSrcweir 							break;
418*cdf0e10cSrcweir 					}
419*cdf0e10cSrcweir 				}
420*cdf0e10cSrcweir 			}
421*cdf0e10cSrcweir 
422*cdf0e10cSrcweir 			nSearchFrom = nFound - 1;
423*cdf0e10cSrcweir 			if( nSearchFrom < 0 )
424*cdf0e10cSrcweir 				break;
425*cdf0e10cSrcweir 		}
426*cdf0e10cSrcweir 	}
427*cdf0e10cSrcweir 	return iHashResult;
428*cdf0e10cSrcweir }
429*cdf0e10cSrcweir 
430*cdf0e10cSrcweir void IntrospectionAccessStatic_Impl::setPropertyValue( const Any& obj, const ::rtl::OUString& aPropertyName, const Any& aValue ) const
431*cdf0e10cSrcweir //void IntrospectionAccessStatic_Impl::setPropertyValue( Any& obj, const ::rtl::OUString& aPropertyName, const Any& aValue ) const
432*cdf0e10cSrcweir {
433*cdf0e10cSrcweir 	sal_Int32 i = getPropertyIndex( aPropertyName );
434*cdf0e10cSrcweir 	if( i != -1 )
435*cdf0e10cSrcweir 		setPropertyValueByIndex( obj, (sal_Int32)i, aValue );
436*cdf0e10cSrcweir 	else
437*cdf0e10cSrcweir 		throw UnknownPropertyException();
438*cdf0e10cSrcweir }
439*cdf0e10cSrcweir 
440*cdf0e10cSrcweir void IntrospectionAccessStatic_Impl::setPropertyValueByIndex(const Any& obj, sal_Int32 nSequenceIndex, const Any& aValue) const
441*cdf0e10cSrcweir //void IntrospectionAccessStatic_Impl::setPropertyValueByIndex( Any& obj, sal_Int32 nSequenceIndex, const Any& aValue) const
442*cdf0e10cSrcweir {
443*cdf0e10cSrcweir 	// Handelt es sich bei dem uebergebenen Objekt ueberhaupt um was passendes?
444*cdf0e10cSrcweir 	TypeClass eObjType = obj.getValueType().getTypeClass();
445*cdf0e10cSrcweir 
446*cdf0e10cSrcweir 	Reference<XInterface> xInterface;
447*cdf0e10cSrcweir 	if( eObjType == TypeClass_INTERFACE )
448*cdf0e10cSrcweir 	{
449*cdf0e10cSrcweir 		xInterface = *( Reference<XInterface>*)obj.getValue();
450*cdf0e10cSrcweir 	}
451*cdf0e10cSrcweir 	else if( nSequenceIndex >= mnPropCount || ( eObjType != TypeClass_STRUCT && eObjType != TypeClass_EXCEPTION ) )
452*cdf0e10cSrcweir 	{
453*cdf0e10cSrcweir 		throw IllegalArgumentException();
454*cdf0e10cSrcweir 	}
455*cdf0e10cSrcweir 
456*cdf0e10cSrcweir 	// Flags pruefen
457*cdf0e10cSrcweir 	const Property* pProps = maAllPropertySeq.getConstArray();
458*cdf0e10cSrcweir 	if( (pProps[ nSequenceIndex ].Attributes & READONLY) != 0 )
459*cdf0e10cSrcweir 	{
460*cdf0e10cSrcweir 		throw UnknownPropertyException();
461*cdf0e10cSrcweir 	}
462*cdf0e10cSrcweir 
463*cdf0e10cSrcweir 	const sal_Int16* pMapTypeArray = maMapTypeSeq.getConstArray();
464*cdf0e10cSrcweir 	switch( pMapTypeArray[ nSequenceIndex ] )
465*cdf0e10cSrcweir 	{
466*cdf0e10cSrcweir 		case MAP_PROPERTY_SET:
467*cdf0e10cSrcweir 		{
468*cdf0e10cSrcweir 			// Property besorgen
469*cdf0e10cSrcweir 			const Property& rProp = maAllPropertySeq.getConstArray()[ nSequenceIndex ];
470*cdf0e10cSrcweir 
471*cdf0e10cSrcweir 			// Interface-Parameter auf den richtigen Typ bringen
472*cdf0e10cSrcweir 			sal_Bool bUseCopy = sal_False;
473*cdf0e10cSrcweir 			Any aRealValue;
474*cdf0e10cSrcweir 
475*cdf0e10cSrcweir 			TypeClass eValType = aValue.getValueType().getTypeClass();
476*cdf0e10cSrcweir 			if( eValType == TypeClass_INTERFACE )
477*cdf0e10cSrcweir 			{
478*cdf0e10cSrcweir 				Type aPropType = rProp.Type;
479*cdf0e10cSrcweir 			    ::rtl::OUString aTypeName( aPropType.getTypeName() );
480*cdf0e10cSrcweir 				Reference< XIdlClass > xPropClass = mxCoreReflection->forName( aTypeName );
481*cdf0e10cSrcweir 				//Reference<XIdlClass> xPropClass = rProp.Type;
482*cdf0e10cSrcweir 				if( xPropClass.is() && xPropClass->getTypeClass() == TypeClass_INTERFACE )
483*cdf0e10cSrcweir 				{
484*cdf0e10cSrcweir 					Reference<XInterface> valInterface = *(Reference<XInterface>*)aValue.getValue();
485*cdf0e10cSrcweir 					if( valInterface.is() )
486*cdf0e10cSrcweir 					{
487*cdf0e10cSrcweir 						//Any queryInterface( const Type& rType );
488*cdf0e10cSrcweir 						aRealValue = valInterface->queryInterface( aPropType );
489*cdf0e10cSrcweir 						if( aRealValue.hasValue() )
490*cdf0e10cSrcweir 							bUseCopy = sal_True;
491*cdf0e10cSrcweir 					}
492*cdf0e10cSrcweir 				}
493*cdf0e10cSrcweir 			}
494*cdf0e10cSrcweir 
495*cdf0e10cSrcweir 			// Haben wir ein FastPropertySet und ein gueltiges Handle?
496*cdf0e10cSrcweir 			// ACHTUNG: An dieser Stelle wird ausgenutzt, dass das PropertySet
497*cdf0e10cSrcweir 			// zu Beginn des Introspection-Vorgangs abgefragt wird.
498*cdf0e10cSrcweir 			sal_Int32 nOrgHandle;
499*cdf0e10cSrcweir 			if( mbFastPropSet && ( nOrgHandle = mpOrgPropertyHandleArray[ nSequenceIndex ] ) != -1 )
500*cdf0e10cSrcweir 			{
501*cdf0e10cSrcweir 				// PropertySet-Interface holen
502*cdf0e10cSrcweir 				Reference<XFastPropertySet> xFastPropSet =
503*cdf0e10cSrcweir 					Reference<XFastPropertySet>::query( xInterface );
504*cdf0e10cSrcweir 				if( xFastPropSet.is() )
505*cdf0e10cSrcweir 				{
506*cdf0e10cSrcweir 					xFastPropSet->setFastPropertyValue( nOrgHandle, bUseCopy ? aRealValue : aValue );
507*cdf0e10cSrcweir 				}
508*cdf0e10cSrcweir 				else
509*cdf0e10cSrcweir 				{
510*cdf0e10cSrcweir 					// throw UnknownPropertyException
511*cdf0e10cSrcweir 				}
512*cdf0e10cSrcweir 			}
513*cdf0e10cSrcweir 			// sonst eben das normale nehmen
514*cdf0e10cSrcweir 			else
515*cdf0e10cSrcweir 			{
516*cdf0e10cSrcweir 				// PropertySet-Interface holen
517*cdf0e10cSrcweir 				Reference<XPropertySet> xPropSet =
518*cdf0e10cSrcweir 					Reference<XPropertySet>::query( xInterface );
519*cdf0e10cSrcweir 				if( xPropSet.is() )
520*cdf0e10cSrcweir 				{
521*cdf0e10cSrcweir 					xPropSet->setPropertyValue( rProp.Name, bUseCopy ? aRealValue : aValue );
522*cdf0e10cSrcweir 				}
523*cdf0e10cSrcweir 				else
524*cdf0e10cSrcweir 				{
525*cdf0e10cSrcweir 					// throw UnknownPropertyException
526*cdf0e10cSrcweir 				}
527*cdf0e10cSrcweir 			}
528*cdf0e10cSrcweir 		}
529*cdf0e10cSrcweir 		break;
530*cdf0e10cSrcweir 
531*cdf0e10cSrcweir 		case MAP_FIELD:
532*cdf0e10cSrcweir 		{
533*cdf0e10cSrcweir 			Reference<XIdlField> xField = (XIdlField*)(aInterfaceSeq1.getConstArray()[ nSequenceIndex ].get());
534*cdf0e10cSrcweir 			Reference<XIdlField2> xField2(xField, UNO_QUERY);
535*cdf0e10cSrcweir 			if( xField2.is() )
536*cdf0e10cSrcweir 			{
537*cdf0e10cSrcweir 				xField2->set( (Any&)obj, aValue );
538*cdf0e10cSrcweir 				// IllegalArgumentException
539*cdf0e10cSrcweir 				// NullPointerException
540*cdf0e10cSrcweir 			} else
541*cdf0e10cSrcweir 			if( xField.is() )
542*cdf0e10cSrcweir 			{
543*cdf0e10cSrcweir 				xField->set( obj, aValue );
544*cdf0e10cSrcweir 				// IllegalArgumentException
545*cdf0e10cSrcweir 				// NullPointerException
546*cdf0e10cSrcweir 			}
547*cdf0e10cSrcweir 			else
548*cdf0e10cSrcweir 			{
549*cdf0e10cSrcweir 				// throw IllegalArgumentException();
550*cdf0e10cSrcweir 			}
551*cdf0e10cSrcweir 		}
552*cdf0e10cSrcweir 		break;
553*cdf0e10cSrcweir 
554*cdf0e10cSrcweir 		case MAP_GETSET:
555*cdf0e10cSrcweir 		case MAP_SETONLY:
556*cdf0e10cSrcweir 		{
557*cdf0e10cSrcweir 			// set-Methode holen
558*cdf0e10cSrcweir 			Reference<XIdlMethod> xMethod = (XIdlMethod*)(aInterfaceSeq2.getConstArray()[ nSequenceIndex ].get());
559*cdf0e10cSrcweir 			if( xMethod.is() )
560*cdf0e10cSrcweir 			{
561*cdf0e10cSrcweir 				Sequence<Any> args( 1 );
562*cdf0e10cSrcweir 				args.getArray()[0] = aValue;
563*cdf0e10cSrcweir 				xMethod->invoke( obj, args );
564*cdf0e10cSrcweir 			}
565*cdf0e10cSrcweir 			else
566*cdf0e10cSrcweir 			{
567*cdf0e10cSrcweir 				// throw IllegalArgumentException();
568*cdf0e10cSrcweir 			}
569*cdf0e10cSrcweir 		}
570*cdf0e10cSrcweir 		break;
571*cdf0e10cSrcweir 	}
572*cdf0e10cSrcweir }
573*cdf0e10cSrcweir 
574*cdf0e10cSrcweir Any IntrospectionAccessStatic_Impl::getPropertyValue( const Any& obj, const ::rtl::OUString& aPropertyName ) const
575*cdf0e10cSrcweir {
576*cdf0e10cSrcweir 	sal_Int32 i = getPropertyIndex( aPropertyName );
577*cdf0e10cSrcweir 	if( i != -1 )
578*cdf0e10cSrcweir 		return getPropertyValueByIndex( obj, i );
579*cdf0e10cSrcweir 
580*cdf0e10cSrcweir 	throw UnknownPropertyException();
581*cdf0e10cSrcweir }
582*cdf0e10cSrcweir 
583*cdf0e10cSrcweir Any IntrospectionAccessStatic_Impl::getPropertyValueByIndex(const Any& obj, sal_Int32 nSequenceIndex) const
584*cdf0e10cSrcweir {
585*cdf0e10cSrcweir 	Any aRet;
586*cdf0e10cSrcweir 
587*cdf0e10cSrcweir 	// Handelt es sich bei dem uebergebenen Objekt ueberhaupt um was passendes?
588*cdf0e10cSrcweir 	TypeClass eObjType = obj.getValueType().getTypeClass();
589*cdf0e10cSrcweir 
590*cdf0e10cSrcweir 	Reference<XInterface> xInterface;
591*cdf0e10cSrcweir 	if( eObjType == TypeClass_INTERFACE )
592*cdf0e10cSrcweir 	{
593*cdf0e10cSrcweir 		xInterface = *(Reference<XInterface>*)obj.getValue();
594*cdf0e10cSrcweir 	}
595*cdf0e10cSrcweir 	else if( nSequenceIndex >= mnPropCount || ( eObjType != TypeClass_STRUCT && eObjType != TypeClass_EXCEPTION ) )
596*cdf0e10cSrcweir 	{
597*cdf0e10cSrcweir 		// throw IllegalArgumentException();
598*cdf0e10cSrcweir 		return aRet;
599*cdf0e10cSrcweir 	}
600*cdf0e10cSrcweir 
601*cdf0e10cSrcweir 	const sal_Int16* pMapTypeArray = maMapTypeSeq.getConstArray();
602*cdf0e10cSrcweir 	switch( pMapTypeArray[ nSequenceIndex ] )
603*cdf0e10cSrcweir 	{
604*cdf0e10cSrcweir 		case MAP_PROPERTY_SET:
605*cdf0e10cSrcweir 		{
606*cdf0e10cSrcweir 			// Property besorgen
607*cdf0e10cSrcweir 			const Property& rProp = maAllPropertySeq.getConstArray()[ nSequenceIndex ];
608*cdf0e10cSrcweir 
609*cdf0e10cSrcweir 			// Haben wir ein FastPropertySet und ein gueltiges Handle?
610*cdf0e10cSrcweir 			// ACHTUNG: An dieser Stelle wird ausgenutzt, dass das PropertySet
611*cdf0e10cSrcweir 			// zu Beginn des Introspection-Vorgangs abgefragt wird.
612*cdf0e10cSrcweir 			sal_Int32 nOrgHandle;
613*cdf0e10cSrcweir 			if( mbFastPropSet && ( nOrgHandle = mpOrgPropertyHandleArray[ nSequenceIndex ] ) != -1 )
614*cdf0e10cSrcweir 			{
615*cdf0e10cSrcweir 				// PropertySet-Interface holen
616*cdf0e10cSrcweir 				Reference<XFastPropertySet> xFastPropSet =
617*cdf0e10cSrcweir 					Reference<XFastPropertySet>::query( xInterface );
618*cdf0e10cSrcweir 				if( xFastPropSet.is() )
619*cdf0e10cSrcweir 				{
620*cdf0e10cSrcweir 					aRet = xFastPropSet->getFastPropertyValue( nOrgHandle);
621*cdf0e10cSrcweir 				}
622*cdf0e10cSrcweir 				else
623*cdf0e10cSrcweir 				{
624*cdf0e10cSrcweir 					// throw UnknownPropertyException
625*cdf0e10cSrcweir 					return aRet;
626*cdf0e10cSrcweir 				}
627*cdf0e10cSrcweir 			}
628*cdf0e10cSrcweir 			// sonst eben das normale nehmen
629*cdf0e10cSrcweir 			else
630*cdf0e10cSrcweir 			{
631*cdf0e10cSrcweir 				// PropertySet-Interface holen
632*cdf0e10cSrcweir 				Reference<XPropertySet> xPropSet =
633*cdf0e10cSrcweir 					Reference<XPropertySet>::query( xInterface );
634*cdf0e10cSrcweir 				if( xPropSet.is() )
635*cdf0e10cSrcweir 				{
636*cdf0e10cSrcweir 					aRet = xPropSet->getPropertyValue( rProp.Name );
637*cdf0e10cSrcweir 				}
638*cdf0e10cSrcweir 				else
639*cdf0e10cSrcweir 				{
640*cdf0e10cSrcweir 					// throw UnknownPropertyException
641*cdf0e10cSrcweir 					return aRet;
642*cdf0e10cSrcweir 				}
643*cdf0e10cSrcweir 			}
644*cdf0e10cSrcweir 		}
645*cdf0e10cSrcweir 		break;
646*cdf0e10cSrcweir 
647*cdf0e10cSrcweir 		case MAP_FIELD:
648*cdf0e10cSrcweir 		{
649*cdf0e10cSrcweir 			Reference<XIdlField> xField = (XIdlField*)(aInterfaceSeq1.getConstArray()[ nSequenceIndex ].get());
650*cdf0e10cSrcweir 			if( xField.is() )
651*cdf0e10cSrcweir 			{
652*cdf0e10cSrcweir 				aRet = xField->get( obj );
653*cdf0e10cSrcweir 				// IllegalArgumentException
654*cdf0e10cSrcweir 				// NullPointerException
655*cdf0e10cSrcweir 			}
656*cdf0e10cSrcweir 			else
657*cdf0e10cSrcweir 			{
658*cdf0e10cSrcweir 				// throw IllegalArgumentException();
659*cdf0e10cSrcweir 				return aRet;
660*cdf0e10cSrcweir 			}
661*cdf0e10cSrcweir 		}
662*cdf0e10cSrcweir 		break;
663*cdf0e10cSrcweir 
664*cdf0e10cSrcweir 		case MAP_GETSET:
665*cdf0e10cSrcweir 		{
666*cdf0e10cSrcweir 			// get-Methode holen
667*cdf0e10cSrcweir 			Reference<XIdlMethod> xMethod = (XIdlMethod*)(aInterfaceSeq1.getConstArray()[ nSequenceIndex ].get());
668*cdf0e10cSrcweir 			if( xMethod.is() )
669*cdf0e10cSrcweir 			{
670*cdf0e10cSrcweir 				Sequence<Any> args;
671*cdf0e10cSrcweir 				aRet = xMethod->invoke( obj, args );
672*cdf0e10cSrcweir 			}
673*cdf0e10cSrcweir 			else
674*cdf0e10cSrcweir 			{
675*cdf0e10cSrcweir 				// throw IllegalArgumentException();
676*cdf0e10cSrcweir 				return aRet;
677*cdf0e10cSrcweir 			}
678*cdf0e10cSrcweir 		}
679*cdf0e10cSrcweir 		break;
680*cdf0e10cSrcweir 
681*cdf0e10cSrcweir 		case MAP_SETONLY:
682*cdf0e10cSrcweir 			// get-Methode gibt es nicht
683*cdf0e10cSrcweir 			// throw WriteOnlyPropertyException();
684*cdf0e10cSrcweir 			return aRet;
685*cdf0e10cSrcweir 	}
686*cdf0e10cSrcweir 	return aRet;
687*cdf0e10cSrcweir }
688*cdf0e10cSrcweir 
689*cdf0e10cSrcweir 
690*cdf0e10cSrcweir // Hilfs-Methoden zur Groessen-Anpassung der Sequences
691*cdf0e10cSrcweir void IntrospectionAccessStatic_Impl::checkPropertyArraysSize
692*cdf0e10cSrcweir (
693*cdf0e10cSrcweir 	Property*& rpAllPropArray,
694*cdf0e10cSrcweir 	sal_Int16*& rpMapTypeArray,
695*cdf0e10cSrcweir 	sal_Int32*& rpPropertyConceptArray,
696*cdf0e10cSrcweir 	sal_Int32 iNextIndex
697*cdf0e10cSrcweir )
698*cdf0e10cSrcweir {
699*cdf0e10cSrcweir 	sal_Int32 nLen = maAllPropertySeq.getLength();
700*cdf0e10cSrcweir 	if( iNextIndex >= nLen )
701*cdf0e10cSrcweir 	{
702*cdf0e10cSrcweir 		maAllPropertySeq.realloc( nLen + ARRAY_SIZE_STEP );
703*cdf0e10cSrcweir 		rpAllPropArray = maAllPropertySeq.getArray();
704*cdf0e10cSrcweir 
705*cdf0e10cSrcweir 		maMapTypeSeq.realloc( nLen + ARRAY_SIZE_STEP );
706*cdf0e10cSrcweir 		rpMapTypeArray = maMapTypeSeq.getArray();
707*cdf0e10cSrcweir 
708*cdf0e10cSrcweir 		maPropertyConceptSeq.realloc( nLen + ARRAY_SIZE_STEP );
709*cdf0e10cSrcweir 		rpPropertyConceptArray = maPropertyConceptSeq.getArray();
710*cdf0e10cSrcweir 	}
711*cdf0e10cSrcweir }
712*cdf0e10cSrcweir 
713*cdf0e10cSrcweir void IntrospectionAccessStatic_Impl::checkInterfaceArraySize( Sequence< Reference<XInterface> >& rSeq,
714*cdf0e10cSrcweir 	Reference<XInterface>*& rpInterfaceArray, sal_Int32 iNextIndex )
715*cdf0e10cSrcweir {
716*cdf0e10cSrcweir 	sal_Int32 nLen = rSeq.getLength();
717*cdf0e10cSrcweir 	if( iNextIndex >= nLen )
718*cdf0e10cSrcweir 	{
719*cdf0e10cSrcweir 		// Neue Groesse mit ARRAY_SIZE_STEP abgleichen
720*cdf0e10cSrcweir 		sal_Int32 nMissingSize = iNextIndex - nLen + 1;
721*cdf0e10cSrcweir 		sal_Int32 nSteps = nMissingSize / ARRAY_SIZE_STEP + 1;
722*cdf0e10cSrcweir 		sal_Int32 nNewSize = nLen + nSteps * ARRAY_SIZE_STEP;
723*cdf0e10cSrcweir 
724*cdf0e10cSrcweir 		rSeq.realloc( nNewSize );
725*cdf0e10cSrcweir 		rpInterfaceArray = rSeq.getArray();
726*cdf0e10cSrcweir 	}
727*cdf0e10cSrcweir }
728*cdf0e10cSrcweir 
729*cdf0e10cSrcweir 
730*cdf0e10cSrcweir //*******************************
731*cdf0e10cSrcweir //*** ImplIntrospectionAccess ***
732*cdf0e10cSrcweir //*******************************
733*cdf0e10cSrcweir 
734*cdf0e10cSrcweir // Neue Impl-Klasse im Rahmen der Introspection-Umstellung auf Instanz-gebundene
735*cdf0e10cSrcweir // Introspection mit Property-Zugriff ueber XPropertySet. Die alte Klasse
736*cdf0e10cSrcweir // ImplIntrospectionAccess lebt als IntrospectionAccessStatic_Impl
737*cdf0e10cSrcweir class ImplIntrospectionAccess : public IntrospectionAccessHelper
738*cdf0e10cSrcweir {
739*cdf0e10cSrcweir 	friend class ImplIntrospection;
740*cdf0e10cSrcweir 
741*cdf0e10cSrcweir 	// Untersuchtes Objekt
742*cdf0e10cSrcweir 	Any maInspectedObject;
743*cdf0e10cSrcweir 
744*cdf0e10cSrcweir 	// Als Interface
745*cdf0e10cSrcweir 	Reference<XInterface> mxIface;
746*cdf0e10cSrcweir 
747*cdf0e10cSrcweir 	// Statische Daten der Introspection
748*cdf0e10cSrcweir 	IntrospectionAccessStatic_Impl* mpStaticImpl;
749*cdf0e10cSrcweir 
750*cdf0e10cSrcweir 	// Adapter-Implementation
751*cdf0e10cSrcweir     WeakReference< XInterface > maAdapter;
752*cdf0e10cSrcweir 
753*cdf0e10cSrcweir 	// Letzte Sequence, die bei getProperties geliefert wurde (Optimierung)
754*cdf0e10cSrcweir     Sequence<Property> maLastPropertySeq;
755*cdf0e10cSrcweir 	sal_Int32 mnLastPropertyConcept;
756*cdf0e10cSrcweir 
757*cdf0e10cSrcweir 	// Letzte Sequence, die bei getMethods geliefert wurde (Optimierung)
758*cdf0e10cSrcweir     Sequence<Reference<XIdlMethod> > maLastMethodSeq;
759*cdf0e10cSrcweir 	sal_Int32 mnLastMethodConcept;
760*cdf0e10cSrcweir 
761*cdf0e10cSrcweir public:
762*cdf0e10cSrcweir 	ImplIntrospectionAccess( const Any& obj, IntrospectionAccessStatic_Impl* pStaticImpl_ );
763*cdf0e10cSrcweir 	~ImplIntrospectionAccess();
764*cdf0e10cSrcweir 
765*cdf0e10cSrcweir 	// Methoden von XIntrospectionAccess
766*cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getSuppliedMethodConcepts(void)
767*cdf0e10cSrcweir 		throw( RuntimeException );
768*cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getSuppliedPropertyConcepts(void)
769*cdf0e10cSrcweir 		throw( RuntimeException );
770*cdf0e10cSrcweir     virtual Property SAL_CALL getProperty(const ::rtl::OUString& Name, sal_Int32 PropertyConcepts)
771*cdf0e10cSrcweir 		throw( NoSuchElementException, RuntimeException );
772*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL hasProperty(const ::rtl::OUString& Name, sal_Int32 PropertyConcepts)
773*cdf0e10cSrcweir 		throw( RuntimeException );
774*cdf0e10cSrcweir     virtual Sequence< Property > SAL_CALL getProperties(sal_Int32 PropertyConcepts)
775*cdf0e10cSrcweir 	  	throw( RuntimeException );
776*cdf0e10cSrcweir     virtual Reference<XIdlMethod> SAL_CALL getMethod(const ::rtl::OUString& Name, sal_Int32 MethodConcepts)
777*cdf0e10cSrcweir 	  	throw( NoSuchMethodException, RuntimeException );
778*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL hasMethod(const ::rtl::OUString& Name, sal_Int32 MethodConcepts)
779*cdf0e10cSrcweir 	  	throw( RuntimeException );
780*cdf0e10cSrcweir     virtual Sequence< Reference<XIdlMethod> > SAL_CALL getMethods(sal_Int32 MethodConcepts)
781*cdf0e10cSrcweir 	  	throw( RuntimeException );
782*cdf0e10cSrcweir     virtual Sequence< Type > SAL_CALL getSupportedListeners(void)
783*cdf0e10cSrcweir 	  	throw( RuntimeException );
784*cdf0e10cSrcweir     using OWeakObject::queryAdapter;
785*cdf0e10cSrcweir     virtual Reference<XInterface> SAL_CALL queryAdapter( const Type& rType )
786*cdf0e10cSrcweir 	  	throw( IllegalTypeException, RuntimeException );
787*cdf0e10cSrcweir 
788*cdf0e10cSrcweir 	// Methoden von XMaterialHolder
789*cdf0e10cSrcweir     virtual Any SAL_CALL getMaterial(void) throw(RuntimeException);
790*cdf0e10cSrcweir 
791*cdf0e10cSrcweir 	// Methoden von XExactName
792*cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getExactName( const ::rtl::OUString& rApproximateName ) throw( RuntimeException );
793*cdf0e10cSrcweir };
794*cdf0e10cSrcweir 
795*cdf0e10cSrcweir ImplIntrospectionAccess::ImplIntrospectionAccess
796*cdf0e10cSrcweir 	( const Any& obj, IntrospectionAccessStatic_Impl* pStaticImpl_ )
797*cdf0e10cSrcweir 		: maInspectedObject( obj ), mpStaticImpl( pStaticImpl_ ), maAdapter()
798*cdf0e10cSrcweir {
799*cdf0e10cSrcweir 	mpStaticImpl->acquire();
800*cdf0e10cSrcweir 
801*cdf0e10cSrcweir 	// Objekt als Interface merken, wenn moeglich
802*cdf0e10cSrcweir 	TypeClass eType = maInspectedObject.getValueType().getTypeClass();
803*cdf0e10cSrcweir 	if( eType == TypeClass_INTERFACE )
804*cdf0e10cSrcweir 		mxIface = *(Reference<XInterface>*)maInspectedObject.getValue();
805*cdf0e10cSrcweir 
806*cdf0e10cSrcweir 	mnLastPropertyConcept = -1;
807*cdf0e10cSrcweir 	mnLastMethodConcept = -1;
808*cdf0e10cSrcweir }
809*cdf0e10cSrcweir 
810*cdf0e10cSrcweir ImplIntrospectionAccess::~ImplIntrospectionAccess()
811*cdf0e10cSrcweir {
812*cdf0e10cSrcweir 	mpStaticImpl->release();
813*cdf0e10cSrcweir }
814*cdf0e10cSrcweir 
815*cdf0e10cSrcweir 
816*cdf0e10cSrcweir //*******************************
817*cdf0e10cSrcweir //*** ImplIntrospectionAdapter ***
818*cdf0e10cSrcweir //*******************************
819*cdf0e10cSrcweir 
820*cdf0e10cSrcweir // Neue Impl-Klasse im Rahmen der Introspection-Umstellung auf Instanz-gebundene
821*cdf0e10cSrcweir // Introspection mit Property-Zugriff ueber XPropertySet. Die alte Klasse
822*cdf0e10cSrcweir // ImplIntrospectionAccess lebt als IntrospectionAccessStatic_Impl
823*cdf0e10cSrcweir class ImplIntrospectionAdapter :
824*cdf0e10cSrcweir 	public XPropertySet, public XFastPropertySet, public XPropertySetInfo,
825*cdf0e10cSrcweir 	public XNameContainer, public XIndexContainer,
826*cdf0e10cSrcweir 	public XEnumerationAccess, public  XIdlArray,
827*cdf0e10cSrcweir 	public OWeakObject
828*cdf0e10cSrcweir {
829*cdf0e10cSrcweir 	// Parent-Objekt
830*cdf0e10cSrcweir     ::rtl::Reference< ImplIntrospectionAccess > mpAccess;
831*cdf0e10cSrcweir 
832*cdf0e10cSrcweir 	// Untersuchtes Objekt
833*cdf0e10cSrcweir 	const Any& mrInspectedObject;
834*cdf0e10cSrcweir 
835*cdf0e10cSrcweir 	// Statische Daten der Introspection
836*cdf0e10cSrcweir 	IntrospectionAccessStatic_Impl* mpStaticImpl;
837*cdf0e10cSrcweir 
838*cdf0e10cSrcweir 	// Objekt als Interface
839*cdf0e10cSrcweir 	Reference<XInterface> mxIface;
840*cdf0e10cSrcweir 
841*cdf0e10cSrcweir 	// Original-Interfaces des Objekts
842*cdf0e10cSrcweir 	Reference<XElementAccess>		mxObjElementAccess;
843*cdf0e10cSrcweir 	Reference<XNameContainer>		mxObjNameContainer;
844*cdf0e10cSrcweir 	Reference<XNameAccess>			mxObjNameAccess;
845*cdf0e10cSrcweir 	Reference<XIndexAccess>			mxObjIndexAccess;
846*cdf0e10cSrcweir 	Reference<XIndexContainer>		mxObjIndexContainer;
847*cdf0e10cSrcweir 	Reference<XEnumerationAccess>	mxObjEnumerationAccess;
848*cdf0e10cSrcweir 	Reference<XIdlArray>			mxObjIdlArray;
849*cdf0e10cSrcweir 
850*cdf0e10cSrcweir public:
851*cdf0e10cSrcweir 	ImplIntrospectionAdapter( ImplIntrospectionAccess* pAccess_,
852*cdf0e10cSrcweir 		const Any& obj, IntrospectionAccessStatic_Impl* pStaticImpl_ );
853*cdf0e10cSrcweir 	~ImplIntrospectionAdapter();
854*cdf0e10cSrcweir 
855*cdf0e10cSrcweir 	// Methoden von XInterface
856*cdf0e10cSrcweir     virtual Any SAL_CALL queryInterface( const Type& rType ) throw( RuntimeException );
857*cdf0e10cSrcweir 	virtual void		SAL_CALL acquire() throw() { OWeakObject::acquire(); }
858*cdf0e10cSrcweir 	virtual void		SAL_CALL release() throw() { OWeakObject::release(); }
859*cdf0e10cSrcweir 
860*cdf0e10cSrcweir 	// Methoden von XPropertySet
861*cdf0e10cSrcweir 	virtual Reference<XPropertySetInfo> SAL_CALL getPropertySetInfo() throw( RuntimeException );
862*cdf0e10cSrcweir     virtual void SAL_CALL setPropertyValue(const ::rtl::OUString& aPropertyName, const Any& aValue)
863*cdf0e10cSrcweir 		throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException );
864*cdf0e10cSrcweir     virtual Any SAL_CALL getPropertyValue(const ::rtl::OUString& aPropertyName)
865*cdf0e10cSrcweir 		throw( UnknownPropertyException, WrappedTargetException, RuntimeException );
866*cdf0e10cSrcweir     virtual void SAL_CALL addPropertyChangeListener(const ::rtl::OUString& aPropertyName, const Reference<XPropertyChangeListener>& aListener)
867*cdf0e10cSrcweir 		throw( UnknownPropertyException, WrappedTargetException, RuntimeException );
868*cdf0e10cSrcweir     virtual void SAL_CALL removePropertyChangeListener(const ::rtl::OUString& aPropertyName, const Reference<XPropertyChangeListener>& aListener)
869*cdf0e10cSrcweir 		throw( UnknownPropertyException, WrappedTargetException, RuntimeException );
870*cdf0e10cSrcweir     virtual void SAL_CALL addVetoableChangeListener(const ::rtl::OUString& aPropertyName, const Reference<XVetoableChangeListener>& aListener)
871*cdf0e10cSrcweir 		throw( UnknownPropertyException, WrappedTargetException, RuntimeException );
872*cdf0e10cSrcweir     virtual void SAL_CALL removeVetoableChangeListener(const ::rtl::OUString& aPropertyName, const Reference<XVetoableChangeListener>& aListener)
873*cdf0e10cSrcweir 		throw( UnknownPropertyException, WrappedTargetException, RuntimeException );
874*cdf0e10cSrcweir 
875*cdf0e10cSrcweir 	// Methoden von XFastPropertySet
876*cdf0e10cSrcweir 	virtual void SAL_CALL setFastPropertyValue(sal_Int32 nHandle, const Any& aValue)
877*cdf0e10cSrcweir 		throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException );
878*cdf0e10cSrcweir 	virtual Any SAL_CALL getFastPropertyValue(sal_Int32 nHandle)
879*cdf0e10cSrcweir 		throw( UnknownPropertyException, WrappedTargetException, RuntimeException );
880*cdf0e10cSrcweir 
881*cdf0e10cSrcweir 	// Methoden von XPropertySetInfo
882*cdf0e10cSrcweir 	virtual Sequence< Property > SAL_CALL getProperties(void) throw( RuntimeException );
883*cdf0e10cSrcweir 	virtual Property SAL_CALL getPropertyByName(const ::rtl::OUString& Name) throw( RuntimeException );
884*cdf0e10cSrcweir 	virtual sal_Bool SAL_CALL hasPropertyByName(const ::rtl::OUString& Name) throw( RuntimeException );
885*cdf0e10cSrcweir 
886*cdf0e10cSrcweir 	// Methoden von XElementAccess
887*cdf0e10cSrcweir     virtual Type SAL_CALL getElementType(void) throw( RuntimeException );
888*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL hasElements(void) throw( RuntimeException );
889*cdf0e10cSrcweir 
890*cdf0e10cSrcweir 	// Methoden von XNameAccess
891*cdf0e10cSrcweir     virtual Any SAL_CALL getByName(const ::rtl::OUString& Name)
892*cdf0e10cSrcweir 		throw( NoSuchElementException, WrappedTargetException, RuntimeException );
893*cdf0e10cSrcweir     virtual Sequence< ::rtl::OUString > SAL_CALL getElementNames(void) throw( RuntimeException );
894*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL hasByName(const ::rtl::OUString& Name) throw( RuntimeException );
895*cdf0e10cSrcweir 
896*cdf0e10cSrcweir 	// Methoden von XNameContainer
897*cdf0e10cSrcweir 	virtual void SAL_CALL insertByName(const ::rtl::OUString& Name, const Any& Element)
898*cdf0e10cSrcweir 		throw( IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException );
899*cdf0e10cSrcweir 	virtual void SAL_CALL replaceByName(const ::rtl::OUString& Name, const Any& Element)
900*cdf0e10cSrcweir 		throw( IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException );
901*cdf0e10cSrcweir 	virtual void SAL_CALL removeByName(const ::rtl::OUString& Name)
902*cdf0e10cSrcweir 		throw( NoSuchElementException, WrappedTargetException, RuntimeException );
903*cdf0e10cSrcweir 
904*cdf0e10cSrcweir 	// Methoden von XIndexAccess
905*cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getCount(void) throw( RuntimeException );
906*cdf0e10cSrcweir     virtual Any SAL_CALL getByIndex(sal_Int32 Index)
907*cdf0e10cSrcweir 		throw( IndexOutOfBoundsException, WrappedTargetException, RuntimeException );
908*cdf0e10cSrcweir 
909*cdf0e10cSrcweir 	// Methoden von XIndexContainer
910*cdf0e10cSrcweir 	virtual void SAL_CALL insertByIndex(sal_Int32 Index, const Any& Element)
911*cdf0e10cSrcweir 		throw( IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException );
912*cdf0e10cSrcweir 	virtual void SAL_CALL replaceByIndex(sal_Int32 Index, const Any& Element)
913*cdf0e10cSrcweir 		throw( IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException );
914*cdf0e10cSrcweir 	virtual void SAL_CALL removeByIndex(sal_Int32 Index)
915*cdf0e10cSrcweir 		throw( IndexOutOfBoundsException, WrappedTargetException, RuntimeException );
916*cdf0e10cSrcweir 
917*cdf0e10cSrcweir 	// Methoden von XEnumerationAccess
918*cdf0e10cSrcweir 	virtual Reference<XEnumeration> SAL_CALL createEnumeration(void) throw( RuntimeException );
919*cdf0e10cSrcweir 
920*cdf0e10cSrcweir 	// Methoden von XIdlArray
921*cdf0e10cSrcweir 	virtual void SAL_CALL realloc(Any& array, sal_Int32 length)
922*cdf0e10cSrcweir 		throw( IllegalArgumentException, RuntimeException );
923*cdf0e10cSrcweir 	virtual sal_Int32 SAL_CALL getLen(const Any& array) throw( IllegalArgumentException, RuntimeException );
924*cdf0e10cSrcweir 	virtual Any SAL_CALL get(const Any& array, sal_Int32 index)
925*cdf0e10cSrcweir 		throw( IllegalArgumentException, ArrayIndexOutOfBoundsException, RuntimeException );
926*cdf0e10cSrcweir 	virtual void SAL_CALL set(Any& array, sal_Int32 index, const Any& value)
927*cdf0e10cSrcweir 		throw( IllegalArgumentException, ArrayIndexOutOfBoundsException, RuntimeException );
928*cdf0e10cSrcweir };
929*cdf0e10cSrcweir 
930*cdf0e10cSrcweir ImplIntrospectionAdapter::ImplIntrospectionAdapter( ImplIntrospectionAccess* pAccess_,
931*cdf0e10cSrcweir 	const Any& obj, IntrospectionAccessStatic_Impl* pStaticImpl_ )
932*cdf0e10cSrcweir 		: mpAccess( pAccess_), mrInspectedObject( obj ), mpStaticImpl( pStaticImpl_ )
933*cdf0e10cSrcweir {
934*cdf0e10cSrcweir 	mpStaticImpl->acquire();
935*cdf0e10cSrcweir 
936*cdf0e10cSrcweir 	// Objekt als Interfaceholen
937*cdf0e10cSrcweir 	TypeClass eType = mrInspectedObject.getValueType().getTypeClass();
938*cdf0e10cSrcweir 	if( eType == TypeClass_INTERFACE )
939*cdf0e10cSrcweir 	{
940*cdf0e10cSrcweir 		mxIface = *( Reference< XInterface >*)mrInspectedObject.getValue();
941*cdf0e10cSrcweir 
942*cdf0e10cSrcweir 		mxObjElementAccess = Reference<XElementAccess>::query( mxIface );
943*cdf0e10cSrcweir 		mxObjNameAccess = Reference<XNameAccess>::query( mxIface );
944*cdf0e10cSrcweir 		mxObjNameContainer = Reference<XNameContainer>::query( mxIface );
945*cdf0e10cSrcweir 		mxObjIndexAccess = Reference<XIndexAccess>::query( mxIface );
946*cdf0e10cSrcweir 		mxObjIndexContainer = Reference<XIndexContainer>::query( mxIface );
947*cdf0e10cSrcweir 		mxObjEnumerationAccess = Reference<XEnumerationAccess>::query( mxIface );
948*cdf0e10cSrcweir 		mxObjIdlArray = Reference<XIdlArray>::query( mxIface );
949*cdf0e10cSrcweir 	}
950*cdf0e10cSrcweir }
951*cdf0e10cSrcweir 
952*cdf0e10cSrcweir ImplIntrospectionAdapter::~ImplIntrospectionAdapter()
953*cdf0e10cSrcweir {
954*cdf0e10cSrcweir 	mpStaticImpl->release();
955*cdf0e10cSrcweir }
956*cdf0e10cSrcweir 
957*cdf0e10cSrcweir // Methoden von XInterface
958*cdf0e10cSrcweir Any SAL_CALL ImplIntrospectionAdapter::queryInterface( const Type& rType )
959*cdf0e10cSrcweir 	throw( RuntimeException )
960*cdf0e10cSrcweir {
961*cdf0e10cSrcweir 	Any aRet( ::cppu::queryInterface(
962*cdf0e10cSrcweir 		rType,
963*cdf0e10cSrcweir 		static_cast< XPropertySet * >( this ),
964*cdf0e10cSrcweir 		static_cast< XFastPropertySet * >( this ),
965*cdf0e10cSrcweir 		static_cast< XPropertySetInfo * >( this ) ) );
966*cdf0e10cSrcweir 	if( !aRet.hasValue() )
967*cdf0e10cSrcweir 		aRet = OWeakObject::queryInterface( rType );
968*cdf0e10cSrcweir 
969*cdf0e10cSrcweir 	if( !aRet.hasValue() )
970*cdf0e10cSrcweir 	{
971*cdf0e10cSrcweir 		// Wrapper fuer die Objekt-Interfaces
972*cdf0e10cSrcweir 		if(   ( mxObjElementAccess.is() && (aRet = ::cppu::queryInterface
973*cdf0e10cSrcweir 					( rType, static_cast< XElementAccess* >( static_cast< XNameAccess* >( this ) ) ) ).hasValue() )
974*cdf0e10cSrcweir 			|| ( mxObjNameAccess.is() && (aRet = ::cppu::queryInterface( rType, static_cast< XNameAccess* >( this ) ) ).hasValue() )
975*cdf0e10cSrcweir 			|| ( mxObjNameContainer.is() && (aRet = ::cppu::queryInterface( rType, static_cast< XNameContainer* >( this ) ) ).hasValue() )
976*cdf0e10cSrcweir 			|| ( mxObjIndexAccess.is() && (aRet = ::cppu::queryInterface( rType, static_cast< XIndexAccess* >( this ) ) ).hasValue() )
977*cdf0e10cSrcweir 			|| ( mxObjIndexContainer.is() && (aRet = ::cppu::queryInterface( rType, static_cast< XIndexContainer* >( this ) ) ).hasValue() )
978*cdf0e10cSrcweir 			|| ( mxObjEnumerationAccess	.is() && (aRet = ::cppu::queryInterface( rType, static_cast< XEnumerationAccess* >( this ) ) ).hasValue() )
979*cdf0e10cSrcweir 			|| ( mxObjIdlArray.is() && (aRet = ::cppu::queryInterface( rType, static_cast< XIdlArray* >( this ) ) ).hasValue() )
980*cdf0e10cSrcweir 		  )
981*cdf0e10cSrcweir 		{
982*cdf0e10cSrcweir 		}
983*cdf0e10cSrcweir 	}
984*cdf0e10cSrcweir 	return aRet;
985*cdf0e10cSrcweir }
986*cdf0e10cSrcweir 
987*cdf0e10cSrcweir 
988*cdf0e10cSrcweir //***************************************************
989*cdf0e10cSrcweir //*** Implementation von ImplIntrospectionAdapter ***
990*cdf0e10cSrcweir //***************************************************
991*cdf0e10cSrcweir 
992*cdf0e10cSrcweir // Methoden von XPropertySet
993*cdf0e10cSrcweir Reference<XPropertySetInfo> ImplIntrospectionAdapter::getPropertySetInfo(void)
994*cdf0e10cSrcweir 	throw( RuntimeException )
995*cdf0e10cSrcweir {
996*cdf0e10cSrcweir 	return (XPropertySetInfo *)this;
997*cdf0e10cSrcweir }
998*cdf0e10cSrcweir 
999*cdf0e10cSrcweir void ImplIntrospectionAdapter::setPropertyValue(const ::rtl::OUString& aPropertyName, const Any& aValue)
1000*cdf0e10cSrcweir 	throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException )
1001*cdf0e10cSrcweir {
1002*cdf0e10cSrcweir 	mpStaticImpl->setPropertyValue( mrInspectedObject, aPropertyName, aValue );
1003*cdf0e10cSrcweir }
1004*cdf0e10cSrcweir 
1005*cdf0e10cSrcweir Any ImplIntrospectionAdapter::getPropertyValue(const ::rtl::OUString& aPropertyName)
1006*cdf0e10cSrcweir 	throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
1007*cdf0e10cSrcweir {
1008*cdf0e10cSrcweir 	return mpStaticImpl->getPropertyValue( mrInspectedObject, aPropertyName );
1009*cdf0e10cSrcweir }
1010*cdf0e10cSrcweir 
1011*cdf0e10cSrcweir void ImplIntrospectionAdapter::addPropertyChangeListener(const ::rtl::OUString& aPropertyName, const Reference<XPropertyChangeListener>& aListener)
1012*cdf0e10cSrcweir 	throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
1013*cdf0e10cSrcweir {
1014*cdf0e10cSrcweir 	if( mxIface.is() )
1015*cdf0e10cSrcweir 	{
1016*cdf0e10cSrcweir 		Reference<XPropertySet> xPropSet =
1017*cdf0e10cSrcweir 			Reference<XPropertySet>::query( mxIface );
1018*cdf0e10cSrcweir 		//Reference<XPropertySet> xPropSet( mxIface, USR_QUERY );
1019*cdf0e10cSrcweir 		if( xPropSet.is() )
1020*cdf0e10cSrcweir 			xPropSet->addPropertyChangeListener(aPropertyName, aListener);
1021*cdf0e10cSrcweir 	}
1022*cdf0e10cSrcweir }
1023*cdf0e10cSrcweir 
1024*cdf0e10cSrcweir void ImplIntrospectionAdapter::removePropertyChangeListener(const ::rtl::OUString& aPropertyName, const Reference<XPropertyChangeListener>& aListener)
1025*cdf0e10cSrcweir 	throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
1026*cdf0e10cSrcweir {
1027*cdf0e10cSrcweir 	if( mxIface.is() )
1028*cdf0e10cSrcweir 	{
1029*cdf0e10cSrcweir 		Reference<XPropertySet> xPropSet =
1030*cdf0e10cSrcweir 			Reference<XPropertySet>::query( mxIface );
1031*cdf0e10cSrcweir 		//Reference<XPropertySet> xPropSet( mxIface, USR_QUERY );
1032*cdf0e10cSrcweir 		if( xPropSet.is() )
1033*cdf0e10cSrcweir 			xPropSet->removePropertyChangeListener(aPropertyName, aListener);
1034*cdf0e10cSrcweir 	}
1035*cdf0e10cSrcweir }
1036*cdf0e10cSrcweir 
1037*cdf0e10cSrcweir void ImplIntrospectionAdapter::addVetoableChangeListener(const ::rtl::OUString& aPropertyName, const Reference<XVetoableChangeListener>& aListener)
1038*cdf0e10cSrcweir 	throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
1039*cdf0e10cSrcweir {
1040*cdf0e10cSrcweir 	if( mxIface.is() )
1041*cdf0e10cSrcweir 	{
1042*cdf0e10cSrcweir 		Reference<XPropertySet> xPropSet =
1043*cdf0e10cSrcweir 			Reference<XPropertySet>::query( mxIface );
1044*cdf0e10cSrcweir 		//Reference<XPropertySet> xPropSet( mxIface, USR_QUERY );
1045*cdf0e10cSrcweir 		if( xPropSet.is() )
1046*cdf0e10cSrcweir 			xPropSet->addVetoableChangeListener(aPropertyName, aListener);
1047*cdf0e10cSrcweir 	}
1048*cdf0e10cSrcweir }
1049*cdf0e10cSrcweir 
1050*cdf0e10cSrcweir void ImplIntrospectionAdapter::removeVetoableChangeListener(const ::rtl::OUString& aPropertyName, const Reference<XVetoableChangeListener>& aListener)
1051*cdf0e10cSrcweir 	throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
1052*cdf0e10cSrcweir {
1053*cdf0e10cSrcweir 	if( mxIface.is() )
1054*cdf0e10cSrcweir 	{
1055*cdf0e10cSrcweir 		Reference<XPropertySet> xPropSet =
1056*cdf0e10cSrcweir 			Reference<XPropertySet>::query( mxIface );
1057*cdf0e10cSrcweir 		if( xPropSet.is() )
1058*cdf0e10cSrcweir 			xPropSet->removeVetoableChangeListener(aPropertyName, aListener);
1059*cdf0e10cSrcweir 	}
1060*cdf0e10cSrcweir }
1061*cdf0e10cSrcweir 
1062*cdf0e10cSrcweir 
1063*cdf0e10cSrcweir // Methoden von XFastPropertySet
1064*cdf0e10cSrcweir void ImplIntrospectionAdapter::setFastPropertyValue(sal_Int32, const Any&)
1065*cdf0e10cSrcweir 	throw( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException )
1066*cdf0e10cSrcweir {
1067*cdf0e10cSrcweir }
1068*cdf0e10cSrcweir 
1069*cdf0e10cSrcweir Any ImplIntrospectionAdapter::getFastPropertyValue(sal_Int32)
1070*cdf0e10cSrcweir 	throw( UnknownPropertyException, WrappedTargetException, RuntimeException )
1071*cdf0e10cSrcweir {
1072*cdf0e10cSrcweir 	return Any();
1073*cdf0e10cSrcweir }
1074*cdf0e10cSrcweir 
1075*cdf0e10cSrcweir // Methoden von XPropertySetInfo
1076*cdf0e10cSrcweir Sequence< Property > ImplIntrospectionAdapter::getProperties(void) throw( RuntimeException )
1077*cdf0e10cSrcweir {
1078*cdf0e10cSrcweir 	return mpStaticImpl->getProperties();
1079*cdf0e10cSrcweir }
1080*cdf0e10cSrcweir 
1081*cdf0e10cSrcweir Property ImplIntrospectionAdapter::getPropertyByName(const ::rtl::OUString& Name)
1082*cdf0e10cSrcweir 	throw( RuntimeException )
1083*cdf0e10cSrcweir {
1084*cdf0e10cSrcweir 	return mpAccess->getProperty( Name, PropertyConcept::ALL );
1085*cdf0e10cSrcweir }
1086*cdf0e10cSrcweir 
1087*cdf0e10cSrcweir sal_Bool ImplIntrospectionAdapter::hasPropertyByName(const ::rtl::OUString& Name)
1088*cdf0e10cSrcweir 	throw( RuntimeException )
1089*cdf0e10cSrcweir {
1090*cdf0e10cSrcweir 	return mpAccess->hasProperty( Name, PropertyConcept::ALL );
1091*cdf0e10cSrcweir }
1092*cdf0e10cSrcweir 
1093*cdf0e10cSrcweir // Methoden von XElementAccess
1094*cdf0e10cSrcweir Type ImplIntrospectionAdapter::getElementType(void) throw( RuntimeException )
1095*cdf0e10cSrcweir {
1096*cdf0e10cSrcweir 	return mxObjElementAccess->getElementType();
1097*cdf0e10cSrcweir }
1098*cdf0e10cSrcweir 
1099*cdf0e10cSrcweir sal_Bool ImplIntrospectionAdapter::hasElements(void) throw( RuntimeException )
1100*cdf0e10cSrcweir {
1101*cdf0e10cSrcweir 	return mxObjElementAccess->hasElements();
1102*cdf0e10cSrcweir }
1103*cdf0e10cSrcweir 
1104*cdf0e10cSrcweir // Methoden von XNameAccess
1105*cdf0e10cSrcweir Any ImplIntrospectionAdapter::getByName(const ::rtl::OUString& Name)
1106*cdf0e10cSrcweir 	throw( NoSuchElementException, WrappedTargetException, RuntimeException )
1107*cdf0e10cSrcweir {
1108*cdf0e10cSrcweir 	return mxObjNameAccess->getByName( Name );
1109*cdf0e10cSrcweir }
1110*cdf0e10cSrcweir 
1111*cdf0e10cSrcweir Sequence< ::rtl::OUString > ImplIntrospectionAdapter::getElementNames(void)
1112*cdf0e10cSrcweir 	throw( RuntimeException )
1113*cdf0e10cSrcweir {
1114*cdf0e10cSrcweir 	return mxObjNameAccess->getElementNames();
1115*cdf0e10cSrcweir }
1116*cdf0e10cSrcweir 
1117*cdf0e10cSrcweir sal_Bool ImplIntrospectionAdapter::hasByName(const ::rtl::OUString& Name)
1118*cdf0e10cSrcweir 	throw( RuntimeException )
1119*cdf0e10cSrcweir {
1120*cdf0e10cSrcweir 	return mxObjNameAccess->hasByName( Name );
1121*cdf0e10cSrcweir }
1122*cdf0e10cSrcweir 
1123*cdf0e10cSrcweir // Methoden von XNameContainer
1124*cdf0e10cSrcweir void ImplIntrospectionAdapter::insertByName(const ::rtl::OUString& Name, const Any& Element)
1125*cdf0e10cSrcweir 	throw( IllegalArgumentException, ElementExistException, WrappedTargetException, RuntimeException )
1126*cdf0e10cSrcweir {
1127*cdf0e10cSrcweir 	mxObjNameContainer->insertByName( Name, Element );
1128*cdf0e10cSrcweir }
1129*cdf0e10cSrcweir 
1130*cdf0e10cSrcweir void ImplIntrospectionAdapter::replaceByName(const ::rtl::OUString& Name, const Any& Element)
1131*cdf0e10cSrcweir 	throw( IllegalArgumentException, NoSuchElementException, WrappedTargetException, RuntimeException )
1132*cdf0e10cSrcweir {
1133*cdf0e10cSrcweir 	mxObjNameContainer->replaceByName( Name, Element );
1134*cdf0e10cSrcweir }
1135*cdf0e10cSrcweir 
1136*cdf0e10cSrcweir void ImplIntrospectionAdapter::removeByName(const ::rtl::OUString& Name)
1137*cdf0e10cSrcweir 	throw( NoSuchElementException, WrappedTargetException, RuntimeException )
1138*cdf0e10cSrcweir {
1139*cdf0e10cSrcweir 	mxObjNameContainer->removeByName( Name );
1140*cdf0e10cSrcweir }
1141*cdf0e10cSrcweir 
1142*cdf0e10cSrcweir // Methoden von XIndexAccess
1143*cdf0e10cSrcweir // Schon in XNameAccess: virtual Reference<XIdlClass> getElementType(void) const
1144*cdf0e10cSrcweir sal_Int32 ImplIntrospectionAdapter::getCount(void) throw( RuntimeException )
1145*cdf0e10cSrcweir {
1146*cdf0e10cSrcweir 	return mxObjIndexAccess->getCount();
1147*cdf0e10cSrcweir }
1148*cdf0e10cSrcweir 
1149*cdf0e10cSrcweir Any ImplIntrospectionAdapter::getByIndex(sal_Int32 Index)
1150*cdf0e10cSrcweir 	throw( IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
1151*cdf0e10cSrcweir {
1152*cdf0e10cSrcweir 	return mxObjIndexAccess->getByIndex( Index );
1153*cdf0e10cSrcweir }
1154*cdf0e10cSrcweir 
1155*cdf0e10cSrcweir // Methoden von XIndexContainer
1156*cdf0e10cSrcweir void ImplIntrospectionAdapter::insertByIndex(sal_Int32 Index, const Any& Element)
1157*cdf0e10cSrcweir 	throw( IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
1158*cdf0e10cSrcweir {
1159*cdf0e10cSrcweir 	mxObjIndexContainer->insertByIndex( Index, Element );
1160*cdf0e10cSrcweir }
1161*cdf0e10cSrcweir 
1162*cdf0e10cSrcweir void ImplIntrospectionAdapter::replaceByIndex(sal_Int32 Index, const Any& Element)
1163*cdf0e10cSrcweir 	throw( IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
1164*cdf0e10cSrcweir {
1165*cdf0e10cSrcweir 	mxObjIndexContainer->replaceByIndex( Index, Element );
1166*cdf0e10cSrcweir }
1167*cdf0e10cSrcweir 
1168*cdf0e10cSrcweir void ImplIntrospectionAdapter::removeByIndex(sal_Int32 Index)
1169*cdf0e10cSrcweir 	throw( IndexOutOfBoundsException, WrappedTargetException, RuntimeException )
1170*cdf0e10cSrcweir {
1171*cdf0e10cSrcweir 	mxObjIndexContainer->removeByIndex( Index );
1172*cdf0e10cSrcweir }
1173*cdf0e10cSrcweir 
1174*cdf0e10cSrcweir // Methoden von XEnumerationAccess
1175*cdf0e10cSrcweir // Schon in XNameAccess: virtual Reference<XIdlClass> getElementType(void) const;
1176*cdf0e10cSrcweir Reference<XEnumeration> ImplIntrospectionAdapter::createEnumeration(void) throw( RuntimeException )
1177*cdf0e10cSrcweir {
1178*cdf0e10cSrcweir 	return mxObjEnumerationAccess->createEnumeration();
1179*cdf0e10cSrcweir }
1180*cdf0e10cSrcweir 
1181*cdf0e10cSrcweir // Methoden von XIdlArray
1182*cdf0e10cSrcweir void ImplIntrospectionAdapter::realloc(Any& array, sal_Int32 length)
1183*cdf0e10cSrcweir 	throw( IllegalArgumentException, RuntimeException )
1184*cdf0e10cSrcweir {
1185*cdf0e10cSrcweir 	mxObjIdlArray->realloc( array, length );
1186*cdf0e10cSrcweir }
1187*cdf0e10cSrcweir 
1188*cdf0e10cSrcweir sal_Int32 ImplIntrospectionAdapter::getLen(const Any& array)
1189*cdf0e10cSrcweir 	throw( IllegalArgumentException, RuntimeException )
1190*cdf0e10cSrcweir {
1191*cdf0e10cSrcweir 	return mxObjIdlArray->getLen( array );
1192*cdf0e10cSrcweir }
1193*cdf0e10cSrcweir 
1194*cdf0e10cSrcweir Any ImplIntrospectionAdapter::get(const Any& array, sal_Int32 index)
1195*cdf0e10cSrcweir 	throw( IllegalArgumentException, ArrayIndexOutOfBoundsException, RuntimeException )
1196*cdf0e10cSrcweir {
1197*cdf0e10cSrcweir 	return mxObjIdlArray->get( array, index );
1198*cdf0e10cSrcweir }
1199*cdf0e10cSrcweir 
1200*cdf0e10cSrcweir void ImplIntrospectionAdapter::set(Any& array, sal_Int32 index, const Any& value)
1201*cdf0e10cSrcweir 	throw( IllegalArgumentException, ArrayIndexOutOfBoundsException, RuntimeException )
1202*cdf0e10cSrcweir {
1203*cdf0e10cSrcweir 	mxObjIdlArray->set( array, index, value );
1204*cdf0e10cSrcweir }
1205*cdf0e10cSrcweir 
1206*cdf0e10cSrcweir 
1207*cdf0e10cSrcweir //**************************************************
1208*cdf0e10cSrcweir //*** Implementation von ImplIntrospectionAccess ***
1209*cdf0e10cSrcweir //**************************************************
1210*cdf0e10cSrcweir 
1211*cdf0e10cSrcweir // Methoden von XIntrospectionAccess
1212*cdf0e10cSrcweir sal_Int32 ImplIntrospectionAccess::getSuppliedMethodConcepts(void)
1213*cdf0e10cSrcweir 	throw( RuntimeException )
1214*cdf0e10cSrcweir {
1215*cdf0e10cSrcweir 	return	MethodConcept::DANGEROUS |
1216*cdf0e10cSrcweir 			PROPERTY |
1217*cdf0e10cSrcweir 			LISTENER |
1218*cdf0e10cSrcweir 			ENUMERATION |
1219*cdf0e10cSrcweir 			NAMECONTAINER |
1220*cdf0e10cSrcweir 			INDEXCONTAINER;
1221*cdf0e10cSrcweir }
1222*cdf0e10cSrcweir 
1223*cdf0e10cSrcweir sal_Int32 ImplIntrospectionAccess::getSuppliedPropertyConcepts(void)
1224*cdf0e10cSrcweir 	throw( RuntimeException )
1225*cdf0e10cSrcweir {
1226*cdf0e10cSrcweir 	return	PropertyConcept::DANGEROUS |
1227*cdf0e10cSrcweir 			PROPERTYSET |
1228*cdf0e10cSrcweir 			ATTRIBUTES |
1229*cdf0e10cSrcweir 			METHODS;
1230*cdf0e10cSrcweir }
1231*cdf0e10cSrcweir 
1232*cdf0e10cSrcweir Property ImplIntrospectionAccess::getProperty(const ::rtl::OUString& Name, sal_Int32 PropertyConcepts)
1233*cdf0e10cSrcweir 	throw( NoSuchElementException, RuntimeException )
1234*cdf0e10cSrcweir {
1235*cdf0e10cSrcweir 	Property aRet;
1236*cdf0e10cSrcweir 	sal_Int32 i = mpStaticImpl->getPropertyIndex( Name );
1237*cdf0e10cSrcweir 	sal_Bool bFound = sal_False;
1238*cdf0e10cSrcweir 	if( i != -1 )
1239*cdf0e10cSrcweir 	{
1240*cdf0e10cSrcweir 		sal_Int32 nConcept = mpStaticImpl->getPropertyConcepts().getConstArray()[ i ];
1241*cdf0e10cSrcweir 		if( (PropertyConcepts & nConcept) != 0 )
1242*cdf0e10cSrcweir 		{
1243*cdf0e10cSrcweir 			const Property* pProps = mpStaticImpl->getProperties().getConstArray();
1244*cdf0e10cSrcweir 			aRet = pProps[ i ];
1245*cdf0e10cSrcweir 			bFound = sal_True;
1246*cdf0e10cSrcweir 		}
1247*cdf0e10cSrcweir 	}
1248*cdf0e10cSrcweir 	if( !bFound )
1249*cdf0e10cSrcweir 		throw NoSuchElementException() ;
1250*cdf0e10cSrcweir 	return aRet;
1251*cdf0e10cSrcweir }
1252*cdf0e10cSrcweir 
1253*cdf0e10cSrcweir sal_Bool ImplIntrospectionAccess::hasProperty(const ::rtl::OUString& Name, sal_Int32 PropertyConcepts)
1254*cdf0e10cSrcweir 	throw( RuntimeException )
1255*cdf0e10cSrcweir {
1256*cdf0e10cSrcweir 	sal_Int32 i = mpStaticImpl->getPropertyIndex( Name );
1257*cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
1258*cdf0e10cSrcweir 	if( i != -1 )
1259*cdf0e10cSrcweir 	{
1260*cdf0e10cSrcweir 		sal_Int32 nConcept = mpStaticImpl->getPropertyConcepts().getConstArray()[ i ];
1261*cdf0e10cSrcweir 		if( (PropertyConcepts & nConcept) != 0 )
1262*cdf0e10cSrcweir 			bRet = sal_True;
1263*cdf0e10cSrcweir 	}
1264*cdf0e10cSrcweir 	return bRet;
1265*cdf0e10cSrcweir }
1266*cdf0e10cSrcweir 
1267*cdf0e10cSrcweir Sequence< Property > ImplIntrospectionAccess::getProperties(sal_Int32 PropertyConcepts)
1268*cdf0e10cSrcweir 	throw( RuntimeException )
1269*cdf0e10cSrcweir {
1270*cdf0e10cSrcweir 	// Wenn alle unterstuetzten Konzepte gefordert werden, Sequence einfach durchreichen
1271*cdf0e10cSrcweir 	sal_Int32 nAllSupportedMask =	PROPERTYSET |
1272*cdf0e10cSrcweir 									ATTRIBUTES |
1273*cdf0e10cSrcweir 									METHODS;
1274*cdf0e10cSrcweir 	if( ( PropertyConcepts & nAllSupportedMask ) == nAllSupportedMask )
1275*cdf0e10cSrcweir 	{
1276*cdf0e10cSrcweir 		return mpStaticImpl->getProperties();
1277*cdf0e10cSrcweir 	}
1278*cdf0e10cSrcweir 
1279*cdf0e10cSrcweir 	// Gleiche Sequence wie beim vorigen mal?
1280*cdf0e10cSrcweir 	if( mnLastPropertyConcept == PropertyConcepts )
1281*cdf0e10cSrcweir 	{
1282*cdf0e10cSrcweir 		return maLastPropertySeq;
1283*cdf0e10cSrcweir 	}
1284*cdf0e10cSrcweir 
1285*cdf0e10cSrcweir 	// Anzahl der zu liefernden Properties
1286*cdf0e10cSrcweir 	sal_Int32 nCount = 0;
1287*cdf0e10cSrcweir 
1288*cdf0e10cSrcweir 	// Es gibt zur Zeit keine DANGEROUS-Properties
1289*cdf0e10cSrcweir 	// if( PropertyConcepts & DANGEROUS )
1290*cdf0e10cSrcweir 	//	nCount += mpStaticImpl->mnDangerousPropCount;
1291*cdf0e10cSrcweir 	if( PropertyConcepts & PROPERTYSET )
1292*cdf0e10cSrcweir 		nCount += mpStaticImpl->mnPropertySetPropCount;
1293*cdf0e10cSrcweir 	if( PropertyConcepts & ATTRIBUTES )
1294*cdf0e10cSrcweir 		nCount += mpStaticImpl->mnAttributePropCount;
1295*cdf0e10cSrcweir 	if( PropertyConcepts & METHODS )
1296*cdf0e10cSrcweir 		nCount += mpStaticImpl->mnMethodPropCount;
1297*cdf0e10cSrcweir 
1298*cdf0e10cSrcweir 	// Sequence entsprechend der geforderten Anzahl reallocieren
1299*cdf0e10cSrcweir 	ImplIntrospectionAccess* pThis = (ImplIntrospectionAccess*)this;	// const umgehen
1300*cdf0e10cSrcweir 	pThis->maLastPropertySeq.realloc( nCount );
1301*cdf0e10cSrcweir 	Property* pDestProps = pThis->maLastPropertySeq.getArray();
1302*cdf0e10cSrcweir 
1303*cdf0e10cSrcweir 	// Alle Properties durchgehen und entsprechend der Concepte uebernehmen
1304*cdf0e10cSrcweir 	Sequence<Property> aPropSeq = mpStaticImpl->getProperties();
1305*cdf0e10cSrcweir 	const Property* pSourceProps = aPropSeq.getConstArray();
1306*cdf0e10cSrcweir 	const sal_Int32* pConcepts = mpStaticImpl->getPropertyConcepts().getConstArray();
1307*cdf0e10cSrcweir 	sal_Int32 nLen = aPropSeq.getLength();
1308*cdf0e10cSrcweir 
1309*cdf0e10cSrcweir 	sal_Int32 iDest = 0;
1310*cdf0e10cSrcweir 	for( sal_Int32 i = 0 ; i < nLen ; i++ )
1311*cdf0e10cSrcweir 	{
1312*cdf0e10cSrcweir 		sal_Int32 nConcept = pConcepts[ i ];
1313*cdf0e10cSrcweir 		if( nConcept & PropertyConcepts )
1314*cdf0e10cSrcweir 			pDestProps[ iDest++ ] = pSourceProps[ i ];
1315*cdf0e10cSrcweir 
1316*cdf0e10cSrcweir 		/*
1317*cdf0e10cSrcweir 		// Property mit Concepts ausgeben
1318*cdf0e10cSrcweir 	    ::rtl::OUString aPropName = pSourceProps[ i ].Name;
1319*cdf0e10cSrcweir 		String aNameStr = OOUStringToString(aPropName, CHARSET_SYSTEM);
1320*cdf0e10cSrcweir 		String ConceptStr;
1321*cdf0e10cSrcweir 		if( nConcept & PROPERTYSET )
1322*cdf0e10cSrcweir 			ConceptStr += "PROPERTYSET";
1323*cdf0e10cSrcweir 		if( nConcept & ATTRIBUTES )
1324*cdf0e10cSrcweir 			ConceptStr += "ATTRIBUTES";
1325*cdf0e10cSrcweir 		if( nConcept & METHODS )
1326*cdf0e10cSrcweir 			ConceptStr += "METHODS";
1327*cdf0e10cSrcweir 		printf( "Property %ld: %s, Concept = %s\n", i, aNameStr.GetStr(), ConceptStr.GetStr() );
1328*cdf0e10cSrcweir 		*/
1329*cdf0e10cSrcweir 	}
1330*cdf0e10cSrcweir 
1331*cdf0e10cSrcweir 	// PropertyConcept merken, dies entspricht maLastPropertySeq
1332*cdf0e10cSrcweir 	pThis->mnLastPropertyConcept = PropertyConcepts;
1333*cdf0e10cSrcweir 
1334*cdf0e10cSrcweir 	// Zusammengebastelte Sequence liefern
1335*cdf0e10cSrcweir 	return maLastPropertySeq;
1336*cdf0e10cSrcweir }
1337*cdf0e10cSrcweir 
1338*cdf0e10cSrcweir Reference<XIdlMethod> ImplIntrospectionAccess::getMethod(const ::rtl::OUString& Name, sal_Int32 MethodConcepts)
1339*cdf0e10cSrcweir 	throw( NoSuchMethodException, RuntimeException )
1340*cdf0e10cSrcweir {
1341*cdf0e10cSrcweir 	Reference<XIdlMethod> xRet;
1342*cdf0e10cSrcweir 	sal_Int32 i = mpStaticImpl->getMethodIndex( Name );
1343*cdf0e10cSrcweir 	if( i != -1 )
1344*cdf0e10cSrcweir 	{
1345*cdf0e10cSrcweir 
1346*cdf0e10cSrcweir 		sal_Int32 nConcept = mpStaticImpl->getMethodConcepts().getConstArray()[ i ];
1347*cdf0e10cSrcweir 		if( (MethodConcepts & nConcept) != 0 )
1348*cdf0e10cSrcweir 		{
1349*cdf0e10cSrcweir 			const Reference<XIdlMethod>* pMethods = mpStaticImpl->getMethods().getConstArray();
1350*cdf0e10cSrcweir 			xRet = pMethods[i];
1351*cdf0e10cSrcweir 		}
1352*cdf0e10cSrcweir 	}
1353*cdf0e10cSrcweir 	if( !xRet.is() )
1354*cdf0e10cSrcweir 		throw NoSuchMethodException();
1355*cdf0e10cSrcweir 	return xRet;
1356*cdf0e10cSrcweir }
1357*cdf0e10cSrcweir 
1358*cdf0e10cSrcweir sal_Bool ImplIntrospectionAccess::hasMethod(const ::rtl::OUString& Name, sal_Int32 MethodConcepts)
1359*cdf0e10cSrcweir 	throw( RuntimeException )
1360*cdf0e10cSrcweir {
1361*cdf0e10cSrcweir 	sal_Int32 i = mpStaticImpl->getMethodIndex( Name );
1362*cdf0e10cSrcweir 	sal_Bool bRet = sal_False;
1363*cdf0e10cSrcweir 	if( i != -1 )
1364*cdf0e10cSrcweir 	{
1365*cdf0e10cSrcweir 		sal_Int32 nConcept = mpStaticImpl->getMethodConcepts().getConstArray()[ i ];
1366*cdf0e10cSrcweir 		if( (MethodConcepts & nConcept) != 0 )
1367*cdf0e10cSrcweir 			bRet = sal_True;
1368*cdf0e10cSrcweir 	}
1369*cdf0e10cSrcweir 	return bRet;
1370*cdf0e10cSrcweir }
1371*cdf0e10cSrcweir 
1372*cdf0e10cSrcweir Sequence< Reference<XIdlMethod> > ImplIntrospectionAccess::getMethods(sal_Int32 MethodConcepts)
1373*cdf0e10cSrcweir 	throw( RuntimeException )
1374*cdf0e10cSrcweir {
1375*cdf0e10cSrcweir 	ImplIntrospectionAccess* pThis = (ImplIntrospectionAccess*)this;	// const umgehen
1376*cdf0e10cSrcweir 
1377*cdf0e10cSrcweir 	// Wenn alle unterstuetzten Konzepte gefordert werden, Sequence einfach durchreichen
1378*cdf0e10cSrcweir 	sal_Int32 nAllSupportedMask = 	MethodConcept::DANGEROUS |
1379*cdf0e10cSrcweir 									PROPERTY |
1380*cdf0e10cSrcweir 									LISTENER |
1381*cdf0e10cSrcweir 									ENUMERATION |
1382*cdf0e10cSrcweir 									NAMECONTAINER |
1383*cdf0e10cSrcweir 									INDEXCONTAINER |
1384*cdf0e10cSrcweir 									MethodConcept_NORMAL_IMPL;
1385*cdf0e10cSrcweir 	if( ( MethodConcepts & nAllSupportedMask ) == nAllSupportedMask )
1386*cdf0e10cSrcweir 	{
1387*cdf0e10cSrcweir 		return mpStaticImpl->getMethods();
1388*cdf0e10cSrcweir 	}
1389*cdf0e10cSrcweir 
1390*cdf0e10cSrcweir 	// Gleiche Sequence wie beim vorigen mal?
1391*cdf0e10cSrcweir 	if( mnLastMethodConcept == MethodConcepts )
1392*cdf0e10cSrcweir 	{
1393*cdf0e10cSrcweir 		return maLastMethodSeq;
1394*cdf0e10cSrcweir 	}
1395*cdf0e10cSrcweir 
1396*cdf0e10cSrcweir 	// Methoden-Sequences besorgen
1397*cdf0e10cSrcweir 	Sequence< Reference<XIdlMethod> > aMethodSeq = mpStaticImpl->getMethods();
1398*cdf0e10cSrcweir 	const Reference<XIdlMethod>* pSourceMethods = aMethodSeq.getConstArray();
1399*cdf0e10cSrcweir 	const sal_Int32* pConcepts = mpStaticImpl->getMethodConcepts().getConstArray();
1400*cdf0e10cSrcweir 	sal_Int32 nLen = aMethodSeq.getLength();
1401*cdf0e10cSrcweir 
1402*cdf0e10cSrcweir 	// Sequence entsprechend der geforderten Anzahl reallocieren
1403*cdf0e10cSrcweir 	// Anders als bei den Properties kann die Anzahl nicht durch
1404*cdf0e10cSrcweir 	// Zaehler in inspect() vorher ermittelt werden, da Methoden
1405*cdf0e10cSrcweir 	// mehreren Konzepten angehoeren koennen
1406*cdf0e10cSrcweir 	pThis->maLastMethodSeq.realloc( nLen );
1407*cdf0e10cSrcweir 	Reference<XIdlMethod>* pDestMethods = pThis->maLastMethodSeq.getArray();
1408*cdf0e10cSrcweir 
1409*cdf0e10cSrcweir 	// Alle Methods durchgehen und entsprechend der Concepte uebernehmen
1410*cdf0e10cSrcweir 	sal_Int32 iDest = 0;
1411*cdf0e10cSrcweir 	for( sal_Int32 i = 0 ; i < nLen ; i++ )
1412*cdf0e10cSrcweir 	{
1413*cdf0e10cSrcweir 		sal_Int32 nConcept = pConcepts[ i ];
1414*cdf0e10cSrcweir 		if( nConcept & MethodConcepts )
1415*cdf0e10cSrcweir 			pDestMethods[ iDest++ ] = pSourceMethods[ i ];
1416*cdf0e10cSrcweir 
1417*cdf0e10cSrcweir     #if OSL_DEBUG_LEVEL > 0
1418*cdf0e10cSrcweir         static bool debug = false;
1419*cdf0e10cSrcweir         if ( debug )
1420*cdf0e10cSrcweir         {
1421*cdf0e10cSrcweir 		    // Methode mit Concepts ausgeben
1422*cdf0e10cSrcweir 		    const Reference< XIdlMethod >& rxMethod = pSourceMethods[ i ];
1423*cdf0e10cSrcweir             ::rtl::OString aNameStr = ::rtl::OUStringToOString( rxMethod->getName(), osl_getThreadTextEncoding() );
1424*cdf0e10cSrcweir 		    ::rtl::OString ConceptStr;
1425*cdf0e10cSrcweir             if( nConcept & MethodConcept::DANGEROUS )
1426*cdf0e10cSrcweir 			    ConceptStr += "DANGEROUS |";
1427*cdf0e10cSrcweir 		    if( nConcept & MethodConcept::PROPERTY )
1428*cdf0e10cSrcweir 			    ConceptStr += "PROPERTY |";
1429*cdf0e10cSrcweir 		    if( nConcept & MethodConcept::LISTENER )
1430*cdf0e10cSrcweir 			    ConceptStr += "LISTENER |";
1431*cdf0e10cSrcweir 		    if( nConcept & MethodConcept::ENUMERATION )
1432*cdf0e10cSrcweir 			    ConceptStr += "ENUMERATION |";
1433*cdf0e10cSrcweir 		    if( nConcept & MethodConcept::NAMECONTAINER )
1434*cdf0e10cSrcweir 			    ConceptStr += "NAMECONTAINER |";
1435*cdf0e10cSrcweir 		    if( nConcept & MethodConcept::INDEXCONTAINER )
1436*cdf0e10cSrcweir 			    ConceptStr += "INDEXCONTAINER |";
1437*cdf0e10cSrcweir 		    OSL_TRACE( "Method %ld: %s, Concepts = %s", i, aNameStr.getStr(), ConceptStr.getStr() );
1438*cdf0e10cSrcweir         }
1439*cdf0e10cSrcweir     #endif
1440*cdf0e10cSrcweir 	}
1441*cdf0e10cSrcweir 
1442*cdf0e10cSrcweir 	// Auf die richtige Laenge bringen
1443*cdf0e10cSrcweir 	pThis->maLastMethodSeq.realloc( iDest );
1444*cdf0e10cSrcweir 
1445*cdf0e10cSrcweir 	// MethodConcept merken, dies entspricht maLastMethodSeq
1446*cdf0e10cSrcweir 	pThis->mnLastMethodConcept = MethodConcepts;
1447*cdf0e10cSrcweir 
1448*cdf0e10cSrcweir 	// Zusammengebastelte Sequence liefern
1449*cdf0e10cSrcweir 	return maLastMethodSeq;
1450*cdf0e10cSrcweir }
1451*cdf0e10cSrcweir 
1452*cdf0e10cSrcweir Sequence< Type > ImplIntrospectionAccess::getSupportedListeners(void)
1453*cdf0e10cSrcweir 	throw( RuntimeException )
1454*cdf0e10cSrcweir {
1455*cdf0e10cSrcweir 	return mpStaticImpl->getSupportedListeners();
1456*cdf0e10cSrcweir }
1457*cdf0e10cSrcweir 
1458*cdf0e10cSrcweir Reference<XInterface> SAL_CALL ImplIntrospectionAccess::queryAdapter( const Type& rType )
1459*cdf0e10cSrcweir 	throw( IllegalTypeException, RuntimeException )
1460*cdf0e10cSrcweir {
1461*cdf0e10cSrcweir 	// Gibt es schon einen Adapter?
1462*cdf0e10cSrcweir     Reference< XInterface > xAdapter( maAdapter );
1463*cdf0e10cSrcweir 	if( !xAdapter.is() )
1464*cdf0e10cSrcweir 	{
1465*cdf0e10cSrcweir         xAdapter = *( new ImplIntrospectionAdapter( this, maInspectedObject, mpStaticImpl ) );
1466*cdf0e10cSrcweir         maAdapter = xAdapter;
1467*cdf0e10cSrcweir 	}
1468*cdf0e10cSrcweir 
1469*cdf0e10cSrcweir 	Reference<XInterface> xRet;
1470*cdf0e10cSrcweir 	xAdapter->queryInterface( rType ) >>= xRet;
1471*cdf0e10cSrcweir 	return xRet;
1472*cdf0e10cSrcweir }
1473*cdf0e10cSrcweir 
1474*cdf0e10cSrcweir // Methoden von XMaterialHolder
1475*cdf0e10cSrcweir Any ImplIntrospectionAccess::getMaterial(void) throw(RuntimeException)
1476*cdf0e10cSrcweir {
1477*cdf0e10cSrcweir 	return maInspectedObject;
1478*cdf0e10cSrcweir }
1479*cdf0e10cSrcweir 
1480*cdf0e10cSrcweir // Hilfs-Funktion zur LowerCase-Wandlung eines ::rtl::OUString
1481*cdf0e10cSrcweir ::rtl::OUString toLower( ::rtl::OUString aUStr )
1482*cdf0e10cSrcweir {
1483*cdf0e10cSrcweir 	// Tabelle fuer XExactName pflegen
1484*cdf0e10cSrcweir     ::rtl::OUString aOWStr( aUStr.getStr() );
1485*cdf0e10cSrcweir 	::rtl::OUString aOWLowerStr = aOWStr.toAsciiLowerCase();
1486*cdf0e10cSrcweir     ::rtl::OUString aLowerUStr( aOWLowerStr.getStr() );
1487*cdf0e10cSrcweir 	return aLowerUStr;
1488*cdf0e10cSrcweir }
1489*cdf0e10cSrcweir 
1490*cdf0e10cSrcweir // Methoden von XExactName
1491*cdf0e10cSrcweir ::rtl::OUString ImplIntrospectionAccess::getExactName( const ::rtl::OUString& rApproximateName ) throw( RuntimeException )
1492*cdf0e10cSrcweir {
1493*cdf0e10cSrcweir     ::rtl::OUString aRetStr;
1494*cdf0e10cSrcweir 	LowerToExactNameMap::iterator aIt =
1495*cdf0e10cSrcweir 		mpStaticImpl->maLowerToExactNameMap.find( toLower( rApproximateName ) );
1496*cdf0e10cSrcweir 	if( !( aIt == mpStaticImpl->maLowerToExactNameMap.end() ) )
1497*cdf0e10cSrcweir 		aRetStr = (*aIt).second;
1498*cdf0e10cSrcweir 	return aRetStr;
1499*cdf0e10cSrcweir }
1500*cdf0e10cSrcweir 
1501*cdf0e10cSrcweir 
1502*cdf0e10cSrcweir //-----------------------------------------------------------------------------
1503*cdf0e10cSrcweir 
1504*cdf0e10cSrcweir #ifdef USE_INTROSPECTION_CACHE
1505*cdf0e10cSrcweir 
1506*cdf0e10cSrcweir struct hashIntrospectionKey_Impl
1507*cdf0e10cSrcweir {
1508*cdf0e10cSrcweir 	Sequence< Reference<XIdlClass> >	aIdlClasses;
1509*cdf0e10cSrcweir 	Reference<XPropertySetInfo>			xPropInfo;
1510*cdf0e10cSrcweir 	Reference<XIdlClass>				xImplClass;
1511*cdf0e10cSrcweir 	sal_Int32							nHitCount;
1512*cdf0e10cSrcweir 
1513*cdf0e10cSrcweir 	void	IncHitCount() const { ((hashIntrospectionKey_Impl*)this)->nHitCount++; }
1514*cdf0e10cSrcweir 	hashIntrospectionKey_Impl() : nHitCount( 0 ) {}
1515*cdf0e10cSrcweir 	hashIntrospectionKey_Impl( const Sequence< Reference<XIdlClass> > & rIdlClasses,
1516*cdf0e10cSrcweir 										const Reference<XPropertySetInfo> & rxPropInfo,
1517*cdf0e10cSrcweir 										const Reference<XIdlClass> & rxImplClass );
1518*cdf0e10cSrcweir };
1519*cdf0e10cSrcweir 
1520*cdf0e10cSrcweir hashIntrospectionKey_Impl::hashIntrospectionKey_Impl
1521*cdf0e10cSrcweir (
1522*cdf0e10cSrcweir 	const Sequence< Reference<XIdlClass> > & rIdlClasses,
1523*cdf0e10cSrcweir 	const Reference<XPropertySetInfo> & rxPropInfo,
1524*cdf0e10cSrcweir 	const Reference<XIdlClass> & rxImplClass
1525*cdf0e10cSrcweir )
1526*cdf0e10cSrcweir 		: aIdlClasses( rIdlClasses )
1527*cdf0e10cSrcweir 		, xPropInfo( rxPropInfo )
1528*cdf0e10cSrcweir 		, xImplClass( rxImplClass )
1529*cdf0e10cSrcweir 		, nHitCount( 0 )
1530*cdf0e10cSrcweir {}
1531*cdf0e10cSrcweir 
1532*cdf0e10cSrcweir 
1533*cdf0e10cSrcweir struct hashIntrospectionAccessCache_Impl
1534*cdf0e10cSrcweir {
1535*cdf0e10cSrcweir 	size_t operator()(const hashIntrospectionKey_Impl & rObj ) const
1536*cdf0e10cSrcweir 	{
1537*cdf0e10cSrcweir 		return (size_t)rObj.xImplClass.get() ^ (size_t)rObj.xPropInfo.get();
1538*cdf0e10cSrcweir 	}
1539*cdf0e10cSrcweir 
1540*cdf0e10cSrcweir 	bool operator()( const hashIntrospectionKey_Impl & rObj1,
1541*cdf0e10cSrcweir 					 const hashIntrospectionKey_Impl & rObj2 ) const
1542*cdf0e10cSrcweir 	{
1543*cdf0e10cSrcweir 		if( rObj1.xPropInfo != rObj2.xPropInfo
1544*cdf0e10cSrcweir 		  || rObj1.xImplClass != rObj2.xImplClass )
1545*cdf0e10cSrcweir 			return sal_False;
1546*cdf0e10cSrcweir 
1547*cdf0e10cSrcweir 		sal_Int32 nCount1 = rObj1.aIdlClasses.getLength();
1548*cdf0e10cSrcweir 		sal_Int32 nCount2 = rObj2.aIdlClasses.getLength();
1549*cdf0e10cSrcweir 		if( nCount1 != nCount2 )
1550*cdf0e10cSrcweir 			return sal_False;
1551*cdf0e10cSrcweir 
1552*cdf0e10cSrcweir 		const Reference<XIdlClass>* pRefs1 = rObj1.aIdlClasses.getConstArray();
1553*cdf0e10cSrcweir 		const Reference<XIdlClass>* pRefs2 = rObj2.aIdlClasses.getConstArray();
1554*cdf0e10cSrcweir 		return memcmp( pRefs1, pRefs2, nCount1 * sizeof( Reference<XIdlClass> ) ) == 0;
1555*cdf0e10cSrcweir 	}
1556*cdf0e10cSrcweir 
1557*cdf0e10cSrcweir };
1558*cdf0e10cSrcweir 
1559*cdf0e10cSrcweir typedef std::hash_map
1560*cdf0e10cSrcweir <
1561*cdf0e10cSrcweir 	hashIntrospectionKey_Impl,
1562*cdf0e10cSrcweir 	IntrospectionAccessStatic_Impl*,
1563*cdf0e10cSrcweir 	hashIntrospectionAccessCache_Impl,
1564*cdf0e10cSrcweir 	hashIntrospectionAccessCache_Impl
1565*cdf0e10cSrcweir >
1566*cdf0e10cSrcweir IntrospectionAccessCacheMap_Impl;
1567*cdf0e10cSrcweir 
1568*cdf0e10cSrcweir class IntrospectionAccessCacheMap : public IntrospectionAccessCacheMap_Impl
1569*cdf0e10cSrcweir {
1570*cdf0e10cSrcweir public:
1571*cdf0e10cSrcweir  	~IntrospectionAccessCacheMap()
1572*cdf0e10cSrcweir  	{
1573*cdf0e10cSrcweir  		IntrospectionAccessCacheMap::iterator iter = begin();
1574*cdf0e10cSrcweir  		IntrospectionAccessCacheMap::iterator stop = this->end();
1575*cdf0e10cSrcweir  		while( iter != stop )
1576*cdf0e10cSrcweir  		{
1577*cdf0e10cSrcweir 
1578*cdf0e10cSrcweir 			(*iter).second->release();
1579*cdf0e10cSrcweir 			(*iter).second = NULL;
1580*cdf0e10cSrcweir 			iter++;
1581*cdf0e10cSrcweir 		}
1582*cdf0e10cSrcweir 	}
1583*cdf0e10cSrcweir };
1584*cdf0e10cSrcweir 
1585*cdf0e10cSrcweir 
1586*cdf0e10cSrcweir // For XTypeProvider
1587*cdf0e10cSrcweir struct hashTypeProviderKey_Impl
1588*cdf0e10cSrcweir {
1589*cdf0e10cSrcweir 	Reference<XPropertySetInfo>			xPropInfo;
1590*cdf0e10cSrcweir 	Sequence< sal_Int8 >				maImpIdSeq;
1591*cdf0e10cSrcweir 	sal_Int32							nHitCount;
1592*cdf0e10cSrcweir 
1593*cdf0e10cSrcweir 	void	IncHitCount() const { ((hashTypeProviderKey_Impl*)this)->nHitCount++; }
1594*cdf0e10cSrcweir 	hashTypeProviderKey_Impl() : nHitCount( 0 ) {}
1595*cdf0e10cSrcweir 	hashTypeProviderKey_Impl( const Reference<XPropertySetInfo> & rxPropInfo, const Sequence< sal_Int8 > & aImpIdSeq_ );
1596*cdf0e10cSrcweir };
1597*cdf0e10cSrcweir 
1598*cdf0e10cSrcweir hashTypeProviderKey_Impl::hashTypeProviderKey_Impl
1599*cdf0e10cSrcweir (
1600*cdf0e10cSrcweir 	const Reference<XPropertySetInfo> & rxPropInfo,
1601*cdf0e10cSrcweir 	const Sequence< sal_Int8 > & aImpIdSeq_
1602*cdf0e10cSrcweir )
1603*cdf0e10cSrcweir 	: xPropInfo( rxPropInfo )
1604*cdf0e10cSrcweir 	, maImpIdSeq( aImpIdSeq_ )
1605*cdf0e10cSrcweir 	, nHitCount( 0 )
1606*cdf0e10cSrcweir {}
1607*cdf0e10cSrcweir 
1608*cdf0e10cSrcweir 
1609*cdf0e10cSrcweir struct TypeProviderAccessCache_Impl
1610*cdf0e10cSrcweir {
1611*cdf0e10cSrcweir 	size_t operator()(const hashTypeProviderKey_Impl & rObj ) const;
1612*cdf0e10cSrcweir 
1613*cdf0e10cSrcweir 	bool operator()( const hashTypeProviderKey_Impl & rObj1,
1614*cdf0e10cSrcweir 					 const hashTypeProviderKey_Impl & rObj2 ) const
1615*cdf0e10cSrcweir 	{
1616*cdf0e10cSrcweir 		if( rObj1.xPropInfo != rObj2.xPropInfo )
1617*cdf0e10cSrcweir 			return sal_False;
1618*cdf0e10cSrcweir 
1619*cdf0e10cSrcweir 		bool bEqual = false;
1620*cdf0e10cSrcweir 		sal_Int32 nLen1 = rObj1.maImpIdSeq.getLength();
1621*cdf0e10cSrcweir 		sal_Int32 nLen2 = rObj2.maImpIdSeq.getLength();
1622*cdf0e10cSrcweir 		if( nLen1 == nLen2 && nLen1 > 0 )
1623*cdf0e10cSrcweir 		{
1624*cdf0e10cSrcweir 			const sal_Int8* pId1 = rObj1.maImpIdSeq.getConstArray();
1625*cdf0e10cSrcweir 			const sal_Int8* pId2 = rObj2.maImpIdSeq.getConstArray();
1626*cdf0e10cSrcweir 			bEqual = (memcmp( pId1, pId2, nLen1 * sizeof( sal_Int8 ) ) == 0 );
1627*cdf0e10cSrcweir 		}
1628*cdf0e10cSrcweir 		return bEqual;
1629*cdf0e10cSrcweir 	}
1630*cdf0e10cSrcweir };
1631*cdf0e10cSrcweir 
1632*cdf0e10cSrcweir size_t TypeProviderAccessCache_Impl::operator()(const hashTypeProviderKey_Impl & rObj ) const
1633*cdf0e10cSrcweir {
1634*cdf0e10cSrcweir 	const sal_Int32* pBytesAsInt32Array = (const sal_Int32*)rObj.maImpIdSeq.getConstArray();
1635*cdf0e10cSrcweir 	sal_Int32 nLen = rObj.maImpIdSeq.getLength();
1636*cdf0e10cSrcweir 	sal_Int32 nCount32 = nLen / 4;
1637*cdf0e10cSrcweir 	sal_Int32 nMod32 = nLen % 4;
1638*cdf0e10cSrcweir 
1639*cdf0e10cSrcweir 	// XOR with full 32 bit values
1640*cdf0e10cSrcweir 	sal_Int32 nId32 = 0;
1641*cdf0e10cSrcweir 	sal_Int32 i;
1642*cdf0e10cSrcweir 	for( i = 0 ; i < nCount32 ; i++ )
1643*cdf0e10cSrcweir 		nId32 ^= *(pBytesAsInt32Array++);
1644*cdf0e10cSrcweir 
1645*cdf0e10cSrcweir 	// XOR with remaining byte values
1646*cdf0e10cSrcweir 	if( nMod32 )
1647*cdf0e10cSrcweir 	{
1648*cdf0e10cSrcweir 		const sal_Int8* pBytes = (const sal_Int8*)pBytesAsInt32Array;
1649*cdf0e10cSrcweir 		sal_Int8* pInt8_Id32 = (sal_Int8*)&nId32;
1650*cdf0e10cSrcweir 		for( i = 0 ; i < nMod32 ; i++ )
1651*cdf0e10cSrcweir 			*(pInt8_Id32++) ^= *(pBytes++);
1652*cdf0e10cSrcweir 	}
1653*cdf0e10cSrcweir 
1654*cdf0e10cSrcweir 	return (size_t)nId32;
1655*cdf0e10cSrcweir }
1656*cdf0e10cSrcweir 
1657*cdf0e10cSrcweir 
1658*cdf0e10cSrcweir typedef std::hash_map
1659*cdf0e10cSrcweir <
1660*cdf0e10cSrcweir 	hashTypeProviderKey_Impl,
1661*cdf0e10cSrcweir 	IntrospectionAccessStatic_Impl*,
1662*cdf0e10cSrcweir 	TypeProviderAccessCache_Impl,
1663*cdf0e10cSrcweir 	TypeProviderAccessCache_Impl
1664*cdf0e10cSrcweir >
1665*cdf0e10cSrcweir TypeProviderAccessCacheMap_Impl;
1666*cdf0e10cSrcweir 
1667*cdf0e10cSrcweir class TypeProviderAccessCacheMap : public TypeProviderAccessCacheMap_Impl
1668*cdf0e10cSrcweir {
1669*cdf0e10cSrcweir public:
1670*cdf0e10cSrcweir  	~TypeProviderAccessCacheMap()
1671*cdf0e10cSrcweir  	{
1672*cdf0e10cSrcweir  		TypeProviderAccessCacheMap::iterator iter = begin();
1673*cdf0e10cSrcweir  		TypeProviderAccessCacheMap::iterator stop = this->end();
1674*cdf0e10cSrcweir  		while( iter != stop )
1675*cdf0e10cSrcweir  		{
1676*cdf0e10cSrcweir 			(*iter).second->release();
1677*cdf0e10cSrcweir 			(*iter).second = NULL;
1678*cdf0e10cSrcweir 			iter++;
1679*cdf0e10cSrcweir 		}
1680*cdf0e10cSrcweir 	}
1681*cdf0e10cSrcweir };
1682*cdf0e10cSrcweir 
1683*cdf0e10cSrcweir #endif
1684*cdf0e10cSrcweir 
1685*cdf0e10cSrcweir 
1686*cdf0e10cSrcweir //*************************
1687*cdf0e10cSrcweir //*** ImplIntrospection ***
1688*cdf0e10cSrcweir //*************************
1689*cdf0e10cSrcweir 
1690*cdf0e10cSrcweir struct OIntrospectionMutex
1691*cdf0e10cSrcweir {
1692*cdf0e10cSrcweir 	Mutex							m_mutex;
1693*cdf0e10cSrcweir };
1694*cdf0e10cSrcweir 
1695*cdf0e10cSrcweir class ImplIntrospection : public XIntrospection
1696*cdf0e10cSrcweir 						, public XServiceInfo
1697*cdf0e10cSrcweir 						, public OIntrospectionMutex
1698*cdf0e10cSrcweir 						, public OComponentHelper
1699*cdf0e10cSrcweir {
1700*cdf0e10cSrcweir 	friend class ImplMergeIntrospection;
1701*cdf0e10cSrcweir 	friend class ImplMVCIntrospection;
1702*cdf0e10cSrcweir 
1703*cdf0e10cSrcweir 	// Implementation der Introspection.
1704*cdf0e10cSrcweir 	// ACHTUNG: RefCounting von Hand !!!
1705*cdf0e10cSrcweir 	IntrospectionAccessStatic_Impl* implInspect(const Any& aToInspectObj);
1706*cdf0e10cSrcweir 
1707*cdf0e10cSrcweir 	// Save XMultiServiceFactory from createComponent
1708*cdf0e10cSrcweir 	Reference<XMultiServiceFactory> m_xSMgr;
1709*cdf0e10cSrcweir 
1710*cdf0e10cSrcweir 	// CoreReflection halten
1711*cdf0e10cSrcweir 	Reference< XIdlReflection > mxCoreReflection;
1712*cdf0e10cSrcweir 
1713*cdf0e10cSrcweir 	// Klassen, deren Methoden eine spezielle Rolle spielen
1714*cdf0e10cSrcweir 	Reference<XIdlClass> mxElementAccessClass;
1715*cdf0e10cSrcweir 	Reference<XIdlClass> mxNameContainerClass;
1716*cdf0e10cSrcweir 	Reference<XIdlClass> mxNameAccessClass;
1717*cdf0e10cSrcweir 	Reference<XIdlClass> mxIndexContainerClass;
1718*cdf0e10cSrcweir 	Reference<XIdlClass> mxIndexAccessClass;
1719*cdf0e10cSrcweir 	Reference<XIdlClass> mxEnumerationAccessClass;
1720*cdf0e10cSrcweir 	Reference<XIdlClass> mxInterfaceClass;
1721*cdf0e10cSrcweir 	Reference<XIdlClass> mxAggregationClass;
1722*cdf0e10cSrcweir 	sal_Bool mbDisposed;
1723*cdf0e10cSrcweir 
1724*cdf0e10cSrcweir #ifdef USE_INTROSPECTION_CACHE
1725*cdf0e10cSrcweir 	sal_uInt16 mnCacheEntryCount;
1726*cdf0e10cSrcweir 	sal_uInt16 mnTPCacheEntryCount;
1727*cdf0e10cSrcweir 	IntrospectionAccessCacheMap* mpCache;
1728*cdf0e10cSrcweir 	TypeProviderAccessCacheMap* mpTypeProviderCache;
1729*cdf0e10cSrcweir #endif
1730*cdf0e10cSrcweir 
1731*cdf0e10cSrcweir public:
1732*cdf0e10cSrcweir 	ImplIntrospection( const Reference<XMultiServiceFactory> & rXSMgr );
1733*cdf0e10cSrcweir 
1734*cdf0e10cSrcweir 	// Methoden von XInterface
1735*cdf0e10cSrcweir 	virtual Any			SAL_CALL queryInterface( const Type& rType ) throw( RuntimeException );
1736*cdf0e10cSrcweir 	virtual void		SAL_CALL acquire() throw() { OComponentHelper::acquire(); }
1737*cdf0e10cSrcweir 	virtual void		SAL_CALL release() throw() { OComponentHelper::release(); }
1738*cdf0e10cSrcweir 
1739*cdf0e10cSrcweir 	// XTypeProvider
1740*cdf0e10cSrcweir     Sequence< Type >	SAL_CALL getTypes(  ) throw( RuntimeException );
1741*cdf0e10cSrcweir     Sequence<sal_Int8>	SAL_CALL getImplementationId(  ) throw( RuntimeException );
1742*cdf0e10cSrcweir 
1743*cdf0e10cSrcweir 	// XServiceInfo
1744*cdf0e10cSrcweir     ::rtl::OUString 					SAL_CALL getImplementationName() throw();
1745*cdf0e10cSrcweir     sal_Bool					SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw();
1746*cdf0e10cSrcweir     Sequence< ::rtl::OUString > 		SAL_CALL getSupportedServiceNames(void) throw();
1747*cdf0e10cSrcweir     static ::rtl::OUString SAL_CALL	getImplementationName_Static(  );
1748*cdf0e10cSrcweir     static Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_Static(void) throw();
1749*cdf0e10cSrcweir 
1750*cdf0e10cSrcweir 	// Methoden von XIntrospection
1751*cdf0e10cSrcweir     virtual Reference<XIntrospectionAccess> SAL_CALL inspect(const Any& aToInspectObj)
1752*cdf0e10cSrcweir 				throw( RuntimeException );
1753*cdf0e10cSrcweir 
1754*cdf0e10cSrcweir protected:
1755*cdf0e10cSrcweir 	// some XComponent part from OComponentHelper
1756*cdf0e10cSrcweir 	virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException);
1757*cdf0e10cSrcweir };
1758*cdf0e10cSrcweir 
1759*cdf0e10cSrcweir enum MethodType
1760*cdf0e10cSrcweir {
1761*cdf0e10cSrcweir 	STANDARD_METHOD,			// normale Methode, kein Bezug zu Properties oder Listenern
1762*cdf0e10cSrcweir 	GETSET_METHOD,				// gehoert zu einer get/set-Property
1763*cdf0e10cSrcweir 	ADD_LISTENER_METHOD,		// add-Methode einer Listener-Schnittstelle
1764*cdf0e10cSrcweir 	REMOVE_LISTENER_METHOD,		// remove-Methode einer Listener-Schnittstelle
1765*cdf0e10cSrcweir 	INVALID_METHOD				// Methode, deren Klasse nicht beruecksichtigt wird, z.B. XPropertySet
1766*cdf0e10cSrcweir };
1767*cdf0e10cSrcweir 
1768*cdf0e10cSrcweir // Ctor
1769*cdf0e10cSrcweir ImplIntrospection::ImplIntrospection( const Reference<XMultiServiceFactory> & rXSMgr )
1770*cdf0e10cSrcweir 	: OComponentHelper( m_mutex )
1771*cdf0e10cSrcweir 	, m_xSMgr( rXSMgr )
1772*cdf0e10cSrcweir {
1773*cdf0e10cSrcweir #ifdef USE_INTROSPECTION_CACHE
1774*cdf0e10cSrcweir 	mnCacheEntryCount = 0;
1775*cdf0e10cSrcweir     mnTPCacheEntryCount = 0;
1776*cdf0e10cSrcweir 	mpCache = NULL;
1777*cdf0e10cSrcweir 	mpTypeProviderCache = NULL;
1778*cdf0e10cSrcweir #endif
1779*cdf0e10cSrcweir 
1780*cdf0e10cSrcweir 	// Spezielle Klassen holen
1781*cdf0e10cSrcweir // 	Reference< XInterface > xServiceIface = m_xSMgr->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.reflection.CoreReflection")) );
1782*cdf0e10cSrcweir // 	if( xServiceIface.is() )
1783*cdf0e10cSrcweir // 		mxCoreReflection = Reference< XIdlReflection >::query( xServiceIface );
1784*cdf0e10cSrcweir     Reference< XPropertySet > xProps( rXSMgr, UNO_QUERY );
1785*cdf0e10cSrcweir     OSL_ASSERT( xProps.is() );
1786*cdf0e10cSrcweir     if (xProps.is())
1787*cdf0e10cSrcweir     {
1788*cdf0e10cSrcweir         Reference< XComponentContext > xContext;
1789*cdf0e10cSrcweir         xProps->getPropertyValue(
1790*cdf0e10cSrcweir             ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ) >>= xContext;
1791*cdf0e10cSrcweir         OSL_ASSERT( xContext.is() );
1792*cdf0e10cSrcweir         if (xContext.is())
1793*cdf0e10cSrcweir         {
1794*cdf0e10cSrcweir             xContext->getValueByName(
1795*cdf0e10cSrcweir                 ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.reflection.theCoreReflection") ) ) >>= mxCoreReflection;
1796*cdf0e10cSrcweir             OSL_ENSURE( mxCoreReflection.is(), "### CoreReflection singleton not accessible!?" );
1797*cdf0e10cSrcweir         }
1798*cdf0e10cSrcweir     }
1799*cdf0e10cSrcweir     if (! mxCoreReflection.is())
1800*cdf0e10cSrcweir     {
1801*cdf0e10cSrcweir         throw DeploymentException(
1802*cdf0e10cSrcweir             ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.reflection.theCoreReflection singleton not accessible") ),
1803*cdf0e10cSrcweir             Reference< XInterface >() );
1804*cdf0e10cSrcweir     }
1805*cdf0e10cSrcweir 
1806*cdf0e10cSrcweir 	mxElementAccessClass = mxCoreReflection->forName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.container.XElementAccess")) );
1807*cdf0e10cSrcweir 	mxNameContainerClass = mxCoreReflection->forName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.container.XNameContainer")) );
1808*cdf0e10cSrcweir 	mxNameAccessClass = mxCoreReflection->forName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.container.XNameAccess")) );
1809*cdf0e10cSrcweir 	mxIndexContainerClass = mxCoreReflection->forName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.container.XIndexContainer")) );
1810*cdf0e10cSrcweir 	mxIndexAccessClass = mxCoreReflection->forName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.container.XIndexAccess")) );
1811*cdf0e10cSrcweir 	mxEnumerationAccessClass = mxCoreReflection->forName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.container.XEnumerationAccess")) );
1812*cdf0e10cSrcweir 	mxInterfaceClass = mxCoreReflection->forName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.XInterface")) );
1813*cdf0e10cSrcweir 	mxAggregationClass = mxCoreReflection->forName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.uno.XAggregation")) );
1814*cdf0e10cSrcweir 	mbDisposed = sal_False;
1815*cdf0e10cSrcweir }
1816*cdf0e10cSrcweir 
1817*cdf0e10cSrcweir // XComponent
1818*cdf0e10cSrcweir void ImplIntrospection::dispose() throw(::com::sun::star::uno::RuntimeException)
1819*cdf0e10cSrcweir {
1820*cdf0e10cSrcweir 	OComponentHelper::dispose();
1821*cdf0e10cSrcweir 
1822*cdf0e10cSrcweir #ifdef USE_INTROSPECTION_CACHE
1823*cdf0e10cSrcweir 	// Cache loeschen
1824*cdf0e10cSrcweir 	delete mpCache;
1825*cdf0e10cSrcweir 	mpCache = NULL;
1826*cdf0e10cSrcweir 	delete mpTypeProviderCache;
1827*cdf0e10cSrcweir 	mpTypeProviderCache = NULL;
1828*cdf0e10cSrcweir #endif
1829*cdf0e10cSrcweir 
1830*cdf0e10cSrcweir 	mxElementAccessClass = NULL;
1831*cdf0e10cSrcweir 	mxNameContainerClass = NULL;
1832*cdf0e10cSrcweir 	mxNameAccessClass = NULL;
1833*cdf0e10cSrcweir 	mxIndexContainerClass = NULL;
1834*cdf0e10cSrcweir 	mxIndexAccessClass = NULL;
1835*cdf0e10cSrcweir 	mxEnumerationAccessClass = NULL;
1836*cdf0e10cSrcweir 	mxInterfaceClass = NULL;
1837*cdf0e10cSrcweir 	mxAggregationClass = NULL;
1838*cdf0e10cSrcweir 	mbDisposed = sal_True;
1839*cdf0e10cSrcweir }
1840*cdf0e10cSrcweir 
1841*cdf0e10cSrcweir 
1842*cdf0e10cSrcweir //-----------------------------------------------------------------------------
1843*cdf0e10cSrcweir 
1844*cdf0e10cSrcweir // XInterface
1845*cdf0e10cSrcweir Any ImplIntrospection::queryInterface( const Type & rType )
1846*cdf0e10cSrcweir 	throw(::com::sun::star::uno::RuntimeException)
1847*cdf0e10cSrcweir {
1848*cdf0e10cSrcweir 	Any aRet( ::cppu::queryInterface(
1849*cdf0e10cSrcweir 		rType,
1850*cdf0e10cSrcweir 		static_cast< XIntrospection * >( this ),
1851*cdf0e10cSrcweir 		static_cast< XServiceInfo * >( this ) ) );
1852*cdf0e10cSrcweir 
1853*cdf0e10cSrcweir 	return (aRet.hasValue() ? aRet : OComponentHelper::queryInterface( rType ));
1854*cdf0e10cSrcweir }
1855*cdf0e10cSrcweir 
1856*cdf0e10cSrcweir // XTypeProvider
1857*cdf0e10cSrcweir Sequence< Type > ImplIntrospection::getTypes()
1858*cdf0e10cSrcweir 	throw( RuntimeException )
1859*cdf0e10cSrcweir {
1860*cdf0e10cSrcweir 	static OTypeCollection * s_pTypes = 0;
1861*cdf0e10cSrcweir 	if (! s_pTypes)
1862*cdf0e10cSrcweir 	{
1863*cdf0e10cSrcweir 		MutexGuard aGuard( Mutex::getGlobalMutex() );
1864*cdf0e10cSrcweir 		if (! s_pTypes)
1865*cdf0e10cSrcweir 		{
1866*cdf0e10cSrcweir 			static OTypeCollection s_aTypes(
1867*cdf0e10cSrcweir 				::getCppuType( (const Reference< XIntrospection > *)0 ),
1868*cdf0e10cSrcweir 				::getCppuType( (const Reference< XServiceInfo > *)0 ),
1869*cdf0e10cSrcweir 				OComponentHelper::getTypes() );
1870*cdf0e10cSrcweir 			s_pTypes = &s_aTypes;
1871*cdf0e10cSrcweir 		}
1872*cdf0e10cSrcweir 	}
1873*cdf0e10cSrcweir 	return s_pTypes->getTypes();
1874*cdf0e10cSrcweir }
1875*cdf0e10cSrcweir 
1876*cdf0e10cSrcweir Sequence< sal_Int8 > ImplIntrospection::getImplementationId()
1877*cdf0e10cSrcweir 	throw( RuntimeException )
1878*cdf0e10cSrcweir {
1879*cdf0e10cSrcweir 	static OImplementationId * s_pId = 0;
1880*cdf0e10cSrcweir 	if (! s_pId)
1881*cdf0e10cSrcweir 	{
1882*cdf0e10cSrcweir 		MutexGuard aGuard( Mutex::getGlobalMutex() );
1883*cdf0e10cSrcweir 		if (! s_pId)
1884*cdf0e10cSrcweir 		{
1885*cdf0e10cSrcweir 			static OImplementationId s_aId;
1886*cdf0e10cSrcweir 			s_pId = &s_aId;
1887*cdf0e10cSrcweir 		}
1888*cdf0e10cSrcweir 	}
1889*cdf0e10cSrcweir 	return s_pId->getImplementationId();
1890*cdf0e10cSrcweir }
1891*cdf0e10cSrcweir 
1892*cdf0e10cSrcweir 
1893*cdf0e10cSrcweir // XServiceInfo
1894*cdf0e10cSrcweir ::rtl::OUString ImplIntrospection::getImplementationName() throw()
1895*cdf0e10cSrcweir {
1896*cdf0e10cSrcweir 	return getImplementationName_Static();
1897*cdf0e10cSrcweir }
1898*cdf0e10cSrcweir 
1899*cdf0e10cSrcweir // XServiceInfo
1900*cdf0e10cSrcweir sal_Bool ImplIntrospection::supportsService(const ::rtl::OUString& ServiceName) throw()
1901*cdf0e10cSrcweir {
1902*cdf0e10cSrcweir 	Sequence< ::rtl::OUString > aSNL = getSupportedServiceNames();
1903*cdf0e10cSrcweir 	const ::rtl::OUString * pArray = aSNL.getConstArray();
1904*cdf0e10cSrcweir 	for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
1905*cdf0e10cSrcweir 		if( pArray[i] == ServiceName )
1906*cdf0e10cSrcweir 			return sal_True;
1907*cdf0e10cSrcweir 	return sal_False;
1908*cdf0e10cSrcweir }
1909*cdf0e10cSrcweir 
1910*cdf0e10cSrcweir // XServiceInfo
1911*cdf0e10cSrcweir Sequence< ::rtl::OUString > ImplIntrospection::getSupportedServiceNames(void) throw()
1912*cdf0e10cSrcweir {
1913*cdf0e10cSrcweir 	return getSupportedServiceNames_Static();
1914*cdf0e10cSrcweir }
1915*cdf0e10cSrcweir 
1916*cdf0e10cSrcweir //*************************************************************************
1917*cdf0e10cSrcweir // Helper XServiceInfo
1918*cdf0e10cSrcweir ::rtl::OUString ImplIntrospection::getImplementationName_Static(  )
1919*cdf0e10cSrcweir {
1920*cdf0e10cSrcweir 	return ::rtl::OUString::createFromAscii( IMPLEMENTATION_NAME );
1921*cdf0e10cSrcweir }
1922*cdf0e10cSrcweir 
1923*cdf0e10cSrcweir // ORegistryServiceManager_Static
1924*cdf0e10cSrcweir Sequence< ::rtl::OUString > ImplIntrospection::getSupportedServiceNames_Static(void) throw()
1925*cdf0e10cSrcweir {
1926*cdf0e10cSrcweir 	Sequence< ::rtl::OUString > aSNS( 1 );
1927*cdf0e10cSrcweir 	aSNS.getArray()[0] = ::rtl::OUString::createFromAscii( SERVICE_NAME );
1928*cdf0e10cSrcweir 	return aSNS;
1929*cdf0e10cSrcweir }
1930*cdf0e10cSrcweir 
1931*cdf0e10cSrcweir //*************************************************************************
1932*cdf0e10cSrcweir 
1933*cdf0e10cSrcweir // Methoden von XIntrospection
1934*cdf0e10cSrcweir Reference<XIntrospectionAccess> ImplIntrospection::inspect(const Any& aToInspectObj)
1935*cdf0e10cSrcweir 	throw( RuntimeException )
1936*cdf0e10cSrcweir {
1937*cdf0e10cSrcweir 	Reference<XIntrospectionAccess> xAccess;
1938*cdf0e10cSrcweir 
1939*cdf0e10cSrcweir 	if ( aToInspectObj.getValueType().getTypeClass() == TypeClass_TYPE )
1940*cdf0e10cSrcweir 	{
1941*cdf0e10cSrcweir 		Type aType;
1942*cdf0e10cSrcweir 		aToInspectObj >>= aType;
1943*cdf0e10cSrcweir 
1944*cdf0e10cSrcweir 		Reference< XIdlClass > xIdlClass = mxCoreReflection->forName(((Type*)(aToInspectObj.getValue()))->getTypeName());
1945*cdf0e10cSrcweir 
1946*cdf0e10cSrcweir 		if ( xIdlClass.is() )
1947*cdf0e10cSrcweir 		{
1948*cdf0e10cSrcweir 			Any aRealInspectObj;
1949*cdf0e10cSrcweir 			aRealInspectObj <<= xIdlClass;
1950*cdf0e10cSrcweir 
1951*cdf0e10cSrcweir 			IntrospectionAccessStatic_Impl* pStaticImpl = implInspect( aRealInspectObj );
1952*cdf0e10cSrcweir 			if( pStaticImpl )
1953*cdf0e10cSrcweir 				xAccess = new ImplIntrospectionAccess( aRealInspectObj, pStaticImpl );
1954*cdf0e10cSrcweir 		}
1955*cdf0e10cSrcweir 	}
1956*cdf0e10cSrcweir 	else
1957*cdf0e10cSrcweir 	{
1958*cdf0e10cSrcweir 		IntrospectionAccessStatic_Impl* pStaticImpl = implInspect( aToInspectObj );
1959*cdf0e10cSrcweir 		if( pStaticImpl )
1960*cdf0e10cSrcweir 			xAccess = new ImplIntrospectionAccess( aToInspectObj, pStaticImpl );
1961*cdf0e10cSrcweir 	}
1962*cdf0e10cSrcweir 
1963*cdf0e10cSrcweir 	return xAccess;
1964*cdf0e10cSrcweir }
1965*cdf0e10cSrcweir 
1966*cdf0e10cSrcweir //-----------------------------------------------------------------------------
1967*cdf0e10cSrcweir 
1968*cdf0e10cSrcweir // Hashtable fuer Pruefung auf mehrfache Beruecksichtigung von Interfaces
1969*cdf0e10cSrcweir struct hashInterface_Impl
1970*cdf0e10cSrcweir {
1971*cdf0e10cSrcweir 	size_t operator()(const void* p) const
1972*cdf0e10cSrcweir 	{
1973*cdf0e10cSrcweir 		return (size_t)p;
1974*cdf0e10cSrcweir 	}
1975*cdf0e10cSrcweir };
1976*cdf0e10cSrcweir 
1977*cdf0e10cSrcweir struct eqInterface_Impl
1978*cdf0e10cSrcweir {
1979*cdf0e10cSrcweir 	bool operator()(const void* p1, const void* p2) const
1980*cdf0e10cSrcweir 	{
1981*cdf0e10cSrcweir 		return ( p1 == p2 );
1982*cdf0e10cSrcweir 	}
1983*cdf0e10cSrcweir };
1984*cdf0e10cSrcweir 
1985*cdf0e10cSrcweir typedef std::hash_map
1986*cdf0e10cSrcweir <
1987*cdf0e10cSrcweir 	void*,
1988*cdf0e10cSrcweir 	void*,
1989*cdf0e10cSrcweir 	hashInterface_Impl,
1990*cdf0e10cSrcweir 	eqInterface_Impl
1991*cdf0e10cSrcweir >
1992*cdf0e10cSrcweir CheckedInterfacesMap;
1993*cdf0e10cSrcweir 
1994*cdf0e10cSrcweir 
1995*cdf0e10cSrcweir 
1996*cdf0e10cSrcweir // TODO: Spaeter auslagern
1997*cdf0e10cSrcweir Reference<XIdlClass> TypeToIdlClass( const Type& rType, const Reference< XMultiServiceFactory > & xMgr )
1998*cdf0e10cSrcweir {
1999*cdf0e10cSrcweir 	static Reference< XIdlReflection > xRefl;
2000*cdf0e10cSrcweir 
2001*cdf0e10cSrcweir 	// void als Default-Klasse eintragen
2002*cdf0e10cSrcweir 	Reference<XIdlClass> xRetClass;
2003*cdf0e10cSrcweir 	typelib_TypeDescription * pTD = 0;
2004*cdf0e10cSrcweir 	rType.getDescription( &pTD );
2005*cdf0e10cSrcweir 	if( pTD )
2006*cdf0e10cSrcweir 	{
2007*cdf0e10cSrcweir 	    ::rtl::OUString sOWName( pTD->pTypeName );
2008*cdf0e10cSrcweir 		if( !xRefl.is() )
2009*cdf0e10cSrcweir 		{
2010*cdf0e10cSrcweir 			xRefl = Reference< XIdlReflection >( xMgr->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.reflection.CoreReflection")) ), UNO_QUERY );
2011*cdf0e10cSrcweir 			OSL_ENSURE( xRefl.is(), "### no corereflection!" );
2012*cdf0e10cSrcweir 		}
2013*cdf0e10cSrcweir 		xRetClass = xRefl->forName( sOWName );
2014*cdf0e10cSrcweir 	}
2015*cdf0e10cSrcweir 	return xRetClass;
2016*cdf0e10cSrcweir }
2017*cdf0e10cSrcweir 
2018*cdf0e10cSrcweir // Implementation der Introspection.
2019*cdf0e10cSrcweir IntrospectionAccessStatic_Impl* ImplIntrospection::implInspect(const Any& aToInspectObj)
2020*cdf0e10cSrcweir {
2021*cdf0e10cSrcweir 	MutexGuard aGuard( m_mutex );
2022*cdf0e10cSrcweir 
2023*cdf0e10cSrcweir 	// Wenn die Introspection schon disposed ist, wird nur ein leeres Ergebnis geliefert
2024*cdf0e10cSrcweir 	if( mbDisposed )
2025*cdf0e10cSrcweir 		return NULL;
2026*cdf0e10cSrcweir 
2027*cdf0e10cSrcweir 	// Objekt untersuchen
2028*cdf0e10cSrcweir 	TypeClass eType = aToInspectObj.getValueType().getTypeClass();
2029*cdf0e10cSrcweir 	if( eType != TypeClass_INTERFACE && eType != TypeClass_STRUCT  && eType != TypeClass_EXCEPTION )
2030*cdf0e10cSrcweir 		return NULL;
2031*cdf0e10cSrcweir 
2032*cdf0e10cSrcweir 	Reference<XInterface> x;
2033*cdf0e10cSrcweir 	if( eType == TypeClass_INTERFACE )
2034*cdf0e10cSrcweir 	{
2035*cdf0e10cSrcweir 		// Interface aus dem Any besorgen
2036*cdf0e10cSrcweir 		x = *(Reference<XInterface>*)aToInspectObj.getValue();
2037*cdf0e10cSrcweir 		if( !x.is() )
2038*cdf0e10cSrcweir 			return NULL;
2039*cdf0e10cSrcweir 	}
2040*cdf0e10cSrcweir 
2041*cdf0e10cSrcweir #ifdef USE_INTROSPECTION_CACHE
2042*cdf0e10cSrcweir 	// Haben wir schon eine Cache-Instanz
2043*cdf0e10cSrcweir 	if( !mpCache )
2044*cdf0e10cSrcweir 		mpCache = new IntrospectionAccessCacheMap;
2045*cdf0e10cSrcweir 	if( !mpTypeProviderCache )
2046*cdf0e10cSrcweir 		mpTypeProviderCache = new TypeProviderAccessCacheMap;
2047*cdf0e10cSrcweir 	IntrospectionAccessCacheMap& aCache = *mpCache;
2048*cdf0e10cSrcweir 	TypeProviderAccessCacheMap& aTPCache = *mpTypeProviderCache;
2049*cdf0e10cSrcweir 
2050*cdf0e10cSrcweir 	// Pointer auf ggf. noetige neue IntrospectionAccess-Instanz
2051*cdf0e10cSrcweir 	IntrospectionAccessStatic_Impl* pAccess = NULL;
2052*cdf0e10cSrcweir #else
2053*cdf0e10cSrcweir 	// Pointer auf ggf. noetige neue IntrospectionAccess-Instanz
2054*cdf0e10cSrcweir 	IntrospectionAccessStatic_Impl* pAccess = new IntrospectionAccessStatic_Impl( mxCoreReflection );
2055*cdf0e10cSrcweir #endif
2056*cdf0e10cSrcweir 
2057*cdf0e10cSrcweir 	// Pruefen: Ist schon ein passendes Access-Objekt gecached?
2058*cdf0e10cSrcweir 	Sequence< Reference<XIdlClass> >	SupportedClassSeq;
2059*cdf0e10cSrcweir 	Sequence< Type >					SupportedTypesSeq;
2060*cdf0e10cSrcweir 	Reference<XIdlClassProvider>		xClassProvider;
2061*cdf0e10cSrcweir 	Reference<XTypeProvider>			xTypeProvider;
2062*cdf0e10cSrcweir 	Reference<XIdlClass>				xImplClass;
2063*cdf0e10cSrcweir 	Reference<XPropertySetInfo>			xPropSetInfo;
2064*cdf0e10cSrcweir 	Reference<XPropertySet>				xPropSet;
2065*cdf0e10cSrcweir 
2066*cdf0e10cSrcweir 	// Bei Interfaces XTypeProvider / XIdlClassProvider- und PropertySet-Interface anfordern
2067*cdf0e10cSrcweir 	if( eType == TypeClass_INTERFACE )
2068*cdf0e10cSrcweir 	{
2069*cdf0e10cSrcweir 		// XIdlClassProvider
2070*cdf0e10cSrcweir 		xTypeProvider = Reference<XTypeProvider>::query( x );
2071*cdf0e10cSrcweir 		if( xTypeProvider.is() )
2072*cdf0e10cSrcweir 		{
2073*cdf0e10cSrcweir 			SupportedTypesSeq = xTypeProvider->getTypes();
2074*cdf0e10cSrcweir 			sal_Int32 nTypeCount = SupportedTypesSeq.getLength();
2075*cdf0e10cSrcweir 			if( nTypeCount )
2076*cdf0e10cSrcweir 			{
2077*cdf0e10cSrcweir 				SupportedClassSeq.realloc( nTypeCount );
2078*cdf0e10cSrcweir 				Reference<XIdlClass>* pClasses = SupportedClassSeq.getArray();
2079*cdf0e10cSrcweir 
2080*cdf0e10cSrcweir 				const Type* pTypes = SupportedTypesSeq.getConstArray();
2081*cdf0e10cSrcweir 				for( sal_Int32 i = 0 ; i < nTypeCount ; i++ )
2082*cdf0e10cSrcweir 				{
2083*cdf0e10cSrcweir 					pClasses[ i ] = TypeToIdlClass( pTypes[ i ], m_xSMgr );
2084*cdf0e10cSrcweir 				}
2085*cdf0e10cSrcweir 				// TODO: Caching!
2086*cdf0e10cSrcweir 			}
2087*cdf0e10cSrcweir 		}
2088*cdf0e10cSrcweir 		else
2089*cdf0e10cSrcweir 		{
2090*cdf0e10cSrcweir 			// XIdlClassProvider
2091*cdf0e10cSrcweir 			xClassProvider = Reference<XIdlClassProvider>::query( x );
2092*cdf0e10cSrcweir 			if( xClassProvider.is() )
2093*cdf0e10cSrcweir 			{
2094*cdf0e10cSrcweir 				SupportedClassSeq = xClassProvider->getIdlClasses();
2095*cdf0e10cSrcweir 				if( SupportedClassSeq.getLength() )
2096*cdf0e10cSrcweir 					xImplClass = SupportedClassSeq.getConstArray()[0];
2097*cdf0e10cSrcweir 			}
2098*cdf0e10cSrcweir 		}
2099*cdf0e10cSrcweir 		// #70197, fuer InvocationAdapter: Interface-Typ im Any auch ohne
2100*cdf0e10cSrcweir 		// ClassProvider unterstuetzen
2101*cdf0e10cSrcweir 		if( !xClassProvider.is() && !xTypeProvider.is() )
2102*cdf0e10cSrcweir 		{
2103*cdf0e10cSrcweir 			xImplClass = TypeToIdlClass( aToInspectObj.getValueType(), m_xSMgr );
2104*cdf0e10cSrcweir 			SupportedClassSeq.realloc( 1 );
2105*cdf0e10cSrcweir 			SupportedClassSeq.getArray()[ 0 ] = xImplClass;
2106*cdf0e10cSrcweir 		}
2107*cdf0e10cSrcweir 
2108*cdf0e10cSrcweir 		xPropSet = Reference<XPropertySet>::query( x );
2109*cdf0e10cSrcweir 		// Jetzt versuchen, das PropertySetInfo zu bekommen
2110*cdf0e10cSrcweir 		if( xPropSet.is() )
2111*cdf0e10cSrcweir 			xPropSetInfo = xPropSet->getPropertySetInfo();
2112*cdf0e10cSrcweir 	}
2113*cdf0e10cSrcweir 	else
2114*cdf0e10cSrcweir 	{
2115*cdf0e10cSrcweir 		xImplClass = TypeToIdlClass( aToInspectObj.getValueType(), m_xSMgr );
2116*cdf0e10cSrcweir 	}
2117*cdf0e10cSrcweir 
2118*cdf0e10cSrcweir #ifdef USE_INTROSPECTION_CACHE
2119*cdf0e10cSrcweir 	if( xTypeProvider.is() )
2120*cdf0e10cSrcweir 	{
2121*cdf0e10cSrcweir 		Sequence< sal_Int8 > aImpIdSeq = xTypeProvider->getImplementationId();
2122*cdf0e10cSrcweir 		sal_Int32 nIdLen = aImpIdSeq.getLength();
2123*cdf0e10cSrcweir 
2124*cdf0e10cSrcweir 		if( nIdLen )
2125*cdf0e10cSrcweir 		{
2126*cdf0e10cSrcweir 			// cache only, if the descriptor class is set
2127*cdf0e10cSrcweir 			hashTypeProviderKey_Impl aKeySeq( xPropSetInfo, aImpIdSeq );
2128*cdf0e10cSrcweir 
2129*cdf0e10cSrcweir 			TypeProviderAccessCacheMap::iterator aIt = aTPCache.find( aKeySeq );
2130*cdf0e10cSrcweir 			if( aIt == aTPCache.end() )
2131*cdf0e10cSrcweir 			{
2132*cdf0e10cSrcweir 				// not found
2133*cdf0e10cSrcweir 				// Neue Instanz anlegen und unter dem gegebenen Key einfuegen
2134*cdf0e10cSrcweir 				pAccess = new IntrospectionAccessStatic_Impl( mxCoreReflection );
2135*cdf0e10cSrcweir 
2136*cdf0e10cSrcweir 				// RefCount von Hand erhoehen, muss beim Entfernen
2137*cdf0e10cSrcweir 				// aus der Hashtable wieder released werden
2138*cdf0e10cSrcweir 				pAccess->acquire();
2139*cdf0e10cSrcweir 
2140*cdf0e10cSrcweir 				// Groesse begrenzen, alten Eintrag wieder rausschmeissen
2141*cdf0e10cSrcweir 				if( mnTPCacheEntryCount > INTROSPECTION_CACHE_MAX_SIZE )
2142*cdf0e10cSrcweir 				{
2143*cdf0e10cSrcweir 					// Access mit dem kleinsten HitCount suchen
2144*cdf0e10cSrcweir 					TypeProviderAccessCacheMap::iterator iter = aTPCache.begin();
2145*cdf0e10cSrcweir 					TypeProviderAccessCacheMap::iterator end = aTPCache.end();
2146*cdf0e10cSrcweir 					TypeProviderAccessCacheMap::iterator toDelete = iter;
2147*cdf0e10cSrcweir 					while( iter != end )
2148*cdf0e10cSrcweir 					{
2149*cdf0e10cSrcweir 						if( (*iter).first.nHitCount < (*toDelete).first.nHitCount )
2150*cdf0e10cSrcweir 							toDelete = iter;
2151*cdf0e10cSrcweir 						++iter;
2152*cdf0e10cSrcweir 					}
2153*cdf0e10cSrcweir 
2154*cdf0e10cSrcweir 					// Gefundenen Eintrag entfernen
2155*cdf0e10cSrcweir 					if( (*toDelete).second )
2156*cdf0e10cSrcweir 						(*toDelete).second->release();
2157*cdf0e10cSrcweir 					(*toDelete).second = NULL;
2158*cdf0e10cSrcweir 					aTPCache.erase( toDelete );
2159*cdf0e10cSrcweir 				}
2160*cdf0e10cSrcweir 				else
2161*cdf0e10cSrcweir 					mnTPCacheEntryCount++;
2162*cdf0e10cSrcweir 
2163*cdf0e10cSrcweir 				// Neuer Eintrage rein in die Table
2164*cdf0e10cSrcweir 				aKeySeq.nHitCount = 1;
2165*cdf0e10cSrcweir 				aTPCache[ aKeySeq ] = pAccess;
2166*cdf0e10cSrcweir 
2167*cdf0e10cSrcweir 			}
2168*cdf0e10cSrcweir 			else
2169*cdf0e10cSrcweir 			{
2170*cdf0e10cSrcweir 				// Hit-Count erhoehen
2171*cdf0e10cSrcweir 				(*aIt).first.IncHitCount();
2172*cdf0e10cSrcweir 				return (*aIt).second;
2173*cdf0e10cSrcweir 			}
2174*cdf0e10cSrcweir 		}
2175*cdf0e10cSrcweir 	}
2176*cdf0e10cSrcweir 	else if( xImplClass.is() )
2177*cdf0e10cSrcweir 	{
2178*cdf0e10cSrcweir 		// cache only, if the descriptor class is set
2179*cdf0e10cSrcweir 		hashIntrospectionKey_Impl	aKeySeq( SupportedClassSeq, xPropSetInfo, xImplClass );
2180*cdf0e10cSrcweir 
2181*cdf0e10cSrcweir 		IntrospectionAccessCacheMap::iterator aIt = aCache.find( aKeySeq );
2182*cdf0e10cSrcweir 		if( aIt == aCache.end() )
2183*cdf0e10cSrcweir 		{
2184*cdf0e10cSrcweir 			// not found
2185*cdf0e10cSrcweir 			// Neue Instanz anlegen und unter dem gegebenen Key einfuegen
2186*cdf0e10cSrcweir 			pAccess = new IntrospectionAccessStatic_Impl( mxCoreReflection );
2187*cdf0e10cSrcweir 
2188*cdf0e10cSrcweir 			// RefCount von Hand erhoehen, muss beim Entfernen
2189*cdf0e10cSrcweir 			// aus der Hashtable wieder released werden
2190*cdf0e10cSrcweir 			pAccess->acquire();
2191*cdf0e10cSrcweir 
2192*cdf0e10cSrcweir 			// Groesse begrenzen, alten Eintrag wieder rausschmeissen
2193*cdf0e10cSrcweir 			if( mnCacheEntryCount > INTROSPECTION_CACHE_MAX_SIZE )
2194*cdf0e10cSrcweir 			{
2195*cdf0e10cSrcweir 				// Access mit dem kleinsten HitCount suchen
2196*cdf0e10cSrcweir 				IntrospectionAccessCacheMap::iterator iter = aCache.begin();
2197*cdf0e10cSrcweir 				IntrospectionAccessCacheMap::iterator end = aCache.end();
2198*cdf0e10cSrcweir 				IntrospectionAccessCacheMap::iterator toDelete = iter;
2199*cdf0e10cSrcweir 				while( iter != end )
2200*cdf0e10cSrcweir 				{
2201*cdf0e10cSrcweir 					if( (*iter).first.nHitCount < (*toDelete).first.nHitCount )
2202*cdf0e10cSrcweir 						toDelete = iter;
2203*cdf0e10cSrcweir 					++iter;
2204*cdf0e10cSrcweir 				}
2205*cdf0e10cSrcweir 
2206*cdf0e10cSrcweir 				// Gefundenen Eintrag entfernen
2207*cdf0e10cSrcweir 				if( (*toDelete).second )
2208*cdf0e10cSrcweir 					(*toDelete).second->release();
2209*cdf0e10cSrcweir 				(*toDelete).second = NULL;
2210*cdf0e10cSrcweir 				aCache.erase( toDelete );
2211*cdf0e10cSrcweir 			}
2212*cdf0e10cSrcweir 			else
2213*cdf0e10cSrcweir 				mnCacheEntryCount++;
2214*cdf0e10cSrcweir 
2215*cdf0e10cSrcweir 			// Neuer Eintrage rein in die Table
2216*cdf0e10cSrcweir 			aKeySeq.nHitCount = 1;
2217*cdf0e10cSrcweir 			aCache[ aKeySeq ] = pAccess;
2218*cdf0e10cSrcweir 
2219*cdf0e10cSrcweir 		}
2220*cdf0e10cSrcweir 		else
2221*cdf0e10cSrcweir 		{
2222*cdf0e10cSrcweir 			// Hit-Count erhoehen
2223*cdf0e10cSrcweir 			(*aIt).first.IncHitCount();
2224*cdf0e10cSrcweir 			return (*aIt).second;
2225*cdf0e10cSrcweir 		}
2226*cdf0e10cSrcweir 	}
2227*cdf0e10cSrcweir #endif
2228*cdf0e10cSrcweir 
2229*cdf0e10cSrcweir 	// Kein Access gecached -> neu anlegen
2230*cdf0e10cSrcweir 	Property* pAllPropArray;
2231*cdf0e10cSrcweir 	Reference<XInterface>* pInterfaces1;
2232*cdf0e10cSrcweir 	Reference<XInterface>* pInterfaces2;
2233*cdf0e10cSrcweir 	sal_Int16* pMapTypeArray;
2234*cdf0e10cSrcweir 	sal_Int32* pPropertyConceptArray;
2235*cdf0e10cSrcweir 	sal_Int32 i;
2236*cdf0e10cSrcweir 
2237*cdf0e10cSrcweir 	if( !pAccess )
2238*cdf0e10cSrcweir 		pAccess = new IntrospectionAccessStatic_Impl( mxCoreReflection );
2239*cdf0e10cSrcweir 
2240*cdf0e10cSrcweir 	// Referenzen auf wichtige Daten von pAccess
2241*cdf0e10cSrcweir 	sal_Int32& rPropCount = pAccess->mnPropCount;
2242*cdf0e10cSrcweir 	IntrospectionNameMap& rPropNameMap = pAccess->maPropertyNameMap;
2243*cdf0e10cSrcweir 	IntrospectionNameMap& rMethodNameMap = pAccess->maMethodNameMap;
2244*cdf0e10cSrcweir 	LowerToExactNameMap& rLowerToExactNameMap = pAccess->maLowerToExactNameMap;
2245*cdf0e10cSrcweir 
2246*cdf0e10cSrcweir 	// Schon mal Pointer auf das eigene Property-Feld holen
2247*cdf0e10cSrcweir 	pAllPropArray = pAccess->maAllPropertySeq.getArray();
2248*cdf0e10cSrcweir 	pInterfaces1 = pAccess->aInterfaceSeq1.getArray();
2249*cdf0e10cSrcweir 	pInterfaces2 = pAccess->aInterfaceSeq2.getArray();
2250*cdf0e10cSrcweir 	pMapTypeArray = pAccess->maMapTypeSeq.getArray();
2251*cdf0e10cSrcweir 	pPropertyConceptArray = pAccess->maPropertyConceptSeq.getArray();
2252*cdf0e10cSrcweir 
2253*cdf0e10cSrcweir 	//*************************
2254*cdf0e10cSrcweir 	//*** Analyse vornehmen ***
2255*cdf0e10cSrcweir 	//*************************
2256*cdf0e10cSrcweir 	if( eType == TypeClass_INTERFACE )
2257*cdf0e10cSrcweir 	{
2258*cdf0e10cSrcweir 		// Zunaechst nach speziellen Interfaces suchen, die fuer
2259*cdf0e10cSrcweir 		// die Introspection von besonderer Bedeutung sind.
2260*cdf0e10cSrcweir 
2261*cdf0e10cSrcweir 		// XPropertySet vorhanden?
2262*cdf0e10cSrcweir 		if( xPropSet.is() && xPropSetInfo.is() )
2263*cdf0e10cSrcweir 		{
2264*cdf0e10cSrcweir 			// Gibt es auch ein FastPropertySet?
2265*cdf0e10cSrcweir 			Reference<XFastPropertySet> xDummy = Reference<XFastPropertySet>::query( x );
2266*cdf0e10cSrcweir 			sal_Bool bFast = pAccess->mbFastPropSet = xDummy.is();
2267*cdf0e10cSrcweir 
2268*cdf0e10cSrcweir 			Sequence<Property> aPropSeq = xPropSetInfo->getProperties();
2269*cdf0e10cSrcweir 			const Property* pProps = aPropSeq.getConstArray();
2270*cdf0e10cSrcweir 			sal_Int32 nLen = aPropSeq.getLength();
2271*cdf0e10cSrcweir 
2272*cdf0e10cSrcweir 			// Bei FastPropertySet muessen wir uns die Original-Handles merken
2273*cdf0e10cSrcweir 			if( bFast )
2274*cdf0e10cSrcweir 				pAccess->mpOrgPropertyHandleArray = new sal_Int32[ nLen ];
2275*cdf0e10cSrcweir 
2276*cdf0e10cSrcweir 			for( i = 0 ; i < nLen ; i++ )
2277*cdf0e10cSrcweir 			{
2278*cdf0e10cSrcweir 				// Property in eigene Liste uebernehmen
2279*cdf0e10cSrcweir 				pAccess->checkPropertyArraysSize
2280*cdf0e10cSrcweir 					( pAllPropArray, pMapTypeArray, pPropertyConceptArray, rPropCount );
2281*cdf0e10cSrcweir 				Property& rProp = pAllPropArray[ rPropCount ];
2282*cdf0e10cSrcweir 				rProp = pProps[ i ];
2283*cdf0e10cSrcweir 
2284*cdf0e10cSrcweir 				if( bFast )
2285*cdf0e10cSrcweir 					pAccess->mpOrgPropertyHandleArray[ i ] = rProp.Handle;
2286*cdf0e10cSrcweir 
2287*cdf0e10cSrcweir 				// PropCount als Handle fuer das eigene FastPropertySet eintragen
2288*cdf0e10cSrcweir 				rProp.Handle = rPropCount;
2289*cdf0e10cSrcweir 
2290*cdf0e10cSrcweir 				// Art der Property merken
2291*cdf0e10cSrcweir 				pMapTypeArray[ rPropCount ] = MAP_PROPERTY_SET;
2292*cdf0e10cSrcweir 				pPropertyConceptArray[ rPropCount ] = PROPERTYSET;
2293*cdf0e10cSrcweir 				pAccess->mnPropertySetPropCount++;
2294*cdf0e10cSrcweir 
2295*cdf0e10cSrcweir 				// Namen in Hashtable eintragen, wenn nicht schon bekannt
2296*cdf0e10cSrcweir 			    ::rtl::OUString aPropName = rProp.Name;
2297*cdf0e10cSrcweir 
2298*cdf0e10cSrcweir 				// Haben wir den Namen schon?
2299*cdf0e10cSrcweir 				IntrospectionNameMap::iterator aIt = rPropNameMap.find( aPropName );
2300*cdf0e10cSrcweir 				if( aIt == rPropNameMap.end() )
2301*cdf0e10cSrcweir 				{
2302*cdf0e10cSrcweir 					// Neuer Eintrag in die Hashtable
2303*cdf0e10cSrcweir 					rPropNameMap[ aPropName ] = rPropCount;
2304*cdf0e10cSrcweir 
2305*cdf0e10cSrcweir 					// Tabelle fuer XExactName pflegen
2306*cdf0e10cSrcweir 					rLowerToExactNameMap[ toLower( aPropName ) ] = aPropName;
2307*cdf0e10cSrcweir 				}
2308*cdf0e10cSrcweir 				else
2309*cdf0e10cSrcweir 				{
2310*cdf0e10cSrcweir 					OSL_ENSURE( sal_False,
2311*cdf0e10cSrcweir 						::rtl::OString( "Introspection: Property \"" ) +
2312*cdf0e10cSrcweir 					    ::rtl::OUStringToOString( aPropName, RTL_TEXTENCODING_ASCII_US ) +
2313*cdf0e10cSrcweir                         ::rtl::OString( "\" found more than once in PropertySet" ) );
2314*cdf0e10cSrcweir 				}
2315*cdf0e10cSrcweir 
2316*cdf0e10cSrcweir 				// Count pflegen
2317*cdf0e10cSrcweir 				rPropCount++;
2318*cdf0e10cSrcweir 			}
2319*cdf0e10cSrcweir 		}
2320*cdf0e10cSrcweir 
2321*cdf0e10cSrcweir 
2322*cdf0e10cSrcweir 		// Jetzt alle weiteren implementierten Interfaces durchgehen
2323*cdf0e10cSrcweir 		// Diese muessen durch das XIdlClassProvider-Interface geliefert werden.
2324*cdf0e10cSrcweir 		// #70197, fuer InvocationAdapter: Interface-Typ im Any auch ohne
2325*cdf0e10cSrcweir 		// ClassProvider unterstuetzen
2326*cdf0e10cSrcweir 		//if( xClassProvider.is() )
2327*cdf0e10cSrcweir 		{
2328*cdf0e10cSrcweir 			// Indizes in die Export-Tabellen
2329*cdf0e10cSrcweir 			sal_Int32 iAllExportedMethod = 0;
2330*cdf0e10cSrcweir 			sal_Int32 iAllSupportedListener = 0;
2331*cdf0e10cSrcweir 
2332*cdf0e10cSrcweir 			// Hashtable fuer Pruefung auf mehrfache Beruecksichtigung von Interfaces
2333*cdf0e10cSrcweir 			CheckedInterfacesMap aCheckedInterfacesMap;
2334*cdf0e10cSrcweir 
2335*cdf0e10cSrcweir 			// Flag, ob XInterface-Methoden erfasst werden sollen
2336*cdf0e10cSrcweir 			// (das darf nur einmal erfolgen, initial zulassen)
2337*cdf0e10cSrcweir 			sal_Bool bXInterfaceIsInvalid = sal_False;
2338*cdf0e10cSrcweir 
2339*cdf0e10cSrcweir 			// Flag, ob die XInterface-Methoden schon erfasst wurden. Wenn sal_True,
2340*cdf0e10cSrcweir 			// wird bXInterfaceIsInvalid am Ende der Iface-Schleife aktiviert und
2341*cdf0e10cSrcweir 			// XInterface-Methoden werden danach abgeklemmt.
2342*cdf0e10cSrcweir 			sal_Bool bFoundXInterface = sal_False;
2343*cdf0e10cSrcweir 
2344*cdf0e10cSrcweir 			// Schleife ueber alle vom ClassProvider angegebenen Klassen
2345*cdf0e10cSrcweir 			sal_Int32 nClassCount = SupportedClassSeq.getLength();
2346*cdf0e10cSrcweir 			for( sal_Int32 nIdx = 0 ; nIdx < nClassCount; nIdx++ )
2347*cdf0e10cSrcweir 			{
2348*cdf0e10cSrcweir 				Reference<XIdlClass> xImplClass2 = SupportedClassSeq.getConstArray()[nIdx];
2349*cdf0e10cSrcweir 				while( xImplClass2.is() )
2350*cdf0e10cSrcweir 				{
2351*cdf0e10cSrcweir 					// Interfaces der Implementation holen
2352*cdf0e10cSrcweir 					Sequence< Reference<XIdlClass> > aClassSeq = xImplClass2->getInterfaces();
2353*cdf0e10cSrcweir 					sal_Int32 nIfaceCount = aClassSeq.getLength();
2354*cdf0e10cSrcweir 
2355*cdf0e10cSrcweir 					aClassSeq.realloc( nIfaceCount + 1 );
2356*cdf0e10cSrcweir 					aClassSeq.getArray()[ nIfaceCount ] = xImplClass2;
2357*cdf0e10cSrcweir 					nIfaceCount++;
2358*cdf0e10cSrcweir 
2359*cdf0e10cSrcweir 					const Reference<XIdlClass>* pParamArray = aClassSeq.getConstArray();
2360*cdf0e10cSrcweir 
2361*cdf0e10cSrcweir 					for( sal_Int32 j = 0 ; j < nIfaceCount ; j++ )
2362*cdf0e10cSrcweir 					{
2363*cdf0e10cSrcweir 						const Reference<XIdlClass>& rxIfaceClass = pParamArray[j];
2364*cdf0e10cSrcweir 
2365*cdf0e10cSrcweir 						// Pruefen, ob das Interface schon beruecksichtigt wurde.
2366*cdf0e10cSrcweir 						XInterface* pIface = SAL_STATIC_CAST( XInterface*, rxIfaceClass.get() );
2367*cdf0e10cSrcweir 						if( aCheckedInterfacesMap.count( pIface ) > 0 )
2368*cdf0e10cSrcweir 						{
2369*cdf0e10cSrcweir 							// Kennen wir schon
2370*cdf0e10cSrcweir 							continue;
2371*cdf0e10cSrcweir 						}
2372*cdf0e10cSrcweir 						else
2373*cdf0e10cSrcweir 						{
2374*cdf0e10cSrcweir 							// Sonst eintragen
2375*cdf0e10cSrcweir 							aCheckedInterfacesMap[ pIface ] = pIface;
2376*cdf0e10cSrcweir 						}
2377*cdf0e10cSrcweir 
2378*cdf0e10cSrcweir 						//********************************************************************
2379*cdf0e10cSrcweir 
2380*cdf0e10cSrcweir 						// 2. Fields als Properties registrieren
2381*cdf0e10cSrcweir 
2382*cdf0e10cSrcweir 						// Felder holen
2383*cdf0e10cSrcweir 						Sequence< Reference<XIdlField> > fields = rxIfaceClass->getFields();
2384*cdf0e10cSrcweir 						const Reference<XIdlField>* pFields = fields.getConstArray();
2385*cdf0e10cSrcweir 						sal_Int32 nLen = fields.getLength();
2386*cdf0e10cSrcweir 
2387*cdf0e10cSrcweir 						for( i = 0 ; i < nLen ; i++ )
2388*cdf0e10cSrcweir 						{
2389*cdf0e10cSrcweir 							Reference<XIdlField> xField = pFields[i];
2390*cdf0e10cSrcweir 							Reference<XIdlClass> xPropType = xField->getType();
2391*cdf0e10cSrcweir 
2392*cdf0e10cSrcweir 							// Ist die PropertySequence gross genug?
2393*cdf0e10cSrcweir 							pAccess->checkPropertyArraysSize
2394*cdf0e10cSrcweir 								( pAllPropArray, pMapTypeArray, pPropertyConceptArray, rPropCount );
2395*cdf0e10cSrcweir 
2396*cdf0e10cSrcweir 							// In eigenes Property-Array eintragen
2397*cdf0e10cSrcweir 							Property& rProp = pAllPropArray[ rPropCount ];
2398*cdf0e10cSrcweir 						    ::rtl::OUString aFieldName = xField->getName();
2399*cdf0e10cSrcweir 							rProp.Name = aFieldName;
2400*cdf0e10cSrcweir 							rProp.Handle = rPropCount;
2401*cdf0e10cSrcweir 							Type aFieldType( xPropType->getTypeClass(), xPropType->getName() );
2402*cdf0e10cSrcweir 							rProp.Type = aFieldType;
2403*cdf0e10cSrcweir 							FieldAccessMode eAccessMode = xField->getAccessMode();
2404*cdf0e10cSrcweir 							rProp.Attributes = (eAccessMode == FieldAccessMode_READONLY ||
2405*cdf0e10cSrcweir 												eAccessMode == FieldAccessMode_CONST)
2406*cdf0e10cSrcweir 												? READONLY : 0;
2407*cdf0e10cSrcweir 
2408*cdf0e10cSrcweir 							// Namen in Hashtable eintragen
2409*cdf0e10cSrcweir 						    ::rtl::OUString aPropName = rProp.Name;
2410*cdf0e10cSrcweir 
2411*cdf0e10cSrcweir 							// Haben wir den Namen schon?
2412*cdf0e10cSrcweir 							IntrospectionNameMap::iterator aIt = rPropNameMap.find( aPropName );
2413*cdf0e10cSrcweir 							if( !( aIt == rPropNameMap.end() ) )
2414*cdf0e10cSrcweir 							{
2415*cdf0e10cSrcweir 								/* TODO
2416*cdf0e10cSrcweir 								OSL_TRACE(
2417*cdf0e10cSrcweir 									String( "Introspection: Property \"" ) +
2418*cdf0e10cSrcweir 									OOUStringToString( aPropName, CHARSET_SYSTEM ) +
2419*cdf0e10cSrcweir 									String( "\" found more than once" ) );
2420*cdf0e10cSrcweir 									*/
2421*cdf0e10cSrcweir 								continue;
2422*cdf0e10cSrcweir 							}
2423*cdf0e10cSrcweir 
2424*cdf0e10cSrcweir 							// Neuer Eintrag in die Hashtable
2425*cdf0e10cSrcweir 							rPropNameMap[ aPropName ] = rPropCount;
2426*cdf0e10cSrcweir 
2427*cdf0e10cSrcweir 							// Tabelle fuer XExactName pflegen
2428*cdf0e10cSrcweir 							rLowerToExactNameMap[ toLower( aPropName ) ] = aPropName;
2429*cdf0e10cSrcweir 
2430*cdf0e10cSrcweir 							// Field merken
2431*cdf0e10cSrcweir 							pAccess->checkInterfaceArraySize( pAccess->aInterfaceSeq1,
2432*cdf0e10cSrcweir 								pInterfaces1, rPropCount );
2433*cdf0e10cSrcweir 							pInterfaces1[ rPropCount ] = xField;
2434*cdf0e10cSrcweir 
2435*cdf0e10cSrcweir 							// Art der Property merken
2436*cdf0e10cSrcweir 							pMapTypeArray[ rPropCount ] = MAP_FIELD;
2437*cdf0e10cSrcweir 							pPropertyConceptArray[ rPropCount ] = ATTRIBUTES;
2438*cdf0e10cSrcweir 							pAccess->mnAttributePropCount++;
2439*cdf0e10cSrcweir 
2440*cdf0e10cSrcweir 							// Count pflegen
2441*cdf0e10cSrcweir 							rPropCount++;
2442*cdf0e10cSrcweir 						}
2443*cdf0e10cSrcweir 
2444*cdf0e10cSrcweir 						//********************************************************************
2445*cdf0e10cSrcweir 
2446*cdf0e10cSrcweir 						// 3. Methoden
2447*cdf0e10cSrcweir 
2448*cdf0e10cSrcweir 						// Zaehler fuer die gefundenen Listener
2449*cdf0e10cSrcweir 						sal_Int32 nListenerCount = 0;
2450*cdf0e10cSrcweir 
2451*cdf0e10cSrcweir 						// Alle Methoden holen und merken
2452*cdf0e10cSrcweir 						Sequence< Reference<XIdlMethod> > methods = rxIfaceClass->getMethods();
2453*cdf0e10cSrcweir 						const Reference<XIdlMethod>* pSourceMethods = methods.getConstArray();
2454*cdf0e10cSrcweir 						sal_Int32 nSourceMethodCount = methods.getLength();
2455*cdf0e10cSrcweir 
2456*cdf0e10cSrcweir 						// 3. a) get/set- und Listener-Methoden suchen
2457*cdf0e10cSrcweir 
2458*cdf0e10cSrcweir 						// Feld fuer Infos ueber die Methoden anlegen, damit spaeter leicht die Methoden
2459*cdf0e10cSrcweir 						// gefunden werden koennen, die nicht im Zusammenhang mit Properties oder Listenern
2460*cdf0e10cSrcweir 						// stehen. NEU: auch MethodConceptArray initialisieren
2461*cdf0e10cSrcweir 						MethodType* pMethodTypes = new MethodType[ nSourceMethodCount ];
2462*cdf0e10cSrcweir 						sal_Int32* pLocalMethodConcepts = new sal_Int32[ nSourceMethodCount ];
2463*cdf0e10cSrcweir 						for( i = 0 ; i < nSourceMethodCount ; i++ )
2464*cdf0e10cSrcweir 						{
2465*cdf0e10cSrcweir 							pMethodTypes[ i ] = STANDARD_METHOD;
2466*cdf0e10cSrcweir 							pLocalMethodConcepts[ i ] = 0;
2467*cdf0e10cSrcweir 						}
2468*cdf0e10cSrcweir 
2469*cdf0e10cSrcweir 					    ::rtl::OUString aMethName;
2470*cdf0e10cSrcweir 					    ::rtl::OUString aPropName;
2471*cdf0e10cSrcweir 					    ::rtl::OUString aStartStr;
2472*cdf0e10cSrcweir 						for( i = 0 ; i < nSourceMethodCount ; i++ )
2473*cdf0e10cSrcweir 						{
2474*cdf0e10cSrcweir 							// Methode ansprechen
2475*cdf0e10cSrcweir 							const Reference<XIdlMethod>& rxMethod_i = pSourceMethods[i];
2476*cdf0e10cSrcweir 							sal_Int32& rMethodConcept_i = pLocalMethodConcepts[ i ];
2477*cdf0e10cSrcweir 
2478*cdf0e10cSrcweir 							// Namen besorgen
2479*cdf0e10cSrcweir 							aMethName = rxMethod_i->getName();
2480*cdf0e10cSrcweir 
2481*cdf0e10cSrcweir 							// Methoden katalogisieren
2482*cdf0e10cSrcweir 							// Alle (?) Methoden von XInterface filtern, damit z.B. nicht
2483*cdf0e10cSrcweir 							// vom Scripting aus aquire oder release gerufen werden kann
2484*cdf0e10cSrcweir 							if( rxMethod_i->getDeclaringClass()->equals( mxInterfaceClass ) )
2485*cdf0e10cSrcweir 							{
2486*cdf0e10cSrcweir 								// XInterface-Methoden sind hiermit einmal beruecksichtigt
2487*cdf0e10cSrcweir 								bFoundXInterface = sal_True;
2488*cdf0e10cSrcweir 
2489*cdf0e10cSrcweir 								if( bXInterfaceIsInvalid )
2490*cdf0e10cSrcweir 								{
2491*cdf0e10cSrcweir 									pMethodTypes[ i ] = INVALID_METHOD;
2492*cdf0e10cSrcweir 									continue;
2493*cdf0e10cSrcweir 								}
2494*cdf0e10cSrcweir 								else
2495*cdf0e10cSrcweir 								{
2496*cdf0e10cSrcweir 									if( aMethName != ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("queryInterface")) )
2497*cdf0e10cSrcweir 									{
2498*cdf0e10cSrcweir 										rMethodConcept_i |= MethodConcept::DANGEROUS;
2499*cdf0e10cSrcweir 										continue;
2500*cdf0e10cSrcweir 									}
2501*cdf0e10cSrcweir 								}
2502*cdf0e10cSrcweir 							}
2503*cdf0e10cSrcweir 							else if( rxMethod_i->getDeclaringClass()->equals( mxAggregationClass ) )
2504*cdf0e10cSrcweir 							{
2505*cdf0e10cSrcweir 								if( aMethName == ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("setDelegator")) )
2506*cdf0e10cSrcweir 								{
2507*cdf0e10cSrcweir 									rMethodConcept_i |= MethodConcept::DANGEROUS;
2508*cdf0e10cSrcweir 									continue;
2509*cdf0e10cSrcweir 								}
2510*cdf0e10cSrcweir 							}
2511*cdf0e10cSrcweir 							else if( rxMethod_i->getDeclaringClass()->equals( mxElementAccessClass ) )
2512*cdf0e10cSrcweir 							{
2513*cdf0e10cSrcweir 								rMethodConcept_i |= ( NAMECONTAINER  |
2514*cdf0e10cSrcweir 													  INDEXCONTAINER |
2515*cdf0e10cSrcweir 													  ENUMERATION );
2516*cdf0e10cSrcweir 							}
2517*cdf0e10cSrcweir 							else if( rxMethod_i->getDeclaringClass()->equals( mxNameContainerClass ) ||
2518*cdf0e10cSrcweir 									 rxMethod_i->getDeclaringClass()->equals( mxNameAccessClass ) )
2519*cdf0e10cSrcweir 							{
2520*cdf0e10cSrcweir 								rMethodConcept_i |= NAMECONTAINER;
2521*cdf0e10cSrcweir 							}
2522*cdf0e10cSrcweir 							else if( rxMethod_i->getDeclaringClass()->equals( mxIndexContainerClass ) ||
2523*cdf0e10cSrcweir 									 rxMethod_i->getDeclaringClass()->equals( mxIndexAccessClass ) )
2524*cdf0e10cSrcweir 							{
2525*cdf0e10cSrcweir 								rMethodConcept_i |= INDEXCONTAINER;
2526*cdf0e10cSrcweir 							}
2527*cdf0e10cSrcweir 							else if( rxMethod_i->getDeclaringClass()->equals( mxEnumerationAccessClass ) )
2528*cdf0e10cSrcweir 							{
2529*cdf0e10cSrcweir 								rMethodConcept_i |= ENUMERATION;
2530*cdf0e10cSrcweir 							}
2531*cdf0e10cSrcweir 
2532*cdf0e10cSrcweir 							// Wenn der Name zu kurz ist, wird's sowieso nichts
2533*cdf0e10cSrcweir 							if( aMethName.getLength() <= 3 )
2534*cdf0e10cSrcweir 								continue;
2535*cdf0e10cSrcweir 
2536*cdf0e10cSrcweir 							// Ist es eine get-Methode?
2537*cdf0e10cSrcweir 							aStartStr = aMethName.copy( 0, 3 );
2538*cdf0e10cSrcweir 							if( aStartStr == ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("get")) )
2539*cdf0e10cSrcweir 							{
2540*cdf0e10cSrcweir 								// Namen der potentiellen Property
2541*cdf0e10cSrcweir 								aPropName = aMethName.copy( 3 );
2542*cdf0e10cSrcweir 
2543*cdf0e10cSrcweir 								// get-Methode darf keinen Parameter haben
2544*cdf0e10cSrcweir 								Sequence< Reference<XIdlClass> > getParams = rxMethod_i->getParameterTypes();
2545*cdf0e10cSrcweir 								if( getParams.getLength() > 0 )
2546*cdf0e10cSrcweir 								{
2547*cdf0e10cSrcweir 									continue;
2548*cdf0e10cSrcweir 								}
2549*cdf0e10cSrcweir 
2550*cdf0e10cSrcweir 								// Haben wir den Namen schon?
2551*cdf0e10cSrcweir 								IntrospectionNameMap::iterator aIt = rPropNameMap.find( aPropName );
2552*cdf0e10cSrcweir 								if( !( aIt == rPropNameMap.end() ) )
2553*cdf0e10cSrcweir 								{
2554*cdf0e10cSrcweir 									/* TODO
2555*cdf0e10cSrcweir 									OSL_TRACE(
2556*cdf0e10cSrcweir 										String( "Introspection: Property \"" ) +
2557*cdf0e10cSrcweir 										OOUStringToString( aPropName, CHARSET_SYSTEM ) +
2558*cdf0e10cSrcweir 										String( "\" found more than once" ) );
2559*cdf0e10cSrcweir 										*/
2560*cdf0e10cSrcweir 									continue;
2561*cdf0e10cSrcweir 								}
2562*cdf0e10cSrcweir 
2563*cdf0e10cSrcweir 								// Eine readonly-Property ist es jetzt mindestens schon
2564*cdf0e10cSrcweir 								rMethodConcept_i |= PROPERTY;
2565*cdf0e10cSrcweir 
2566*cdf0e10cSrcweir 								pMethodTypes[i] = GETSET_METHOD;
2567*cdf0e10cSrcweir 								Reference<XIdlClass> xGetRetType = rxMethod_i->getReturnType();
2568*cdf0e10cSrcweir 
2569*cdf0e10cSrcweir 								// Ist die PropertySequence gross genug?
2570*cdf0e10cSrcweir 								pAccess->checkPropertyArraysSize
2571*cdf0e10cSrcweir 									( pAllPropArray, pMapTypeArray, pPropertyConceptArray, rPropCount );
2572*cdf0e10cSrcweir 
2573*cdf0e10cSrcweir 								// In eigenes Property-Array eintragen
2574*cdf0e10cSrcweir 								Property& rProp = pAllPropArray[ rPropCount ];
2575*cdf0e10cSrcweir 								rProp.Name = aPropName;
2576*cdf0e10cSrcweir 								rProp.Handle = rPropCount;
2577*cdf0e10cSrcweir 								rProp.Type = Type( xGetRetType->getTypeClass(), xGetRetType->getName() );
2578*cdf0e10cSrcweir 								rProp.Attributes = READONLY;
2579*cdf0e10cSrcweir 
2580*cdf0e10cSrcweir 								// Neuer Eintrag in die Hashtable
2581*cdf0e10cSrcweir 								rPropNameMap[ aPropName ] = rPropCount;
2582*cdf0e10cSrcweir 
2583*cdf0e10cSrcweir 								// Tabelle fuer XExactName pflegen
2584*cdf0e10cSrcweir 								rLowerToExactNameMap[ toLower( aPropName ) ] = aPropName;
2585*cdf0e10cSrcweir 
2586*cdf0e10cSrcweir 								// get-Methode merken
2587*cdf0e10cSrcweir 								pAccess->checkInterfaceArraySize( pAccess->aInterfaceSeq1,
2588*cdf0e10cSrcweir 									pInterfaces1, rPropCount );
2589*cdf0e10cSrcweir 								pInterfaces1[ rPropCount ] = rxMethod_i;
2590*cdf0e10cSrcweir 
2591*cdf0e10cSrcweir 								// Art der Property merken
2592*cdf0e10cSrcweir 								pMapTypeArray[ rPropCount ] = MAP_GETSET;
2593*cdf0e10cSrcweir 								pPropertyConceptArray[ rPropCount ] = METHODS;
2594*cdf0e10cSrcweir 								pAccess->mnMethodPropCount++;
2595*cdf0e10cSrcweir 
2596*cdf0e10cSrcweir 								// Passende set-Methode suchen
2597*cdf0e10cSrcweir 								sal_Int32 k;
2598*cdf0e10cSrcweir 								for( k = 0 ; k < nSourceMethodCount ; k++ )
2599*cdf0e10cSrcweir 								{
2600*cdf0e10cSrcweir 									// Methode ansprechen
2601*cdf0e10cSrcweir 									const Reference<XIdlMethod>& rxMethod_k = pSourceMethods[k];
2602*cdf0e10cSrcweir 
2603*cdf0e10cSrcweir 									// Nur Methoden nehmen, die nicht schon zugeordnet sind
2604*cdf0e10cSrcweir 									if( k == i || pMethodTypes[k] != STANDARD_METHOD )
2605*cdf0e10cSrcweir 										continue;
2606*cdf0e10cSrcweir 
2607*cdf0e10cSrcweir 									// Name holen und auswerten
2608*cdf0e10cSrcweir 								    ::rtl::OUString aMethName2 = rxMethod_k->getName();
2609*cdf0e10cSrcweir 								    ::rtl::OUString aStartStr2 = aMethName2.copy( 0, 3 );
2610*cdf0e10cSrcweir 									// ACHTUNG: Wegen SDL-Bug NICHT != bei ::rtl::OUString verwenden !!!
2611*cdf0e10cSrcweir 									if( !( aStartStr2 == ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("set")) ) )
2612*cdf0e10cSrcweir 										continue;
2613*cdf0e10cSrcweir 
2614*cdf0e10cSrcweir 									// Ist es denn der gleiche Name?
2615*cdf0e10cSrcweir 								    ::rtl::OUString aPropName2 = aMethName2.copy( 3 );
2616*cdf0e10cSrcweir 									// ACHTUNG: Wegen SDL-Bug NICHT != bei ::rtl::OUString verwenden !!!
2617*cdf0e10cSrcweir 									if( !( aPropName == aPropName2 ) )
2618*cdf0e10cSrcweir 										continue;
2619*cdf0e10cSrcweir 
2620*cdf0e10cSrcweir 									// set-Methode muss void returnen
2621*cdf0e10cSrcweir 									Reference<XIdlClass> xSetRetType = rxMethod_k->getReturnType();
2622*cdf0e10cSrcweir 									if( xSetRetType->getTypeClass() != TypeClass_VOID )
2623*cdf0e10cSrcweir 									{
2624*cdf0e10cSrcweir 										continue;
2625*cdf0e10cSrcweir 									}
2626*cdf0e10cSrcweir 
2627*cdf0e10cSrcweir 									// set-Methode darf nur einen Parameter haben
2628*cdf0e10cSrcweir 									Sequence< Reference<XIdlClass> > setParams = rxMethod_k->getParameterTypes();
2629*cdf0e10cSrcweir 									sal_Int32 nParamCount = setParams.getLength();
2630*cdf0e10cSrcweir 									if( nParamCount != 1 )
2631*cdf0e10cSrcweir 									{
2632*cdf0e10cSrcweir 										continue;
2633*cdf0e10cSrcweir 									}
2634*cdf0e10cSrcweir 
2635*cdf0e10cSrcweir 									// Jetzt muss nur noch der return-Typ dem Parameter-Typ entsprechen
2636*cdf0e10cSrcweir 									const Reference<XIdlClass>* pParamArray2 = setParams.getConstArray();
2637*cdf0e10cSrcweir 									Reference<XIdlClass> xParamType = pParamArray2[ 0 ];
2638*cdf0e10cSrcweir 									if( xParamType->equals( xGetRetType ) )
2639*cdf0e10cSrcweir 									{
2640*cdf0e10cSrcweir 										pLocalMethodConcepts[ k ] = PROPERTY;
2641*cdf0e10cSrcweir 
2642*cdf0e10cSrcweir 										pMethodTypes[k] = GETSET_METHOD;
2643*cdf0e10cSrcweir 
2644*cdf0e10cSrcweir 										// ReadOnly-Flag wieder loschen
2645*cdf0e10cSrcweir 										rProp.Attributes &= ~READONLY;
2646*cdf0e10cSrcweir 
2647*cdf0e10cSrcweir 										// set-Methode merken
2648*cdf0e10cSrcweir 										pAccess->checkInterfaceArraySize( pAccess->aInterfaceSeq2,
2649*cdf0e10cSrcweir 											pInterfaces2, rPropCount );
2650*cdf0e10cSrcweir 										pInterfaces2[ rPropCount ] = rxMethod_k;
2651*cdf0e10cSrcweir 									}
2652*cdf0e10cSrcweir 								}
2653*cdf0e10cSrcweir 
2654*cdf0e10cSrcweir 								// Count pflegen
2655*cdf0e10cSrcweir 								rPropCount++;
2656*cdf0e10cSrcweir 							}
2657*cdf0e10cSrcweir 
2658*cdf0e10cSrcweir 							// Ist es eine addListener-Methode?
2659*cdf0e10cSrcweir 							else if( aStartStr == ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("add")) )
2660*cdf0e10cSrcweir 							{
2661*cdf0e10cSrcweir 							    ::rtl::OUString aListenerStr( RTL_CONSTASCII_USTRINGPARAM("Listener" ) );
2662*cdf0e10cSrcweir 
2663*cdf0e10cSrcweir 								// Namen der potentiellen Property
2664*cdf0e10cSrcweir 								sal_Int32 nStrLen = aMethName.getLength();
2665*cdf0e10cSrcweir                                 sal_Int32 nCopyLen = nStrLen - aListenerStr.getLength();
2666*cdf0e10cSrcweir                                 ::rtl::OUString aEndStr = aMethName.copy( nCopyLen > 0 ? nCopyLen : 0 );
2667*cdf0e10cSrcweir 
2668*cdf0e10cSrcweir 								// Endet das Teil auf Listener?
2669*cdf0e10cSrcweir 								// ACHTUNG: Wegen SDL-Bug NICHT != bei ::rtl::OUString verwenden !!!
2670*cdf0e10cSrcweir 								if( !( aEndStr == aListenerStr ) )
2671*cdf0e10cSrcweir 									continue;
2672*cdf0e10cSrcweir 
2673*cdf0e10cSrcweir 								// Welcher Listener?
2674*cdf0e10cSrcweir 							    ::rtl::OUString aListenerName = aMethName.copy( 3, nStrLen - aListenerStr.getLength() - 3 );
2675*cdf0e10cSrcweir 
2676*cdf0e10cSrcweir 								// TODO: Hier koennten noch genauere Pruefungen vorgenommen werden
2677*cdf0e10cSrcweir 								// - Rueckgabe-Typ
2678*cdf0e10cSrcweir 								// - Anzahl und Art der Parameter
2679*cdf0e10cSrcweir 
2680*cdf0e10cSrcweir 
2681*cdf0e10cSrcweir 								// Passende remove-Methode suchen, sonst gilt's nicht
2682*cdf0e10cSrcweir 								sal_Int32 k;
2683*cdf0e10cSrcweir 								for( k = 0 ; k < nSourceMethodCount ; k++ )
2684*cdf0e10cSrcweir 								{
2685*cdf0e10cSrcweir 									// Methode ansprechen
2686*cdf0e10cSrcweir 									const Reference<XIdlMethod>& rxMethod_k = pSourceMethods[k];
2687*cdf0e10cSrcweir 
2688*cdf0e10cSrcweir 									// Nur Methoden nehmen, die nicht schon zugeordnet sind
2689*cdf0e10cSrcweir 									if( k == i || pMethodTypes[k] != STANDARD_METHOD )
2690*cdf0e10cSrcweir 										continue;
2691*cdf0e10cSrcweir 
2692*cdf0e10cSrcweir 									// Name holen und auswerten
2693*cdf0e10cSrcweir 								    ::rtl::OUString aMethName2 = rxMethod_k->getName();
2694*cdf0e10cSrcweir                                     sal_Int32 nNameLen = aMethName2.getLength();
2695*cdf0e10cSrcweir                                     sal_Int32 nCopyLen2 = (nNameLen < 6) ? nNameLen : 6;
2696*cdf0e10cSrcweir 								    ::rtl::OUString aStartStr2 = aMethName2.copy( 0, nCopyLen2 );
2697*cdf0e10cSrcweir 								    ::rtl::OUString aRemoveStr( RTL_CONSTASCII_USTRINGPARAM("remove" ) );
2698*cdf0e10cSrcweir 									// ACHTUNG: Wegen SDL-Bug NICHT != bei ::rtl::OUString verwenden !!!
2699*cdf0e10cSrcweir 									if( !( aStartStr2 == aRemoveStr ) )
2700*cdf0e10cSrcweir 										continue;
2701*cdf0e10cSrcweir 
2702*cdf0e10cSrcweir 									// Ist es denn der gleiche Listener?
2703*cdf0e10cSrcweir 									if( aMethName2.getLength() - aRemoveStr.getLength() <= aListenerStr.getLength() )
2704*cdf0e10cSrcweir 										continue;
2705*cdf0e10cSrcweir 								    ::rtl::OUString aListenerName2 = aMethName2.copy
2706*cdf0e10cSrcweir 										( 6, aMethName2.getLength() - aRemoveStr.getLength() - aListenerStr.getLength() );
2707*cdf0e10cSrcweir 									// ACHTUNG: Wegen SDL-Bug NICHT != bei ::rtl::OUString verwenden !!!
2708*cdf0e10cSrcweir 									if( !( aListenerName == aListenerName2 ) )
2709*cdf0e10cSrcweir 										continue;
2710*cdf0e10cSrcweir 
2711*cdf0e10cSrcweir 									// TODO: Hier koennten noch genauere Pruefungen vorgenommen werden
2712*cdf0e10cSrcweir 									// - Rueckgabe-Typ
2713*cdf0e10cSrcweir 									// - Anzahl und Art der Parameter
2714*cdf0e10cSrcweir 
2715*cdf0e10cSrcweir 
2716*cdf0e10cSrcweir 									// Methoden sind als Listener-Schnittstelle erkannt
2717*cdf0e10cSrcweir 									rMethodConcept_i |= LISTENER;
2718*cdf0e10cSrcweir 									pLocalMethodConcepts[ k ] |= LISTENER;
2719*cdf0e10cSrcweir 
2720*cdf0e10cSrcweir 									pMethodTypes[i] = ADD_LISTENER_METHOD;
2721*cdf0e10cSrcweir 									pMethodTypes[k] = REMOVE_LISTENER_METHOD;
2722*cdf0e10cSrcweir 									nListenerCount++;
2723*cdf0e10cSrcweir 								}
2724*cdf0e10cSrcweir 							}
2725*cdf0e10cSrcweir 						}
2726*cdf0e10cSrcweir 
2727*cdf0e10cSrcweir 
2728*cdf0e10cSrcweir 						// Jetzt koennen noch SET-Methoden ohne zugehoerige GET-Methode existieren,
2729*cdf0e10cSrcweir 						// diese muessen zu Write-Only-Properties gemachte werden.
2730*cdf0e10cSrcweir 						for( i = 0 ; i < nSourceMethodCount ; i++ )
2731*cdf0e10cSrcweir 						{
2732*cdf0e10cSrcweir 							// Methode ansprechen
2733*cdf0e10cSrcweir 							const Reference<XIdlMethod>& rxMethod_i = pSourceMethods[i];
2734*cdf0e10cSrcweir 
2735*cdf0e10cSrcweir 							// Nur Methoden nehmen, die nicht schon zugeordnet sind
2736*cdf0e10cSrcweir 							if( pMethodTypes[i] != STANDARD_METHOD )
2737*cdf0e10cSrcweir 								continue;
2738*cdf0e10cSrcweir 
2739*cdf0e10cSrcweir 							// Namen besorgen
2740*cdf0e10cSrcweir 							aMethName = rxMethod_i->getName();
2741*cdf0e10cSrcweir 
2742*cdf0e10cSrcweir 							// Wenn der Name zu kurz ist, wird's sowieso nichts
2743*cdf0e10cSrcweir 							if( aMethName.getLength() <= 3 )
2744*cdf0e10cSrcweir 								continue;
2745*cdf0e10cSrcweir 
2746*cdf0e10cSrcweir 							// Ist es eine set-Methode ohne zugehoerige get-Methode?
2747*cdf0e10cSrcweir 							aStartStr = aMethName.copy( 0, 3 );
2748*cdf0e10cSrcweir 							if( aStartStr == ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("set")) )
2749*cdf0e10cSrcweir 							{
2750*cdf0e10cSrcweir 								// Namen der potentiellen Property
2751*cdf0e10cSrcweir 								aPropName = aMethName.copy( 3 );
2752*cdf0e10cSrcweir 
2753*cdf0e10cSrcweir 								// set-Methode muss void returnen
2754*cdf0e10cSrcweir 								Reference<XIdlClass> xSetRetType = rxMethod_i->getReturnType();
2755*cdf0e10cSrcweir 								if( xSetRetType->getTypeClass() != TypeClass_VOID )
2756*cdf0e10cSrcweir 								{
2757*cdf0e10cSrcweir 									continue;
2758*cdf0e10cSrcweir 								}
2759*cdf0e10cSrcweir 
2760*cdf0e10cSrcweir 								// set-Methode darf nur einen Parameter haben
2761*cdf0e10cSrcweir 								Sequence< Reference<XIdlClass> > setParams = rxMethod_i->getParameterTypes();
2762*cdf0e10cSrcweir 								sal_Int32 nParamCount = setParams.getLength();
2763*cdf0e10cSrcweir 								if( nParamCount != 1 )
2764*cdf0e10cSrcweir 								{
2765*cdf0e10cSrcweir 									continue;
2766*cdf0e10cSrcweir 								}
2767*cdf0e10cSrcweir 
2768*cdf0e10cSrcweir 								// Haben wir den Namen schon?
2769*cdf0e10cSrcweir 								IntrospectionNameMap::iterator aIt = rPropNameMap.find( aPropName );
2770*cdf0e10cSrcweir 								if( !( aIt == rPropNameMap.end() ) )
2771*cdf0e10cSrcweir 								{
2772*cdf0e10cSrcweir 									/* TODO:
2773*cdf0e10cSrcweir 									OSL_TRACE(
2774*cdf0e10cSrcweir 										String( "Introspection: Property \"" ) +
2775*cdf0e10cSrcweir 										OOUStringToString( aPropName, CHARSET_SYSTEM ) +
2776*cdf0e10cSrcweir 										String( "\" found more than once" ) );
2777*cdf0e10cSrcweir 										*/
2778*cdf0e10cSrcweir 									continue;
2779*cdf0e10cSrcweir 								}
2780*cdf0e10cSrcweir 
2781*cdf0e10cSrcweir 								// Alles klar, es ist eine Write-Only-Property
2782*cdf0e10cSrcweir 								pLocalMethodConcepts[ i ] = PROPERTY;
2783*cdf0e10cSrcweir 
2784*cdf0e10cSrcweir 								pMethodTypes[i] = GETSET_METHOD;
2785*cdf0e10cSrcweir 								Reference<XIdlClass> xGetRetType = setParams.getConstArray()[0];
2786*cdf0e10cSrcweir 
2787*cdf0e10cSrcweir 								// Ist die PropertySequence gross genug?
2788*cdf0e10cSrcweir 								pAccess->checkPropertyArraysSize
2789*cdf0e10cSrcweir 									( pAllPropArray, pMapTypeArray, pPropertyConceptArray, rPropCount );
2790*cdf0e10cSrcweir 
2791*cdf0e10cSrcweir 								// In eigenes Property-Array eintragen
2792*cdf0e10cSrcweir 								Property& rProp = pAllPropArray[ rPropCount ];
2793*cdf0e10cSrcweir 								rProp.Name = aPropName;
2794*cdf0e10cSrcweir 								rProp.Handle = rPropCount;
2795*cdf0e10cSrcweir 								rProp.Type = Type( xGetRetType->getTypeClass(), xGetRetType->getName() );
2796*cdf0e10cSrcweir 								rProp.Attributes = 0;	// PROPERTY_WRITEONLY ???
2797*cdf0e10cSrcweir 
2798*cdf0e10cSrcweir 								// Neuer Eintrag in die Hashtable
2799*cdf0e10cSrcweir 								rPropNameMap[ aPropName ] = rPropCount;
2800*cdf0e10cSrcweir 
2801*cdf0e10cSrcweir 								// Tabelle fuer XExactName pflegen
2802*cdf0e10cSrcweir 								rLowerToExactNameMap[ toLower( aPropName ) ] = aPropName;
2803*cdf0e10cSrcweir 
2804*cdf0e10cSrcweir 								// set-Methode merken
2805*cdf0e10cSrcweir 								pAccess->checkInterfaceArraySize( pAccess->aInterfaceSeq2,
2806*cdf0e10cSrcweir 									pInterfaces2, rPropCount );
2807*cdf0e10cSrcweir 								pInterfaces2[ rPropCount ] = rxMethod_i;
2808*cdf0e10cSrcweir 
2809*cdf0e10cSrcweir 								// Art der Property merken
2810*cdf0e10cSrcweir 								pMapTypeArray[ rPropCount ] = MAP_SETONLY;
2811*cdf0e10cSrcweir 								pPropertyConceptArray[ rPropCount ] = METHODS;
2812*cdf0e10cSrcweir 								pAccess->mnMethodPropCount++;
2813*cdf0e10cSrcweir 
2814*cdf0e10cSrcweir 								// Count pflegen
2815*cdf0e10cSrcweir 								rPropCount++;
2816*cdf0e10cSrcweir 							}
2817*cdf0e10cSrcweir 						}
2818*cdf0e10cSrcweir 
2819*cdf0e10cSrcweir 
2820*cdf0e10cSrcweir 						//********************************************************************
2821*cdf0e10cSrcweir 
2822*cdf0e10cSrcweir 						// 4. Methoden in die Gesamt-Sequence uebernehmen
2823*cdf0e10cSrcweir 
2824*cdf0e10cSrcweir 						// Wieviele Methoden muessen in die Method-Sequence?
2825*cdf0e10cSrcweir 						sal_Int32 nExportedMethodCount = 0;
2826*cdf0e10cSrcweir 						sal_Int32 nSupportedListenerCount = 0;
2827*cdf0e10cSrcweir 						for( i = 0 ; i < nSourceMethodCount ; i++ )
2828*cdf0e10cSrcweir 						{
2829*cdf0e10cSrcweir 							if( pMethodTypes[ i ] != INVALID_METHOD )
2830*cdf0e10cSrcweir 							{
2831*cdf0e10cSrcweir 								nExportedMethodCount++;
2832*cdf0e10cSrcweir 							}
2833*cdf0e10cSrcweir 							if( pMethodTypes[ i ] == ADD_LISTENER_METHOD )
2834*cdf0e10cSrcweir 							{
2835*cdf0e10cSrcweir 								nSupportedListenerCount++;
2836*cdf0e10cSrcweir 							}
2837*cdf0e10cSrcweir 						}
2838*cdf0e10cSrcweir 
2839*cdf0e10cSrcweir 						// Sequences im Access-Objekt entsprechend aufbohren
2840*cdf0e10cSrcweir 						pAccess->maAllMethodSeq.realloc( nExportedMethodCount + iAllExportedMethod );
2841*cdf0e10cSrcweir 						pAccess->maMethodConceptSeq.realloc( nExportedMethodCount + iAllExportedMethod );
2842*cdf0e10cSrcweir 						pAccess->maSupportedListenerSeq.realloc( nSupportedListenerCount + iAllSupportedListener );
2843*cdf0e10cSrcweir 
2844*cdf0e10cSrcweir 						// Methoden reinschreiben
2845*cdf0e10cSrcweir 						Reference<XIdlMethod>* pDestMethods = pAccess->maAllMethodSeq.getArray();
2846*cdf0e10cSrcweir 						sal_Int32* pMethodConceptArray = pAccess->maMethodConceptSeq.getArray();
2847*cdf0e10cSrcweir 						Type* pListenerClassRefs = pAccess->maSupportedListenerSeq.getArray();
2848*cdf0e10cSrcweir 						for( i = 0 ; i < nSourceMethodCount ; i++ )
2849*cdf0e10cSrcweir 						{
2850*cdf0e10cSrcweir 							if( pMethodTypes[ i ] != INVALID_METHOD )
2851*cdf0e10cSrcweir 							{
2852*cdf0e10cSrcweir 								// Methode ansprechen
2853*cdf0e10cSrcweir 								const Reference<XIdlMethod>& rxMethod = pSourceMethods[i];
2854*cdf0e10cSrcweir 
2855*cdf0e10cSrcweir 								// Namen in Hashtable eintragen, wenn nicht schon bekannt
2856*cdf0e10cSrcweir 							    ::rtl::OUString aMethName2 = rxMethod->getName();
2857*cdf0e10cSrcweir 								IntrospectionNameMap::iterator aIt = rMethodNameMap.find( aMethName2 );
2858*cdf0e10cSrcweir 								if( aIt == rMethodNameMap.end() )
2859*cdf0e10cSrcweir 								{
2860*cdf0e10cSrcweir 									// Eintragen
2861*cdf0e10cSrcweir 									rMethodNameMap[ aMethName2 ] = iAllExportedMethod;
2862*cdf0e10cSrcweir 
2863*cdf0e10cSrcweir 								    // Tabelle fuer XExactName pflegen
2864*cdf0e10cSrcweir 								    rLowerToExactNameMap[ toLower( aMethName2 ) ] = aMethName2;
2865*cdf0e10cSrcweir 								}
2866*cdf0e10cSrcweir                                 else
2867*cdf0e10cSrcweir                                 {
2868*cdf0e10cSrcweir                             		sal_Int32 iHashResult = (*aIt).second;
2869*cdf0e10cSrcweir 
2870*cdf0e10cSrcweir                                 	Reference<XIdlMethod> xExistingMethod = pDestMethods[ iHashResult ];
2871*cdf0e10cSrcweir 
2872*cdf0e10cSrcweir 					                Reference< XIdlClass > xExistingMethClass =
2873*cdf0e10cSrcweir                                         xExistingMethod->getDeclaringClass();
2874*cdf0e10cSrcweir 					                Reference< XIdlClass > xNewMethClass = rxMethod->getDeclaringClass();
2875*cdf0e10cSrcweir 					                if( xExistingMethClass->equals( xNewMethClass ) )
2876*cdf0e10cSrcweir                                         continue;
2877*cdf0e10cSrcweir                                 }
2878*cdf0e10cSrcweir 
2879*cdf0e10cSrcweir 								pDestMethods[ iAllExportedMethod ] = rxMethod;
2880*cdf0e10cSrcweir 
2881*cdf0e10cSrcweir 								// Wenn kein Concept gesetzt wurde, ist die Methode "normal"
2882*cdf0e10cSrcweir 								sal_Int32& rMethodConcept_i = pLocalMethodConcepts[ i ];
2883*cdf0e10cSrcweir 								if( !rMethodConcept_i )
2884*cdf0e10cSrcweir 									rMethodConcept_i = MethodConcept_NORMAL_IMPL;
2885*cdf0e10cSrcweir 								pMethodConceptArray[ iAllExportedMethod ] = rMethodConcept_i;
2886*cdf0e10cSrcweir 								iAllExportedMethod++;
2887*cdf0e10cSrcweir 							}
2888*cdf0e10cSrcweir 							if( pMethodTypes[ i ] == ADD_LISTENER_METHOD )
2889*cdf0e10cSrcweir 							{
2890*cdf0e10cSrcweir 								// Klasse des Listeners ermitteln
2891*cdf0e10cSrcweir 								const Reference<XIdlMethod>& rxMethod = pSourceMethods[i];
2892*cdf0e10cSrcweir 
2893*cdf0e10cSrcweir 								// void als Default-Klasse eintragen
2894*cdf0e10cSrcweir 								Reference<XIdlClass> xListenerClass = TypeToIdlClass( getCppuVoidType(), m_xSMgr );
2895*cdf0e10cSrcweir 								// ALT: Reference<XIdlClass> xListenerClass = Void_getReflection()->getIdlClass();
2896*cdf0e10cSrcweir 
2897*cdf0e10cSrcweir 								// 1. Moeglichkeit: Parameter nach einer Listener-Klasse durchsuchen
2898*cdf0e10cSrcweir 								// Nachteil: Superklassen muessen rekursiv durchsucht werden
2899*cdf0e10cSrcweir 								Sequence< Reference<XIdlClass> > aParams = rxMethod->getParameterTypes();
2900*cdf0e10cSrcweir 								const Reference<XIdlClass>* pParamArray2 = aParams.getConstArray();
2901*cdf0e10cSrcweir 
2902*cdf0e10cSrcweir 								Reference<XIdlClass> xEventListenerClass = TypeToIdlClass( getCppuType( (Reference<XEventListener>*) NULL ), m_xSMgr );
2903*cdf0e10cSrcweir 								// ALT: Reference<XIdlClass> xEventListenerClass = XEventListener_getReflection()->getIdlClass();
2904*cdf0e10cSrcweir 								sal_Int32 nParamCount = aParams.getLength();
2905*cdf0e10cSrcweir 								sal_Int32 k;
2906*cdf0e10cSrcweir 								for( k = 0 ; k < nParamCount ; k++ )
2907*cdf0e10cSrcweir 								{
2908*cdf0e10cSrcweir 									const Reference<XIdlClass>& rxClass = pParamArray2[k];
2909*cdf0e10cSrcweir 
2910*cdf0e10cSrcweir 									// Sind wir von einem Listener abgeleitet?
2911*cdf0e10cSrcweir 									if( rxClass->equals( xEventListenerClass ) ||
2912*cdf0e10cSrcweir 										isDerivedFrom( rxClass, xEventListenerClass ) )
2913*cdf0e10cSrcweir 									{
2914*cdf0e10cSrcweir 										xListenerClass = rxClass;
2915*cdf0e10cSrcweir 										break;
2916*cdf0e10cSrcweir 									}
2917*cdf0e10cSrcweir 								}
2918*cdf0e10cSrcweir 
2919*cdf0e10cSrcweir 								// 2. Moeglichkeit: Namen der Methode auswerden
2920*cdf0e10cSrcweir 								// Nachteil: geht nicht bei Test-Listenern, die es nicht gibt
2921*cdf0e10cSrcweir 								//aMethName = rxMethod->getName();
2922*cdf0e10cSrcweir 								//aListenerName = aMethName.Copy( 3, aMethName.Len()-8-3 );
2923*cdf0e10cSrcweir 								//Reference<XIdlClass> xListenerClass = reflection->forName( aListenerName );
2924*cdf0e10cSrcweir 								Type aListenerType( TypeClass_INTERFACE, xListenerClass->getName() );
2925*cdf0e10cSrcweir 								pListenerClassRefs[ iAllSupportedListener ] = aListenerType;
2926*cdf0e10cSrcweir 								iAllSupportedListener++;
2927*cdf0e10cSrcweir 							}
2928*cdf0e10cSrcweir 						}
2929*cdf0e10cSrcweir 
2930*cdf0e10cSrcweir 						// Wenn in diesem Durchlauf XInterface-Methoden
2931*cdf0e10cSrcweir 						// dabei waren, diese zukuenftig ignorieren
2932*cdf0e10cSrcweir 						if( bFoundXInterface )
2933*cdf0e10cSrcweir 							bXInterfaceIsInvalid = sal_True;
2934*cdf0e10cSrcweir 
2935*cdf0e10cSrcweir 						delete[] pMethodTypes;
2936*cdf0e10cSrcweir 						delete[] pLocalMethodConcepts;
2937*cdf0e10cSrcweir 					}
2938*cdf0e10cSrcweir 
2939*cdf0e10cSrcweir 					// Super-Klasse(n) vorhanden? Dann dort fortsetzen
2940*cdf0e10cSrcweir 					Sequence< Reference<XIdlClass> > aSuperClassSeq = xImplClass2->getSuperclasses();
2941*cdf0e10cSrcweir 
2942*cdf0e10cSrcweir 					// Zur Zeit wird nur von einer Superklasse ausgegangen
2943*cdf0e10cSrcweir 					if( aSuperClassSeq.getLength() >= 1 )
2944*cdf0e10cSrcweir 					{
2945*cdf0e10cSrcweir 						xImplClass2 = aSuperClassSeq.getConstArray()[0];
2946*cdf0e10cSrcweir 						OSL_ENSURE( xImplClass2.is(), "super class null" );
2947*cdf0e10cSrcweir 					}
2948*cdf0e10cSrcweir 					else
2949*cdf0e10cSrcweir 					{
2950*cdf0e10cSrcweir 						xImplClass2 = NULL;
2951*cdf0e10cSrcweir 					}
2952*cdf0e10cSrcweir 				}
2953*cdf0e10cSrcweir 			}
2954*cdf0e10cSrcweir 
2955*cdf0e10cSrcweir 			// Anzahl der exportierten Methoden uebernehmen und Sequences anpassen
2956*cdf0e10cSrcweir 			// (kann abweichen, weil doppelte Methoden erst nach der Ermittlung
2957*cdf0e10cSrcweir 			//  von nExportedMethodCount herausgeworfen werden)
2958*cdf0e10cSrcweir 			sal_Int32& rMethCount = pAccess->mnMethCount;
2959*cdf0e10cSrcweir 			rMethCount = iAllExportedMethod;
2960*cdf0e10cSrcweir 			pAccess->maAllMethodSeq.realloc( rMethCount );
2961*cdf0e10cSrcweir 			pAccess->maMethodConceptSeq.realloc( rMethCount );
2962*cdf0e10cSrcweir 
2963*cdf0e10cSrcweir 			// Groesse der Property-Sequences anpassen
2964*cdf0e10cSrcweir 			pAccess->maAllPropertySeq.realloc( rPropCount );
2965*cdf0e10cSrcweir 			pAccess->maPropertyConceptSeq.realloc( rPropCount );
2966*cdf0e10cSrcweir 			pAccess->maMapTypeSeq.realloc( rPropCount );
2967*cdf0e10cSrcweir 
2968*cdf0e10cSrcweir 			// Ende der Schleife ueber alle vom ClassProvider angegebenen Klassen
2969*cdf0e10cSrcweir 		}
2970*cdf0e10cSrcweir 	}
2971*cdf0e10cSrcweir 	// Bei structs Fields als Properties registrieren
2972*cdf0e10cSrcweir 	else //if( eType == TypeClass_STRUCT )
2973*cdf0e10cSrcweir 	{
2974*cdf0e10cSrcweir 		// Ist es ein Interface oder eine struct?
2975*cdf0e10cSrcweir 		//Reference<XIdlClass> xClassRef = aToInspectObj.getReflection()->getIdlClass();
2976*cdf0e10cSrcweir 		Reference<XIdlClass> xClassRef = TypeToIdlClass( aToInspectObj.getValueType(), m_xSMgr );
2977*cdf0e10cSrcweir 		if( !xClassRef.is() )
2978*cdf0e10cSrcweir 		{
2979*cdf0e10cSrcweir 			OSL_ENSURE( sal_False, "Can't get XIdlClass from Reflection" );
2980*cdf0e10cSrcweir 			return pAccess;
2981*cdf0e10cSrcweir 		}
2982*cdf0e10cSrcweir 
2983*cdf0e10cSrcweir 		// Felder holen
2984*cdf0e10cSrcweir 		Sequence< Reference<XIdlField> > fields = xClassRef->getFields();
2985*cdf0e10cSrcweir 		const Reference<XIdlField>* pFields = fields.getConstArray();
2986*cdf0e10cSrcweir 		sal_Int32 nLen = fields.getLength();
2987*cdf0e10cSrcweir 
2988*cdf0e10cSrcweir 		for( i = 0 ; i < nLen ; i++ )
2989*cdf0e10cSrcweir 		{
2990*cdf0e10cSrcweir 			Reference<XIdlField> xField = pFields[i];
2991*cdf0e10cSrcweir 			Reference<XIdlClass> xPropType = xField->getType();
2992*cdf0e10cSrcweir 		    ::rtl::OUString aPropName = xField->getName();
2993*cdf0e10cSrcweir 
2994*cdf0e10cSrcweir 			// Ist die PropertySequence gross genug?
2995*cdf0e10cSrcweir 			pAccess->checkPropertyArraysSize
2996*cdf0e10cSrcweir 				( pAllPropArray, pMapTypeArray, pPropertyConceptArray, rPropCount );
2997*cdf0e10cSrcweir 
2998*cdf0e10cSrcweir 			// In eigenes Property-Array eintragen
2999*cdf0e10cSrcweir 			Property& rProp = pAllPropArray[ rPropCount ];
3000*cdf0e10cSrcweir 			rProp.Name = aPropName;
3001*cdf0e10cSrcweir 			rProp.Handle = rPropCount;
3002*cdf0e10cSrcweir 			rProp.Type = Type( xPropType->getTypeClass(), xPropType->getName() );
3003*cdf0e10cSrcweir 			FieldAccessMode eAccessMode = xField->getAccessMode();
3004*cdf0e10cSrcweir 			rProp.Attributes = (eAccessMode == FieldAccessMode_READONLY ||
3005*cdf0e10cSrcweir 								eAccessMode == FieldAccessMode_CONST)
3006*cdf0e10cSrcweir 								? READONLY : 0;
3007*cdf0e10cSrcweir 
3008*cdf0e10cSrcweir 			//FieldAccessMode eAccessMode = xField->getAccessMode();
3009*cdf0e10cSrcweir 			//rProp.Attributes = (eAccessMode == FieldAccessMode::READONLY || eAccessMode == CONST)
3010*cdf0e10cSrcweir 				//? PropertyAttribute::READONLY : 0;
3011*cdf0e10cSrcweir 
3012*cdf0e10cSrcweir 			// Namen in Hashtable eintragen
3013*cdf0e10cSrcweir 			rPropNameMap[ aPropName ] = rPropCount;
3014*cdf0e10cSrcweir 
3015*cdf0e10cSrcweir 			// Tabelle fuer XExactName pflegen
3016*cdf0e10cSrcweir 			rLowerToExactNameMap[ toLower( aPropName ) ] = aPropName;
3017*cdf0e10cSrcweir 
3018*cdf0e10cSrcweir 			// Field merken
3019*cdf0e10cSrcweir 			pAccess->checkInterfaceArraySize( pAccess->aInterfaceSeq1,
3020*cdf0e10cSrcweir 				pInterfaces1, rPropCount );
3021*cdf0e10cSrcweir 			pInterfaces1[ rPropCount ] = xField;
3022*cdf0e10cSrcweir 
3023*cdf0e10cSrcweir 			// Art der Property merken
3024*cdf0e10cSrcweir 			pMapTypeArray[ rPropCount ] = MAP_FIELD;
3025*cdf0e10cSrcweir 			pPropertyConceptArray[ rPropCount ] = ATTRIBUTES;
3026*cdf0e10cSrcweir 			pAccess->mnAttributePropCount++;
3027*cdf0e10cSrcweir 
3028*cdf0e10cSrcweir 			// Count pflegen
3029*cdf0e10cSrcweir 			rPropCount++;
3030*cdf0e10cSrcweir 		}
3031*cdf0e10cSrcweir 	}
3032*cdf0e10cSrcweir 
3033*cdf0e10cSrcweir 	// Property-Sequence auf die richtige Laenge bringen
3034*cdf0e10cSrcweir 	pAccess->maAllPropertySeq.realloc( pAccess->mnPropCount );
3035*cdf0e10cSrcweir 
3036*cdf0e10cSrcweir 	return pAccess;
3037*cdf0e10cSrcweir }
3038*cdf0e10cSrcweir 
3039*cdf0e10cSrcweir //*************************************************************************
3040*cdf0e10cSrcweir Reference< XInterface > SAL_CALL ImplIntrospection_CreateInstance( const Reference< XMultiServiceFactory > & rSMgr )
3041*cdf0e10cSrcweir 	throw( RuntimeException )
3042*cdf0e10cSrcweir {
3043*cdf0e10cSrcweir 	Reference< XInterface > xService = (OWeakObject*)(OComponentHelper*)new ImplIntrospection( rSMgr );
3044*cdf0e10cSrcweir 	return xService;
3045*cdf0e10cSrcweir }
3046*cdf0e10cSrcweir 
3047*cdf0e10cSrcweir }
3048*cdf0e10cSrcweir 
3049*cdf0e10cSrcweir extern "C"
3050*cdf0e10cSrcweir {
3051*cdf0e10cSrcweir //==================================================================================================
3052*cdf0e10cSrcweir void SAL_CALL component_getImplementationEnvironment(
3053*cdf0e10cSrcweir 	const sal_Char ** ppEnvTypeName, uno_Environment ** )
3054*cdf0e10cSrcweir {
3055*cdf0e10cSrcweir 	*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
3056*cdf0e10cSrcweir }
3057*cdf0e10cSrcweir //==================================================================================================
3058*cdf0e10cSrcweir void * SAL_CALL component_getFactory(
3059*cdf0e10cSrcweir 	const sal_Char * pImplName, void * pServiceManager, void * )
3060*cdf0e10cSrcweir {
3061*cdf0e10cSrcweir 	void * pRet = 0;
3062*cdf0e10cSrcweir 
3063*cdf0e10cSrcweir 	if (pServiceManager && rtl_str_compare( pImplName, IMPLEMENTATION_NAME ) == 0)
3064*cdf0e10cSrcweir 	{
3065*cdf0e10cSrcweir 		Reference< XSingleServiceFactory > xFactory( createOneInstanceFactory(
3066*cdf0e10cSrcweir 			reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
3067*cdf0e10cSrcweir 		    ::rtl::OUString::createFromAscii( pImplName ),
3068*cdf0e10cSrcweir 			stoc_inspect::ImplIntrospection_CreateInstance,
3069*cdf0e10cSrcweir 			stoc_inspect::ImplIntrospection::getSupportedServiceNames_Static() ) );
3070*cdf0e10cSrcweir 
3071*cdf0e10cSrcweir 		if (xFactory.is())
3072*cdf0e10cSrcweir 		{
3073*cdf0e10cSrcweir 			xFactory->acquire();
3074*cdf0e10cSrcweir 			pRet = xFactory.get();
3075*cdf0e10cSrcweir 		}
3076*cdf0e10cSrcweir 	}
3077*cdf0e10cSrcweir 
3078*cdf0e10cSrcweir 	return pRet;
3079*cdf0e10cSrcweir }
3080*cdf0e10cSrcweir }
3081*cdf0e10cSrcweir 
3082*cdf0e10cSrcweir 
3083