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