1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/public/nsISelectionController.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,254 @@ 1.4 +/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 + 1.10 +#include "nsISelectionDisplay.idl" 1.11 + 1.12 +%{C++ 1.13 +typedef short SelectionType; 1.14 +typedef short SelectionRegion; 1.15 +%} 1.16 + 1.17 +interface nsIContent; 1.18 +interface nsIDOMNode; 1.19 +interface nsISelection; 1.20 +interface nsISelectionDisplay; 1.21 + 1.22 +[scriptable, uuid(b1ff7faa-8097-431d-b7f1-b0615e3cd596)] 1.23 +interface nsISelectionController : nsISelectionDisplay 1.24 +{ 1.25 + const short SELECTION_NONE=0; 1.26 + const short SELECTION_NORMAL=1; 1.27 + const short SELECTION_SPELLCHECK=2; 1.28 + const short SELECTION_IME_RAWINPUT=4; 1.29 + const short SELECTION_IME_SELECTEDRAWTEXT=8; 1.30 + const short SELECTION_IME_CONVERTEDTEXT=16; 1.31 + const short SELECTION_IME_SELECTEDCONVERTEDTEXT=32; 1.32 + const short SELECTION_ACCESSIBILITY=64; // For accessibility API usage 1.33 + const short SELECTION_FIND=128; 1.34 + const short SELECTION_URLSECONDARY=256; 1.35 + const short NUM_SELECTIONTYPES=10; 1.36 + 1.37 + const short SELECTION_ANCHOR_REGION = 0; 1.38 + const short SELECTION_FOCUS_REGION = 1; 1.39 + const short SELECTION_WHOLE_SELECTION = 2; 1.40 + const short NUM_SELECTION_REGIONS = 3; 1.41 + 1.42 + const short SELECTION_OFF = 0; 1.43 + const short SELECTION_HIDDEN =1;//>HIDDEN displays selection 1.44 + const short SELECTION_ON = 2; 1.45 + const short SELECTION_DISABLED = 3; 1.46 + const short SELECTION_ATTENTION = 4; 1.47 + 1.48 + /** 1.49 + * SetDisplaySelection will set the display mode for the selection. OFF,ON,DISABLED 1.50 + */ 1.51 + void setDisplaySelection(in short toggle); 1.52 + 1.53 + /** 1.54 + * GetDisplaySelection will get the display mode for the selection. OFF,ON,DISABLED 1.55 + */ 1.56 + short getDisplaySelection(); 1.57 + 1.58 + /** 1.59 + * GetSelection will return the selection that the presentation 1.60 + * shell may implement. 1.61 + * 1.62 + * @param aType will hold the type of selection //SelectionType 1.63 + * @param _return will hold the return value 1.64 + */ 1.65 + nsISelection getSelection(in short type); 1.66 + 1.67 + const short SCROLL_SYNCHRONOUS = 1<<1; 1.68 + const short SCROLL_FIRST_ANCESTOR_ONLY = 1<<2; 1.69 + const short SCROLL_CENTER_VERTICALLY = 1<<4; 1.70 + const short SCROLL_OVERFLOW_HIDDEN = 1<<5; 1.71 + 1.72 + /** 1.73 + * ScrollSelectionIntoView scrolls a region of the selection, 1.74 + * so that it is visible in the scrolled view. 1.75 + * 1.76 + * @param aType the selection to scroll into view. //SelectionType 1.77 + * @param aRegion the region inside the selection to scroll into view. //SelectionRegion 1.78 + * @param aFlags the scroll flags. Valid bits include: 1.79 + * SCROLL_SYNCHRONOUS: when set, scrolls the selection into view 1.80 + * before returning. If not set, posts a request which is processed 1.81 + * at some point after the method returns. 1.82 + * SCROLL_FIRST_ANCESTOR_ONLY: if set, only the first ancestor will be scrolled 1.83 + * into view. 1.84 + * SCROLL_OVERFLOW_HIDDEN: if set, scrolls even if the overflow is specified 1.85 + * as hidden. 1.86 + * 1.87 + * Note that if isSynchronous is true, then this might flush the pending 1.88 + * reflow. It's dangerous for some objects. See bug 418470 comment 12. 1.89 + */ 1.90 + void scrollSelectionIntoView(in short type, in short region, in short flags); 1.91 + 1.92 + /** 1.93 + * RepaintSelection repaints the selection specified by aType. 1.94 + * 1.95 + * @param aType specifies the selection to repaint. 1.96 + */ 1.97 + void repaintSelection(in short type); 1.98 + 1.99 + /** 1.100 + * Set the caret as enabled or disabled. An enabled caret will 1.101 + * draw or blink when made visible. A disabled caret will never show up. 1.102 + * Can be called any time. 1.103 + * @param aEnable PR_TRUE to enable caret. PR_FALSE to disable. 1.104 + * @return always NS_OK 1.105 + */ 1.106 + 1.107 + void setCaretEnabled(in boolean enabled); 1.108 + 1.109 + /** 1.110 + * Set the caret readonly or not. An readonly caret will 1.111 + * draw but not blink when made visible. 1.112 + * @param aReadOnly PR_TRUE to enable caret. PR_FALSE to disable. 1.113 + * @return always NS_OK 1.114 + */ 1.115 + void setCaretReadOnly(in boolean readOnly); 1.116 + 1.117 + /** 1.118 + * Gets the current state of the caret. 1.119 + * @param aEnabled [OUT] set to the current caret state, as set by SetCaretEnabled 1.120 + * @return if aOutEnabled==null, returns NS_ERROR_INVALID_ARG 1.121 + * else NS_OK 1.122 + */ 1.123 + boolean getCaretEnabled(); 1.124 + 1.125 + /** 1.126 + * This is true if the caret is enabled, visible, and currently blinking. 1.127 + * This is still true when the caret is enabled, visible, but in its "off" 1.128 + * blink cycle. 1.129 + */ 1.130 + readonly attribute boolean caretVisible; 1.131 + 1.132 + /** 1.133 + * Show the caret even in selections. By default the caret is hidden unless the 1.134 + * selection is collapsed. Use this function to show the caret even in selections. 1.135 + * @param aVisibility PR_TRUE to show the caret in selections. PR_FALSE to hide. 1.136 + * @return always NS_OK 1.137 + */ 1.138 + void setCaretVisibilityDuringSelection(in boolean visibility); 1.139 + 1.140 + /** CharacterMove will move the selection one character forward/backward in the document. 1.141 + * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE 1.142 + * the "point" of selection that is extended is considered the "focus" point. 1.143 + * or the last point adjusted by the selection. 1.144 + * @param aForward forward or backward if PR_FALSE 1.145 + * @param aExtend should it collapse the selection of extend it? 1.146 + */ 1.147 + void characterMove(in boolean forward, in boolean extend); 1.148 + 1.149 + /** 1.150 + * CharacterExtendForDelete will extend the selection one character cell 1.151 + * forward in the document. 1.152 + * this method is used internally for handling del key. 1.153 + */ 1.154 + [noscript] void characterExtendForDelete(); 1.155 + 1.156 + /** 1.157 + * CharacterExtendForBackspace will extend the selection one character cell 1.158 + * backward in the document. 1.159 + * this method is used internally for handling backspace key only when we're 1.160 + * after UTF-16 surrogates. 1.161 + */ 1.162 + [noscript] void characterExtendForBackspace(); 1.163 + 1.164 + /** WordMove will move the selection one word forward/backward in the document. 1.165 + * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE 1.166 + * the "point" of selection that is extended is considered the "focus" point. 1.167 + * or the last point adjusted by the selection. 1.168 + * @param aForward forward or backward if PR_FALSE 1.169 + * @param aExtend should it collapse the selection of extend it? 1.170 + */ 1.171 + 1.172 + void wordMove(in boolean forward, in boolean extend); 1.173 + 1.174 + /** wordExtendForDelete will extend the selection one word forward/backward in the document. 1.175 + * this method is used internally for handling ctrl[option]-backspace and ctrl[option]-del. 1.176 + * @param aForward forward or backward if PR_FALSE 1.177 + */ 1.178 + [noscript] void wordExtendForDelete(in boolean forward); 1.179 + 1.180 + /** LineMove will move the selection one line forward/backward in the document. 1.181 + * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE 1.182 + * the "point" of selection that is extended is considered the "focus" point. 1.183 + * or the last point adjusted by the selection. 1.184 + * @param aForward forward or backward if PR_FALSE 1.185 + * @param aExtend should it collapse the selection of extend it? 1.186 + */ 1.187 + void lineMove(in boolean forward, in boolean extend); 1.188 + 1.189 + /** IntraLineMove will move the selection to the front of the line or end of the line 1.190 + * in the document. 1.191 + * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE 1.192 + * the "point" of selection that is extended is considered the "focus" point. 1.193 + * or the last point adjusted by the selection. 1.194 + * @param aForward forward or backward if PR_FALSE 1.195 + * @param aExtend should it collapse the selection of extend it? 1.196 + */ 1.197 + void intraLineMove(in boolean forward, in boolean extend); 1.198 + 1.199 + /** PageMove will move the selection one page forward/backward in the document. 1.200 + * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE 1.201 + * the "point" of selection that is extended is considered the "focus" point. 1.202 + * or the last point adjusted by the selection. 1.203 + * @param aForward forward or backward if PR_FALSE 1.204 + * @param aExtend should it collapse the selection of extend it? 1.205 + */ 1.206 + void pageMove(in boolean forward, in boolean extend); 1.207 + 1.208 + /** CompleteScroll will move page view to the top or bottom of the document 1.209 + * @param aForward forward or backward if PR_FALSE 1.210 + */ 1.211 + void completeScroll(in boolean forward); 1.212 + 1.213 + /** CompleteMove will move page view to the top or bottom of the document 1.214 + * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE 1.215 + * the "point" of selection that is extended is considered the "focus" point. 1.216 + * or the last point adjusted by the selection. 1.217 + * @param aForward forward or backward if PR_FALSE 1.218 + * @param aExtend should it collapse the selection of extend it? 1.219 + */ 1.220 + void completeMove(in boolean forward, in boolean extend); 1.221 + 1.222 + 1.223 + /** ScrollPage will scroll the page without affecting the selection. 1.224 + * @param aForward scroll forward or backwards in selection 1.225 + */ 1.226 + void scrollPage(in boolean forward); 1.227 + 1.228 + /** ScrollLine will scroll line up or down dependent on the boolean 1.229 + * @param aForward scroll forward or backwards in selection 1.230 + */ 1.231 + void scrollLine(in boolean forward); 1.232 + 1.233 + /** ScrollCharacter will scroll right or left dependent on the boolean 1.234 + * @param aRight if true will scroll right. if not will scroll left. 1.235 + */ 1.236 + void scrollCharacter(in boolean right); 1.237 + 1.238 + /** SelectAll will select the whole page 1.239 + */ 1.240 + void selectAll(); 1.241 + 1.242 + /** CheckVisibility will return true if textnode and offsets are actually rendered 1.243 + * in the current precontext. 1.244 + * @param aNode textNode to test 1.245 + * @param aStartOffset offset in dom to first char of textnode to test 1.246 + * @param aEndOffset offset in dom to last char of textnode to test 1.247 + * @param aReturnBool boolean returned TRUE if visible FALSE if not 1.248 + */ 1.249 + boolean checkVisibility(in nsIDOMNode node, in short startOffset, in short endOffset); 1.250 + [noscript,nostdcall] boolean checkVisibilityContent(in nsIContent node, in short startOffset, in short endOffset); 1.251 + 1.252 +}; 1.253 +%{ C++ 1.254 + #define NS_ISELECTIONCONTROLLER_CID \ 1.255 + { 0x513b9460, 0xd56a, 0x4c4e, \ 1.256 + { 0xb6, 0xf9, 0x0b, 0x8a, 0xe4, 0x37, 0x2a, 0x3b }} 1.257 +%}