editor/idl/nsIPlaintextEditor.idl

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include "nsISupports.idl"
michael@0 7
michael@0 8 [scriptable, uuid(07b6d070-ccea-4a00-84b4-f4b94dd9eb52)]
michael@0 9 interface nsIPlaintextEditor : nsISupports
michael@0 10 {
michael@0 11
michael@0 12 // XXX Why aren't these in nsIEditor?
michael@0 13 // only plain text entry is allowed via events
michael@0 14 const long eEditorPlaintextMask = 0x0001;
michael@0 15 // enter key and CR-LF handled specially
michael@0 16 const long eEditorSingleLineMask = 0x0002;
michael@0 17 // text is not entered into content, only a representative character
michael@0 18 const long eEditorPasswordMask = 0x0004;
michael@0 19 // editing events are disabled. Editor may still accept focus.
michael@0 20 const long eEditorReadonlyMask = 0x0008;
michael@0 21 // all events are disabled (like scrolling). Editor will not accept focus.
michael@0 22 const long eEditorDisabledMask = 0x0010;
michael@0 23 // text input is limited to certain character types, use mFilter
michael@0 24 const long eEditorFilterInputMask = 0x0020;
michael@0 25 // use mail-compose editing rules
michael@0 26 const long eEditorMailMask = 0x0040;
michael@0 27 // allow the editor to set font: monospace on the root node
michael@0 28 const long eEditorEnableWrapHackMask = 0x0080;
michael@0 29 // bit for widgets (form elements)
michael@0 30 const long eEditorWidgetMask = 0x0100;
michael@0 31 // this HTML editor should not create css styles
michael@0 32 const long eEditorNoCSSMask = 0x0200;
michael@0 33 // whether HTML document specific actions are executed or not.
michael@0 34 // e.g., if this flag is set, the editor doesn't handle Tab key.
michael@0 35 // besides, anchors of HTML are not clickable.
michael@0 36 const long eEditorAllowInteraction = 0x0400;
michael@0 37 // when this is set, the characters in password editor are always masked.
michael@0 38 // see bug 530367 for the detail.
michael@0 39 const long eEditorDontEchoPassword = 0x0800;
michael@0 40 // when this flag is set, the internal direction of the editor is RTL.
michael@0 41 // if neither of the direction flags are set, the direction is determined
michael@0 42 // from the text control's content node.
michael@0 43 const long eEditorRightToLeft = 0x1000;
michael@0 44 // when this flag is set, the internal direction of the editor is LTR.
michael@0 45 const long eEditorLeftToRight = 0x2000;
michael@0 46 // when this flag is set, the editor's text content is not spell checked.
michael@0 47 const long eEditorSkipSpellCheck = 0x4000;
michael@0 48
michael@0 49 /*
michael@0 50 * The valid values for newlines handling.
michael@0 51 * Can't change the values unless we remove
michael@0 52 * use of the pref.
michael@0 53 */
michael@0 54 const long eNewlinesPasteIntact = 0;
michael@0 55 const long eNewlinesPasteToFirst = 1;
michael@0 56 const long eNewlinesReplaceWithSpaces = 2;
michael@0 57 const long eNewlinesStrip = 3;
michael@0 58 const long eNewlinesReplaceWithCommas = 4;
michael@0 59 const long eNewlinesStripSurroundingWhitespace = 5;
michael@0 60
michael@0 61 /**
michael@0 62 * The length of the contents in characters.
michael@0 63 * XXX change this type to 'unsigned long'
michael@0 64 */
michael@0 65 readonly attribute long textLength;
michael@0 66
michael@0 67 /**
michael@0 68 * The maximum number of characters allowed.
michael@0 69 * default: -1 (unlimited).
michael@0 70 */
michael@0 71 attribute long maxTextLength;
michael@0 72
michael@0 73 /** Get and set the body wrap width.
michael@0 74 *
michael@0 75 * Special values:
michael@0 76 * 0 = wrap to window width
michael@0 77 * -1 = no wrap at all
michael@0 78 */
michael@0 79 attribute long wrapWidth;
michael@0 80
michael@0 81 /**
michael@0 82 * Similar to the setter for wrapWidth, but just sets the editor
michael@0 83 * internal state without actually changing the content being edited
michael@0 84 * to wrap at that column. This should only be used by callers who
michael@0 85 * are sure that their content is already set up correctly.
michael@0 86 */
michael@0 87 void setWrapColumn(in long aWrapColumn);
michael@0 88
michael@0 89 /** Get and set newline handling.
michael@0 90 *
michael@0 91 * Values are the constants defined above.
michael@0 92 */
michael@0 93 attribute long newlineHandling;
michael@0 94
michael@0 95 /**
michael@0 96 * Inserts a string at the current location,
michael@0 97 * given by the selection.
michael@0 98 * If the selection is not collapsed, the selection is deleted
michael@0 99 * and the insertion takes place at the resulting collapsed selection.
michael@0 100 *
michael@0 101 * @param aString the string to be inserted
michael@0 102 */
michael@0 103 void insertText(in DOMString aStringToInsert);
michael@0 104
michael@0 105 /**
michael@0 106 * Insert a line break into the content model.
michael@0 107 * The interpretation of a break is up to the implementation:
michael@0 108 * it may enter a character, split a node in the tree, etc.
michael@0 109 * This may be more efficient than calling InsertText with a newline.
michael@0 110 */
michael@0 111 void insertLineBreak();
michael@0 112 };

mercurial