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 <rtl/ustrbuf.hxx>
22 : #include "registry/reader.hxx"
23 : #include "registry/version.h"
24 :
25 : #include <com/sun/star/reflection/XInterfaceMemberTypeDescription.hpp>
26 : #include <com/sun/star/reflection/XInterfaceAttributeTypeDescription2.hpp>
27 : #include <com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp>
28 : #include <com/sun/star/reflection/XMethodParameter.hpp>
29 : #include <com/sun/star/reflection/XParameter.hpp>
30 : #include "com/sun/star/uno/RuntimeException.hpp"
31 : #include "base.hxx"
32 : #include "functiondescription.hxx"
33 : #include "methoddescription.hxx"
34 :
35 : #include <memory>
36 : #include <set>
37 :
38 : namespace stoc_rdbtdp
39 : {
40 :
41 : //==================================================================================================
42 : class InterfaceMethodImpl : public WeakImplHelper1< XInterfaceMethodTypeDescription >
43 : {
44 : stoc::registry_tdprovider::MethodDescription _desc;
45 :
46 : Reference< XHierarchicalNameAccess > _xTDMgr;
47 :
48 : OUString _aTypeName;
49 :
50 : OUString _aReturnType;
51 : Reference< XTypeDescription > _xReturnTD;
52 :
53 : sal_Bool _bIsOneWay;
54 : sal_Int32 _nPosition;
55 :
56 : public:
57 44026 : InterfaceMethodImpl( const Reference< XHierarchicalNameAccess > & xTDMgr,
58 : const OUString & rTypeName,
59 : const OUString & rMemberName,
60 : const OUString & rReturnType,
61 : const Sequence< sal_Int8 > & rBytes,
62 : sal_uInt16 nMethodIndex,
63 : sal_Bool bIsOneWay,
64 : sal_Int32 nPosition )
65 : : _desc(xTDMgr, rMemberName, rBytes, nMethodIndex)
66 : , _xTDMgr( xTDMgr )
67 : , _aTypeName( rTypeName )
68 : , _aReturnType( rReturnType )
69 : , _bIsOneWay( bIsOneWay )
70 44026 : , _nPosition( nPosition )
71 : {
72 44026 : g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
73 44026 : }
74 : virtual ~InterfaceMethodImpl();
75 :
76 : // XTypeDescription
77 : virtual TypeClass SAL_CALL getTypeClass() throw(::com::sun::star::uno::RuntimeException);
78 : virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
79 :
80 : // XInterfaceMemberTypeDescription
81 0 : virtual OUString SAL_CALL getMemberName() throw(::com::sun::star::uno::RuntimeException)
82 0 : { return _desc.getName(); }
83 : virtual sal_Int32 SAL_CALL getPosition() throw(::com::sun::star::uno::RuntimeException);
84 :
85 : // XInterfaceMethodTypeDescription
86 : virtual Reference< XTypeDescription > SAL_CALL getReturnType() throw(::com::sun::star::uno::RuntimeException);
87 : virtual sal_Bool SAL_CALL isOneway() throw(::com::sun::star::uno::RuntimeException);
88 : virtual Sequence< Reference< XMethodParameter > > SAL_CALL getParameters() throw(::com::sun::star::uno::RuntimeException);
89 : virtual Sequence< Reference< XTypeDescription > > SAL_CALL getExceptions() throw(::com::sun::star::uno::RuntimeException);
90 : };
91 : //__________________________________________________________________________________________________
92 130350 : InterfaceMethodImpl::~InterfaceMethodImpl()
93 : {
94 43450 : g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
95 86900 : }
96 :
97 : // XTypeDescription
98 : //__________________________________________________________________________________________________
99 111143 : TypeClass InterfaceMethodImpl::getTypeClass()
100 : throw(::com::sun::star::uno::RuntimeException)
101 : {
102 111143 : return TypeClass_INTERFACE_METHOD;
103 : }
104 : //__________________________________________________________________________________________________
105 136879 : OUString InterfaceMethodImpl::getName()
106 : throw(::com::sun::star::uno::RuntimeException)
107 : {
108 136879 : return _aTypeName;
109 : }
110 :
111 : // XInterfaceMemberTypeDescription
112 : //__________________________________________________________________________________________________
113 7723 : sal_Int32 InterfaceMethodImpl::getPosition()
114 : throw(::com::sun::star::uno::RuntimeException)
115 : {
116 7723 : return _nPosition;
117 : }
118 :
119 : // XInterfaceMethodTypeDescription
120 : //__________________________________________________________________________________________________
121 7723 : Reference<XTypeDescription > InterfaceMethodImpl::getReturnType()
122 : throw(::com::sun::star::uno::RuntimeException)
123 : {
124 7723 : if (!_xReturnTD.is() && !_aReturnType.isEmpty())
125 : {
126 : try
127 : {
128 7720 : Reference< XTypeDescription > xReturnTD;
129 7720 : if (_xTDMgr->getByHierarchicalName( _aReturnType ) >>= xReturnTD)
130 : {
131 7720 : MutexGuard aGuard( getMutex() );
132 7720 : if (! _xReturnTD.is())
133 7720 : _xReturnTD = xReturnTD;
134 7720 : return _xReturnTD;
135 7720 : }
136 : }
137 0 : catch (NoSuchElementException &)
138 : {
139 : }
140 : // never try again, if no td was found
141 0 : _aReturnType = OUString();
142 : }
143 3 : return _xReturnTD;
144 : }
145 : //__________________________________________________________________________________________________
146 7723 : sal_Bool InterfaceMethodImpl::isOneway()
147 : throw(::com::sun::star::uno::RuntimeException)
148 : {
149 7723 : return _bIsOneWay;
150 : }
151 : //__________________________________________________________________________________________________
152 7723 : Sequence<Reference<XMethodParameter > > InterfaceMethodImpl::getParameters()
153 : throw(::com::sun::star::uno::RuntimeException)
154 : {
155 7723 : Sequence< Reference< XParameter > > s1(_desc.getParameters());
156 7723 : Sequence< Reference< XMethodParameter > > s2(s1.getLength());
157 14682 : for (sal_Int32 i = 0; i < s1.getLength(); ++i) {
158 6959 : s2[i] = s1[i].get();
159 : }
160 7723 : return s2;
161 : }
162 : //__________________________________________________________________________________________________
163 7723 : Sequence<Reference<XTypeDescription > > InterfaceMethodImpl::getExceptions()
164 : throw(::com::sun::star::uno::RuntimeException)
165 : {
166 : Sequence< Reference< XCompoundTypeDescription > > s1(
167 7723 : _desc.getExceptions());
168 7723 : Sequence< Reference< XTypeDescription > > s2(s1.getLength());
169 12401 : for (sal_Int32 i = 0; i < s1.getLength(); ++i) {
170 4678 : s2[i] = s1[i].get();
171 : }
172 7723 : return s2;
173 : }
174 :
175 :
176 : //##################################################################################################
177 : //##################################################################################################
178 : //##################################################################################################
179 :
180 :
181 : //==================================================================================================
182 : class InterfaceAttributeImpl : public WeakImplHelper1< XInterfaceAttributeTypeDescription2 >
183 : {
184 : Reference< XHierarchicalNameAccess > _xTDMgr;
185 :
186 : OUString _aTypeName;
187 : OUString _aMemberName;
188 :
189 : OUString _aMemberTypeName;
190 : Reference< XTypeDescription > _xMemberTD;
191 :
192 : sal_Bool _bReadOnly;
193 : sal_Bool _bBound;
194 : sal_Int32 _nPosition;
195 :
196 : SAL_WNODEPRECATED_DECLARATIONS_PUSH
197 : std::auto_ptr< stoc::registry_tdprovider::FunctionDescription > _getter;
198 : std::auto_ptr< stoc::registry_tdprovider::FunctionDescription > _setter;
199 : SAL_WNODEPRECATED_DECLARATIONS_POP
200 :
201 : public:
202 : SAL_WNODEPRECATED_DECLARATIONS_PUSH
203 3137 : InterfaceAttributeImpl(
204 : const Reference< XHierarchicalNameAccess > & xTDMgr,
205 : const OUString & rTypeName,
206 : const OUString & rMemberName,
207 : const OUString & rMemberTypeName,
208 : sal_Bool bReadOnly,
209 : sal_Bool bBound,
210 : std::auto_ptr< stoc::registry_tdprovider::FunctionDescription > &
211 : getter,
212 : std::auto_ptr< stoc::registry_tdprovider::FunctionDescription > &
213 : setter,
214 : sal_Int32 nPosition )
215 : : _xTDMgr( xTDMgr )
216 : , _aTypeName( rTypeName )
217 : , _aMemberName( rMemberName )
218 : , _aMemberTypeName( rMemberTypeName )
219 : , _bReadOnly( bReadOnly )
220 : , _bBound( bBound )
221 : , _nPosition( nPosition )
222 : , _getter( getter )
223 3137 : , _setter( setter )
224 : {
225 3137 : g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
226 3137 : }
227 : SAL_WNODEPRECATED_DECLARATIONS_POP
228 : virtual ~InterfaceAttributeImpl();
229 :
230 : // XTypeDescription
231 : virtual TypeClass SAL_CALL getTypeClass() throw(::com::sun::star::uno::RuntimeException);
232 : virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
233 :
234 : // XInterfaceMemberTypeDescription
235 : virtual OUString SAL_CALL getMemberName() throw(::com::sun::star::uno::RuntimeException);
236 : virtual sal_Int32 SAL_CALL getPosition() throw(::com::sun::star::uno::RuntimeException);
237 :
238 : // XInterfaceAttributeTypeDescription2
239 : virtual sal_Bool SAL_CALL isReadOnly() throw(::com::sun::star::uno::RuntimeException);
240 : virtual Reference< XTypeDescription > SAL_CALL getType() throw(::com::sun::star::uno::RuntimeException);
241 :
242 5970 : virtual sal_Bool SAL_CALL isBound() throw (RuntimeException)
243 5970 : { return _bBound; }
244 :
245 : virtual Sequence< Reference< XCompoundTypeDescription > > SAL_CALL
246 8077 : getGetExceptions() throw (RuntimeException)
247 : {
248 8077 : if (_getter.get() != 0) {
249 2 : return _getter->getExceptions();
250 : } else {
251 8075 : return Sequence< Reference< XCompoundTypeDescription > >();
252 : }
253 : }
254 :
255 : virtual Sequence< Reference< XCompoundTypeDescription > > SAL_CALL
256 8077 : getSetExceptions() throw (RuntimeException)
257 : {
258 8077 : if (_setter.get() != 0) {
259 184 : return _setter->getExceptions();
260 : } else {
261 7893 : return Sequence< Reference< XCompoundTypeDescription > >();
262 : }
263 : }
264 : };
265 :
266 8973 : InterfaceAttributeImpl::~InterfaceAttributeImpl()
267 : {
268 2991 : g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
269 5982 : }
270 : // XTypeDescription
271 : //__________________________________________________________________________________________________
272 11244 : TypeClass InterfaceAttributeImpl::getTypeClass()
273 : throw(::com::sun::star::uno::RuntimeException)
274 : {
275 11244 : return TypeClass_INTERFACE_ATTRIBUTE;
276 : }
277 : //__________________________________________________________________________________________________
278 21008 : OUString InterfaceAttributeImpl::getName()
279 : throw(::com::sun::star::uno::RuntimeException)
280 : {
281 21008 : return _aTypeName;
282 : }
283 :
284 : // XInterfaceMemberTypeDescription
285 : //__________________________________________________________________________________________________
286 5970 : OUString InterfaceAttributeImpl::getMemberName()
287 : throw(::com::sun::star::uno::RuntimeException)
288 : {
289 5970 : return _aMemberName;
290 : }
291 : //__________________________________________________________________________________________________
292 2107 : sal_Int32 InterfaceAttributeImpl::getPosition()
293 : throw(::com::sun::star::uno::RuntimeException)
294 : {
295 2107 : return _nPosition;
296 : }
297 :
298 : // XInterfaceAttributeTypeDescription2
299 : //__________________________________________________________________________________________________
300 8077 : sal_Bool InterfaceAttributeImpl::isReadOnly()
301 : throw(::com::sun::star::uno::RuntimeException)
302 : {
303 8077 : return _bReadOnly;
304 : }
305 : //__________________________________________________________________________________________________
306 8077 : Reference<XTypeDescription > InterfaceAttributeImpl::getType()
307 : throw(::com::sun::star::uno::RuntimeException)
308 : {
309 8077 : if (!_xMemberTD.is() && !_aMemberTypeName.isEmpty())
310 : {
311 : try
312 : {
313 2029 : Reference< XTypeDescription > xMemberTD;
314 2029 : if (_xTDMgr->getByHierarchicalName( _aMemberTypeName ) >>= xMemberTD)
315 : {
316 2029 : MutexGuard aGuard( getMutex() );
317 2029 : if (! _xMemberTD.is())
318 2029 : _xMemberTD = xMemberTD;
319 2029 : return _xMemberTD;
320 2029 : }
321 : }
322 0 : catch (NoSuchElementException &)
323 : {
324 : }
325 : // never try again, if no td was found
326 0 : _aMemberTypeName = OUString();
327 : }
328 6048 : return _xMemberTD;
329 : }
330 :
331 :
332 : //##################################################################################################
333 : //##################################################################################################
334 : //##################################################################################################
335 :
336 14440 : void InterfaceTypeDescriptionImpl::checkInterfaceType(
337 : Reference< XTypeDescription > const & type)
338 : {
339 14440 : if (resolveTypedefs(type)->getTypeClass() != TypeClass_INTERFACE) {
340 : throw RuntimeException(
341 : OUString(
342 : RTL_CONSTASCII_USTRINGPARAM(
343 : "Interface base is not an interface type")),
344 0 : static_cast< OWeakObject * >(this));
345 : }
346 14440 : }
347 :
348 : namespace {
349 :
350 13289 : class BaseOffset {
351 : public:
352 : BaseOffset(Reference< XInterfaceTypeDescription2 > const & desc);
353 :
354 13289 : sal_Int32 get() const { return offset; }
355 :
356 : private:
357 : void calculateBases(Reference< XInterfaceTypeDescription2 > const & desc);
358 :
359 : void calculate(Reference< XInterfaceTypeDescription2 > const & desc);
360 :
361 : std::set< rtl::OUString > set;
362 : sal_Int32 offset;
363 : };
364 :
365 13289 : BaseOffset::BaseOffset(Reference< XInterfaceTypeDescription2 > const & desc) {
366 13289 : offset = 0;
367 13289 : calculateBases(desc);
368 13289 : }
369 :
370 35597 : void BaseOffset::calculateBases(
371 : Reference< XInterfaceTypeDescription2 > const & desc)
372 : {
373 35597 : Sequence< Reference < XTypeDescription > > bases(desc->getBaseTypes());
374 59460 : for (sal_Int32 i = 0; i < bases.getLength(); ++i) {
375 : calculate(
376 : Reference< XInterfaceTypeDescription2 >(
377 23863 : resolveTypedefs(bases[i]), UNO_QUERY_THROW));
378 35597 : }
379 35597 : }
380 :
381 23863 : void BaseOffset::calculate(Reference< XInterfaceTypeDescription2 > const & desc)
382 : {
383 23863 : if (set.insert(desc->getName()).second) {
384 22308 : calculateBases(desc);
385 22308 : offset += desc->getMembers().getLength();
386 : }
387 23863 : }
388 :
389 : }
390 :
391 : //__________________________________________________________________________________________________
392 13641 : InterfaceTypeDescriptionImpl::InterfaceTypeDescriptionImpl(
393 : const Reference< XHierarchicalNameAccess > & xTDMgr,
394 : const OUString & rName, const Sequence< OUString > & rBaseTypes,
395 : const Sequence< OUString > & rOptionalBaseTypes,
396 : const Sequence< sal_Int8 > & rBytes, bool published )
397 : : _xTDMgr( xTDMgr )
398 : , _aBytes( rBytes )
399 : , _aName( rName )
400 : , _aBaseTypes( rBaseTypes )
401 : , _aOptionalBaseTypes( rOptionalBaseTypes )
402 : , _membersInit( false )
403 13641 : , _published( published )
404 : {
405 13641 : g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
406 13641 : }
407 : //__________________________________________________________________________________________________
408 40518 : InterfaceTypeDescriptionImpl::~InterfaceTypeDescriptionImpl()
409 : {
410 13506 : g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
411 27012 : }
412 :
413 : // XTypeDescription
414 : //__________________________________________________________________________________________________
415 94688 : TypeClass InterfaceTypeDescriptionImpl::getTypeClass()
416 : throw(::com::sun::star::uno::RuntimeException)
417 : {
418 94688 : return TypeClass_INTERFACE;
419 : }
420 : //__________________________________________________________________________________________________
421 113117 : OUString InterfaceTypeDescriptionImpl::getName()
422 : throw(::com::sun::star::uno::RuntimeException)
423 : {
424 113117 : return _aName;
425 : }
426 :
427 : // XInterfaceTypeDescription2
428 : //__________________________________________________________________________________________________
429 0 : Reference< XTypeDescription > InterfaceTypeDescriptionImpl::getBaseType()
430 : throw(::com::sun::star::uno::RuntimeException)
431 : {
432 0 : Sequence< Reference< XTypeDescription > > aBaseTypes(getBaseTypes());
433 0 : return aBaseTypes.getLength() >= 1 ? aBaseTypes[0] : 0;
434 : }
435 : //__________________________________________________________________________________________________
436 27371 : Uik SAL_CALL InterfaceTypeDescriptionImpl::getUik()
437 : throw(::com::sun::star::uno::RuntimeException)
438 : {
439 27371 : return Uik();
440 : }
441 : //__________________________________________________________________________________________________
442 67388 : Sequence< Reference< XInterfaceMemberTypeDescription > > InterfaceTypeDescriptionImpl::getMembers()
443 : throw(::com::sun::star::uno::RuntimeException)
444 : {
445 67388 : osl::MutexGuard guard(getMutex());
446 67388 : if (!_membersInit) {
447 13289 : _nBaseOffset = BaseOffset(this).get();
448 : typereg::Reader reader(
449 26578 : _aBytes.getConstArray(), _aBytes.getLength(), false,
450 26578 : TYPEREG_VERSION_1);
451 13289 : sal_Int32 count = 0;
452 13289 : sal_uInt16 methodCount = reader.getMethodCount();
453 57628 : {for (sal_uInt16 i = 0; i < methodCount; ++i) {
454 44339 : RTMethodMode flags = reader.getMethodFlags(i);
455 44339 : if (flags != RT_MODE_ATTRIBUTE_GET
456 : && flags != RT_MODE_ATTRIBUTE_SET)
457 : {
458 44026 : ++count;
459 : }
460 : }}
461 13289 : sal_uInt16 fieldCount = reader.getFieldCount();
462 13289 : count += fieldCount;
463 13289 : _members.realloc(count);
464 13289 : sal_Int32 index = 0;
465 16426 : {for (sal_uInt16 i = 0; i < fieldCount; ++i) {
466 3137 : rtl::OUString name(reader.getFieldName(i));
467 3137 : rtl::OUStringBuffer typeName(getName());
468 3137 : typeName.appendAscii(RTL_CONSTASCII_STRINGPARAM("::"));
469 3137 : typeName.append(name);
470 3137 : RTFieldAccess flags = reader.getFieldFlags(i);
471 : SAL_WNODEPRECATED_DECLARATIONS_PUSH
472 : std::auto_ptr< stoc::registry_tdprovider::FunctionDescription >
473 3137 : getter;
474 : std::auto_ptr< stoc::registry_tdprovider::FunctionDescription >
475 3137 : setter;
476 : SAL_WNODEPRECATED_DECLARATIONS_POP
477 24881 : for (sal_uInt16 j = 0; j < methodCount; ++j) {
478 21744 : if (reader.getMethodName(j) == name) {
479 313 : switch (reader.getMethodFlags(j)) {
480 : case RT_MODE_ATTRIBUTE_GET:
481 : OSL_ASSERT(getter.get() == 0);
482 : getter.reset(
483 : new stoc::registry_tdprovider::FunctionDescription(
484 2 : _xTDMgr, _aBytes, j));
485 2 : break;
486 :
487 : case RT_MODE_ATTRIBUTE_SET:
488 : OSL_ASSERT(setter.get() == 0);
489 : setter.reset(
490 : new stoc::registry_tdprovider::FunctionDescription(
491 311 : _xTDMgr, _aBytes, j));
492 311 : break;
493 :
494 : default:
495 : OSL_ASSERT(false);
496 0 : break;
497 : }
498 : }
499 : }
500 3137 : _members[index] = new InterfaceAttributeImpl(
501 : _xTDMgr, typeName.makeStringAndClear(), name,
502 : reader.getFieldTypeName(i).replace('/', '.'),
503 : (flags & RT_ACCESS_READONLY) != 0,
504 : (flags & RT_ACCESS_BOUND) != 0, getter, setter,
505 6274 : _nBaseOffset + index);
506 3137 : ++index;
507 3137 : }}
508 57628 : {for (sal_uInt16 i = 0; i < methodCount; ++i) {
509 44339 : RTMethodMode flags = reader.getMethodFlags(i);
510 44339 : if (flags != RT_MODE_ATTRIBUTE_GET
511 : && flags != RT_MODE_ATTRIBUTE_SET)
512 : {
513 44026 : rtl::OUString name(reader.getMethodName(i));
514 44026 : rtl::OUStringBuffer typeName(getName());
515 44026 : typeName.appendAscii(RTL_CONSTASCII_STRINGPARAM("::"));
516 44026 : typeName.append(name);
517 44026 : _members[index] = new InterfaceMethodImpl(
518 : _xTDMgr, typeName.makeStringAndClear(), name,
519 : reader.getMethodReturnTypeName(i).replace('/', '.'),
520 88052 : _aBytes, i, flags == RT_MODE_ONEWAY, _nBaseOffset + index);
521 44026 : ++index;
522 : }
523 : }}
524 13289 : _membersInit = true;
525 : }
526 67388 : return _members;
527 : }
528 :
529 : Sequence< Reference< XTypeDescription > >
530 70928 : InterfaceTypeDescriptionImpl::getBaseTypes() throw (RuntimeException) {
531 70928 : MutexGuard guard(getMutex());
532 70928 : if (_xBaseTDs.getLength() == 0 && _aBaseTypes.getLength() != 0) {
533 13183 : Sequence< Reference< XTypeDescription > > tds(_aBaseTypes.getLength());
534 27623 : for (sal_Int32 i = 0; i < _aBaseTypes.getLength(); ++i) {
535 : try {
536 14440 : _xTDMgr->getByHierarchicalName(_aBaseTypes[i]) >>= tds[i];
537 0 : } catch (const NoSuchElementException & e) {
538 : throw RuntimeException(
539 : (OUString(
540 : RTL_CONSTASCII_USTRINGPARAM(
541 : "com.sun.star.container.NoSuchElementException: "))
542 0 : + e.Message),
543 0 : static_cast< OWeakObject * >(this));
544 : }
545 : OSL_ASSERT(tds[i].is());
546 14440 : checkInterfaceType(tds[i]);
547 : }
548 13183 : _xBaseTDs = tds;
549 : }
550 70928 : return _xBaseTDs;
551 : }
552 :
553 : Sequence< Reference< XTypeDescription > >
554 0 : InterfaceTypeDescriptionImpl::getOptionalBaseTypes() throw (RuntimeException) {
555 0 : MutexGuard guard(getMutex());
556 0 : if (_xOptionalBaseTDs.getLength() == 0
557 0 : && _aOptionalBaseTypes.getLength() != 0)
558 : {
559 : Sequence< Reference< XTypeDescription > > tds(
560 0 : _aOptionalBaseTypes.getLength());
561 0 : for (sal_Int32 i = 0; i < _aOptionalBaseTypes.getLength(); ++i) {
562 : try {
563 0 : _xTDMgr->getByHierarchicalName(_aOptionalBaseTypes[i])
564 0 : >>= tds[i];
565 0 : } catch (const NoSuchElementException & e) {
566 : throw RuntimeException(
567 : (OUString(
568 : RTL_CONSTASCII_USTRINGPARAM(
569 : "com.sun.star.container.NoSuchElementException: "))
570 0 : + e.Message),
571 0 : static_cast< OWeakObject * >(this));
572 : }
573 : OSL_ASSERT(tds[i].is());
574 0 : checkInterfaceType(tds[i]);
575 : }
576 0 : _xOptionalBaseTDs = tds;
577 : }
578 0 : return _xOptionalBaseTDs;
579 : }
580 :
581 : }
582 :
583 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|