summaryrefslogtreecommitdiff
path: root/eventattacher
diff options
context:
space:
mode:
Diffstat (limited to 'eventattacher')
-rw-r--r--eventattacher/source/eventattacher.cxx88
1 files changed, 36 insertions, 52 deletions
diff --git a/eventattacher/source/eventattacher.cxx b/eventattacher/source/eventattacher.cxx
index 11625aa1c746..fdbcb1ed4a01 100644
--- a/eventattacher/source/eventattacher.cxx
+++ b/eventattacher/source/eventattacher.cxx
@@ -253,7 +253,7 @@ private:
Mutex m_aMutex;
Reference< XMultiServiceFactory > m_xSMgr;
- // Services merken
+ // Save Services
Reference< XIntrospection > m_xIntrospection;
Reference< XIdlReflection > m_xReflection;
Reference< XTypeConverter > m_xConverter;
@@ -374,11 +374,10 @@ void SAL_CALL EventAttacherImpl::initialize(const Sequence< Any >& Arguments) th
}
//*************************************************************************
-//*** Private Hilfs-Methoden ***
+//*** Private Help-Methods ***
Reference< XIntrospection > EventAttacherImpl::getIntrospection() throw( Exception )
{
Guard< Mutex > aGuard( m_aMutex );
- // Haben wir den Service schon? Sonst anlegen
if( !m_xIntrospection.is() )
{
Reference< XInterface > xIFace( m_xSMgr->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.beans.Introspection")) ) );
@@ -392,7 +391,6 @@ Reference< XIntrospection > EventAttacherImpl::getIntrospection() throw( Excepti
Reference< XIdlReflection > EventAttacherImpl::getReflection() throw( Exception )
{
Guard< Mutex > aGuard( m_aMutex );
- // Haben wir den Service schon? Sonst anlegen
if( !m_xReflection.is() )
{
Reference< XInterface > xIFace( m_xSMgr->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.reflection.CoreReflection")) ) );
@@ -402,11 +400,10 @@ Reference< XIdlReflection > EventAttacherImpl::getReflection() throw( Exception
}
//*************************************************************************
-//*** Private Hilfs-Methoden ***
+//*** Private Help-Methods ***
Reference< XInvocationAdapterFactory > EventAttacherImpl::getInvocationAdapterService() throw( Exception )
{
Guard< Mutex > aGuard( m_aMutex );
- // Haben wir den Service schon? Sonst anlegen
if( !m_xInvocationAdapterFactory.is() )
{
Reference< XInterface > xIFace( m_xSMgr->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.InvocationAdapterFactory")) ) );
@@ -417,11 +414,10 @@ Reference< XInvocationAdapterFactory > EventAttacherImpl::getInvocationAdapterSe
//*************************************************************************
-//*** Private Hilfs-Methoden ***
+//*** Private Hilfs-Methods ***
Reference< XTypeConverter > EventAttacherImpl::getConverter() throw( Exception )
{
Guard< Mutex > aGuard( m_aMutex );
- // Haben wir den Service schon? Sonst anlegen
if( !m_xConverter.is() )
{
Reference< XInterface > xIFace( m_xSMgr->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.script.Converter")) ) );
@@ -433,8 +429,8 @@ Reference< XTypeConverter > EventAttacherImpl::getConverter() throw( Exception )
//------------------------------------------------------------------------
//------------------------------------------------------------------------
//------------------------------------------------------------------------
-// Implementation eines EventAttacher-bezogenen AllListeners, der
-// nur einzelne Events an einen allgemeinen AllListener weiterleitet
+// Implementation of a EventAttacher-related AllListeners, which brings
+// a few Events to a general AllListener
class FilterAllListenerImpl : public WeakImplHelper1< XAllListener >
{
public:
@@ -473,7 +469,6 @@ FilterAllListenerImpl::FilterAllListenerImpl( EventAttacherImpl * pEA_, const OU
void SAL_CALL FilterAllListenerImpl::firing(const AllEventObject& Event)
throw( RuntimeException )
{
- // Nur durchreichen, wenn es die richtige Methode ist
if( Event.MethodName == m_EventMethod && m_AllListener.is() )
m_AllListener->firing( Event );
}
@@ -529,7 +524,6 @@ Any SAL_CALL FilterAllListenerImpl::approveFiring( const AllEventObject& Event )
{
Any aRet;
- // Nur durchreichen, wenn es die richtige Methode ist
if( Event.MethodName == m_EventMethod && m_AllListener.is() )
aRet = m_AllListener->approveFiring( Event );
else
@@ -579,35 +573,30 @@ Reference< XEventListener > EventAttacherImpl::attachListener
Reference< XEventListener > xRet = NULL;
- // InvocationAdapterService holen
Reference< XInvocationAdapterFactory > xInvocationAdapterFactory = getInvocationAdapterService();
if( !xInvocationAdapterFactory.is() )
throw ServiceNotRegisteredException();
- // Listener-Klasse per Reflection besorgen
Reference< XIdlReflection > xReflection = getReflection();
if( !xReflection.is() )
throw ServiceNotRegisteredException();
- // Anmelden, dazu passende addListener-Methode aufrufen
- // Zunaechst ueber Introspection gehen, da die Methoden in der gleichen
- // Weise analysiert werden koennen. Fuer bessere Performance entweder
- // hier nochmal implementieren oder die Impl-Methode der Introspection
- // fuer diesen Zweck konfigurierbar machen.
-
- // Introspection-Service holen
+ // Sign in, Call the fitting addListener-Method
+ // First Introspection, as the Methods can be analyzed in the same way
+ // For better perfomance it is implemented here again or make the Impl-Method
+ // of the Introspection for this more configurable.
Reference< XIntrospection > xIntrospection = getIntrospection();
if( !xIntrospection.is() )
return xRet;
- // und unspecten
+ // Inspect Introspection
Any aObjAny( &xObject, ::getCppuType( (const Reference< XInterface > *)0) );
Reference< XIntrospectionAccess > xAccess = xIntrospection->inspect( aObjAny );
if( !xAccess.is() )
return xRet;
- // Name der addListener-Methode zusammenbasteln
+ // Construct the name of the addListener-Method.
OUString aAddListenerName;
OUString aListenerName( ListenerType );
sal_Int32 nIndex = aListenerName.lastIndexOf( '.' );
@@ -622,17 +611,16 @@ Reference< XEventListener > EventAttacherImpl::attachListener
aListenerName = aListenerName.copy( nIndex +1 );
aAddListenerName = OUString( RTL_CONSTASCII_USTRINGPARAM( "add" ) ) + aListenerName;
- // Methoden nach der passenden addListener-Methode durchsuchen
+ // Send Methods to the correct addListener-Method
Sequence< Reference< XIdlMethod > > aMethodSeq = xAccess->getMethods( MethodConcept::LISTENER );
sal_uInt32 i, nLen = aMethodSeq.getLength();
const Reference< XIdlMethod >* pMethods = aMethodSeq.getConstArray();
for( i = 0 ; i < nLen ; i++ )
{
- // Methode ansprechen
const Reference< XIdlMethod >& rxMethod = pMethods[i];
- // Ist es die richtige Methode?
+ // Is it the correct method?
OUString aMethName = rxMethod->getName();
if( aAddListenerName == aMethName )
@@ -646,7 +634,7 @@ Reference< XEventListener > EventAttacherImpl::attachListener
else if( nParamCount == 2 )
xListenerType = params.getConstArray()[1];
- // Adapter zum eigentlichen Listener-Typ anfordern
+ // Send Adapter to its own Listener-Type
Reference< XInterface > xAdapter = createAllListenerAdapter
( xInvocationAdapterFactory, xListenerType, AllListener, Helper );
@@ -655,7 +643,7 @@ Reference< XEventListener > EventAttacherImpl::attachListener
xRet = Reference< XEventListener >( xAdapter, UNO_QUERY );
- // Nur der Listener als Parameter?
+ // Just the Listener as parameter?
if( nParamCount == 1 )
{
Sequence< Any > args( 1 );
@@ -669,23 +657,23 @@ Reference< XEventListener > EventAttacherImpl::attachListener
throw IntrospectionException();
}
}
- // Sonst den Zusatzparameter mit uebergeben
+ // Else, Give the other parameters now
else if( nParamCount == 2 )
{
Sequence< Any > args( 2 );
Any* pAnys = args.getArray();
- // Typ des 1. Parameters pruefen
+ // Search the type of the 1st parameter
Reference< XIdlClass > xParamClass = params.getConstArray()[0];
if( xParamClass->getTypeClass() == TypeClass_STRING )
{
pAnys[0] <<= AddListenerParam;
}
- // 2. Parameter == Listener? TODO: Pruefen!
+ // 2. Parameter == Listener? TODO: Test!
pAnys[1] <<= xAdapter;
- // TODO: Konvertierung String -> ?
+ // TODO: Convert String -> ?
// else
try
{
@@ -698,7 +686,7 @@ Reference< XEventListener > EventAttacherImpl::attachListener
}
break;
// else...
- // Alles andere wird nicht unterstuetzt
+ // Anything else will not be supported
}
}
@@ -717,7 +705,7 @@ Reference< XEventListener > EventAttacherImpl::attachSingleEventListener
)
throw( IllegalArgumentException, ServiceNotRegisteredException, CannotCreateAdapterException, IntrospectionException, RuntimeException )
{
- // FilterListener anmelden
+ // Subscribe FilterListener
Reference< XAllListener > aFilterListener = (XAllListener*)
new FilterAllListenerImpl( this, EventMethod, AllListener );
return attachListener( xObject, aFilterListener, Helper, ListenerType, AddListenerParam);
@@ -736,29 +724,25 @@ void EventAttacherImpl::removeListener
if( !xObject.is() || !aToRemoveListener.is() )
throw IllegalArgumentException();
- // Listener-Klasse per Reflection besorgen
Reference< XIdlReflection > xReflection = getReflection();
if( !xReflection.is() )
throw IntrospectionException();
- // Abmelden, dazu passende removeListener-Methode aufrufen
- // Zunaechst ueber Introspection gehen, da die Methoden in der gleichen
- // Weise analysiert werden koennen. Fuer bessere Performance entweder
- // hier nochmal implementieren oder die Impl-Methode der Introspection
- // fuer diesen Zweck konfigurierbar machen.
-
- // Introspection-Service holen
+ // Sign in, Call the fitting removeListener-Method
+ // First Introspection, as the Methods can be analyzed in the same way
+ // For better perfomance it is implemented here again or make the Impl-Method
+ // of the Introspection for this more configurable.
Reference< XIntrospection > xIntrospection = getIntrospection();
if( !xIntrospection.is() )
throw IntrospectionException();
- // und inspecten
+ //Inspect Introspection
Any aObjAny( &xObject, ::getCppuType( (const Reference< XInterface > *)0) );
Reference< XIntrospectionAccess > xAccess = xIntrospection->inspect( aObjAny );
if( !xAccess.is() )
throw IntrospectionException();
- // Name der removeListener-Methode zusammenbasteln
+ // Create name of the removeListener-Method
OUString aRemoveListenerName;
OUString aListenerName( ListenerType );
sal_Int32 nIndex = aListenerName.lastIndexOf( '.' );
@@ -773,22 +757,22 @@ void EventAttacherImpl::removeListener
aListenerName = aListenerName.copy( nIndex +1 );
aRemoveListenerName = OUString( RTL_CONSTASCII_USTRINGPARAM("remove") ) + aListenerName;
- // Methoden nach der passenden addListener-Methode durchsuchen
+ // Send Methods to the correct removeListener-Method
Sequence< Reference< XIdlMethod > > aMethodSeq = xAccess->getMethods( MethodConcept::LISTENER );
sal_uInt32 i, nLen = aMethodSeq.getLength();
const Reference< XIdlMethod >* pMethods = aMethodSeq.getConstArray();
for( i = 0 ; i < nLen ; i++ )
{
- // Methode ansprechen
+ // Call Methode
const Reference< XIdlMethod >& rxMethod = pMethods[i];
- // Ist es die richtige Methode?
+ // Is it the right method?
if( aRemoveListenerName == rxMethod->getName() )
{
Sequence< Reference< XIdlClass > > params = rxMethod->getParameterTypes();
sal_uInt32 nParamCount = params.getLength();
- // Nur der Listener als Parameter?
+ // Just the Listener as parameter?
if( nParamCount == 1 )
{
Sequence< Any > args( 1 );
@@ -802,21 +786,21 @@ void EventAttacherImpl::removeListener
throw IntrospectionException();
}
}
- // Sonst den Zusatzparameter mit uebergeben
+ // Else give the other parameters
else if( nParamCount == 2 )
{
Sequence< Any > args( 2 );
Any* pAnys = args.getArray();
- // Typ des 1. Parameters pruefen
+ // Search the type of the 1st parameter
Reference< XIdlClass > xParamClass = params.getConstArray()[0];
if( xParamClass->getTypeClass() == TypeClass_STRING )
pAnys[0] <<= AddListenerParam;
- // 2. Parameter == Listener? TODO: Pruefen!
+ // 2. Parameter == Listener? TODO: Test!
pAnys[1] <<= aToRemoveListener;
- // TODO: Konvertierung String -> ?
+ // TODO: Convert String -> ?
// else
try
{