LibreOffice Module cppuhelper (master)  1
tdmgr.cxx
Go to the documentation of this file.
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 
21 #include <sal/config.h>
22 #include <sal/log.hxx>
23 
24 #include <vector>
25 
26 #include <osl/diagnose.h>
27 #include <rtl/ustring.hxx>
28 
29 #include <uno/lbnames.h>
30 #include <uno/mapping.hxx>
31 
32 #include <cppuhelper/bootstrap.hxx>
33 #include <cppuhelper/implbase.hxx>
34 #include <typelib/typedescription.h>
35 
36 #include <com/sun/star/lang/XComponent.hpp>
37 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
38 #include <com/sun/star/reflection/XTypeDescription.hpp>
39 #include <com/sun/star/reflection/XEnumTypeDescription.hpp>
40 #include <com/sun/star/reflection/XIndirectTypeDescription.hpp>
41 #include <com/sun/star/reflection/XInterfaceMemberTypeDescription.hpp>
42 #include <com/sun/star/reflection/XInterfaceAttributeTypeDescription2.hpp>
43 #include <com/sun/star/reflection/XMethodParameter.hpp>
44 #include <com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp>
45 #include <com/sun/star/reflection/XInterfaceTypeDescription2.hpp>
46 #include <com/sun/star/reflection/XCompoundTypeDescription.hpp>
47 #include <com/sun/star/reflection/XStructTypeDescription.hpp>
48 
49 #include <memory>
50 
51 using namespace ::com::sun::star;
52 using namespace ::com::sun::star::uno;
53 using namespace ::com::sun::star::reflection;
54 
55 namespace cppu
56 {
57 
59  Reference< container::XHierarchicalNameAccess > const & access,
60  const Reference< XTypeDescription > & xType );
61 
62 
64  const Reference< XCompoundTypeDescription > & xType )
65 {
66  typelib_TypeDescription * pRet = nullptr;
67  if (xType.is())
68  {
69  typelib_TypeDescription * pBaseType = createCTD(
70  Reference< XCompoundTypeDescription >::query( xType->getBaseType() ) );
71  if (pBaseType)
73 
74  // construct member init array
75  const Sequence<Reference< XTypeDescription > > & rMemberTypes = xType->getMemberTypes();
76  const Sequence< OUString > & rMemberNames = xType->getMemberNames();
77 
78  const Reference< XTypeDescription > * pMemberTypes = rMemberTypes.getConstArray();
79  const OUString * pMemberNames = rMemberNames.getConstArray();
80 
81  sal_Int32 nMembers = rMemberTypes.getLength();
82  OSL_ENSURE( nMembers == rMemberNames.getLength(), "### lens differ!" );
83 
84  OUString aTypeName( xType->getName() );
85 
86  typelib_CompoundMember_Init * pMemberInits = static_cast<typelib_CompoundMember_Init *>(alloca(
87  sizeof(typelib_CompoundMember_Init) * nMembers ));
88 
89  sal_Int32 nPos;
90  for ( nPos = nMembers; nPos--; )
91  {
92  typelib_CompoundMember_Init & rInit = pMemberInits[nPos];
93  rInit.eTypeClass = static_cast<typelib_TypeClass>(pMemberTypes[nPos]->getTypeClass());
94 
95  OUString aMemberTypeName( pMemberTypes[nPos]->getName() );
96  rInit.pTypeName = aMemberTypeName.pData;
97  rtl_uString_acquire( rInit.pTypeName );
98 
99  // string is held by rMemberNames
100  rInit.pMemberName = pMemberNames[nPos].pData;
101  }
102 
104  &pRet,
105  static_cast<typelib_TypeClass>(xType->getTypeClass()),
106  aTypeName.pData,
107  (pBaseType ? pBaseType->pWeakRef : nullptr),
108  nMembers, pMemberInits );
109 
110  // cleanup
111  for ( nPos = nMembers; nPos--; )
112  {
113  rtl_uString_release( pMemberInits[nPos].pTypeName );
114  }
115  if (pBaseType)
116  typelib_typedescription_release( pBaseType );
117  }
118  return pRet;
119 }
120 
122  Reference< container::XHierarchicalNameAccess > const & access,
123  const Reference< XStructTypeDescription > & xType )
124 {
125  typelib_TypeDescription * pRet = nullptr;
126  if (xType.is() && !xType->getTypeParameters().hasElements())
127  {
128  typelib_TypeDescription * pBaseType = createCTD(
129  access, xType->getBaseType() );
130  if (pBaseType)
131  typelib_typedescription_register( &pBaseType );
132 
133  // construct member init array
134  const Sequence<Reference< XTypeDescription > > & rMemberTypes = xType->getMemberTypes();
135  const Sequence< OUString > & rMemberNames = xType->getMemberNames();
136 
137  const Reference< XTypeDescription > * pMemberTypes = rMemberTypes.getConstArray();
138  const OUString * pMemberNames = rMemberNames.getConstArray();
139 
140  sal_Int32 nMembers = rMemberTypes.getLength();
141  OSL_ENSURE( nMembers == rMemberNames.getLength(), "### lens differ!" );
142 
143  OUString aTypeName( xType->getName() );
144 
145  typelib_StructMember_Init * pMemberInits = static_cast<typelib_StructMember_Init *>(alloca(
146  sizeof(typelib_StructMember_Init) * nMembers ));
147 
148  Sequence< Reference< XTypeDescription > > templateMemberTypes;
149  sal_Int32 i = aTypeName.indexOf('<');
150  if (i >= 0) {
151  Reference< XStructTypeDescription > templateDesc(
152  access->getByHierarchicalName(aTypeName.copy(0, i)),
153  UNO_QUERY_THROW);
154  OSL_ASSERT(
155  templateDesc->getTypeParameters().getLength()
156  == xType->getTypeArguments().getLength());
157  templateMemberTypes = templateDesc->getMemberTypes();
158  OSL_ASSERT(templateMemberTypes.getLength() == nMembers);
159  }
160 
161  sal_Int32 nPos;
162  for ( nPos = nMembers; nPos--; )
163  {
164  typelib_StructMember_Init & rInit = pMemberInits[nPos];
165  rInit.aBase.eTypeClass
166  = static_cast<typelib_TypeClass>(pMemberTypes[nPos]->getTypeClass());
167 
168  OUString aMemberTypeName( pMemberTypes[nPos]->getName() );
169  rInit.aBase.pTypeName = aMemberTypeName.pData;
170  rtl_uString_acquire( rInit.aBase.pTypeName );
171 
172  // string is held by rMemberNames
173  rInit.aBase.pMemberName = pMemberNames[nPos].pData;
174 
175  rInit.bParameterizedType = templateMemberTypes.hasElements()
176  && (templateMemberTypes[nPos]->getTypeClass()
177  == TypeClass_UNKNOWN);
178  }
179 
181  &pRet,
182  aTypeName.pData,
183  (pBaseType ? pBaseType->pWeakRef : nullptr),
184  nMembers, pMemberInits );
185 
186  // cleanup
187  for ( nPos = nMembers; nPos--; )
188  {
189  rtl_uString_release( pMemberInits[nPos].aBase.pTypeName );
190  }
191  if (pBaseType)
192  typelib_typedescription_release( pBaseType );
193  }
194  return pRet;
195 }
196 
198  const Reference< XInterfaceAttributeTypeDescription2 > & xAttribute )
199 {
200  typelib_TypeDescription * pRet = nullptr;
201  if (xAttribute.is())
202  {
203  OUString aMemberName( xAttribute->getName() );
204  Reference< XTypeDescription > xType( xAttribute->getType() );
205  OUString aMemberTypeName( xType->getName() );
206  std::vector< rtl_uString * > getExc;
207  const Sequence< Reference< XCompoundTypeDescription > > getExcs(
208  xAttribute->getGetExceptions() );
209  for (const auto & ctd : getExcs)
210  {
211  OSL_ASSERT( ctd.is() );
212  getExc.push_back( ctd->getName().pData );
213  }
214  std::vector< rtl_uString * > setExc;
215  const Sequence< Reference< XCompoundTypeDescription > > setExcs(
216  xAttribute->getSetExceptions() );
217  for (const auto & ctd : setExcs)
218  {
219  OSL_ASSERT( ctd.is() );
220  setExc.push_back( ctd->getName().pData );
221  }
223  reinterpret_cast<typelib_InterfaceAttributeTypeDescription **>(&pRet),
224  xAttribute->getPosition(),
225  aMemberName.pData, // name
226  static_cast<typelib_TypeClass>(xType->getTypeClass()),
227  aMemberTypeName.pData, // type name
228  xAttribute->isReadOnly(),
229  getExc.size(), getExc.data(),
230  setExc.size(), setExc.data() );
231  }
232  return pRet;
233 }
234 
236  const Reference< XInterfaceMethodTypeDescription > & xMethod )
237 {
238  typelib_TypeDescription * pRet = nullptr;
239  if (xMethod.is())
240  {
241  Reference< XTypeDescription > xReturnType( xMethod->getReturnType() );
242 
243  // init all params
244  const Sequence<Reference< XMethodParameter > > & rParams = xMethod->getParameters();
245  const Reference< XMethodParameter > * pParams = rParams.getConstArray();
246  sal_Int32 nParams = rParams.getLength();
247 
248  typelib_Parameter_Init * pParamInit = static_cast<typelib_Parameter_Init *>(alloca(
249  sizeof(typelib_Parameter_Init) * nParams ));
250 
251  sal_Int32 nPos;
252  for ( nPos = nParams; nPos--; )
253  {
254  const Reference< XMethodParameter > & xParam = pParams[nPos];
255  const Reference< XTypeDescription > & xType = xParam->getType();
256  typelib_Parameter_Init & rInit = pParamInit[xParam->getPosition()];
257 
258  rInit.eTypeClass = static_cast<typelib_TypeClass>(xType->getTypeClass());
259  OUString aParamTypeName( xType->getName() );
260  rInit.pTypeName = aParamTypeName.pData;
261  rtl_uString_acquire( rInit.pTypeName );
262  OUString aParamName( xParam->getName() );
263  rInit.pParamName = aParamName.pData;
264  rtl_uString_acquire( rInit.pParamName );
265  rInit.bIn = xParam->isIn();
266  rInit.bOut = xParam->isOut();
267  }
268 
269  // init all exception strings
270  const Sequence<Reference< XTypeDescription > > & rExceptions = xMethod->getExceptions();
271  const Reference< XTypeDescription > * pExceptions = rExceptions.getConstArray();
272  sal_Int32 nExceptions = rExceptions.getLength();
273  rtl_uString ** ppExceptionNames = static_cast<rtl_uString **>(alloca(
274  sizeof(rtl_uString *) * nExceptions ));
275 
276  for ( nPos = nExceptions; nPos--; )
277  {
278  OUString aExceptionTypeName( pExceptions[nPos]->getName() );
279  ppExceptionNames[nPos] = aExceptionTypeName.pData;
280  rtl_uString_acquire( ppExceptionNames[nPos] );
281  }
282 
283  OUString aTypeName( xMethod->getName() );
284  OUString aReturnTypeName( xReturnType->getName() );
285 
287  reinterpret_cast<typelib_InterfaceMethodTypeDescription **>(&pRet),
288  xMethod->getPosition(),
289  xMethod->isOneway(),
290  aTypeName.pData,
291  static_cast<typelib_TypeClass>(xReturnType->getTypeClass()),
292  aReturnTypeName.pData,
293  nParams, pParamInit,
294  nExceptions, ppExceptionNames );
295 
296  for ( nPos = nParams; nPos--; )
297  {
298  rtl_uString_release( pParamInit[nPos].pTypeName );
299  rtl_uString_release( pParamInit[nPos].pParamName );
300  }
301  for ( nPos = nExceptions; nPos--; )
302  {
303  rtl_uString_release( ppExceptionNames[nPos] );
304  }
305  }
306  return pRet;
307 }
308 
310  Reference< container::XHierarchicalNameAccess > const & access,
311  const Reference< XInterfaceTypeDescription2 > & xType )
312 {
313  typelib_TypeDescription * pRet = nullptr;
314  if (xType.is())
315  {
316  Sequence< Reference< XTypeDescription > > aBases(xType->getBaseTypes());
317  sal_Int32 nBases = aBases.getLength();
318  // Exploit the fact that a typelib_TypeDescription for an interface type
319  // is also the typelib_TypeDescriptionReference for that type:
320  std::unique_ptr< typelib_TypeDescription * []> aBaseTypes(
321  new typelib_TypeDescription *[nBases]);
322  for (sal_Int32 i = 0; i < nBases; ++i) {
323  typelib_TypeDescription * p = createCTD(access, aBases[i]);
324  OSL_ASSERT(
325  !TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK(p->eTypeClass));
327  aBaseTypes[i] = p;
328  }
329  typelib_TypeDescriptionReference ** pBaseTypeRefs
330  = reinterpret_cast< typelib_TypeDescriptionReference ** >(
331  aBaseTypes.get());
332 
333  // construct all member refs
334  const Sequence<Reference< XInterfaceMemberTypeDescription > > & rMembers = xType->getMembers();
335  sal_Int32 nMembers = rMembers.getLength();
336 
337  typelib_TypeDescriptionReference ** ppMemberRefs = static_cast<typelib_TypeDescriptionReference **>(alloca(
338  sizeof(typelib_TypeDescriptionReference *) * nMembers ));
339 
340  const Reference< XInterfaceMemberTypeDescription > * pMembers = rMembers.getConstArray();
341 
342  OUString aTypeName( xType->getName() );
343 
344  sal_Int32 nPos;
345  for ( nPos = nMembers; nPos--; )
346  {
347  OUString aMemberTypeName( pMembers[nPos]->getName() );
348  ppMemberRefs[nPos] = nullptr;
350  ppMemberRefs + nPos,
351  static_cast<typelib_TypeClass>(pMembers[nPos]->getTypeClass()),
352  aMemberTypeName.pData );
353  }
354 
356  reinterpret_cast<typelib_InterfaceTypeDescription **>(&pRet),
357  aTypeName.pData,
358  0, 0, 0, 0, 0,
359  nBases, pBaseTypeRefs,
360  nMembers, ppMemberRefs );
361 
362  // cleanup refs and base type
363  for (int i = 0; i < nBases; ++i) {
364  typelib_typedescription_release(aBaseTypes[i]);
365  }
366 
367  for ( nPos = nMembers; nPos--; )
368  {
369  typelib_typedescriptionreference_release( ppMemberRefs[nPos] );
370  }
371  }
372  return pRet;
373 }
374 
375 static typelib_TypeDescription * createCTD( const Reference< XEnumTypeDescription > & xType )
376 {
377  typelib_TypeDescription * pRet = nullptr;
378  if (xType.is())
379  {
380  OUString aTypeName( xType->getName() );
381  Sequence< OUString > aNames( xType->getEnumNames() );
382  OSL_ASSERT( sizeof(OUString) == sizeof(rtl_uString *) ); // !!!
383  Sequence< sal_Int32 > aValues( xType->getEnumValues() );
384 
386  &pRet, aTypeName.pData, xType->getDefaultEnumValue(),
387  aNames.getLength(),
388  const_cast<rtl_uString **>(reinterpret_cast<rtl_uString * const *>(aNames.getConstArray())),
389  const_cast< sal_Int32 * >( aValues.getConstArray() ) );
390  }
391  return pRet;
392 }
393 
395  Reference< container::XHierarchicalNameAccess > const & access,
396  const Reference< XIndirectTypeDescription > & xType )
397 {
398  typelib_TypeDescription * pRet = nullptr;
399  if (xType.is())
400  {
401  typelib_TypeDescription * pRefType = createCTD(
402  access, xType->getReferencedType() );
404 
405  OUString aTypeName( xType->getName() );
406 
408  &pRet,
409  static_cast<typelib_TypeClass>(xType->getTypeClass()),
410  aTypeName.pData,
411  pRefType->pWeakRef,
412  0, nullptr );
413 
414  // cleanup
416  }
417  return pRet;
418 }
419 
420 
422  Reference< container::XHierarchicalNameAccess > const & access,
423  const Reference< XTypeDescription > & xType )
424 {
425  typelib_TypeDescription * pRet = nullptr;
426 
427  if (xType.is())
428  {
429  switch (xType->getTypeClass())
430  {
431  // built in types
432  case TypeClass_VOID:
433  {
434  OUString aTypeName("void");
435  typelib_typedescription_new( &pRet, typelib_TypeClass_VOID, aTypeName.pData, nullptr, 0, nullptr );
436  break;
437  }
438  case TypeClass_CHAR:
439  {
440  OUString aTypeName("char");
441  typelib_typedescription_new( &pRet, typelib_TypeClass_CHAR, aTypeName.pData, nullptr, 0, nullptr );
442  break;
443  }
444  case TypeClass_BOOLEAN:
445  {
446  OUString aTypeName("boolean");
447  typelib_typedescription_new( &pRet, typelib_TypeClass_BOOLEAN, aTypeName.pData, nullptr, 0, nullptr );
448  break;
449  }
450  case TypeClass_BYTE:
451  {
452  OUString aTypeName("byte");
453  typelib_typedescription_new( &pRet, typelib_TypeClass_BYTE, aTypeName.pData, nullptr, 0, nullptr );
454  break;
455  }
456  case TypeClass_SHORT:
457  {
458  OUString aTypeName("short");
459  typelib_typedescription_new( &pRet, typelib_TypeClass_SHORT, aTypeName.pData, nullptr, 0, nullptr );
460  break;
461  }
462  case TypeClass_UNSIGNED_SHORT:
463  {
464  OUString aTypeName("unsigned short");
465  typelib_typedescription_new( &pRet, typelib_TypeClass_UNSIGNED_SHORT, aTypeName.pData, nullptr, 0, nullptr );
466  break;
467  }
468  case TypeClass_LONG:
469  {
470  OUString aTypeName("long");
471  typelib_typedescription_new( &pRet, typelib_TypeClass_LONG, aTypeName.pData, nullptr, 0, nullptr );
472  break;
473  }
474  case TypeClass_UNSIGNED_LONG:
475  {
476  OUString aTypeName("unsigned long");
477  typelib_typedescription_new( &pRet, typelib_TypeClass_UNSIGNED_LONG, aTypeName.pData, nullptr, 0, nullptr );
478  break;
479  }
480  case TypeClass_HYPER:
481  {
482  OUString aTypeName("hyper");
483  typelib_typedescription_new( &pRet, typelib_TypeClass_HYPER, aTypeName.pData, nullptr, 0, nullptr );
484  break;
485  }
486  case TypeClass_UNSIGNED_HYPER:
487  {
488  OUString aTypeName("unsigned hyper");
489  typelib_typedescription_new( &pRet, typelib_TypeClass_UNSIGNED_HYPER, aTypeName.pData, nullptr, 0, nullptr );
490  break;
491  }
492  case TypeClass_FLOAT:
493  {
494  OUString aTypeName("float");
495  typelib_typedescription_new( &pRet, typelib_TypeClass_FLOAT, aTypeName.pData, nullptr, 0, nullptr );
496  break;
497  }
498  case TypeClass_DOUBLE:
499  {
500  OUString aTypeName("double");
501  typelib_typedescription_new( &pRet, typelib_TypeClass_DOUBLE, aTypeName.pData, nullptr, 0, nullptr );
502  break;
503  }
504  case TypeClass_STRING:
505  {
506  OUString aTypeName("string");
507  typelib_typedescription_new( &pRet, typelib_TypeClass_STRING, aTypeName.pData, nullptr, 0, nullptr );
508  break;
509  }
510  case TypeClass_TYPE:
511  {
512  OUString aTypeName("type");
513  typelib_typedescription_new( &pRet, typelib_TypeClass_TYPE, aTypeName.pData, nullptr, 0, nullptr );
514  break;
515  }
516  case TypeClass_ANY:
517  {
518  OUString aTypeName("any");
519  typelib_typedescription_new( &pRet, typelib_TypeClass_ANY, aTypeName.pData, nullptr, 0, nullptr );
520  break;
521  }
522 
523  case TypeClass_EXCEPTION:
524  pRet = createCTD( Reference< XCompoundTypeDescription >::query( xType ) );
525  break;
526  case TypeClass_STRUCT:
527  pRet = createCTD(
528  access, Reference< XStructTypeDescription >::query( xType ) );
529  break;
530  case TypeClass_ENUM:
531  pRet = createCTD( Reference< XEnumTypeDescription >::query( xType ) );
532  break;
533  case TypeClass_TYPEDEF:
534  {
535  Reference< XIndirectTypeDescription > xTypedef( xType, UNO_QUERY );
536  if (xTypedef.is())
537  pRet = createCTD( access, xTypedef->getReferencedType() );
538  break;
539  }
540  case TypeClass_SEQUENCE:
541  pRet = createCTD(
542  access, Reference< XIndirectTypeDescription >::query( xType ) );
543  break;
544  case TypeClass_INTERFACE:
545  pRet = createCTD(
546  access,
547  Reference< XInterfaceTypeDescription2 >::query( xType ) );
548  break;
549  case TypeClass_INTERFACE_METHOD:
550  pRet = createCTD( Reference< XInterfaceMethodTypeDescription >::query( xType ) );
551  break;
552  case TypeClass_INTERFACE_ATTRIBUTE:
553  pRet = createCTD( Reference< XInterfaceAttributeTypeDescription2 >::query( xType ) );
554  break;
555  default:
556  break;
557  }
558  }
559 
560  return pRet;
561 }
562 
563 
564 extern "C"
565 {
566 static void typelib_callback(
567  void * pContext, typelib_TypeDescription ** ppRet, rtl_uString * pTypeName )
568 {
569  OSL_ENSURE( pContext && ppRet && pTypeName, "### null ptr!" );
570  if (!ppRet)
571  return;
572 
573  if (*ppRet)
574  {
575  ::typelib_typedescription_release( *ppRet );
576  *ppRet = nullptr;
577  }
578  if (!(pContext && pTypeName))
579  return;
580 
581  Reference< container::XHierarchicalNameAccess > access(
582  static_cast< container::XHierarchicalNameAccess * >(
583  pContext));
584  try
585  {
586  OUString const & rTypeName = OUString::unacquired( &pTypeName );
587  Reference< XTypeDescription > xTD;
588  if (access->getByHierarchicalName(rTypeName ) >>= xTD)
589  {
590  *ppRet = createCTD( access, xTD );
591  }
592  }
593  catch (const container::NoSuchElementException & exc)
594  {
595  SAL_INFO("cppuhelper", "typelibrary type not available: " << exc );
596  }
597  catch (const Exception & exc)
598  {
599  SAL_INFO("cppuhelper", exc );
600  }
601 }
602 }
603 
604 namespace {
605 
606 class EventListenerImpl
607  : public WeakImplHelper< lang::XEventListener >
608 {
609  Reference< container::XHierarchicalNameAccess > m_xTDMgr;
610 
611 public:
612  explicit EventListenerImpl(
613  Reference< container::XHierarchicalNameAccess > const & xTDMgr )
614  : m_xTDMgr( xTDMgr )
615  {}
616 
617  // XEventListener
618  virtual void SAL_CALL disposing( lang::EventObject const & rEvt ) override;
619 };
620 
621 }
622 
623 void EventListenerImpl::disposing( lang::EventObject const & rEvt )
624 {
625  if (rEvt.Source != m_xTDMgr) {
626  OSL_ASSERT(false);
627  }
628  // deregister of c typelib callback
629  ::typelib_typedescription_revokeCallback( m_xTDMgr.get(), typelib_callback );
630 }
631 
632 
634  Reference< container::XHierarchicalNameAccess > const & xTDMgr_c )
635 {
636  uno::Environment curr_env(Environment::getCurrent());
637  uno::Environment target_env(CPPU_CURRENT_LANGUAGE_BINDING_NAME);
638 
639  uno::Mapping curr2target(curr_env, target_env);
640 
641 
642  Reference<container::XHierarchicalNameAccess> xTDMgr(
643  static_cast<container::XHierarchicalNameAccess *>(
644  curr2target.mapInterface(xTDMgr_c.get(), cppu::UnoType<decltype(xTDMgr_c)>::get())),
645  SAL_NO_ACQUIRE);
646 
647  Reference< lang::XComponent > xComp( xTDMgr, UNO_QUERY );
648  if (xComp.is())
649  {
650  xComp->addEventListener( new EventListenerImpl( xTDMgr ) );
651  // register c typelib callback
652  ::typelib_typedescription_registerCallback( xTDMgr.get(), typelib_callback );
653  return true;
654  }
655  return false;
656 }
657 
658 } // end namespace cppu
659 
660 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SAL_CALL typelib_typedescription_register(typelib_TypeDescription **ppNewDescription) SAL_THROW_EXTERN_C()
void SAL_CALL typelib_typedescription_newStruct(typelib_TypeDescription **ppRet, rtl_uString *pTypeName, typelib_TypeDescriptionReference *pType, sal_Int32 nMembers, typelib_StructMember_Init *pMembers) SAL_THROW_EXTERN_C()
void SAL_CALL typelib_typedescription_newMIInterface(typelib_InterfaceTypeDescription **ppRet, rtl_uString *pTypeName, SAL_UNUSED_PARAMETER sal_uInt32, SAL_UNUSED_PARAMETER sal_uInt16, SAL_UNUSED_PARAMETER sal_uInt16, SAL_UNUSED_PARAMETER sal_uInt32, SAL_UNUSED_PARAMETER sal_uInt32, sal_Int32 nBaseInterfaces, typelib_TypeDescriptionReference **ppBaseInterfaces, sal_Int32 nMembers, typelib_TypeDescriptionReference **ppMembers) SAL_THROW_EXTERN_C()
static typelib_TypeDescription * createCTD(Reference< container::XHierarchicalNameAccess > const &access, const Reference< XTypeDescription > &xType)
Definition: tdmgr.cxx:421
PyRef getTypeClass(const Runtime &)
void SAL_CALL typelib_typedescription_newExtendedInterfaceAttribute(typelib_InterfaceAttributeTypeDescription **ppRet, sal_Int32 nAbsolutePosition, rtl_uString *pTypeName, typelib_TypeClass eAttributeTypeClass, rtl_uString *pAttributeTypeName, sal_Bool bReadOnly, sal_Int32 nGetExceptions, rtl_uString **ppGetExceptionNames, sal_Int32 nSetExceptions, rtl_uString **ppSetExceptionNames) SAL_THROW_EXTERN_C()
sal_Bool SAL_CALL installTypeDescriptionManager(Reference< container::XHierarchicalNameAccess > const &xTDMgr_c)
Definition: tdmgr.cxx:633
int i
void SAL_CALL typelib_typedescription_newEnum(typelib_TypeDescription **ppRet, rtl_uString *pTypeName, sal_Int32 nDefaultValue, sal_Int32 nEnumValues, rtl_uString **ppEnumNames, sal_Int32 *pEnumValues) SAL_THROW_EXTERN_C()
unsigned char sal_Bool
void SAL_CALL typelib_typedescriptionreference_release(typelib_TypeDescriptionReference *pRef) SAL_THROW_EXTERN_C()
struct _typelib_TypeDescription typelib_TypeDescription
void SAL_CALL typelib_typedescription_release(typelib_TypeDescription *pTD) SAL_THROW_EXTERN_C()
void SAL_CALL typelib_typedescriptionreference_new(typelib_TypeDescriptionReference **ppTDR, typelib_TypeClass eTypeClass, rtl_uString *pTypeName) SAL_THROW_EXTERN_C()
Reference< container::XHierarchicalNameAccess > m_xTDMgr
Definition: tdmgr.cxx:609
static void typelib_callback(void *pContext, typelib_TypeDescription **ppRet, rtl_uString *pTypeName)
Definition: tdmgr.cxx:566
#define SAL_INFO(area, stream)
void * p
void SAL_CALL typelib_typedescription_new(typelib_TypeDescription **ppRet, typelib_TypeClass eTypeClass, rtl_uString *pTypeName, typelib_TypeDescriptionReference *pType, sal_Int32 nMembers, typelib_CompoundMember_Init *pMembers) SAL_THROW_EXTERN_C()
void SAL_CALL typelib_typedescription_newInterfaceMethod(typelib_InterfaceMethodTypeDescription **ppRet, sal_Int32 nAbsolutePosition, sal_Bool bOneWay, rtl_uString *pTypeName, typelib_TypeClass eReturnTypeClass, rtl_uString *pReturnTypeName, sal_Int32 nParams, typelib_Parameter_Init *pParams, sal_Int32 nExceptions, rtl_uString **ppExceptionNames) SAL_THROW_EXTERN_C()
sal_uInt16 nPos