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 "i_accessibility_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 void 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 child node information by accessibility ID and filtered by text and set the result by callback. 53 * @param elementId: The unique id of the component 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 text Filter for the child components to matched with the text 57 */ 58 virtual void SearchElementInfosByText(const int64_t elementId, const std::string &text, 59 const int32_t requestId, const sptr<IAccessibilityElementOperatorCallback> &callback) = 0; 60 61 /** 62 * @brief Make the node information of the component focused by the focus type specified. 63 * @param elementId: The unique id of the component ID. 64 * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. 65 * @param callback To transfer the node info to ASAC and it defined by ASAC. 66 * @param focusType FOCUS_TYPE_ACCESSIBILITY: accessibility focus 67 * FOCUS_TYPE_INPUT: text input focus 68 */ 69 virtual void FindFocusedElementInfo(const int64_t elementId, const int32_t focusType, const int32_t requestId, 70 const sptr<IAccessibilityElementOperatorCallback> &callback) = 0; 71 72 /** 73 * @brief Make the node info by current focus move direction. 74 * @param elementId: The unique id of the component ID. 75 * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. 76 * @param callback To transfer the node info to ASAC and it defined by ASAC. 77 * @param direction Refer to AccessibilityElementInfo.FocusMoveDirection(UP/DOWN/LEFT/RIGHT/FORWARD/BACKWARD) 78 */ 79 virtual void FocusMoveSearch(const int64_t elementId, const int32_t direction, const int32_t requestId, 80 const sptr<IAccessibilityElementOperatorCallback> &callback) = 0; 81 82 /** 83 * @brief To return the result of perform action. 84 * @param elementId: The unique id of the component ID. 85 * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. 86 * @param callback To transfer the node info to ASAC and it defined by ASAC. 87 * @param action Refer to [AccessibilityElementInfo.ActionType] 88 * @param actionArguments The parameter for action type. such as: 89 * action: ACCESSIBILITY_ACTION_NEXT_HTML_ITEM, 90 * actionArguments(ACTION_ARGU_HTML_ELEMENT,HtmlItemType) 91 * action: ACCESSIBILITY_ACTION_PREVIOUS_HTML_ITEM, 92 * actionArguments(ACTION_ARGU_HTML_ELEMENT,HtmlItemType) 93 * action: ACCESSIBILITY_ACTION_NEXT_TEXT, 94 * actionArguments(ACTION_ARGU_MOVE_UNIT,MOVE_UNIT_XXX) 95 * action: ACCESSIBILITY_ACTION_PREVIOUS_TEXT, 96 * actionArguments(ACTION_ARGU_MOVE_UNIT,MOVE_UNIT_XXX) 97 * action: ACCESSIBILITY_ACTION_SET_SELECTION, 98 * actionArguments({ACTION_ARGU_SELECT_TEXT_START,"1"(start location)}, 99 * {ACTION_ARGU_SELECT_TEXT_END,"10"(end location)}) 100 * action: ACCESSIBILITY_ACTION_SET_TEXT, 101 * actionArguments(ACTION_ARGU_SET_TEXT,"the text of setted") 102 */ 103 virtual void ExecuteAction(const int64_t elementId, const int32_t action, 104 const std::map<std::string, std::string> &actionArguments, 105 const int32_t requestId, const sptr<IAccessibilityElementOperatorCallback> &callback) = 0; 106 107 /** 108 * @brief To return the result of cursor position. 109 * @param elementId: The unique id of the component ID. 110 * @param requestId Matched the request and response. It needn't cared by ACE, transfer it by callback only. 111 * @param callback To transfer the node info to ASAC and it defined by ASAC. 112 */ 113 virtual void GetCursorPosition(const int64_t elementId, 114 const int32_t requestId, const sptr<IAccessibilityElementOperatorCallback> &callback) = 0; 115 116 /** 117 * @brief The function is called while accessibility System check the id of window is not equal 118 * to the id of active window when sendAccessibility. 119 */ 120 virtual void ClearFocus() = 0; 121 122 /** 123 * @brief the low layer is notified by the function called while accessibility system execute 124 * the function of executeAction from AS to check the all low windows cared the outside event. 125 * Example: PopupWindow receive the OUTSIDE_EVENT to close itself. 126 */ 127 virtual void OutsideTouch() = 0; 128 129 /** 130 * @brief To return the result of elementId, treeId, childWindowId. 131 * @param elementId: The element Id. 132 * @param treeId: The tree Id. 133 * @param childWindowId The childwindow Id. 134 */ 135 virtual void SetChildTreeIdAndWinId(const int64_t elementId, const int32_t treeId, 136 const int32_t childWindowId) = 0; 137 138 /** 139 * @brief To return the result of treeId 140 * @param treeId: The tree Id. 141 */ 142 virtual void SetBelongTreeId(const int32_t treeId) = 0; 143 144 /** 145 * @brief Set the parent window Id to the element info. 146 * @param iParentWindowId The parent window Id 147 * @sysCap Accessibility 148 */ 149 virtual void SetParentWindowId(const int32_t iParentWindowId) = 0; 150 }; 151 } // namespace Accessibility 152 } // namespace OHOS 153 #endif // INTERFACE_ACCESSIBILITY_ELEMENT_OPERATOR_H