summaryrefslogtreecommitdiffstats
path: root/accessible/interfaces/nsIAccessibleTextRange.idl
blob: 2972eb52682ec04108f0054f3db02d54d6c0d90b (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
/* -*- 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;

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

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

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