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