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_CALLBACK_H 17 #define INTERFACE_ACCESSIBILITY_ELEMENT_OPERATOR_CALLBACK_H 18 19 #include <cstdint> 20 #include <string> 21 #include <vector> 22 #include "accessibility_element_info.h" 23 #include "iremote_broker.h" 24 25 namespace OHOS { 26 namespace Accessibility { 27 /* 28 * The class supply the callback to feedback the result from UI to AA. 29 */ 30 class IAccessibilityElementOperatorCallback : public IRemoteBroker { 31 public: 32 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.accessibility.IAccessibilityElementOperatorCallback"); 33 34 /** 35 * @brief Set the element information by accessibility id to AA. 36 * @param infos The element info searched by accessibility id. 37 * @param requestId The request id from AA, it is used to match with request and response. 38 */ 39 virtual void SetSearchElementInfoByAccessibilityIdResult(const std::vector<AccessibilityElementInfo> &infos, 40 const int32_t requestId) = 0; 41 42 /** 43 * @brief Set the element information matched with text to AA. 44 * @param infos The element information searched matched with text. 45 * @param requestId The request id from AA, it is used to match with request and response. 46 */ 47 virtual void SetSearchElementInfoByTextResult(const std::vector<AccessibilityElementInfo> &infos, 48 const int32_t requestId) = 0; 49 50 /** 51 * @brief Set the element information matched with focus type to AA. 52 * @param info The element information searched matched with focus type. 53 * @param requestId The request id from AA, it is used to match with request and response. 54 */ 55 virtual void SetFindFocusedElementInfoResult(const AccessibilityElementInfo &info, const int32_t requestId) = 0; 56 57 /** 58 * @brief Set the element information by focus direction to AA. 59 * @param info The element information searched by focus direction. 60 * @param requestId The request id from AA, it is used to match with request and response. 61 */ 62 virtual void SetFocusMoveSearchResult(const AccessibilityElementInfo &info, const int32_t requestId) = 0; 63 64 /** 65 * @brief Set the result of action executed to AA. 66 * @param succeeded True: The action is executed successfully; otherwise is false. 67 * @param requestId The request id from AA, it is used to match with request and response. 68 */ 69 virtual void SetExecuteActionResult(const bool succeeded, const int32_t requestId) = 0; 70 71 /** 72 * @brief Set the result of cursor position to AA. 73 * @param cursorPosition The cursorPosition to be returned. 74 * @param requestId The request id from AA, it is used to match with request and response. 75 */ 76 virtual void SetCursorPositionResult(const int32_t cursorPosition, const int32_t requestId) = 0; 77 78 /** 79 * @brief Set isFilter. 80 * @param enableFilter True : Perform filtering ;otherwise is false. 81 */ SetIsFilter(bool enableFilter)82 void SetIsFilter(bool enableFilter) 83 { 84 isFilter = enableFilter; 85 } 86 87 /** 88 * @brief Get isFilter. 89 */ GetFilter()90 bool GetFilter() 91 { 92 return isFilter; 93 } 94 private: 95 bool isFilter = false; 96 }; 97 } // namespace Accessibility 98 } // namespace OHOS 99 #endif // INTERFACE_ACCESSIBILITY_ELEMENT_OPERATOR_CALLBACK_H