Hi Alex,

com::sun::star::lang::XEventListener is not deprecated.
The problem looks to be that the document implements two "addEventListener()" methods that differ only by the type of the provided argument. You need the one that gets com::sun::star::lang::XEventListener.

If I am not wrong there was a solution for Basic that has allowed to resolve the ambiguity. Unfortunately I can not currently remember how exactly should it look like.

instead of

    oDoc.addEventListener(...)

you can also write:

    oDoc.com_sun_star_lang_XEventListener_addEventListener(...)

to force the usage of the correct interface.

Regards

Andreas



Best regards,
Mikhail.

On 04/29/09 13:29, Bernard Marcelly wrote:
Hi Alex,
According to the IDL documentation, XEventListener is deprecated.
Use (still unpublished) XDocumentEventListener.
<http://api.openoffice.org/docs/common/ref/com/sun/star/document/XDocumentEventListener.html>

Regards
  Bernard

Message de Alex P  date 2009-04-29 12:37 :
Hello!
I've got a Problem with the registration of my Event-Handler since I installed OpenOffice.org 3. My Basic script to register my simple Eventhandler seems to be obsolete and I dont find the correct fix for this. I only want to capture the Close of my Document to sent a message to my application.


Here my old script (from an old OO example), which produces this Exception:

Type: com.sun.star.lang.IllegalArgumentException
Message: cannot coerce argument type during corereflection call!


Sub StartCloseListening()
 oDoc = ThisComponent
oEventListener = CreateUnoListener( "DocCloseListener_", "com.sun.star.lang.XEventListener" ) oDoc.addEventListener( oEventListener ) <--- Here comes the exception!!
End Sub

Sub DocCloseListener_disposing( oEvent )
 AutoClose()
End Sub


Thanks for Help

Alex P.



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]





--
===================================================================
Sitz der Gesellschaft: Sun Microsystems GmbH, Sonnenallee 1,
D-85551 Kirchheim-Heimstetten
Amtsgericht Muenchen: HRB 161028
Geschaeftsfuehrer: Thomas Schroeder, Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Haering

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to