Mathias Bauer ha scritto:
news.gmane.org wrote:

Hello,
I have a java application which intercepts events from an office bean using the GlobalEventBroadcaster interface.
[CUT]
My goal is to find at least the name of the file being loaded, or better a unique ID identifying the instance of the bean which generated the event.
Any idea?

Why don't you take the EventSource argument of your notification call?
It is a reference to the document for that the event is notified.

I'm already getting the EventObject using the code below, but I could not find the document name in the Properties.

Is there a may to get the document name?
Thank you

XEventBroadcaster xEventBroad = (XEventBroadcaster)UnoRuntime.queryInterface(XEventBroadcaster.class, xGlobalBroadCaster);
                        xEventBroad.addEventListener(new 
com.sun.star.document.XEventListener() {
                                public void 
notifyEvent(com.sun.star.document.EventObject oEvent) {
//                                       the control model which fired the event
System.out.println("Evento da : " + oEvent.Source + " " + oEvent.EventName); XPropertySet xSourceProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class,oEvent.Source);
                                        if (xSourceProps!=null) {
Property[] aoProps = xSourceProps.getPropertySetInfo().getProperties();
                                                for(int iCount=0; 
iCount<aoProps.length; iCount++) {
System.out.println("Property " + iCount + ": " + aoProps[iCount].Name);
                                                }
                                                //String sUid = 
(String)xSourceProps.getPropertyValue("RuntimeUID");
                                        }
                                }
                                public void 
disposing(com.sun.star.lang.EventObject e) {
                                    System.out.println("On Dispose");
                                }
                        });

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to