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/. */
7 #include
"nsISelectionDisplay.idl"
10 typedef short SelectionType
;
11 typedef short SelectionRegion
;
16 interface nsISelection
;
17 interface nsISelectionDisplay
;
19 [scriptable
, uuid(7835DE46
-DB36
-4BB7
-8684-1049A0C13049
)]
20 interface nsISelectionController
: nsISelectionDisplay
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;
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;
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;
46 * SetDisplaySelection will set the display mode for the selection. OFF,ON,DISABLED
48 void setDisplaySelection
(in short toggle
);
51 * GetDisplaySelection will get the display mode for the selection. OFF,ON,DISABLED
53 short getDisplaySelection
();
56 * GetSelection will return the selection that the presentation
57 * shell may implement.
59 * @param aType will hold the type of selection //SelectionType
60 * @param _return will hold the return value
62 nsISelection getSelection
(in short type
);
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;
70 * ScrollSelectionIntoView scrolls a region of the selection,
71 * so that it is visible in the scrolled view.
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
81 * SCROLL_OVERFLOW_HIDDEN: if set, scrolls even if the overflow is specified
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.
87 void scrollSelectionIntoView
(in short type
, in short region
, in short flags
);
90 * RepaintSelection repaints the selection specified by aType.
92 * @param aType specifies the selection to repaint.
94 void repaintSelection
(in short type
);
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
104 void setCaretEnabled
(in boolean enabled
);
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
112 void setCaretReadOnly
(in boolean readOnly);
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
120 boolean getCaretEnabled
();
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"
127 readonly attribute
boolean caretVisible
;
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
135 void setCaretVisibilityDuringSelection
(in boolean visibility
);
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?
144 void characterMove
(in boolean forward
, in boolean extend
);
146 /** PhysicalMove will move the selection one "unit" in a given direction
147 * within the document.
148 * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
149 * the "point" of selection that is extended is considered the "focus" point.
150 * or the last point adjusted by the selection.
152 * @param aAmount character/line; word/lineBoundary
153 * @param aExtend should it collapse the selection of extend it?
155 void physicalMove
(in short direction
, in short amount
, in boolean extend
);
158 * nsFrameSelection::PhysicalMove depends on the ordering of these values;
159 * do not change without checking there!
161 const short MOVE_LEFT
= 0;
162 const short MOVE_RIGHT
= 1;
163 const short MOVE_UP
= 2;
164 const short MOVE_DOWN
= 3;
167 * CharacterExtendForDelete will extend the selection one character cell
168 * forward in the document.
169 * this method is used internally for handling del key.
171 [noscript
] void characterExtendForDelete
();
174 * CharacterExtendForBackspace will extend the selection one character cell
175 * backward in the document.
176 * this method is used internally for handling backspace key only when we're
177 * after UTF-16 surrogates.
179 [noscript
] void characterExtendForBackspace
();
181 /** WordMove will move the selection one word forward/backward in the document.
182 * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
183 * the "point" of selection that is extended is considered the "focus" point.
184 * or the last point adjusted by the selection.
185 * @param aForward forward or backward if PR_FALSE
186 * @param aExtend should it collapse the selection of extend it?
189 void wordMove
(in boolean forward
, in boolean extend
);
191 /** wordExtendForDelete will extend the selection one word forward/backward in the document.
192 * this method is used internally for handling ctrl[option]-backspace and ctrl[option]-del.
193 * @param aForward forward or backward if PR_FALSE
195 [noscript
] void wordExtendForDelete
(in boolean forward
);
197 /** LineMove will move the selection one line forward/backward in the document.
198 * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
199 * the "point" of selection that is extended is considered the "focus" point.
200 * or the last point adjusted by the selection.
201 * @param aForward forward or backward if PR_FALSE
202 * @param aExtend should it collapse the selection of extend it?
204 void lineMove
(in boolean forward
, in boolean extend
);
206 /** IntraLineMove will move the selection to the front of the line or end of the line
208 * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
209 * the "point" of selection that is extended is considered the "focus" point.
210 * or the last point adjusted by the selection.
211 * @param aForward forward or backward if PR_FALSE
212 * @param aExtend should it collapse the selection of extend it?
214 void intraLineMove
(in boolean forward
, in boolean extend
);
216 /** PageMove will move the selection one page forward/backward in the document.
217 * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
218 * the "point" of selection that is extended is considered the "focus" point.
219 * or the last point adjusted by the selection.
220 * @param aForward forward or backward if PR_FALSE
221 * @param aExtend should it collapse the selection of extend it?
223 void pageMove
(in boolean forward
, in boolean extend
);
225 /** CompleteScroll will move page view to the top or bottom of the document
226 * @param aForward forward or backward if PR_FALSE
228 void completeScroll
(in boolean forward
);
230 /** CompleteMove will move page view to the top or bottom of the document
231 * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
232 * the "point" of selection that is extended is considered the "focus" point.
233 * or the last point adjusted by the selection.
234 * @param aForward forward or backward if PR_FALSE
235 * @param aExtend should it collapse the selection of extend it?
237 void completeMove
(in boolean forward
, in boolean extend
);
240 /** ScrollPage will scroll the page without affecting the selection.
241 * @param aForward scroll forward or backwards in selection
243 void scrollPage
(in boolean forward
);
245 /** ScrollLine will scroll line up or down dependent on the boolean
246 * @param aForward scroll forward or backwards in selection
248 void scrollLine
(in boolean forward
);
250 /** ScrollCharacter will scroll right or left dependent on the boolean
251 * @param aRight if true will scroll right. if not will scroll left.
253 void scrollCharacter
(in boolean right
);
255 /** SelectAll will select the whole page
259 /** CheckVisibility will return true if textnode and offsets are actually rendered
260 * in the current precontext.
261 * @param aNode textNode to test
262 * @param aStartOffset offset in dom to first char of textnode to test
263 * @param aEndOffset offset in dom to last char of textnode to test
264 * @param aReturnBool boolean returned TRUE if visible FALSE if not
266 boolean checkVisibility
(in nsIDOMNode node
, in short startOffset
, in short endOffset
);
267 [noscript
,nostdcall
] boolean checkVisibilityContent
(in nsIContent node
, in short startOffset
, in short endOffset
);
271 #define NS_ISELECTIONCONTROLLER_CID \
272 { 0x513b9460, 0xd56a, 0x4c4e, \
273 { 0xb6, 0xf9, 0x0b, 0x8a, 0xe4, 0x37, 0x2a, 0x3b }}