1*3a700b0aSSteve Yin /**************************************************************
2*3a700b0aSSteve Yin  *
3*3a700b0aSSteve Yin  * Licensed to the Apache Software Foundation (ASF) under one
4*3a700b0aSSteve Yin  * or more contributor license agreements.  See the NOTICE file
5*3a700b0aSSteve Yin  * distributed with this work for additional information
6*3a700b0aSSteve Yin  * regarding copyright ownership.  The ASF licenses this file
7*3a700b0aSSteve Yin  * to you under the Apache License, Version 2.0 (the
8*3a700b0aSSteve Yin  * "License"); you may not use this file except in compliance
9*3a700b0aSSteve Yin  * with the License.  You may obtain a copy of the License at
10*3a700b0aSSteve Yin  *
11*3a700b0aSSteve Yin  *   http://www.apache.org/licenses/LICENSE-2.0
12*3a700b0aSSteve Yin  *
13*3a700b0aSSteve Yin  * Unless required by applicable law or agreed to in writing,
14*3a700b0aSSteve Yin  * software distributed under the License is distributed on an
15*3a700b0aSSteve Yin  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*3a700b0aSSteve Yin  * KIND, either express or implied.  See the License for the
17*3a700b0aSSteve Yin  * specific language governing permissions and limitations
18*3a700b0aSSteve Yin  * under the License.
19*3a700b0aSSteve Yin  *
20*3a700b0aSSteve Yin  *************************************************************/
215fdc4257SSteve Yin 
225fdc4257SSteve Yin #ifndef __ACCHELPER_HXX
235fdc4257SSteve Yin #define __ACCHELPER_HXX
245fdc4257SSteve Yin 
255fdc4257SSteve Yin #include <com/sun/star/accessibility/XAccessibleText.hpp>
265fdc4257SSteve Yin #include <com/sun/star/accessibility/AccessibleRole.hpp>
275fdc4257SSteve Yin #include <com/sun/star/accessibility/AccessibleStateType.hpp>
285fdc4257SSteve Yin 
295fdc4257SSteve Yin #include "AccessibleRole.h"
305fdc4257SSteve Yin 
315fdc4257SSteve Yin 
325fdc4257SSteve Yin #include "UAccCOM2.h"
335fdc4257SSteve Yin 
345fdc4257SSteve Yin enum DIRECTION
355fdc4257SSteve Yin {
365fdc4257SSteve Yin     FIRST_CHILD=0,
375fdc4257SSteve Yin     LAST_CHILD=-1,
385fdc4257SSteve Yin     BEFORE_CHILD=1 ,
395fdc4257SSteve Yin     AFTER_CHILD=2
405fdc4257SSteve Yin };
415fdc4257SSteve Yin 
425fdc4257SSteve Yin #define CHILDID_SELF			 0
435fdc4257SSteve Yin #define UNO_MSAA_UNMAPPING		 0x00000000
445fdc4257SSteve Yin 
455fdc4257SSteve Yin using namespace com::sun::star::uno;
465fdc4257SSteve Yin using namespace com::sun::star::accessibility::AccessibleRole;
475fdc4257SSteve Yin using namespace com::sun::star::accessibility::AccessibleStateType;
485fdc4257SSteve Yin 
495fdc4257SSteve Yin //Role mapping table,left side is UNO role, right side is MSAA role
505fdc4257SSteve Yin const short ROLE_TABLE[][2] =
515fdc4257SSteve Yin     {
525fdc4257SSteve Yin         {UNKNOWN,				   IA2_ROLE_UNKNOWN},
535fdc4257SSteve Yin         {ALERT ,                   ROLE_SYSTEM_DIALOG},
545fdc4257SSteve Yin         {COLUMN_HEADER ,           ROLE_SYSTEM_COLUMNHEADER},
555fdc4257SSteve Yin         //{CANVAS ,                  ROLE_SYSTEM_CLIENT},
565fdc4257SSteve Yin         {CANVAS ,                  IA2_ROLE_CANVAS},
575fdc4257SSteve Yin         {CHECK_BOX ,               ROLE_SYSTEM_CHECKBUTTON},
585fdc4257SSteve Yin         {CHECK_MENU_ITEM ,         IA2_ROLE_CHECK_MENU_ITEM},
595fdc4257SSteve Yin         {COLOR_CHOOSER,			   IA2_ROLE_COLOR_CHOOSER},
605fdc4257SSteve Yin         {COMBO_BOX ,               ROLE_SYSTEM_COMBOBOX},
615fdc4257SSteve Yin         {DATE_EDITOR ,             IA2_ROLE_DATE_EDITOR},
625fdc4257SSteve Yin         {DESKTOP_ICON ,			   IA2_ROLE_DESKTOP_ICON},
635fdc4257SSteve Yin         {DESKTOP_PANE,             IA2_ROLE_DESKTOP_PANE},
645fdc4257SSteve Yin         {DIRECTORY_PANE,           IA2_ROLE_DIRECTORY_PANE},
655fdc4257SSteve Yin         {DIALOG,                   ROLE_SYSTEM_DIALOG},
665fdc4257SSteve Yin         {DOCUMENT,                 ROLE_SYSTEM_DOCUMENT},
675fdc4257SSteve Yin         {EMBEDDED_OBJECT ,		   IA2_ROLE_EMBEDDED_OBJECT },
685fdc4257SSteve Yin         {END_NOTE ,				   IA2_ROLE_ENDNOTE },
695fdc4257SSteve Yin         {FILE_CHOOSER ,			   IA2_ROLE_FILE_CHOOSER },
705fdc4257SSteve Yin         {FILLER,                   ROLE_SYSTEM_WHITESPACE},
715fdc4257SSteve Yin         {FONT_CHOOSER,			   IA2_ROLE_FONT_CHOOSER},
725fdc4257SSteve Yin         {FOOTER,				   IA2_ROLE_FOOTER},
735fdc4257SSteve Yin         {FOOTNOTE,				   IA2_ROLE_FOOTNOTE},
745fdc4257SSteve Yin         //{FRAME,					   IA2_ROLE_FRAME},
755fdc4257SSteve Yin         {FRAME,					   ROLE_SYSTEM_DIALOG},
765fdc4257SSteve Yin         {GLASS_PANE ,              IA2_ROLE_GLASS_PANE},
775fdc4257SSteve Yin         {GRAPHIC ,                 ROLE_SYSTEM_GRAPHIC},
785fdc4257SSteve Yin         {GROUP_BOX,                ROLE_SYSTEM_GROUPING},
795fdc4257SSteve Yin         {HEADER	,				   IA2_ROLE_HEADER},
805fdc4257SSteve Yin         {HEADING ,                 IA2_ROLE_HEADING},
815fdc4257SSteve Yin         {HYPER_LINK ,              ROLE_SYSTEM_TEXT},
825fdc4257SSteve Yin         {ICON ,                    IA2_ROLE_ICON},
835fdc4257SSteve Yin         {INTERNAL_FRAME,           IA2_ROLE_INTERNAL_FRAME},
845fdc4257SSteve Yin         {LABEL,                    ROLE_SYSTEM_STATICTEXT},
855fdc4257SSteve Yin         {LAYERED_PANE ,            IA2_ROLE_LAYERED_PANE},
865fdc4257SSteve Yin         {LIST ,                    ROLE_SYSTEM_LIST},
875fdc4257SSteve Yin         {LIST_ITEM ,               ROLE_SYSTEM_LISTITEM},
885fdc4257SSteve Yin         //{MENU ,                    ROLE_SYSTEM_MENUPOPUP},
895fdc4257SSteve Yin         {MENU,                ROLE_SYSTEM_MENUITEM},
905fdc4257SSteve Yin         {MENU_BAR,                 ROLE_SYSTEM_MENUBAR},
915fdc4257SSteve Yin         {MENU_ITEM,                ROLE_SYSTEM_MENUITEM},
925fdc4257SSteve Yin         {OPTION_PANE ,             IA2_ROLE_OPTION_PANE},
935fdc4257SSteve Yin         {PAGE_TAB,                 ROLE_SYSTEM_PAGETAB},
945fdc4257SSteve Yin         {PAGE_TAB_LIST,            ROLE_SYSTEM_PAGETABLIST},
955fdc4257SSteve Yin         {PANEL,                    IA2_ROLE_OPTION_PANE},
965fdc4257SSteve Yin         {PARAGRAPH,                IA2_ROLE_PARAGRAPH},
975fdc4257SSteve Yin         {PASSWORD_TEXT,            ROLE_SYSTEM_TEXT},
985fdc4257SSteve Yin         {POPUP_MENU,               ROLE_SYSTEM_MENUPOPUP},
995fdc4257SSteve Yin         {PUSH_BUTTON,              ROLE_SYSTEM_PUSHBUTTON},
1005fdc4257SSteve Yin         {PROGRESS_BAR,             ROLE_SYSTEM_PROGRESSBAR},
1015fdc4257SSteve Yin         {RADIO_BUTTON,             ROLE_SYSTEM_RADIOBUTTON},
1025fdc4257SSteve Yin         {RADIO_MENU_ITEM,     	   IA2_ROLE_RADIO_MENU_ITEM},
1035fdc4257SSteve Yin         {ROW_HEADER ,              ROLE_SYSTEM_ROWHEADER},
1045fdc4257SSteve Yin         {ROOT_PANE,                IA2_ROLE_ROOT_PANE},
1055fdc4257SSteve Yin         {SCROLL_BAR ,              ROLE_SYSTEM_SCROLLBAR},
1065fdc4257SSteve Yin         {SCROLL_PANE ,             IA2_ROLE_SCROLL_PANE},
1075fdc4257SSteve Yin         {SHAPE,					   IA2_ROLE_SHAPE},
1085fdc4257SSteve Yin         {SEPARATOR ,               ROLE_SYSTEM_SEPARATOR},
1095fdc4257SSteve Yin         {SLIDER ,                  ROLE_SYSTEM_SLIDER},
1105fdc4257SSteve Yin         {SPIN_BOX ,                ROLE_SYSTEM_SPINBUTTON},
1115fdc4257SSteve Yin         {SPLIT_PANE,               IA2_ROLE_SPLIT_PANE},
1125fdc4257SSteve Yin         {STATUS_BAR,               ROLE_SYSTEM_STATUSBAR},
1135fdc4257SSteve Yin         {TABLE,                    ROLE_SYSTEM_TABLE},
1145fdc4257SSteve Yin         {TABLE_CELL ,              ROLE_SYSTEM_CELL},
1155fdc4257SSteve Yin         {TEXT,                     ROLE_SYSTEM_TEXT},
1165fdc4257SSteve Yin         {TEXT_FRAME ,			   IA2_ROLE_TEXT_FRAME},
1175fdc4257SSteve Yin         //for change toggle button to push button for jaws
1185fdc4257SSteve Yin         {TOGGLE_BUTTON,            ROLE_SYSTEM_PUSHBUTTON},
1195fdc4257SSteve Yin 
1205fdc4257SSteve Yin         {TOOL_BAR,                 ROLE_SYSTEM_TOOLBAR},
1215fdc4257SSteve Yin         {TOOL_TIP,                 ROLE_SYSTEM_TOOLTIP},
1225fdc4257SSteve Yin         {TREE ,                    ROLE_SYSTEM_OUTLINE},
1235fdc4257SSteve Yin         {VIEW_PORT ,			   IA2_ROLE_VIEW_PORT},
1245fdc4257SSteve Yin         {WINDOW,                   ROLE_SYSTEM_WINDOW},
1255fdc4257SSteve Yin 		{BUTTON_DROPDOWN,  ROLE_SYSTEM_BUTTONDROPDOWN},
1265fdc4257SSteve Yin 		{BUTTON_MENU,			  ROLE_SYSTEM_BUTTONMENU},
1275fdc4257SSteve Yin 		{CAPTION,					IA2_ROLE_CAPTION},
1285fdc4257SSteve Yin 		{CHART,						IA2_ROLE_SHAPE},
1295fdc4257SSteve Yin 		{EDIT_BAR,					IA2_ROLE_EDITBAR},
1305fdc4257SSteve Yin 		{FORM,						IA2_ROLE_FORM},
1315fdc4257SSteve Yin 		{IMAGE_MAP ,			  IA2_ROLE_IMAGE_MAP},
1325fdc4257SSteve Yin 		{NOTE,						IA2_ROLE_NOTE},
1335fdc4257SSteve Yin 		{PAGE,						IA2_ROLE_PAGE},
1345fdc4257SSteve Yin 		{RULER ,				  IA2_ROLE_RULER},
1355fdc4257SSteve Yin 		{SECTION,					IA2_ROLE_SECTION},
1365fdc4257SSteve Yin         {TREE_ITEM ,              ROLE_SYSTEM_OUTLINEITEM},
1375fdc4257SSteve Yin 		{TREE_TABLE,				ROLE_SYSTEM_OUTLINE}
1385fdc4257SSteve Yin     };
1395fdc4257SSteve Yin 
1405fdc4257SSteve Yin struct ltstr4
1415fdc4257SSteve Yin {
1425fdc4257SSteve Yin     bool operator()(const long  s1, const long  s2) const
1435fdc4257SSteve Yin     {
1445fdc4257SSteve Yin         return long(s1)<long(s2);
1455fdc4257SSteve Yin     }
1465fdc4257SSteve Yin };
1475fdc4257SSteve Yin 
1485fdc4257SSteve Yin #endif
149