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 #ifndef _STOC_RDBTDP_BASE_HXX
29*cdf0e10cSrcweir #define _STOC_RDBTDP_BASE_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <osl/diagnose.h>
32*cdf0e10cSrcweir #include <osl/mutex.hxx>
33*cdf0e10cSrcweir #include <cppuhelper/weak.hxx>
34*cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx>
35*cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx>
36*cdf0e10cSrcweir #ifndef _CPPUHELPER_IMPLEMENTATIONENTRY_HXX_
37*cdf0e10cSrcweir #include <cppuhelper/implementationentry.hxx>
38*cdf0e10cSrcweir #endif
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir #include "registry/refltype.hxx"
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir #include <list>
43*cdf0e10cSrcweir #include <memory>
44*cdf0e10cSrcweir #include <vector>
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir #include <com/sun/star/reflection/XTypeDescription.hpp>
47*cdf0e10cSrcweir #include <com/sun/star/reflection/XTypeDescriptionEnumerationAccess.hpp>
48*cdf0e10cSrcweir #include <com/sun/star/reflection/XInterfaceTypeDescription.hpp>
49*cdf0e10cSrcweir #include <com/sun/star/reflection/XInterfaceTypeDescription2.hpp>
50*cdf0e10cSrcweir #include <com/sun/star/reflection/XCompoundTypeDescription.hpp>
51*cdf0e10cSrcweir #include <com/sun/star/reflection/XConstantTypeDescription.hpp>
52*cdf0e10cSrcweir #include <com/sun/star/reflection/XConstantsTypeDescription.hpp>
53*cdf0e10cSrcweir #include <com/sun/star/reflection/XEnumTypeDescription.hpp>
54*cdf0e10cSrcweir #include <com/sun/star/reflection/XIndirectTypeDescription.hpp>
55*cdf0e10cSrcweir #include <com/sun/star/reflection/XServiceConstructorDescription.hpp>
56*cdf0e10cSrcweir #include <com/sun/star/reflection/XServiceTypeDescription.hpp>
57*cdf0e10cSrcweir #include <com/sun/star/reflection/XServiceTypeDescription2.hpp>
58*cdf0e10cSrcweir #include <com/sun/star/reflection/XSingletonTypeDescription2.hpp>
59*cdf0e10cSrcweir #include <com/sun/star/reflection/XModuleTypeDescription.hpp>
60*cdf0e10cSrcweir #include <com/sun/star/reflection/XPublished.hpp>
61*cdf0e10cSrcweir #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
62*cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp>
63*cdf0e10cSrcweir #include <com/sun/star/registry/XRegistryKey.hpp>
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir using namespace std;
66*cdf0e10cSrcweir using namespace rtl;
67*cdf0e10cSrcweir using namespace osl;
68*cdf0e10cSrcweir using namespace cppu;
69*cdf0e10cSrcweir using namespace com::sun::star::uno;
70*cdf0e10cSrcweir using namespace com::sun::star::lang;
71*cdf0e10cSrcweir using namespace com::sun::star::container;
72*cdf0e10cSrcweir using namespace com::sun::star::reflection;
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir extern rtl_StandardModuleCount g_moduleCount;
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir namespace stoc_rdbtdp
79*cdf0e10cSrcweir {
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir com::sun::star::uno::Reference< XTypeDescription > resolveTypedefs(
82*cdf0e10cSrcweir     com::sun::star::uno::Reference< XTypeDescription > const & type);
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir ::osl::Mutex & getMutex();
86*cdf0e10cSrcweir 
87*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------
88*cdf0e10cSrcweir 
89*cdf0e10cSrcweir typedef ::std::list< ::com::sun::star::uno::Reference<
90*cdf0e10cSrcweir             ::com::sun::star::registry::XRegistryKey > > RegistryKeyList;
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir class RegistryKeyCloser
95*cdf0e10cSrcweir {
96*cdf0e10cSrcweir public:
97*cdf0e10cSrcweir     RegistryKeyCloser( const ::com::sun::star::uno::Reference<
98*cdf0e10cSrcweir         ::com::sun::star::registry::XRegistryKey > & xKey )
99*cdf0e10cSrcweir     : m_xKey( xKey ) {}
100*cdf0e10cSrcweir     ~RegistryKeyCloser()
101*cdf0e10cSrcweir     { if ( m_xKey.is() ) { try { if ( m_xKey->isValid() ) m_xKey->closeKey(); } catch (...) {} } }
102*cdf0e10cSrcweir 
103*cdf0e10cSrcweir     void reset() { m_xKey.clear(); }
104*cdf0e10cSrcweir private:
105*cdf0e10cSrcweir     ::com::sun::star::uno::Reference<
106*cdf0e10cSrcweir         ::com::sun::star::registry::XRegistryKey > m_xKey;
107*cdf0e10cSrcweir };
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir // helper to create XTypeDescription instances using typereg::Reader
112*cdf0e10cSrcweir // (used from Type Provider and Type Description Enumeration implementation)
113*cdf0e10cSrcweir ::com::sun::star::uno::Reference<
114*cdf0e10cSrcweir     ::com::sun::star::reflection::XTypeDescription >
115*cdf0e10cSrcweir createTypeDescription(
116*cdf0e10cSrcweir     const ::com::sun::star::uno::Sequence< sal_Int8 > & rData,
117*cdf0e10cSrcweir     const ::com::sun::star::uno::Reference<
118*cdf0e10cSrcweir         ::com::sun::star::container::XHierarchicalNameAccess > & xNameAccess,
119*cdf0e10cSrcweir     bool bReturnEmptyRefForUnknownType );
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------
123*cdf0e10cSrcweir inline sal_Int32 getRTValueAsInt32( const RTConstValue & rVal )
124*cdf0e10cSrcweir {
125*cdf0e10cSrcweir 	switch (rVal.m_type)
126*cdf0e10cSrcweir 	{
127*cdf0e10cSrcweir 	case RT_TYPE_BYTE:
128*cdf0e10cSrcweir 		return rVal.m_value.aByte;
129*cdf0e10cSrcweir 	case RT_TYPE_INT16:
130*cdf0e10cSrcweir 		return rVal.m_value.aShort;
131*cdf0e10cSrcweir 	case RT_TYPE_UINT16:
132*cdf0e10cSrcweir 		return rVal.m_value.aUShort;
133*cdf0e10cSrcweir 	case RT_TYPE_INT32:
134*cdf0e10cSrcweir 		return rVal.m_value.aLong;
135*cdf0e10cSrcweir 	case RT_TYPE_UINT32:
136*cdf0e10cSrcweir 		return rVal.m_value.aULong;
137*cdf0e10cSrcweir     default:
138*cdf0e10cSrcweir         OSL_ENSURE( sal_False, "### unexpected value type!" );
139*cdf0e10cSrcweir         return 0;
140*cdf0e10cSrcweir 	}
141*cdf0e10cSrcweir }
142*cdf0e10cSrcweir //--------------------------------------------------------------------------------------------------
143*cdf0e10cSrcweir inline Any getRTValue( const RTConstValue & rVal )
144*cdf0e10cSrcweir {
145*cdf0e10cSrcweir 	switch (rVal.m_type)
146*cdf0e10cSrcweir 	{
147*cdf0e10cSrcweir 	case RT_TYPE_BOOL:
148*cdf0e10cSrcweir 		return Any( &rVal.m_value.aBool, ::getCppuBooleanType() );
149*cdf0e10cSrcweir 	case RT_TYPE_BYTE:
150*cdf0e10cSrcweir 		return Any( &rVal.m_value.aByte, ::getCppuType( (const sal_Int8 *)0 ) );
151*cdf0e10cSrcweir 	case RT_TYPE_INT16:
152*cdf0e10cSrcweir 		return Any( &rVal.m_value.aShort, ::getCppuType( (const sal_Int16 *)0 ) );
153*cdf0e10cSrcweir 	case RT_TYPE_UINT16:
154*cdf0e10cSrcweir 		return Any( &rVal.m_value.aUShort, ::getCppuType( (const sal_uInt16 *)0 ) );
155*cdf0e10cSrcweir 	case RT_TYPE_INT32:
156*cdf0e10cSrcweir 		return Any( &rVal.m_value.aLong, ::getCppuType( (const sal_Int32 *)0 ) );
157*cdf0e10cSrcweir 	case RT_TYPE_UINT32:
158*cdf0e10cSrcweir 		return Any( &rVal.m_value.aULong, ::getCppuType( (const sal_uInt32 *)0 ) );
159*cdf0e10cSrcweir 	case RT_TYPE_INT64:
160*cdf0e10cSrcweir 		return Any( &rVal.m_value.aHyper, ::getCppuType( (const sal_Int64 *)0 ) );
161*cdf0e10cSrcweir 	case RT_TYPE_UINT64:
162*cdf0e10cSrcweir 		return Any( &rVal.m_value.aUHyper, ::getCppuType( (const sal_uInt64 *)0 ) );
163*cdf0e10cSrcweir 	case RT_TYPE_FLOAT:
164*cdf0e10cSrcweir 		return Any( &rVal.m_value.aFloat, ::getCppuType( (const float *)0 ) );
165*cdf0e10cSrcweir 	case RT_TYPE_DOUBLE:
166*cdf0e10cSrcweir 		return Any( &rVal.m_value.aDouble, ::getCppuType( (const double *)0 ) );
167*cdf0e10cSrcweir 	case RT_TYPE_STRING:
168*cdf0e10cSrcweir 	{
169*cdf0e10cSrcweir 		OUString aStr( rVal.m_value.aString );
170*cdf0e10cSrcweir 		return Any( &aStr, ::getCppuType( (const OUString *)0 ) );
171*cdf0e10cSrcweir 	}
172*cdf0e10cSrcweir     default:
173*cdf0e10cSrcweir         OSL_ENSURE( sal_False, "### unexpected RTValue!" );
174*cdf0e10cSrcweir         return Any();
175*cdf0e10cSrcweir 	}
176*cdf0e10cSrcweir }
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir //==================================================================================================
179*cdf0e10cSrcweir class TypeDescriptionImpl : public WeakImplHelper1< XTypeDescription >
180*cdf0e10cSrcweir {
181*cdf0e10cSrcweir 	TypeClass			_eTypeClass;
182*cdf0e10cSrcweir 	OUString			_aName;
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir public:
185*cdf0e10cSrcweir 	TypeDescriptionImpl( TypeClass eTypeClass, const OUString & rName )
186*cdf0e10cSrcweir 		: _eTypeClass( eTypeClass )
187*cdf0e10cSrcweir 		, _aName( rName )
188*cdf0e10cSrcweir 		{
189*cdf0e10cSrcweir 			g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
190*cdf0e10cSrcweir 		}
191*cdf0e10cSrcweir 	virtual ~TypeDescriptionImpl();
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir 	// XTypeDescription
194*cdf0e10cSrcweir     virtual TypeClass SAL_CALL getTypeClass() throw(::com::sun::star::uno::RuntimeException);
195*cdf0e10cSrcweir     virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
196*cdf0e10cSrcweir };
197*cdf0e10cSrcweir 
198*cdf0e10cSrcweir //==================================================================================================
199*cdf0e10cSrcweir class InterfaceTypeDescriptionImpl:
200*cdf0e10cSrcweir     public WeakImplHelper2< XInterfaceTypeDescription2, XPublished >
201*cdf0e10cSrcweir {
202*cdf0e10cSrcweir 	com::sun::star::uno::Reference< XHierarchicalNameAccess >  _xTDMgr;
203*cdf0e10cSrcweir 	Sequence< sal_Int8 >				  _aBytes;
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir 	OUString							  _aName;
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir 	Sequence< OUString >				  _aBaseTypes;
208*cdf0e10cSrcweir 	Sequence< com::sun::star::uno::Reference< XTypeDescription > > _xBaseTDs;
209*cdf0e10cSrcweir 	Sequence< OUString >				  _aOptionalBaseTypes;
210*cdf0e10cSrcweir 	Sequence< com::sun::star::uno::Reference< XTypeDescription > >
211*cdf0e10cSrcweir     _xOptionalBaseTDs;
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir 	sal_Int32							  _nBaseOffset;
214*cdf0e10cSrcweir     Sequence<
215*cdf0e10cSrcweir         com::sun::star::uno::Reference< XInterfaceMemberTypeDescription > >
216*cdf0e10cSrcweir     _members;
217*cdf0e10cSrcweir     bool _membersInit;
218*cdf0e10cSrcweir 
219*cdf0e10cSrcweir     bool _published;
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir     void checkInterfaceType(
222*cdf0e10cSrcweir         com::sun::star::uno::Reference< XTypeDescription > const & type);
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir public:
225*cdf0e10cSrcweir 	InterfaceTypeDescriptionImpl(
226*cdf0e10cSrcweir         const com::sun::star::uno::Reference< XHierarchicalNameAccess > &
227*cdf0e10cSrcweir         xTDMgr,
228*cdf0e10cSrcweir         const OUString & rName, const Sequence< OUString > & rBaseTypes,
229*cdf0e10cSrcweir         const Sequence< OUString > & rOptionalBaseTypes,
230*cdf0e10cSrcweir         const Sequence< sal_Int8 > & rBytes, bool published );
231*cdf0e10cSrcweir 	virtual ~InterfaceTypeDescriptionImpl();
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir 	// XTypeDescription
234*cdf0e10cSrcweir     virtual TypeClass SAL_CALL getTypeClass() throw(::com::sun::star::uno::RuntimeException);
235*cdf0e10cSrcweir     virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir 	// XInterfaceTypeDescription2
238*cdf0e10cSrcweir     virtual Uik SAL_CALL getUik() throw(::com::sun::star::uno::RuntimeException);
239*cdf0e10cSrcweir     virtual com::sun::star::uno::Reference< XTypeDescription > SAL_CALL
240*cdf0e10cSrcweir     getBaseType() throw(::com::sun::star::uno::RuntimeException);
241*cdf0e10cSrcweir     virtual
242*cdf0e10cSrcweir     Sequence<
243*cdf0e10cSrcweir         com::sun::star::uno::Reference< XInterfaceMemberTypeDescription > >
244*cdf0e10cSrcweir     SAL_CALL getMembers() throw(::com::sun::star::uno::RuntimeException);
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir     virtual Sequence< com::sun::star::uno::Reference< XTypeDescription > >
247*cdf0e10cSrcweir     SAL_CALL getBaseTypes() throw (RuntimeException);
248*cdf0e10cSrcweir 
249*cdf0e10cSrcweir     virtual Sequence< com::sun::star::uno::Reference< XTypeDescription > >
250*cdf0e10cSrcweir     SAL_CALL getOptionalBaseTypes() throw (RuntimeException);
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL isPublished()
253*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException)
254*cdf0e10cSrcweir     { return _published; }
255*cdf0e10cSrcweir };
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir //==================================================================================================
258*cdf0e10cSrcweir class CompoundTypeDescriptionImpl:
259*cdf0e10cSrcweir     public WeakImplHelper2< XCompoundTypeDescription, XPublished >
260*cdf0e10cSrcweir {
261*cdf0e10cSrcweir 	com::sun::star::uno::Reference< XHierarchicalNameAccess >  _xTDMgr;
262*cdf0e10cSrcweir 	TypeClass							  _eTypeClass;
263*cdf0e10cSrcweir 	Sequence< sal_Int8 >				  _aBytes;
264*cdf0e10cSrcweir 	OUString							  _aName;
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir 	OUString							  _aBaseType;
267*cdf0e10cSrcweir 	com::sun::star::uno::Reference< XTypeDescription >		  _xBaseTD;
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir 	Sequence< com::sun::star::uno::Reference< XTypeDescription > > * _pMembers;
270*cdf0e10cSrcweir 	Sequence< OUString > *				  _pMemberNames;
271*cdf0e10cSrcweir 
272*cdf0e10cSrcweir     bool _published;
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir public:
275*cdf0e10cSrcweir 	CompoundTypeDescriptionImpl(
276*cdf0e10cSrcweir         const com::sun::star::uno::Reference< XHierarchicalNameAccess > &
277*cdf0e10cSrcweir         xTDMgr,
278*cdf0e10cSrcweir         TypeClass eTypeClass,
279*cdf0e10cSrcweir         const OUString & rName, const OUString & rBaseName,
280*cdf0e10cSrcweir         const Sequence< sal_Int8 > & rBytes,
281*cdf0e10cSrcweir         bool published )
282*cdf0e10cSrcweir 		: _xTDMgr( xTDMgr )
283*cdf0e10cSrcweir 		, _eTypeClass( eTypeClass )
284*cdf0e10cSrcweir 		, _aBytes( rBytes )
285*cdf0e10cSrcweir 		, _aName( rName )
286*cdf0e10cSrcweir 		, _aBaseType( rBaseName )
287*cdf0e10cSrcweir 		, _pMembers( 0 )
288*cdf0e10cSrcweir 		, _pMemberNames( 0 )
289*cdf0e10cSrcweir         , _published( published )
290*cdf0e10cSrcweir 		{
291*cdf0e10cSrcweir 			g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
292*cdf0e10cSrcweir 		}
293*cdf0e10cSrcweir 	virtual ~CompoundTypeDescriptionImpl();
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir 	// XTypeDescription
296*cdf0e10cSrcweir     virtual TypeClass SAL_CALL getTypeClass() throw(::com::sun::star::uno::RuntimeException);
297*cdf0e10cSrcweir     virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
298*cdf0e10cSrcweir 
299*cdf0e10cSrcweir 	// XCompoundTypeDescription
300*cdf0e10cSrcweir     virtual com::sun::star::uno::Reference< XTypeDescription > SAL_CALL
301*cdf0e10cSrcweir     getBaseType() throw(::com::sun::star::uno::RuntimeException);
302*cdf0e10cSrcweir     virtual Sequence< com::sun::star::uno::Reference< XTypeDescription > >
303*cdf0e10cSrcweir     SAL_CALL getMemberTypes() throw(::com::sun::star::uno::RuntimeException);
304*cdf0e10cSrcweir     virtual Sequence< OUString > SAL_CALL getMemberNames() throw(::com::sun::star::uno::RuntimeException);
305*cdf0e10cSrcweir 
306*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL isPublished()
307*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException)
308*cdf0e10cSrcweir     { return _published; }
309*cdf0e10cSrcweir };
310*cdf0e10cSrcweir 
311*cdf0e10cSrcweir //==================================================================================================
312*cdf0e10cSrcweir class EnumTypeDescriptionImpl:
313*cdf0e10cSrcweir     public WeakImplHelper2< XEnumTypeDescription, XPublished >
314*cdf0e10cSrcweir {
315*cdf0e10cSrcweir 	com::sun::star::uno::Reference< XHierarchicalNameAccess >  _xTDMgr;
316*cdf0e10cSrcweir 	Sequence< sal_Int8 >				  _aBytes;
317*cdf0e10cSrcweir 
318*cdf0e10cSrcweir 	OUString							  _aName;
319*cdf0e10cSrcweir 	sal_Int32							  _nDefaultValue;
320*cdf0e10cSrcweir 
321*cdf0e10cSrcweir 	Sequence< OUString > *				  _pEnumNames;
322*cdf0e10cSrcweir 	Sequence< sal_Int32 > *				  _pEnumValues;
323*cdf0e10cSrcweir 
324*cdf0e10cSrcweir     bool _published;
325*cdf0e10cSrcweir 
326*cdf0e10cSrcweir public:
327*cdf0e10cSrcweir 	EnumTypeDescriptionImpl(
328*cdf0e10cSrcweir         const com::sun::star::uno::Reference< XHierarchicalNameAccess > &
329*cdf0e10cSrcweir         xTDMgr,
330*cdf0e10cSrcweir         const OUString & rName, sal_Int32 nDefaultValue,
331*cdf0e10cSrcweir         const Sequence< sal_Int8 > & rBytes, bool published )
332*cdf0e10cSrcweir 		: _xTDMgr( xTDMgr )
333*cdf0e10cSrcweir 		, _aBytes( rBytes )
334*cdf0e10cSrcweir 		, _aName( rName )
335*cdf0e10cSrcweir 		, _nDefaultValue( nDefaultValue )
336*cdf0e10cSrcweir 		, _pEnumNames( 0 )
337*cdf0e10cSrcweir 		, _pEnumValues( 0 )
338*cdf0e10cSrcweir         , _published( published )
339*cdf0e10cSrcweir 		{
340*cdf0e10cSrcweir 			g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
341*cdf0e10cSrcweir 		}
342*cdf0e10cSrcweir 	virtual ~EnumTypeDescriptionImpl();
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir 	// XTypeDescription
345*cdf0e10cSrcweir     virtual TypeClass SAL_CALL getTypeClass() throw(::com::sun::star::uno::RuntimeException);
346*cdf0e10cSrcweir     virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir 	// XEnumTypeDescription
349*cdf0e10cSrcweir     virtual sal_Int32 SAL_CALL getDefaultEnumValue() throw(::com::sun::star::uno::RuntimeException);
350*cdf0e10cSrcweir     virtual Sequence< OUString > SAL_CALL getEnumNames() throw(::com::sun::star::uno::RuntimeException);
351*cdf0e10cSrcweir     virtual Sequence< sal_Int32 > SAL_CALL getEnumValues() throw(::com::sun::star::uno::RuntimeException);
352*cdf0e10cSrcweir 
353*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL isPublished()
354*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException)
355*cdf0e10cSrcweir     { return _published; }
356*cdf0e10cSrcweir };
357*cdf0e10cSrcweir 
358*cdf0e10cSrcweir //==================================================================================================
359*cdf0e10cSrcweir class TypedefTypeDescriptionImpl:
360*cdf0e10cSrcweir     public WeakImplHelper2< XIndirectTypeDescription, XPublished >
361*cdf0e10cSrcweir {
362*cdf0e10cSrcweir 	com::sun::star::uno::Reference< XHierarchicalNameAccess > _xTDMgr;
363*cdf0e10cSrcweir 	OUString							  _aName;
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir 	OUString							  _aRefName;
366*cdf0e10cSrcweir 	com::sun::star::uno::Reference< XTypeDescription > _xRefTD;
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir     bool _published;
369*cdf0e10cSrcweir 
370*cdf0e10cSrcweir public:
371*cdf0e10cSrcweir 	TypedefTypeDescriptionImpl(
372*cdf0e10cSrcweir         const com::sun::star::uno::Reference< XHierarchicalNameAccess > &
373*cdf0e10cSrcweir         xTDMgr,
374*cdf0e10cSrcweir         const OUString & rName, const OUString & rRefName, bool published )
375*cdf0e10cSrcweir 		: _xTDMgr( xTDMgr )
376*cdf0e10cSrcweir 		, _aName( rName )
377*cdf0e10cSrcweir 		, _aRefName( rRefName )
378*cdf0e10cSrcweir         , _published( published )
379*cdf0e10cSrcweir 		{
380*cdf0e10cSrcweir 			g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
381*cdf0e10cSrcweir 		}
382*cdf0e10cSrcweir 	virtual ~TypedefTypeDescriptionImpl();
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir 	// XTypeDescription
385*cdf0e10cSrcweir     virtual TypeClass SAL_CALL getTypeClass() throw(::com::sun::star::uno::RuntimeException);
386*cdf0e10cSrcweir     virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
387*cdf0e10cSrcweir 
388*cdf0e10cSrcweir 	// XIndirectTypeDescription
389*cdf0e10cSrcweir     virtual com::sun::star::uno::Reference< XTypeDescription > SAL_CALL
390*cdf0e10cSrcweir     getReferencedType() throw(::com::sun::star::uno::RuntimeException);
391*cdf0e10cSrcweir 
392*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL isPublished()
393*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException)
394*cdf0e10cSrcweir     { return _published; }
395*cdf0e10cSrcweir };
396*cdf0e10cSrcweir 
397*cdf0e10cSrcweir //==================================================================================================
398*cdf0e10cSrcweir class ServiceTypeDescriptionImpl:
399*cdf0e10cSrcweir     public WeakImplHelper2< XServiceTypeDescription2, XPublished >
400*cdf0e10cSrcweir {
401*cdf0e10cSrcweir     OUString                              _aName;
402*cdf0e10cSrcweir     Sequence< sal_Int8 >                  _aBytes;
403*cdf0e10cSrcweir     com::sun::star::uno::Reference< XHierarchicalNameAccess > _xTDMgr;
404*cdf0e10cSrcweir     bool _bInitReferences;
405*cdf0e10cSrcweir 
406*cdf0e10cSrcweir     com::sun::star::uno::Reference< XTypeDescription > _xInterfaceTD;
407*cdf0e10cSrcweir     std::auto_ptr<
408*cdf0e10cSrcweir         Sequence<
409*cdf0e10cSrcweir             com::sun::star::uno::Reference< XServiceConstructorDescription > > >
410*cdf0e10cSrcweir     _pCtors;
411*cdf0e10cSrcweir     Sequence< com::sun::star::uno::Reference< XServiceTypeDescription > >
412*cdf0e10cSrcweir     _aMandatoryServices;
413*cdf0e10cSrcweir     Sequence< com::sun::star::uno::Reference< XServiceTypeDescription > >
414*cdf0e10cSrcweir     _aOptionalServices;
415*cdf0e10cSrcweir     Sequence< com::sun::star::uno::Reference< XInterfaceTypeDescription > >
416*cdf0e10cSrcweir     _aMandatoryInterfaces;
417*cdf0e10cSrcweir     Sequence< com::sun::star::uno::Reference< XInterfaceTypeDescription > >
418*cdf0e10cSrcweir     _aOptionalInterfaces;
419*cdf0e10cSrcweir     std::auto_ptr<
420*cdf0e10cSrcweir         Sequence< com::sun::star::uno::Reference< XPropertyTypeDescription > > >
421*cdf0e10cSrcweir     _pProps;
422*cdf0e10cSrcweir 
423*cdf0e10cSrcweir     bool _published;
424*cdf0e10cSrcweir 
425*cdf0e10cSrcweir public:
426*cdf0e10cSrcweir     ServiceTypeDescriptionImpl(
427*cdf0e10cSrcweir         const com::sun::star::uno::Reference< XHierarchicalNameAccess > &
428*cdf0e10cSrcweir         xTDMgr,
429*cdf0e10cSrcweir         const OUString & rName, const Sequence< sal_Int8 > & rBytes,
430*cdf0e10cSrcweir         bool published)
431*cdf0e10cSrcweir     : _aName( rName ), _aBytes( rBytes ), _xTDMgr( xTDMgr ),
432*cdf0e10cSrcweir       _bInitReferences( false ), _published( published )
433*cdf0e10cSrcweir     {
434*cdf0e10cSrcweir         g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
435*cdf0e10cSrcweir     }
436*cdf0e10cSrcweir     virtual ~ServiceTypeDescriptionImpl();
437*cdf0e10cSrcweir 
438*cdf0e10cSrcweir     // XTypeDescription
439*cdf0e10cSrcweir     virtual TypeClass SAL_CALL
440*cdf0e10cSrcweir     getTypeClass()
441*cdf0e10cSrcweir         throw(::com::sun::star::uno::RuntimeException);
442*cdf0e10cSrcweir     virtual OUString SAL_CALL
443*cdf0e10cSrcweir     getName()
444*cdf0e10cSrcweir         throw(::com::sun::star::uno::RuntimeException);
445*cdf0e10cSrcweir 
446*cdf0e10cSrcweir     // XServiceTypeDescription
447*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence<
448*cdf0e10cSrcweir         ::com::sun::star::uno::Reference<
449*cdf0e10cSrcweir             ::com::sun::star::reflection::XServiceTypeDescription > > SAL_CALL
450*cdf0e10cSrcweir     getMandatoryServices()
451*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
452*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence<
453*cdf0e10cSrcweir         ::com::sun::star::uno::Reference<
454*cdf0e10cSrcweir             ::com::sun::star::reflection::XServiceTypeDescription > > SAL_CALL
455*cdf0e10cSrcweir     getOptionalServices()
456*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
457*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence<
458*cdf0e10cSrcweir         ::com::sun::star::uno::Reference<
459*cdf0e10cSrcweir             ::com::sun::star::reflection::XInterfaceTypeDescription > > SAL_CALL
460*cdf0e10cSrcweir     getMandatoryInterfaces()
461*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
462*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence<
463*cdf0e10cSrcweir         ::com::sun::star::uno::Reference<
464*cdf0e10cSrcweir             ::com::sun::star::reflection::XInterfaceTypeDescription > > SAL_CALL
465*cdf0e10cSrcweir     getOptionalInterfaces()
466*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
467*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence<
468*cdf0e10cSrcweir         ::com::sun::star::uno::Reference<
469*cdf0e10cSrcweir             ::com::sun::star::reflection::XPropertyTypeDescription > > SAL_CALL
470*cdf0e10cSrcweir     getProperties()
471*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
472*cdf0e10cSrcweir 
473*cdf0e10cSrcweir     // XServiceTypeDescription2
474*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL isSingleInterfaceBased()
475*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
476*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< XTypeDescription > SAL_CALL
477*cdf0e10cSrcweir     getInterface() throw (::com::sun::star::uno::RuntimeException);
478*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence<
479*cdf0e10cSrcweir         ::com::sun::star::uno::Reference<
480*cdf0e10cSrcweir             ::com::sun::star::reflection::XServiceConstructorDescription > >
481*cdf0e10cSrcweir     SAL_CALL getConstructors()
482*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
483*cdf0e10cSrcweir 
484*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL isPublished()
485*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException)
486*cdf0e10cSrcweir     { return _published; }
487*cdf0e10cSrcweir 
488*cdf0e10cSrcweir private:
489*cdf0e10cSrcweir     void getReferences()
490*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
491*cdf0e10cSrcweir };
492*cdf0e10cSrcweir 
493*cdf0e10cSrcweir //==================================================================================================
494*cdf0e10cSrcweir class ModuleTypeDescriptionImpl : public WeakImplHelper1< XModuleTypeDescription >
495*cdf0e10cSrcweir {
496*cdf0e10cSrcweir     OUString                                        _aName;
497*cdf0e10cSrcweir     com::sun::star::uno::Reference< XTypeDescriptionEnumerationAccess > _xTDMgr;
498*cdf0e10cSrcweir 
499*cdf0e10cSrcweir     Sequence< com::sun::star::uno::Reference< XTypeDescription > > * _pMembers;
500*cdf0e10cSrcweir 
501*cdf0e10cSrcweir public:
502*cdf0e10cSrcweir     ModuleTypeDescriptionImpl(
503*cdf0e10cSrcweir         const com::sun::star::uno::Reference<
504*cdf0e10cSrcweir         XTypeDescriptionEnumerationAccess > & xTDMgr,
505*cdf0e10cSrcweir         const OUString & rName )
506*cdf0e10cSrcweir     : _aName( rName ), _xTDMgr( xTDMgr ), _pMembers( 0 )
507*cdf0e10cSrcweir     {
508*cdf0e10cSrcweir         g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
509*cdf0e10cSrcweir     }
510*cdf0e10cSrcweir     virtual ~ModuleTypeDescriptionImpl();
511*cdf0e10cSrcweir 
512*cdf0e10cSrcweir     // XTypeDescription
513*cdf0e10cSrcweir     virtual TypeClass SAL_CALL
514*cdf0e10cSrcweir     getTypeClass()
515*cdf0e10cSrcweir         throw( ::com::sun::star::uno::RuntimeException );
516*cdf0e10cSrcweir     virtual OUString SAL_CALL
517*cdf0e10cSrcweir     getName()
518*cdf0e10cSrcweir         throw( ::com::sun::star::uno::RuntimeException );
519*cdf0e10cSrcweir 
520*cdf0e10cSrcweir     // XModuleTypeDescription
521*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Sequence<
522*cdf0e10cSrcweir         ::com::sun::star::uno::Reference<
523*cdf0e10cSrcweir             ::com::sun::star::reflection::XTypeDescription > > SAL_CALL
524*cdf0e10cSrcweir     getMembers()
525*cdf0e10cSrcweir         throw ( ::com::sun::star::uno::RuntimeException );
526*cdf0e10cSrcweir };
527*cdf0e10cSrcweir 
528*cdf0e10cSrcweir //==================================================================================================
529*cdf0e10cSrcweir class ConstantTypeDescriptionImpl : public WeakImplHelper1< XConstantTypeDescription >
530*cdf0e10cSrcweir {
531*cdf0e10cSrcweir     OUString _aName;
532*cdf0e10cSrcweir     Any      _aValue;
533*cdf0e10cSrcweir 
534*cdf0e10cSrcweir public:
535*cdf0e10cSrcweir     ConstantTypeDescriptionImpl( const OUString & rName,
536*cdf0e10cSrcweir                                  const Any & rValue )
537*cdf0e10cSrcweir     : _aName( rName ), _aValue( rValue )
538*cdf0e10cSrcweir     {
539*cdf0e10cSrcweir         g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
540*cdf0e10cSrcweir     }
541*cdf0e10cSrcweir     virtual ~ConstantTypeDescriptionImpl();
542*cdf0e10cSrcweir 
543*cdf0e10cSrcweir     // XTypeDescription
544*cdf0e10cSrcweir     virtual TypeClass SAL_CALL
545*cdf0e10cSrcweir     getTypeClass()
546*cdf0e10cSrcweir         throw( ::com::sun::star::uno::RuntimeException );
547*cdf0e10cSrcweir     virtual OUString SAL_CALL
548*cdf0e10cSrcweir     getName()
549*cdf0e10cSrcweir         throw( ::com::sun::star::uno::RuntimeException );
550*cdf0e10cSrcweir 
551*cdf0e10cSrcweir     // XConstantTypeDescription
552*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any SAL_CALL
553*cdf0e10cSrcweir     getConstantValue()
554*cdf0e10cSrcweir         throw ( ::com::sun::star::uno::RuntimeException );
555*cdf0e10cSrcweir };
556*cdf0e10cSrcweir 
557*cdf0e10cSrcweir //==================================================================================================
558*cdf0e10cSrcweir class ConstantsTypeDescriptionImpl:
559*cdf0e10cSrcweir     public WeakImplHelper2< XConstantsTypeDescription, XPublished >
560*cdf0e10cSrcweir {
561*cdf0e10cSrcweir     OUString             _aName;
562*cdf0e10cSrcweir     Sequence< sal_Int8 > _aBytes;
563*cdf0e10cSrcweir     Sequence< com::sun::star::uno::Reference< XConstantTypeDescription > > *
564*cdf0e10cSrcweir     _pMembers;
565*cdf0e10cSrcweir 
566*cdf0e10cSrcweir     bool _published;
567*cdf0e10cSrcweir 
568*cdf0e10cSrcweir public:
569*cdf0e10cSrcweir     ConstantsTypeDescriptionImpl( const OUString & rName,
570*cdf0e10cSrcweir                                   const Sequence< sal_Int8 > & rBytes,
571*cdf0e10cSrcweir                                   bool published )
572*cdf0e10cSrcweir     : _aName( rName ), _aBytes( rBytes), _pMembers( 0 ), _published( published )
573*cdf0e10cSrcweir     {
574*cdf0e10cSrcweir         g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
575*cdf0e10cSrcweir     }
576*cdf0e10cSrcweir     virtual ~ConstantsTypeDescriptionImpl();
577*cdf0e10cSrcweir 
578*cdf0e10cSrcweir     // XTypeDescription
579*cdf0e10cSrcweir     virtual TypeClass SAL_CALL
580*cdf0e10cSrcweir     getTypeClass()
581*cdf0e10cSrcweir         throw( ::com::sun::star::uno::RuntimeException );
582*cdf0e10cSrcweir     virtual OUString SAL_CALL
583*cdf0e10cSrcweir     getName()
584*cdf0e10cSrcweir         throw( ::com::sun::star::uno::RuntimeException );
585*cdf0e10cSrcweir 
586*cdf0e10cSrcweir     // XConstantsTypeDescription
587*cdf0e10cSrcweir     virtual
588*cdf0e10cSrcweir     Sequence< com::sun::star::uno::Reference< XConstantTypeDescription > >
589*cdf0e10cSrcweir     SAL_CALL getConstants() throw ( RuntimeException );
590*cdf0e10cSrcweir 
591*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL isPublished()
592*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException)
593*cdf0e10cSrcweir     { return _published; }
594*cdf0e10cSrcweir };
595*cdf0e10cSrcweir 
596*cdf0e10cSrcweir //==================================================================================================
597*cdf0e10cSrcweir class SingletonTypeDescriptionImpl:
598*cdf0e10cSrcweir     public WeakImplHelper2< XSingletonTypeDescription2, XPublished >
599*cdf0e10cSrcweir {
600*cdf0e10cSrcweir     OUString _aName;
601*cdf0e10cSrcweir     OUString _aBaseName;
602*cdf0e10cSrcweir     com::sun::star::uno::Reference< XHierarchicalNameAccess > _xTDMgr;
603*cdf0e10cSrcweir     com::sun::star::uno::Reference< XTypeDescription > _xInterfaceTD;
604*cdf0e10cSrcweir     com::sun::star::uno::Reference< XServiceTypeDescription > _xServiceTD;
605*cdf0e10cSrcweir 
606*cdf0e10cSrcweir     bool _published;
607*cdf0e10cSrcweir 
608*cdf0e10cSrcweir     void init();
609*cdf0e10cSrcweir 
610*cdf0e10cSrcweir public:
611*cdf0e10cSrcweir     SingletonTypeDescriptionImpl(
612*cdf0e10cSrcweir         const com::sun::star::uno::Reference< XHierarchicalNameAccess > &
613*cdf0e10cSrcweir         xTDMgr,
614*cdf0e10cSrcweir         const OUString & rName, const OUString & rBaseName, bool published )
615*cdf0e10cSrcweir     : _aName( rName ), _aBaseName( rBaseName), _xTDMgr( xTDMgr ),
616*cdf0e10cSrcweir       _published( published )
617*cdf0e10cSrcweir     {
618*cdf0e10cSrcweir         g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
619*cdf0e10cSrcweir     }
620*cdf0e10cSrcweir     virtual ~SingletonTypeDescriptionImpl();
621*cdf0e10cSrcweir 
622*cdf0e10cSrcweir     // XTypeDescription
623*cdf0e10cSrcweir     virtual TypeClass SAL_CALL
624*cdf0e10cSrcweir     getTypeClass()
625*cdf0e10cSrcweir         throw( ::com::sun::star::uno::RuntimeException );
626*cdf0e10cSrcweir     virtual OUString SAL_CALL
627*cdf0e10cSrcweir     getName()
628*cdf0e10cSrcweir         throw( ::com::sun::star::uno::RuntimeException );
629*cdf0e10cSrcweir 
630*cdf0e10cSrcweir     // XSingletonTypeDescription
631*cdf0e10cSrcweir     virtual com::sun::star::uno::Reference< XServiceTypeDescription > SAL_CALL
632*cdf0e10cSrcweir     getService() throw ( ::com::sun::star::uno::RuntimeException );
633*cdf0e10cSrcweir 
634*cdf0e10cSrcweir     // XSingletonTypeDescription2
635*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL isInterfaceBased()
636*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException);
637*cdf0e10cSrcweir     virtual com::sun::star::uno::Reference< XTypeDescription > SAL_CALL
638*cdf0e10cSrcweir     getInterface() throw (::com::sun::star::uno::RuntimeException);
639*cdf0e10cSrcweir 
640*cdf0e10cSrcweir     virtual sal_Bool SAL_CALL isPublished()
641*cdf0e10cSrcweir         throw (::com::sun::star::uno::RuntimeException)
642*cdf0e10cSrcweir     { return _published; }
643*cdf0e10cSrcweir };
644*cdf0e10cSrcweir 
645*cdf0e10cSrcweir }
646*cdf0e10cSrcweir 
647*cdf0e10cSrcweir #endif /* _STOC_RDBTDP_BASE_HXX */
648