cURL: follow redirects
[LibreOffice.git] / cppuhelper / source / tdmgr.cxx
blob789b3f1e77265bd2c6fa4e1557bc0add4e9f74ce
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include <sal/config.h>
23 #include <vector>
25 #include <sal/alloca.h>
27 #include <osl/diagnose.h>
28 #include <rtl/alloc.h>
29 #include <rtl/ustring.hxx>
31 #include <uno/lbnames.h>
32 #include <uno/mapping.hxx>
34 #include <cppuhelper/bootstrap.hxx>
35 #include <cppuhelper/implbase1.hxx>
36 #include <typelib/typedescription.h>
38 #include <com/sun/star/lang/XComponent.hpp>
39 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
40 #include <com/sun/star/reflection/XTypeDescription.hpp>
41 #include <com/sun/star/reflection/XEnumTypeDescription.hpp>
42 #include <com/sun/star/reflection/XIndirectTypeDescription.hpp>
43 #include <com/sun/star/reflection/XInterfaceMemberTypeDescription.hpp>
44 #include <com/sun/star/reflection/XInterfaceAttributeTypeDescription2.hpp>
45 #include <com/sun/star/reflection/XMethodParameter.hpp>
46 #include <com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp>
47 #include <com/sun/star/reflection/XInterfaceTypeDescription2.hpp>
48 #include <com/sun/star/reflection/XCompoundTypeDescription.hpp>
49 #include <com/sun/star/reflection/XStructTypeDescription.hpp>
50 #include <com/sun/star/uno/RuntimeException.hpp>
52 #include <memory>
54 using namespace ::com::sun::star;
55 using namespace ::com::sun::star::uno;
56 using namespace ::com::sun::star::reflection;
58 using rtl::OUString;
60 namespace cppu
63 static typelib_TypeDescription * createCTD(
64 Reference< container::XHierarchicalNameAccess > const & access,
65 const Reference< XTypeDescription > & xType );
68 inline static typelib_TypeDescription * createCTD(
69 const Reference< XCompoundTypeDescription > & xType )
71 typelib_TypeDescription * pRet = nullptr;
72 if (xType.is())
74 typelib_TypeDescription * pBaseType = createCTD(
75 Reference< XCompoundTypeDescription >::query( xType->getBaseType() ) );
76 if (pBaseType)
77 typelib_typedescription_register( &pBaseType );
79 // construct member init array
80 const Sequence<Reference< XTypeDescription > > & rMemberTypes = xType->getMemberTypes();
81 const Sequence< OUString > & rMemberNames = xType->getMemberNames();
83 const Reference< XTypeDescription > * pMemberTypes = rMemberTypes.getConstArray();
84 const OUString * pMemberNames = rMemberNames.getConstArray();
86 sal_Int32 nMembers = rMemberTypes.getLength();
87 OSL_ENSURE( nMembers == rMemberNames.getLength(), "### lens differ!" );
89 OUString aTypeName( xType->getName() );
91 typelib_CompoundMember_Init * pMemberInits = static_cast<typelib_CompoundMember_Init *>(alloca(
92 sizeof(typelib_CompoundMember_Init) * nMembers ));
94 sal_Int32 nPos;
95 for ( nPos = nMembers; nPos--; )
97 typelib_CompoundMember_Init & rInit = pMemberInits[nPos];
98 rInit.eTypeClass = (typelib_TypeClass)pMemberTypes[nPos]->getTypeClass();
100 OUString aMemberTypeName( pMemberTypes[nPos]->getName() );
101 rtl_uString_acquire( rInit.pTypeName = aMemberTypeName.pData );
103 // string is held by rMemberNames
104 rInit.pMemberName = pMemberNames[nPos].pData;
107 typelib_typedescription_new(
108 &pRet,
109 (typelib_TypeClass)xType->getTypeClass(),
110 aTypeName.pData,
111 (pBaseType ? pBaseType->pWeakRef : nullptr),
112 nMembers, pMemberInits );
114 // cleanup
115 for ( nPos = nMembers; nPos--; )
117 rtl_uString_release( pMemberInits[nPos].pTypeName );
119 if (pBaseType)
120 typelib_typedescription_release( pBaseType );
122 return pRet;
125 inline static typelib_TypeDescription * createCTD(
126 Reference< container::XHierarchicalNameAccess > const & access,
127 const Reference< XStructTypeDescription > & xType )
129 typelib_TypeDescription * pRet = nullptr;
130 if (xType.is() && xType->getTypeParameters().getLength() == 0)
132 typelib_TypeDescription * pBaseType = createCTD(
133 access, xType->getBaseType() );
134 if (pBaseType)
135 typelib_typedescription_register( &pBaseType );
137 // construct member init array
138 const Sequence<Reference< XTypeDescription > > & rMemberTypes = xType->getMemberTypes();
139 const Sequence< OUString > & rMemberNames = xType->getMemberNames();
141 const Reference< XTypeDescription > * pMemberTypes = rMemberTypes.getConstArray();
142 const OUString * pMemberNames = rMemberNames.getConstArray();
144 sal_Int32 nMembers = rMemberTypes.getLength();
145 OSL_ENSURE( nMembers == rMemberNames.getLength(), "### lens differ!" );
147 OUString aTypeName( xType->getName() );
149 typelib_StructMember_Init * pMemberInits = static_cast<typelib_StructMember_Init *>(alloca(
150 sizeof(typelib_StructMember_Init) * nMembers ));
152 Sequence< Reference< XTypeDescription > > templateMemberTypes;
153 sal_Int32 i = aTypeName.indexOf('<');
154 if (i >= 0) {
155 Reference< XStructTypeDescription > templateDesc(
156 access->getByHierarchicalName(aTypeName.copy(0, i)),
157 UNO_QUERY_THROW);
158 OSL_ASSERT(
159 templateDesc->getTypeParameters().getLength()
160 == xType->getTypeArguments().getLength());
161 templateMemberTypes = templateDesc->getMemberTypes();
162 OSL_ASSERT(templateMemberTypes.getLength() == nMembers);
165 sal_Int32 nPos;
166 for ( nPos = nMembers; nPos--; )
168 typelib_StructMember_Init & rInit = pMemberInits[nPos];
169 rInit.aBase.eTypeClass
170 = (typelib_TypeClass)pMemberTypes[nPos]->getTypeClass();
172 OUString aMemberTypeName( pMemberTypes[nPos]->getName() );
173 rtl_uString_acquire(
174 rInit.aBase.pTypeName = aMemberTypeName.pData );
176 // string is held by rMemberNames
177 rInit.aBase.pMemberName = pMemberNames[nPos].pData;
179 rInit.bParameterizedType = templateMemberTypes.getLength() != 0
180 && (templateMemberTypes[nPos]->getTypeClass()
181 == TypeClass_UNKNOWN);
184 typelib_typedescription_newStruct(
185 &pRet,
186 aTypeName.pData,
187 (pBaseType ? pBaseType->pWeakRef : nullptr),
188 nMembers, pMemberInits );
190 // cleanup
191 for ( nPos = nMembers; nPos--; )
193 rtl_uString_release( pMemberInits[nPos].aBase.pTypeName );
195 if (pBaseType)
196 typelib_typedescription_release( pBaseType );
198 return pRet;
201 inline static typelib_TypeDescription * createCTD(
202 const Reference< XInterfaceAttributeTypeDescription2 > & xAttribute )
204 typelib_TypeDescription * pRet = nullptr;
205 if (xAttribute.is())
207 OUString aMemberName( xAttribute->getName() );
208 Reference< XTypeDescription > xType( xAttribute->getType() );
209 OUString aMemberTypeName( xType->getName() );
210 std::vector< rtl_uString * > getExc;
211 Sequence< Reference< XCompoundTypeDescription > > getExcs(
212 xAttribute->getGetExceptions() );
213 for (sal_Int32 i = 0; i != getExcs.getLength(); ++i)
215 OSL_ASSERT( getExcs[i].is() );
216 getExc.push_back( getExcs[i]->getName().pData );
218 std::vector< rtl_uString * > setExc;
219 Sequence< Reference< XCompoundTypeDescription > > setExcs(
220 xAttribute->getSetExceptions() );
221 for (sal_Int32 i = 0; i != setExcs.getLength(); ++i)
223 OSL_ASSERT( setExcs[i].is() );
224 setExc.push_back( setExcs[i]->getName().pData );
226 typelib_typedescription_newExtendedInterfaceAttribute(
227 reinterpret_cast<typelib_InterfaceAttributeTypeDescription **>(&pRet),
228 xAttribute->getPosition(),
229 aMemberName.pData, // name
230 (typelib_TypeClass)xType->getTypeClass(),
231 aMemberTypeName.pData, // type name
232 xAttribute->isReadOnly(),
233 getExc.size(), getExc.data(),
234 setExc.size(), setExc.data() );
236 return pRet;
239 static typelib_TypeDescription * createCTD(
240 const Reference< XInterfaceMethodTypeDescription > & xMethod )
242 typelib_TypeDescription * pRet = nullptr;
243 if (xMethod.is())
245 Reference< XTypeDescription > xReturnType( xMethod->getReturnType() );
247 // init all params
248 const Sequence<Reference< XMethodParameter > > & rParams = xMethod->getParameters();
249 const Reference< XMethodParameter > * pParams = rParams.getConstArray();
250 sal_Int32 nParams = rParams.getLength();
252 typelib_Parameter_Init * pParamInit = static_cast<typelib_Parameter_Init *>(alloca(
253 sizeof(typelib_Parameter_Init) * nParams ));
255 sal_Int32 nPos;
256 for ( nPos = nParams; nPos--; )
258 const Reference< XMethodParameter > & xParam = pParams[nPos];
259 const Reference< XTypeDescription > & xType = xParam->getType();
260 typelib_Parameter_Init & rInit = pParamInit[xParam->getPosition()];
262 rInit.eTypeClass = (typelib_TypeClass)xType->getTypeClass();
263 OUString aParamTypeName( xType->getName() );
264 rtl_uString_acquire( rInit.pTypeName = aParamTypeName.pData );
265 OUString aParamName( xParam->getName() );
266 rtl_uString_acquire( rInit.pParamName = aParamName.pData );
267 rInit.bIn = xParam->isIn();
268 rInit.bOut = xParam->isOut();
271 // init all exception strings
272 const Sequence<Reference< XTypeDescription > > & rExceptions = xMethod->getExceptions();
273 const Reference< XTypeDescription > * pExceptions = rExceptions.getConstArray();
274 sal_Int32 nExceptions = rExceptions.getLength();
275 rtl_uString ** ppExceptionNames = static_cast<rtl_uString **>(alloca(
276 sizeof(rtl_uString *) * nExceptions ));
278 for ( nPos = nExceptions; nPos--; )
280 OUString aExceptionTypeName( pExceptions[nPos]->getName() );
281 rtl_uString_acquire( ppExceptionNames[nPos] = aExceptionTypeName.pData );
284 OUString aTypeName( xMethod->getName() );
285 OUString aReturnTypeName( xReturnType->getName() );
287 typelib_typedescription_newInterfaceMethod(
288 reinterpret_cast<typelib_InterfaceMethodTypeDescription **>(&pRet),
289 xMethod->getPosition(),
290 xMethod->isOneway(),
291 aTypeName.pData,
292 (typelib_TypeClass)xReturnType->getTypeClass(),
293 aReturnTypeName.pData,
294 nParams, pParamInit,
295 nExceptions, ppExceptionNames );
297 for ( nPos = nParams; nPos--; )
299 rtl_uString_release( pParamInit[nPos].pTypeName );
300 rtl_uString_release( pParamInit[nPos].pParamName );
302 for ( nPos = nExceptions; nPos--; )
304 rtl_uString_release( ppExceptionNames[nPos] );
307 return pRet;
310 inline static typelib_TypeDescription * createCTD(
311 Reference< container::XHierarchicalNameAccess > const & access,
312 const Reference< XInterfaceTypeDescription2 > & xType )
314 typelib_TypeDescription * pRet = nullptr;
315 if (xType.is())
317 Sequence< Reference< XTypeDescription > > aBases(xType->getBaseTypes());
318 sal_Int32 nBases = aBases.getLength();
319 // Exploit the fact that a typelib_TypeDescription for an interface type
320 // is also the typelib_TypeDescriptionReference for that type:
321 std::unique_ptr< typelib_TypeDescription * []> aBaseTypes(
322 new typelib_TypeDescription *[nBases]);
323 for (sal_Int32 i = 0; i < nBases; ++i) {
324 typelib_TypeDescription * p = createCTD(access, aBases[i]);
325 OSL_ASSERT(
326 !TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(p->eTypeClass));
327 typelib_typedescription_register(&p);
328 aBaseTypes[i] = p;
330 typelib_TypeDescriptionReference ** pBaseTypeRefs
331 = reinterpret_cast< typelib_TypeDescriptionReference ** >(
332 aBaseTypes.get());
334 // construct all member refs
335 const Sequence<Reference< XInterfaceMemberTypeDescription > > & rMembers = xType->getMembers();
336 sal_Int32 nMembers = rMembers.getLength();
338 typelib_TypeDescriptionReference ** ppMemberRefs = static_cast<typelib_TypeDescriptionReference **>(alloca(
339 sizeof(typelib_TypeDescriptionReference *) * nMembers ));
341 const Reference< XInterfaceMemberTypeDescription > * pMembers = rMembers.getConstArray();
343 OUString aTypeName( xType->getName() );
345 sal_Int32 nPos;
346 for ( nPos = nMembers; nPos--; )
348 OUString aMemberTypeName( pMembers[nPos]->getName() );
349 ppMemberRefs[nPos] = nullptr;
350 typelib_typedescriptionreference_new(
351 ppMemberRefs + nPos,
352 (typelib_TypeClass)pMembers[nPos]->getTypeClass(),
353 aMemberTypeName.pData );
356 typelib_typedescription_newMIInterface(
357 reinterpret_cast<typelib_InterfaceTypeDescription **>(&pRet),
358 aTypeName.pData,
359 0, 0, 0, 0, 0,
360 nBases, pBaseTypeRefs,
361 nMembers, ppMemberRefs );
363 // cleanup refs and base type
364 for (int i = 0; i < nBases; ++i) {
365 typelib_typedescription_release(aBaseTypes[i]);
368 for ( nPos = nMembers; nPos--; )
370 typelib_typedescriptionreference_release( ppMemberRefs[nPos] );
373 return pRet;
376 inline static typelib_TypeDescription * createCTD( const Reference< XEnumTypeDescription > & xType )
378 typelib_TypeDescription * pRet = nullptr;
379 if (xType.is())
381 OUString aTypeName( xType->getName() );
382 Sequence< OUString > aNames( xType->getEnumNames() );
383 OSL_ASSERT( sizeof(OUString) == sizeof(rtl_uString *) ); // !!!
384 Sequence< sal_Int32 > aValues( xType->getEnumValues() );
386 typelib_typedescription_newEnum(
387 &pRet, aTypeName.pData, xType->getDefaultEnumValue(),
388 aNames.getLength(),
389 const_cast<rtl_uString **>(reinterpret_cast<rtl_uString * const *>(aNames.getConstArray())),
390 const_cast< sal_Int32 * >( aValues.getConstArray() ) );
392 return pRet;
395 inline static typelib_TypeDescription * createCTD(
396 Reference< container::XHierarchicalNameAccess > const & access,
397 const Reference< XIndirectTypeDescription > & xType )
399 typelib_TypeDescription * pRet = nullptr;
400 if (xType.is())
402 typelib_TypeDescription * pRefType = createCTD(
403 access, xType->getReferencedType() );
404 typelib_typedescription_register( &pRefType );
406 OUString aTypeName( xType->getName() );
408 typelib_typedescription_new(
409 &pRet,
410 (typelib_TypeClass)xType->getTypeClass(),
411 aTypeName.pData,
412 pRefType->pWeakRef,
413 0, nullptr );
415 // cleanup
416 typelib_typedescription_release( pRefType );
418 return pRet;
422 static typelib_TypeDescription * createCTD(
423 Reference< container::XHierarchicalNameAccess > const & access,
424 const Reference< XTypeDescription > & xType )
426 typelib_TypeDescription * pRet = nullptr;
428 if (xType.is())
430 switch (xType->getTypeClass())
432 // built in types
433 case TypeClass_VOID:
435 OUString aTypeName("void");
436 typelib_typedescription_new( &pRet, typelib_TypeClass_VOID, aTypeName.pData, nullptr, 0, nullptr );
437 break;
439 case TypeClass_CHAR:
441 OUString aTypeName("char");
442 typelib_typedescription_new( &pRet, typelib_TypeClass_CHAR, aTypeName.pData, nullptr, 0, nullptr );
443 break;
445 case TypeClass_BOOLEAN:
447 OUString aTypeName("boolean");
448 typelib_typedescription_new( &pRet, typelib_TypeClass_BOOLEAN, aTypeName.pData, nullptr, 0, nullptr );
449 break;
451 case TypeClass_BYTE:
453 OUString aTypeName("byte");
454 typelib_typedescription_new( &pRet, typelib_TypeClass_BYTE, aTypeName.pData, nullptr, 0, nullptr );
455 break;
457 case TypeClass_SHORT:
459 OUString aTypeName("short");
460 typelib_typedescription_new( &pRet, typelib_TypeClass_SHORT, aTypeName.pData, nullptr, 0, nullptr );
461 break;
463 case TypeClass_UNSIGNED_SHORT:
465 OUString aTypeName("unsigned short");
466 typelib_typedescription_new( &pRet, typelib_TypeClass_UNSIGNED_SHORT, aTypeName.pData, nullptr, 0, nullptr );
467 break;
469 case TypeClass_LONG:
471 OUString aTypeName("long");
472 typelib_typedescription_new( &pRet, typelib_TypeClass_LONG, aTypeName.pData, nullptr, 0, nullptr );
473 break;
475 case TypeClass_UNSIGNED_LONG:
477 OUString aTypeName("unsigned long");
478 typelib_typedescription_new( &pRet, typelib_TypeClass_UNSIGNED_LONG, aTypeName.pData, nullptr, 0, nullptr );
479 break;
481 case TypeClass_HYPER:
483 OUString aTypeName("hyper");
484 typelib_typedescription_new( &pRet, typelib_TypeClass_HYPER, aTypeName.pData, nullptr, 0, nullptr );
485 break;
487 case TypeClass_UNSIGNED_HYPER:
489 OUString aTypeName("unsigned hyper");
490 typelib_typedescription_new( &pRet, typelib_TypeClass_UNSIGNED_HYPER, aTypeName.pData, nullptr, 0, nullptr );
491 break;
493 case TypeClass_FLOAT:
495 OUString aTypeName("float");
496 typelib_typedescription_new( &pRet, typelib_TypeClass_FLOAT, aTypeName.pData, nullptr, 0, nullptr );
497 break;
499 case TypeClass_DOUBLE:
501 OUString aTypeName("double");
502 typelib_typedescription_new( &pRet, typelib_TypeClass_DOUBLE, aTypeName.pData, nullptr, 0, nullptr );
503 break;
505 case TypeClass_STRING:
507 OUString aTypeName("string");
508 typelib_typedescription_new( &pRet, typelib_TypeClass_STRING, aTypeName.pData, nullptr, 0, nullptr );
509 break;
511 case TypeClass_TYPE:
513 OUString aTypeName("type");
514 typelib_typedescription_new( &pRet, typelib_TypeClass_TYPE, aTypeName.pData, nullptr, 0, nullptr );
515 break;
517 case TypeClass_ANY:
519 OUString aTypeName("any");
520 typelib_typedescription_new( &pRet, typelib_TypeClass_ANY, aTypeName.pData, nullptr, 0, nullptr );
521 break;
524 case TypeClass_EXCEPTION:
525 pRet = createCTD( Reference< XCompoundTypeDescription >::query( xType ) );
526 break;
527 case TypeClass_STRUCT:
528 pRet = createCTD(
529 access, Reference< XStructTypeDescription >::query( xType ) );
530 break;
531 case TypeClass_ENUM:
532 pRet = createCTD( Reference< XEnumTypeDescription >::query( xType ) );
533 break;
534 case TypeClass_TYPEDEF:
536 Reference< XIndirectTypeDescription > xTypedef( xType, UNO_QUERY );
537 if (xTypedef.is())
538 pRet = createCTD( access, xTypedef->getReferencedType() );
539 break;
541 case TypeClass_SEQUENCE:
542 pRet = createCTD(
543 access, Reference< XIndirectTypeDescription >::query( xType ) );
544 break;
545 case TypeClass_INTERFACE:
546 pRet = createCTD(
547 access,
548 Reference< XInterfaceTypeDescription2 >::query( xType ) );
549 break;
550 case TypeClass_INTERFACE_METHOD:
551 pRet = createCTD( Reference< XInterfaceMethodTypeDescription >::query( xType ) );
552 break;
553 case TypeClass_INTERFACE_ATTRIBUTE:
554 pRet = createCTD( Reference< XInterfaceAttributeTypeDescription2 >::query( xType ) );
555 break;
556 default:
557 break;
561 return pRet;
565 extern "C"
567 static void SAL_CALL typelib_callback(
568 void * pContext, typelib_TypeDescription ** ppRet, rtl_uString * pTypeName )
570 OSL_ENSURE( pContext && ppRet && pTypeName, "### null ptr!" );
571 if (ppRet)
573 if (*ppRet)
575 ::typelib_typedescription_release( *ppRet );
576 *ppRet = nullptr;
578 if (pContext && pTypeName)
580 Reference< container::XHierarchicalNameAccess > access(
581 static_cast< container::XHierarchicalNameAccess * >(
582 pContext));
585 OUString const & rTypeName = OUString::unacquired( &pTypeName );
586 Reference< XTypeDescription > xTD;
587 if (access->getByHierarchicalName(rTypeName ) >>= xTD)
589 *ppRet = createCTD( access, xTD );
592 catch (container::NoSuchElementException & exc)
594 (void) exc; // avoid warning about unused variable
595 OSL_TRACE(
596 "typelibrary type not available: %s",
597 OUStringToOString(
598 exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
600 catch (Exception & exc)
602 (void) exc; // avoid warning about unused variable
603 OSL_TRACE(
604 "%s",
605 OUStringToOString(
606 exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
614 class EventListenerImpl
615 : public WeakImplHelper1< lang::XEventListener >
617 Reference< container::XHierarchicalNameAccess > m_xTDMgr;
619 public:
620 explicit EventListenerImpl(
621 Reference< container::XHierarchicalNameAccess > const & xTDMgr )
622 : m_xTDMgr( xTDMgr )
625 // XEventListener
626 virtual void SAL_CALL disposing( lang::EventObject const & rEvt )
627 throw (RuntimeException, std::exception) override;
630 void EventListenerImpl::disposing( lang::EventObject const & rEvt )
631 throw (RuntimeException, std::exception)
633 if (rEvt.Source != m_xTDMgr) {
634 OSL_ASSERT(false);
636 // deregister of c typelib callback
637 ::typelib_typedescription_revokeCallback( m_xTDMgr.get(), typelib_callback );
641 sal_Bool SAL_CALL installTypeDescriptionManager(
642 Reference< container::XHierarchicalNameAccess > const & xTDMgr_c )
644 uno::Environment curr_env(Environment::getCurrent());
645 uno::Environment target_env(CPPU_CURRENT_LANGUAGE_BINDING_NAME);
647 uno::Mapping curr2target(curr_env, target_env);
650 Reference<container::XHierarchicalNameAccess> xTDMgr(
651 static_cast<container::XHierarchicalNameAccess *>(
652 curr2target.mapInterface(xTDMgr_c.get(), cppu::UnoType<decltype(xTDMgr_c)>::get())),
653 SAL_NO_ACQUIRE);
655 Reference< lang::XComponent > xComp( xTDMgr, UNO_QUERY );
656 if (xComp.is())
658 xComp->addEventListener( new EventListenerImpl( xTDMgr ) );
659 // register c typelib callback
660 ::typelib_typedescription_registerCallback( xTDMgr.get(), typelib_callback );
661 return true;
663 return false;
666 } // end namespace cppu
668 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */