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