merged tag ooo/DEV300_m102
[LibreOffice.git] / toolkit / test / accessibility / ov / ListeningObjectView.java
blob574fa989b20fced66a1e8dfcf8c3068aee210507
1 package ov;
3 import com.sun.star.accessibility.AccessibleEventObject;
4 import com.sun.star.accessibility.XAccessibleContext;
5 import com.sun.star.accessibility.XAccessibleEventBroadcaster;
6 import com.sun.star.accessibility.XAccessibleEventListener;
7 import com.sun.star.lang.EventObject;
8 import com.sun.star.uno.UnoRuntime;
10 /** Base class for object views that regsiters as accessibility event
11 listener.
13 abstract class ListeningObjectView
14 extends ObjectView
15 implements XAccessibleEventListener
17 public ListeningObjectView (ObjectViewContainer aContainer)
19 super (aContainer);
22 /** Add this object as event listener at the broadcasting
23 accessible object.
25 public void SetObject (XAccessibleContext xContext)
27 super.SetObject (xContext);
28 XAccessibleEventBroadcaster xBroadcaster =
29 (XAccessibleEventBroadcaster)UnoRuntime.queryInterface(
30 XAccessibleEventBroadcaster.class, xContext);
31 if (xBroadcaster != null)
32 xBroadcaster.addEventListener (this);
36 /** Remove this object as event listener from the broadcasting
37 accessible object.
39 public void Destroy ()
41 super.Destroy ();
42 XAccessibleEventBroadcaster xBroadcaster =
43 (XAccessibleEventBroadcaster)UnoRuntime.queryInterface(
44 XAccessibleEventBroadcaster.class, mxContext);
45 if (xBroadcaster != null)
46 xBroadcaster.removeEventListener (this);
49 /** Derived classes have to implement this method to handle incoming
50 events.
52 abstract public void notifyEvent (AccessibleEventObject aEvent);
54 /** The disposing event is ignored per default. If a derived class is
55 interested it can overwrite this method.
57 public void disposing (EventObject aEvent)