michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 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: #include "nsISupports.idl" michael@0: michael@0: [scriptable, uuid(07b6d070-ccea-4a00-84b4-f4b94dd9eb52)] michael@0: interface nsIPlaintextEditor : nsISupports michael@0: { michael@0: michael@0: // XXX Why aren't these in nsIEditor? michael@0: // only plain text entry is allowed via events michael@0: const long eEditorPlaintextMask = 0x0001; michael@0: // enter key and CR-LF handled specially michael@0: const long eEditorSingleLineMask = 0x0002; michael@0: // text is not entered into content, only a representative character michael@0: const long eEditorPasswordMask = 0x0004; michael@0: // editing events are disabled. Editor may still accept focus. michael@0: const long eEditorReadonlyMask = 0x0008; michael@0: // all events are disabled (like scrolling). Editor will not accept focus. michael@0: const long eEditorDisabledMask = 0x0010; michael@0: // text input is limited to certain character types, use mFilter michael@0: const long eEditorFilterInputMask = 0x0020; michael@0: // use mail-compose editing rules michael@0: const long eEditorMailMask = 0x0040; michael@0: // allow the editor to set font: monospace on the root node michael@0: const long eEditorEnableWrapHackMask = 0x0080; michael@0: // bit for widgets (form elements) michael@0: const long eEditorWidgetMask = 0x0100; michael@0: // this HTML editor should not create css styles michael@0: const long eEditorNoCSSMask = 0x0200; michael@0: // whether HTML document specific actions are executed or not. michael@0: // e.g., if this flag is set, the editor doesn't handle Tab key. michael@0: // besides, anchors of HTML are not clickable. michael@0: const long eEditorAllowInteraction = 0x0400; michael@0: // when this is set, the characters in password editor are always masked. michael@0: // see bug 530367 for the detail. michael@0: const long eEditorDontEchoPassword = 0x0800; michael@0: // when this flag is set, the internal direction of the editor is RTL. michael@0: // if neither of the direction flags are set, the direction is determined michael@0: // from the text control's content node. michael@0: const long eEditorRightToLeft = 0x1000; michael@0: // when this flag is set, the internal direction of the editor is LTR. michael@0: const long eEditorLeftToRight = 0x2000; michael@0: // when this flag is set, the editor's text content is not spell checked. michael@0: const long eEditorSkipSpellCheck = 0x4000; michael@0: michael@0: /* michael@0: * The valid values for newlines handling. michael@0: * Can't change the values unless we remove michael@0: * use of the pref. michael@0: */ michael@0: const long eNewlinesPasteIntact = 0; michael@0: const long eNewlinesPasteToFirst = 1; michael@0: const long eNewlinesReplaceWithSpaces = 2; michael@0: const long eNewlinesStrip = 3; michael@0: const long eNewlinesReplaceWithCommas = 4; michael@0: const long eNewlinesStripSurroundingWhitespace = 5; michael@0: michael@0: /** michael@0: * The length of the contents in characters. michael@0: * XXX change this type to 'unsigned long' michael@0: */ michael@0: readonly attribute long textLength; michael@0: michael@0: /** michael@0: * The maximum number of characters allowed. michael@0: * default: -1 (unlimited). michael@0: */ michael@0: attribute long maxTextLength; michael@0: michael@0: /** Get and set the body wrap width. michael@0: * michael@0: * Special values: michael@0: * 0 = wrap to window width michael@0: * -1 = no wrap at all michael@0: */ michael@0: attribute long wrapWidth; michael@0: michael@0: /** michael@0: * Similar to the setter for wrapWidth, but just sets the editor michael@0: * internal state without actually changing the content being edited michael@0: * to wrap at that column. This should only be used by callers who michael@0: * are sure that their content is already set up correctly. michael@0: */ michael@0: void setWrapColumn(in long aWrapColumn); michael@0: michael@0: /** Get and set newline handling. michael@0: * michael@0: * Values are the constants defined above. michael@0: */ michael@0: attribute long newlineHandling; michael@0: michael@0: /** michael@0: * Inserts a string at the current location, michael@0: * given by the selection. michael@0: * If the selection is not collapsed, the selection is deleted michael@0: * and the insertion takes place at the resulting collapsed selection. michael@0: * michael@0: * @param aString the string to be inserted michael@0: */ michael@0: void insertText(in DOMString aStringToInsert); michael@0: michael@0: /** michael@0: * Insert a line break into the content model. michael@0: * The interpretation of a break is up to the implementation: michael@0: * it may enter a character, split a node in the tree, etc. michael@0: * This may be more efficient than calling InsertText with a newline. michael@0: */ michael@0: void insertLineBreak(); michael@0: };