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