1 /*
2  * Copyright (C) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "accessibility_constants.h"
17 
18 namespace OHOS {
19 namespace Accessibility {
20 // text move step
21 const std::string MOVE_UNIT_CHARACTER = "char";
22 const std::string MOVE_UNIT_WORD = "word";
23 const std::string MOVE_UNIT_LINE = "line";
24 const std::string MOVE_UNIT_PAGE = "page";
25 const std::string MOVE_UNIT_PARAGRAPH = "paragraph";
26 
27 // Operation Arguments Type
28 const std::string ACTION_ARGU_INVALID = "invalid";
29 const std::string ACTION_ARGU_SELECT_TEXT_START = "selectTextBegin";
30 const std::string ACTION_ARGU_SELECT_TEXT_END = "selectTextEnd";
31 const std::string ACTION_ARGU_SELECT_TEXT_INFORWARD = "selectTextInForWard";
32 const std::string ACTION_ARGU_SET_OFFSET = "offset";
33 const std::string ACTION_ARGU_HTML_ELEMENT = "htmlItem";
34 const std::string ACTION_ARGU_SET_TEXT = "setText";
35 const std::string ACTION_ARGU_MOVE_UNIT = "textMoveUnit";
36 const std::string ACTION_ARGU_SPAN_ID = "spanId";
37 
38 // HtmlItemType
39 const std::string HTML_ITEM_INVALID = "invalid";
40 const std::string HTML_ITEM_LINK = "link";
41 const std::string HTML_ITEM_CONTROL = "control";
42 const std::string HTML_ITEM_GRAPHIC = "graphic";
43 const std::string HTML_ITEM_LIST_ITEM = "listItem";
44 const std::string HTML_ITEM_LIST = "list";
45 const std::string HTML_ITEM_TABLE = "table";
46 const std::string HTML_ITEM_COMBOX = "combox";
47 const std::string HTML_ITEM_HEADING = "heading";
48 const std::string HTML_ITEM_BUTTON = "button";
49 const std::string HTML_ITEM_CHECKBOX = "checkBox";
50 const std::string HTML_ITEM_LANDMARK = "landmark";
51 const std::string HTML_ITEM_TEXT_FIELD = "textField";
52 const std::string HTML_ITEM_FOCUSABLE = "focusable";
53 const std::string HTML_ITEM_H1 = "h1";
54 const std::string HTML_ITEM_H2 = "h2";
55 const std::string HTML_ITEM_H3 = "h3";
56 const std::string HTML_ITEM_H4 = "h4";
57 const std::string HTML_ITEM_H5 = "h5";
58 const std::string HTML_ITEM_H6 = "h6";
59 const std::string HTML_ITEM_UNKOWN = "unknown";
60 
61 const std::string OHOS_PERMISSION_READ_ACCESSIBILITY_CONFIG = "ohos.permission.READ_ACCESSIBILITY_CONFIG";
62 const std::string OHOS_PERMISSION_WRITE_ACCESSIBILITY_CONFIG = "ohos.permission.WRITE_ACCESSIBILITY_CONFIG";
63 const std::string OHOS_PERMISSION_QUERY_ACCESSIBILITY_ELEMENT = "ohos.permission.QUERY_ACCESSIBILITY_ELEMENT";
64 
65 const int32_t PREFETCH_PREDECESSORS = 1 << 0;
66 const int32_t PREFETCH_SIBLINGS = 1 << 1;
67 const int32_t PREFETCH_CHILDREN = 1 << 2;
68 const int32_t PREFETCH_RECURSIVE_CHILDREN = 1 << 3;
69 const int32_t GET_SOURCE_MODE = PREFETCH_RECURSIVE_CHILDREN | PREFETCH_PREDECESSORS;
70 const int32_t UNDEFINED = -1;
71 const int32_t GET_SOURCE_PREFETCH_MODE = PREFETCH_PREDECESSORS | PREFETCH_SIBLINGS | PREFETCH_CHILDREN;
72 const int32_t UNDEFINED_SELECTION_INDEX = -1;
73 const int32_t UNDEFINED_ITEM_ID = 0x1FFFFFF;
74 const int32_t ROOT_ITEM_ID = -1;
75 const int32_t MAX_TEXT_LENGTH = 500;
76 const int32_t HOST_VIEW_ID = -1;
77 const int64_t ROOT_NODE_ID = -1;
78 
79 // Focus types
80 const int32_t FOCUS_TYPE_INVALID = -1;
81 const int32_t FOCUS_TYPE_INPUT = 1 << 0;
82 const int32_t FOCUS_TYPE_ACCESSIBILITY = 1 << 1;
83 
84 // grid mode
85 const int32_t SELECTION_MODE_NONE = 0;
86 const int32_t SELECTION_MODE_SINGLE = 1;
87 const int32_t SELECTION_MODE_MULTIPLE = 2;
88 
89 const int32_t INVALID_WINDOW_ID = -1;
90 const int32_t INVALID_TREE_ID = -1;
91 const int32_t ANY_WINDOW_ID = -2;
92 const int32_t ACTIVE_WINDOW_ID = 0x7FFFFFFF;
93 
94 const uint32_t STATE_ACCESSIBILITY_ENABLED = 0x00000001;
95 const uint32_t STATE_EXPLORATION_ENABLED = 0x00000002;
96 const uint32_t STATE_CAPTION_ENABLED = 0x00000004;
97 const uint32_t STATE_KEYEVENT_ENABLED = 0x00000008;
98 const uint32_t STATE_GESTURE_ENABLED = 0x00000010;
99 const uint32_t STATE_SCREENMAGNIFIER_ENABLED = 0x00000020;
100 const uint32_t STATE_MOUSEKEY_ENABLED = 0x00000040;
101 const uint32_t STATE_SHORTKEY_ENABLED = 0x00000080;
102 const uint32_t STATE_HIGHCONTRAST_ENABLED = 0x00000100;
103 const uint32_t STATE_INVETRTCOLOR_ENABLED = 0x00000200;
104 const uint32_t STATE_ANIMATIONOFF_ENABLED = 0x00000400;
105 const uint32_t STATE_AUDIOMONO_ENABLED = 0x00000800;
106 const uint32_t STATE_DALTONIZATION_STATE_ENABLED = 0x00001000;
107 const uint32_t STATE_IGNORE_REPEAT_CLICK_ENABLED = 0x00002000;
108 
109 const int32_t INVALID_CHANNEL_ID = 0xFFFFFFFF;
110 } // namespace Accessibility
111 } // namespace OHOS