1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_stoc.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <sal/config.h>
32*cdf0e10cSrcweir #ifdef SAL_UNX
33*cdf0e10cSrcweir #include <sal/alloca.h>
34*cdf0e10cSrcweir #endif
35*cdf0e10cSrcweir #if !(defined(MACOSX) || defined(FREEBSD))
36*cdf0e10cSrcweir #include <malloc.h>
37*cdf0e10cSrcweir #endif
38*cdf0e10cSrcweir #include <rtl/alloc.h>
39*cdf0e10cSrcweir #include <typelib/typedescription.hxx>
40*cdf0e10cSrcweir #include <uno/data.h>
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir #include "base.hxx"
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir #include "com/sun/star/lang/WrappedTargetRuntimeException.hpp"
45*cdf0e10cSrcweir #include "com/sun/star/uno/RuntimeException.hpp"
46*cdf0e10cSrcweir #include "cppuhelper/exc_hlp.hxx"
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir namespace stoc_corefl
49*cdf0e10cSrcweir {
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir //==================================================================================================
52*cdf0e10cSrcweir class IdlAttributeFieldImpl
53*cdf0e10cSrcweir 	: public IdlMemberImpl
54*cdf0e10cSrcweir 	, public XIdlField
55*cdf0e10cSrcweir 	, public XIdlField2
56*cdf0e10cSrcweir {
57*cdf0e10cSrcweir public:
58*cdf0e10cSrcweir 	typelib_InterfaceAttributeTypeDescription * getAttributeTypeDescr()
59*cdf0e10cSrcweir 		{ return (typelib_InterfaceAttributeTypeDescription *)getTypeDescr(); }
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir 	IdlAttributeFieldImpl( IdlReflectionServiceImpl * pReflection, const OUString & rName,
62*cdf0e10cSrcweir 						   typelib_TypeDescription * pTypeDescr, typelib_TypeDescription * pDeclTypeDescr )
63*cdf0e10cSrcweir 		: IdlMemberImpl( pReflection, rName, pTypeDescr, pDeclTypeDescr )
64*cdf0e10cSrcweir 		{}
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir 	// XInterface
67*cdf0e10cSrcweir 	virtual Any SAL_CALL queryInterface( const Type & rType ) throw(::com::sun::star::uno::RuntimeException);
68*cdf0e10cSrcweir 	virtual void SAL_CALL acquire() throw();
69*cdf0e10cSrcweir 	virtual void SAL_CALL release() throw();
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir 	// XTypeProvider
72*cdf0e10cSrcweir 	virtual Sequence< Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException);
73*cdf0e10cSrcweir 	virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir 	// XIdlMember
76*cdf0e10cSrcweir     virtual Reference< XIdlClass > SAL_CALL getDeclaringClass() throw(::com::sun::star::uno::RuntimeException);
77*cdf0e10cSrcweir     virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
78*cdf0e10cSrcweir 	// XIdlField
79*cdf0e10cSrcweir     virtual Reference< XIdlClass > SAL_CALL getType() throw(::com::sun::star::uno::RuntimeException);
80*cdf0e10cSrcweir     virtual FieldAccessMode SAL_CALL getAccessMode() throw(::com::sun::star::uno::RuntimeException);
81*cdf0e10cSrcweir     virtual Any SAL_CALL get( const Any & rObj ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
82*cdf0e10cSrcweir     virtual void SAL_CALL set( const Any & rObj, const Any & rValue ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException);
83*cdf0e10cSrcweir 	// XIdlField2: getType, getAccessMode and get are equal to XIdlField
84*cdf0e10cSrcweir     virtual void SAL_CALL set( Any & rObj, const Any & rValue ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException);
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir private:
87*cdf0e10cSrcweir     void checkException(
88*cdf0e10cSrcweir         uno_Any * exception, Reference< XInterface > const & context);
89*cdf0e10cSrcweir };
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir // XInterface
92*cdf0e10cSrcweir //__________________________________________________________________________________________________
93*cdf0e10cSrcweir Any IdlAttributeFieldImpl::queryInterface( const Type & rType )
94*cdf0e10cSrcweir 	throw(::com::sun::star::uno::RuntimeException)
95*cdf0e10cSrcweir {
96*cdf0e10cSrcweir 	Any aRet( ::cppu::queryInterface( rType,
97*cdf0e10cSrcweir     								  static_cast< XIdlField * >( this ),
98*cdf0e10cSrcweir                                       static_cast< XIdlField2 * >( this ) ) );
99*cdf0e10cSrcweir 	return (aRet.hasValue() ? aRet : IdlMemberImpl::queryInterface( rType ));
100*cdf0e10cSrcweir }
101*cdf0e10cSrcweir //__________________________________________________________________________________________________
102*cdf0e10cSrcweir void IdlAttributeFieldImpl::acquire() throw()
103*cdf0e10cSrcweir {
104*cdf0e10cSrcweir 	IdlMemberImpl::acquire();
105*cdf0e10cSrcweir }
106*cdf0e10cSrcweir //__________________________________________________________________________________________________
107*cdf0e10cSrcweir void IdlAttributeFieldImpl::release() throw()
108*cdf0e10cSrcweir {
109*cdf0e10cSrcweir 	IdlMemberImpl::release();
110*cdf0e10cSrcweir }
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir // XTypeProvider
113*cdf0e10cSrcweir //__________________________________________________________________________________________________
114*cdf0e10cSrcweir Sequence< Type > IdlAttributeFieldImpl::getTypes()
115*cdf0e10cSrcweir 	throw (::com::sun::star::uno::RuntimeException)
116*cdf0e10cSrcweir {
117*cdf0e10cSrcweir 	static OTypeCollection * s_pTypes = 0;
118*cdf0e10cSrcweir 	if (! s_pTypes)
119*cdf0e10cSrcweir 	{
120*cdf0e10cSrcweir 		MutexGuard aGuard( getMutexAccess() );
121*cdf0e10cSrcweir 		if (! s_pTypes)
122*cdf0e10cSrcweir 		{
123*cdf0e10cSrcweir 			static OTypeCollection s_aTypes(
124*cdf0e10cSrcweir 				::getCppuType( (const Reference< XIdlField2 > *)0 ),
125*cdf0e10cSrcweir 				::getCppuType( (const Reference< XIdlField > *)0 ),
126*cdf0e10cSrcweir 				IdlMemberImpl::getTypes() );
127*cdf0e10cSrcweir 			s_pTypes = &s_aTypes;
128*cdf0e10cSrcweir 		}
129*cdf0e10cSrcweir 	}
130*cdf0e10cSrcweir 	return s_pTypes->getTypes();
131*cdf0e10cSrcweir }
132*cdf0e10cSrcweir //__________________________________________________________________________________________________
133*cdf0e10cSrcweir Sequence< sal_Int8 > IdlAttributeFieldImpl::getImplementationId()
134*cdf0e10cSrcweir 	throw (::com::sun::star::uno::RuntimeException)
135*cdf0e10cSrcweir {
136*cdf0e10cSrcweir 	static OImplementationId * s_pId = 0;
137*cdf0e10cSrcweir 	if (! s_pId)
138*cdf0e10cSrcweir 	{
139*cdf0e10cSrcweir 		MutexGuard aGuard( getMutexAccess() );
140*cdf0e10cSrcweir 		if (! s_pId)
141*cdf0e10cSrcweir 		{
142*cdf0e10cSrcweir 			static OImplementationId s_aId;
143*cdf0e10cSrcweir 			s_pId = &s_aId;
144*cdf0e10cSrcweir 		}
145*cdf0e10cSrcweir 	}
146*cdf0e10cSrcweir 	return s_pId->getImplementationId();
147*cdf0e10cSrcweir }
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir // XIdlMember
150*cdf0e10cSrcweir //__________________________________________________________________________________________________
151*cdf0e10cSrcweir Reference< XIdlClass > IdlAttributeFieldImpl::getDeclaringClass()
152*cdf0e10cSrcweir 	throw(::com::sun::star::uno::RuntimeException)
153*cdf0e10cSrcweir {
154*cdf0e10cSrcweir 	if (! _xDeclClass.is())
155*cdf0e10cSrcweir 	{
156*cdf0e10cSrcweir 		MutexGuard aGuard( getMutexAccess() );
157*cdf0e10cSrcweir 		if (! _xDeclClass.is())
158*cdf0e10cSrcweir 		{
159*cdf0e10cSrcweir             rtl::OUString aName(getAttributeTypeDescr()->aBase.aBase.pTypeName);
160*cdf0e10cSrcweir             sal_Int32 i = aName.indexOf(':');
161*cdf0e10cSrcweir             OSL_ASSERT(i >= 0);
162*cdf0e10cSrcweir             _xDeclClass = getReflection()->forName(aName.copy(0, i));
163*cdf0e10cSrcweir 		}
164*cdf0e10cSrcweir 	}
165*cdf0e10cSrcweir 	return _xDeclClass;
166*cdf0e10cSrcweir }
167*cdf0e10cSrcweir //__________________________________________________________________________________________________
168*cdf0e10cSrcweir OUString IdlAttributeFieldImpl::getName()
169*cdf0e10cSrcweir 	throw(::com::sun::star::uno::RuntimeException)
170*cdf0e10cSrcweir {
171*cdf0e10cSrcweir 	return IdlMemberImpl::getName();
172*cdf0e10cSrcweir }
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir // XIdlField
175*cdf0e10cSrcweir //__________________________________________________________________________________________________
176*cdf0e10cSrcweir Reference< XIdlClass > IdlAttributeFieldImpl::getType()
177*cdf0e10cSrcweir 	throw(::com::sun::star::uno::RuntimeException)
178*cdf0e10cSrcweir {
179*cdf0e10cSrcweir 	return getReflection()->forType(
180*cdf0e10cSrcweir         getAttributeTypeDescr()->pAttributeTypeRef );
181*cdf0e10cSrcweir }
182*cdf0e10cSrcweir //__________________________________________________________________________________________________
183*cdf0e10cSrcweir FieldAccessMode IdlAttributeFieldImpl::getAccessMode()
184*cdf0e10cSrcweir 	throw(::com::sun::star::uno::RuntimeException)
185*cdf0e10cSrcweir {
186*cdf0e10cSrcweir     return (((typelib_InterfaceAttributeTypeDescription *)getAttributeTypeDescr())->bReadOnly
187*cdf0e10cSrcweir 			? FieldAccessMode_READONLY : FieldAccessMode_READWRITE);
188*cdf0e10cSrcweir }
189*cdf0e10cSrcweir //__________________________________________________________________________________________________
190*cdf0e10cSrcweir Any IdlAttributeFieldImpl::get( const Any & rObj )
191*cdf0e10cSrcweir 	throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
192*cdf0e10cSrcweir {
193*cdf0e10cSrcweir 	uno_Interface * pUnoI = getReflection()->mapToUno(
194*cdf0e10cSrcweir         rObj, (typelib_InterfaceTypeDescription *)getDeclTypeDescr() );
195*cdf0e10cSrcweir 	OSL_ENSURE( pUnoI, "### illegal destination object given!" );
196*cdf0e10cSrcweir 	if (pUnoI)
197*cdf0e10cSrcweir 	{
198*cdf0e10cSrcweir 		TypeDescription aTD( getAttributeTypeDescr()->pAttributeTypeRef );
199*cdf0e10cSrcweir 		typelib_TypeDescription * pTD = aTD.get();
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir 		uno_Any aExc;
202*cdf0e10cSrcweir 		uno_Any * pExc = &aExc;
203*cdf0e10cSrcweir 		void * pReturn = alloca( pTD->nSize );
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir 		(*pUnoI->pDispatcher)( pUnoI, getTypeDescr(), pReturn, 0, &pExc );
206*cdf0e10cSrcweir 		(*pUnoI->release)( pUnoI );
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir         checkException(
209*cdf0e10cSrcweir             pExc,
210*cdf0e10cSrcweir             *static_cast< Reference< XInterface > const * >(rObj.getValue()));
211*cdf0e10cSrcweir 		Any aRet;
212*cdf0e10cSrcweir         uno_any_destruct(
213*cdf0e10cSrcweir             &aRet, reinterpret_cast< uno_ReleaseFunc >(cpp_release) );
214*cdf0e10cSrcweir         uno_any_constructAndConvert( &aRet, pReturn, pTD, getReflection()->getUno2Cpp().get() );
215*cdf0e10cSrcweir         uno_destructData( pReturn, pTD, 0 );
216*cdf0e10cSrcweir 		return aRet;
217*cdf0e10cSrcweir 	}
218*cdf0e10cSrcweir 	throw IllegalArgumentException(
219*cdf0e10cSrcweir 		OUString( RTL_CONSTASCII_USTRINGPARAM("illegal object given!") ),
220*cdf0e10cSrcweir 		(XWeak *)(OWeakObject *)this, 0 );
221*cdf0e10cSrcweir }
222*cdf0e10cSrcweir //__________________________________________________________________________________________________
223*cdf0e10cSrcweir void IdlAttributeFieldImpl::set( Any & rObj, const Any & rValue )
224*cdf0e10cSrcweir 	throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException)
225*cdf0e10cSrcweir {
226*cdf0e10cSrcweir 	if (getAttributeTypeDescr()->bReadOnly)
227*cdf0e10cSrcweir 	{
228*cdf0e10cSrcweir 		throw IllegalAccessException(
229*cdf0e10cSrcweir 			OUString( RTL_CONSTASCII_USTRINGPARAM("cannot set readonly attribute!") ),
230*cdf0e10cSrcweir 			(XWeak *)(OWeakObject *)this );
231*cdf0e10cSrcweir 	}
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir 	uno_Interface * pUnoI = getReflection()->mapToUno(
234*cdf0e10cSrcweir         rObj, (typelib_InterfaceTypeDescription *)getDeclTypeDescr() );
235*cdf0e10cSrcweir 	OSL_ENSURE( pUnoI, "### illegal destination object given!" );
236*cdf0e10cSrcweir 	if (pUnoI)
237*cdf0e10cSrcweir 	{
238*cdf0e10cSrcweir 		TypeDescription aTD( getAttributeTypeDescr()->pAttributeTypeRef );
239*cdf0e10cSrcweir 		typelib_TypeDescription * pTD = aTD.get();
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir 		// construct uno value to be set
242*cdf0e10cSrcweir 		void * pArgs[1];
243*cdf0e10cSrcweir 		void * pArg = pArgs[0] = alloca( pTD->nSize );
244*cdf0e10cSrcweir 
245*cdf0e10cSrcweir 		sal_Bool bAssign;
246*cdf0e10cSrcweir 		if (pTD->eTypeClass == typelib_TypeClass_ANY)
247*cdf0e10cSrcweir 		{
248*cdf0e10cSrcweir 			uno_copyAndConvertData( pArg, SAL_CONST_CAST( Any *, &rValue ),
249*cdf0e10cSrcweir 									pTD, getReflection()->getCpp2Uno().get() );
250*cdf0e10cSrcweir 			bAssign = sal_True;
251*cdf0e10cSrcweir 		}
252*cdf0e10cSrcweir 		else if (typelib_typedescriptionreference_equals( rValue.getValueTypeRef(), pTD->pWeakRef ))
253*cdf0e10cSrcweir 		{
254*cdf0e10cSrcweir 			uno_copyAndConvertData( pArg, SAL_CONST_CAST( void *, rValue.getValue() ),
255*cdf0e10cSrcweir 									pTD, getReflection()->getCpp2Uno().get() );
256*cdf0e10cSrcweir 			bAssign = sal_True;
257*cdf0e10cSrcweir 		}
258*cdf0e10cSrcweir 		else if (pTD->eTypeClass == typelib_TypeClass_INTERFACE)
259*cdf0e10cSrcweir 		{
260*cdf0e10cSrcweir 			Reference< XInterface > xObj;
261*cdf0e10cSrcweir             bAssign = extract(
262*cdf0e10cSrcweir                 rValue, (typelib_InterfaceTypeDescription *)pTD, xObj,
263*cdf0e10cSrcweir                 getReflection() );
264*cdf0e10cSrcweir 			if (bAssign)
265*cdf0e10cSrcweir 			{
266*cdf0e10cSrcweir 				*(void **)pArg = getReflection()->getCpp2Uno().mapInterface(
267*cdf0e10cSrcweir 					xObj.get(), (typelib_InterfaceTypeDescription *)pTD );
268*cdf0e10cSrcweir 			}
269*cdf0e10cSrcweir 		}
270*cdf0e10cSrcweir 		else
271*cdf0e10cSrcweir 		{
272*cdf0e10cSrcweir 			typelib_TypeDescription * pValueTD = 0;
273*cdf0e10cSrcweir 			TYPELIB_DANGER_GET( &pValueTD, rValue.getValueTypeRef() );
274*cdf0e10cSrcweir 			// construct temp uno val to do proper assignment: todo opt
275*cdf0e10cSrcweir 			void * pTemp = alloca( pValueTD->nSize );
276*cdf0e10cSrcweir 			uno_copyAndConvertData(
277*cdf0e10cSrcweir 				pTemp, (void *)rValue.getValue(), pValueTD, getReflection()->getCpp2Uno().get() );
278*cdf0e10cSrcweir 			uno_constructData(
279*cdf0e10cSrcweir 				pArg, pTD );
280*cdf0e10cSrcweir 			// assignment does simple conversion
281*cdf0e10cSrcweir 			bAssign = uno_assignData(
282*cdf0e10cSrcweir 				pArg, pTD, pTemp, pValueTD, 0, 0, 0 );
283*cdf0e10cSrcweir 			uno_destructData(
284*cdf0e10cSrcweir 				pTemp, pValueTD, 0 );
285*cdf0e10cSrcweir 			TYPELIB_DANGER_RELEASE( pValueTD );
286*cdf0e10cSrcweir 		}
287*cdf0e10cSrcweir 
288*cdf0e10cSrcweir 		if (bAssign)
289*cdf0e10cSrcweir 		{
290*cdf0e10cSrcweir 			uno_Any aExc;
291*cdf0e10cSrcweir 			uno_Any * pExc = &aExc;
292*cdf0e10cSrcweir 			(*pUnoI->pDispatcher)( pUnoI, getTypeDescr(), 0, pArgs, &pExc );
293*cdf0e10cSrcweir 			(*pUnoI->release)( pUnoI );
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir 			uno_destructData( pArg, pTD, 0 );
296*cdf0e10cSrcweir             checkException(
297*cdf0e10cSrcweir                 pExc,
298*cdf0e10cSrcweir                 *static_cast< Reference< XInterface > const * >(
299*cdf0e10cSrcweir                     rObj.getValue()));
300*cdf0e10cSrcweir 			return;
301*cdf0e10cSrcweir 		}
302*cdf0e10cSrcweir 		(*pUnoI->release)( pUnoI );
303*cdf0e10cSrcweir 
304*cdf0e10cSrcweir 		throw IllegalArgumentException(
305*cdf0e10cSrcweir 			OUString( RTL_CONSTASCII_USTRINGPARAM("illegal value given!") ),
306*cdf0e10cSrcweir 			*(const Reference< XInterface > *)rObj.getValue(), 1 );
307*cdf0e10cSrcweir 	}
308*cdf0e10cSrcweir 	throw IllegalArgumentException(
309*cdf0e10cSrcweir 		OUString( RTL_CONSTASCII_USTRINGPARAM("illegal destination object given!") ),
310*cdf0e10cSrcweir 		(XWeak *)(OWeakObject *)this, 0 );
311*cdf0e10cSrcweir }
312*cdf0e10cSrcweir //__________________________________________________________________________________________________
313*cdf0e10cSrcweir void IdlAttributeFieldImpl::set( const Any & rObj, const Any & rValue )
314*cdf0e10cSrcweir 	throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException)
315*cdf0e10cSrcweir {
316*cdf0e10cSrcweir     IdlAttributeFieldImpl::set( const_cast< Any & >( rObj ), rValue );
317*cdf0e10cSrcweir }
318*cdf0e10cSrcweir 
319*cdf0e10cSrcweir void IdlAttributeFieldImpl::checkException(
320*cdf0e10cSrcweir     uno_Any * exception, Reference< XInterface > const & context)
321*cdf0e10cSrcweir {
322*cdf0e10cSrcweir     if (exception != 0) {
323*cdf0e10cSrcweir         Any e;
324*cdf0e10cSrcweir         uno_any_destruct(&e, reinterpret_cast< uno_ReleaseFunc >(cpp_release));
325*cdf0e10cSrcweir         uno_type_any_constructAndConvert(
326*cdf0e10cSrcweir             &e, exception->pData, exception->pType,
327*cdf0e10cSrcweir             getReflection()->getUno2Cpp().get());
328*cdf0e10cSrcweir         uno_any_destruct(exception, 0);
329*cdf0e10cSrcweir         if (e.isExtractableTo(
330*cdf0e10cSrcweir                 getCppuType(static_cast< RuntimeException const * >(0))))
331*cdf0e10cSrcweir         {
332*cdf0e10cSrcweir             cppu::throwException(e);
333*cdf0e10cSrcweir         } else {
334*cdf0e10cSrcweir             throw WrappedTargetRuntimeException(
335*cdf0e10cSrcweir                 OUString(
336*cdf0e10cSrcweir                     RTL_CONSTASCII_USTRINGPARAM(
337*cdf0e10cSrcweir                         "non-RuntimeException occured when accessing an"
338*cdf0e10cSrcweir                         " interface type attribute")),
339*cdf0e10cSrcweir                 context, e);
340*cdf0e10cSrcweir         }
341*cdf0e10cSrcweir     }
342*cdf0e10cSrcweir }
343*cdf0e10cSrcweir 
344*cdf0e10cSrcweir //##################################################################################################
345*cdf0e10cSrcweir //##################################################################################################
346*cdf0e10cSrcweir //##################################################################################################
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir 
349*cdf0e10cSrcweir //==================================================================================================
350*cdf0e10cSrcweir class IdlInterfaceMethodImpl
351*cdf0e10cSrcweir 	: public IdlMemberImpl
352*cdf0e10cSrcweir 	, public XIdlMethod
353*cdf0e10cSrcweir {
354*cdf0e10cSrcweir 	Sequence< Reference< XIdlClass > > * _pExceptionTypes;
355*cdf0e10cSrcweir 	Sequence< Reference< XIdlClass > > * _pParamTypes;
356*cdf0e10cSrcweir 	Sequence< ParamInfo > *				 _pParamInfos;
357*cdf0e10cSrcweir 
358*cdf0e10cSrcweir public:
359*cdf0e10cSrcweir 	typelib_InterfaceMethodTypeDescription * getMethodTypeDescr()
360*cdf0e10cSrcweir 		{ return (typelib_InterfaceMethodTypeDescription *)getTypeDescr(); }
361*cdf0e10cSrcweir 
362*cdf0e10cSrcweir 	IdlInterfaceMethodImpl( IdlReflectionServiceImpl * pReflection, const OUString & rName,
363*cdf0e10cSrcweir 							typelib_TypeDescription * pTypeDescr, typelib_TypeDescription * pDeclTypeDescr )
364*cdf0e10cSrcweir 		: IdlMemberImpl( pReflection, rName, pTypeDescr, pDeclTypeDescr )
365*cdf0e10cSrcweir 		, _pExceptionTypes( 0 )
366*cdf0e10cSrcweir 		, _pParamTypes( 0 )
367*cdf0e10cSrcweir 		, _pParamInfos( 0 )
368*cdf0e10cSrcweir 		{}
369*cdf0e10cSrcweir 	virtual ~IdlInterfaceMethodImpl();
370*cdf0e10cSrcweir 
371*cdf0e10cSrcweir 	// XInterface
372*cdf0e10cSrcweir 	virtual Any SAL_CALL queryInterface( const Type & rType ) throw(::com::sun::star::uno::RuntimeException);
373*cdf0e10cSrcweir 	virtual void SAL_CALL acquire() throw();
374*cdf0e10cSrcweir 	virtual void SAL_CALL release() throw();
375*cdf0e10cSrcweir 
376*cdf0e10cSrcweir 	// XTypeProvider
377*cdf0e10cSrcweir 	virtual Sequence< Type > SAL_CALL getTypes() throw (::com::sun::star::uno::RuntimeException);
378*cdf0e10cSrcweir 	virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (::com::sun::star::uno::RuntimeException);
379*cdf0e10cSrcweir 
380*cdf0e10cSrcweir 	// XIdlMember
381*cdf0e10cSrcweir     virtual Reference< XIdlClass > SAL_CALL getDeclaringClass() throw(::com::sun::star::uno::RuntimeException);
382*cdf0e10cSrcweir     virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException);
383*cdf0e10cSrcweir 	// XIdlMethod
384*cdf0e10cSrcweir     virtual Reference< XIdlClass > SAL_CALL getReturnType() throw(::com::sun::star::uno::RuntimeException);
385*cdf0e10cSrcweir     virtual Sequence< Reference< XIdlClass > > SAL_CALL getParameterTypes() throw(::com::sun::star::uno::RuntimeException);
386*cdf0e10cSrcweir     virtual Sequence< ParamInfo > SAL_CALL getParameterInfos() throw(::com::sun::star::uno::RuntimeException);
387*cdf0e10cSrcweir     virtual Sequence< Reference< XIdlClass > > SAL_CALL getExceptionTypes() throw(::com::sun::star::uno::RuntimeException);
388*cdf0e10cSrcweir     virtual MethodMode SAL_CALL getMode() throw(::com::sun::star::uno::RuntimeException);
389*cdf0e10cSrcweir     virtual Any SAL_CALL invoke( const Any & rObj, Sequence< Any > & rArgs ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::reflection::InvocationTargetException, ::com::sun::star::uno::RuntimeException);
390*cdf0e10cSrcweir };
391*cdf0e10cSrcweir //__________________________________________________________________________________________________
392*cdf0e10cSrcweir IdlInterfaceMethodImpl::~IdlInterfaceMethodImpl()
393*cdf0e10cSrcweir {
394*cdf0e10cSrcweir 	delete _pParamInfos;
395*cdf0e10cSrcweir 	delete _pParamTypes;
396*cdf0e10cSrcweir 	delete _pExceptionTypes;
397*cdf0e10cSrcweir }
398*cdf0e10cSrcweir 
399*cdf0e10cSrcweir // XInterface
400*cdf0e10cSrcweir //__________________________________________________________________________________________________
401*cdf0e10cSrcweir Any IdlInterfaceMethodImpl::queryInterface( const Type & rType )
402*cdf0e10cSrcweir 	throw(::com::sun::star::uno::RuntimeException)
403*cdf0e10cSrcweir {
404*cdf0e10cSrcweir 	Any aRet( ::cppu::queryInterface( rType, static_cast< XIdlMethod * >( this ) ) );
405*cdf0e10cSrcweir 	return (aRet.hasValue() ? aRet : IdlMemberImpl::queryInterface( rType ));
406*cdf0e10cSrcweir }
407*cdf0e10cSrcweir //__________________________________________________________________________________________________
408*cdf0e10cSrcweir void IdlInterfaceMethodImpl::acquire() throw()
409*cdf0e10cSrcweir {
410*cdf0e10cSrcweir 	IdlMemberImpl::acquire();
411*cdf0e10cSrcweir }
412*cdf0e10cSrcweir //__________________________________________________________________________________________________
413*cdf0e10cSrcweir void IdlInterfaceMethodImpl::release() throw()
414*cdf0e10cSrcweir {
415*cdf0e10cSrcweir 	IdlMemberImpl::release();
416*cdf0e10cSrcweir }
417*cdf0e10cSrcweir 
418*cdf0e10cSrcweir // XTypeProvider
419*cdf0e10cSrcweir //__________________________________________________________________________________________________
420*cdf0e10cSrcweir Sequence< Type > IdlInterfaceMethodImpl::getTypes()
421*cdf0e10cSrcweir 	throw (::com::sun::star::uno::RuntimeException)
422*cdf0e10cSrcweir {
423*cdf0e10cSrcweir 	static OTypeCollection * s_pTypes = 0;
424*cdf0e10cSrcweir 	if (! s_pTypes)
425*cdf0e10cSrcweir 	{
426*cdf0e10cSrcweir 		MutexGuard aGuard( getMutexAccess() );
427*cdf0e10cSrcweir 		if (! s_pTypes)
428*cdf0e10cSrcweir 		{
429*cdf0e10cSrcweir 			static OTypeCollection s_aTypes(
430*cdf0e10cSrcweir 				::getCppuType( (const Reference< XIdlMethod > *)0 ),
431*cdf0e10cSrcweir 				IdlMemberImpl::getTypes() );
432*cdf0e10cSrcweir 			s_pTypes = &s_aTypes;
433*cdf0e10cSrcweir 		}
434*cdf0e10cSrcweir 	}
435*cdf0e10cSrcweir 	return s_pTypes->getTypes();
436*cdf0e10cSrcweir }
437*cdf0e10cSrcweir //__________________________________________________________________________________________________
438*cdf0e10cSrcweir Sequence< sal_Int8 > IdlInterfaceMethodImpl::getImplementationId()
439*cdf0e10cSrcweir 	throw (::com::sun::star::uno::RuntimeException)
440*cdf0e10cSrcweir {
441*cdf0e10cSrcweir 	static OImplementationId * s_pId = 0;
442*cdf0e10cSrcweir 	if (! s_pId)
443*cdf0e10cSrcweir 	{
444*cdf0e10cSrcweir 		MutexGuard aGuard( getMutexAccess() );
445*cdf0e10cSrcweir 		if (! s_pId)
446*cdf0e10cSrcweir 		{
447*cdf0e10cSrcweir 			static OImplementationId s_aId;
448*cdf0e10cSrcweir 			s_pId = &s_aId;
449*cdf0e10cSrcweir 		}
450*cdf0e10cSrcweir 	}
451*cdf0e10cSrcweir 	return s_pId->getImplementationId();
452*cdf0e10cSrcweir }
453*cdf0e10cSrcweir 
454*cdf0e10cSrcweir // XIdlMember
455*cdf0e10cSrcweir //__________________________________________________________________________________________________
456*cdf0e10cSrcweir Reference< XIdlClass > IdlInterfaceMethodImpl::getDeclaringClass()
457*cdf0e10cSrcweir 	throw(::com::sun::star::uno::RuntimeException)
458*cdf0e10cSrcweir {
459*cdf0e10cSrcweir 	if (! _xDeclClass.is())
460*cdf0e10cSrcweir 	{
461*cdf0e10cSrcweir 		MutexGuard aGuard( getMutexAccess() );
462*cdf0e10cSrcweir 		if (! _xDeclClass.is())
463*cdf0e10cSrcweir 		{
464*cdf0e10cSrcweir             rtl::OUString aName(getMethodTypeDescr()->aBase.aBase.pTypeName);
465*cdf0e10cSrcweir             sal_Int32 i = aName.indexOf(':');
466*cdf0e10cSrcweir             OSL_ASSERT(i >= 0);
467*cdf0e10cSrcweir             _xDeclClass = getReflection()->forName(aName.copy(0, i));
468*cdf0e10cSrcweir 		}
469*cdf0e10cSrcweir 	}
470*cdf0e10cSrcweir 	return _xDeclClass;
471*cdf0e10cSrcweir }
472*cdf0e10cSrcweir //__________________________________________________________________________________________________
473*cdf0e10cSrcweir OUString IdlInterfaceMethodImpl::getName()
474*cdf0e10cSrcweir 	throw(::com::sun::star::uno::RuntimeException)
475*cdf0e10cSrcweir {
476*cdf0e10cSrcweir 	return IdlMemberImpl::getName();
477*cdf0e10cSrcweir }
478*cdf0e10cSrcweir 
479*cdf0e10cSrcweir // XIdlMethod
480*cdf0e10cSrcweir //__________________________________________________________________________________________________
481*cdf0e10cSrcweir Reference< XIdlClass > SAL_CALL IdlInterfaceMethodImpl::getReturnType()
482*cdf0e10cSrcweir 	throw(::com::sun::star::uno::RuntimeException)
483*cdf0e10cSrcweir {
484*cdf0e10cSrcweir 	return getReflection()->forType( getMethodTypeDescr()->pReturnTypeRef );
485*cdf0e10cSrcweir }
486*cdf0e10cSrcweir //__________________________________________________________________________________________________
487*cdf0e10cSrcweir Sequence< Reference< XIdlClass > > IdlInterfaceMethodImpl::getExceptionTypes()
488*cdf0e10cSrcweir 	throw(::com::sun::star::uno::RuntimeException)
489*cdf0e10cSrcweir {
490*cdf0e10cSrcweir 	if (! _pExceptionTypes)
491*cdf0e10cSrcweir 	{
492*cdf0e10cSrcweir 		MutexGuard aGuard( getMutexAccess() );
493*cdf0e10cSrcweir 		if (! _pExceptionTypes)
494*cdf0e10cSrcweir 		{
495*cdf0e10cSrcweir 			sal_Int32 nExc = getMethodTypeDescr()->nExceptions;
496*cdf0e10cSrcweir 			Sequence< Reference< XIdlClass > > * pTempExceptionTypes =
497*cdf0e10cSrcweir 				new Sequence< Reference< XIdlClass > >( nExc );
498*cdf0e10cSrcweir 			Reference< XIdlClass > * pExceptionTypes = pTempExceptionTypes->getArray();
499*cdf0e10cSrcweir 
500*cdf0e10cSrcweir 			typelib_TypeDescriptionReference ** ppExc =
501*cdf0e10cSrcweir                 getMethodTypeDescr()->ppExceptions;
502*cdf0e10cSrcweir 			IdlReflectionServiceImpl * pRefl = getReflection();
503*cdf0e10cSrcweir 
504*cdf0e10cSrcweir 			while (nExc--)
505*cdf0e10cSrcweir 				pExceptionTypes[nExc] = pRefl->forType( ppExc[nExc] );
506*cdf0e10cSrcweir 
507*cdf0e10cSrcweir 			_pExceptionTypes = pTempExceptionTypes;
508*cdf0e10cSrcweir 		}
509*cdf0e10cSrcweir 	}
510*cdf0e10cSrcweir 	return *_pExceptionTypes;
511*cdf0e10cSrcweir }
512*cdf0e10cSrcweir //__________________________________________________________________________________________________
513*cdf0e10cSrcweir Sequence< Reference< XIdlClass > > IdlInterfaceMethodImpl::getParameterTypes()
514*cdf0e10cSrcweir 	throw(::com::sun::star::uno::RuntimeException)
515*cdf0e10cSrcweir {
516*cdf0e10cSrcweir 	if (! _pParamTypes)
517*cdf0e10cSrcweir 	{
518*cdf0e10cSrcweir 		MutexGuard aGuard( getMutexAccess() );
519*cdf0e10cSrcweir 		if (! _pParamTypes)
520*cdf0e10cSrcweir 		{
521*cdf0e10cSrcweir 			sal_Int32 nParams = getMethodTypeDescr()->nParams;
522*cdf0e10cSrcweir 			Sequence< Reference< XIdlClass > > * pTempParamTypes =
523*cdf0e10cSrcweir 				new Sequence< Reference< XIdlClass > >( nParams );
524*cdf0e10cSrcweir 			Reference< XIdlClass > * pParamTypes = pTempParamTypes->getArray();
525*cdf0e10cSrcweir 
526*cdf0e10cSrcweir 			typelib_MethodParameter * pTypelibParams =
527*cdf0e10cSrcweir                 getMethodTypeDescr()->pParams;
528*cdf0e10cSrcweir 			IdlReflectionServiceImpl * pRefl = getReflection();
529*cdf0e10cSrcweir 
530*cdf0e10cSrcweir 			while (nParams--)
531*cdf0e10cSrcweir 				pParamTypes[nParams] = pRefl->forType( pTypelibParams[nParams].pTypeRef );
532*cdf0e10cSrcweir 
533*cdf0e10cSrcweir 			_pParamTypes = pTempParamTypes;
534*cdf0e10cSrcweir 		}
535*cdf0e10cSrcweir 	}
536*cdf0e10cSrcweir 	return *_pParamTypes;
537*cdf0e10cSrcweir }
538*cdf0e10cSrcweir //__________________________________________________________________________________________________
539*cdf0e10cSrcweir Sequence< ParamInfo > IdlInterfaceMethodImpl::getParameterInfos()
540*cdf0e10cSrcweir 	throw(::com::sun::star::uno::RuntimeException)
541*cdf0e10cSrcweir {
542*cdf0e10cSrcweir 	if (! _pParamInfos)
543*cdf0e10cSrcweir 	{
544*cdf0e10cSrcweir 		MutexGuard aGuard( getMutexAccess() );
545*cdf0e10cSrcweir 		if (! _pParamInfos)
546*cdf0e10cSrcweir 		{
547*cdf0e10cSrcweir 			sal_Int32 nParams = getMethodTypeDescr()->nParams;
548*cdf0e10cSrcweir 			Sequence< ParamInfo > * pTempParamInfos = new Sequence< ParamInfo >( nParams );
549*cdf0e10cSrcweir 			ParamInfo * pParamInfos = pTempParamInfos->getArray();
550*cdf0e10cSrcweir 
551*cdf0e10cSrcweir 			typelib_MethodParameter * pTypelibParams =
552*cdf0e10cSrcweir                 getMethodTypeDescr()->pParams;
553*cdf0e10cSrcweir 
554*cdf0e10cSrcweir 			if (_pParamTypes) // use param types
555*cdf0e10cSrcweir 			{
556*cdf0e10cSrcweir 				const Reference< XIdlClass > * pParamTypes = _pParamTypes->getConstArray();
557*cdf0e10cSrcweir 
558*cdf0e10cSrcweir 				while (nParams--)
559*cdf0e10cSrcweir 				{
560*cdf0e10cSrcweir 					const typelib_MethodParameter & rParam = pTypelibParams[nParams];
561*cdf0e10cSrcweir 					ParamInfo & rInfo = pParamInfos[nParams];
562*cdf0e10cSrcweir 					rInfo.aName = rParam.pName;
563*cdf0e10cSrcweir 					if (rParam.bIn)
564*cdf0e10cSrcweir 						rInfo.aMode = (rParam.bOut ? ParamMode_INOUT : ParamMode_IN);
565*cdf0e10cSrcweir 					else
566*cdf0e10cSrcweir 						rInfo.aMode = ParamMode_OUT;
567*cdf0e10cSrcweir 					rInfo.aType = pParamTypes[nParams];
568*cdf0e10cSrcweir 				}
569*cdf0e10cSrcweir 			}
570*cdf0e10cSrcweir 			else // make also param types sequence if not already initialized
571*cdf0e10cSrcweir 			{
572*cdf0e10cSrcweir 				Sequence< Reference< XIdlClass > > * pTempParamTypes =
573*cdf0e10cSrcweir 					new Sequence< Reference< XIdlClass > >( nParams );
574*cdf0e10cSrcweir 				Reference< XIdlClass > * pParamTypes = pTempParamTypes->getArray();
575*cdf0e10cSrcweir 
576*cdf0e10cSrcweir 				IdlReflectionServiceImpl * pRefl = getReflection();
577*cdf0e10cSrcweir 
578*cdf0e10cSrcweir 				while (nParams--)
579*cdf0e10cSrcweir 				{
580*cdf0e10cSrcweir 					const typelib_MethodParameter & rParam = pTypelibParams[nParams];
581*cdf0e10cSrcweir 					ParamInfo & rInfo = pParamInfos[nParams];
582*cdf0e10cSrcweir 					rInfo.aName = rParam.pName;
583*cdf0e10cSrcweir 					if (rParam.bIn)
584*cdf0e10cSrcweir 						rInfo.aMode = (rParam.bOut ? ParamMode_INOUT : ParamMode_IN);
585*cdf0e10cSrcweir 					else
586*cdf0e10cSrcweir 						rInfo.aMode = ParamMode_OUT;
587*cdf0e10cSrcweir 					rInfo.aType = pParamTypes[nParams] = pRefl->forType( rParam.pTypeRef );
588*cdf0e10cSrcweir 				}
589*cdf0e10cSrcweir 
590*cdf0e10cSrcweir 				_pParamTypes = pTempParamTypes;
591*cdf0e10cSrcweir 			}
592*cdf0e10cSrcweir 
593*cdf0e10cSrcweir 			_pParamInfos = pTempParamInfos;
594*cdf0e10cSrcweir 		}
595*cdf0e10cSrcweir 	}
596*cdf0e10cSrcweir 	return *_pParamInfos;
597*cdf0e10cSrcweir }
598*cdf0e10cSrcweir //__________________________________________________________________________________________________
599*cdf0e10cSrcweir MethodMode SAL_CALL IdlInterfaceMethodImpl::getMode()
600*cdf0e10cSrcweir 	throw(::com::sun::star::uno::RuntimeException)
601*cdf0e10cSrcweir {
602*cdf0e10cSrcweir 	return
603*cdf0e10cSrcweir         getMethodTypeDescr()->bOneWay ? MethodMode_ONEWAY : MethodMode_TWOWAY;
604*cdf0e10cSrcweir }
605*cdf0e10cSrcweir //__________________________________________________________________________________________________
606*cdf0e10cSrcweir Any SAL_CALL IdlInterfaceMethodImpl::invoke( const Any & rObj, Sequence< Any > & rArgs )
607*cdf0e10cSrcweir 	throw(::com::sun::star::lang::IllegalArgumentException,
608*cdf0e10cSrcweir 		  ::com::sun::star::reflection::InvocationTargetException,
609*cdf0e10cSrcweir 		  ::com::sun::star::uno::RuntimeException)
610*cdf0e10cSrcweir {
611*cdf0e10cSrcweir 	if (rObj.getValueTypeClass() == TypeClass_INTERFACE)
612*cdf0e10cSrcweir 	{
613*cdf0e10cSrcweir 		// acquire()/ release()
614*cdf0e10cSrcweir 		if (rtl_ustr_ascii_compare( getTypeDescr()->pTypeName->buffer,
615*cdf0e10cSrcweir 									"com.sun.star.uno.XInterface::acquire" ) == 0)
616*cdf0e10cSrcweir 		{
617*cdf0e10cSrcweir 			(*(const Reference< XInterface > *)rObj.getValue())->acquire();
618*cdf0e10cSrcweir 			return Any();
619*cdf0e10cSrcweir 		}
620*cdf0e10cSrcweir 		else if (rtl_ustr_ascii_compare( getTypeDescr()->pTypeName->buffer,
621*cdf0e10cSrcweir 										 "com.sun.star.uno.XInterface::release" ) == 0)
622*cdf0e10cSrcweir 		{
623*cdf0e10cSrcweir 			(*(const Reference< XInterface > *)rObj.getValue())->release();
624*cdf0e10cSrcweir 			return Any();
625*cdf0e10cSrcweir 		}
626*cdf0e10cSrcweir 	}
627*cdf0e10cSrcweir 
628*cdf0e10cSrcweir 	uno_Interface * pUnoI = getReflection()->mapToUno(
629*cdf0e10cSrcweir         rObj, (typelib_InterfaceTypeDescription *)getDeclTypeDescr() );
630*cdf0e10cSrcweir 	OSL_ENSURE( pUnoI, "### illegal destination object given!" );
631*cdf0e10cSrcweir 	if (pUnoI)
632*cdf0e10cSrcweir 	{
633*cdf0e10cSrcweir 		sal_Int32 nParams = getMethodTypeDescr()->nParams;
634*cdf0e10cSrcweir 		if (rArgs.getLength() != nParams)
635*cdf0e10cSrcweir 		{
636*cdf0e10cSrcweir 			(*pUnoI->release)( pUnoI );
637*cdf0e10cSrcweir 			throw IllegalArgumentException(
638*cdf0e10cSrcweir 				OUString( RTL_CONSTASCII_USTRINGPARAM("arguments len differ!") ),
639*cdf0e10cSrcweir 				*(const Reference< XInterface > *)rObj.getValue(), 1 );
640*cdf0e10cSrcweir 		}
641*cdf0e10cSrcweir 
642*cdf0e10cSrcweir 		Any * pCppArgs = rArgs.getArray();
643*cdf0e10cSrcweir 		typelib_MethodParameter * pParams = getMethodTypeDescr()->pParams;
644*cdf0e10cSrcweir 		typelib_TypeDescription * pReturnType = 0;
645*cdf0e10cSrcweir 		TYPELIB_DANGER_GET(
646*cdf0e10cSrcweir             &pReturnType, getMethodTypeDescr()->pReturnTypeRef );
647*cdf0e10cSrcweir 
648*cdf0e10cSrcweir 		void * pUnoReturn = alloca( pReturnType->nSize );
649*cdf0e10cSrcweir 		void ** ppUnoArgs = (void **)alloca( sizeof(void *) * nParams *2 );
650*cdf0e10cSrcweir 		typelib_TypeDescription ** ppParamTypes = (typelib_TypeDescription **)(ppUnoArgs + nParams);
651*cdf0e10cSrcweir 
652*cdf0e10cSrcweir 		// convert arguments
653*cdf0e10cSrcweir 		for ( sal_Int32 nPos = 0; nPos < nParams; ++nPos )
654*cdf0e10cSrcweir 		{
655*cdf0e10cSrcweir 			ppParamTypes[nPos] = 0;
656*cdf0e10cSrcweir 			TYPELIB_DANGER_GET( ppParamTypes + nPos, pParams[nPos].pTypeRef );
657*cdf0e10cSrcweir 			typelib_TypeDescription * pTD = ppParamTypes[nPos];
658*cdf0e10cSrcweir 
659*cdf0e10cSrcweir 			ppUnoArgs[nPos] = alloca( pTD->nSize );
660*cdf0e10cSrcweir 			if (pParams[nPos].bIn)
661*cdf0e10cSrcweir 			{
662*cdf0e10cSrcweir 				sal_Bool bAssign;
663*cdf0e10cSrcweir 				if (typelib_typedescriptionreference_equals(
664*cdf0e10cSrcweir                         pCppArgs[nPos].getValueTypeRef(), pTD->pWeakRef ))
665*cdf0e10cSrcweir 				{
666*cdf0e10cSrcweir 					uno_type_copyAndConvertData(
667*cdf0e10cSrcweir 						ppUnoArgs[nPos], (void *)pCppArgs[nPos].getValue(),
668*cdf0e10cSrcweir 						pCppArgs[nPos].getValueTypeRef(), getReflection()->getCpp2Uno().get() );
669*cdf0e10cSrcweir 					bAssign = sal_True;
670*cdf0e10cSrcweir 				}
671*cdf0e10cSrcweir 				else if (pTD->eTypeClass == typelib_TypeClass_ANY)
672*cdf0e10cSrcweir 				{
673*cdf0e10cSrcweir 					uno_type_any_constructAndConvert(
674*cdf0e10cSrcweir 						(uno_Any *)ppUnoArgs[nPos], (void *)pCppArgs[nPos].getValue(),
675*cdf0e10cSrcweir 						pCppArgs[nPos].getValueTypeRef(), getReflection()->getCpp2Uno().get() );
676*cdf0e10cSrcweir 					bAssign = sal_True;
677*cdf0e10cSrcweir 				}
678*cdf0e10cSrcweir 				else if (pTD->eTypeClass == typelib_TypeClass_INTERFACE)
679*cdf0e10cSrcweir 				{
680*cdf0e10cSrcweir 					Reference< XInterface > xDest;
681*cdf0e10cSrcweir                     bAssign = extract(
682*cdf0e10cSrcweir                         pCppArgs[nPos], (typelib_InterfaceTypeDescription *)pTD,
683*cdf0e10cSrcweir                         xDest, getReflection() );
684*cdf0e10cSrcweir 					if (bAssign)
685*cdf0e10cSrcweir 					{
686*cdf0e10cSrcweir 						*(void **)ppUnoArgs[nPos] = getReflection()->getCpp2Uno().mapInterface(
687*cdf0e10cSrcweir 							xDest.get(), (typelib_InterfaceTypeDescription *)pTD );
688*cdf0e10cSrcweir 					}
689*cdf0e10cSrcweir 				}
690*cdf0e10cSrcweir 				else
691*cdf0e10cSrcweir 				{
692*cdf0e10cSrcweir 					typelib_TypeDescription * pValueTD = 0;
693*cdf0e10cSrcweir 					TYPELIB_DANGER_GET( &pValueTD, pCppArgs[nPos].getValueTypeRef() );
694*cdf0e10cSrcweir 					// construct temp uno val to do proper assignment: todo opt
695*cdf0e10cSrcweir 					void * pTemp = alloca( pValueTD->nSize );
696*cdf0e10cSrcweir 					uno_copyAndConvertData(
697*cdf0e10cSrcweir 						pTemp, (void *)pCppArgs[nPos].getValue(), pValueTD,
698*cdf0e10cSrcweir                         getReflection()->getCpp2Uno().get() );
699*cdf0e10cSrcweir 					uno_constructData(
700*cdf0e10cSrcweir 						ppUnoArgs[nPos], pTD );
701*cdf0e10cSrcweir 					// assignment does simple conversion
702*cdf0e10cSrcweir 					bAssign = uno_assignData(
703*cdf0e10cSrcweir 						ppUnoArgs[nPos], pTD, pTemp, pValueTD, 0, 0, 0 );
704*cdf0e10cSrcweir 					uno_destructData(
705*cdf0e10cSrcweir 						pTemp, pValueTD, 0 );
706*cdf0e10cSrcweir 					TYPELIB_DANGER_RELEASE( pValueTD );
707*cdf0e10cSrcweir 				}
708*cdf0e10cSrcweir 
709*cdf0e10cSrcweir 				if (! bAssign)
710*cdf0e10cSrcweir 				{
711*cdf0e10cSrcweir 					IllegalArgumentException aExc(
712*cdf0e10cSrcweir 						OUString( RTL_CONSTASCII_USTRINGPARAM("cannot coerce argument type during corereflection call!") ),
713*cdf0e10cSrcweir 						*(const Reference< XInterface > *)rObj.getValue(), (sal_Int16)nPos );
714*cdf0e10cSrcweir 
715*cdf0e10cSrcweir 					// cleanup
716*cdf0e10cSrcweir 					while (nPos--)
717*cdf0e10cSrcweir 					{
718*cdf0e10cSrcweir 						if (pParams[nPos].bIn)
719*cdf0e10cSrcweir 							uno_destructData( ppUnoArgs[nPos], ppParamTypes[nPos], 0 );
720*cdf0e10cSrcweir 						TYPELIB_DANGER_RELEASE( ppParamTypes[nPos] );
721*cdf0e10cSrcweir 					}
722*cdf0e10cSrcweir 					TYPELIB_DANGER_RELEASE( pReturnType );
723*cdf0e10cSrcweir 					(*pUnoI->release)( pUnoI );
724*cdf0e10cSrcweir 
725*cdf0e10cSrcweir 					throw aExc;
726*cdf0e10cSrcweir 				}
727*cdf0e10cSrcweir 			}
728*cdf0e10cSrcweir 		}
729*cdf0e10cSrcweir 
730*cdf0e10cSrcweir 		uno_Any aUnoExc;
731*cdf0e10cSrcweir 		uno_Any * pUnoExc = &aUnoExc;
732*cdf0e10cSrcweir 
733*cdf0e10cSrcweir 		(*pUnoI->pDispatcher)(
734*cdf0e10cSrcweir 			pUnoI, getTypeDescr(), pUnoReturn, ppUnoArgs, &pUnoExc );
735*cdf0e10cSrcweir 		(*pUnoI->release)( pUnoI );
736*cdf0e10cSrcweir 
737*cdf0e10cSrcweir 		Any aRet;
738*cdf0e10cSrcweir 		if (pUnoExc)
739*cdf0e10cSrcweir 		{
740*cdf0e10cSrcweir 			// cleanup
741*cdf0e10cSrcweir 			while (nParams--)
742*cdf0e10cSrcweir 			{
743*cdf0e10cSrcweir 				if (pParams[nParams].bIn)
744*cdf0e10cSrcweir 					uno_destructData( ppUnoArgs[nParams], ppParamTypes[nParams], 0 );
745*cdf0e10cSrcweir 				TYPELIB_DANGER_RELEASE( ppParamTypes[nParams] );
746*cdf0e10cSrcweir 			}
747*cdf0e10cSrcweir 			TYPELIB_DANGER_RELEASE( pReturnType );
748*cdf0e10cSrcweir 
749*cdf0e10cSrcweir 			InvocationTargetException aExc;
750*cdf0e10cSrcweir 			aExc.Context = *(const Reference< XInterface > *)rObj.getValue();
751*cdf0e10cSrcweir 			aExc.Message = OUString( RTL_CONSTASCII_USTRINGPARAM("exception occured during invocation!") );
752*cdf0e10cSrcweir 			uno_any_destruct(
753*cdf0e10cSrcweir                 &aExc.TargetException,
754*cdf0e10cSrcweir                 reinterpret_cast< uno_ReleaseFunc >(cpp_release) );
755*cdf0e10cSrcweir 			uno_type_copyAndConvertData(
756*cdf0e10cSrcweir 				&aExc.TargetException, pUnoExc, ::getCppuType( (const Any *)0 ).getTypeLibType(),
757*cdf0e10cSrcweir                 getReflection()->getUno2Cpp().get() );
758*cdf0e10cSrcweir 			uno_any_destruct( pUnoExc, 0 );
759*cdf0e10cSrcweir 			throw aExc;
760*cdf0e10cSrcweir 		}
761*cdf0e10cSrcweir 		else
762*cdf0e10cSrcweir 		{
763*cdf0e10cSrcweir 			// reconvert arguments and cleanup
764*cdf0e10cSrcweir 			while (nParams--)
765*cdf0e10cSrcweir 			{
766*cdf0e10cSrcweir 				if (pParams[nParams].bOut) // write back
767*cdf0e10cSrcweir 				{
768*cdf0e10cSrcweir 					uno_any_destruct(
769*cdf0e10cSrcweir                         &pCppArgs[nParams],
770*cdf0e10cSrcweir                         reinterpret_cast< uno_ReleaseFunc >(cpp_release) );
771*cdf0e10cSrcweir 					uno_any_constructAndConvert(
772*cdf0e10cSrcweir 						&pCppArgs[nParams], ppUnoArgs[nParams], ppParamTypes[nParams],
773*cdf0e10cSrcweir                         getReflection()->getUno2Cpp().get() );
774*cdf0e10cSrcweir 				}
775*cdf0e10cSrcweir 				uno_destructData( ppUnoArgs[nParams], ppParamTypes[nParams], 0 );
776*cdf0e10cSrcweir 				TYPELIB_DANGER_RELEASE( ppParamTypes[nParams] );
777*cdf0e10cSrcweir 			}
778*cdf0e10cSrcweir 			uno_any_destruct(
779*cdf0e10cSrcweir                 &aRet, reinterpret_cast< uno_ReleaseFunc >(cpp_release) );
780*cdf0e10cSrcweir 			uno_any_constructAndConvert(
781*cdf0e10cSrcweir                 &aRet, pUnoReturn, pReturnType,
782*cdf0e10cSrcweir                 getReflection()->getUno2Cpp().get() );
783*cdf0e10cSrcweir 			uno_destructData( pUnoReturn, pReturnType, 0 );
784*cdf0e10cSrcweir 			TYPELIB_DANGER_RELEASE( pReturnType );
785*cdf0e10cSrcweir 		}
786*cdf0e10cSrcweir 		return aRet;
787*cdf0e10cSrcweir 	}
788*cdf0e10cSrcweir 	throw IllegalArgumentException(
789*cdf0e10cSrcweir 		OUString( RTL_CONSTASCII_USTRINGPARAM("illegal destination object given!") ),
790*cdf0e10cSrcweir 		(XWeak *)(OWeakObject *)this, 0 );
791*cdf0e10cSrcweir }
792*cdf0e10cSrcweir 
793*cdf0e10cSrcweir 
794*cdf0e10cSrcweir //##################################################################################################
795*cdf0e10cSrcweir //##################################################################################################
796*cdf0e10cSrcweir //##################################################################################################
797*cdf0e10cSrcweir 
798*cdf0e10cSrcweir 
799*cdf0e10cSrcweir //__________________________________________________________________________________________________
800*cdf0e10cSrcweir InterfaceIdlClassImpl::~InterfaceIdlClassImpl()
801*cdf0e10cSrcweir {
802*cdf0e10cSrcweir 	for ( sal_Int32 nPos = _nMethods + _nAttributes; nPos--; )
803*cdf0e10cSrcweir 		typelib_typedescription_release( _pSortedMemberInit[nPos].second );
804*cdf0e10cSrcweir 
805*cdf0e10cSrcweir 	delete [] _pSortedMemberInit;
806*cdf0e10cSrcweir }
807*cdf0e10cSrcweir 
808*cdf0e10cSrcweir //__________________________________________________________________________________________________
809*cdf0e10cSrcweir Sequence< Reference< XIdlClass > > InterfaceIdlClassImpl::getSuperclasses()
810*cdf0e10cSrcweir 	throw(::com::sun::star::uno::RuntimeException)
811*cdf0e10cSrcweir {
812*cdf0e10cSrcweir     MutexGuard aGuard(getMutexAccess());
813*cdf0e10cSrcweir     if (_xSuperClasses.getLength() == 0) {
814*cdf0e10cSrcweir         typelib_InterfaceTypeDescription * pType = getTypeDescr();
815*cdf0e10cSrcweir         _xSuperClasses.realloc(pType->nBaseTypes);
816*cdf0e10cSrcweir         for (sal_Int32 i = 0; i < pType->nBaseTypes; ++i) {
817*cdf0e10cSrcweir             _xSuperClasses[i] = getReflection()->forType(
818*cdf0e10cSrcweir                 &pType->ppBaseTypes[i]->aBase);
819*cdf0e10cSrcweir             OSL_ASSERT(_xSuperClasses[i].is());
820*cdf0e10cSrcweir         }
821*cdf0e10cSrcweir     }
822*cdf0e10cSrcweir     return Sequence< Reference< XIdlClass > >(_xSuperClasses);
823*cdf0e10cSrcweir }
824*cdf0e10cSrcweir //__________________________________________________________________________________________________
825*cdf0e10cSrcweir void InterfaceIdlClassImpl::initMembers()
826*cdf0e10cSrcweir {
827*cdf0e10cSrcweir 	sal_Int32 nAll = getTypeDescr()->nAllMembers;
828*cdf0e10cSrcweir 	MemberInit * pSortedMemberInit = new MemberInit[nAll];
829*cdf0e10cSrcweir 	typelib_TypeDescriptionReference ** ppAllMembers = getTypeDescr()->ppAllMembers;
830*cdf0e10cSrcweir 
831*cdf0e10cSrcweir 	for ( sal_Int32 nPos = 0; nPos < nAll; ++nPos )
832*cdf0e10cSrcweir 	{
833*cdf0e10cSrcweir 		sal_Int32 nIndex;
834*cdf0e10cSrcweir 		if (ppAllMembers[nPos]->eTypeClass == typelib_TypeClass_INTERFACE_METHOD)
835*cdf0e10cSrcweir 		{
836*cdf0e10cSrcweir 			// methods to front
837*cdf0e10cSrcweir 			nIndex = _nMethods;
838*cdf0e10cSrcweir 			++_nMethods;
839*cdf0e10cSrcweir 		}
840*cdf0e10cSrcweir 		else
841*cdf0e10cSrcweir 		{
842*cdf0e10cSrcweir 			++_nAttributes;
843*cdf0e10cSrcweir 			nIndex = (nAll - _nAttributes);
844*cdf0e10cSrcweir 			// attributes at the back
845*cdf0e10cSrcweir 		}
846*cdf0e10cSrcweir 
847*cdf0e10cSrcweir 		typelib_TypeDescription * pTD = 0;
848*cdf0e10cSrcweir 		typelib_typedescriptionreference_getDescription( &pTD, ppAllMembers[nPos] );
849*cdf0e10cSrcweir 		OSL_ENSURE( pTD, "### cannot get type description!" );
850*cdf0e10cSrcweir 		pSortedMemberInit[nIndex].first = ((typelib_InterfaceMemberTypeDescription *)pTD)->pMemberName;
851*cdf0e10cSrcweir 		pSortedMemberInit[nIndex].second = pTD;
852*cdf0e10cSrcweir 	}
853*cdf0e10cSrcweir 
854*cdf0e10cSrcweir 	_pSortedMemberInit = pSortedMemberInit;
855*cdf0e10cSrcweir }
856*cdf0e10cSrcweir //__________________________________________________________________________________________________
857*cdf0e10cSrcweir sal_Bool InterfaceIdlClassImpl::isAssignableFrom( const Reference< XIdlClass > & xType )
858*cdf0e10cSrcweir 	throw(::com::sun::star::uno::RuntimeException)
859*cdf0e10cSrcweir {
860*cdf0e10cSrcweir 	if (xType.is() && xType->getTypeClass() == TypeClass_INTERFACE)
861*cdf0e10cSrcweir 	{
862*cdf0e10cSrcweir 		if (equals( xType ))
863*cdf0e10cSrcweir 			return sal_True;
864*cdf0e10cSrcweir 		else
865*cdf0e10cSrcweir 		{
866*cdf0e10cSrcweir 			const Sequence< Reference< XIdlClass > > & rSeq = xType->getSuperclasses();
867*cdf0e10cSrcweir             for (sal_Int32 i = 0; i < rSeq.getLength(); ++i) {
868*cdf0e10cSrcweir 				if (isAssignableFrom(rSeq[i])) {
869*cdf0e10cSrcweir                     return true;
870*cdf0e10cSrcweir                 }
871*cdf0e10cSrcweir 			}
872*cdf0e10cSrcweir 		}
873*cdf0e10cSrcweir 	}
874*cdf0e10cSrcweir 	return sal_False;
875*cdf0e10cSrcweir }
876*cdf0e10cSrcweir //__________________________________________________________________________________________________
877*cdf0e10cSrcweir Uik InterfaceIdlClassImpl::getUik()
878*cdf0e10cSrcweir 	throw(::com::sun::star::uno::RuntimeException)
879*cdf0e10cSrcweir {
880*cdf0e10cSrcweir 	return Uik(0, 0, 0, 0, 0);
881*cdf0e10cSrcweir         // Uiks are deprecated and this function must not be called
882*cdf0e10cSrcweir }
883*cdf0e10cSrcweir //__________________________________________________________________________________________________
884*cdf0e10cSrcweir Sequence< Reference< XIdlMethod > > InterfaceIdlClassImpl::getMethods()
885*cdf0e10cSrcweir 	throw(::com::sun::star::uno::RuntimeException)
886*cdf0e10cSrcweir {
887*cdf0e10cSrcweir 	MutexGuard aGuard( getMutexAccess() );
888*cdf0e10cSrcweir 	if (! _pSortedMemberInit)
889*cdf0e10cSrcweir 		initMembers();
890*cdf0e10cSrcweir 
891*cdf0e10cSrcweir 	// create methods sequence
892*cdf0e10cSrcweir 	Sequence< Reference< XIdlMethod > > aRet( _nMethods );
893*cdf0e10cSrcweir 	Reference< XIdlMethod > * pRet = aRet.getArray();
894*cdf0e10cSrcweir 	for ( sal_Int32 nPos = _nMethods; nPos--; )
895*cdf0e10cSrcweir 	{
896*cdf0e10cSrcweir 
897*cdf0e10cSrcweir 		/*_aName2Method[_pSortedMemberInit[nPos].first] = */pRet[nPos] = new IdlInterfaceMethodImpl(
898*cdf0e10cSrcweir 			getReflection(), _pSortedMemberInit[nPos].first,
899*cdf0e10cSrcweir 			_pSortedMemberInit[nPos].second, IdlClassImpl::getTypeDescr() );
900*cdf0e10cSrcweir 	}
901*cdf0e10cSrcweir 	return aRet;
902*cdf0e10cSrcweir }
903*cdf0e10cSrcweir //__________________________________________________________________________________________________
904*cdf0e10cSrcweir Sequence< Reference< XIdlField > > InterfaceIdlClassImpl::getFields()
905*cdf0e10cSrcweir 	throw(::com::sun::star::uno::RuntimeException)
906*cdf0e10cSrcweir {
907*cdf0e10cSrcweir 	MutexGuard aGuard( getMutexAccess() );
908*cdf0e10cSrcweir 	if (! _pSortedMemberInit)
909*cdf0e10cSrcweir 		initMembers();
910*cdf0e10cSrcweir 
911*cdf0e10cSrcweir 	// create fields sequence
912*cdf0e10cSrcweir 	Sequence< Reference< XIdlField > > aRet( _nAttributes );
913*cdf0e10cSrcweir 	Reference< XIdlField > * pRet = aRet.getArray();
914*cdf0e10cSrcweir 	for ( sal_Int32 nPos = _nAttributes; nPos--; )
915*cdf0e10cSrcweir 	{
916*cdf0e10cSrcweir 		/*_aName2Field[_pSortedMemberInit[_nMethods+nPos].first] = */pRet[_nAttributes-nPos-1] =
917*cdf0e10cSrcweir 			new IdlAttributeFieldImpl(
918*cdf0e10cSrcweir 				getReflection(), _pSortedMemberInit[_nMethods+nPos].first,
919*cdf0e10cSrcweir 				_pSortedMemberInit[_nMethods+nPos].second, IdlClassImpl::getTypeDescr() );
920*cdf0e10cSrcweir 	}
921*cdf0e10cSrcweir 	return aRet;
922*cdf0e10cSrcweir }
923*cdf0e10cSrcweir //__________________________________________________________________________________________________
924*cdf0e10cSrcweir Reference< XIdlMethod > InterfaceIdlClassImpl::getMethod( const OUString & rName )
925*cdf0e10cSrcweir 	throw(::com::sun::star::uno::RuntimeException)
926*cdf0e10cSrcweir {
927*cdf0e10cSrcweir 	MutexGuard aGuard( getMutexAccess() );
928*cdf0e10cSrcweir 	if (! _pSortedMemberInit)
929*cdf0e10cSrcweir 		initMembers();
930*cdf0e10cSrcweir 
931*cdf0e10cSrcweir 	Reference< XIdlMethod > xRet;
932*cdf0e10cSrcweir 
933*cdf0e10cSrcweir 	// try weak map
934*cdf0e10cSrcweir 	const OUString2Method::const_iterator iFind( _aName2Method.find( rName ) );
935*cdf0e10cSrcweir 	if (iFind != _aName2Method.end())
936*cdf0e10cSrcweir 		xRet = (*iFind).second; // harden ref
937*cdf0e10cSrcweir 
938*cdf0e10cSrcweir 	if (! xRet.is())
939*cdf0e10cSrcweir 	{
940*cdf0e10cSrcweir 		for ( sal_Int32 nPos = _nMethods; nPos--; )
941*cdf0e10cSrcweir 		{
942*cdf0e10cSrcweir 			if (_pSortedMemberInit[nPos].first == rName)
943*cdf0e10cSrcweir 			{
944*cdf0e10cSrcweir 				_aName2Method[rName] = xRet = new IdlInterfaceMethodImpl(
945*cdf0e10cSrcweir 					getReflection(), rName,
946*cdf0e10cSrcweir 					_pSortedMemberInit[nPos].second, IdlClassImpl::getTypeDescr() );
947*cdf0e10cSrcweir 				break;
948*cdf0e10cSrcweir 			}
949*cdf0e10cSrcweir 		}
950*cdf0e10cSrcweir 	}
951*cdf0e10cSrcweir 	return xRet;
952*cdf0e10cSrcweir }
953*cdf0e10cSrcweir //__________________________________________________________________________________________________
954*cdf0e10cSrcweir Reference< XIdlField > InterfaceIdlClassImpl::getField( const OUString & rName )
955*cdf0e10cSrcweir 	throw(::com::sun::star::uno::RuntimeException)
956*cdf0e10cSrcweir {
957*cdf0e10cSrcweir 	MutexGuard aGuard( getMutexAccess() );
958*cdf0e10cSrcweir 	if (! _pSortedMemberInit)
959*cdf0e10cSrcweir 		initMembers();
960*cdf0e10cSrcweir 
961*cdf0e10cSrcweir 	Reference< XIdlField > xRet;
962*cdf0e10cSrcweir 
963*cdf0e10cSrcweir 	// try weak map
964*cdf0e10cSrcweir 	const OUString2Field::const_iterator iFind( _aName2Field.find( rName ) );
965*cdf0e10cSrcweir 	if (iFind != _aName2Field.end())
966*cdf0e10cSrcweir 		xRet = (*iFind).second; // harden ref
967*cdf0e10cSrcweir 
968*cdf0e10cSrcweir 	if (! xRet.is())
969*cdf0e10cSrcweir 	{
970*cdf0e10cSrcweir 		for ( sal_Int32 nPos = _nAttributes; nPos--; )
971*cdf0e10cSrcweir 		{
972*cdf0e10cSrcweir 			if (_pSortedMemberInit[_nMethods+nPos].first == rName)
973*cdf0e10cSrcweir 			{
974*cdf0e10cSrcweir 				_aName2Field[rName] = xRet = new IdlAttributeFieldImpl(
975*cdf0e10cSrcweir 					getReflection(), rName,
976*cdf0e10cSrcweir 					_pSortedMemberInit[_nMethods+nPos].second, IdlClassImpl::getTypeDescr() );
977*cdf0e10cSrcweir 				break;
978*cdf0e10cSrcweir 			}
979*cdf0e10cSrcweir 		}
980*cdf0e10cSrcweir 	}
981*cdf0e10cSrcweir 	return xRet;
982*cdf0e10cSrcweir }
983*cdf0e10cSrcweir //__________________________________________________________________________________________________
984*cdf0e10cSrcweir void InterfaceIdlClassImpl::createObject( Any & rObj )
985*cdf0e10cSrcweir 	throw(::com::sun::star::uno::RuntimeException)
986*cdf0e10cSrcweir {
987*cdf0e10cSrcweir 	// interfaces cannot be constructed
988*cdf0e10cSrcweir 	rObj.clear();
989*cdf0e10cSrcweir }
990*cdf0e10cSrcweir 
991*cdf0e10cSrcweir }
992*cdf0e10cSrcweir 
993*cdf0e10cSrcweir 
994