1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is Selection code.
16 *
17 * The Initial Developer of the Original Code is
18 * Google Inc.
19 * Portions created by the Initial Developer are Copyright (C) 2006
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 * Brett Wilson <brettw@gmail.com>
24 *
25 * Alternatively, the contents of this file may be used under the terms of
26 * either of the GNU General Public License Version 2 or later (the "GPL"),
27 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
36 *
37 * ***** END LICENSE BLOCK ***** */
38
39 #include "nsISelection.idl"
40
41 interface nsIDOMNode;
42 interface nsIDOMRange;
43
44 %{C++
45 #include "nsCOMArray.h"
46 %}
47
48 [ptr] native RangeArray(nsCOMArray<nsIDOMRange>);
49
50 [scriptable, uuid(b515878d-3b06-433b-bc9e-5c53d2fa3eff)]
51 interface nsISelection2 : nsISelection
52 {
53 void GetRangesForInterval(
54 in nsIDOMNode beginNode, in PRInt32 beginOffset,
55 in nsIDOMNode endNode, in PRInt32 endOffset,
56 in PRBool allowAdjacent,
57 out PRUint32 resultCount,
58 [retval, array, size_is(resultCount)] out nsIDOMRange results);
59
60 [noscript] void GetRangesForIntervalCOMArray(
61 in nsIDOMNode beginNode, in PRInt32 beginOffset,
62 in nsIDOMNode endNode, in PRInt32 endOffset,
63 in PRBool allowAdjacent,
64 in RangeArray results);
65
66 /**
67 * Scrolls a region of the selection, so that it is visible in
68 * the scrolled view.
69 *
70 * @param aRegion - the region inside the selection to scroll into view
71 * (see selection region constants defined in
72 * nsISelectionController).
73 * @param aIsSynchronous - when true, scrolls the selection into view
74 * before returning. If false, posts a request which
75 * is processed at some point after the method returns.
76 * @param aVPercent - how to align the frame vertically. A value of 0
77 * means the frame's upper edge is aligned with the top edge
78 * of the visible area. A value of 100 means the frame's
79 * bottom edge is aligned with the bottom edge of
80 * the visible area. For values in between, the point
81 * "aVPercent" down the frame is placed at the point
82 * "aVPercent" down the visible area. A value of 50 centers
83 * the frame vertically. A value of -1 means move
84 * the frame the minimum amount necessary in order for
85 * the entire frame to be visible vertically (if possible).
86 * @param aHPercent - how to align the frame horizontally. A value of 0
87 * means the frame's left edge is aligned with the left
88 * edge of the visible area. A value of 100 means the
89 * frame's right edge is aligned with the right edge of
90 * the visible area. For values in between, the point
91 * "aHPercent" across the frame is placed at the point
92 * "aHPercent" across the visible area. A value of 50
93 * centers the frame horizontally . A value of -1 means
94 * move the frame the minimum amount necessary in order
95 * for the entire frame to be visible horizontally
96 * (if possible).
97 */
98 void scrollIntoView(in short aRegion, in boolean aIsSynchronous,
99 in short aVPercent, in short aHPercent);
100 };