You are here: Plugin API > Library Reference > IHost Interface > IDocument Interface
IDocument Interface
The IDocument interface provides access to components associated with an editor document.
Properties
- ISelection Selection - Gets the ISelection of the currently selected text.
Events
- Closing - Occurs when the editor document is closing.
- KeyDown - Occurs when a key is pressed down while the editor document has focus.
- KeyUp - Occurs when a key is released while the editor document has focus.
- MouseClick - Occurs when the editor document is clicked by the mouse.
- MouseDoubleClick - Occurs when the editor document is double-clicked by the mouse.
- MouseHover - Occurs when the editor document is hovered over by the mouse.
- MouseMove - Occurs when the mouse moves over the editor document.
- OnContentChanged - Occurs when content is changed in the editor document.
- PreviewKeyDown - Occurs before the KeyDown event when a key is pressed while the document has focus.
- Saved - Occurs when the editor document is saved.
- Saving - Occurs when before the editor document is saved.
Methods
- bool ApplyStylesheet(string) - Adds the referenced CSS stylesheet to the working list of styles.
- int GetCursorPosition() - Returns the linear position of the insertion point. The intial position starts from 0.
- string GetDocumentText() - Returns the document text.
- string GetDocumentXml() - Returns the document xml.
- string GetSourceUrl() - Returns the url of the editor document.
- List<ToolStripItem> GetUserPendingContextMenuItems() - Returns the list of System.Windows.Forms.ToolStripItem(s) that are pending to be added to the context menu.
- bool RemoveStylesheet(string) - Removes the referenced CSS stylesheet to the working list of styles.
- void Select(string) - Selects the first instance of text matching the search string after the current position of the insertion point.
- void SetCursorPosition(int) - Sets the position of the insertion point to the specified value.