• 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 ACCESSIBILITY_ELEMENT_INFO_H
17 #define ACCESSIBILITY_ELEMENT_INFO_H
18 
19 #include <map>
20 #include <vector>
21 #include "accessibility_def.h"
22 
23 namespace OHOS {
24 namespace Accessibility {
25 /*
26 * class define the action on Accessibility info
27 */
28 class AccessibleAction {
29 public:
30     /**
31      * @brief Construct
32      */
AccessibleAction()33     AccessibleAction() {}
34 
35     /**
36      * @brief Construct
37      * @param actionType The type of action, refer to [ActionType]
38      * @param description The description message of action.
39      */
40     AccessibleAction(ActionType actionType, const std::string &description);
41 
42     /**
43      * @brief Gets the action type.
44      * @return The type of action, refer to [ActionType]
45      */
46     ActionType GetActionType() const;
47 
48     /**
49      * @brief Gets the action description.
50      * @return The description message of action.
51      */
52     const std::string &GetDescriptionInfo() const;
53 
54 protected:
55     ActionType actionType_ = ACCESSIBILITY_ACTION_INVALID;
56     std::string description_ = "";
57 };
58 
59 /**
60  * @brief  Define the RangInfo for progress bar
61  * @note
62  * @retval None
63  */
64 class RangeInfo {
65 public:
66     /**
67      * @brief Construct
68      */
RangeInfo()69     RangeInfo() {}
70 
71     /**
72      * @brief Construct
73      * @param min The min value
74      * @param max The max value
75      * @param current current value
76      */
77     RangeInfo(int32_t min, int32_t max, int32_t current);
78 
79     /**
80      * @brief Gets the min value.
81      * @return min value
82      */
83     int32_t GetMin() const;
84 
85     /**
86      * @brief Gets the max value.
87      * @return max value.
88      */
89     int32_t GetMax() const;
90 
91     /**
92      * @brief Gets the current value.
93      * @return current value.
94      */
95     int32_t GetCurrent() const;
96 
97     /**
98      * @brief Sets the min value.
99      * @param min min value
100      */
101     void SetMin(int32_t min);
102 
103     /**
104      * @brief Sets the max value.
105      * @param max max value.
106      */
107     void SetMax(int32_t max);
108 
109     /**
110      * @brief Sets the current value.
111      * @param current current value
112      */
113     void SetCurrent(int32_t current);
114 
115 protected:
116     int32_t min_ = 0;
117     int32_t max_ = 0;
118     int32_t current_ = 0;
119 };
120 
121 /**
122  * @brief  Define the list/grid component
123  * @note
124  * @retval None
125  */
126 class GridInfo {
127 public:
128     /**
129      * @brief Construct
130      * @since 3
131      * @sysCap Accessibility
132      */
GridInfo()133     GridInfo() {}
134 
135     /**
136      * @brief Construct
137      * @param rowCount The number of row
138      * @param columnCount The number of column
139      * @param mode 0: select one line only, otherwise select multilines.
140      * @since 3
141      * @sysCap Accessibility
142      */
143     GridInfo(int32_t rowCount, int32_t columnCount, int32_t mode);
144 
145     /**
146      * @brief Set the grid object
147      * @param rowCount The number of row
148      * @param columnCount The number of column
149      * @param mode 0: select one line only, otherwise select multilines.
150      * @since 3
151      * @sysCap Accessibility
152      */
153     void SetGrid(int32_t rowCount, int32_t columnCount, int32_t mode);
154 
155     /**
156      * @brief Copy grid object.
157      * @param other The copied grid
158      * @since 3
159      * @sysCap Accessibility
160      */
161     void SetGrid(GridInfo other);
162 
163     /**
164      * @brief Gets the number of rows.
165      * @return number of rows.
166      * @since 3
167      * @sysCap Accessibility
168      */
169     int32_t GetRowCount() const;
170 
171     /**
172      * @brief Gets the number of columns.
173      * @return number of columns.
174      * @since 3
175      * @sysCap Accessibility
176      */
177     int32_t GetColumnCount() const;
178 
179     /**
180      * @brief Get the mode of grid
181      * @return 0: Selected by one line, otherwise is multilines.
182      * @since 3
183      * @sysCap Accessibility
184      */
185     int32_t GetSelectionMode() const;
186 
187 protected:
188     int32_t rowCount_ = 0;
189     int32_t columnCount_ = 0;
190     int32_t selectionMode_ = 0;
191 };
192 
193 class GridItemInfo {
194 public:
195     /**
196      * @brief Construct
197      * @since 3
198      * @sysCap Accessibility
199      */
GridItemInfo()200     GridItemInfo() {}
201 
202     /**
203      * @brief Construct
204      * @param rowIndex The index of row.
205      * @param rowSpan  The row spanned.
206      * @param columnIndex The index of column
207      * @param columnSpan THe column spanned
208      * @param heading true:The item isHeading, otherwise is not
209      * @param selected true:The item is selected,otherwise is not
210      * @since 3
211      * @sysCap Accessibility
212      */
213     GridItemInfo(int32_t rowIndex, int32_t rowSpan, int32_t columnIndex, int32_t columnSpan,
214         bool heading, bool selected);
215 
216     /**
217      * @brief Copy the GridItemInfo
218      * @param other The object of GridItemInfo copied.
219      * @since 3
220      * @sysCap Accessibility
221      */
222     void SetGridItemInfo(GridItemInfo other);
223 
224     /**
225      * @brief Set grid object
226      * @param rowIndex The index of row.
227      * @param rowSpan  The row spanned.
228      * @param columnIndex The index of column
229      * @param columnSpan THe column spanned
230      * @param heading true:The item isHeading, otherwise is not
231      * @param selected true:The item is selected,otherwise is not
232      * @since 3
233      * @sysCap Accessibility
234      */
235     void SetGridItemInfo(int32_t rowIndex, int32_t rowSpan, int32_t columnIndex, int32_t columnSpan,
236         bool heading, bool selected);
237 
238     /**
239      * @brief Gets the column index at which the item is located.
240      * @return The column index.
241      * @since 3
242      * @sysCap Accessibility
243      */
244     int32_t GetColumnIndex() const;
245 
246     /**
247      * @brief Gets the row index at which the item is located.
248      * @return The row index.
249      * @since 3
250      * @sysCap Accessibility
251      */
252     int32_t GetRowIndex() const;
253 
254     /**
255      * @brief Gets the number of columns the item spans.
256      * @return The column span.
257      * @since 3
258      * @sysCap Accessibility
259      */
260     int32_t GetColumnSpan() const;
261 
262     /**
263      * @brief Gets the number of rows the item spans.
264      * @return The row span.
265      * @since 3
266      * @sysCap Accessibility
267      */
268     int32_t GetRowSpan() const;
269 
270     /**
271      * @brief Checks if the grid item is a heading.
272      * @return true:If the item is a heading, otherwise is not.
273      * @since 3
274      * @sysCap Accessibility
275      */
276     bool IsHeading() const;
277 
278     /**
279      * @brief Checks if the grid item is a selected.
280      * @return true:If the item is a selected, otherwise is not.
281      * @since 3
282      * @sysCap Accessibility
283      */
284     bool IsSelected() const;
285 
286 protected:
287     bool heading_ = false;
288     int32_t columnIndex_ = 0;
289     int32_t rowIndex_ = 0;
290     int32_t columnSpan_ = 0;
291     int32_t rowSpan_ = 0;
292     bool selected_ = false;
293 };
294 
295 class Rect {
296 public:
297     /**
298      * @brief Construct
299      * @since 3
300      * @sysCap Accessibility
301      */
Rect()302     Rect() {}
303 
304     /**
305      * @brief Destruct
306      * @since 3
307      * @sysCap Accessibility
308      */
309     virtual ~Rect() = default;
310 
311     /**
312      * @brief Construct
313      * @param leftTopX : The left top x pixel coordinates
314      * @param leftTopY : The left top y pixel coordinates
315      * @param rightBottomY : The right bottom y pixel coordinates
316      * @param rightBottomX : The right bottom x pixel coordinates
317      * @since 3
318      * @sysCap Accessibility
319      */
Rect(int32_t leftTopX,int32_t leftTopY,int32_t rightBottomX,int32_t rightBottomY)320     Rect(int32_t leftTopX, int32_t leftTopY, int32_t rightBottomX, int32_t rightBottomY)
321     {
322         leftTopX_ = leftTopX;
323         leftTopY_ = leftTopY;
324         rightBottomX_ = rightBottomX;
325         rightBottomY_ = rightBottomY;
326     }
327 
328     /**
329      * @brief Get the left top point's pixel coordinates
330      * @return The left top x pixel coordinates
331      * @since 3
332      * @sysCap Accessibility
333      */
GetLeftTopXScreenPostion()334     int32_t GetLeftTopXScreenPostion() const
335     {
336         return leftTopX_;
337     }
338 
339     /**
340      * @brief Get the left top point's pixel coordinates
341      * @return The left top y pixel coordinates
342      * @since 3
343      * @sysCap Accessibility
344      */
GetLeftTopYScreenPostion()345     int32_t GetLeftTopYScreenPostion() const
346     {
347         return leftTopY_;
348     }
349 
350     /**
351      * @brief Get the right bottom point's pixel coordinates
352      * @return The bottom x pixel coordinates
353      * @since 3
354      * @sysCap Accessibility
355      */
GetRightBottomXScreenPostion()356     int32_t GetRightBottomXScreenPostion() const
357     {
358         return rightBottomX_;
359     }
360 
361     /**
362      * @brief Get the right bottom point's pixel coordinates
363      * @return The bottom y pixel coordinates
364      * @since 3
365      * @sysCap Accessibility
366      */
GetRightBottomYScreenPostion()367     int32_t GetRightBottomYScreenPostion() const
368     {
369         return rightBottomY_;
370     }
371     /**
372      * @brief Set the left top point's pixel coordinates
373      * @param leftTopX The left top x pixel coordinates
374      * @param leftTopY The left top y pixel coordinates
375      * @since 3
376      * @sysCap Accessibility
377      */
SetLeftTopScreenPostion(int32_t leftTopX,int32_t leftTopY)378     void SetLeftTopScreenPostion(int32_t leftTopX, int32_t leftTopY)
379     {
380         leftTopY_ = leftTopY;
381         leftTopX_ = leftTopX;
382     }
383 
384     /**
385      * @brief Set the right bottom point's pixel coordinates
386      * @param rightBottomX The right bottom x pixel coordinates
387      * @param rightBottomY The right bottom y pixel coordinates
388      * @since 3
389      * @sysCap Accessibility
390      */
SetRightBottomScreenPostion(int32_t rightBottomX,int32_t rightBottomY)391     void SetRightBottomScreenPostion(int32_t rightBottomX, int32_t rightBottomY)
392     {
393         rightBottomY_ = rightBottomY;
394         rightBottomX_ = rightBottomX;
395     }
396 
397 protected:
398     int32_t leftTopX_ = 0;
399     int32_t leftTopY_ = 0;
400     int32_t rightBottomX_ = 0;
401     int32_t rightBottomY_ = 0;
402 };
403 
404 /*
405 * The class supply the api to set/get ui component property
406 */
407 class AccessibilityElementInfo {
408 public:
409     static constexpr int64_t UNDEFINED_ACCESSIBILITY_ID = -1;
410     static constexpr int32_t MAX_SIZE = 50;
411 
412     /**
413      * @brief Construct
414      * @since 3
415      * @sysCap Accessibility
416      */
417     AccessibilityElementInfo();
418 
419     /**
420      * @brief Set the id of AccessibilityElementInfo
421      * @param componentId The id of component.
422      * @since 3
423      * @sysCap Accessibility
424      */
425     void SetComponentId(const int64_t componentId);
426 
427     /**
428      * @brief Get the child's accessibility Id by index.
429      * @param index The index of child
430      * @return The child's accessibility Id
431      * @since 3
432      * @sysCap Accessibility
433      */
434     int64_t GetChildId(const int32_t index) const;
435 
436     /**
437      * @brief Gets the number of children
438      * @return The number of children
439      * @since 3
440      * @sysCap Accessibility
441      */
442     int32_t GetChildCount() const;
443 
444     /**
445      * @brief Gets the id of children
446      * @return The list of children id
447      * @since 3
448      * @sysCap Accessibility
449      */
450     const std::vector<int64_t> &GetChildIds() const;
451 
452     /**
453      * @brief Add child node information
454      * @param childId The id of child node
455      * @since 3
456      * @sysCap Accessibility
457      */
458     void AddChild(const int64_t childId);
459 
460     /**
461      * @brief Remove child specified.
462      * @param childId The child to removed.
463      * @return true:Removed succeed, otherwise is not.
464      * @since 3
465      * @sysCap Accessibility
466      */
467     bool RemoveChild(const int64_t childId);
468 
469     /**
470      * @brief Gets an action list.
471      * @return action list.  Refer to AccessibleAction
472      * @since 3
473      * @sysCap Accessibility
474      */
475     const std::vector<AccessibleAction> &GetActionList() const;
476 
477     /**
478      * @brief Add action on the component
479      * @param action The action on the component.
480      * @since 3
481      * @sysCap Accessibility
482      */
483     void AddAction(AccessibleAction &action);
484 
485     /**
486      * @brief Remove action on the component
487      * @param action The action object.
488      * @since 3
489      * @sysCap Accessibility
490      */
491     void DeleteAction(AccessibleAction &action);
492 
493     /**
494      * @brief Remove the action on the component.
495      * @param actionType The action type.
496      * @return true:successfully deleted, otherwise is not.
497      * @since 3
498      * @sysCap Accessibility
499      */
500     bool DeleteAction(ActionType &actionType);
501 
502     /**
503      * @brief Remove all the action on the component.
504      * @since 3
505      * @sysCap Accessibility
506      */
507     void DeleteAllActions();
508 
509     /**
510      * @brief Sets the maximum length of text allowed for this node.
511      * @param max The maximum length of text
512      * @since 3
513      * @sysCap Accessibility
514      */
515     void SetTextLengthLimit(const int32_t max);
516 
517     /**
518      * @brief Gets the maximum length of text allowed for this node.
519      * @return The maximum length of text
520      * @since 3
521      * @sysCap Accessibility
522      */
523     int32_t GetTextLengthLimit() const;
524 
525     /**
526      * @brief Get the window Id of the component that belongs to the window.
527      * @return window id
528      * @since 3
529      * @sysCap Accessibility
530      */
531     int32_t GetWindowId() const;
532 
533     /**
534      * @brief Set the window Id of the component that belongs to the window.
535      * @param windowId The window Id
536      * @since 3
537      * @sysCap Accessibility
538      */
539     void SetWindowId(const int32_t windowId);
540 
541     /**
542      * @brief Get parent accessibility Id.
543      * @return The accessibility Id of parent.
544      * @since 3
545      * @sysCap Accessibility
546      */
547     int64_t GetParentNodeId() const;
548 
549     /**
550      * @brief Set parent node information
551      * @param parentId Parent node id
552      * @since 3
553      * @sysCap Accessibility
554      */
555     void SetParent(const int64_t parentId);
556 
557     /**
558      * @brief Gets the rectangular area of this accessibility node control in the screen.
559      * @return The rectangular area of this accessibility node
560      * @since 3
561      * @sysCap Accessibility
562      */
563     const Rect &GetRectInScreen() const;
564 
565     /**
566      * @brief Set the rectangular area of this accessibility node control in the screen.
567      * @param bounds The rectangular area of this accessibility node
568      * @since 3
569      * @sysCap Accessibility
570      */
571     void SetRectInScreen(Rect &bounds);
572 
573     /**
574      * @brief Checks whether this node (a check box as an example) is checkable.
575      * @return true:the node is checkable, otherwise is not.
576      * @since 3
577      * @sysCap Accessibility
578      */
579     bool IsCheckable() const;
580 
581     /**
582      * @brief Set whether this node (a check box as an example) is checkable.
583      * @param checkable true:the node is checkable, otherwise is not.
584      * @since 3
585      * @sysCap Accessibility
586      */
587     void SetCheckable(const bool checkable);
588 
589     /**
590      * @brief Checks whether this node is checked.
591      * @return true : Is checked, otherwise is not.
592      * @since 3
593      * @sysCap Accessibility
594      */
595     bool IsChecked() const;
596 
597     /**
598      * @brief Set whether this node is checked.
599      * @param checked true:Is checked, otherwise is not.
600      * @since 3
601      * @sysCap Accessibility
602      */
603     void SetChecked(const bool checked);
604 
605     /**
606      * @brief Checks whether this node can be focused.
607      * @return true : Can be focused, otherwise is not.
608      * @since 3
609      * @sysCap Accessibility
610      */
611     bool IsFocusable() const;
612 
613     /**
614      * @brief Set whether this node can be focused.
615      * @param focusable true : Can be focused, otherwise is not.
616      * @since 3
617      * @sysCap Accessibility
618      */
619     void SetFocusable(const bool focusable);
620 
621     /**
622      * @brief Checks whether this node has gained focus.
623      * @return true:Focused, otherwise is not.
624      * @since 3
625      * @sysCap Accessibility
626      */
627     bool IsFocused() const;
628 
629     /**
630      * @brief Set whether this node has gained focus.
631      * @param focused true : Focused, otherwise is not.
632      * @since 3
633      * @sysCap Accessibility
634      */
635     void SetFocused(const bool focused);
636 
637     /**
638      * @brief Checks whether this node is visible to users.
639      * @return true : visible, otherwise is not.
640      * @since 3
641      * @sysCap Accessibility
642      */
643     bool IsVisible() const;
644 
645     /**
646      * @brief Set whether this node is visible to users.
647      * @param visible true:visible, otherwise is not.
648      * @since 3
649      * @sysCap Accessibility
650      */
651     void SetVisible(const bool visible);
652 
653     /**
654      * @brief Checks whether this node has gained accessibility focus.
655      * @return true:Gained accessibility focus, otherwise is not.
656      * @since 3
657      * @sysCap Accessibility
658      */
659     bool HasAccessibilityFocus() const;
660 
661     /**
662      * @brief Set whether this node has gained accessibility focus.
663      * @param focused true:Gained accessibility focus, otherwise is not.
664      * @since 3
665      * @sysCap Accessibility
666      */
667     void SetAccessibilityFocus(const bool focused);
668 
669     /**
670      * @brief Checks whether this node is selected.
671      * @return true:selected, otherwise is not.
672      * @since 3
673      * @sysCap Accessibility
674      */
675     bool IsSelected() const;
676 
677     /**
678      * @brief Set whether this node is selected.
679      * @param selected true: selected, otherwise is not.
680      * @since 3
681      * @sysCap Accessibility
682      */
683     void SetSelected(const bool selected);
684 
685     /**
686      * @brief Checks whether this node is clickable.
687      * @return true: clickable, otherwise is not.
688      * @since 3
689      * @sysCap Accessibility
690      */
691     bool IsClickable() const;
692 
693     /**
694      * @brief Set whether this node is clickable.
695      * @param clickable true:clickable, otherwise is not.
696      * @since 3
697      * @sysCap Accessibility
698      */
699     void SetClickable(const bool clickable);
700 
701     /**
702      * @brief Checks whether this node is long clickable.
703      * @return true: long clickable, otherwise is not.
704      * @since 3
705      * @sysCap Accessibility
706      */
707     bool IsLongClickable() const;
708 
709     /**
710      * @brief Set whether this node is long clickable.
711      * @param longClickable true: long clickable, otherwise is not.
712      * @since 3
713      * @sysCap Accessibility
714      */
715     void SetLongClickable(const bool longClickable);
716 
717     /**
718      * @brief Checks whether this node is enabled.
719      * @return true:enabled, otherwise is not.
720      * @since 3
721      * @sysCap Accessibility
722      */
723     bool IsEnabled() const;
724 
725     /**
726      * @brief Set whether this node is enabled.
727      * @param enabled true: enabled, otherwise is not.
728      * @since 3
729      * @sysCap Accessibility
730      */
731     void SetEnabled(const bool enabled);
732 
733     /**
734      * @brief Checks whether the content in this node is a password.
735      * @return true: password, otherwise is not.
736      * @since 3
737      * @sysCap Accessibility
738      */
739     bool IsPassword() const;
740 
741     /**
742      * @brief Set whether the content in this node is a password
743      * @param type true:password, otherwise is not.
744      * @since 3
745      * @sysCap Accessibility
746      */
747     void SetPassword(const bool type);
748 
749     /**
750      * @brief Checks whether this node is scrollable.
751      * @return true: scrollable, otherwise is not.
752      * @since 3
753      * @sysCap Accessibility
754      */
755     bool IsScrollable() const;
756 
757     /**
758      * @brief Set whether this node is scrollable.
759      * @param scrollable true: scrollable, otherwise is not.
760      * @since 3
761      * @sysCap Accessibility
762      */
763     void SetScrollable(const bool scrollable);
764 
765     /**
766      * @brief Checks whether this node is editable.
767      * @return true:editable, otherwise is not.
768      * @since 3
769      * @sysCap Accessibility
770      */
771     bool IsEditable() const;
772 
773     /**
774      * @brief Set whether this node is editable.
775      * @param editable true: editable, otherwise is not.
776      * @since 3
777      * @sysCap Accessibility
778      */
779     void SetEditable(const bool editable);
780 
781     /**
782      * @brief Checks whether this node can display text in multiple lines.
783      * @return true: multilines, otherwise is not.
784      * @since 3
785      * @sysCap Accessibility
786      */
787     bool IsPluraLineSupported() const;
788 
789     /**
790      * @brief Set whether this node can display text in multiple lines.
791      * @param multiLine true:multilines, otherwise is not.
792      * @since 3
793      * @sysCap Accessibility
794      */
795     void SetPluraLineSupported(const bool multiLine);
796 
797     /**
798      * @brief Checks whether pop-up windows are supported.
799      * @return true: Support popup, otherwise is not.
800      * @since 3
801      * @sysCap Accessibility
802      */
803     bool IsPopupSupported() const;
804 
805     /**
806      * @brief Set whether pop-up windows are supported.
807      * @param supportPopup true: Support popup, otherwise is not.
808      * @since 3
809      * @sysCap Accessibility
810      */
811     void SetPopupSupported(const bool supportPopup);
812 
813     /**
814      * @brief Checks whether this node is deletable.
815      * @return true:deletable, otherwise is not.
816      * @since 3
817      * @sysCap Accessibility
818      */
819     bool IsDeletable() const;
820 
821     /**
822      * @brief Set whether this node is deletable.
823      * @param deletable true:deletable, otherwise is not.
824      * @since 3
825      * @sysCap Accessibility
826      */
827     void SetDeletable(const bool deletable);
828 
829     /**
830      * @brief Checks whether this node is essential to users.
831      * @return true: essential to user, otherwise is not.
832      * @since 3
833      * @sysCap Accessibility
834      */
835     bool IsEssential() const;
836 
837     /**
838      * @brief Set whether this node is essential to users.
839      * @param essential true:essential to user, otherwise is not.
840      * @since 3
841      * @sysCap Accessibility
842      */
843     void SetEssential(const bool essential);
844 
845     /**
846      * @brief Checks whether this node is displaying a hint.
847      * @return true:displaying a hint, otherwise is not.
848      * @since 3
849      * @sysCap Accessibility
850      */
851     bool IsGivingHint() const;
852 
853     /**
854      * @brief Set whether this node is displaying a hint.
855      * @param hinting true:displaying a hint, otherwise is not.
856      * @since 3
857      * @sysCap Accessibility
858      */
859     void SetHinting(const bool hinting);
860 
861     /**
862      * @brief Gets the bundle name of application target.
863      * @return bundle name
864      * @since 3
865      * @sysCap Accessibility
866      */
867     const std::string &GetBundleName() const;
868 
869     /**
870      * @brief Set the bundle name of application target.
871      * @param bundleName The bundle name of application target.
872      * @since 3
873      * @sysCap Accessibility
874      */
875     void SetBundleName(const std::string &bundleName);
876 
877     /**
878      * @brief Get component type.
879      * @return The component type.
880      * @since 3
881      * @sysCap Accessibility
882      */
883     const std::string &GetComponentType() const;
884 
885     /**
886      * @brief Set component type.
887      * @param className The component type.
888      * @since 3
889      * @sysCap Accessibility
890      */
891     void SetComponentType(const std::string &className);
892 
893     /**
894      * @brief Gets the text of node.
895      * @return The text of node
896      * @since 3
897      * @sysCap Accessibility
898      */
899     const std::string &GetContent() const;
900 
901     /**
902      * @brief Set the text of node.
903      * @param text The text of node
904      * @since 3
905      * @sysCap Accessibility
906      */
907     void SetContent(const std::string &text);
908 
909     /**
910      * @brief Gets the hint information.
911      * @return the hint information.
912      * @since 3
913      * @sysCap Accessibility
914      */
915     const std::string &GetHint() const;
916 
917     /**
918      * @brief Sets the hint information.
919      * @param hintText the hint information.
920      * @since 3
921      * @sysCap Accessibility
922      */
923     void SetHint(const std::string &hintText);
924 
925     /**
926      * @brief Gets the description of the accessibility node.
927      * @return the description of the accessibility node.
928      * @since 3
929      * @sysCap Accessibility
930      */
931     const std::string &GetDescriptionInfo() const;
932 
933     /**
934      * @brief Set the description of the accessibility node.
935      * @param contentDescription the description of the accessibility node.
936      * @since 3
937      * @sysCap Accessibility
938      */
939     void SetDescriptionInfo(const std::string &contentDescription);
940 
941     /**
942      * @brief Set the resource name of the component.
943      * @param viewIdResName The resource name.
944      * @since 3
945      * @sysCap Accessibility
946      */
947     void SetComponentResourceId(const std::string &viewIdResName);
948 
949     /**
950      * @brief Gets the resource name.
951      * @return the resource name.
952      * @since 3
953      * @sysCap Accessibility
954      */
955     const std::string &GetComponentResourceId() const;
956 
957     /**
958      * @brief Set whether this node has live region
959      * @param liveRegion live region: 0: not live region; 1: interrupt current talk back; 2: talk back by order
960      * @since 3
961      * @sysCap Accessibility
962      */
963     void SetLiveRegion(const int32_t liveRegion);
964 
965     /**
966      * @brief Get the live region of the node
967      * @return The live region of the node
968      * @since 3
969      * @sysCap Accessibility
970      */
971     int32_t GetLiveRegion() const;
972 
973     /**
974      * @brief Set whether this node has content Invalid.
975      * @note If the node has content Invalid,when input invalid information, it will be talkbacked. such as:
976      * The editbox permit number only, you input character("a"), The invalid information will be talkbacked.
977      * @param contentInvalid true:the content is invalid; false:the content is valid
978      * @since 3
979      * @sysCap Accessibility
980      */
981     void SetContentInvalid(const bool contentInvalid);
982 
983     /**
984      * @brief Get whether this node has content Invalid.
985      * @return true:the content is invalid; false:the content is valid
986      * @since 3
987      * @sysCap Accessibility
988      */
989     bool GetContentInvalid() const;
990 
991     /**
992      * @brief Set error information, it used with contentInvalid is setted true.
993      * @param error error information
994      * @since 3
995      * @sysCap Accessibility
996      */
997     void SetError(const std::string &error);
998 
999     /**
1000      * @brief Get error information,it used with contentInvalid is setted true.
1001      * @return error information
1002      * @since 3
1003      * @sysCap Accessibility
1004      */
1005     const std::string &GetError() const;
1006 
1007     /**
1008      * @brief Set the id of component labeled
1009      * @param componentId the id of component
1010      * @since 3
1011      * @sysCap Accessibility
1012      */
1013     void SetLabeled(const int64_t componentId);
1014 
1015     /**
1016      * @brief Get labeled accessibility Id
1017      * @return accessibility Id
1018      * @since 3
1019      * @sysCap Accessibility
1020      */
1021     int64_t GetLabeledAccessibilityId() const;
1022 
1023     /**
1024      * @brief Set accessibility Id
1025      * @param componentId The id of component
1026      * @since 3
1027      * @sysCap Accessibility
1028      */
1029     void SetAccessibilityId(const int64_t componentId);
1030 
1031     /**
1032      * @brief Get accessibility Id
1033      * @return accessibility Id
1034      * @since 3
1035      * @sysCap Accessibility
1036      */
1037     int64_t GetAccessibilityId() const;
1038 
1039     /**
1040      * @brief Get the object of RangeInfo
1041      * @return the object of RangeInfo
1042      * @since 3
1043      * @sysCap Accessibility
1044      */
1045     const RangeInfo &GetRange() const;
1046 
1047     /**
1048      * @brief Set the object of RangeInfo
1049      * @param rangeInfo the object of RangeInfo
1050      * @since 3
1051      * @sysCap Accessibility
1052      */
1053     void SetRange(RangeInfo &rangeInfo);
1054 
1055     /**
1056      * @brief Set the start location of text selected.
1057      * @param start the start location of text selected.
1058      * @since 3
1059      * @sysCap Accessibility
1060      */
1061     void SetSelectedBegin(const int32_t start);
1062 
1063     /**
1064      * @brief Get the start location of text selected.
1065      * @return the start location of text selected.
1066      * @since 3
1067      * @sysCap Accessibility
1068      */
1069     int32_t GetSelectedBegin() const;
1070 
1071     /**
1072      * @brief Set the end location of text selected.
1073      * @param end the end location of text selected.
1074      * @since 3
1075      * @sysCap Accessibility
1076      */
1077     void SetSelectedEnd(const int32_t end);
1078 
1079     /**
1080      * @brief Get the end location of text selected.
1081      * @return the end location of text selected.
1082      * @since 3
1083      * @sysCap Accessibility
1084      */
1085     int32_t GetSelectedEnd() const;
1086 
1087     /**
1088      * @brief Get the object of GridInfo
1089      * @return the object of GridInfo
1090      * @since 3
1091      * @sysCap Accessibility
1092      */
1093     const GridInfo &GetGrid() const;
1094 
1095     /**
1096      * @brief Set the object of GridInfo
1097      * @param grid the object of GridInfo
1098      * @since 3
1099      * @sysCap Accessibility
1100      */
1101     void SetGrid(const GridInfo &grid);
1102 
1103     /**
1104      * @brief Get the object of GridItemInfo
1105      * @return the object of GridItemInfo
1106      * @since 3
1107      * @sysCap Accessibility
1108      */
1109     const GridItemInfo &GetGridItem() const;
1110 
1111     /**
1112      * @brief Set the object of GridItemInfo
1113      * @param gridItem the object of GridItemInfo
1114      * @since 3
1115      * @sysCap Accessibility
1116      */
1117     void SetGridItem(const GridItemInfo &gridItem);
1118 
1119     /**
1120      * @brief Get the current index of list or location text
1121      * @return the current index of list or location text
1122      * @since 3
1123      * @sysCap Accessibility
1124      */
1125     int32_t GetCurrentIndex() const;
1126 
1127     /**
1128      * @brief Set the current index of list or location text
1129      * @param index the current index of list or location text
1130      * @since 3
1131      * @sysCap Accessibility
1132      */
1133     void SetCurrentIndex(const int32_t index);
1134 
1135     /**
1136      * @brief Get the start index of list or location text
1137      * @return the start index of list or location text
1138      * @since 3
1139      * @sysCap Accessibility
1140      */
1141     int32_t GetBeginIndex() const;
1142 
1143     /**
1144      * @brief Set the start index of list or location text
1145      * @param index the start index of list or location text
1146      * @since 3
1147      * @sysCap Accessibility
1148      */
1149     void SetBeginIndex(const int32_t index);
1150 
1151     /**
1152      * @brief Get the end index of list or location text
1153      * @return the end index of list or location text
1154      * @since 3
1155      * @sysCap Accessibility
1156      */
1157     int32_t GetEndIndex() const;
1158 
1159     /**
1160      * @brief Set the end index of list or location text
1161      * @param index the end index of list or location text
1162      * @since 3
1163      * @sysCap Accessibility
1164      */
1165     void SetEndIndex(const int32_t index);
1166 
1167     /**
1168      * @brief Get the input type of text
1169      * @return The input type of text
1170      * @since 3
1171      * @sysCap Accessibility
1172      */
1173     int32_t GetInputType() const;
1174 
1175     /**
1176      * @brief Set the input type of text
1177      * @param inputType The input type of text
1178      * @since 3
1179      * @sysCap Accessibility
1180      */
1181     void SetInputType(const int32_t inputType);
1182 
1183     /**
1184      * @brief Check whether this node is valid
1185      * @return true:valid, otherwise is not.
1186      * @since 3
1187      * @sysCap Accessibility
1188      */
1189     bool IsValidElement() const;
1190 
1191     /**
1192      * @brief Set whether this node is valid
1193      * @param valid true:valid, otherwise is not.
1194      * @since 3
1195      * @sysCap Accessibility
1196      */
1197     void SetValidElement(const bool valid);
1198 
1199     /**
1200      * @brief Set inspector key
1201      * @param inspector The inspector key.
1202      * @since 3
1203      * @sysCap Accessibility
1204      */
1205     void SetInspectorKey(const std::string &key);
1206 
1207     /**
1208      * @brief Get inspector key
1209      * @return The inspector key
1210      * @since 3
1211      * @sysCap Accessibility
1212      */
1213     const std::string &GetInspectorKey() const;
1214 
1215     /**
1216      * @brief Set the path of page.
1217      * @param path The unique identification of one page.
1218      * @sysCap Accessibility
1219      */
1220     void SetPagePath(const std::string &path);
1221 
1222     /**
1223      * @brief Get the path of page
1224      * @return Page path
1225      * @sysCap Accessibility
1226      */
1227     const std::string &GetPagePath() const;
1228 
1229     /**
1230      * @brief Set page id
1231      * @param pageId page id.
1232      * @sysCap Accessibility
1233      */
1234     void SetPageId(const int32_t pageId);
1235 
1236     /**
1237      * @brief Get page id
1238      * @return page id
1239      * @sysCap Accessibility
1240      */
1241     int32_t GetPageId() const;
1242 
1243     /**
1244      * @brief Set the text movement step
1245      * @param granularity text moving unit
1246      * @sysCap Accessibility
1247      */
1248     void SetTextMovementStep(const TextMoveUnit granularity);
1249 
1250     /**
1251      * @brief Get the text movement step
1252      * @return Text moving unit
1253      * @sysCap Accessibility
1254      */
1255     TextMoveUnit GetTextMovementStep() const;
1256 
1257     /**
1258      * @brief Set item count
1259      * @param itemCounts The count of item
1260      * @sysCap Accessibility
1261      */
1262     void SetItemCounts(const int32_t itemCounts);
1263 
1264     /**
1265      * @brief Get item count
1266      * @return The count of item
1267      * @sysCap Accessibility
1268      */
1269     int32_t GetItemCounts() const;
1270 
1271     // The following methods are only used when the target application uses
1272     // the sendEvent interface to send event data.
1273     /**
1274      * @brief Set trigger action
1275      * @param action The trigger action
1276      * @sysCap Accessibility
1277      */
1278     void SetTriggerAction(const ActionType action);
1279 
1280     /**
1281      * @brief Get trigger action
1282      * @return The trigger action
1283      * @sysCap Accessibility
1284      */
1285     ActionType GetTriggerAction() const;
1286 
1287     /**
1288      * @brief Set content list
1289      * @param contentList The list of content
1290      * @sysCap Accessibility
1291      */
1292     void SetContentList(const std::vector<std::string> &contentList);
1293 
1294     /**
1295      * @brief Get content list
1296      * @param contentList(out) The list of content
1297      * @sysCap Accessibility
1298      */
1299     void GetContentList(std::vector<std::string> &contentList) const;
1300 
1301     /**
1302      * @brief Set latest content
1303      * @param content The latest content
1304      * @sysCap Accessibility
1305      */
1306     void SetLatestContent(const std::string &content);
1307 
1308     /**
1309      * @brief Get latest content
1310      * @return The latest content
1311      * @sysCap Accessibility
1312      */
1313     const std::string &GetLatestContent() const;
1314 
1315 protected:
1316     int32_t pageId_ = -1;
1317     int32_t windowId_ = -1;
1318     int64_t elementId_ = UNDEFINED_ACCESSIBILITY_ID;
1319     int64_t parentId_ = UNDEFINED_ACCESSIBILITY_ID;
1320     std::string bundleName_ = "";
1321     std::string componentType_ = "";
1322     std::string text_ = "";
1323     std::string hintText_ = "";
1324     std::string contentDescription_ = "";
1325     std::string resourceName_ = "";
1326     std::string inspectorKey_ = "";
1327     std::string pagePath_ = "";
1328     std::vector<int64_t> childNodeIds_;
1329     int32_t childCount_ = 0;
1330     std::vector<AccessibleAction> operations_;
1331     int32_t textLengthLimit_ = -1;
1332     Rect bounds_ {};
1333     bool checkable_ = false;
1334     bool checked_ = false;
1335     bool focusable_ = false;
1336     bool focused_ = false;
1337     bool visible_ = false;
1338     bool accessibilityFocused_ = false;
1339     bool selected_ = false;
1340     bool clickable_ = false;
1341     bool longClickable_ = false;
1342     bool enable_ = false;
1343     bool isPassword_ = false;
1344     bool scrollable_ = false;
1345     bool editable_ = false;
1346     bool popupSupported_ = false;
1347     bool multiLine_ = false;
1348     bool deletable_ = false;
1349     bool hint_ = false;
1350     bool isEssential_ = false;
1351     int32_t currentIndex_ = 0;
1352     int32_t beginIndex_ = 0;
1353     int32_t endIndex_ = 0;
1354     RangeInfo rangeInfo_ {};
1355     GridInfo grid_ {};
1356     GridItemInfo gridItem_ {};
1357     int32_t liveRegion_ = 0;
1358     bool contentInvalid_ = true;
1359     std::string error_ = "";
1360     int64_t labeled_ = 0;
1361     int32_t beginSelected_ = 0;
1362     int32_t endSelected_ = 0;
1363     int32_t inputType_ = 0; // text input type added
1364     bool validElement_ = true;
1365     TextMoveUnit textMoveStep_ = STEP_CHARACTER;
1366     int32_t itemCounts_ = 0;
1367     ActionType triggerAction_ = ACCESSIBILITY_ACTION_INVALID;
1368     std::vector<std::string> contentList_ {};
1369     std::string latestContent_ = "";
1370 };
1371 } // namespace Accessibility
1372 } // namespace OHOS
1373 #endif // ACCESSIBILITY_ELEMENT_INFO_H