diff options
-rw-r--r-- | eventattacher/source/eventattacher.cxx | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/eventattacher/source/eventattacher.cxx b/eventattacher/source/eventattacher.cxx index 06d48346604e..29954d9893f5 100644 --- a/eventattacher/source/eventattacher.cxx +++ b/eventattacher/source/eventattacher.cxx @@ -654,70 +654,70 @@ Reference<XEventListener> EventAttacherImpl::attachListenerForTarget( // Is it the correct method? OUString aMethName = rxMethod->getName(); - if( aAddListenerName == aMethName ) - { - Sequence< Reference< XIdlClass > > params = rxMethod->getParameterTypes(); - sal_uInt32 nParamCount = params.getLength(); + if (aAddListenerName != aMethName) + continue; - Reference< XIdlClass > xListenerType; - if( nParamCount == 1 ) - xListenerType = params.getConstArray()[0]; - else if( nParamCount == 2 ) - xListenerType = params.getConstArray()[1]; + Sequence< Reference< XIdlClass > > params = rxMethod->getParameterTypes(); + sal_uInt32 nParamCount = params.getLength(); - // Request Adapter for the actual Listener type - Reference< XInterface > xAdapter = createAllListenerAdapter( - xInvocationAdapterFactory, xListenerType, xAllListener, aHelper ); + Reference< XIdlClass > xListenerType; + if( nParamCount == 1 ) + xListenerType = params.getConstArray()[0]; + else if( nParamCount == 2 ) + xListenerType = params.getConstArray()[1]; - if( !xAdapter.is() ) - throw CannotCreateAdapterException(); - xRet = Reference< XEventListener >( xAdapter, UNO_QUERY ); + // Request Adapter for the actual Listener type + Reference< XInterface > xAdapter = createAllListenerAdapter( + xInvocationAdapterFactory, xListenerType, xAllListener, aHelper ); - // Just the Listener as parameter? - if( nParamCount == 1 ) + if( !xAdapter.is() ) + throw CannotCreateAdapterException(); + xRet = Reference< XEventListener >( xAdapter, UNO_QUERY ); + + // Just the Listener as parameter? + if( nParamCount == 1 ) + { + Sequence< Any > args( 1 ); + args.getArray()[0] <<= xAdapter; + try { - Sequence< Any > args( 1 ); - args.getArray()[0] <<= xAdapter; - try - { - rxMethod->invoke( aObject, args ); - } - catch( InvocationTargetException& ) - { - throw IntrospectionException(); - } + rxMethod->invoke( aObject, args ); } - // Else, pass the other parameter now - else if( nParamCount == 2 ) + catch( InvocationTargetException& ) { - Sequence< Any > args( 2 ); - Any* pAnys = args.getArray(); + throw IntrospectionException(); + } + } + // Else, pass the other parameter now + else if( nParamCount == 2 ) + { + Sequence< Any > args( 2 ); + Any* pAnys = args.getArray(); - // Check the type of the 1st parameter - Reference< XIdlClass > xParamClass = params.getConstArray()[0]; - if( xParamClass->getTypeClass() == TypeClass_STRING ) - { - pAnys[0] <<= aAddListenerParam; - } + // Check the type of the 1st parameter + Reference< XIdlClass > xParamClass = params.getConstArray()[0]; + if( xParamClass->getTypeClass() == TypeClass_STRING ) + { + pAnys[0] <<= aAddListenerParam; + } - // 2nd Parameter == Listener? TODO: Test! - pAnys[1] <<= xAdapter; + // 2nd Parameter == Listener? TODO: Test! + pAnys[1] <<= xAdapter; - // TODO: Convert String -> ? - // else - try - { - rxMethod->invoke( aObject, args ); - } - catch( InvocationTargetException& ) - { - throw IntrospectionException(); - } + // TODO: Convert String -> ? + // else + try + { + rxMethod->invoke( aObject, args ); + } + catch( InvocationTargetException& ) + { + throw IntrospectionException(); } - break; - // else... - // Anything else is not supported } + break; + // else... + // Anything else is not supported } return xRet; |