michael@0: /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: michael@0: #include "nsISelectionDisplay.idl" michael@0: michael@0: %{C++ michael@0: typedef short SelectionType; michael@0: typedef short SelectionRegion; michael@0: %} michael@0: michael@0: interface nsIContent; michael@0: interface nsIDOMNode; michael@0: interface nsISelection; michael@0: interface nsISelectionDisplay; michael@0: michael@0: [scriptable, uuid(b1ff7faa-8097-431d-b7f1-b0615e3cd596)] michael@0: interface nsISelectionController : nsISelectionDisplay michael@0: { michael@0: const short SELECTION_NONE=0; michael@0: const short SELECTION_NORMAL=1; michael@0: const short SELECTION_SPELLCHECK=2; michael@0: const short SELECTION_IME_RAWINPUT=4; michael@0: const short SELECTION_IME_SELECTEDRAWTEXT=8; michael@0: const short SELECTION_IME_CONVERTEDTEXT=16; michael@0: const short SELECTION_IME_SELECTEDCONVERTEDTEXT=32; michael@0: const short SELECTION_ACCESSIBILITY=64; // For accessibility API usage michael@0: const short SELECTION_FIND=128; michael@0: const short SELECTION_URLSECONDARY=256; michael@0: const short NUM_SELECTIONTYPES=10; michael@0: michael@0: const short SELECTION_ANCHOR_REGION = 0; michael@0: const short SELECTION_FOCUS_REGION = 1; michael@0: const short SELECTION_WHOLE_SELECTION = 2; michael@0: const short NUM_SELECTION_REGIONS = 3; michael@0: michael@0: const short SELECTION_OFF = 0; michael@0: const short SELECTION_HIDDEN =1;//>HIDDEN displays selection michael@0: const short SELECTION_ON = 2; michael@0: const short SELECTION_DISABLED = 3; michael@0: const short SELECTION_ATTENTION = 4; michael@0: michael@0: /** michael@0: * SetDisplaySelection will set the display mode for the selection. OFF,ON,DISABLED michael@0: */ michael@0: void setDisplaySelection(in short toggle); michael@0: michael@0: /** michael@0: * GetDisplaySelection will get the display mode for the selection. OFF,ON,DISABLED michael@0: */ michael@0: short getDisplaySelection(); michael@0: michael@0: /** michael@0: * GetSelection will return the selection that the presentation michael@0: * shell may implement. michael@0: * michael@0: * @param aType will hold the type of selection //SelectionType michael@0: * @param _return will hold the return value michael@0: */ michael@0: nsISelection getSelection(in short type); michael@0: michael@0: const short SCROLL_SYNCHRONOUS = 1<<1; michael@0: const short SCROLL_FIRST_ANCESTOR_ONLY = 1<<2; michael@0: const short SCROLL_CENTER_VERTICALLY = 1<<4; michael@0: const short SCROLL_OVERFLOW_HIDDEN = 1<<5; michael@0: michael@0: /** michael@0: * ScrollSelectionIntoView scrolls a region of the selection, michael@0: * so that it is visible in the scrolled view. michael@0: * michael@0: * @param aType the selection to scroll into view. //SelectionType michael@0: * @param aRegion the region inside the selection to scroll into view. //SelectionRegion michael@0: * @param aFlags the scroll flags. Valid bits include: michael@0: * SCROLL_SYNCHRONOUS: when set, scrolls the selection into view michael@0: * before returning. If not set, posts a request which is processed michael@0: * at some point after the method returns. michael@0: * SCROLL_FIRST_ANCESTOR_ONLY: if set, only the first ancestor will be scrolled michael@0: * into view. michael@0: * SCROLL_OVERFLOW_HIDDEN: if set, scrolls even if the overflow is specified michael@0: * as hidden. michael@0: * michael@0: * Note that if isSynchronous is true, then this might flush the pending michael@0: * reflow. It's dangerous for some objects. See bug 418470 comment 12. michael@0: */ michael@0: void scrollSelectionIntoView(in short type, in short region, in short flags); michael@0: michael@0: /** michael@0: * RepaintSelection repaints the selection specified by aType. michael@0: * michael@0: * @param aType specifies the selection to repaint. michael@0: */ michael@0: void repaintSelection(in short type); michael@0: michael@0: /** michael@0: * Set the caret as enabled or disabled. An enabled caret will michael@0: * draw or blink when made visible. A disabled caret will never show up. michael@0: * Can be called any time. michael@0: * @param aEnable PR_TRUE to enable caret. PR_FALSE to disable. michael@0: * @return always NS_OK michael@0: */ michael@0: michael@0: void setCaretEnabled(in boolean enabled); michael@0: michael@0: /** michael@0: * Set the caret readonly or not. An readonly caret will michael@0: * draw but not blink when made visible. michael@0: * @param aReadOnly PR_TRUE to enable caret. PR_FALSE to disable. michael@0: * @return always NS_OK michael@0: */ michael@0: void setCaretReadOnly(in boolean readOnly); michael@0: michael@0: /** michael@0: * Gets the current state of the caret. michael@0: * @param aEnabled [OUT] set to the current caret state, as set by SetCaretEnabled michael@0: * @return if aOutEnabled==null, returns NS_ERROR_INVALID_ARG michael@0: * else NS_OK michael@0: */ michael@0: boolean getCaretEnabled(); michael@0: michael@0: /** michael@0: * This is true if the caret is enabled, visible, and currently blinking. michael@0: * This is still true when the caret is enabled, visible, but in its "off" michael@0: * blink cycle. michael@0: */ michael@0: readonly attribute boolean caretVisible; michael@0: michael@0: /** michael@0: * Show the caret even in selections. By default the caret is hidden unless the michael@0: * selection is collapsed. Use this function to show the caret even in selections. michael@0: * @param aVisibility PR_TRUE to show the caret in selections. PR_FALSE to hide. michael@0: * @return always NS_OK michael@0: */ michael@0: void setCaretVisibilityDuringSelection(in boolean visibility); michael@0: michael@0: /** CharacterMove will move the selection one character forward/backward in the document. michael@0: * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE michael@0: * the "point" of selection that is extended is considered the "focus" point. michael@0: * or the last point adjusted by the selection. michael@0: * @param aForward forward or backward if PR_FALSE michael@0: * @param aExtend should it collapse the selection of extend it? michael@0: */ michael@0: void characterMove(in boolean forward, in boolean extend); michael@0: michael@0: /** michael@0: * CharacterExtendForDelete will extend the selection one character cell michael@0: * forward in the document. michael@0: * this method is used internally for handling del key. michael@0: */ michael@0: [noscript] void characterExtendForDelete(); michael@0: michael@0: /** michael@0: * CharacterExtendForBackspace will extend the selection one character cell michael@0: * backward in the document. michael@0: * this method is used internally for handling backspace key only when we're michael@0: * after UTF-16 surrogates. michael@0: */ michael@0: [noscript] void characterExtendForBackspace(); michael@0: michael@0: /** WordMove will move the selection one word forward/backward in the document. michael@0: * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE michael@0: * the "point" of selection that is extended is considered the "focus" point. michael@0: * or the last point adjusted by the selection. michael@0: * @param aForward forward or backward if PR_FALSE michael@0: * @param aExtend should it collapse the selection of extend it? michael@0: */ michael@0: michael@0: void wordMove(in boolean forward, in boolean extend); michael@0: michael@0: /** wordExtendForDelete will extend the selection one word forward/backward in the document. michael@0: * this method is used internally for handling ctrl[option]-backspace and ctrl[option]-del. michael@0: * @param aForward forward or backward if PR_FALSE michael@0: */ michael@0: [noscript] void wordExtendForDelete(in boolean forward); michael@0: michael@0: /** LineMove will move the selection one line forward/backward in the document. michael@0: * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE michael@0: * the "point" of selection that is extended is considered the "focus" point. michael@0: * or the last point adjusted by the selection. michael@0: * @param aForward forward or backward if PR_FALSE michael@0: * @param aExtend should it collapse the selection of extend it? michael@0: */ michael@0: void lineMove(in boolean forward, in boolean extend); michael@0: michael@0: /** IntraLineMove will move the selection to the front of the line or end of the line michael@0: * in the document. michael@0: * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE michael@0: * the "point" of selection that is extended is considered the "focus" point. michael@0: * or the last point adjusted by the selection. michael@0: * @param aForward forward or backward if PR_FALSE michael@0: * @param aExtend should it collapse the selection of extend it? michael@0: */ michael@0: void intraLineMove(in boolean forward, in boolean extend); michael@0: michael@0: /** PageMove will move the selection one page forward/backward in the document. michael@0: * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE michael@0: * the "point" of selection that is extended is considered the "focus" point. michael@0: * or the last point adjusted by the selection. michael@0: * @param aForward forward or backward if PR_FALSE michael@0: * @param aExtend should it collapse the selection of extend it? michael@0: */ michael@0: void pageMove(in boolean forward, in boolean extend); michael@0: michael@0: /** CompleteScroll will move page view to the top or bottom of the document michael@0: * @param aForward forward or backward if PR_FALSE michael@0: */ michael@0: void completeScroll(in boolean forward); michael@0: michael@0: /** CompleteMove will move page view to the top or bottom of the document michael@0: * this will also have the effect of collapsing the selection if the aExtend = PR_FALSE michael@0: * the "point" of selection that is extended is considered the "focus" point. michael@0: * or the last point adjusted by the selection. michael@0: * @param aForward forward or backward if PR_FALSE michael@0: * @param aExtend should it collapse the selection of extend it? michael@0: */ michael@0: void completeMove(in boolean forward, in boolean extend); michael@0: michael@0: michael@0: /** ScrollPage will scroll the page without affecting the selection. michael@0: * @param aForward scroll forward or backwards in selection michael@0: */ michael@0: void scrollPage(in boolean forward); michael@0: michael@0: /** ScrollLine will scroll line up or down dependent on the boolean michael@0: * @param aForward scroll forward or backwards in selection michael@0: */ michael@0: void scrollLine(in boolean forward); michael@0: michael@0: /** ScrollCharacter will scroll right or left dependent on the boolean michael@0: * @param aRight if true will scroll right. if not will scroll left. michael@0: */ michael@0: void scrollCharacter(in boolean right); michael@0: michael@0: /** SelectAll will select the whole page michael@0: */ michael@0: void selectAll(); michael@0: michael@0: /** CheckVisibility will return true if textnode and offsets are actually rendered michael@0: * in the current precontext. michael@0: * @param aNode textNode to test michael@0: * @param aStartOffset offset in dom to first char of textnode to test michael@0: * @param aEndOffset offset in dom to last char of textnode to test michael@0: * @param aReturnBool boolean returned TRUE if visible FALSE if not michael@0: */ michael@0: boolean checkVisibility(in nsIDOMNode node, in short startOffset, in short endOffset); michael@0: [noscript,nostdcall] boolean checkVisibilityContent(in nsIContent node, in short startOffset, in short endOffset); michael@0: michael@0: }; michael@0: %{ C++ michael@0: #define NS_ISELECTIONCONTROLLER_CID \ michael@0: { 0x513b9460, 0xd56a, 0x4c4e, \ michael@0: { 0xb6, 0xf9, 0x0b, 0x8a, 0xe4, 0x37, 0x2a, 0x3b }} michael@0: %}