2001-09-26 02:53:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2000-11-17 03:10:37 +03:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
2014-08-28 18:33:35 +04:00
|
|
|
[scriptable, uuid(b74fb158-1265-4102-91eb-edd0136b49f8)]
|
2000-11-17 03:10:37 +03:00
|
|
|
interface nsIPlaintextEditor : nsISupports
|
|
|
|
{
|
2001-01-28 23:13:07 +03:00
|
|
|
|
2007-06-28 06:48:16 +04:00
|
|
|
// XXX Why aren't these in nsIEditor?
|
2010-04-12 06:35:18 +04:00
|
|
|
// only plain text entry is allowed via events
|
|
|
|
const long eEditorPlaintextMask = 0x0001;
|
|
|
|
// enter key and CR-LF handled specially
|
|
|
|
const long eEditorSingleLineMask = 0x0002;
|
|
|
|
// text is not entered into content, only a representative character
|
|
|
|
const long eEditorPasswordMask = 0x0004;
|
|
|
|
// editing events are disabled. Editor may still accept focus.
|
|
|
|
const long eEditorReadonlyMask = 0x0008;
|
|
|
|
// all events are disabled (like scrolling). Editor will not accept focus.
|
|
|
|
const long eEditorDisabledMask = 0x0010;
|
|
|
|
// text input is limited to certain character types, use mFilter
|
|
|
|
const long eEditorFilterInputMask = 0x0020;
|
|
|
|
// use mail-compose editing rules
|
|
|
|
const long eEditorMailMask = 0x0040;
|
|
|
|
// allow the editor to set font: monospace on the root node
|
2011-12-24 07:52:21 +04:00
|
|
|
const long eEditorEnableWrapHackMask = 0x0080;
|
2010-04-12 06:35:18 +04:00
|
|
|
// bit for widgets (form elements)
|
2011-12-24 07:52:21 +04:00
|
|
|
const long eEditorWidgetMask = 0x0100;
|
2010-04-12 06:35:18 +04:00
|
|
|
// this HTML editor should not create css styles
|
2011-12-24 07:52:21 +04:00
|
|
|
const long eEditorNoCSSMask = 0x0200;
|
2010-04-12 06:35:18 +04:00
|
|
|
// whether HTML document specific actions are executed or not.
|
|
|
|
// e.g., if this flag is set, the editor doesn't handle Tab key.
|
|
|
|
// besides, anchors of HTML are not clickable.
|
2011-12-24 07:52:21 +04:00
|
|
|
const long eEditorAllowInteraction = 0x0400;
|
2010-04-12 06:35:18 +04:00
|
|
|
// when this is set, the characters in password editor are always masked.
|
|
|
|
// see bug 530367 for the detail.
|
2011-12-24 07:52:21 +04:00
|
|
|
const long eEditorDontEchoPassword = 0x0800;
|
2011-01-27 08:26:33 +03:00
|
|
|
// when this flag is set, the internal direction of the editor is RTL.
|
|
|
|
// if neither of the direction flags are set, the direction is determined
|
|
|
|
// from the text control's content node.
|
2011-12-24 07:52:21 +04:00
|
|
|
const long eEditorRightToLeft = 0x1000;
|
2011-01-27 08:26:33 +03:00
|
|
|
// when this flag is set, the internal direction of the editor is LTR.
|
2011-12-24 07:52:21 +04:00
|
|
|
const long eEditorLeftToRight = 0x2000;
|
2011-10-17 06:06:24 +04:00
|
|
|
// when this flag is set, the editor's text content is not spell checked.
|
2011-12-24 07:52:21 +04:00
|
|
|
const long eEditorSkipSpellCheck = 0x4000;
|
2002-02-05 18:16:14 +03:00
|
|
|
|
2005-12-20 23:12:54 +03:00
|
|
|
/*
|
|
|
|
* The valid values for newlines handling.
|
|
|
|
* Can't change the values unless we remove
|
|
|
|
* use of the pref.
|
|
|
|
*/
|
|
|
|
const long eNewlinesPasteIntact = 0;
|
|
|
|
const long eNewlinesPasteToFirst = 1;
|
|
|
|
const long eNewlinesReplaceWithSpaces = 2;
|
|
|
|
const long eNewlinesStrip = 3;
|
|
|
|
const long eNewlinesReplaceWithCommas = 4;
|
|
|
|
const long eNewlinesStripSurroundingWhitespace = 5;
|
|
|
|
|
2000-11-17 03:10:37 +03:00
|
|
|
/**
|
|
|
|
* The length of the contents in characters.
|
2005-10-17 04:54:02 +04:00
|
|
|
* XXX change this type to 'unsigned long'
|
2000-11-17 03:10:37 +03:00
|
|
|
*/
|
|
|
|
readonly attribute long textLength;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The maximum number of characters allowed.
|
2005-10-17 04:54:02 +04:00
|
|
|
* default: -1 (unlimited).
|
2000-11-17 03:10:37 +03:00
|
|
|
*/
|
|
|
|
attribute long maxTextLength;
|
|
|
|
|
|
|
|
/** Get and set the body wrap width.
|
|
|
|
*
|
|
|
|
* Special values:
|
|
|
|
* 0 = wrap to window width
|
|
|
|
* -1 = no wrap at all
|
|
|
|
*/
|
2001-01-09 00:01:29 +03:00
|
|
|
attribute long wrapWidth;
|
2000-11-17 03:10:37 +03:00
|
|
|
|
2007-07-25 04:11:22 +04:00
|
|
|
/**
|
|
|
|
* Similar to the setter for wrapWidth, but just sets the editor
|
|
|
|
* internal state without actually changing the content being edited
|
|
|
|
* to wrap at that column. This should only be used by callers who
|
|
|
|
* are sure that their content is already set up correctly.
|
|
|
|
*/
|
|
|
|
void setWrapColumn(in long aWrapColumn);
|
|
|
|
|
2005-12-20 23:12:54 +03:00
|
|
|
/** Get and set newline handling.
|
|
|
|
*
|
|
|
|
* Values are the constants defined above.
|
|
|
|
*/
|
|
|
|
attribute long newlineHandling;
|
|
|
|
|
2000-11-17 03:10:37 +03:00
|
|
|
/**
|
|
|
|
* Inserts a string at the current location,
|
|
|
|
* given by the selection.
|
|
|
|
* If the selection is not collapsed, the selection is deleted
|
|
|
|
* and the insertion takes place at the resulting collapsed selection.
|
|
|
|
*
|
|
|
|
* @param aString the string to be inserted
|
|
|
|
*/
|
2001-04-07 04:45:26 +04:00
|
|
|
void insertText(in DOMString aStringToInsert);
|
2003-04-22 22:11:12 +04:00
|
|
|
|
2000-11-17 03:10:37 +03:00
|
|
|
/**
|
|
|
|
* Insert a line break into the content model.
|
|
|
|
* The interpretation of a break is up to the implementation:
|
|
|
|
* it may enter a character, split a node in the tree, etc.
|
|
|
|
* This may be more efficient than calling InsertText with a newline.
|
|
|
|
*/
|
|
|
|
void insertLineBreak();
|
|
|
|
};
|