diff options
Diffstat (limited to 'eventattacher/source/eventattacher.cxx')
-rw-r--r-- | eventattacher/source/eventattacher.cxx | 160 |
1 files changed, 80 insertions, 80 deletions
diff --git a/eventattacher/source/eventattacher.cxx b/eventattacher/source/eventattacher.cxx index c692a6c10dff..d008afb9e745 100644 --- a/eventattacher/source/eventattacher.cxx +++ b/eventattacher/source/eventattacher.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -58,7 +58,7 @@ using namespace rtl; #define SERVICENAME "com.sun.star.script.EventAttacher" -#define IMPLNAME "com.sun.star.comp.EventAttacher" +#define IMPLNAME "com.sun.star.comp.EventAttacher" namespace comp_EventAttacher { @@ -69,14 +69,14 @@ namespace comp_EventAttacher { class InvocationToAllListenerMapper : public WeakImplHelper1< XInvocation > { public: - InvocationToAllListenerMapper( const Reference< XIdlClass >& ListenerType, + InvocationToAllListenerMapper( const Reference< XIdlClass >& ListenerType, const Reference< XAllListener >& AllListener, const Any& Helper ); // XInvocation virtual Reference< XIntrospectionAccess > SAL_CALL getIntrospection(void) throw( RuntimeException ); - virtual Any SAL_CALL invoke(const OUString& FunctionName, const Sequence< Any >& Params, Sequence< sal_Int16 >& OutParamIndex, Sequence< Any >& OutParam) + virtual Any SAL_CALL invoke(const OUString& FunctionName, const Sequence< Any >& Params, Sequence< sal_Int16 >& OutParamIndex, Sequence< Any >& OutParam) throw( IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException ); - virtual void SAL_CALL setValue(const OUString& PropertyName, const Any& Value) + virtual void SAL_CALL setValue(const OUString& PropertyName, const Any& Value) throw( UnknownPropertyException, CannotConvertException, InvocationTargetException, RuntimeException ); virtual Any SAL_CALL getValue(const OUString& PropertyName) throw( UnknownPropertyException, RuntimeException ); virtual sal_Bool SAL_CALL hasMethod(const OUString& Name) throw( RuntimeException ); @@ -84,9 +84,9 @@ public: private: Reference< XIdlReflection > m_xCoreReflection; - Reference< XAllListener > m_xAllListener; - Reference< XIdlClass > m_xListenerType; - Any m_Helper; + Reference< XAllListener > m_xAllListener; + Reference< XIdlClass > m_xListenerType; + Any m_Helper; }; @@ -102,7 +102,7 @@ Reference< XInterface > createAllListenerAdapter Reference< XInterface > xAdapter; if( xInvocationAdapterFactory.is() && xListenerType.is() && xListener.is() ) { - Reference< XInvocation > xInvocationToAllListenerMapper = + Reference< XInvocation > xInvocationToAllListenerMapper = (XInvocation*)new InvocationToAllListenerMapper( xListenerType, xListener, Helper ); Type aListenerType( xListenerType->getTypeClass(), xListenerType->getName()); xAdapter = xInvocationAdapterFactory->createAdapter( xInvocationToAllListenerMapper, aListenerType ); @@ -122,16 +122,16 @@ InvocationToAllListenerMapper::InvocationToAllListenerMapper } //************************************************************************* -Reference< XIntrospectionAccess > SAL_CALL InvocationToAllListenerMapper::getIntrospection(void) +Reference< XIntrospectionAccess > SAL_CALL InvocationToAllListenerMapper::getIntrospection(void) throw( RuntimeException ) { return Reference< XIntrospectionAccess >(); } //************************************************************************* -Any SAL_CALL InvocationToAllListenerMapper::invoke(const OUString& FunctionName, const Sequence< Any >& Params, - Sequence< sal_Int16 >& , Sequence< Any >& ) - throw( IllegalArgumentException, CannotConvertException, +Any SAL_CALL InvocationToAllListenerMapper::invoke(const OUString& FunctionName, const Sequence< Any >& Params, + Sequence< sal_Int16 >& , Sequence< Any >& ) + throw( IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException ) { Any aRet; @@ -180,14 +180,14 @@ Any SAL_CALL InvocationToAllListenerMapper::invoke(const OUString& FunctionName, } //************************************************************************* -void SAL_CALL InvocationToAllListenerMapper::setValue(const OUString& , const Any& ) - throw( UnknownPropertyException, CannotConvertException, +void SAL_CALL InvocationToAllListenerMapper::setValue(const OUString& , const Any& ) + throw( UnknownPropertyException, CannotConvertException, InvocationTargetException, RuntimeException ) { } //************************************************************************* -Any SAL_CALL InvocationToAllListenerMapper::getValue(const OUString& ) +Any SAL_CALL InvocationToAllListenerMapper::getValue(const OUString& ) throw( UnknownPropertyException, RuntimeException ) { return Any(); @@ -227,20 +227,20 @@ public: static Sequence< OUString > SAL_CALL getSupportedServiceNames_Static( ); // XInitialization - virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) + virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw( Exception, RuntimeException); // Methoden von XEventAttacher - virtual Reference< XEventListener > SAL_CALL attachListener(const Reference< XInterface >& xObject, - const Reference< XAllListener >& AllListener, const Any& Helper, + virtual Reference< XEventListener > SAL_CALL attachListener(const Reference< XInterface >& xObject, + const Reference< XAllListener >& AllListener, const Any& Helper, const OUString& ListenerType, const OUString& AddListenerParam) throw( IllegalArgumentException, ServiceNotRegisteredException, CannotCreateAdapterException, IntrospectionException, RuntimeException ); - virtual Reference< XEventListener > SAL_CALL attachSingleEventListener(const Reference< XInterface >& xObject, - const Reference< XAllListener >& AllListener, const Any& Helper, - const OUString& ListenerType, const OUString& AddListenerParam, + virtual Reference< XEventListener > SAL_CALL attachSingleEventListener(const Reference< XInterface >& xObject, + const Reference< XAllListener >& AllListener, const Any& Helper, + const OUString& ListenerType, const OUString& AddListenerParam, const OUString& EventMethod) throw( IllegalArgumentException, ServiceNotRegisteredException, CannotCreateAdapterException, IntrospectionException, RuntimeException ); - virtual void SAL_CALL removeListener(const Reference< XInterface >& xObject, + virtual void SAL_CALL removeListener(const Reference< XInterface >& xObject, const OUString& ListenerType, const OUString& AddListenerParam, const Reference< XEventListener >& aToRemoveListener) throw( IllegalArgumentException, IntrospectionException, RuntimeException ); @@ -250,19 +250,19 @@ public: friend class FilterAllListenerImpl; private: - Mutex m_aMutex; - Reference< XMultiServiceFactory > m_xSMgr; + Mutex m_aMutex; + Reference< XMultiServiceFactory > m_xSMgr; // Services merken - Reference< XIntrospection > m_xIntrospection; - Reference< XIdlReflection > m_xReflection; - Reference< XTypeConverter > m_xConverter; - Reference< XInvocationAdapterFactory > m_xInvocationAdapterFactory; + Reference< XIntrospection > m_xIntrospection; + Reference< XIdlReflection > m_xReflection; + Reference< XTypeConverter > m_xConverter; + Reference< XInvocationAdapterFactory > m_xInvocationAdapterFactory; // needed services - Reference< XIntrospection > getIntrospection() throw( Exception ); - Reference< XIdlReflection > getReflection() throw( Exception ); - Reference< XInvocationAdapterFactory > getInvocationAdapterService() throw( Exception ); + Reference< XIntrospection > getIntrospection() throw( Exception ); + Reference< XIdlReflection > getReflection() throw( Exception ); + Reference< XInvocationAdapterFactory > getInvocationAdapterService() throw( Exception ); }; @@ -280,26 +280,26 @@ EventAttacherImpl::~EventAttacherImpl() //************************************************************************* Reference< XInterface > SAL_CALL EventAttacherImpl_CreateInstance( const Reference< XMultiServiceFactory >& rSMgr ) throw( Exception ) { - Reference< XInterface > xRet; + Reference< XInterface > xRet; XEventAttacher *pEventAttacher = (XEventAttacher*) new EventAttacherImpl(rSMgr); if (pEventAttacher) { xRet = Reference<XInterface>::query(pEventAttacher); - } + } return xRet; } //************************************************************************* -OUString SAL_CALL EventAttacherImpl::getImplementationName( ) +OUString SAL_CALL EventAttacherImpl::getImplementationName( ) throw(RuntimeException) { return OUString( RTL_CONSTASCII_USTRINGPARAM( IMPLNAME ) ); -} +} //************************************************************************* -sal_Bool SAL_CALL EventAttacherImpl::supportsService( const OUString& ServiceName ) +sal_Bool SAL_CALL EventAttacherImpl::supportsService( const OUString& ServiceName ) throw(RuntimeException) { Sequence< OUString > aSNL = getSupportedServiceNames(); @@ -308,21 +308,21 @@ sal_Bool SAL_CALL EventAttacherImpl::supportsService( const OUString& ServiceNam if( pArray[i] == ServiceName ) return sal_True; return sal_False; -} +} //************************************************************************* -Sequence<OUString> SAL_CALL EventAttacherImpl::getSupportedServiceNames( ) +Sequence<OUString> SAL_CALL EventAttacherImpl::getSupportedServiceNames( ) throw(RuntimeException) { return getSupportedServiceNames_Static(); -} +} //************************************************************************* -Sequence<OUString> SAL_CALL EventAttacherImpl::getSupportedServiceNames_Static( ) +Sequence<OUString> SAL_CALL EventAttacherImpl::getSupportedServiceNames_Static( ) { OUString aStr( RTL_CONSTASCII_USTRINGPARAM( SERVICENAME ) ); return Sequence< OUString >( &aStr, 1 ); -} +} //************************************************************************* void SAL_CALL EventAttacherImpl::initialize(const Sequence< Any >& Arguments) throw( Exception, RuntimeException ) @@ -332,7 +332,7 @@ void SAL_CALL EventAttacherImpl::initialize(const Sequence< Any >& Arguments) th for( sal_Int32 i = 0; i < Arguments.getLength(); i++ ) { if( pArray[i].getValueType().getTypeClass() != TypeClass_INTERFACE ) - throw IllegalArgumentException(); + throw IllegalArgumentException(); // InvocationAdapter service ? Reference< XInvocationAdapterFactory > xALAS; @@ -369,7 +369,7 @@ void SAL_CALL EventAttacherImpl::initialize(const Sequence< Any >& Arguments) th // no right interface if( !xALAS.is() && !xI.is() && !xIdlR.is() && !xC.is() ) - throw IllegalArgumentException(); + throw IllegalArgumentException(); } } @@ -450,17 +450,17 @@ public: private: // convert - void convertToEventReturn( Any & rRet, const Type& rRetType ) + void convertToEventReturn( Any & rRet, const Type& rRetType ) throw( CannotConvertException ); - EventAttacherImpl * m_pEA; - Reference< XInterface > m_xEAHold; - OUString m_EventMethod; - Reference< XAllListener > m_AllListener; + EventAttacherImpl * m_pEA; + Reference< XInterface > m_xEAHold; + OUString m_EventMethod; + Reference< XAllListener > m_AllListener; }; //************************************************************************* -FilterAllListenerImpl::FilterAllListenerImpl( EventAttacherImpl * pEA_, const OUString& EventMethod_, +FilterAllListenerImpl::FilterAllListenerImpl( EventAttacherImpl * pEA_, const OUString& EventMethod_, const Reference< XAllListener >& AllListener_ ) : m_pEA( pEA_ ) , m_xEAHold( *pEA_ ) @@ -494,21 +494,21 @@ void FilterAllListenerImpl::convertToEventReturn( Any & rRet, const Type & rRetT } break; - case TypeClass_BOOLEAN: - rRet <<= sal_True; + case TypeClass_BOOLEAN: + rRet <<= sal_True; break; - - case TypeClass_STRING: - rRet <<= OUString(); + + case TypeClass_STRING: + rRet <<= OUString(); break; - case TypeClass_FLOAT: rRet <<= float(0); break; - case TypeClass_DOUBLE: rRet <<= double(0.0); break; - case TypeClass_BYTE: rRet <<= sal_uInt8( 0 ); break; - case TypeClass_SHORT: rRet <<= sal_Int16( 0 ); break; - case TypeClass_LONG: rRet <<= sal_Int32( 0 ); break; - case TypeClass_UNSIGNED_SHORT: rRet <<= sal_uInt16( 0 ); break; - case TypeClass_UNSIGNED_LONG: rRet <<= sal_uInt32( 0 ); break; + case TypeClass_FLOAT: rRet <<= float(0); break; + case TypeClass_DOUBLE: rRet <<= double(0.0); break; + case TypeClass_BYTE: rRet <<= sal_uInt8( 0 ); break; + case TypeClass_SHORT: rRet <<= sal_Int16( 0 ); break; + case TypeClass_LONG: rRet <<= sal_Int32( 0 ); break; + case TypeClass_UNSIGNED_SHORT: rRet <<= sal_uInt16( 0 ); break; + case TypeClass_UNSIGNED_LONG: rRet <<= sal_uInt32( 0 ); break; default: break; } @@ -566,10 +566,10 @@ void FilterAllListenerImpl::disposing(const EventObject& ) //************************************************************************* Reference< XEventListener > EventAttacherImpl::attachListener ( - const Reference< XInterface >& xObject, - const Reference< XAllListener >& AllListener, - const Any& Helper, - const OUString& ListenerType, + const Reference< XInterface >& xObject, + const Reference< XAllListener >& AllListener, + const Any& Helper, + const OUString& ListenerType, const OUString& AddListenerParam ) throw( IllegalArgumentException, ServiceNotRegisteredException, CannotCreateAdapterException, IntrospectionException, RuntimeException ) @@ -602,7 +602,7 @@ Reference< XEventListener > EventAttacherImpl::attachListener // und unspecten Any aObjAny( &xObject, ::getCppuType( (const Reference< XInterface > *)0) ); - + Reference< XIntrospectionAccess > xAccess = xIntrospection->inspect( aObjAny ); if( !xAccess.is() ) return xRet; @@ -634,7 +634,7 @@ Reference< XEventListener > EventAttacherImpl::attachListener // Ist es die richtige Methode? OUString aMethName = rxMethod->getName(); - + if( aAddListenerName == aMethName ) { Sequence< Reference< XIdlClass > > params = rxMethod->getParameterTypes(); @@ -708,11 +708,11 @@ Reference< XEventListener > EventAttacherImpl::attachListener // XEventAttacher Reference< XEventListener > EventAttacherImpl::attachSingleEventListener ( - const Reference< XInterface >& xObject, - const Reference< XAllListener >& AllListener, - const Any& Helper, - const OUString& ListenerType, - const OUString& AddListenerParam, + const Reference< XInterface >& xObject, + const Reference< XAllListener >& AllListener, + const Any& Helper, + const OUString& ListenerType, + const OUString& AddListenerParam, const OUString& EventMethod ) throw( IllegalArgumentException, ServiceNotRegisteredException, CannotCreateAdapterException, IntrospectionException, RuntimeException ) @@ -726,8 +726,8 @@ Reference< XEventListener > EventAttacherImpl::attachSingleEventListener // XEventAttacher void EventAttacherImpl::removeListener ( - const Reference< XInterface >& xObject, - const OUString& ListenerType, + const Reference< XInterface >& xObject, + const OUString& ListenerType, const OUString& AddListenerParam, const Reference< XEventListener >& aToRemoveListener ) @@ -772,7 +772,7 @@ void EventAttacherImpl::removeListener // erase X from the interface name aListenerName = aListenerName.copy( nIndex +1 ); aRemoveListenerName = OUString( RTL_CONSTASCII_USTRINGPARAM("remove") ) + aListenerName; - + // Methoden nach der passenden addListener-Methode durchsuchen Sequence< Reference< XIdlMethod > > aMethodSeq = xAccess->getMethods( MethodConcept::LISTENER ); sal_uInt32 i, nLen = aMethodSeq.getLength(); @@ -854,7 +854,7 @@ sal_Bool SAL_CALL component_writeInfo( Reference< XRegistryKey > xNewKey( reinterpret_cast< XRegistryKey * >( pRegistryKey )->createKey( OUString( RTL_CONSTASCII_USTRINGPARAM( "/" IMPLNAME "/UNO/SERVICES") ))); - + Sequence< OUString > aSNL ( ::comp_EventAttacher::EventAttacherImpl::getSupportedServiceNames_Static() ); const OUString * pArray = aSNL.getConstArray(); @@ -875,15 +875,15 @@ void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * ) { void * pRet = 0; - + if (pServiceManager && rtl_str_compare( pImplName, IMPLNAME ) == 0) { Reference< XSingleServiceFactory > xFactory( createOneInstanceFactory( reinterpret_cast< XMultiServiceFactory * >( pServiceManager ), OUString( RTL_CONSTASCII_USTRINGPARAM( IMPLNAME ) ), - ::comp_EventAttacher::EventAttacherImpl_CreateInstance, + ::comp_EventAttacher::EventAttacherImpl_CreateInstance, ::comp_EventAttacher::EventAttacherImpl::getSupportedServiceNames_Static() ) ); - + if (xFactory.is()) { xFactory->acquire(); |