nsIAccessibleTextRange.idl 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #include "nsISupports.idl"
  6. interface nsIAccessible;
  7. interface nsIAccessibleText;
  8. interface nsIArray;
  9. interface nsIVariant;
  10. /**
  11. * A range representing a piece of text in the document.
  12. */
  13. [scriptable, builtinclass, uuid(c4515623-55f9-4543-a3d5-c1e9afa588f4)]
  14. interface nsIAccessibleTextRange : nsISupports
  15. {
  16. readonly attribute nsIAccessibleText startContainer;
  17. readonly attribute long startOffset;
  18. readonly attribute nsIAccessibleText endContainer;
  19. readonly attribute long endOffset;
  20. /**
  21. * Return an accessible containing the whole range
  22. */
  23. readonly attribute nsIAccessible container;
  24. /**
  25. * Return embedded children within the range.
  26. */
  27. readonly attribute nsIArray embeddedChildren;
  28. /**
  29. * Return true if this range has the same end points of the given range.
  30. */
  31. boolean compare(in nsIAccessibleTextRange aOtherRange);
  32. /**
  33. * The two endpoints of the range (starting and ending).
  34. */
  35. const unsigned long EndPoint_Start = 1;
  36. const unsigned long EndPoint_End = 2;
  37. /**
  38. * Compare this and given ranges end points.
  39. *
  40. * @return -1/0/1 if this range end point is before/equal/after the given
  41. * range end point.
  42. */
  43. long compareEndPoints(in unsigned long aEndPoint,
  44. in nsIAccessibleTextRange aOtherRange,
  45. in unsigned long aOtherRangeEndPoint);
  46. /**
  47. * Return text within the range.
  48. */
  49. readonly attribute AString text;
  50. /**
  51. * Return list of rects of the range.
  52. */
  53. readonly attribute nsIArray bounds;
  54. const unsigned long FormatUnit = 0;
  55. const unsigned long WordUnit = 1;
  56. const unsigned long LineUnit = 2;
  57. const unsigned long ParagraphUnit = 3;
  58. const unsigned long PageUnit = 4;
  59. const unsigned long DocumentUnit = 5;
  60. /**
  61. * Move the boundary(ies) by the given number of the unit.
  62. */
  63. void move(in unsigned long aUnit, in long aCount);
  64. void moveStart(in unsigned long aUnit, in long aCount);
  65. void moveEnd(in unsigned long aUnit, in long aCount);
  66. /**
  67. * Normalize the range to the closest unit of the given type.
  68. */
  69. void normalize(in unsigned long aUnit);
  70. /**
  71. * Crops the range by the given accessible element.
  72. */
  73. boolean crop(in nsIAccessible aContainer);
  74. /**
  75. * Return range enclosing the found text.
  76. */
  77. nsIAccessibleTextRange findText(in AString aText, in boolean aIsBackward,
  78. in boolean aIsIgnoreCase);
  79. /**
  80. * Text attributes. Used in conjunction with findAttrs().
  81. */
  82. const unsigned long AnimationStyleAttr = 0;
  83. const unsigned long AnnotationObjectsAttr = 1;
  84. const unsigned long AnnotationTypesAttr = 2;
  85. const unsigned long BackgroundColorAttr = 3;
  86. const unsigned long BulletStyleAttr = 4;
  87. const unsigned long CapStyleAttr = 5;
  88. const unsigned long CaretBidiModeAttr = 6;
  89. const unsigned long CaretPositionAttr = 7;
  90. const unsigned long CultureAttr = 8;
  91. const unsigned long FontNameAttr = 9;
  92. const unsigned long FontSizeAttr = 10;
  93. const unsigned long FontWeightAttr = 11;
  94. const unsigned long ForegroundColorAttr = 12;
  95. const unsigned long HorizontalTextAlignmentAttr = 13;
  96. const unsigned long IndentationFirstLineAttr = 14;
  97. const unsigned long IndentationLeadingAttr = 15;
  98. const unsigned long IndentationTrailingAttr = 16;
  99. const unsigned long IsActiveAttr = 17;
  100. const unsigned long IsHiddenAttr = 18;
  101. const unsigned long IsItalicAttr = 19;
  102. const unsigned long IsReadOnlyAttr = 20;
  103. const unsigned long IsSubscriptAttr = 21;
  104. const unsigned long IsSuperscriptAttr = 22;
  105. const unsigned long LinkAttr = 23;
  106. const unsigned long MarginBottomAttr = 24;
  107. const unsigned long MarginLeadingAttr = 25;
  108. const unsigned long MarginTopAttr = 26;
  109. const unsigned long MarginTrailingAttr = 27;
  110. const unsigned long OutlineStylesAttr = 28;
  111. const unsigned long OverlineColorAttr = 29;
  112. const unsigned long OverlineStyleAttr = 30;
  113. const unsigned long SelectionActiveEndAttr = 31;
  114. const unsigned long StrikethroughColorAttr = 32;
  115. const unsigned long StrikethroughStyleAttr = 33;
  116. const unsigned long StyleIdAttr = 34;
  117. const unsigned long StyleNameAttr = 35;
  118. const unsigned long TabsAttr = 36;
  119. const unsigned long TextFlowDirectionsAttr = 37;
  120. const unsigned long UnderlineColorAttr = 38;
  121. const unsigned long UnderlineStyleAttr = 39;
  122. /**
  123. * Return range enslosing the text having requested attribute.
  124. */
  125. nsIAccessibleTextRange findAttr(in unsigned long aAttr, in nsIVariant aValue,
  126. in boolean aIsBackward);
  127. /**
  128. * Add/remove the text range from selection.
  129. */
  130. void addToSelection();
  131. void removeFromSelection();
  132. void select();
  133. const unsigned long AlignToTop = 0;
  134. const unsigned long AlignToBottom = 1;
  135. /**
  136. * Scroll the range into view.
  137. */
  138. void scrollIntoView(in unsigned long aHow);
  139. };