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