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 : #include <osl/diagnose.h>
21 : #include <osl/mutex.hxx>
22 : #include <uno/dispatcher.h>
23 : #include <uno/mapping.hxx>
24 : #include <cppuhelper/factory.hxx>
25 : #include <cppuhelper/compbase4.hxx>
26 : #include <cppuhelper/implbase2.hxx>
27 : #include <cppuhelper/typeprovider.hxx>
28 :
29 : #include <cppuhelper/weakref.hxx>
30 :
31 : #include <com/sun/star/lang/XServiceInfo.hpp>
32 : #include <com/sun/star/lang/XComponent.hpp>
33 : #include <com/sun/star/lang/XTypeProvider.hpp>
34 : #include <com/sun/star/lang/XInitialization.hpp>
35 : #include <com/sun/star/registry/XSimpleRegistry.hpp>
36 : #include <com/sun/star/registry/XRegistryKey.hpp>
37 : #include <com/sun/star/beans/XPropertySet.hpp>
38 : #include <com/sun/star/reflection/XTypeDescriptionEnumerationAccess.hpp>
39 : #include "com/sun/star/uno/RuntimeException.hpp"
40 :
41 : #include "registry/reader.hxx"
42 : #include "registry/version.h"
43 : #include "base.hxx"
44 : #include "rdbtdp_tdenumeration.hxx"
45 : #include "structtypedescription.hxx"
46 :
47 : #define SERVICENAME "com.sun.star.reflection.TypeDescriptionProvider"
48 : #define IMPLNAME "com.sun.star.comp.stoc.RegistryTypeDescriptionProvider"
49 :
50 : using namespace com::sun::star;
51 : using namespace com::sun::star::beans;
52 : using namespace com::sun::star::registry;
53 :
54 : extern rtl_StandardModuleCount g_moduleCount;
55 :
56 : namespace stoc_bootstrap
57 : {
58 122 : uno::Sequence< OUString > rdbtdp_getSupportedServiceNames()
59 : {
60 122 : Sequence< OUString > seqNames(1);
61 122 : seqNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM(SERVICENAME));
62 122 : return seqNames;
63 : }
64 :
65 1596 : OUString rdbtdp_getImplementationName()
66 : {
67 1596 : return OUString(RTL_CONSTASCII_USTRINGPARAM(IMPLNAME));
68 : }
69 : }
70 :
71 : namespace stoc_rdbtdp
72 : {
73 218 : struct MutexHolder
74 : {
75 : Mutex _aComponentMutex;
76 : };
77 : //==================================================================================================
78 : class ProviderImpl
79 : : public MutexHolder
80 : , public WeakComponentImplHelper4< XServiceInfo,
81 : XHierarchicalNameAccess,
82 : XTypeDescriptionEnumerationAccess,
83 : XInitialization >
84 : {
85 : // XHierarchicalNameAccess + XTypeDescriptionEnumerationAccess wrapper
86 : // first asking the tdmgr instance, then looking up locally
87 168 : class TypeDescriptionManagerWrapper
88 : : public ::cppu::WeakImplHelper2<
89 : container::XHierarchicalNameAccess,
90 : reflection::XTypeDescriptionEnumerationAccess>
91 : {
92 : com::sun::star::uno::Reference<container::XHierarchicalNameAccess>
93 : m_xTDMgr;
94 : com::sun::star::uno::Reference<container::XHierarchicalNameAccess>
95 : m_xThisProvider;
96 : public:
97 108 : TypeDescriptionManagerWrapper( ProviderImpl * pProvider )
98 108 : : m_xTDMgr( pProvider->_xContext->getValueByName(
99 : OUString( RTL_CONSTASCII_USTRINGPARAM(
100 : "/singletons/com.sun.star.reflection."
101 108 : "theTypeDescriptionManager") ) ),
102 : UNO_QUERY_THROW ),
103 216 : m_xThisProvider( pProvider )
104 108 : {}
105 : // XHierarchicalNameAccess
106 : virtual Any SAL_CALL getByHierarchicalName( OUString const & name )
107 : throw (container::NoSuchElementException, RuntimeException);
108 : virtual sal_Bool SAL_CALL hasByHierarchicalName( OUString const & name )
109 : throw (RuntimeException);
110 :
111 : // XTypeDescriptionEnumerationAccess
112 : virtual uno::Reference<
113 : reflection::XTypeDescriptionEnumeration > SAL_CALL
114 : createTypeDescriptionEnumeration(
115 : const ::rtl::OUString& moduleName,
116 : const uno::Sequence< uno::TypeClass >& types,
117 : reflection::TypeDescriptionSearchDepth depth )
118 : throw ( reflection::NoSuchTypeNameException,
119 : reflection::InvalidTypeNameException,
120 : uno::RuntimeException );
121 : };
122 : friend class TypeDescriptionManagerWrapper;
123 :
124 : com::sun::star::uno::Reference< XComponentContext > _xContext;
125 : com::sun::star::uno::WeakReference<XHierarchicalNameAccess> _xTDMgr;
126 : com::sun::star::uno::Reference< XHierarchicalNameAccess > getTDMgr() SAL_THROW(());
127 :
128 : RegistryKeyList _aBaseKeys;
129 :
130 : protected:
131 : virtual void SAL_CALL disposing();
132 :
133 : public:
134 : ProviderImpl( const com::sun::star::uno::Reference< XComponentContext > & xContext );
135 : virtual ~ProviderImpl();
136 :
137 : // XInitialization
138 : virtual void SAL_CALL initialize( const Sequence< Any > & args ) throw (Exception, RuntimeException);
139 :
140 : // XServiceInfo
141 : virtual OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException);
142 : virtual sal_Bool SAL_CALL supportsService( const OUString & rServiceName ) throw(::com::sun::star::uno::RuntimeException);
143 : virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException);
144 :
145 : // XHierarchicalNameAccess
146 : Any getByHierarchicalNameImpl( const OUString & rName );
147 :
148 : virtual Any SAL_CALL getByHierarchicalName( const OUString & rName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
149 : virtual sal_Bool SAL_CALL hasByHierarchicalName( const OUString & rName ) throw(::com::sun::star::uno::RuntimeException);
150 :
151 : // XTypeDescriptionEnumerationAccess
152 : virtual ::com::sun::star::uno::Reference<
153 : ::com::sun::star::reflection::XTypeDescriptionEnumeration > SAL_CALL
154 : createTypeDescriptionEnumeration(
155 : const ::rtl::OUString& moduleName,
156 : const ::com::sun::star::uno::Sequence<
157 : ::com::sun::star::uno::TypeClass >& types,
158 : ::com::sun::star::reflection::TypeDescriptionSearchDepth depth )
159 : throw ( ::com::sun::star::reflection::NoSuchTypeNameException,
160 : ::com::sun::star::reflection::InvalidTypeNameException,
161 : ::com::sun::star::uno::RuntimeException );
162 : };
163 : //__________________________________________________________________________________________________
164 122 : ProviderImpl::ProviderImpl( const com::sun::star::uno::Reference< XComponentContext > & xContext )
165 : : WeakComponentImplHelper4<
166 : XServiceInfo, XHierarchicalNameAccess,
167 : XTypeDescriptionEnumerationAccess, XInitialization >( _aComponentMutex )
168 122 : , _xContext( xContext )
169 : {
170 122 : g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
171 122 : }
172 : //__________________________________________________________________________________________________
173 288 : ProviderImpl::~ProviderImpl()
174 : {
175 96 : g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
176 192 : }
177 :
178 : //______________________________________________________________________________
179 44284 : Any ProviderImpl::TypeDescriptionManagerWrapper::getByHierarchicalName(
180 : OUString const & name ) throw (container::NoSuchElementException,
181 : RuntimeException)
182 : {
183 : try
184 : {
185 : // first try tdmgr:
186 44284 : return m_xTDMgr->getByHierarchicalName( name );
187 : }
188 0 : catch (container::NoSuchElementException &)
189 : {
190 : // then lookup locally:
191 0 : return m_xThisProvider->getByHierarchicalName( name );
192 : }
193 : }
194 :
195 : //______________________________________________________________________________
196 0 : sal_Bool ProviderImpl::TypeDescriptionManagerWrapper::hasByHierarchicalName(
197 : OUString const & name ) throw (RuntimeException)
198 : {
199 0 : return m_xTDMgr->hasByHierarchicalName( name ) || m_xThisProvider->hasByHierarchicalName( name );
200 : }
201 :
202 : //______________________________________________________________________________
203 : uno::Reference< reflection::XTypeDescriptionEnumeration > SAL_CALL
204 0 : ProviderImpl::TypeDescriptionManagerWrapper::createTypeDescriptionEnumeration(
205 : const ::rtl::OUString& moduleName,
206 : const uno::Sequence< uno::TypeClass >& types,
207 : reflection::TypeDescriptionSearchDepth depth )
208 : throw ( reflection::NoSuchTypeNameException,
209 : reflection::InvalidTypeNameException,
210 : uno::RuntimeException )
211 : {
212 : try
213 : {
214 : // first try tdmgr:
215 : uno::Reference< reflection::XTypeDescriptionEnumerationAccess > xTDEA(
216 0 : m_xTDMgr, uno::UNO_QUERY_THROW );
217 : return
218 0 : xTDEA->createTypeDescriptionEnumeration( moduleName, types, depth );
219 : }
220 0 : catch (reflection::NoSuchTypeNameException &)
221 : {
222 : // then lookup locally:
223 : uno::Reference< reflection::XTypeDescriptionEnumerationAccess > xTDEA(
224 0 : m_xThisProvider, uno::UNO_QUERY_THROW );
225 : return
226 0 : xTDEA->createTypeDescriptionEnumeration( moduleName, types, depth );
227 : }
228 : }
229 :
230 : //__________________________________________________________________________________________________
231 17431 : com::sun::star::uno::Reference< XHierarchicalNameAccess > ProviderImpl::getTDMgr()
232 : SAL_THROW(())
233 : {
234 : // harden weak reference:
235 : com::sun::star::uno::Reference<container::XHierarchicalNameAccess> xTDMgr(
236 17431 : _xTDMgr );
237 17431 : if (! xTDMgr.is())
238 : {
239 108 : xTDMgr.set( new TypeDescriptionManagerWrapper(this) );
240 : {
241 108 : MutexGuard guard( _aComponentMutex );
242 108 : _xTDMgr = xTDMgr;
243 : }
244 : }
245 17431 : return xTDMgr;
246 : }
247 :
248 : //__________________________________________________________________________________________________
249 96 : void ProviderImpl::disposing()
250 : {
251 96 : _xContext.clear();
252 :
253 576 : for ( RegistryKeyList::const_iterator iPos( _aBaseKeys.begin() );
254 384 : iPos != _aBaseKeys.end(); ++iPos )
255 : {
256 96 : (*iPos)->closeKey();
257 : }
258 96 : _aBaseKeys.clear();
259 96 : }
260 :
261 : // XInitialization
262 : //__________________________________________________________________________________________________
263 122 : void ProviderImpl::initialize(
264 : const Sequence< Any > & args )
265 : throw (Exception, RuntimeException)
266 : {
267 : // registries to read from
268 122 : Any const * pRegistries = args.getConstArray();
269 244 : for ( sal_Int32 nPos = 0; nPos < args.getLength(); ++nPos )
270 : {
271 122 : com::sun::star::uno::Reference< XSimpleRegistry > xRegistry( pRegistries[ nPos ], UNO_QUERY );
272 122 : if (xRegistry.is() && xRegistry->isValid())
273 : {
274 244 : com::sun::star::uno::Reference< XRegistryKey > xKey( xRegistry->getRootKey()->openKey(
275 122 : OUString( RTL_CONSTASCII_USTRINGPARAM("/UCR") ) ) );
276 122 : if (xKey.is() && xKey->isValid())
277 : {
278 122 : _aBaseKeys.push_back( xKey );
279 122 : }
280 : }
281 122 : }
282 122 : }
283 :
284 : // XServiceInfo
285 : //__________________________________________________________________________________________________
286 0 : OUString ProviderImpl::getImplementationName()
287 : throw(::com::sun::star::uno::RuntimeException)
288 : {
289 0 : return stoc_bootstrap::rdbtdp_getImplementationName();
290 : }
291 : //__________________________________________________________________________________________________
292 0 : sal_Bool ProviderImpl::supportsService( const OUString & rServiceName )
293 : throw(::com::sun::star::uno::RuntimeException)
294 : {
295 0 : const Sequence< OUString > & rSNL = getSupportedServiceNames();
296 0 : const OUString * pArray = rSNL.getConstArray();
297 0 : for ( sal_Int32 nPos = rSNL.getLength(); nPos--; )
298 : {
299 0 : if (pArray[nPos] == rServiceName)
300 0 : return sal_True;
301 : }
302 0 : return sal_False;
303 : }
304 : //__________________________________________________________________________________________________
305 0 : Sequence< OUString > ProviderImpl::getSupportedServiceNames()
306 : throw(::com::sun::star::uno::RuntimeException)
307 : {
308 0 : return stoc_bootstrap::rdbtdp_getSupportedServiceNames();
309 : }
310 :
311 : // XHierarchicalNameAccess
312 : //__________________________________________________________________________________________________
313 17458 : Any ProviderImpl::getByHierarchicalNameImpl( const OUString & rName )
314 : {
315 17458 : Any aRet;
316 :
317 : // read from registry
318 17458 : OUString aKey( rName.replace( '.', '/' ) );
319 139694 : for ( RegistryKeyList::const_iterator iPos( _aBaseKeys.begin() );
320 104778 : !aRet.hasValue() && iPos != _aBaseKeys.end(); ++iPos )
321 : {
322 : try
323 : {
324 17458 : com::sun::star::uno::Reference< XRegistryKey > xBaseKey( *iPos );
325 17458 : com::sun::star::uno::Reference< XRegistryKey > xKey( xBaseKey->openKey( aKey ) );
326 17458 : if (xKey.is())
327 : {
328 : // closes key in it's dtor (which is
329 : // called even in case of exceptions).
330 17429 : RegistryKeyCloser aCloser( xKey );
331 :
332 17429 : if ( xKey->isValid() )
333 : {
334 17429 : if (xKey->getValueType() == RegistryValueType_BINARY)
335 : {
336 17429 : Sequence< sal_Int8 > aBytes( xKey->getBinaryValue() );
337 : com::sun::star::uno::Reference< XTypeDescription > xTD(
338 : createTypeDescription( aBytes,
339 : getTDMgr(),
340 17429 : true ) );
341 17429 : if ( xTD.is() )
342 17429 : aRet <<= xTD;
343 : }
344 17429 : }
345 : }
346 : else // might be a constant
347 : {
348 29 : sal_Int32 nIndex = aKey.lastIndexOf( '/' );
349 29 : if (nIndex > 0)
350 : {
351 : // open module
352 16 : com::sun::star::uno::Reference< XRegistryKey > xKey2( xBaseKey->openKey( aKey.copy( 0, nIndex ) ) );
353 16 : if (xKey2.is())
354 : {
355 : // closes key in it's dtor (which is
356 : // called even in case of exceptions).
357 14 : RegistryKeyCloser aCloser( xKey2 );
358 :
359 14 : if ( xKey2->isValid() )
360 : {
361 14 : if (xKey2->getValueType() == RegistryValueType_BINARY)
362 : {
363 14 : Sequence< sal_Int8 > aBytes( xKey2->getBinaryValue() );
364 : typereg::Reader aReader(
365 28 : aBytes.getConstArray(), aBytes.getLength(),
366 28 : false, TYPEREG_VERSION_1);
367 :
368 31 : if (aReader.getTypeClass() == RT_TYPE_MODULE ||
369 14 : aReader.getTypeClass() == RT_TYPE_CONSTANTS ||
370 3 : aReader.getTypeClass() == RT_TYPE_ENUM)
371 : {
372 14 : OUString aFieldName( aKey.copy( nIndex+1, aKey.getLength() - nIndex -1 ) );
373 14 : sal_Int16 nPos = aReader.getFieldCount();
374 90 : while (nPos--)
375 : {
376 152 : if (aFieldName.equals(
377 152 : aReader.getFieldName(nPos)))
378 14 : break;
379 : }
380 14 : if (nPos >= 0)
381 : aRet = getRTValue(
382 14 : aReader.getFieldValue(nPos));
383 14 : }
384 : }
385 14 : }
386 16 : }
387 : }
388 17458 : }
389 : }
390 0 : catch ( InvalidRegistryException const & )
391 : {
392 : OSL_FAIL( "ProviderImpl::getByHierarchicalName "
393 : "- Caught InvalidRegistryException!" );
394 :
395 : // openKey, closeKey, getValueType, getBinaryValue, isValid
396 :
397 : // Don't stop iteration in this case.
398 : }
399 0 : catch ( NoSuchElementException const & )
400 : {
401 : }
402 : }
403 17458 : return aRet;
404 : }
405 :
406 17458 : Any SAL_CALL ProviderImpl::getByHierarchicalName( const OUString & rName )
407 : throw(::com::sun::star::uno::RuntimeException, com::sun::star::container::NoSuchElementException)
408 : {
409 17458 : Any aRet( getByHierarchicalNameImpl( rName ) );
410 :
411 17458 : if ( !aRet.hasValue() )
412 : throw NoSuchElementException(
413 15 : rName, static_cast< cppu::OWeakObject * >( this ) );
414 :
415 17458 : return aRet;
416 : }
417 :
418 : //__________________________________________________________________________________________________
419 0 : sal_Bool ProviderImpl::hasByHierarchicalName( const OUString & rName )
420 : throw(::com::sun::star::uno::RuntimeException)
421 : {
422 0 : return getByHierarchicalNameImpl( rName ).hasValue();
423 : }
424 :
425 : // XTypeDescriptionEnumerationAccess
426 : //__________________________________________________________________________________________________
427 : // virtual
428 : com::sun::star::uno::Reference< XTypeDescriptionEnumeration > SAL_CALL
429 2 : ProviderImpl::createTypeDescriptionEnumeration(
430 : const OUString & moduleName,
431 : const Sequence< TypeClass > & types,
432 : TypeDescriptionSearchDepth depth )
433 : throw ( NoSuchTypeNameException,
434 : InvalidTypeNameException,
435 : RuntimeException )
436 : {
437 : return com::sun::star::uno::Reference< XTypeDescriptionEnumeration >(
438 : TypeDescriptionEnumerationImpl::createInstance( getTDMgr(),
439 : moduleName,
440 : types,
441 : depth,
442 2 : _aBaseKeys ).get() );
443 : }
444 :
445 : //__________________________________________________________________________________________________
446 : // global helper function
447 :
448 38303 : com::sun::star::uno::Reference< XTypeDescription > resolveTypedefs(
449 : com::sun::star::uno::Reference< XTypeDescription > const & type)
450 : {
451 38303 : com::sun::star::uno::Reference< XTypeDescription > resolved(type);
452 76606 : while (resolved->getTypeClass() == TypeClass_TYPEDEF) {
453 : resolved = com::sun::star::uno::Reference< XIndirectTypeDescription >(
454 0 : resolved, UNO_QUERY_THROW)->getReferencedType();
455 : }
456 38303 : return resolved;
457 : }
458 :
459 19085 : com::sun::star::uno::Reference< XTypeDescription > createTypeDescription(
460 : const Sequence< sal_Int8 > & rData,
461 : const com::sun::star::uno::Reference< XHierarchicalNameAccess > & xNameAccess,
462 : bool bReturnEmptyRefForUnknownType )
463 : {
464 : typereg::Reader aReader(
465 19085 : rData.getConstArray(), rData.getLength(), false, TYPEREG_VERSION_1);
466 :
467 19085 : OUString aName( aReader.getTypeName().replace( '/', '.' ) );
468 :
469 19085 : switch (aReader.getTypeClass())
470 : {
471 : case RT_TYPE_INTERFACE:
472 : {
473 13641 : sal_uInt16 n = aReader.getSuperTypeCount();
474 13641 : com::sun::star::uno::Sequence< rtl::OUString > aBaseTypeNames(n);
475 28433 : {for (sal_uInt16 i = 0; i < n; ++i) {
476 14792 : aBaseTypeNames[i] = aReader.getSuperTypeName(i).replace(
477 29584 : '/', '.');
478 : }}
479 13641 : sal_uInt16 n2 = aReader.getReferenceCount();
480 : com::sun::star::uno::Sequence< rtl::OUString >
481 13641 : aOptionalBaseTypeNames(n2);
482 13646 : {for (sal_uInt16 i = 0; i < n2; ++i) {
483 : OSL_ASSERT(
484 : aReader.getReferenceSort(i) == RT_REF_SUPPORTS
485 : && aReader.getReferenceFlags(i) == RT_ACCESS_OPTIONAL);
486 5 : aOptionalBaseTypeNames[i] = aReader.getReferenceTypeName(i);
487 : }}
488 : return com::sun::star::uno::Reference< XTypeDescription >(
489 : new InterfaceTypeDescriptionImpl( xNameAccess,
490 : aName,
491 : aBaseTypeNames,
492 : aOptionalBaseTypeNames,
493 : rData,
494 13641 : aReader.isPublished() ) );
495 : }
496 :
497 : case RT_TYPE_MODULE:
498 : {
499 : com::sun::star::uno::Reference<
500 : XTypeDescriptionEnumerationAccess > xTDEA(
501 0 : xNameAccess, UNO_QUERY );
502 :
503 : OSL_ENSURE( xTDEA.is(),
504 : "No XTypeDescriptionEnumerationAccess!" );
505 :
506 : return com::sun::star::uno::Reference< XTypeDescription >(
507 0 : new ModuleTypeDescriptionImpl( xTDEA, aName ) );
508 : }
509 :
510 : case RT_TYPE_STRUCT:
511 : {
512 2268 : rtl::OUString superTypeName;
513 2268 : if (aReader.getSuperTypeCount() == 1) {
514 : superTypeName = aReader.getSuperTypeName(0).replace(
515 324 : '/', '.');
516 : }
517 : return com::sun::star::uno::Reference< XTypeDescription >(
518 : new stoc::registry_tdprovider::StructTypeDescription(
519 : xNameAccess, aName, superTypeName, rData,
520 2268 : aReader.isPublished()));
521 : }
522 :
523 : case RT_TYPE_ENUM:
524 : return com::sun::star::uno::Reference< XTypeDescription >(
525 : new EnumTypeDescriptionImpl( xNameAccess,
526 : aName,
527 : getRTValueAsInt32(
528 796 : aReader.getFieldValue( 0 ) ),
529 398 : rData, aReader.isPublished() ) );
530 :
531 : case RT_TYPE_EXCEPTION:
532 : {
533 998 : rtl::OUString superTypeName;
534 998 : if (aReader.getSuperTypeCount() == 1) {
535 : superTypeName = aReader.getSuperTypeName(0).replace(
536 923 : '/', '.');
537 : }
538 : return com::sun::star::uno::Reference< XTypeDescription >(
539 : new CompoundTypeDescriptionImpl(
540 : xNameAccess, TypeClass_EXCEPTION, aName, superTypeName,
541 998 : rData, aReader.isPublished()));
542 : }
543 :
544 : case RT_TYPE_TYPEDEF:
545 : return com::sun::star::uno::Reference< XTypeDescription >(
546 : new TypedefTypeDescriptionImpl( xNameAccess,
547 : aName,
548 : aReader.getSuperTypeName(0)
549 : .replace( '/', '.' ),
550 120 : aReader.isPublished() ) );
551 : case RT_TYPE_SERVICE:
552 : return com::sun::star::uno::Reference< XTypeDescription >(
553 : new ServiceTypeDescriptionImpl(
554 0 : xNameAccess, aName, rData, aReader.isPublished() ) );
555 :
556 : case RT_TYPE_CONSTANTS:
557 : return com::sun::star::uno::Reference< XTypeDescription >(
558 : new ConstantsTypeDescriptionImpl(
559 1660 : aName, rData, aReader.isPublished() ) );
560 :
561 : case RT_TYPE_SINGLETON:
562 : return com::sun::star::uno::Reference< XTypeDescription >(
563 : new SingletonTypeDescriptionImpl( xNameAccess,
564 : aName,
565 : aReader.getSuperTypeName(0)
566 : .replace( '/', '.' ),
567 0 : aReader.isPublished() ) );
568 : case RT_TYPE_INVALID:
569 : case RT_TYPE_OBJECT: // deprecated and not used
570 : case RT_TYPE_UNION: // deprecated and not used
571 : OSL_FAIL( "createTypeDescription - Unsupported Type!" );
572 0 : break;
573 :
574 : default:
575 : OSL_FAIL( "createTypeDescription - Unknown Type!" );
576 0 : break;
577 : }
578 :
579 : // Unknown type.
580 :
581 0 : if ( bReturnEmptyRefForUnknownType )
582 0 : return com::sun::star::uno::Reference< XTypeDescription >();
583 :
584 : return com::sun::star::uno::Reference< XTypeDescription >(
585 0 : new TypeDescriptionImpl( TypeClass_UNKNOWN, aName ) );
586 : }
587 :
588 : }
589 :
590 : namespace stoc_bootstrap
591 : {
592 : //==================================================================================================
593 122 : com::sun::star::uno::Reference< XInterface > SAL_CALL ProviderImpl_create(
594 : com::sun::star::uno::Reference< XComponentContext > const & xContext )
595 : throw(::com::sun::star::uno::Exception)
596 : {
597 122 : return com::sun::star::uno::Reference< XInterface >( *new stoc_rdbtdp::ProviderImpl( xContext ) );
598 : }
599 : }
600 :
601 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|