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 #ifndef INTERFACE_ACCESSIBILITY_ELEMENT_OPERATOR_H 17 #define INTERFACE_ACCESSIBILITY_ELEMENT_OPERATOR_H 18 19 #include <cstdint> 20 #include <map> 21 #include <string> 22 23 #include "iaccessibility_element_operator_callback.h" 24 #include "iremote_broker.h" 25 26 namespace OHOS { 27 namespace Accessibility { 28 /* 29 * The class define the interface for UI to implement. 30 * It triggered by ABMS when AA to request the accessibility information. 31 */ 32 class IAccessibilityElementOperator : public IRemoteBroker { 33 public: 34 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.accessibility.IAccessibilityElementOperator"); 35 36 /** 37 * @brief Make the node information by accessibility ID and set the result by callback. 38 * @param elementId: The unique id of the component ID. 39 * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. 40 * @param callback To transfer the node info to ASAC and it defined by ASAC. 41 * @param mode PREFETCH_PREDECESSORS: Need to make the parent node info also. 42 * PREFETCH_SIBLINGS: Need to make the sister/brothers node info also. 43 * PREFETCH_CHILDREN: Need to make the child node info also. 44 * otherwise: Make the node information by elementId only. 45 * @sysCap Accessibility 46 */ 47 virtual RetError SearchElementInfoByAccessibilityId(const int64_t elementId, 48 const int32_t requestId, const sptr<IAccessibilityElementOperatorCallback> &callback, const int32_t mode, 49 bool isFliter = false) = 0; 50 51 /** 52 * @brief Make the node information by window ID and set the result by callback. 53 * @param windowId: The window id. 54 * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. 55 * @param callback To transfer the node info to ASAC and it defined by ASAC. 56 * @param mode PREFETCH_PREDECESSORS: Need to make the parent node info also. 57 * PREFETCH_SIBLINGS: Need to make the sister/brothers node info also. 58 * PREFETCH_CHILDREN: Need to make the child node info also. 59 * otherwise: Make the node information by elementId only. 60 * @sysCap Accessibility 61 */ 62 virtual void SearchDefaultFocusedByWindowId(const int32_t windowId, 63 const int32_t requestId, const sptr<IAccessibilityElementOperatorCallback> &callback, const int32_t mode, 64 bool isFliter = false) = 0; 65 66 /** 67 * @brief Make the child node information by accessibility ID and filtered by text and set the result by callback. 68 * @param elementId: The unique id of the component ID. 69 * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. 70 * @param callback To transfer the node info to ASAC and it defined by ASAC. 71 * @param text Filter for the child components to matched with the text 72 */ 73 virtual void SearchElementInfosByText(const int64_t elementId, const std::string &text, 74 const int32_t requestId, const sptr<IAccessibilityElementOperatorCallback> &callback) = 0; 75 76 /** 77 * @brief Make the node information of the component focused by the focus type specified. 78 * @param elementId: The unique id of the component ID. 79 * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. 80 * @param callback To transfer the node info to ASAC and it defined by ASAC. 81 * @param focusType FOCUS_TYPE_ACCESSIBILITY: accessibility focus 82 * FOCUS_TYPE_INPUT: text input focus 83 */ 84 virtual void FindFocusedElementInfo(const int64_t elementId, const int32_t focusType, const int32_t requestId, 85 const sptr<IAccessibilityElementOperatorCallback> &callback) = 0; 86 87 /** 88 * @brief Make the node info by current focus move direction. 89 * @param elementId: The unique id of the component ID. 90 * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. 91 * @param callback To transfer the node info to ASAC and it defined by ASAC. 92 * @param direction Refer to AccessibilityElementInfo.FocusMoveDirection(UP/DOWN/LEFT/RIGHT/FORWARD/BACKWARD) 93 */ 94 virtual void FocusMoveSearch(const int64_t elementId, const int32_t direction, const int32_t requestId, 95 const sptr<IAccessibilityElementOperatorCallback> &callback) = 0; 96 97 /** 98 * @brief To return the result of perform action. 99 * @param elementId: The unique id of the component ID. 100 * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. 101 * @param callback To transfer the node info to ASAC and it defined by ASAC. 102 * @param action Refer to [AccessibilityElementInfo.ActionType] 103 * @param actionArguments The parameter for action type. such as: 104 * action: ACCESSIBILITY_ACTION_NEXT_HTML_ITEM, 105 * actionArguments(ACTION_ARGU_HTML_ELEMENT,HtmlItemType) 106 * action: ACCESSIBILITY_ACTION_PREVIOUS_HTML_ITEM, 107 * actionArguments(ACTION_ARGU_HTML_ELEMENT,HtmlItemType) 108 * action: ACCESSIBILITY_ACTION_NEXT_TEXT, 109 * actionArguments(ACTION_ARGU_MOVE_UNIT,MOVE_UNIT_XXX) 110 * action: ACCESSIBILITY_ACTION_PREVIOUS_TEXT, 111 * actionArguments(ACTION_ARGU_MOVE_UNIT,MOVE_UNIT_XXX) 112 * action: ACCESSIBILITY_ACTION_SET_SELECTION, 113 * actionArguments({ACTION_ARGU_SELECT_TEXT_START,"1"(start location)}, 114 * {ACTION_ARGU_SELECT_TEXT_END,"10"(end location)}) 115 * action: ACCESSIBILITY_ACTION_SET_TEXT, 116 * actionArguments(ACTION_ARGU_SET_TEXT,"the text of setted") 117 */ 118 virtual void ExecuteAction(const int64_t elementId, const int32_t action, 119 const std::map<std::string, std::string> &actionArguments, 120 const int32_t requestId, const sptr<IAccessibilityElementOperatorCallback> &callback) = 0; 121 122 /** 123 * @brief To return the result of cursor position. 124 * @param elementId: The unique id of the component ID. 125 * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. 126 * @param callback To transfer the node info to ASAC and it defined by ASAC. 127 */ 128 virtual void GetCursorPosition(const int64_t elementId, 129 const int32_t requestId, const sptr<IAccessibilityElementOperatorCallback> &callback) = 0; 130 131 /** 132 * @brief The function is called while accessibility System check the id of window is not equal 133 * to the id of active window when sendAccessibility. 134 */ 135 virtual void ClearFocus() = 0; 136 137 /** 138 * @brief the low layer is notified by the function called while accessibility system execute 139 * the function of executeAction from AS to check the all low windows cared the outside event. 140 * Example: PopupWindow receive the OUTSIDE_EVENT to close itself. 141 */ 142 virtual void OutsideTouch() = 0; 143 144 /** 145 * @brief To return the result of elementId, treeId, childWindowId. 146 * @param elementId: The element Id. 147 * @param treeId: The tree Id. 148 * @param childWindowId The childwindow Id. 149 */ 150 virtual void SetChildTreeIdAndWinId(const int64_t elementId, const int32_t treeId, 151 const int32_t childWindowId) = 0; 152 153 /** 154 * @brief To return the result of treeId 155 * @param treeId: The tree Id. 156 */ 157 virtual void SetBelongTreeId(const int32_t treeId) = 0; 158 159 /** 160 * @brief Set the parent window Id to the element info. 161 * @param iParentWindowId The parent window Id 162 * @sysCap Accessibility 163 */ 164 virtual void SetParentWindowId(const int32_t iParentWindowId) = 0; 165 166 /** 167 * @brief Search element info by specific property. 168 * @param elementId The unique id of the component ID. 169 * @param param The specific property parameters. 170 * @param requestId The request id from AA, it is used to match with request and response. 171 * @param callback The callback to return the result. 172 */ 173 virtual void SearchElementInfoBySpecificProperty(const int64_t elementId, 174 const SpecificPropertyParam& param, const int32_t requestId, 175 const sptr<IAccessibilityElementOperatorCallback> &callback) = 0; 176 }; 177 } // namespace Accessibility 178 } // namespace OHOS 179 #endif // INTERFACE_ACCESSIBILITY_ELEMENT_OPERATOR_H