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 .
21 import java
.util
.HashMap
;
22 import com
.sun
.star
.accessibility
.AccessibleStateType
;
23 import com
.sun
.star
.accessibility
.AccessibleEventId
;
24 import com
.sun
.star
.accessibility
.AccessibleRole
;
25 import com
.sun
.star
.accessibility
.AccessibleRelationType
;
28 /** Provide names for several accessibility constants groups.
30 public class NameProvider
32 /** Return the name of the specified state.
34 Id of the state for which to return its name. This is one of
35 the ids listed in the <type>AccessibleStateType</const>
38 Returns the name of the specified state or an empty string if an
39 invalid / unknown state id was given.
41 public static String
getStateName (int nStateId
)
43 return maStateMap
.get (Integer
.valueOf(nStateId
));
47 /** Return the name of the specified event.
49 Id of the event type for which to return its name. This is one
50 of the ids listed in the <type>AccessibleEventId</const>
53 Returns the name of the specified event type or an empty string
54 if an invalid / unknown event id was given.
56 public static String
getEventName (int nEventId
)
58 return maEventMap
.get (Integer
.valueOf(nEventId
));
62 /** Return the name of the specified role.
64 Id of the role for which to return its name. This is one of
65 the ids listed in the <type>AccessibleRole</const>
68 Returns the name of the specified role or an empty string if an
69 invalid / unknown role id was given.
71 public static String
getRoleName (int nRole
)
73 return maRoleMap
.get (Integer
.valueOf(nRole
));
77 /** Return the name of the specified relation.
79 Id of the relation for which to return its name.
81 Returns the name of the specified relation type or an empty
82 string if an invalid / unknown relation type id was given.
84 public static String
getRelationName (AccessibleRelationType eRelation
)
86 return maRelationMap
.get(eRelation
);
90 private static HashMap
<Integer
, String
> maStateMap
= new HashMap
<Integer
, String
>();
91 private static HashMap
<Integer
, String
> maEventMap
= new HashMap
<Integer
, String
>();
92 private static HashMap
<Integer
, String
> maRoleMap
= new HashMap
<Integer
, String
>();
93 private static HashMap
<AccessibleRelationType
, String
> maRelationMap
= new HashMap
<AccessibleRelationType
, String
>();
96 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.INVALID
), "INVALID");
97 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.ACTIVE
), "ACTIVE");
98 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.ARMED
), "ARMED");
99 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.BUSY
), "BUSY");
100 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.CHECKABLE
), "CHECKABLE");
101 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.CHECKED
), "CHECKED");
102 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.DEFUNC
), "DEFUNC");
103 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.EDITABLE
), "EDITABLE");
104 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.ENABLED
), "ENABLED");
105 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.EXPANDABLE
), "EXPANDABLE");
106 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.EXPANDED
), "EXPANDED");
107 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.FOCUSABLE
), "FOCUSABLE");
108 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.FOCUSED
), "FOCUSED");
109 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.HORIZONTAL
), "HORIZONTAL");
110 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.ICONIFIED
), "ICONIFIED");
111 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.MODAL
), "MODAL");
112 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.MULTI_LINE
), "MULTI_LINE");
113 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.MULTI_SELECTABLE
), "MULTI_SELECTABLE");
114 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.OPAQUE
), "OPAQUE");
115 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.PRESSED
), "PRESSED");
116 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.RESIZABLE
), "RESIZABLE");
117 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.SELECTABLE
), "SELECTABLE");
118 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.SELECTED
), "SELECTED");
119 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.SENSITIVE
), "SENSITIVE");
120 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.SHOWING
), "SHOWING");
121 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.SINGLE_LINE
), "SINGLE_LINE");
122 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.STALE
), "STALE");
123 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.TRANSIENT
), "TRANSIENT");
124 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.VERTICAL
), "VERTICAL");
125 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.VISIBLE
), "VISIBLE");
126 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.MANAGES_DESCENDANTS
),
127 "MANAGES_DESCENDANTS");
130 maEventMap
.put (Integer
.valueOf(0),
132 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.NAME_CHANGED
),
134 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.DESCRIPTION_CHANGED
),
135 "DESCRIPTION_CHANGED");
136 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.ACTION_CHANGED
),
138 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.STATE_CHANGED
),
140 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.ACTIVE_DESCENDANT_CHANGED
),
141 "ACTIVE_DESCENDANT_CHANGED");
142 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.BOUNDRECT_CHANGED
),
143 "BOUNDRECT_CHANGED");
144 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.CHILD
),
146 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.INVALIDATE_ALL_CHILDREN
),
147 "INVALIDATE_ALL_CHILDREN");
148 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.SELECTION_CHANGED
),
149 "SELECTION_CHANGED");
150 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.VISIBLE_DATA_CHANGED
),
151 "VISIBLE_DATA_CHANGED");
152 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.VALUE_CHANGED
),
154 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.CONTENT_FLOWS_FROM_RELATION_CHANGED
),
155 "CONTENT_FLOWS_FROM_RELATION_CHANGED");
156 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.CONTENT_FLOWS_TO_RELATION_CHANGED
),
157 "CONTENT_FLOWS_TO_RELATION_CHANGED");
158 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.CONTROLLED_BY_RELATION_CHANGED
),
159 "CONTROLLED_BY_RELATION_CHANGED");
160 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.CONTROLLER_FOR_RELATION_CHANGED
),
161 "CONTROLLER_FOR_RELATION_CHANGED");
162 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.LABEL_FOR_RELATION_CHANGED
),
163 "LABEL_FOR_RELATION_CHANGED");
164 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.LABELED_BY_RELATION_CHANGED
),
165 "LABELED_BY_RELATION_CHANGED");
166 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.MEMBER_OF_RELATION_CHANGED
),
167 "MEMBER_OF_RELATION_CHANGED");
168 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.SUB_WINDOW_OF_RELATION_CHANGED
),
169 "SUB_WINDOW_OF_RELATION_CHANGED");
170 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.CARET_CHANGED
),
172 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.TEXT_SELECTION_CHANGED
),
173 "TEXT_SELECTION_CHANGED");
174 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.TEXT_CHANGED
),
176 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.TEXT_ATTRIBUTE_CHANGED
),
177 "TEXT_ATTRIBUTE_CHANGED");
178 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.HYPERTEXT_CHANGED
),
179 "HYPERTEXT_CHANGED");
180 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.TABLE_CAPTION_CHANGED
),
181 "TABLE_CAPTION_CHANGED");
182 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.TABLE_COLUMN_DESCRIPTION_CHANGED
),
183 "TABLE_COLUMN_DESCRIPTION_CHANGED");
184 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.TABLE_COLUMN_HEADER_CHANGED
),
185 "TABLE_COLUMN_HEADER_CHANGED");
186 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.TABLE_MODEL_CHANGED
),
187 "TABLE_MODEL_CHANGED");
188 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.TABLE_ROW_DESCRIPTION_CHANGED
),
189 "TABLE_ROW_DESCRIPTION_CHANGED");
190 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.TABLE_ROW_HEADER_CHANGED
),
191 "TABLE_ROW_HEADER_CHANGED");
192 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.TABLE_SUMMARY_CHANGED
),
193 "TABLE_SUMMARY_CHANGED");
195 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.UNKNOWN
), "UNKNOWN");
196 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.UNKNOWN
), "UNKNOWN");
197 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.ALERT
), "ALERT");
198 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.COLUMN_HEADER
), "COLUMN_HEADER");
199 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.CANVAS
), "CANVAS");
200 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.CHECK_BOX
), "CHECK_BOX");
201 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.CHECK_MENU_ITEM
), "CHECK_MENU_ITEM");
202 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.COLOR_CHOOSER
), "COLOR_CHOOSER");
203 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.COMBO_BOX
), "COMBO_BOX");
204 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.DESKTOP_ICON
), "DESKTOP_ICON");
205 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.DESKTOP_PANE
), "DESKTOP_PANE");
206 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.DIRECTORY_PANE
), "DIRECTORY_PANE");
207 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.DIALOG
), "DIALOG");
208 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.DOCUMENT
), "DOCUMENT");
209 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.EMBEDDED_OBJECT
), "EMBEDDED_OBJECT");
210 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.END_NOTE
), "END_NOTE");
211 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.FILE_CHOOSER
), "FILE_CHOOSER");
212 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.FILLER
), "FILLER");
213 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.FONT_CHOOSER
), "FONT_CHOOSER");
214 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.FOOTER
), "FOOTER");
215 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.FOOTNOTE
), "FOOTNOTE");
216 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.FRAME
), "FRAME");
217 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.GLASS_PANE
), "GLASS_PANE");
218 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.GRAPHIC
), "GRAPHIC");
219 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.GROUP_BOX
), "GROUP_BOX");
220 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.HEADER
), "HEADER");
221 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.HEADING
), "HEADING");
222 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.HYPER_LINK
), "HYPER_LINK");
223 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.ICON
), "ICON");
224 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.INTERNAL_FRAME
), "INTERNAL_FRAME");
225 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.LABEL
), "LABEL");
226 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.LAYERED_PANE
), "LAYERED_PANE");
227 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.LIST
), "LIST");
228 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.LIST_ITEM
), "LIST_ITEM");
229 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.MENU
), "MENU");
230 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.MENU_BAR
), "MENU_BAR");
231 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.MENU_ITEM
), "MENU_ITEM");
232 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.OPTION_PANE
), "OPTION_PANE");
233 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.PAGE_TAB
), "PAGE_TAB");
234 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.PAGE_TAB_LIST
), "PAGE_TAB_LIST");
235 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.PANEL
), "PANEL");
236 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.PARAGRAPH
), "PARAGRAPH");
237 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.PASSWORD_TEXT
), "PASSWORD_TEXT");
238 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.POPUP_MENU
), "POPUP_MENU");
239 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.PUSH_BUTTON
), "PUSH_BUTTON");
240 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.PROGRESS_BAR
), "PROGRESS_BAR");
241 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.RADIO_BUTTON
), "RADIO_BUTTON");
242 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.RADIO_MENU_ITEM
), "RADIO_MENU_ITEM");
243 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.ROW_HEADER
), "ROW_HEADER");
244 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.ROOT_PANE
), "ROOT_PANE");
245 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.SCROLL_BAR
), "SCROLL_BAR");
246 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.SCROLL_PANE
), "SCROLL_PANE");
247 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.SHAPE
), "SHAPE");
248 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.SEPARATOR
), "SEPARATOR");
249 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.SLIDER
), "SLIDER");
250 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.SPIN_BOX
), "SPIN_BOX");
251 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.SPLIT_PANE
), "SPLIT_PANE");
252 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.STATIC
), "STATIC");
253 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.STATUS_BAR
), "STATUS_BAR");
254 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.TABLE
), "TABLE");
255 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.TABLE_CELL
), "TABLE_CELL");
256 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.TEXT
), "TEXT");
257 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.TEXT_FRAME
), "TEXT_FRAME");
258 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.TOGGLE_BUTTON
), "TOGGLE_BUTTON");
259 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.TOOL_BAR
), "TOOL_BAR");
260 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.TOOL_TIP
), "TOOL_TIP");
261 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.TREE
), "TREE");
262 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.VIEW_PORT
), "VIEW_PORT");
263 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.WINDOW
), "WINDOW");
265 maRelationMap
.put (AccessibleRelationType
.INVALID
, "INVALID");
266 maRelationMap
.put (AccessibleRelationType
.CONTENT_FLOWS_FROM
, "CONTENT_FLOWS_FROM");
267 maRelationMap
.put (AccessibleRelationType
.CONTENT_FLOWS_TO
, "CONTENT_FLOWS_TO");
268 maRelationMap
.put (AccessibleRelationType
.CONTROLLED_BY
, "CONTROLLED_BY");
269 maRelationMap
.put (AccessibleRelationType
.CONTROLLER_FOR
, "CONTROLLER_FOR");
270 maRelationMap
.put (AccessibleRelationType
.LABEL_FOR
, "LABEL_FOR");
271 maRelationMap
.put (AccessibleRelationType
.LABELED_BY
, "LABELED_BY");
272 maRelationMap
.put (AccessibleRelationType
.MEMBER_OF
, "MEMBER_OF");
273 maRelationMap
.put (AccessibleRelationType
.SUB_WINDOW_OF
, "SUB_WINDOW_OF");