2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 import com
.sun
.star
.accessibility
.*;
21 /** Objects of this class (usually one, singleton?) listen to accessible
22 events of all objects in all trees.
24 public class EventListener
26 private boolean mbVerbose
= false;
28 public EventListener (AccessibilityTreeModel aTreeModel
)
30 maTreeModel
= aTreeModel
;
34 /** This method handles accessibility objects that are being disposed.
36 public void disposing (XAccessibleContext xContext
)
39 System
.out
.println("disposing " + xContext
);
40 maTreeModel
.removeNode (xContext
);
43 /** This method is called from accessible objects that broadcast
44 modifications of themselves or from their children. The event is
45 processed only, except printing some messages, if the tree is not
46 locked. It should be locked during changes to its internal
47 structure like expanding nodes.
49 public void notifyEvent (AccessibleEventObject aEvent
)
51 EventHandler aHandler
;
53 switch (aEvent
.EventId
)
55 case AccessibleEventId
.CHILD
:
56 aHandler
= new ChildEventHandler (aEvent
, maTreeModel
);
59 case AccessibleEventId
.BOUNDRECT_CHANGED
:
60 case AccessibleEventId
.VISIBLE_DATA_CHANGED
:
61 aHandler
= new GeometryEventHandler (aEvent
, maTreeModel
);
65 case AccessibleEventId
.NAME_CHANGED
:
66 case AccessibleEventId
.DESCRIPTION_CHANGED
:
67 case AccessibleEventId
.STATE_CHANGED
:
68 case AccessibleEventId
.SELECTION_CHANGED
:
69 aHandler
= new ContextEventHandler (aEvent
, maTreeModel
);
72 case AccessibleEventId
.TABLE_MODEL_CHANGED
:
73 case AccessibleEventId
.TABLE_CAPTION_CHANGED
:
74 case AccessibleEventId
.TABLE_COLUMN_DESCRIPTION_CHANGED
:
75 case AccessibleEventId
.TABLE_COLUMN_HEADER_CHANGED
:
76 case AccessibleEventId
.TABLE_ROW_DESCRIPTION_CHANGED
:
77 case AccessibleEventId
.TABLE_ROW_HEADER_CHANGED
:
78 case AccessibleEventId
.TABLE_SUMMARY_CHANGED
:
79 aHandler
= new TableEventHandler (aEvent
, maTreeModel
);
82 case AccessibleEventId
.ACTION_CHANGED
:
83 case AccessibleEventId
.HYPERTEXT_CHANGED
:
84 case AccessibleEventId
.ACTIVE_DESCENDANT_CHANGED
:
85 case AccessibleEventId
.CARET_CHANGED
:
86 case AccessibleEventId
.TEXT_CHANGED
:
87 case AccessibleEventId
.VALUE_CHANGED
:
88 aHandler
= new EventHandler (aEvent
, maTreeModel
);
97 System
.out
.println (" unhandled event");
101 aHandler
.Print (System
.out
);
107 private final AccessibilityTreeModel maTreeModel
;