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