summaryrefslogtreecommitdiffstats
path: root/accessible/interfaces/nsIAccessibleTextRange.idl
blob: 1c351c734c91926e91ce40a9d63e201152b75392 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"

interface nsIAccessible;
interface nsIAccessibleText;
interface nsIArray;
interface nsIVariant;

/**
 * A range representing a piece of text in the document.
 */
[scriptable, builtinclass, uuid(c4515623-55f9-4543-a3d5-c1e9afa588f4)]
interface nsIAccessibleTextRange : nsISupports
{
  readonly attribute nsIAccessibleText startContainer;
  readonly attribute long startOffset;
  readonly attribute nsIAccessibleText endContainer;
  readonly attribute long endOffset;

  /**
   * Return an accessible containing the whole range
   */
  readonly attribute nsIAccessible container;

  /**
   * Return embedded children within the range.
   */
  readonly attribute nsIArray embeddedChildren;

  /**
   * Return true if this range has the same end points of the given range.
   */
  boolean compare(in nsIAccessibleTextRange aOtherRange);

  /**
   * The two endpoints of the range (starting and ending).
   */
  const unsigned long EndPoint_Start = 1;
  const unsigned long EndPoint_End = 2;

  /**
   * Compare this and given ranges end points.
   *
   * @return -1/0/1 if this range end point is before/equal/after the given
   *          range end point.
   */
  long compareEndPoints(in unsigned long aEndPoint,
                        in nsIAccessibleTextRange aOtherRange,
                        in unsigned long aOtherRangeEndPoint);

  /**
   * Return text within the range.
   */
  readonly attribute AString text;

  /**
   * Return list of rects of the range.
   */
  readonly attribute nsIArray bounds;

  const unsigned long FormatUnit = 0;
  const unsigned long WordUnit = 1;
  const unsigned long LineUnit = 2;
  const unsigned long ParagraphUnit = 3;
  const unsigned long PageUnit = 4;
  const unsigned long DocumentUnit = 5;

  /**
   *  Move the boundary(ies) by the given number of the unit.
   */
  void move(in unsigned long aUnit, in long aCount);
  void moveStart(in unsigned long aUnit, in long aCount);
  void moveEnd(in unsigned long aUnit, in long aCount);

  /**
   * Normalize the range to the closest unit of the given type.
   */
  void normalize(in unsigned long aUnit);

  /**
   * Crops the range by the given accessible element.
   */
  boolean crop(in nsIAccessible aContainer);

  /**
   * Return range enclosing the found text.
   */
  nsIAccessibleTextRange findText(in AString aText, in boolean aIsBackward,
                                  in boolean aIsIgnoreCase);

  /**
   * Text attributes. Used in conjunction with findAttrs().
   */
  const unsigned long AnimationStyleAttr = 0;
  const unsigned long AnnotationObjectsAttr = 1;
  const unsigned long AnnotationTypesAttr = 2;
  const unsigned long BackgroundColorAttr = 3;
  const unsigned long BulletStyleAttr = 4;
  const unsigned long CapStyleAttr = 5;
  const unsigned long CaretBidiModeAttr = 6;
  const unsigned long CaretPositionAttr = 7;
  const unsigned long CultureAttr = 8;
  const unsigned long FontNameAttr = 9;
  const unsigned long FontSizeAttr = 10;
  const unsigned long FontWeightAttr = 11;
  const unsigned long ForegroundColorAttr = 12;
  const unsigned long HorizontalTextAlignmentAttr = 13;
  const unsigned long IndentationFirstLineAttr = 14;
  const unsigned long IndentationLeadingAttr = 15;
  const unsigned long IndentationTrailingAttr = 16;
  const unsigned long IsActiveAttr = 17;
  const unsigned long IsHiddenAttr = 18;
  const unsigned long IsItalicAttr = 19;
  const unsigned long IsReadOnlyAttr = 20;
  const unsigned long IsSubscriptAttr = 21;
  const unsigned long IsSuperscriptAttr = 22;
  const unsigned long LinkAttr = 23;
  const unsigned long MarginBottomAttr = 24;
  const unsigned long MarginLeadingAttr = 25;
  const unsigned long MarginTopAttr = 26;
  const unsigned long MarginTrailingAttr = 27;
  const unsigned long OutlineStylesAttr = 28;
  const unsigned long OverlineColorAttr = 29;
  const unsigned long OverlineStyleAttr = 30;
  const unsigned long SelectionActiveEndAttr = 31;
  const unsigned long StrikethroughColorAttr = 32;
  const unsigned long StrikethroughStyleAttr = 33;
  const unsigned long StyleIdAttr = 34;
  const unsigned long StyleNameAttr = 35;
  const unsigned long TabsAttr = 36;
  const unsigned long TextFlowDirectionsAttr = 37;
  const unsigned long UnderlineColorAttr = 38;
  const unsigned long UnderlineStyleAttr = 39;

  /**
   * Return range enslosing the text having requested attribute.
   */
  nsIAccessibleTextRange findAttr(in unsigned long aAttr, in nsIVariant aValue,
                                  in boolean aIsBackward);

  /**
   * Add/remove the text range from selection.
   */
  void addToSelection();
  void removeFromSelection();
  void select();

  const unsigned long AlignToTop = 0;
  const unsigned long AlignToBottom = 1;

  /**
   * Scroll the range into view.
   */
  void scrollIntoView(in unsigned long aHow);
};