2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
2011-12-23 19:52:21 -08:00
|
|
|
[scriptable, uuid(07b6d070-ccea-4a00-84b4-f4b94dd9eb52)]
|
2007-03-22 10:30:00 -07:00
|
|
|
interface nsIPlaintextEditor : nsISupports
|
|
|
|
{
|
|
|
|
|
2007-06-27 19:48:16 -07:00
|
|
|
// XXX Why aren't these in nsIEditor?
|
2010-04-11 19:35:18 -07: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-23 19:52:21 -08:00
|
|
|
const long eEditorEnableWrapHackMask = 0x0080;
|
2010-04-11 19:35:18 -07:00
|
|
|
// bit for widgets (form elements)
|
2011-12-23 19:52:21 -08:00
|
|
|
const long eEditorWidgetMask = 0x0100;
|
2010-04-11 19:35:18 -07:00
|
|
|
// this HTML editor should not create css styles
|
2011-12-23 19:52:21 -08:00
|
|
|
const long eEditorNoCSSMask = 0x0200;
|
2010-04-11 19:35:18 -07: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-23 19:52:21 -08:00
|
|
|
const long eEditorAllowInteraction = 0x0400;
|
2010-04-11 19:35:18 -07:00
|
|
|
// when this is set, the characters in password editor are always masked.
|
|
|
|
// see bug 530367 for the detail.
|
2011-12-23 19:52:21 -08:00
|
|
|
const long eEditorDontEchoPassword = 0x0800;
|
2011-01-26 21:26:33 -08: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-23 19:52:21 -08:00
|
|
|
const long eEditorRightToLeft = 0x1000;
|
2011-01-26 21:26:33 -08:00
|
|
|
// when this flag is set, the internal direction of the editor is LTR.
|
2011-12-23 19:52:21 -08:00
|
|
|
const long eEditorLeftToRight = 0x2000;
|
2011-10-16 19:06:24 -07:00
|
|
|
// when this flag is set, the editor's text content is not spell checked.
|
2011-12-23 19:52:21 -08:00
|
|
|
const long eEditorSkipSpellCheck = 0x4000;
|
2007-03-22 10:30:00 -07: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;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The length of the contents in characters.
|
|
|
|
* XXX change this type to 'unsigned long'
|
|
|
|
*/
|
|
|
|
readonly attribute long textLength;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The maximum number of characters allowed.
|
|
|
|
* default: -1 (unlimited).
|
|
|
|
*/
|
|
|
|
attribute long maxTextLength;
|
|
|
|
|
|
|
|
/** Get and set the body wrap width.
|
|
|
|
*
|
|
|
|
* Special values:
|
|
|
|
* 0 = wrap to window width
|
|
|
|
* -1 = no wrap at all
|
|
|
|
*/
|
|
|
|
attribute long wrapWidth;
|
|
|
|
|
2007-07-24 17:11:22 -07: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);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/** Get and set newline handling.
|
|
|
|
*
|
|
|
|
* Values are the constants defined above.
|
|
|
|
*/
|
|
|
|
attribute long newlineHandling;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
void insertText(in DOMString aStringToInsert);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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();
|
|
|
|
};
|