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. This is one of
80 the ids listed in the <type>AccessibleRelationType</const>
83 Returns the name of the specified relation type or an empty
84 string if an invalid / unknown role id was given.
86 public static String
getRelationName (int nRelation
)
88 return maRelationMap
.get (Integer
.valueOf(nRelation
));
92 private static HashMap
<Integer
, String
> maStateMap
= new HashMap
<Integer
, String
>();
93 private static HashMap
<Integer
, String
> maEventMap
= new HashMap
<Integer
, String
>();
94 private static HashMap
<Integer
, String
> maRoleMap
= new HashMap
<Integer
, String
>();
95 private static HashMap
<Integer
, String
> maRelationMap
= new HashMap
<Integer
, String
>();
98 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.INVALID
), "INVALID");
99 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.ACTIVE
), "ACTIVE");
100 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.ARMED
), "ARMED");
101 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.BUSY
), "BUSY");
102 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.CHECKED
), "CHECKED");
103 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.DEFUNC
), "DEFUNC");
104 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.EDITABLE
), "EDITABLE");
105 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.ENABLED
), "ENABLED");
106 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.EXPANDABLE
), "EXPANDABLE");
107 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.EXPANDED
), "EXPANDED");
108 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.FOCUSABLE
), "FOCUSABLE");
109 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.FOCUSED
), "FOCUSED");
110 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.HORIZONTAL
), "HORIZONTAL");
111 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.ICONIFIED
), "ICONIFIED");
112 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.MODAL
), "MODAL");
113 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.MULTI_LINE
), "MULTI_LINE");
114 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.MULTI_SELECTABLE
), "MULTI_SELECTABLE");
115 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.OPAQUE
), "OPAQUE");
116 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.PRESSED
), "PRESSED");
117 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.RESIZABLE
), "RESIZABLE");
118 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.SELECTABLE
), "SELECTABLE");
119 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.SELECTED
), "SELECTED");
120 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.SENSITIVE
), "SENSITIVE");
121 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.SHOWING
), "SHOWING");
122 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.SINGLE_LINE
), "SINGLE_LINE");
123 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.STALE
), "STALE");
124 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.TRANSIENT
), "TRANSIENT");
125 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.VERTICAL
), "VERTICAL");
126 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.VISIBLE
), "VISIBLE");
127 maStateMap
.put (Integer
.valueOf(AccessibleStateType
.MANAGES_DESCENDANTS
),
128 "MANAGES_DESCENDANTS");
131 maEventMap
.put (Integer
.valueOf(0),
133 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.NAME_CHANGED
),
135 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.DESCRIPTION_CHANGED
),
136 "DESCRIPTION_CHANGED");
137 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.ACTION_CHANGED
),
139 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.STATE_CHANGED
),
141 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.ACTIVE_DESCENDANT_CHANGED
),
142 "ACTIVE_DESCENDANT_CHANGED");
143 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.BOUNDRECT_CHANGED
),
144 "BOUNDRECT_CHANGED");
145 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.CHILD
),
147 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.INVALIDATE_ALL_CHILDREN
),
148 "INVALIDATE_ALL_CHILDREN");
149 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.SELECTION_CHANGED
),
150 "SELECTION_CHANGED");
151 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.VISIBLE_DATA_CHANGED
),
152 "VISIBLE_DATA_CHANGED");
153 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.VALUE_CHANGED
),
155 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.CONTENT_FLOWS_FROM_RELATION_CHANGED
),
156 "CONTENT_FLOWS_FROM_RELATION_CHANGED");
157 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.CONTENT_FLOWS_TO_RELATION_CHANGED
),
158 "CONTENT_FLOWS_TO_RELATION_CHANGED");
159 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.CONTROLLED_BY_RELATION_CHANGED
),
160 "CONTROLLED_BY_RELATION_CHANGED");
161 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.CONTROLLER_FOR_RELATION_CHANGED
),
162 "CONTROLLER_FOR_RELATION_CHANGED");
163 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.LABEL_FOR_RELATION_CHANGED
),
164 "LABEL_FOR_RELATION_CHANGED");
165 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.LABELED_BY_RELATION_CHANGED
),
166 "LABELED_BY_RELATION_CHANGED");
167 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.MEMBER_OF_RELATION_CHANGED
),
168 "MEMBER_OF_RELATION_CHANGED");
169 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.SUB_WINDOW_OF_RELATION_CHANGED
),
170 "SUB_WINDOW_OF_RELATION_CHANGED");
171 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.CARET_CHANGED
),
173 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.TEXT_SELECTION_CHANGED
),
174 "TEXT_SELECTION_CHANGED");
175 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.TEXT_CHANGED
),
177 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.TEXT_ATTRIBUTE_CHANGED
),
178 "TEXT_ATTRIBUTE_CHANGED");
179 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.HYPERTEXT_CHANGED
),
180 "HYPERTEXT_CHANGED");
181 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.TABLE_CAPTION_CHANGED
),
182 "TABLE_CAPTION_CHANGED");
183 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.TABLE_COLUMN_DESCRIPTION_CHANGED
),
184 "TABLE_COLUMN_DESCRIPTION_CHANGED");
185 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.TABLE_COLUMN_HEADER_CHANGED
),
186 "TABLE_COLUMN_HEADER_CHANGED");
187 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.TABLE_MODEL_CHANGED
),
188 "TABLE_MODEL_CHANGED");
189 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.TABLE_ROW_DESCRIPTION_CHANGED
),
190 "TABLE_ROW_DESCRIPTION_CHANGED");
191 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.TABLE_ROW_HEADER_CHANGED
),
192 "TABLE_ROW_HEADER_CHANGED");
193 maEventMap
.put (Integer
.valueOf(AccessibleEventId
.TABLE_SUMMARY_CHANGED
),
194 "TABLE_SUMMARY_CHANGED");
196 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.UNKNOWN
), "UNKNOWN");
197 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.UNKNOWN
), "UNKNOWN");
198 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.ALERT
), "ALERT");
199 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.COLUMN_HEADER
), "COLUMN_HEADER");
200 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.CANVAS
), "CANVAS");
201 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.CHECK_BOX
), "CHECK_BOX");
202 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.CHECK_MENU_ITEM
), "CHECK_MENU_ITEM");
203 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.COLOR_CHOOSER
), "COLOR_CHOOSER");
204 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.COMBO_BOX
), "COMBO_BOX");
205 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.DESKTOP_ICON
), "DESKTOP_ICON");
206 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.DESKTOP_PANE
), "DESKTOP_PANE");
207 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.DIRECTORY_PANE
), "DIRECTORY_PANE");
208 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.DIALOG
), "DIALOG");
209 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.DOCUMENT
), "DOCUMENT");
210 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.EMBEDDED_OBJECT
), "EMBEDDED_OBJECT");
211 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.END_NOTE
), "END_NOTE");
212 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.FILE_CHOOSER
), "FILE_CHOOSER");
213 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.FILLER
), "FILLER");
214 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.FONT_CHOOSER
), "FONT_CHOOSER");
215 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.FOOTER
), "FOOTER");
216 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.FOOTNOTE
), "FOOTNOTE");
217 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.FRAME
), "FRAME");
218 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.GLASS_PANE
), "GLASS_PANE");
219 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.GRAPHIC
), "GRAPHIC");
220 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.GROUP_BOX
), "GROUP_BOX");
221 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.HEADER
), "HEADER");
222 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.HEADING
), "HEADING");
223 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.HYPER_LINK
), "HYPER_LINK");
224 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.ICON
), "ICON");
225 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.INTERNAL_FRAME
), "INTERNAL_FRAME");
226 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.LABEL
), "LABEL");
227 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.LAYERED_PANE
), "LAYERED_PANE");
228 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.LIST
), "LIST");
229 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.LIST_ITEM
), "LIST_ITEM");
230 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.MENU
), "MENU");
231 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.MENU_BAR
), "MENU_BAR");
232 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.MENU_ITEM
), "MENU_ITEM");
233 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.OPTION_PANE
), "OPTION_PANE");
234 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.PAGE_TAB
), "PAGE_TAB");
235 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.PAGE_TAB_LIST
), "PAGE_TAB_LIST");
236 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.PANEL
), "PANEL");
237 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.PARAGRAPH
), "PARAGRAPH");
238 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.PASSWORD_TEXT
), "PASSWORD_TEXT");
239 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.POPUP_MENU
), "POPUP_MENU");
240 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.PUSH_BUTTON
), "PUSH_BUTTON");
241 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.PROGRESS_BAR
), "PROGRESS_BAR");
242 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.RADIO_BUTTON
), "RADIO_BUTTON");
243 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.RADIO_MENU_ITEM
), "RADIO_MENU_ITEM");
244 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.ROW_HEADER
), "ROW_HEADER");
245 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.ROOT_PANE
), "ROOT_PANE");
246 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.SCROLL_BAR
), "SCROLL_BAR");
247 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.SCROLL_PANE
), "SCROLL_PANE");
248 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.SHAPE
), "SHAPE");
249 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.SEPARATOR
), "SEPARATOR");
250 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.SLIDER
), "SLIDER");
251 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.SPIN_BOX
), "SPIN_BOX");
252 maRoleMap
.put (Integer
.valueOf(AccessibleRole
.SPLIT_PANE
), "SPLIT_PANE");
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 (Integer
.valueOf(AccessibleRelationType
.INVALID
), "INVALID");
266 maRelationMap
.put (Integer
.valueOf(AccessibleRelationType
.CONTENT_FLOWS_FROM
), "CONTENT_FLOWS_FROM");
267 maRelationMap
.put (Integer
.valueOf(AccessibleRelationType
.CONTENT_FLOWS_TO
), "CONTENT_FLOWS_TO");
268 maRelationMap
.put (Integer
.valueOf(AccessibleRelationType
.CONTROLLED_BY
), "CONTROLLED_BY");
269 maRelationMap
.put (Integer
.valueOf(AccessibleRelationType
.CONTROLLER_FOR
), "CONTROLLER_FOR");
270 maRelationMap
.put (Integer
.valueOf(AccessibleRelationType
.LABEL_FOR
), "LABEL_FOR");
271 maRelationMap
.put (Integer
.valueOf(AccessibleRelationType
.LABELED_BY
), "LABELED_BY");
272 maRelationMap
.put (Integer
.valueOf(AccessibleRelationType
.MEMBER_OF
), "MEMBER_OF");
273 maRelationMap
.put (Integer
.valueOf(AccessibleRelationType
.SUB_WINDOW_OF
), "SUB_WINDOW_OF");