content/base/public/nsISelectionController.idl

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:e9138876d83c
1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
6
7 #include "nsISelectionDisplay.idl"
8
9 %{C++
10 typedef short SelectionType;
11 typedef short SelectionRegion;
12 %}
13
14 interface nsIContent;
15 interface nsIDOMNode;
16 interface nsISelection;
17 interface nsISelectionDisplay;
18
19 [scriptable, uuid(b1ff7faa-8097-431d-b7f1-b0615e3cd596)]
20 interface nsISelectionController : nsISelectionDisplay
21 {
22 const short SELECTION_NONE=0;
23 const short SELECTION_NORMAL=1;
24 const short SELECTION_SPELLCHECK=2;
25 const short SELECTION_IME_RAWINPUT=4;
26 const short SELECTION_IME_SELECTEDRAWTEXT=8;
27 const short SELECTION_IME_CONVERTEDTEXT=16;
28 const short SELECTION_IME_SELECTEDCONVERTEDTEXT=32;
29 const short SELECTION_ACCESSIBILITY=64; // For accessibility API usage
30 const short SELECTION_FIND=128;
31 const short SELECTION_URLSECONDARY=256;
32 const short NUM_SELECTIONTYPES=10;
33
34 const short SELECTION_ANCHOR_REGION = 0;
35 const short SELECTION_FOCUS_REGION = 1;
36 const short SELECTION_WHOLE_SELECTION = 2;
37 const short NUM_SELECTION_REGIONS = 3;
38
39 const short SELECTION_OFF = 0;
40 const short SELECTION_HIDDEN =1;//>HIDDEN displays selection
41 const short SELECTION_ON = 2;
42 const short SELECTION_DISABLED = 3;
43 const short SELECTION_ATTENTION = 4;
44
45 /**
46 * SetDisplaySelection will set the display mode for the selection. OFF,ON,DISABLED
47 */
48 void setDisplaySelection(in short toggle);
49
50 /**
51 * GetDisplaySelection will get the display mode for the selection. OFF,ON,DISABLED
52 */
53 short getDisplaySelection();
54
55 /**
56 * GetSelection will return the selection that the presentation
57 * shell may implement.
58 *
59 * @param aType will hold the type of selection //SelectionType
60 * @param _return will hold the return value
61 */
62 nsISelection getSelection(in short type);
63
64 const short SCROLL_SYNCHRONOUS = 1<<1;
65 const short SCROLL_FIRST_ANCESTOR_ONLY = 1<<2;
66 const short SCROLL_CENTER_VERTICALLY = 1<<4;
67 const short SCROLL_OVERFLOW_HIDDEN = 1<<5;
68
69 /**
70 * ScrollSelectionIntoView scrolls a region of the selection,
71 * so that it is visible in the scrolled view.
72 *
73 * @param aType the selection to scroll into view. //SelectionType
74 * @param aRegion the region inside the selection to scroll into view. //SelectionRegion
75 * @param aFlags the scroll flags. Valid bits include:
76 * SCROLL_SYNCHRONOUS: when set, scrolls the selection into view
77 * before returning. If not set, posts a request which is processed
78 * at some point after the method returns.
79 * SCROLL_FIRST_ANCESTOR_ONLY: if set, only the first ancestor will be scrolled
80 * into view.
81 * SCROLL_OVERFLOW_HIDDEN: if set, scrolls even if the overflow is specified
82 * as hidden.
83 *
84 * Note that if isSynchronous is true, then this might flush the pending
85 * reflow. It's dangerous for some objects. See bug 418470 comment 12.
86 */
87 void scrollSelectionIntoView(in short type, in short region, in short flags);
88
89 /**
90 * RepaintSelection repaints the selection specified by aType.
91 *
92 * @param aType specifies the selection to repaint.
93 */
94 void repaintSelection(in short type);
95
96 /**
97 * Set the caret as enabled or disabled. An enabled caret will
98 * draw or blink when made visible. A disabled caret will never show up.
99 * Can be called any time.
100 * @param aEnable PR_TRUE to enable caret. PR_FALSE to disable.
101 * @return always NS_OK
102 */
103
104 void setCaretEnabled(in boolean enabled);
105
106 /**
107 * Set the caret readonly or not. An readonly caret will
108 * draw but not blink when made visible.
109 * @param aReadOnly PR_TRUE to enable caret. PR_FALSE to disable.
110 * @return always NS_OK
111 */
112 void setCaretReadOnly(in boolean readOnly);
113
114 /**
115 * Gets the current state of the caret.
116 * @param aEnabled [OUT] set to the current caret state, as set by SetCaretEnabled
117 * @return if aOutEnabled==null, returns NS_ERROR_INVALID_ARG
118 * else NS_OK
119 */
120 boolean getCaretEnabled();
121
122 /**
123 * This is true if the caret is enabled, visible, and currently blinking.
124 * This is still true when the caret is enabled, visible, but in its "off"
125 * blink cycle.
126 */
127 readonly attribute boolean caretVisible;
128
129 /**
130 * Show the caret even in selections. By default the caret is hidden unless the
131 * selection is collapsed. Use this function to show the caret even in selections.
132 * @param aVisibility PR_TRUE to show the caret in selections. PR_FALSE to hide.
133 * @return always NS_OK
134 */
135 void setCaretVisibilityDuringSelection(in boolean visibility);
136
137 /** CharacterMove will move the selection one character forward/backward in the document.
138 * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
139 * the "point" of selection that is extended is considered the "focus" point.
140 * or the last point adjusted by the selection.
141 * @param aForward forward or backward if PR_FALSE
142 * @param aExtend should it collapse the selection of extend it?
143 */
144 void characterMove(in boolean forward, in boolean extend);
145
146 /**
147 * CharacterExtendForDelete will extend the selection one character cell
148 * forward in the document.
149 * this method is used internally for handling del key.
150 */
151 [noscript] void characterExtendForDelete();
152
153 /**
154 * CharacterExtendForBackspace will extend the selection one character cell
155 * backward in the document.
156 * this method is used internally for handling backspace key only when we're
157 * after UTF-16 surrogates.
158 */
159 [noscript] void characterExtendForBackspace();
160
161 /** WordMove will move the selection one word forward/backward in the document.
162 * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
163 * the "point" of selection that is extended is considered the "focus" point.
164 * or the last point adjusted by the selection.
165 * @param aForward forward or backward if PR_FALSE
166 * @param aExtend should it collapse the selection of extend it?
167 */
168
169 void wordMove(in boolean forward, in boolean extend);
170
171 /** wordExtendForDelete will extend the selection one word forward/backward in the document.
172 * this method is used internally for handling ctrl[option]-backspace and ctrl[option]-del.
173 * @param aForward forward or backward if PR_FALSE
174 */
175 [noscript] void wordExtendForDelete(in boolean forward);
176
177 /** LineMove will move the selection one line forward/backward in the document.
178 * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
179 * the "point" of selection that is extended is considered the "focus" point.
180 * or the last point adjusted by the selection.
181 * @param aForward forward or backward if PR_FALSE
182 * @param aExtend should it collapse the selection of extend it?
183 */
184 void lineMove(in boolean forward, in boolean extend);
185
186 /** IntraLineMove will move the selection to the front of the line or end of the line
187 * in the document.
188 * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
189 * the "point" of selection that is extended is considered the "focus" point.
190 * or the last point adjusted by the selection.
191 * @param aForward forward or backward if PR_FALSE
192 * @param aExtend should it collapse the selection of extend it?
193 */
194 void intraLineMove(in boolean forward, in boolean extend);
195
196 /** PageMove will move the selection one page forward/backward in the document.
197 * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
198 * the "point" of selection that is extended is considered the "focus" point.
199 * or the last point adjusted by the selection.
200 * @param aForward forward or backward if PR_FALSE
201 * @param aExtend should it collapse the selection of extend it?
202 */
203 void pageMove(in boolean forward, in boolean extend);
204
205 /** CompleteScroll will move page view to the top or bottom of the document
206 * @param aForward forward or backward if PR_FALSE
207 */
208 void completeScroll(in boolean forward);
209
210 /** CompleteMove will move page view to the top or bottom of the document
211 * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
212 * the "point" of selection that is extended is considered the "focus" point.
213 * or the last point adjusted by the selection.
214 * @param aForward forward or backward if PR_FALSE
215 * @param aExtend should it collapse the selection of extend it?
216 */
217 void completeMove(in boolean forward, in boolean extend);
218
219
220 /** ScrollPage will scroll the page without affecting the selection.
221 * @param aForward scroll forward or backwards in selection
222 */
223 void scrollPage(in boolean forward);
224
225 /** ScrollLine will scroll line up or down dependent on the boolean
226 * @param aForward scroll forward or backwards in selection
227 */
228 void scrollLine(in boolean forward);
229
230 /** ScrollCharacter will scroll right or left dependent on the boolean
231 * @param aRight if true will scroll right. if not will scroll left.
232 */
233 void scrollCharacter(in boolean right);
234
235 /** SelectAll will select the whole page
236 */
237 void selectAll();
238
239 /** CheckVisibility will return true if textnode and offsets are actually rendered
240 * in the current precontext.
241 * @param aNode textNode to test
242 * @param aStartOffset offset in dom to first char of textnode to test
243 * @param aEndOffset offset in dom to last char of textnode to test
244 * @param aReturnBool boolean returned TRUE if visible FALSE if not
245 */
246 boolean checkVisibility(in nsIDOMNode node, in short startOffset, in short endOffset);
247 [noscript,nostdcall] boolean checkVisibilityContent(in nsIContent node, in short startOffset, in short endOffset);
248
249 };
250 %{ C++
251 #define NS_ISELECTIONCONTROLLER_CID \
252 { 0x513b9460, 0xd56a, 0x4c4e, \
253 { 0xb6, 0xf9, 0x0b, 0x8a, 0xe4, 0x37, 0x2a, 0x3b }}
254 %}

mercurial