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