1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
16 * The Original Code is mozilla.org code.
18 * The Initial Developer of the Original Code is
19 * Netscape Communications Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 1998
21 * the Initial Developer. All Rights Reserved.
26 * Alternatively, the contents of this file may be used under the terms of
27 * either of the GNU General Public License Version 2 or later (the "GPL"),
28 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
38 * ***** END LICENSE BLOCK ***** */
41 #include
"nsISupports.idl"
42 #include
"nsISelection.idl"
43 #include
"nsISelectionDisplay.idl"
46 typedef short SelectionType
;
47 typedef short SelectionRegion
;
51 interface nsISelection
;
52 interface nsISelectionDisplay
;
54 [scriptable
, uuid(b5c3ffc4
-f48a
-4f25
-86e1
-4cf79db1bcbb
)]
55 interface nsISelectionController
: nsISelectionDisplay
57 const short SELECTION_NONE
=0;
58 const short SELECTION_NORMAL
=1;
59 const short SELECTION_SPELLCHECK
=2;
60 const short SELECTION_IME_RAWINPUT
=4;
61 const short SELECTION_IME_SELECTEDRAWTEXT
=8;
62 const short SELECTION_IME_CONVERTEDTEXT
=16;
63 const short SELECTION_IME_SELECTEDCONVERTEDTEXT
=32;
64 const short SELECTION_ACCESSIBILITY
=64; // For accessibility API usage
65 const short SELECTION_FIND
=128;
66 const short NUM_SELECTIONTYPES
=9;
68 const short SELECTION_ANCHOR_REGION
= 0;
69 const short SELECTION_FOCUS_REGION
= 1;
70 const short NUM_SELECTION_REGIONS
= 2;
72 const short SELECTION_OFF
= 0;
73 const short SELECTION_HIDDEN
=1;//>HIDDEN displays selection
74 const short SELECTION_ON
= 2;
75 const short SELECTION_DISABLED
= 3;
76 const short SELECTION_ATTENTION
= 4;
79 * SetDisplaySelection will set the display mode for the selection. OFF,ON,DISABLED
81 void setDisplaySelection
(in short toggle
);
84 * GetDisplaySelection will get the display mode for the selection. OFF,ON,DISABLED
86 short getDisplaySelection
();
89 * GetSelection will return the selection that the presentation
90 * shell may implement.
92 * @param aType will hold the type of selection //SelectionType
93 * @param _return will hold the return value
95 nsISelection getSelection
(in short type
);
98 * ScrollSelectionIntoView scrolls a region of the selection,
99 * so that it is visible in the scrolled view.
101 * @param aType the selection to scroll into view. //SelectionType
102 * @param aRegion the region inside the selection to scroll into view. //SelectionRegion
103 * @param aIsSynchronous when true, scrolls the selection into view
104 * before returning. If false, posts a request which is processed
105 * at some point after the method returns.
107 * Note that if isSynchronous is true, then this might flush the pending
108 * reflow. It's dangerous for some objects. See bug 418470 comment 12.
110 void scrollSelectionIntoView
(in short type
, in short region
, in boolean isSynchronous
);
112 * RepaintSelection repaints the selection specified by aType.
114 * @param aType specifies the selection to repaint.
116 void repaintSelection
(in short type
);
119 * Set the caret as enabled or disabled. An enabled caret will
120 * draw or blink when made visible. A disabled caret will never show up.
121 * Can be called any time.
122 * @param aEnable PR_TRUE to enable caret. PR_FALSE to disable.
123 * @return always NS_OK
126 void setCaretEnabled
(in boolean enabled
);
129 * Set the caret readonly or not. An readonly caret will
130 * draw but not blink when made visible.
131 * @param aReadOnly PR_TRUE to enable caret. PR_FALSE to disable.
132 * @return always NS_OK
134 void setCaretReadOnly
(in boolean readOnly);
137 * Gets the current state of the caret.
138 * @param aEnabled [OUT] set to the current caret state, as set by SetCaretEnabled
139 * @return if aOutEnabled==null, returns NS_ERROR_INVALID_ARG
142 boolean getCaretEnabled
();
145 * This is true if the caret is enabled, visible, and currently blinking.
146 * This is still true when the caret is enabled, visible, but in its "off"
149 readonly attribute
boolean caretVisible
;
152 * Show the caret even in selections. By default the caret is hidden unless the
153 * selection is collapsed. Use this function to show the caret even in selections.
154 * @param aVisibility PR_TRUE to show the caret in selections. PR_FALSE to hide.
155 * @return always NS_OK
157 void setCaretVisibilityDuringSelection
(in boolean visibility
);
159 /** CharacterMove will move the selection one character forward/backward in the document.
160 * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
161 * the "point" of selection that is extended is considered the "focus" point.
162 * or the last point adjusted by the selection.
163 * @param aForward forward or backward if PR_FALSE
164 * @param aExtend should it collapse the selection of extend it?
166 void characterMove
(in boolean forward
, in boolean extend
);
169 * CharacterExtendForDelete will extend the selection one character cell
170 * forward in the document.
171 * this method is used internally for handling del key.
173 [noscript
] void characterExtendForDelete
();
175 /** WordMove will move the selection one word forward/backward in the document.
176 * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
177 * the "point" of selection that is extended is considered the "focus" point.
178 * or the last point adjusted by the selection.
179 * @param aForward forward or backward if PR_FALSE
180 * @param aExtend should it collapse the selection of extend it?
183 void wordMove
(in boolean forward
, in boolean extend
);
185 /** wordExtendForDelete will extend the selection one word forward/backward in the document.
186 * this method is used internally for handling ctrl[option]-backspace and ctrl[option]-del.
187 * @param aForward forward or backward if PR_FALSE
189 [noscript
] void wordExtendForDelete
(in boolean forward
);
191 /** LineMove will move the selection one line forward/backward in the document.
192 * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
193 * the "point" of selection that is extended is considered the "focus" point.
194 * or the last point adjusted by the selection.
195 * @param aForward forward or backward if PR_FALSE
196 * @param aExtend should it collapse the selection of extend it?
198 void lineMove
(in boolean forward
, in boolean extend
);
200 /** IntraLineMove will move the selection to the front of the line or end of the line
202 * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
203 * the "point" of selection that is extended is considered the "focus" point.
204 * or the last point adjusted by the selection.
205 * @param aForward forward or backward if PR_FALSE
206 * @param aExtend should it collapse the selection of extend it?
208 void intraLineMove
(in boolean forward
, in boolean extend
);
210 /** PageMove will move the selection one page forward/backward in 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?
217 void pageMove
(in boolean forward
, in boolean extend
);
219 /** CompleteScroll will move page view to the top or bottom of the document
220 * @param aForward forward or backward if PR_FALSE
222 void completeScroll
(in boolean forward
);
224 /** CompleteMove will move page view to the top or bottom of the document
225 * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE
226 * the "point" of selection that is extended is considered the "focus" point.
227 * or the last point adjusted by the selection.
228 * @param aForward forward or backward if PR_FALSE
229 * @param aExtend should it collapse the selection of extend it?
231 void completeMove
(in boolean forward
, in boolean extend
);
234 /** ScrollPage will scroll the page without affecting the selection.
235 * @param aForward scroll forward or backwards in selection
237 void scrollPage
(in boolean forward
);
239 /** ScrolLine will scroll line up or down dependent on the boolean
240 * @param aForward scroll forward or backwards in selection
242 void scrollLine
(in boolean forward
);
244 /** ScrolHorizontal will scroll left or right dependent on the boolean
245 * @param aLeft if true will scroll left. if not will scroll right.
247 void scrollHorizontal
(in boolean left
);
248 /** SelectAll will select the whole page
252 /** CheckVisibility will return true if textnode and offsets are actually rendered
253 * in the current precontext.
254 * @param aNode textNode to test
255 * @param aStartOffset offset in dom to first char of textnode to test
256 * @param aEndOffset offset in dom to last char of textnode to test
257 * @param aReturnBool boolean returned TRUE if visible FALSE if not
259 boolean checkVisibility
(in nsIDOMNode node
, in short startOffset
, in short endOffset
);
263 #define NS_ISELECTIONCONTROLLER_CID \
264 { 0x513b9460, 0xd56a, 0x4c4e, \
265 { 0xb6, 0xf9, 0x0b, 0x8a, 0xe4, 0x37, 0x2a, 0x3b }}