merge the formfield patch from ooo-build
[ooovba.git] / toolkit / test / accessibility / EventHandler.java
blob616448e5d769346ea3f84aefa85fa71c9de2ba1c
1 import com.sun.star.accessibility.XAccessible;
2 import com.sun.star.accessibility.XAccessibleContext;
3 import com.sun.star.accessibility.AccessibleEventObject;
4 import com.sun.star.uno.UnoRuntime;
6 import java.io.PrintStream;
8 import tools.NameProvider;
10 /** Base class for handling of accessibility events.
12 class EventHandler
14 public EventHandler (AccessibleEventObject aEvent, AccessibilityTreeModel aTreeModel)
16 maEvent = aEvent;
17 maTreeModel = aTreeModel;
19 mnEventId = aEvent.EventId;
21 mxEventSource = (XAccessibleContext)UnoRuntime.queryInterface(
22 XAccessibleContext.class, aEvent.Source);
23 if (mxEventSource == null)
25 XAccessible xAccessible = (XAccessible)UnoRuntime.queryInterface(
26 XAccessible.class, aEvent.Source);
27 if (xAccessible != null)
28 mxEventSource = xAccessible.getAccessibleContext();
32 public void Print (PrintStream out)
34 out.println ("Event id is " + mnEventId
35 + " (" + NameProvider.getEventName(mnEventId)+")"
36 + " for " + mxEventSource.getAccessibleName() + " / "
37 + NameProvider.getRoleName (mxEventSource.getAccessibleRole()));
38 PrintOldAndNew (out);
41 public void PrintOldAndNew (PrintStream out)
43 out.println (" old value is " + maEvent.OldValue);
44 out.println (" new value is " + maEvent.NewValue);
47 public void Process ()
49 System.out.println ("processing of event " + maEvent + " not implemented");
52 protected AccessibleEventObject maEvent;
53 protected AccessibilityTreeModel maTreeModel;
55 protected int mnEventId;
56 protected XAccessibleContext mxEventSource;