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