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 10166 : 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 10166 : , _nPosition( nPosition )
71 : {
72 10166 : g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
73 10166 : }
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 30255 : InterfaceMethodImpl::~InterfaceMethodImpl()
93 : {
94 10085 : g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
95 20170 : }
96 :
97 : // XTypeDescription
98 : //__________________________________________________________________________________________________
99 28099 : TypeClass InterfaceMethodImpl::getTypeClass()
100 : throw(::com::sun::star::uno::RuntimeException)
101 : {
102 28099 : return TypeClass_INTERFACE_METHOD;
103 : }
104 : //__________________________________________________________________________________________________
105 28611 : OUString InterfaceMethodImpl::getName()
106 : throw(::com::sun::star::uno::RuntimeException)
107 : {
108 28611 : return _aTypeName;
109 : }
110 :
111 : // XInterfaceMemberTypeDescription
112 : //__________________________________________________________________________________________________
113 1463 : sal_Int32 InterfaceMethodImpl::getPosition()
114 : throw(::com::sun::star::uno::RuntimeException)
115 : {
116 1463 : return _nPosition;
117 : }
118 :
119 : // XInterfaceMethodTypeDescription
120 : //__________________________________________________________________________________________________
121 1463 : Reference<XTypeDescription > InterfaceMethodImpl::getReturnType()
122 : throw(::com::sun::star::uno::RuntimeException)
123 : {
124 1463 : if (!_xReturnTD.is() && !_aReturnType.isEmpty())
125 : {
126 : try
127 : {
128 1463 : Reference< XTypeDescription > xReturnTD;
129 1463 : if (_xTDMgr->getByHierarchicalName( _aReturnType ) >>= xReturnTD)
130 : {
131 1463 : MutexGuard aGuard( getMutex() );
132 1463 : if (! _xReturnTD.is())
133 1463 : _xReturnTD = xReturnTD;
134 1463 : return _xReturnTD;
135 1463 : }
136 : }
137 0 : catch (NoSuchElementException &)
138 : {
139 : }
140 : // never try again, if no td was found
141 0 : _aReturnType = OUString();
142 : }
143 0 : return _xReturnTD;
144 : }
145 : //__________________________________________________________________________________________________
146 1463 : sal_Bool InterfaceMethodImpl::isOneway()
147 : throw(::com::sun::star::uno::RuntimeException)
148 : {
149 1463 : return _bIsOneWay;
150 : }
151 : //__________________________________________________________________________________________________
152 1463 : Sequence<Reference<XMethodParameter > > InterfaceMethodImpl::getParameters()
153 : throw(::com::sun::star::uno::RuntimeException)
154 : {
155 1463 : Sequence< Reference< XParameter > > s1(_desc.getParameters());
156 1463 : Sequence< Reference< XMethodParameter > > s2(s1.getLength());
157 2783 : for (sal_Int32 i = 0; i < s1.getLength(); ++i) {
158 1320 : s2[i] = s1[i].get();
159 : }
160 1463 : return s2;
161 : }
162 : //__________________________________________________________________________________________________
163 1463 : Sequence<Reference<XTypeDescription > > InterfaceMethodImpl::getExceptions()
164 : throw(::com::sun::star::uno::RuntimeException)
165 : {
166 : Sequence< Reference< XCompoundTypeDescription > > s1(
167 1463 : _desc.getExceptions());
168 1463 : Sequence< Reference< XTypeDescription > > s2(s1.getLength());
169 2389 : for (sal_Int32 i = 0; i < s1.getLength(); ++i) {
170 926 : s2[i] = s1[i].get();
171 : }
172 1463 : 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 697 : 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 697 : , _setter( setter )
224 : {
225 697 : g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
226 697 : }
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 2319 : virtual sal_Bool SAL_CALL isBound() throw (RuntimeException)
243 2319 : { return _bBound; }
244 :
245 : virtual Sequence< Reference< XCompoundTypeDescription > > SAL_CALL
246 2706 : getGetExceptions() throw (RuntimeException)
247 : {
248 2706 : if (_getter.get() != 0) {
249 1 : return _getter->getExceptions();
250 : } else {
251 2705 : return Sequence< Reference< XCompoundTypeDescription > >();
252 : }
253 : }
254 :
255 : virtual Sequence< Reference< XCompoundTypeDescription > > SAL_CALL
256 2706 : getSetExceptions() throw (RuntimeException)
257 : {
258 2706 : if (_setter.get() != 0) {
259 35 : return _setter->getExceptions();
260 : } else {
261 2671 : return Sequence< Reference< XCompoundTypeDescription > >();
262 : }
263 : }
264 : };
265 :
266 2028 : InterfaceAttributeImpl::~InterfaceAttributeImpl()
267 : {
268 676 : g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
269 1352 : }
270 : // XTypeDescription
271 : //__________________________________________________________________________________________________
272 3423 : TypeClass InterfaceAttributeImpl::getTypeClass()
273 : throw(::com::sun::star::uno::RuntimeException)
274 : {
275 3423 : return TypeClass_INTERFACE_ATTRIBUTE;
276 : }
277 : //__________________________________________________________________________________________________
278 3596 : OUString InterfaceAttributeImpl::getName()
279 : throw(::com::sun::star::uno::RuntimeException)
280 : {
281 3596 : return _aTypeName;
282 : }
283 :
284 : // XInterfaceMemberTypeDescription
285 : //__________________________________________________________________________________________________
286 2319 : OUString InterfaceAttributeImpl::getMemberName()
287 : throw(::com::sun::star::uno::RuntimeException)
288 : {
289 2319 : return _aMemberName;
290 : }
291 : //__________________________________________________________________________________________________
292 387 : sal_Int32 InterfaceAttributeImpl::getPosition()
293 : throw(::com::sun::star::uno::RuntimeException)
294 : {
295 387 : return _nPosition;
296 : }
297 :
298 : // XInterfaceAttributeTypeDescription2
299 : //__________________________________________________________________________________________________
300 2706 : sal_Bool InterfaceAttributeImpl::isReadOnly()
301 : throw(::com::sun::star::uno::RuntimeException)
302 : {
303 2706 : return _bReadOnly;
304 : }
305 : //__________________________________________________________________________________________________
306 2706 : Reference<XTypeDescription > InterfaceAttributeImpl::getType()
307 : throw(::com::sun::star::uno::RuntimeException)
308 : {
309 2706 : if (!_xMemberTD.is() && !_aMemberTypeName.isEmpty())
310 : {
311 : try
312 : {
313 379 : Reference< XTypeDescription > xMemberTD;
314 379 : if (_xTDMgr->getByHierarchicalName( _aMemberTypeName ) >>= xMemberTD)
315 : {
316 379 : MutexGuard aGuard( getMutex() );
317 379 : if (! _xMemberTD.is())
318 379 : _xMemberTD = xMemberTD;
319 379 : return _xMemberTD;
320 379 : }
321 : }
322 0 : catch (NoSuchElementException &)
323 : {
324 : }
325 : // never try again, if no td was found
326 0 : _aMemberTypeName = OUString();
327 : }
328 2327 : return _xMemberTD;
329 : }
330 :
331 :
332 : //##################################################################################################
333 : //##################################################################################################
334 : //##################################################################################################
335 :
336 3395 : void InterfaceTypeDescriptionImpl::checkInterfaceType(
337 : Reference< XTypeDescription > const & type)
338 : {
339 3395 : 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 3395 : }
347 :
348 : namespace {
349 :
350 3141 : class BaseOffset {
351 : public:
352 : BaseOffset(Reference< XInterfaceTypeDescription2 > const & desc);
353 :
354 3141 : 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 3141 : BaseOffset::BaseOffset(Reference< XInterfaceTypeDescription2 > const & desc) {
366 3141 : offset = 0;
367 3141 : calculateBases(desc);
368 3141 : }
369 :
370 8312 : void BaseOffset::calculateBases(
371 : Reference< XInterfaceTypeDescription2 > const & desc)
372 : {
373 8312 : Sequence< Reference < XTypeDescription > > bases(desc->getBaseTypes());
374 13829 : for (sal_Int32 i = 0; i < bases.getLength(); ++i) {
375 : calculate(
376 : Reference< XInterfaceTypeDescription2 >(
377 5517 : resolveTypedefs(bases[i]), UNO_QUERY_THROW));
378 8312 : }
379 8312 : }
380 :
381 5517 : void BaseOffset::calculate(Reference< XInterfaceTypeDescription2 > const & desc)
382 : {
383 5517 : if (set.insert(desc->getName()).second) {
384 5171 : calculateBases(desc);
385 5171 : offset += desc->getMembers().getLength();
386 : }
387 5517 : }
388 :
389 : }
390 :
391 : //__________________________________________________________________________________________________
392 3210 : 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 3210 : , _published( published )
404 : {
405 3210 : g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
406 3210 : }
407 : //__________________________________________________________________________________________________
408 9549 : InterfaceTypeDescriptionImpl::~InterfaceTypeDescriptionImpl()
409 : {
410 3183 : g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
411 6366 : }
412 :
413 : // XTypeDescription
414 : //__________________________________________________________________________________________________
415 23554 : TypeClass InterfaceTypeDescriptionImpl::getTypeClass()
416 : throw(::com::sun::star::uno::RuntimeException)
417 : {
418 23554 : return TypeClass_INTERFACE;
419 : }
420 : //__________________________________________________________________________________________________
421 27657 : OUString InterfaceTypeDescriptionImpl::getName()
422 : throw(::com::sun::star::uno::RuntimeException)
423 : {
424 27657 : 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 6411 : Uik SAL_CALL InterfaceTypeDescriptionImpl::getUik()
437 : throw(::com::sun::star::uno::RuntimeException)
438 : {
439 6411 : return Uik();
440 : }
441 : //__________________________________________________________________________________________________
442 16516 : Sequence< Reference< XInterfaceMemberTypeDescription > > InterfaceTypeDescriptionImpl::getMembers()
443 : throw(::com::sun::star::uno::RuntimeException)
444 : {
445 16516 : osl::MutexGuard guard(getMutex());
446 16516 : if (!_membersInit) {
447 3141 : _nBaseOffset = BaseOffset(this).get();
448 : typereg::Reader reader(
449 6282 : _aBytes.getConstArray(), _aBytes.getLength(), false,
450 6282 : TYPEREG_VERSION_1);
451 3141 : sal_Int32 count = 0;
452 3141 : sal_uInt16 methodCount = reader.getMethodCount();
453 13381 : {for (sal_uInt16 i = 0; i < methodCount; ++i) {
454 10240 : RTMethodMode flags = reader.getMethodFlags(i);
455 10240 : if (flags != RT_MODE_ATTRIBUTE_GET
456 : && flags != RT_MODE_ATTRIBUTE_SET)
457 : {
458 10166 : ++count;
459 : }
460 : }}
461 3141 : sal_uInt16 fieldCount = reader.getFieldCount();
462 3141 : count += fieldCount;
463 3141 : _members.realloc(count);
464 3141 : sal_Int32 index = 0;
465 3838 : {for (sal_uInt16 i = 0; i < fieldCount; ++i) {
466 697 : rtl::OUString name(reader.getFieldName(i));
467 697 : rtl::OUStringBuffer typeName(getName());
468 697 : typeName.appendAscii(RTL_CONSTASCII_STRINGPARAM("::"));
469 697 : typeName.append(name);
470 697 : RTFieldAccess flags = reader.getFieldFlags(i);
471 : SAL_WNODEPRECATED_DECLARATIONS_PUSH
472 : std::auto_ptr< stoc::registry_tdprovider::FunctionDescription >
473 697 : getter;
474 : std::auto_ptr< stoc::registry_tdprovider::FunctionDescription >
475 697 : setter;
476 : SAL_WNODEPRECATED_DECLARATIONS_POP
477 5003 : for (sal_uInt16 j = 0; j < methodCount; ++j) {
478 4306 : if (reader.getMethodName(j) == name) {
479 74 : 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 1 : _xTDMgr, _aBytes, j));
485 1 : break;
486 :
487 : case RT_MODE_ATTRIBUTE_SET:
488 : OSL_ASSERT(setter.get() == 0);
489 : setter.reset(
490 : new stoc::registry_tdprovider::FunctionDescription(
491 73 : _xTDMgr, _aBytes, j));
492 73 : break;
493 :
494 : default:
495 : OSL_ASSERT(false);
496 0 : break;
497 : }
498 : }
499 : }
500 697 : _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 1394 : _nBaseOffset + index);
506 697 : ++index;
507 697 : }}
508 13381 : {for (sal_uInt16 i = 0; i < methodCount; ++i) {
509 10240 : RTMethodMode flags = reader.getMethodFlags(i);
510 10240 : if (flags != RT_MODE_ATTRIBUTE_GET
511 : && flags != RT_MODE_ATTRIBUTE_SET)
512 : {
513 10166 : rtl::OUString name(reader.getMethodName(i));
514 10166 : rtl::OUStringBuffer typeName(getName());
515 10166 : typeName.appendAscii(RTL_CONSTASCII_STRINGPARAM("::"));
516 10166 : typeName.append(name);
517 10166 : _members[index] = new InterfaceMethodImpl(
518 : _xTDMgr, typeName.makeStringAndClear(), name,
519 : reader.getMethodReturnTypeName(i).replace('/', '.'),
520 20332 : _aBytes, i, flags == RT_MODE_ONEWAY, _nBaseOffset + index);
521 10166 : ++index;
522 : }
523 : }}
524 3141 : _membersInit = true;
525 : }
526 16516 : return _members;
527 : }
528 :
529 : Sequence< Reference< XTypeDescription > >
530 17815 : InterfaceTypeDescriptionImpl::getBaseTypes() throw (RuntimeException) {
531 17815 : MutexGuard guard(getMutex());
532 17815 : if (_xBaseTDs.getLength() == 0 && _aBaseTypes.getLength() != 0) {
533 3107 : Sequence< Reference< XTypeDescription > > tds(_aBaseTypes.getLength());
534 6502 : for (sal_Int32 i = 0; i < _aBaseTypes.getLength(); ++i) {
535 : try {
536 3395 : _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 3395 : checkInterfaceType(tds[i]);
547 : }
548 3107 : _xBaseTDs = tds;
549 : }
550 17815 : 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: */
|