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_INFO_H 17 #define ACCESSIBILITY_INFO_H 18 19 #include <cstdint> 20 #include <list> 21 #include <map> 22 #include <string> 23 #include <vector> 24 25 #include "parcel.h" 26 27 namespace OHOS { 28 namespace Accessibility { 29 enum ActionType :int { 30 ACCESSIBILITY_ACTION_INVALID = 0, 31 ACCESSIBILITY_ACTION_FOCUS = 0x00000001, 32 ACCESSIBILITY_ACTION_CLEAR_FOCUS = 0x00000002, 33 ACCESSIBILITY_ACTION_SELECT = 0x00000004, 34 ACCESSIBILITY_ACTION_CLEAR_SELECTION = 0x00000008, 35 ACCESSIBILITY_ACTION_CLICK = 0x00000010, 36 ACCESSIBILITY_ACTION_LONG_CLICK = 0x00000020, 37 ACCESSIBILITY_ACTION_ACCESSIBILITY_FOCUS = 0x00000040, 38 ACCESSIBILITY_ACTION_CLEAR_ACCESSIBILITY_FOCUS = 0x00000080, 39 ACCESSIBILITY_ACTION_SCROLL_FORWARD = 0x00000100, 40 ACCESSIBILITY_ACTION_SCROLL_BACKWARD = 0x00000200, 41 ACCESSIBILITY_ACTION_COPY = 0x00000400, 42 ACCESSIBILITY_ACTION_PASTE = 0x00000800, 43 ACCESSIBILITY_ACTION_CUT = 0x00001000, 44 ACCESSIBILITY_ACTION_SET_SELECTION = 0x00002000, 45 ACCESSIBILITY_ACTION_SET_TEXT = 0x00004000, 46 ACCESSIBILITY_ACTION_NEXT_TEXT = 0x00200000, 47 ACCESSIBILITY_ACTION_PREVIOUS_TEXT = 0x00400000, 48 ACCESSIBILITY_ACTION_UNFOLD = 0x00800000, 49 ACCESSIBILITY_ACTION_FOLD = 0x01000000, 50 ACCESSIBILITY_ACTION_NEXT_HTML_ITEM = 0x02000000, 51 ACCESSIBILITY_ACTION_PREVIOUS_HTML_ITEM = 0x04000000, 52 ACCESSIBILITY_ACTION_DELETED = 0x08000000, 53 ACCESSIBILITY_ACTION_TYPE_MASK = 0x1FFFFFFF, 54 }; 55 56 // text move step 57 enum TextMoveUnit : int { 58 STEP_INVALID = 0, 59 STEP_CHARACTER = 0x00000001, 60 STEP_WORD = 0x00000002, 61 STEP_LINE = 0x00000004, 62 STEP_PAGE = 0x00000008, 63 STEP_PARAGRAPH = 0x00000010, 64 }; 65 66 // text move step 67 extern const std::string MOVE_UNIT_CHARACTER; 68 extern const std::string MOVE_UNIT_WORD; 69 extern const std::string MOVE_UNIT_LINE; 70 extern const std::string MOVE_UNIT_PAGE; 71 extern const std::string MOVE_UNIT_PARAGRAPH; 72 73 // Operation Arguments Type 74 extern const std::string ACTION_ARGU_INVALID; 75 extern const std::string ACTION_ARGU_SELECT_TEXT_START; 76 extern const std::string ACTION_ARGU_SELECT_TEXT_END; 77 extern const std::string ACTION_ARGU_HTML_ELEMENT; 78 extern const std::string ACTION_ARGU_SET_TEXT; 79 extern const std::string ACTION_ARGU_MOVE_UNIT; 80 81 // HtmlItemType 82 extern const std::string HTML_ITEM_INVALID; 83 extern const std::string HTML_ITEM_LINK; 84 extern const std::string HTML_ITEM_CONTROL; 85 extern const std::string HTML_ITEM_GRAPHIC; 86 extern const std::string HTML_ITEM_LIST_ITEM; 87 extern const std::string HTML_ITEM_LIST; 88 extern const std::string HTML_ITEM_TABLE; 89 extern const std::string HTML_ITEM_COMBOX; 90 extern const std::string HTML_ITEM_HEADING; 91 extern const std::string HTML_ITEM_BUTTON; 92 extern const std::string HTML_ITEM_CHECKBOX; 93 extern const std::string HTML_ITEM_LANDMARK; 94 extern const std::string HTML_ITEM_TEXT_FIELD; 95 extern const std::string HTML_ITEM_FOCUSABLE; 96 extern const std::string HTML_ITEM_H1; 97 extern const std::string HTML_ITEM_H2; 98 extern const std::string HTML_ITEM_H3; 99 extern const std::string HTML_ITEM_H4; 100 extern const std::string HTML_ITEM_H5; 101 extern const std::string HTML_ITEM_H6; 102 extern const std::string HTML_ITEM_UNKOWN; 103 104 enum FocusMoveDirection :int { 105 DIRECTION_INVALID = 0, 106 UP = 0x00000001, 107 DOWN = 0x00000002, 108 LEFT = 0x00000004, 109 RIGHT = 0x00000008, 110 FORWARD = 0x00000010, 111 BACKWARD = 0x00000020, 112 }; 113 static const int PREFETCH_PREDECESSORS = 1 << 0; 114 static const int PREFETCH_SIBLINGS = 1 << 1; 115 static const int PREFETCH_CHILDREN = 1 << 2; 116 static const int UNDEFINED = -1; 117 static const int GET_SOURCE_PREFETCH_MODE = 118 PREFETCH_PREDECESSORS 119 | PREFETCH_SIBLINGS 120 | PREFETCH_CHILDREN; 121 static const int UNDEFINED_CHANNEL_ID = -1; 122 static const int UNDEFINED_SELECTION_INDEX = -1; 123 static const int UNDEFINED_ITEM_ID = 0x1FFFFFF; 124 static const int ROOT_ITEM_ID = -1; 125 static const int MAX_TEXT_LENGTH = 500; 126 static const int HOST_VIEW_ID = -1; 127 static const int ROOT_NODE_ID = -1; 128 129 // Focus types 130 static const int FOCUS_TYPE_INVALID = -1; 131 static const int FOCUS_TYPE_INPUT = 1 << 0; 132 static const int FOCUS_TYPE_ACCESSIBILITY = 1 << 1; 133 134 // grid mode 135 static const int SELECTION_MODE_NONE = 0; 136 static const int SELECTION_MODE_SINGLE = 1; 137 static const int SELECTION_MODE_MULTIPLE = 2; 138 /* 139 * class define the action on Accessibility info 140 */ 141 class AccessibleAction : public Parcelable { 142 public: 143 /** 144 * @brief Construct 145 * @param 146 * @return 147 */ AccessibleAction()148 AccessibleAction() {} 149 150 /** 151 * @brief Construct 152 * @param actionType The type of action, refer to [ActionType] 153 * @param description The description message of action. 154 * @return 155 */ 156 AccessibleAction(ActionType actionType, std::string description); 157 158 /** 159 * @brief Gets the action type. 160 * @param - 161 * @return The type of action, refer to [ActionType] 162 */ 163 ActionType GetActionType() const; 164 165 /** 166 * @brief Gets the action description. 167 * @param - 168 * @return he description message of action. 169 */ 170 std::string GetDescriptionInfo() const; 171 172 /** 173 * @brief Used for IPC communication 174 * @param parcel 175 * @return true: Read parcel date successfully; otherwise is not 176 */ 177 bool ReadFromParcel(Parcel &parcel); 178 179 /** 180 * @brief Used for IPC communication 181 * @param parcel 182 * @return 183 */ 184 virtual bool Marshalling(Parcel &parcel) const override; 185 186 /** 187 * @brief Used for IPC communication 188 * @param parcel 189 * @return Read AccessibleAction from parcel data 190 */ 191 static sptr<AccessibleAction> Unmarshalling(Parcel &parcel); 192 private: 193 ActionType actionType_ = ACCESSIBILITY_ACTION_INVALID; 194 std::string description_ = ""; 195 }; 196 197 /** 198 * @brief Define the RangInfo for progress bar 199 * @note 200 * @retval None 201 */ 202 class RangeInfo : public Parcelable { 203 public: 204 /** 205 * @brief Construct 206 * @param 207 * @return 208 */ RangeInfo()209 RangeInfo() {} 210 211 /** 212 * @brief Construct 213 * @param min The min value 214 * @param max The max value 215 * @param current current value 216 * @return 217 */ 218 RangeInfo(int min, int max, int current); 219 220 /** 221 * @brief Gets the min value. 222 * @param 223 * @return min value 224 */ 225 int GetMin() const; 226 227 /** 228 * @brief Gets the max value. 229 * @param 230 * @return max value. 231 */ 232 int GetMax() const; 233 234 /** 235 * @brief Gets the current value. 236 * @param 237 * @return 238 */ 239 int GetCurrent() const; 240 241 /** 242 * @brief Sets the min value. 243 * @param min min value 244 * @return 245 */ 246 void SetMin(int min); 247 248 /** 249 * @brief Sets the max value. 250 * @param max max value. 251 * @return 252 */ 253 void SetMax(int max); 254 255 /** 256 * @brief Sets the current value. 257 * @param current current value 258 * @return 259 */ 260 void SetCurrent(int current); 261 262 /** 263 * @brief Used for IPC communication 264 * @param parcel 265 * @return 266 */ 267 bool ReadFromParcel(Parcel &parcel); 268 269 /** 270 * @brief Used for IPC communication 271 * @param parcel 272 * @return 273 */ 274 virtual bool Marshalling(Parcel &parcel) const override; 275 276 /** 277 * @brief Used for IPC communication 278 * @param parcel 279 * @return 280 */ 281 static sptr<RangeInfo> Unmarshalling(Parcel &parcel); 282 private: 283 int min_ = 0; 284 int max_ = 0; 285 int current_ = 0; 286 }; 287 288 /** 289 * @brief Define the list/grid component 290 * @note 291 * @retval None 292 */ 293 class GridInfo : public Parcelable { 294 public: 295 /** 296 * @brief Construct 297 * @param 298 * @return 299 * @since 3 300 * @sysCap Accessibility 301 */ GridInfo()302 GridInfo() {} 303 304 /** 305 * @brief Construct 306 * @param rowCount The number of row 307 * @param columnCount The number of column 308 * @param mode 0: select one line only, otherwise select multilines. 309 * @return 310 * @since 3 311 * @sysCap Accessibility 312 */ 313 GridInfo(int rowCount, int columnCount, int mode); 314 315 /** 316 * @brief Set the grid object 317 * @param rowCount The number of row 318 * @param columnCount The number of column 319 * @param mode 0: select one line only, otherwise select multilines. 320 * @return grid object 321 * @since 3 322 * @sysCap Accessibility 323 */ 324 void SetGrid(int rowCount, int columnCount, int mode); 325 326 /** 327 * @brief Copy grid object. 328 * @param other The copied grid 329 * @return grid object 330 * @since 3 331 * @sysCap Accessibility 332 */ 333 void SetGrid(GridInfo other); 334 335 /** 336 * @brief Gets the number of rows. 337 * @param - 338 * @return number of rows. 339 * @since 3 340 * @sysCap Accessibility 341 */ 342 int GetRowCount() const; 343 344 /** 345 * @brief Gets the number of columns. 346 * @param 347 * @return number of columns. 348 * @since 3 349 * @sysCap Accessibility 350 */ 351 int GetColumnCount() const; 352 353 /** 354 * @brief Get the mode of grid 355 * @param 356 * @return 0: Selected by one line, otherwise is multilines. 357 * @since 3 358 * @sysCap Accessibility 359 */ 360 int GetSelectionMode() const; 361 362 /** 363 * @brief Used for IPC communication 364 * @param parcel 365 * @return 366 * @since 3 367 * @sysCap Accessibility 368 */ 369 bool ReadFromParcel(Parcel &parcel); 370 371 /** 372 * @brief Used for IPC communication 373 * @param parcel 374 * @return 375 * @since 3 376 * @sysCap Accessibility 377 */ 378 virtual bool Marshalling(Parcel &parcel) const override; 379 380 /** 381 * @brief Used for IPC communication 382 * @param parcel 383 * @param 384 * @return 385 * @since 3 386 * @sysCap Accessibility 387 */ 388 static sptr<GridInfo> Unmarshalling(Parcel &parcel); 389 private: 390 int rowCount_ = 0; 391 int columnCount_ = 0; 392 int selectionMode_ = 0; 393 }; 394 395 class GridItemInfo : public Parcelable { 396 public: 397 /** 398 * @brief Construct 399 * @param 400 * @return 401 * @since 3 402 * @sysCap Accessibility 403 */ GridItemInfo()404 GridItemInfo() {} 405 406 /** 407 * @brief Construct 408 * @param rowIndex The index of row. 409 * @param rowSpan The row spanned. 410 * @param columnIndex The index of column 411 * @param columnSpan THe column spanned 412 * @param heading true: The item isHeading, otherwise is not 413 * @param selected true: The item is selected,otherwise is not 414 * @return 415 * @since 3 416 * @sysCap Accessibility 417 */ 418 GridItemInfo(int rowIndex, int rowSpan, int columnIndex, int columnSpan, bool heading, bool selected); 419 420 /** 421 * @brief Copy the GridItemInfo 422 * @param other The object of GridItemInfo copied. 423 * @return GridItemInfo object 424 * @since 3 425 * @sysCap Accessibility 426 */ 427 void SetGridItemInfo(GridItemInfo other); 428 429 /** 430 * @brief Set grid object 431 * @param rowIndex The index of row. 432 * @param rowSpan The row spanned. 433 * @param columnIndex The index of column 434 * @param columnSpan THe column spanned 435 * @param heading true: The item isHeading, otherwise is not 436 * @param selected true: The item is selected,otherwise is not 437 * @return GridItemInfo object 438 * @since 3 439 * @sysCap Accessibility 440 */ 441 void SetGridItemInfo(int rowIndex, int rowSpan, 442 int columnIndex, int columnSpan, bool heading, bool selected); 443 444 /** 445 * @brief Gets the column index at which the item is located. 446 * @param 447 * @return The column index. 448 * @since 3 449 * @sysCap Accessibility 450 */ 451 int GetColumnIndex() const; 452 453 /** 454 * @brief Gets the row index at which the item is located. 455 * @param 456 * @return The row index. 457 * @since 3 458 * @sysCap Accessibility 459 */ 460 int GetRowIndex() const; 461 462 /** 463 * @brief Gets the number of columns the item spans. 464 * @param 465 * @return The column span. 466 * @since 3 467 * @sysCap Accessibility 468 */ 469 int GetColumnSpan() const; 470 471 /** 472 * @brief Gets the number of rows the item spans. 473 * @param 474 * @return The row span. 475 * @since 3 476 * @sysCap Accessibility 477 */ 478 int GetRowSpan() const; 479 480 /** 481 * @brief Checks if the grid item is a heading. 482 * @param 483 * @return true: If the item is a heading, otherwise is not. 484 * @since 3 485 * @sysCap Accessibility 486 */ 487 bool IsHeading() const; 488 489 /** 490 * @brief Checks if the grid item is a selected. 491 * @param 492 * @return true: If the item is a selected, otherwise is not. 493 * @since 3 494 * @sysCap Accessibility 495 */ 496 bool IsSelected() const; 497 498 /** 499 * @brief Used for IPC communication 500 * @param parcel 501 * @param 502 * @return 503 * @since 3 504 * @sysCap Accessibility 505 */ 506 bool ReadFromParcel(Parcel &parcel); 507 508 /** 509 * @brief Used for IPC communication 510 * @param parcel 511 * @param 512 * @return 513 * @since 3 514 * @sysCap Accessibility 515 */ 516 virtual bool Marshalling(Parcel &parcel) const override; 517 518 /** 519 * @brief Used for IPC communication 520 * @param parcel 521 * @param 522 * @return 523 * @since 3 524 * @sysCap Accessibility 525 */ 526 static sptr<GridItemInfo> Unmarshalling(Parcel &parcel); 527 private: 528 bool heading_ = false; 529 int columnIndex_ = 0; 530 int rowIndex_ = 0; 531 int columnSpan_ = 0; 532 int rowSpan_ = 0; 533 bool selected_ = 0; 534 }; 535 536 class Rect : public Parcelable { 537 public: 538 /** 539 * @brief Construct 540 * @param 541 * @return 542 * @since 3 543 * @sysCap Accessibility 544 */ Rect()545 Rect() {} 546 547 /** 548 * @brief Destruct 549 * @param - 550 * @return 551 * @since 3 552 * @sysCap Accessibility 553 */ 554 virtual ~Rect() = default; 555 556 /** 557 * @brief Construct 558 * @param leftTopX : The left top x pixel coordinates 559 * @param leftTopY : The left top y pixel coordinates 560 * @param rightBottomY : The right bottom y pixel coordinates 561 * @param rightBottomX : The right bottom x pixel coordinates 562 * @return 563 * @since 3 564 * @sysCap Accessibility 565 */ Rect(int leftTopX,int leftTopY,int rightBottomX,int rightBottomY)566 Rect(int leftTopX, int leftTopY, int rightBottomX, int rightBottomY) 567 { 568 leftTopX_ = leftTopX; 569 leftTopY_ = leftTopY; 570 rightBottomX_ = rightBottomX; 571 rightBottomY_ = rightBottomY; 572 } 573 574 /** 575 * @brief Get the left top point's pixel coordinates 576 * @param - 577 * @return The left top x pixel coordinates 578 * @since 3 579 * @sysCap Accessibility 580 */ GetLeftTopXScreenPostion()581 int GetLeftTopXScreenPostion() const 582 { 583 return leftTopX_; 584 } 585 586 /** 587 * @brief Get the left top point's pixel coordinates 588 * @param - 589 * @return The left top y pixel coordinates 590 * @since 3 591 * @sysCap Accessibility 592 */ GetLeftTopYScreenPostion()593 int GetLeftTopYScreenPostion() const 594 { 595 return leftTopY_; 596 } 597 598 /** 599 * @brief Get the right bottom point's pixel coordinates 600 * @param - 601 * @return The bottom x pixel coordinates 602 * @since 3 603 * @sysCap Accessibility 604 */ GetRightBottomXScreenPostion()605 int GetRightBottomXScreenPostion() const 606 { 607 return rightBottomX_; 608 } 609 610 /** 611 * @brief Get the right bottom point's pixel coordinates 612 * @param - 613 * @return The bottom y pixel coordinates 614 * @since 3 615 * @sysCap Accessibility 616 */ GetRightBottomYScreenPostion()617 int GetRightBottomYScreenPostion() const 618 { 619 return rightBottomY_; 620 } 621 /** 622 * @brief Set the left top point's pixel coordinates 623 * @param leftTopX(out) The left top x pixel coordinates 624 * @param leftTopY(out) The left top y pixel coordinates 625 * @return 626 * @since 3 627 * @sysCap Accessibility 628 */ SetLeftTopScreenPostion(int leftTopX,int leftTopY)629 void SetLeftTopScreenPostion(int leftTopX, int leftTopY) 630 { 631 leftTopY_ = leftTopY; 632 leftTopX_ = leftTopX; 633 } 634 635 /** 636 * @brief Get the right bottom point's pixel coordinates 637 * @param rightBottomX(out) The right bottom x pixel coordinates 638 * @param rightBottomY(out) The right bottom y pixel coordinates 639 * @return 640 * @since 3 641 * @sysCap Accessibility 642 */ SetRightBottomScreenPostion(int rightBottomX,int rightBottomY)643 void SetRightBottomScreenPostion(int rightBottomX, int rightBottomY) 644 { 645 rightBottomY_ = rightBottomY; 646 rightBottomX_ = rightBottomX; 647 } 648 649 /** 650 * @brief Used for IPC communication 651 * @param parcel 652 * @param 653 * @return 654 * @since 3 655 * @sysCap Accessibility 656 */ 657 bool ReadFromParcel(Parcel &parcel); 658 659 /** 660 * @brief Used for IPC communication 661 * @param parcel 662 * @param 663 * @return 664 * @since 3 665 * @sysCap Accessibility 666 */ 667 virtual bool Marshalling(Parcel &parcel) const override; 668 669 /** 670 * @brief Used for IPC communication 671 * @param parcel 672 * @param 673 * @return 674 * @since 3 675 * @sysCap Accessibility 676 */ 677 static sptr<Rect> Unmarshalling(Parcel &parcel); 678 679 private: 680 int leftTopX_ = 0; 681 int leftTopY_ = 0; 682 int rightBottomX_ = 0; 683 int rightBottomY_ = 0; 684 }; 685 686 /* 687 * The class supply the api to set/get ui component property 688 */ 689 class AccessibilityElementInfo : public Parcelable { 690 public: 691 static const int UNDEFINED_ACCESSIBILITY_ID = -1; 692 static const int MAX_SIZE = 50; 693 694 /** 695 * @brief Construct 696 * @param 697 * @return 698 * @since 3 699 * @sysCap Accessibility 700 */ 701 AccessibilityElementInfo(); 702 703 /** 704 * @brief Set the AccessibilityElementInfo 705 * @param componentId The id of component. 706 * @return 707 * @since 3 708 * @sysCap Accessibility 709 */ 710 void SetComponentId(const int componentId); 711 712 /** 713 * @brief Gets information about the node that gains accessibility focus 714 * @param focus Indicates the focus type, which is described in AccessibilityElementInfo#FOCUS_TYPE_ACCESSIBILITY. 715 * @return Returns information about the focused accessibility node. 716 * @since 3 717 * @sysCap Accessibility 718 */ 719 bool GetFocus(const int focus, AccessibilityElementInfo &elementInfo); 720 721 /** 722 * @brief Gets the next focused node in the specified direction of the currently focused node. 723 * @param direction Indicates the direction to obtain the next focused node. Refer to FocusMoveDirection 724 * @return 725 * @since 3 726 * @sysCap Accessibility 727 */ 728 bool GetNext(const FocusMoveDirection direction, AccessibilityElementInfo &elementInfo); 729 730 /** 731 * @brief Get the childe accessibility Id by index. 732 * @param index The index of child 733 * @return accessibility Id 734 * @since 3 735 * @sysCap Accessibility 736 */ 737 int GetChildId(const int index) const; 738 739 /** 740 * @brief Gets the number of children 741 * @param - 742 * @return The number of children 743 * @since 3 744 * @sysCap Accessibility 745 */ 746 int GetChildCount() const; 747 748 /** 749 * @brief Gets the id of children 750 * @param - 751 * @return The list of children id 752 * @since 3 753 * @sysCap Accessibility 754 */ 755 std::vector<int> GetChildIds() const; 756 757 /** 758 * @brief Get the child node information by index 759 * @param index The index of child 760 * @param elementInfo The componet info of child 761 * @return true: get child component info; otherwise is null 762 * @since 3 763 * @sysCap Accessibility 764 */ 765 bool GetChild(const int index, AccessibilityElementInfo &elementInfo); 766 767 /** 768 * @brief Add child node information 769 * @param childId The id of child node 770 * @return 771 * @since 3 772 * @sysCap Accessibility 773 */ 774 void AddChild(const int childId); 775 776 /** 777 * @brief Remove child specified. 778 * @param childId Remove child 779 * @return true: Removed succeed, otherwise is not. 780 * @since 3 781 * @sysCap Accessibility 782 */ 783 bool RemoveChild(const int childId); 784 785 /** 786 * @brief Gets an action list. 787 * @param - 788 * @return action list. Refer to ActionType 789 * @since 3 790 * @sysCap Accessibility 791 */ 792 std::vector<AccessibleAction> GetActionList() const; 793 794 /** 795 * @brief Add action on the component 796 * @param action The action on the component. 797 * @return 798 * @since 3 799 * @sysCap Accessibility 800 */ 801 void AddAction(AccessibleAction &action); 802 803 /** 804 * @brief Remove action on the component 805 * @param action The action object. 806 * @return 807 * @since 3 808 * @sysCap Accessibility 809 */ 810 void DeleteAction(AccessibleAction &action); 811 812 /** 813 * @brief Remove the action on the component. 814 * @param actionType The action type. 815 * @return 816 * @since 3 817 * @sysCap Accessibility 818 */ 819 bool DeleteAction(ActionType &actionType); 820 821 /** 822 * @brief Remove all the action on the component. 823 * @param 824 * @return 825 * @since 3 826 * @sysCap Accessibility 827 */ 828 void DeleteAllActions(); 829 830 /** 831 * @brief Sets the maximum length of text allowed for this node. 832 * @param max The maximum length of text 833 * @return 834 * @since 3 835 * @sysCap Accessibility 836 */ 837 void SetTextLengthLimit(const int max); 838 839 /** 840 * @brief Gets the maximum length of text allowed for this node. 841 * @param 842 * @return The maximum length of text 843 * @since 3 844 * @sysCap Accessibility 845 */ 846 int GetTextLengthLimit() const; 847 848 /** 849 * @brief Executes a specified action. 850 * @param action: the action type 851 * @param actionArguments: The parameter for action type. such as: 852 * action: ACCESSIBILITY_ACTION_NEXT_HTML_ITEM, 853 * actionArguments(ACTION_ARGU_HTML_ELEMENT,HtmlItemType) 854 * action: ACCESSIBILITY_ACTION_PREVIOUS_HTML_ITEM, 855 * actionArguments(ACTION_ARGU_HTML_ELEMENT,HtmlItemType) 856 * action: ACCESSIBILITY_ACTION_NEXT_TEXT, 857 * actionArguments(ACTION_ARGU_MOVE_UNIT,MOVE_UNIT_XXX) 858 * action: ACCESSIBILITY_ACTION_PREVIOUS_TEXT, 859 * actionArguments(ACTION_ARGU_MOVE_UNIT,MOVE_UNIT_XXX) 860 * action: ACCESSIBILITY_ACTION_SET_SELECTION, 861 * actionArguments({ACTION_ARGU_SELECT_TEXT_START,"1"(start location)}, 862 * {ACTION_ARGU_SELECT_TEXT_END,"10"(end location)}) 863 * action: ACCESSIBILITY_ACTION_SET_TEXT, 864 * actionArguments(ACTION_ARGU_SET_TEXT,"the text of setted") 865 * @return true Perform action succeed, otherwise is not. 866 * @since 3 867 * @sysCap Accessibility 868 */ 869 bool ExecuteAction(const ActionType &action, const std::map<std::string, std::string> &actionArguments); 870 871 /** 872 * @brief Searches for node information based on the specified content. 873 * @param text specified content 874 * @return The child node information matched the text filterred. 875 * @since 3 876 * @sysCap Accessibility 877 */ 878 bool GetByContent(const std::string &text, std::vector<AccessibilityElementInfo> &elementInfos); 879 880 /** 881 * @brief Searches for node information by elementId. 882 * @param elementId The unique id of the accessibility ID. It composed by componentId(component id) and virtualId 883 * accessibility ID Low 32 bit: It is componentId(component id), the id of component 884 * accessibility ID High 32 bit: virtualId, It is used when the component is complex and 885 * componentId can't describe the component clearly otherwise the virtualId maybe is -1. 886 * @param mode PREFETCH_PREDECESSORS: Need to make the parent node info also. 887 * PREFETCH_SIBLINGS: Need to make the sister/brothers node info also. 888 * PREFETCH_CHILDREN: Need to make the child node info also. 889 * otherwise: Make the node information by elementId only. 890 * @return node information 891 * @since 3 892 * @sysCap Accessibility 893 */ 894 bool GetElementInfosById(const int elementId, int mode, std::vector<AccessibilityElementInfo> &elementInfos); 895 896 /** 897 * @brief Get the window Id of the component is belongs to the window. 898 * @param 899 * @return window id 900 * @since 3 901 * @sysCap Accessibility 902 */ 903 int GetWindowId() const; 904 905 /** 906 * @brief Set the window Id of the component is belongs to the window. 907 * @param windowId 908 * @return 909 * @since 3 910 * @sysCap Accessibility 911 */ 912 void SetWindowId(const int windowId); 913 914 /** 915 * @brief Get Parent node information 916 * @param 917 * @return Parent node information 918 * @since 3 919 * @sysCap Accessibility 920 */ 921 bool GetParent(AccessibilityElementInfo &elementInfo); 922 923 /** 924 * @brief Get Parent accessibility Id. 925 * @param 926 * @return accessibility Id. 927 * @since 3 928 * @sysCap Accessibility 929 */ 930 int GetParentNodeId() const; 931 932 /** 933 * @brief Set Parent node information 934 * @param parentId Parent node id 935 * @return 936 * @since 3 937 * @sysCap Accessibility 938 */ 939 void SetParent(const int parentId); 940 941 /** 942 * @brief Gets the rectangular area of this accessibility node control in the screen. 943 * @param 944 * @return The rectangular area of this accessibility node 945 * @since 3 946 * @sysCap Accessibility 947 */ 948 Rect GetRectInScreen() const; 949 950 /** 951 * @brief Set the rectangular area of this accessibility node control in the screen. 952 * @param bounds The rectangular area of this accessibility node 953 * @return 954 * @since 3 955 * @sysCap Accessibility 956 */ 957 void SetRectInScreen(Rect &bounds); 958 959 /** 960 * @brief Checks whether this node (a check box as an example) is checkable. 961 * @param 962 * @return whether this node (a check box as an example) is checkable. 963 * @since 3 964 * @sysCap Accessibility 965 */ 966 bool IsCheckable() const; 967 968 /** 969 * @brief Set whether this node (a check box as an example) is checkable. 970 * @param 971 * @return true : Is checkable, otherwise is not. 972 * @since 3 973 * @sysCap Accessibility 974 */ 975 void SetCheckable(const bool checkable); 976 977 /** 978 * @brief Checks whether this node is checked. 979 * @param 980 * @return true : Is checked, otherwise is not. 981 * @since 3 982 * @sysCap Accessibility 983 */ 984 bool IsChecked() const; 985 986 /** 987 * @brief Set whether this node is checked. 988 * @param checked true : Is checked, otherwise is not. 989 * @return 990 * @since 3 991 * @sysCap Accessibility 992 */ 993 void SetChecked(const bool checked); 994 995 /** 996 * @brief Checks whether this node can be focused. 997 * @param 998 * @return true : Can be focused, otherwise is not. 999 * @since 3 1000 * @sysCap Accessibility 1001 */ 1002 bool IsFocusable() const; 1003 1004 /** 1005 * @brief Set whether this node can be focused. 1006 * @param focusable true : Can be focused, otherwise is not. 1007 * @return 1008 * @since 3 1009 * @sysCap Accessibility 1010 */ 1011 void SetFocusable(const bool focusable); 1012 1013 /** 1014 * @brief Checks whether this node has gained focus. 1015 * @param 1016 * @return true : Focused, otherwise is not. 1017 * @since 3 1018 * @sysCap Accessibility 1019 */ 1020 bool IsFocused() const; 1021 1022 /** 1023 * @brief Set whether this node has gained focus. 1024 * @param focused true : Focused, otherwise is not. 1025 * @return 1026 * @since 3 1027 * @sysCap Accessibility 1028 */ 1029 void SetFocused(const bool focused); 1030 1031 /** 1032 * @brief Checks whether this node is visible to users. 1033 * @param 1034 * @return true : visible, otherwise is not. 1035 * @since 3 1036 * @sysCap Accessibility 1037 */ 1038 bool IsVisible() const; 1039 1040 /** 1041 * @brief Set whether this node is visible to users. 1042 * @param visible true : visible, otherwise is not. 1043 * @return 1044 * @since 3 1045 * @sysCap Accessibility 1046 */ 1047 void SetVisible(const bool visible); 1048 1049 /** 1050 * @brief Checks whether this node has gained accessibility focus. 1051 * @param 1052 * @return true : Gained accessibility focus, otherwise is not. 1053 * @since 3 1054 * @sysCap Accessibility 1055 */ 1056 bool HasAccessibilityFocus() const; 1057 1058 /** 1059 * @brief Set whether this node has gained accessibility focus. 1060 * @param focused true : Gained accessibility focus, otherwise is not. 1061 * @return 1062 * @since 3 1063 * @sysCap Accessibility 1064 */ 1065 void SetAccessibilityFocus(const bool focused); 1066 1067 /** 1068 * @brief Checks whether this node is selected. 1069 * @param 1070 * @return true: selected, otherwise is not. 1071 * @since 3 1072 * @sysCap Accessibility 1073 */ 1074 bool IsSelected() const; 1075 1076 /** 1077 * @brief Set whether this node is selected. 1078 * @param selected true: selected, otherwise is not. 1079 * @return 1080 * @since 3 1081 * @sysCap Accessibility 1082 */ 1083 void SetSelected(const bool selected); 1084 1085 /** 1086 * @brief Checks whether this node is clickable. 1087 * @param 1088 * @return true: clickable, otherwise is not. 1089 * @since 3 1090 * @sysCap Accessibility 1091 */ 1092 bool IsClickable() const; 1093 1094 /** 1095 * @brief Set whether this node is clickable. 1096 * @param clickable true: clickable, otherwise is not. 1097 * @return 1098 * @since 3 1099 * @sysCap Accessibility 1100 */ 1101 void SetClickable(const bool clickable); 1102 1103 /** 1104 * @brief Checks whether this node is long clickable. 1105 * @param 1106 * @return true: long clickable, otherwise is not. 1107 * @since 3 1108 * @sysCap Accessibility 1109 */ 1110 bool IsLongClickable() const; 1111 1112 /** 1113 * @brief Set whether this node is long clickable. 1114 * @param longClickable true: long clickable, otherwise is not. 1115 * @return 1116 * @since 3 1117 * @sysCap Accessibility 1118 */ 1119 void SetLongClickable(const bool longClickable); 1120 1121 /** 1122 * @brief Checks whether this node is enabled. 1123 * @param 1124 * @return true: enabled, otherwise is not. 1125 * @since 3 1126 * @sysCap Accessibility 1127 */ 1128 bool IsEnabled() const; 1129 1130 /** 1131 * @brief Set whether this node is enabled. 1132 * @param enabled true: enabled, otherwise is not. 1133 * @return 1134 * @since 3 1135 * @sysCap Accessibility 1136 */ 1137 void SetEnabled(const bool enabled); 1138 1139 /** 1140 * @brief Checks whether the content in this node is a password. 1141 * @param 1142 * @return true: password, otherwise is not. 1143 * @since 3 1144 * @sysCap Accessibility 1145 */ 1146 bool IsPassword() const; 1147 1148 /** 1149 * @brief Set whether the content in this node is a password 1150 * @param type true: password, otherwise is not. 1151 * @return 1152 * @since 3 1153 * @sysCap Accessibility 1154 */ 1155 void SetPassword(const bool type); 1156 1157 /** 1158 * @brief Checks whether this node is scrollable. 1159 * @param 1160 * @return true: scrollable, otherwise is not. 1161 * @since 3 1162 * @sysCap Accessibility 1163 */ 1164 bool IsScrollable() const; 1165 1166 /** 1167 * @brief Set whether this node is scrollable. 1168 * @param scrollable true: scrollable, otherwise is not. 1169 * @return 1170 * @since 3 1171 * @sysCap Accessibility 1172 */ 1173 void SetScrollable(const bool scrollable); 1174 1175 /** 1176 * @brief Checks whether this node is editable. 1177 * @param 1178 * @return true: editable, otherwise is not. 1179 * @since 3 1180 * @sysCap Accessibility 1181 */ 1182 bool IsEditable() const; 1183 1184 /** 1185 * @brief Set whether this node is editable. 1186 * @param editable true: editable, otherwise is not. 1187 * @return 1188 * @since 3 1189 * @sysCap Accessibility 1190 */ 1191 void SetEditable(const bool editable); 1192 1193 /** 1194 * @brief Checks whether this node can display text in multiple lines. 1195 * @param 1196 * @return true: multilines, otherwise is not. 1197 * @since 3 1198 * @sysCap Accessibility 1199 */ 1200 bool IsPluraLineSupported() const; 1201 1202 /** 1203 * @brief Set whether this node can display text in multiple lines. 1204 * @param multiLine true: multilines, otherwise is not. 1205 * @return 1206 * @since 3 1207 * @sysCap Accessibility 1208 */ 1209 void SetPluraLineSupported(const bool multiLine); 1210 1211 /** 1212 * @brief Checks whether pop-up windows are supported. 1213 * @param 1214 * @return true: Support popup, otherwise is not. 1215 * @since 3 1216 * @sysCap Accessibility 1217 */ 1218 bool IsPopupSupported() const; 1219 1220 /** 1221 * @brief Set whether pop-up windows are supported. 1222 * @param supportPopup true: Support popup, otherwise is not. 1223 * @return 1224 * @since 3 1225 * @sysCap Accessibility 1226 */ 1227 void SetPopupSupported(const bool supportPopup); 1228 1229 /** 1230 * @brief Checks whether this node is deletable. 1231 * @param 1232 * @return true: deletable, otherwise is not. 1233 * @since 3 1234 * @sysCap Accessibility 1235 */ 1236 bool IsDeletable() const; 1237 1238 /** 1239 * @brief Set whether this node is deletable. 1240 * @param deletable true: deletable, otherwise is not. 1241 * @return 1242 * @since 3 1243 * @sysCap Accessibility 1244 */ 1245 void SetDeletable(const bool deletable); 1246 1247 /** 1248 * @brief Checks whether this node is essential to users. 1249 * @param 1250 * @return true: essential to user, otherwise is not. 1251 * @since 3 1252 * @sysCap Accessibility 1253 */ 1254 bool IsEssential() const; 1255 1256 /** 1257 * @brief Set whether this node is essential to users. 1258 * @param essential true: essential to user, otherwise is not. 1259 * @return 1260 * @since 3 1261 * @sysCap Accessibility 1262 */ 1263 void SetEssential(const bool essential); 1264 1265 /** 1266 * @brief Checks whether this node is displaying a hint. 1267 * @param 1268 * @return true: displaying a hint, otherwise is not. 1269 * @since 3 1270 * @sysCap Accessibility 1271 */ 1272 bool IsGivingHint() const; 1273 1274 /** 1275 * @brief Set whether this node is displaying a hint. 1276 * @param hinting true: displaying a hint, otherwise is not. 1277 * @return 1278 * @since 3 1279 * @sysCap Accessibility 1280 */ 1281 void SetHinting(const bool hinting); 1282 1283 /** 1284 * @brief Gets the bundle name of application target. 1285 * @param 1286 * @return bundle name 1287 * @since 3 1288 * @sysCap Accessibility 1289 */ 1290 std::string GetBundleName() const; 1291 1292 /** 1293 * @brief Set the bundle name of application target. 1294 * @param bundleName The bundle name of application target. 1295 * @return 1296 * @since 3 1297 * @sysCap Accessibility 1298 */ 1299 void SetBundleName(const std::string &bundleName); 1300 1301 /** 1302 * @brief Gets the class name. 1303 * @param 1304 * @return class name. 1305 * @since 3 1306 * @sysCap Accessibility 1307 */ 1308 std::string GetComponentType() const; 1309 1310 /** 1311 * @brief Sets the class name. 1312 * @param className class name. 1313 * @return 1314 * @since 3 1315 * @sysCap Accessibility 1316 */ 1317 void SetComponentType(const std::string &className); 1318 1319 /** 1320 * @brief Gets the text of node. 1321 * @param 1322 * @return The text of node 1323 * @since 3 1324 * @sysCap Accessibility 1325 */ 1326 std::string GetContent() const; 1327 1328 /** 1329 * @brief Set the text of node. 1330 * @param text The text of node 1331 * @return 1332 * @since 3 1333 * @sysCap Accessibility 1334 */ 1335 void SetContent(const std::string &text); 1336 1337 /** 1338 * @brief Gets the accessibility text of node. 1339 * @param 1340 * @return the accessibility text of node 1341 * @since 3 1342 * @sysCap Accessibility 1343 */ 1344 std::string GetAccessibilityContent() const; 1345 1346 /** 1347 * @brief Set the accessibility text of node. 1348 * @param text The accessibility text of node. 1349 * @return 1350 * @since 3 1351 * @sysCap Accessibility 1352 */ 1353 void SetAccessibilityContent(const std::string &text); 1354 1355 /** 1356 * @brief Gets the accessibility description of node. 1357 * @param 1358 * @return The accessibility description of node. 1359 * @since 3 1360 * @sysCap Accessibility 1361 */ 1362 std::string GetAccessibilityDescription() const; 1363 1364 /** 1365 * @brief Set the accessibility description of node. 1366 * @param text The accessibility description of node. 1367 * @return 1368 * @since 3 1369 * @sysCap Accessibility 1370 */ 1371 void SetAccessibilityDescription(const std::string &text); 1372 1373 /** 1374 * @brief Checks whether this node is accessibility group. 1375 * @param 1376 * @return true Accessibility group, otherwise is not. 1377 * @since 3 1378 * @sysCap Accessibility 1379 */ 1380 bool GetAccessibilityGroup() const; 1381 1382 /** 1383 * @brief Set whether this node is accessibility group 1384 * @param group true Accessibility group, otherwise is not. 1385 * @return 1386 * @since 3 1387 * @sysCap Accessibility 1388 */ 1389 void SetAccessibilityGroup(const bool group); 1390 1391 /** 1392 * @brief Gets the hint information. 1393 * @param 1394 * @return the hint information. 1395 * @since 3 1396 * @sysCap Accessibility 1397 */ 1398 std::string GetHint() const; 1399 1400 /** 1401 * @brief Sets the hint information. 1402 * @param hintText the hint information. 1403 * @return 1404 * @since 3 1405 * @sysCap Accessibility 1406 */ 1407 void SetHint(const std::string &hintText); 1408 1409 /** 1410 * @brief Gets the description of the accessibility node. 1411 * @param 1412 * @return the description of the accessibility node. 1413 * @since 3 1414 * @sysCap Accessibility 1415 */ 1416 std::string GetDescriptionInfo() const; 1417 1418 /** 1419 * @brief Set the description of the accessibility node. 1420 * @param contentDescription the description of the accessibility node. 1421 * @return 1422 * @since 3 1423 * @sysCap Accessibility 1424 */ 1425 void SetDescriptionInfo(const std::string contentDescription); 1426 1427 /** 1428 * @brief Set the resource name of the component. 1429 * @param viewIdResName The resource name. 1430 * @return 1431 * @since 3 1432 * @sysCap Accessibility 1433 */ 1434 void SetComponentResourceId(const std::string &viewIdResName); 1435 1436 /** 1437 * @brief Gets the resource name. 1438 * @param 1439 * @return the resource name. 1440 * @since 3 1441 * @sysCap Accessibility 1442 */ 1443 std::string GetComponentResourceId() const; 1444 1445 /** 1446 * @brief Set whether this node has live region 1447 * @param liveRegion live region: 0: not live region; 1: interrupt current talk back; 2: talk back by order 1448 * @return 1449 * @since 3 1450 * @sysCap Accessibility 1451 */ 1452 void SetLiveRegion(const int liveRegion); 1453 /** 1454 * @brief Get whether this node has live region 1455 * @param 1456 * @return live region 1457 * @since 3 1458 * @sysCap Accessibility 1459 */ 1460 int GetLiveRegion() const; 1461 1462 /** 1463 * @brief Set whether this node has content Invalid. 1464 * @note If the node has content Invalid,when input invalid information, it will be talkbacked. such as: 1465 * The editbox permit number only, you input character("a"), The invalid information will be talkbacked. 1466 * @param contentInvalid content Invalid 1467 * @return 1468 * @since 3 1469 * @sysCap Accessibility 1470 */ 1471 void SetContentInvalid(const bool contentInvalid); 1472 1473 /** 1474 * @brief Get whether this node has content Invalid. 1475 * @param 1476 * @return true Is setted content invalid, otherwise is not. 1477 * @since 3 1478 * @sysCap Accessibility 1479 */ 1480 bool GetContentInvalid() const; 1481 1482 /** 1483 * @brief Set error information, it used with contentInvalid is setted true. 1484 * @param error error information 1485 * @return 1486 * @since 3 1487 * @sysCap Accessibility 1488 */ 1489 void SetError(const std::string &error); 1490 1491 /** 1492 * @brief Get error information,it used with contentInvalid is setted true. 1493 * @param 1494 * @return 1495 * @since 3 1496 * @sysCap Accessibility 1497 */ 1498 std::string GetError() const; 1499 1500 /** 1501 * @brief Set the id of component labeled 1502 * @param componentId the id of component 1503 * @return 1504 * @since 3 1505 * @sysCap Accessibility 1506 */ 1507 void SetLabeled(const int componentId); 1508 1509 /** 1510 * @brief Get the node information labeled component 1511 * @param 1512 * @return the node information labeled 1513 * @since 3 1514 * @sysCap Accessibility 1515 */ 1516 bool GetLabeled(AccessibilityElementInfo &elementInfo) const; 1517 1518 /** 1519 * @brief Get labeled accessibility Id 1520 * @param 1521 * @return accessibility Id 1522 * @since 3 1523 * @sysCap Accessibility 1524 */ 1525 int GetLabeledAccessibilityId() const; 1526 1527 /** 1528 * @brief Get the id of the IAccessibleAbilityChannel 1529 * @param 1530 * @return The id of the IAccessibleAbilityChannel 1531 * @since 3 1532 * @sysCap Accessibility 1533 */ 1534 int GetChannelId() const; 1535 1536 /** 1537 * @brief AAMS called to set the id of the IAccessibleAbilityChannel 1538 * @param channelId The id of the IAccessibleAbilityChannel 1539 * @param 1540 * @return 1541 * @since 3 1542 * @sysCap Accessibility 1543 */ 1544 void SetChannelId(const int channelId); 1545 1546 /** 1547 * @brief Set accessibility Id 1548 * @param componentId The id of component 1549 * @return 1550 * @since 3 1551 * @sysCap Accessibility 1552 */ 1553 void SetAccessibilityId(const int componentId); 1554 1555 /** 1556 * @brief Get accessibility Id 1557 * @param 1558 * @return accessibility Id 1559 * @since 3 1560 * @sysCap Accessibility 1561 */ 1562 int GetAccessibilityId() const; 1563 1564 /** 1565 * @brief Get the object of RangeInfo 1566 * @param 1567 * @return the object of RangeInfo 1568 * @since 3 1569 * @sysCap Accessibility 1570 */ 1571 RangeInfo GetRange() const; 1572 1573 /** 1574 * @brief Set the object of RangeInfo 1575 * @param rangeInfo the object of RangeInfo 1576 * @return 1577 * @since 3 1578 * @sysCap Accessibility 1579 */ 1580 void SetRange(RangeInfo &rangeInfo); 1581 1582 /** 1583 * @brief Set the start location of text selected. 1584 * @param start the end location of text selected. 1585 * @return 1586 * @since 3 1587 * @sysCap Accessibility 1588 */ 1589 void SetSelectedBegin(const int start); 1590 1591 /** 1592 * @brief Get the start location of text selected. 1593 * @param 1594 * @return the start location of text selected. 1595 * @since 3 1596 * @sysCap Accessibility 1597 */ 1598 int GetSelectedBegin() const; 1599 1600 /** 1601 * @brief Set the end location of text selected. 1602 * @param end the end location of text selected. 1603 * @return 1604 * @since 3 1605 * @sysCap Accessibility 1606 */ 1607 void SetSelectedEnd(const int end); 1608 1609 /** 1610 * @brief Get the end location of text selected. 1611 * @param 1612 * @return the end location of text selected. 1613 * @since 3 1614 * @sysCap Accessibility 1615 */ 1616 int GetSelectedEnd() const; 1617 1618 /** 1619 * @brief Get the object of GridInfo 1620 * @param 1621 * @return the object of GridInfo 1622 * @since 3 1623 * @sysCap Accessibility 1624 */ 1625 GridInfo GetGrid() const; 1626 1627 /** 1628 * @brief Set the object of GridInfo 1629 * @param grid the object of GridInfo 1630 * @return 1631 * @since 3 1632 * @sysCap Accessibility 1633 */ 1634 void SetGrid(const GridInfo &grid); 1635 1636 /** 1637 * @brief Get the object of GridItemInfo 1638 * @param 1639 * @return the object of GridItemInfo 1640 * @since 3 1641 * @sysCap Accessibility 1642 */ 1643 GridItemInfo GetGridItem() const; 1644 1645 /** 1646 * @brief Set the object of GridItemInfo 1647 * @param gridItem the object of GridItemInfo 1648 * @return 1649 * @since 3 1650 * @sysCap Accessibility 1651 */ 1652 void SetGridItem(const GridItemInfo &gridItem); 1653 1654 /** 1655 * @brief Get the current index of list or location text 1656 * @param 1657 * @return the current index of list or location text 1658 * @since 3 1659 * @sysCap Accessibility 1660 */ 1661 int GetCurrentIndex() const; 1662 1663 /** 1664 * @brief Set the current index of list or location text 1665 * @param index the current index of list or location text 1666 * @return 1667 * @since 3 1668 * @sysCap Accessibility 1669 */ 1670 void SetCurrentIndex(const int index); 1671 1672 /** 1673 * @brief Get the start index of list or location text 1674 * @param 1675 * @return the start index of list or location text 1676 * @since 3 1677 * @sysCap Accessibility 1678 */ 1679 int GetBeginIndex() const; 1680 1681 /** 1682 * @brief Set the start index of list or location text 1683 * @param index the start index of list or location text 1684 * @return 1685 * @since 3 1686 * @sysCap Accessibility 1687 */ 1688 void SetBeginIndex(const int index); 1689 1690 /** 1691 * @brief Get the end index of list or location text 1692 * @param 1693 * @return the end index of list or location text 1694 * @since 3 1695 * @sysCap Accessibility 1696 */ 1697 int GetEndIndex() const; 1698 1699 /** 1700 * @brief Set the end index of list or location text 1701 * @param index the end index of list or location text 1702 * @return 1703 * @since 3 1704 * @sysCap Accessibility 1705 */ 1706 void SetEndIndex(const int index); 1707 1708 /** 1709 * @brief Get the input type of text 1710 * @param 1711 * @return The input type of text 1712 * @since 3 1713 * @sysCap Accessibility 1714 */ 1715 int GetInputType() const; 1716 1717 /** 1718 * @brief Set the input type of text 1719 * @param inputType The input type of text 1720 * @return 1721 * @since 3 1722 * @sysCap Accessibility 1723 */ 1724 void SetInputType(const int inputType); 1725 1726 /** 1727 * @brief Checks whether this node is valid 1728 * @param 1729 * @return true: valid, otherwise is not. 1730 * @since 3 1731 * @sysCap Accessibility 1732 */ 1733 bool IsValidElement() const; 1734 1735 /** 1736 * @brief Set whether this node is valid 1737 * @param valid true: valid, otherwise is not. 1738 * @return 1739 * @since 3 1740 * @sysCap Accessibility 1741 */ 1742 void SetValidElement(const bool valid); 1743 1744 /** 1745 * @brief Set InspectorKey 1746 * @param inspector key. 1747 * @since 3 1748 * @sysCap Accessibility 1749 */ 1750 void SetInspectorKey(const std::string key); 1751 1752 /** 1753 * @brief Get InspectorKey 1754 * @return inspector key 1755 * @since 3 1756 * @sysCap Accessibility 1757 */ 1758 std::string GetInspectorKey() const; 1759 1760 /** 1761 * @brief Used for IPC communication 1762 * @param parcel 1763 * @return true: Read parcel data successfully; ohterwise is not. 1764 * @since 3 1765 * @sysCap Accessibility 1766 */ 1767 bool ReadFromParcel(Parcel &parcel); 1768 1769 /** 1770 * @brief Used for IPC communication 1771 * @param parcel 1772 * @return true: Write parcel data successfully; ohterwise is not. 1773 * @since 3 1774 * @sysCap Accessibility 1775 */ 1776 virtual bool Marshalling(Parcel &parcel) const override; 1777 1778 /** 1779 * @brief Used for IPC communication 1780 * @param parcel 1781 * @return Read AccessibilityElementInfo from parcel data 1782 * @since 3 1783 * @sysCap Accessibility 1784 */ 1785 static sptr<AccessibilityElementInfo> Unmarshalling(Parcel &parcel); 1786 1787 private: 1788 int windowId_ = -1; 1789 int elementId_ = UNDEFINED_ACCESSIBILITY_ID; 1790 int parentId_ = UNDEFINED_ACCESSIBILITY_ID; 1791 std::string bundleName_ = ""; 1792 std::string componentType_ = ""; 1793 std::string text_ = ""; 1794 std::string hintText_ = ""; 1795 std::string accessibilityText_ = ""; 1796 std::string accessibilityDescription_ = ""; 1797 std::string contentDescription_ = ""; 1798 std::string resourceName_ = ""; 1799 std::string inspectorKey_ = ""; 1800 std::vector<int> childNodeIds_; 1801 int childCount_ = 0; 1802 std::vector<AccessibleAction> operations_; 1803 int textLengthLimit_ = -1; 1804 int channelId_ = UNDEFINED_CHANNEL_ID; // rename 1805 Rect bounds_ {}; 1806 bool accessibilityGroup_ = false; 1807 bool checkable_ = false; 1808 bool checked_ = false; 1809 bool focusable_ = false; 1810 bool focused_ = false; 1811 bool visible_ = false; 1812 bool accessibilityFocused_ = false; 1813 bool selected_ = false; 1814 bool clickable_ = false; 1815 bool longClickable_ = false; 1816 bool enable_ = false; 1817 bool isPassword_ = false; 1818 bool scrollable_ = false; 1819 bool editable_ = false; 1820 bool popupSupported_ = false; 1821 bool multiLine_ = false; 1822 bool deletable_ = false; 1823 bool hint_ = false; 1824 bool isEssential_ = false; 1825 int currentIndex_ = 0; 1826 int beginIndex_ = 0; 1827 int endIndex_ = 0; 1828 RangeInfo rangeInfo_ {}; 1829 GridInfo grid_ {}; 1830 GridItemInfo gridItem_ {}; 1831 int liveRegion_ = 0; 1832 bool contentInvalid_ = true; 1833 std::string error_ = ""; 1834 int labeled_ = 0; 1835 int beginSelected_ = 0; 1836 int endSelected_ = 0; 1837 int inputType_ = 0; // text input type added 1838 bool validElement_ = true; 1839 }; 1840 } // namespace Accessibility 1841 } // namespace OHOS 1842 #endif