1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 #ifndef __ACCHELPER_HXX
23 #define __ACCHELPER_HXX
24 
25 #include <com/sun/star/accessibility/XAccessibleText.hpp>
26 #include <com/sun/star/accessibility/AccessibleRole.hpp>
27 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
28 
29 #include "UAccCOM2.h"
30 
31 enum DIRECTION
32 {
33     FIRST_CHILD=0,
34     LAST_CHILD=-1,
35     BEFORE_CHILD=1 ,
36     AFTER_CHILD=2
37 };
38 
39 #define CHILDID_SELF			 0
40 #define UNO_MSAA_UNMAPPING		 0x00000000
41 
42 using namespace com::sun::star::uno;
43 using namespace com::sun::star::accessibility::AccessibleRole;
44 using namespace com::sun::star::accessibility::AccessibleStateType;
45 
46 //Role mapping table,left side is UNO role, right side is MSAA role
47 const short ROLE_TABLE[][2] =
48     {
49         {UNKNOWN,				   IA2_ROLE_UNKNOWN},
50         {ALERT ,                   ROLE_SYSTEM_DIALOG},
51         {COLUMN_HEADER ,           ROLE_SYSTEM_COLUMNHEADER},
52         //{CANVAS ,                  ROLE_SYSTEM_CLIENT},
53         {CANVAS ,                  IA2_ROLE_CANVAS},
54         {CHECK_BOX ,               ROLE_SYSTEM_CHECKBUTTON},
55         {CHECK_MENU_ITEM ,         IA2_ROLE_CHECK_MENU_ITEM},
56         {COLOR_CHOOSER,			   IA2_ROLE_COLOR_CHOOSER},
57         {COMBO_BOX ,               ROLE_SYSTEM_COMBOBOX},
58         {DATE_EDITOR ,             IA2_ROLE_DATE_EDITOR},
59         {DESKTOP_ICON ,			   IA2_ROLE_DESKTOP_ICON},
60         {DESKTOP_PANE,             IA2_ROLE_DESKTOP_PANE},
61         {DIRECTORY_PANE,           IA2_ROLE_DIRECTORY_PANE},
62         {DIALOG,                   ROLE_SYSTEM_DIALOG},
63         {DOCUMENT,                 ROLE_SYSTEM_DOCUMENT},
64         {EMBEDDED_OBJECT ,		   IA2_ROLE_EMBEDDED_OBJECT },
65         {END_NOTE ,				   IA2_ROLE_ENDNOTE },
66         {FILE_CHOOSER ,			   IA2_ROLE_FILE_CHOOSER },
67         {FILLER,                   ROLE_SYSTEM_WHITESPACE},
68         {FONT_CHOOSER,			   IA2_ROLE_FONT_CHOOSER},
69         {FOOTER,				   IA2_ROLE_FOOTER},
70         {FOOTNOTE,				   IA2_ROLE_FOOTNOTE},
71         //{FRAME,					   IA2_ROLE_FRAME},
72         {FRAME,					   ROLE_SYSTEM_DIALOG},
73         {GLASS_PANE ,              IA2_ROLE_GLASS_PANE},
74         {GRAPHIC ,                 ROLE_SYSTEM_GRAPHIC},
75         {GROUP_BOX,                ROLE_SYSTEM_GROUPING},
76         {HEADER	,				   IA2_ROLE_HEADER},
77         {HEADING ,                 IA2_ROLE_HEADING},
78         {HYPER_LINK ,              ROLE_SYSTEM_TEXT},
79         {ICON ,                    IA2_ROLE_ICON},
80         {INTERNAL_FRAME,           IA2_ROLE_INTERNAL_FRAME},
81         {LABEL,                    ROLE_SYSTEM_STATICTEXT},
82         {LAYERED_PANE ,            IA2_ROLE_LAYERED_PANE},
83         {LIST ,                    ROLE_SYSTEM_LIST},
84         {LIST_ITEM ,               ROLE_SYSTEM_LISTITEM},
85         //{MENU ,                    ROLE_SYSTEM_MENUPOPUP},
86         {MENU,                ROLE_SYSTEM_MENUITEM},
87         {MENU_BAR,                 ROLE_SYSTEM_MENUBAR},
88         {MENU_ITEM,                ROLE_SYSTEM_MENUITEM},
89         {OPTION_PANE ,             IA2_ROLE_OPTION_PANE},
90         {PAGE_TAB,                 ROLE_SYSTEM_PAGETAB},
91         {PAGE_TAB_LIST,            ROLE_SYSTEM_PAGETABLIST},
92         {PANEL,                    IA2_ROLE_OPTION_PANE},
93         {PARAGRAPH,                IA2_ROLE_PARAGRAPH},
94         {PASSWORD_TEXT,            ROLE_SYSTEM_TEXT},
95         {POPUP_MENU,               ROLE_SYSTEM_MENUPOPUP},
96         {PUSH_BUTTON,              ROLE_SYSTEM_PUSHBUTTON},
97         {PROGRESS_BAR,             ROLE_SYSTEM_PROGRESSBAR},
98         {RADIO_BUTTON,             ROLE_SYSTEM_RADIOBUTTON},
99         {RADIO_MENU_ITEM,     	   IA2_ROLE_RADIO_MENU_ITEM},
100         {ROW_HEADER ,              ROLE_SYSTEM_ROWHEADER},
101         {ROOT_PANE,                IA2_ROLE_ROOT_PANE},
102         {SCROLL_BAR ,              ROLE_SYSTEM_SCROLLBAR},
103         {SCROLL_PANE ,             IA2_ROLE_SCROLL_PANE},
104         {SHAPE,					   IA2_ROLE_SHAPE},
105         {SEPARATOR ,               ROLE_SYSTEM_SEPARATOR},
106         {SLIDER ,                  ROLE_SYSTEM_SLIDER},
107         {SPIN_BOX ,                ROLE_SYSTEM_SPINBUTTON},
108         {SPLIT_PANE,               IA2_ROLE_SPLIT_PANE},
109         {STATUS_BAR,               ROLE_SYSTEM_STATUSBAR},
110         {TABLE,                    ROLE_SYSTEM_TABLE},
111         {TABLE_CELL ,              ROLE_SYSTEM_CELL},
112         {TEXT,                     ROLE_SYSTEM_TEXT},
113         {TEXT_FRAME ,			   IA2_ROLE_TEXT_FRAME},
114         //for change toggle button to push button for jaws
115         {TOGGLE_BUTTON,            ROLE_SYSTEM_PUSHBUTTON},
116 
117         {TOOL_BAR,                 ROLE_SYSTEM_TOOLBAR},
118         {TOOL_TIP,                 ROLE_SYSTEM_TOOLTIP},
119         {TREE ,                    ROLE_SYSTEM_OUTLINE},
120         {VIEW_PORT ,			   IA2_ROLE_VIEW_PORT},
121         {WINDOW,                   ROLE_SYSTEM_WINDOW},
122 		{BUTTON_DROPDOWN,  ROLE_SYSTEM_BUTTONDROPDOWN},
123 		{BUTTON_MENU,			  ROLE_SYSTEM_BUTTONMENU},
124 		{CAPTION,					IA2_ROLE_CAPTION},
125 		{CHART,						IA2_ROLE_SHAPE},
126 		{EDIT_BAR,					IA2_ROLE_EDITBAR},
127 		{FORM,						IA2_ROLE_FORM},
128 		{IMAGE_MAP ,			  IA2_ROLE_IMAGE_MAP},
129 		{NOTE,						IA2_ROLE_NOTE},
130 		{PAGE,						IA2_ROLE_PAGE},
131 		{RULER ,				  IA2_ROLE_RULER},
132 		{SECTION,					IA2_ROLE_SECTION},
133         {TREE_ITEM ,              ROLE_SYSTEM_OUTLINEITEM},
134 		{TREE_TABLE,				ROLE_SYSTEM_OUTLINE}
135     };
136 
137 struct ltstr4
138 {
operator ()ltstr4139     bool operator()(const long  s1, const long  s2) const
140     {
141         return long(s1)<long(s2);
142     }
143 };
144 
145 #endif
146