2002-03-14 22:11:14 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
2001-03-27 23:11:08 +00:00
|
|
|
*
|
2012-05-21 11:12:37 +00: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/. */
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
#include "domstubs.idl"
|
2001-07-16 02:40:48 +00:00
|
|
|
|
2001-11-01 15:26:34 +00:00
|
|
|
interface nsIURI;
|
2001-07-16 02:40:48 +00:00
|
|
|
interface nsIAtom;
|
2007-01-07 11:01:35 +00:00
|
|
|
interface nsIContent;
|
2001-07-16 02:40:48 +00:00
|
|
|
interface nsISelection;
|
|
|
|
interface nsISelectionController;
|
|
|
|
interface nsIDocumentStateListener;
|
|
|
|
interface nsIOutputStream;
|
|
|
|
interface nsITransactionManager;
|
|
|
|
interface nsITransaction;
|
2012-11-14 19:23:35 +00:00
|
|
|
interface nsIEditorObserver;
|
2001-07-16 02:40:48 +00:00
|
|
|
interface nsIEditActionListener;
|
2005-02-01 21:12:53 +00:00
|
|
|
interface nsIInlineSpellChecker;
|
2010-01-11 01:45:45 +00:00
|
|
|
interface nsITransferable;
|
2001-04-12 23:37:08 +00:00
|
|
|
|
2015-01-15 21:47:56 +00:00
|
|
|
[scriptable, uuid(094be624-f0bf-400f-89e2-6a84baab9474)]
|
2001-03-27 23:11:08 +00:00
|
|
|
interface nsIEditor : nsISupports
|
|
|
|
{
|
|
|
|
%{C++
|
|
|
|
typedef short EDirection;
|
2012-05-10 14:54:33 +00:00
|
|
|
typedef short EStripWrappers;
|
2001-03-27 23:11:08 +00:00
|
|
|
%}
|
|
|
|
const short eNone = 0;
|
|
|
|
const short eNext = 1;
|
|
|
|
const short ePrevious = 2;
|
|
|
|
const short eNextWord = 3;
|
|
|
|
const short ePreviousWord = 4;
|
|
|
|
const short eToBeginningOfLine = 5;
|
|
|
|
const short eToEndOfLine = 6;
|
|
|
|
|
2012-05-10 14:54:33 +00:00
|
|
|
const short eStrip = 0;
|
|
|
|
const short eNoStrip = 1;
|
|
|
|
|
2002-03-14 22:11:14 +00:00
|
|
|
readonly attribute nsISelection selection;
|
|
|
|
|
2014-09-09 23:27:56 +00:00
|
|
|
/**
|
|
|
|
* Finalizes selection and caret for the editor.
|
|
|
|
*/
|
|
|
|
[noscript] void finalizeSelection();
|
|
|
|
|
2001-03-27 23:11:08 +00:00
|
|
|
/**
|
|
|
|
* Init is to tell the implementation of nsIEditor to begin its services
|
2002-03-14 22:11:14 +00:00
|
|
|
* @param aDoc The dom document interface being observed
|
|
|
|
* @param aRoot This is the root of the editable section of this
|
|
|
|
* document. If it is null then we get root
|
|
|
|
* from document body.
|
|
|
|
* @param aSelCon this should be used to get the selection location
|
2011-03-11 05:40:31 +00:00
|
|
|
* (will be null for HTML editors)
|
2002-03-14 22:11:14 +00:00
|
|
|
* @param aFlags A bitmask of flags for specifying the behavior
|
|
|
|
* of the editor.
|
2001-03-27 23:11:08 +00:00
|
|
|
*/
|
2011-03-11 05:40:31 +00:00
|
|
|
[noscript] void init(in nsIDOMDocument doc,
|
2007-01-07 11:01:35 +00:00
|
|
|
in nsIContent aRoot,
|
2002-03-14 22:11:14 +00:00
|
|
|
in nsISelectionController aSelCon,
|
2014-04-14 12:33:47 +00:00
|
|
|
in unsigned long aFlags,
|
|
|
|
in AString initialValue);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2002-03-14 22:11:14 +00:00
|
|
|
void setAttributeOrEquivalent(in nsIDOMElement element,
|
|
|
|
in AString sourceAttrName,
|
2002-09-17 12:04:59 +00:00
|
|
|
in AString sourceAttrValue,
|
|
|
|
in boolean aSuppressTransaction);
|
2002-03-15 15:33:29 +00:00
|
|
|
void removeAttributeOrEquivalent(in nsIDOMElement element,
|
2002-09-17 12:04:59 +00:00
|
|
|
in DOMString sourceAttrName,
|
|
|
|
in boolean aSuppressTransaction);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/**
|
2002-03-14 22:11:14 +00:00
|
|
|
* postCreate should be called after Init, and is the time that the editor
|
|
|
|
* tells its documentStateObservers that the document has been created.
|
2001-03-27 23:11:08 +00:00
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
void postCreate();
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/**
|
2002-03-14 22:11:14 +00:00
|
|
|
* preDestroy is called before the editor goes away, and gives the editor a
|
|
|
|
* chance to tell its documentStateObservers that the document is going away.
|
2008-12-12 08:34:43 +00:00
|
|
|
* @param aDestroyingFrames set to true when the frames being edited
|
|
|
|
* are being destroyed (so there is no need to modify any nsISelections,
|
|
|
|
* nor is it safe to do so)
|
2001-03-27 23:11:08 +00:00
|
|
|
*/
|
2008-12-12 08:34:43 +00:00
|
|
|
void preDestroy(in boolean aDestroyingFrames);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2002-03-14 22:11:14 +00:00
|
|
|
/** edit flags for this editor. May be set at any time. */
|
|
|
|
attribute unsigned long flags;
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2002-09-18 19:42:38 +00:00
|
|
|
/**
|
|
|
|
* the MimeType of the document
|
|
|
|
*/
|
|
|
|
attribute string contentsMIMEType;
|
|
|
|
|
|
|
|
/** Returns true if we have a document that is not marked read-only */
|
|
|
|
readonly attribute boolean isDocumentEditable;
|
|
|
|
|
2011-08-17 17:28:03 +00:00
|
|
|
/** Returns true if the current selection anchor is editable */
|
|
|
|
readonly attribute boolean isSelectionEditable;
|
|
|
|
|
2001-03-27 23:11:08 +00:00
|
|
|
/**
|
2002-03-14 22:11:14 +00:00
|
|
|
* the DOM Document this editor is associated with, refcounted.
|
2001-03-27 23:11:08 +00:00
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
readonly attribute nsIDOMDocument document;
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2002-03-14 22:11:14 +00:00
|
|
|
/** the body element, i.e. the root of the editable document.
|
2001-03-27 23:11:08 +00:00
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
readonly attribute nsIDOMElement rootElement;
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2002-03-14 22:11:14 +00:00
|
|
|
/**
|
|
|
|
* the selection controller for the current presentation, refcounted.
|
2001-03-27 23:11:08 +00:00
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
readonly attribute nsISelectionController selectionController;
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* ------------ Selected content removal -------------- */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* DeleteSelection removes all nodes in the current selection.
|
2002-09-18 19:42:38 +00:00
|
|
|
* @param aDir if eNext, delete to the right (for example, the DEL key)
|
|
|
|
* if ePrevious, delete to the left (for example, the BACKSPACE key)
|
2012-05-10 14:54:33 +00:00
|
|
|
* @param stripWrappers If eStrip, strip any empty inline elements left
|
|
|
|
* behind after the deletion; if eNoStrip, don't. If in
|
|
|
|
* doubt, pass eStrip -- eNoStrip is only for if you're
|
|
|
|
* about to insert text or similar right after.
|
2001-03-27 23:11:08 +00:00
|
|
|
*/
|
2012-05-10 14:54:33 +00:00
|
|
|
void deleteSelection(in short action, in short stripWrappers);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* ------------ Document info and file methods -------------- */
|
|
|
|
|
|
|
|
/** Returns true if the document has no *meaningful* content */
|
2002-03-14 22:11:14 +00:00
|
|
|
readonly attribute boolean documentIsEmpty;
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/** Returns true if the document is modifed and needs saving */
|
2002-03-14 22:11:14 +00:00
|
|
|
readonly attribute boolean documentModified;
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/** Sets the current 'Save' document character set */
|
2003-06-17 16:40:34 +00:00
|
|
|
attribute ACString documentCharacterSet;
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2002-03-14 22:11:14 +00:00
|
|
|
/** to be used ONLY when we need to override the doc's modification
|
|
|
|
* state (such as when it's saved).
|
2001-12-10 15:23:11 +00:00
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
void resetModificationCount();
|
2001-12-10 15:23:11 +00:00
|
|
|
|
2002-03-14 22:11:14 +00:00
|
|
|
/** Gets the modification count of the document we are editing.
|
|
|
|
* @return the modification count of the document being edited.
|
|
|
|
* Zero means unchanged.
|
2001-12-10 15:23:11 +00:00
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
long getModificationCount();
|
2001-12-10 15:23:11 +00:00
|
|
|
|
2002-03-14 22:11:14 +00:00
|
|
|
/** called each time we modify the document.
|
|
|
|
* Increments the modification count of the document.
|
|
|
|
* @param aModCount the number of modifications by which
|
|
|
|
* to increase or decrease the count
|
2001-12-10 15:23:11 +00:00
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
void incrementModificationCount(in long aModCount);
|
2001-12-10 15:23:11 +00:00
|
|
|
|
2001-03-27 23:11:08 +00:00
|
|
|
/* ------------ Transaction methods -------------- */
|
|
|
|
|
2002-03-14 22:11:14 +00:00
|
|
|
/** transactionManager Get the transaction manager the editor is using.
|
2001-03-27 23:11:08 +00:00
|
|
|
*/
|
2007-02-05 22:24:12 +00:00
|
|
|
attribute nsITransactionManager transactionManager;
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2003-04-04 20:50:25 +00:00
|
|
|
/** doTransaction() fires a transaction.
|
2002-03-14 22:11:14 +00:00
|
|
|
* It is provided here so clients can create their own transactions.
|
2001-03-27 23:11:08 +00:00
|
|
|
* If a transaction manager is present, it is used.
|
|
|
|
* Otherwise, the transaction is just executed directly.
|
|
|
|
*
|
|
|
|
* @param aTxn the transaction to execute
|
|
|
|
*/
|
2003-04-04 20:50:25 +00:00
|
|
|
void doTransaction(in nsITransaction txn);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
/** turn the undo system on or off
|
2012-10-25 16:32:24 +00:00
|
|
|
* @param aEnable if PR_TRUE, the undo system is turned on if available
|
|
|
|
* if PR_FALSE the undo system is turned off if it
|
2002-03-14 22:11:14 +00:00
|
|
|
* was previously on
|
2012-10-25 16:32:24 +00:00
|
|
|
* @return if aEnable is PR_TRUE, returns NS_OK if
|
2002-03-14 22:11:14 +00:00
|
|
|
* the undo system could be initialized properly
|
2012-10-25 16:32:24 +00:00
|
|
|
* if aEnable is PR_FALSE, returns NS_OK.
|
2001-03-27 23:11:08 +00:00
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
void enableUndo(in boolean enable);
|
|
|
|
|
2012-02-23 20:47:37 +00:00
|
|
|
/**
|
|
|
|
* The number of items on the undo stack.
|
|
|
|
*/
|
|
|
|
readonly attribute long numberOfUndoItems;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The number of items on the redo stack.
|
|
|
|
*/
|
|
|
|
readonly attribute long numberOfRedoItems;
|
|
|
|
|
2002-03-14 22:11:14 +00:00
|
|
|
/** undo reverses the effects of the last Do operation,
|
|
|
|
* if Undo is enabled in the editor.
|
|
|
|
* It is provided here so clients need no knowledge of whether
|
|
|
|
* the editor has a transaction manager or not.
|
|
|
|
* If a transaction manager is present, it is told to undo,
|
|
|
|
* and the result of that undo is returned.
|
|
|
|
* Otherwise, the Undo request is ignored and an
|
|
|
|
* error NS_ERROR_NOT_AVAILABLE is returned.
|
2001-03-27 23:11:08 +00:00
|
|
|
*
|
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
void undo(in unsigned long count);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/** returns state information about the undo system.
|
2012-10-25 16:32:24 +00:00
|
|
|
* @param aIsEnabled [OUT] PR_TRUE if undo is enabled
|
|
|
|
* @param aCanUndo [OUT] PR_TRUE if at least one transaction is
|
2002-03-14 22:11:14 +00:00
|
|
|
* currently ready to be undone.
|
2001-03-27 23:11:08 +00:00
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
void canUndo(out boolean isEnabled, out boolean canUndo);
|
|
|
|
|
|
|
|
/** redo reverses the effects of the last Undo operation
|
|
|
|
* It is provided here so clients need no knowledge of whether
|
|
|
|
* the editor has a transaction manager or not.
|
|
|
|
* If a transaction manager is present, it is told to redo and the
|
|
|
|
* result of the previously undone transaction is reapplied to the document.
|
|
|
|
* If no transaction is available for Redo, or if the document
|
|
|
|
* has no transaction manager, the Redo request is ignored and an
|
|
|
|
* error NS_ERROR_NOT_AVAILABLE is returned.
|
2001-03-27 23:11:08 +00:00
|
|
|
*
|
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
void redo(in unsigned long count);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/** returns state information about the redo system.
|
2012-10-25 16:32:24 +00:00
|
|
|
* @param aIsEnabled [OUT] PR_TRUE if redo is enabled
|
|
|
|
* @param aCanRedo [OUT] PR_TRUE if at least one transaction is
|
2002-03-14 22:11:14 +00:00
|
|
|
currently ready to be redone.
|
2001-03-27 23:11:08 +00:00
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
void canRedo(out boolean isEnabled, out boolean canRedo);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2002-03-14 22:11:14 +00:00
|
|
|
/** beginTransaction is a signal from the caller to the editor that
|
|
|
|
* the caller will execute multiple updates to the content tree
|
|
|
|
* that should be treated as a single logical operation,
|
2001-03-27 23:11:08 +00:00
|
|
|
* in the most efficient way possible.<br>
|
2002-03-14 22:11:14 +00:00
|
|
|
* All transactions executed between a call to beginTransaction and
|
|
|
|
* endTransaction will be undoable as an atomic action.<br>
|
|
|
|
* endTransaction must be called after beginTransaction.<br>
|
|
|
|
* Calls to beginTransaction can be nested, as long as endTransaction
|
|
|
|
* is called once per beginUpdate.
|
2001-03-27 23:11:08 +00:00
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
void beginTransaction();
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2002-03-14 22:11:14 +00:00
|
|
|
/** endTransaction is a signal to the editor that the caller is
|
|
|
|
* finished updating the content model.<br>
|
|
|
|
* beginUpdate must be called before endTransaction is called.<br>
|
|
|
|
* Calls to beginTransaction can be nested, as long as endTransaction
|
|
|
|
* is called once per beginTransaction.
|
2001-03-27 23:11:08 +00:00
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
void endTransaction();
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2002-03-14 22:11:14 +00:00
|
|
|
void beginPlaceHolderTransaction(in nsIAtom name);
|
|
|
|
void endPlaceHolderTransaction();
|
|
|
|
boolean shouldTxnSetSelection();
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2002-03-14 22:11:14 +00:00
|
|
|
/** Set the flag that prevents insertElementTxn from changing the selection
|
2001-04-12 03:41:06 +00:00
|
|
|
* @param should Set false to suppress changing the selection;
|
2002-03-14 22:11:14 +00:00
|
|
|
* i.e., before using InsertElement() to insert
|
|
|
|
* under <head> element
|
2012-10-25 16:32:24 +00:00
|
|
|
* WARNING: You must be very careful to reset back to PR_TRUE after
|
|
|
|
* setting PR_FALSE, else selection/caret is trashed
|
2002-03-14 22:11:14 +00:00
|
|
|
* for further editing.
|
2001-04-12 03:41:06 +00:00
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
void setShouldTxnSetSelection(in boolean should);
|
2001-04-12 03:41:06 +00:00
|
|
|
|
2005-02-01 21:12:53 +00:00
|
|
|
/* ------------ Inline Spell Checking methods -------------- */
|
|
|
|
|
2005-12-05 18:07:33 +00:00
|
|
|
/** Returns the inline spell checker associated with this object. The spell
|
|
|
|
* checker is lazily created, so this function may create the object for
|
|
|
|
* you during this call.
|
|
|
|
* @param autoCreate If true, this will create a spell checker object
|
|
|
|
* if one does not exist yet for this editor. If false
|
|
|
|
* and the object has not been created, this function
|
|
|
|
* WILL RETURN NULL.
|
|
|
|
*/
|
|
|
|
nsIInlineSpellChecker getInlineSpellChecker(in boolean autoCreate);
|
2005-02-01 21:12:53 +00:00
|
|
|
|
2006-07-29 00:04:40 +00:00
|
|
|
/** Resyncs spellchecking state (enabled/disabled). This should be called
|
|
|
|
* when anything that affects spellchecking state changes, such as the
|
|
|
|
* spellcheck attribute value.
|
|
|
|
*/
|
|
|
|
void syncRealTimeSpell();
|
|
|
|
|
|
|
|
/** Called when the user manually overrides the spellchecking state for this
|
|
|
|
* editor.
|
|
|
|
* @param enable The new state of spellchecking in this editor, as
|
|
|
|
* requested by the user.
|
|
|
|
*/
|
|
|
|
void setSpellcheckUserOverride(in boolean enable);
|
|
|
|
|
2001-03-27 23:11:08 +00:00
|
|
|
/* ------------ Clipboard methods -------------- */
|
|
|
|
|
|
|
|
/** cut the currently selected text, putting it into the OS clipboard
|
|
|
|
* What if no text is selected?
|
|
|
|
* What about mixed selections?
|
|
|
|
* What are the clipboard formats?
|
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
void cut();
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/** Can we cut? True if the doc is modifiable, and we have a non-
|
|
|
|
* collapsed selection.
|
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
boolean canCut();
|
2015-01-15 21:47:56 +00:00
|
|
|
|
2001-03-27 23:11:08 +00:00
|
|
|
/** copy the currently selected text, putting it into the OS clipboard
|
|
|
|
* What if no text is selected?
|
|
|
|
* What about mixed selections?
|
|
|
|
* What are the clipboard formats?
|
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
void copy();
|
2015-01-15 21:47:56 +00:00
|
|
|
|
2001-03-27 23:11:08 +00:00
|
|
|
/** Can we copy? True if we have a non-collapsed selection.
|
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
boolean canCopy();
|
2015-01-15 21:47:56 +00:00
|
|
|
|
|
|
|
/** Can we delete? True if we have a non-collapsed selection.
|
|
|
|
*/
|
|
|
|
boolean canDelete();
|
|
|
|
|
2001-03-27 23:11:08 +00:00
|
|
|
/** paste the text in the OS clipboard at the cursor position, replacing
|
|
|
|
* the selected text (if any)
|
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
void paste(in long aSelectionType);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2010-01-11 01:45:45 +00:00
|
|
|
/** Paste the text in |aTransferable| at the cursor position, replacing the
|
|
|
|
* selected text (if any).
|
|
|
|
*/
|
|
|
|
void pasteTransferable(in nsITransferable aTransferable);
|
|
|
|
|
2001-03-27 23:11:08 +00:00
|
|
|
/** Can we paste? True if the doc is modifiable, and we have
|
|
|
|
* pasteable data in the clipboard.
|
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
boolean canPaste(in long aSelectionType);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2010-01-11 01:45:45 +00:00
|
|
|
/** Can we paste |aTransferable| or, if |aTransferable| is null, will a call
|
|
|
|
* to pasteTransferable later possibly succeed if given an instance of
|
|
|
|
* nsITransferable then? True if the doc is modifiable, and, if
|
|
|
|
* |aTransfeable| is non-null, we have pasteable data in |aTransfeable|.
|
|
|
|
*/
|
|
|
|
boolean canPasteTransferable([optional] in nsITransferable aTransferable);
|
|
|
|
|
2001-03-27 23:11:08 +00:00
|
|
|
/* ------------ Selection methods -------------- */
|
|
|
|
|
|
|
|
/** sets the document selection to the entire contents of the document */
|
2002-03-14 22:11:14 +00:00
|
|
|
void selectAll();
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/** sets the document selection to the beginning of the document */
|
2002-03-14 22:11:14 +00:00
|
|
|
void beginningOfDocument();
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/** sets the document selection to the end of the document */
|
2002-03-14 22:11:14 +00:00
|
|
|
void endOfDocument();
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/* ------------ Node manipulation methods -------------- */
|
|
|
|
|
|
|
|
/**
|
2002-03-14 22:11:14 +00:00
|
|
|
* setAttribute() sets the attribute of aElement.
|
2001-03-27 23:11:08 +00:00
|
|
|
* No checking is done to see if aAttribute is a legal attribute of the node,
|
|
|
|
* or if aValue is a legal value of aAttribute.
|
|
|
|
*
|
|
|
|
* @param aElement the content element to operate on
|
|
|
|
* @param aAttribute the string representation of the attribute to set
|
|
|
|
* @param aValue the value to set aAttribute to
|
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
void setAttribute(in nsIDOMElement aElement, in AString attributestr,
|
|
|
|
in AString attvalue);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/**
|
2002-03-14 22:11:14 +00:00
|
|
|
* getAttributeValue() retrieves the attribute's value for aElement.
|
2001-03-27 23:11:08 +00:00
|
|
|
*
|
|
|
|
* @param aElement the content element to operate on
|
|
|
|
* @param aAttribute the string representation of the attribute to get
|
2002-03-14 22:11:14 +00:00
|
|
|
* @param aResultValue [OUT] the value of aAttribute.
|
2012-10-25 16:32:24 +00:00
|
|
|
* Only valid if aResultIsSet is PR_TRUE
|
|
|
|
* @return PR_TRUE if aAttribute is set on the current node,
|
|
|
|
* PR_FALSE if it is not.
|
2001-03-27 23:11:08 +00:00
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
boolean getAttributeValue(in nsIDOMElement aElement,
|
|
|
|
in AString attributestr,
|
|
|
|
out AString resultValue);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/**
|
2002-03-14 22:11:14 +00:00
|
|
|
* removeAttribute() deletes aAttribute from the attribute list of aElement.
|
2001-03-27 23:11:08 +00:00
|
|
|
* If aAttribute is not an attribute of aElement, nothing is done.
|
|
|
|
*
|
|
|
|
* @param aElement the content element to operate on
|
|
|
|
* @param aAttribute the string representation of the attribute to get
|
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
void removeAttribute(in nsIDOMElement aElement,
|
|
|
|
in AString aAttribute);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2003-06-17 08:45:54 +00:00
|
|
|
/**
|
|
|
|
* cloneAttribute() copies the attribute from the source node to
|
|
|
|
* the destination node and delete those not in the source.
|
|
|
|
*
|
|
|
|
* The supplied nodes MUST BE ELEMENTS (most callers are working with nodes)
|
|
|
|
* @param aAttribute the name of the attribute to copy
|
|
|
|
* @param aDestNode the destination element to operate on
|
|
|
|
* @param aSourceNode the source element to copy attributes from
|
|
|
|
* @exception NS_ERROR_NULL_POINTER at least one of the nodes is null
|
|
|
|
* @exception NS_ERROR_NO_INTERFACE at least one of the nodes is not an
|
|
|
|
* element
|
|
|
|
*/
|
|
|
|
void cloneAttribute(in AString aAttribute,
|
|
|
|
in nsIDOMNode aDestNode, in nsIDOMNode aSourceNode);
|
|
|
|
|
2001-03-27 23:11:08 +00:00
|
|
|
/**
|
2002-03-14 22:11:14 +00:00
|
|
|
* cloneAttributes() is similar to nsIDOMNode::cloneNode(),
|
|
|
|
* it assures the attribute nodes of the destination are identical
|
|
|
|
* with the source node by copying all existing attributes from the
|
|
|
|
* source and deleting those not in the source.
|
2001-03-27 23:11:08 +00:00
|
|
|
* This is used when the destination node (element) already exists
|
|
|
|
*
|
|
|
|
* The supplied nodes MUST BE ELEMENTS (most callers are working with nodes)
|
|
|
|
* @param aDestNode the destination element to operate on
|
|
|
|
* @param aSourceNode the source element to copy attributes from
|
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
void cloneAttributes(in nsIDOMNode destNode, in nsIDOMNode sourceNode);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/**
|
2002-03-14 22:11:14 +00:00
|
|
|
* createNode instantiates a new element of type aTag and inserts it
|
|
|
|
* into aParent at aPosition.
|
2001-03-27 23:11:08 +00:00
|
|
|
* @param aTag The type of object to create
|
|
|
|
* @param aParent The node to insert the new object into
|
|
|
|
* @param aPosition The place in aParent to insert the new node
|
2002-03-14 22:11:14 +00:00
|
|
|
* @return The node created. Caller must release aNewNode.
|
2001-03-27 23:11:08 +00:00
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
nsIDOMNode createNode(in AString tag,
|
2001-03-27 23:11:08 +00:00
|
|
|
in nsIDOMNode parent,
|
2002-03-14 22:11:14 +00:00
|
|
|
in long position);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/**
|
2002-03-14 22:11:14 +00:00
|
|
|
* insertNode inserts aNode into aParent at aPosition.
|
|
|
|
* No checking is done to verify the legality of the insertion.
|
|
|
|
* That is the responsibility of the caller.
|
2001-03-27 23:11:08 +00:00
|
|
|
* @param aNode The DOM Node to insert.
|
|
|
|
* @param aParent The node to insert the new object into
|
|
|
|
* @param aPosition The place in aParent to insert the new node
|
|
|
|
* 0=first child, 1=second child, etc.
|
|
|
|
* any number > number of current children = last child
|
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
void insertNode(in nsIDOMNode node,
|
|
|
|
in nsIDOMNode parent,
|
|
|
|
in long aPosition);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2002-03-14 22:11:14 +00:00
|
|
|
* splitNode() creates a new node identical to an existing node,
|
|
|
|
* and split the contents between the two nodes
|
|
|
|
* @param aExistingRightNode the node to split.
|
|
|
|
* It will become the new node's next sibling.
|
|
|
|
* @param aOffset the offset of aExistingRightNode's
|
|
|
|
* content|children to do the split at
|
|
|
|
* @param aNewLeftNode [OUT] the new node resulting from the split,
|
|
|
|
* becomes aExistingRightNode's previous sibling.
|
2001-03-27 23:11:08 +00:00
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
void splitNode(in nsIDOMNode existingRightNode,
|
|
|
|
in long offset,
|
|
|
|
out nsIDOMNode newLeftNode);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/**
|
2002-03-14 22:11:14 +00:00
|
|
|
* joinNodes() takes 2 nodes and merge their content|children.
|
2001-03-27 23:11:08 +00:00
|
|
|
* @param aLeftNode The left node. It will be deleted.
|
|
|
|
* @param aRightNode The right node. It will remain after the join.
|
|
|
|
* @param aParent The parent of aExistingRightNode
|
|
|
|
*
|
2002-03-14 22:11:14 +00:00
|
|
|
* There is no requirement that the two nodes be
|
|
|
|
* of the same type. However, a text node can be
|
|
|
|
* merged only with another text node.
|
2001-03-27 23:11:08 +00:00
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
void joinNodes(in nsIDOMNode leftNode,
|
|
|
|
in nsIDOMNode rightNode,
|
|
|
|
in nsIDOMNode parent);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/**
|
2002-03-14 22:11:14 +00:00
|
|
|
* deleteNode removes aChild from aParent.
|
2001-03-27 23:11:08 +00:00
|
|
|
* @param aChild The node to delete
|
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
void deleteNode(in nsIDOMNode child);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2012-04-24 06:06:11 +00:00
|
|
|
/**
|
|
|
|
* Returns true if markNodeDirty() has any effect. Returns false if
|
|
|
|
* markNodeDirty() is a no-op.
|
|
|
|
*/
|
|
|
|
[notxpcom] boolean outputsMozDirty();
|
|
|
|
|
2001-03-27 23:11:08 +00:00
|
|
|
/**
|
2002-03-14 22:11:14 +00:00
|
|
|
* markNodeDirty() sets a special dirty attribute on the node.
|
2001-03-27 23:11:08 +00:00
|
|
|
* Usually this will be called immediately after creating a new node.
|
|
|
|
* @param aNode The node for which to insert formatting.
|
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
void markNodeDirty(in nsIDOMNode node);
|
|
|
|
|
2005-01-26 01:40:30 +00:00
|
|
|
/* ---------- direction controller ---------- */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Switches the editor element direction; from "Left-to-Right" to
|
|
|
|
* "Right-to-Left", and vice versa.
|
|
|
|
*/
|
|
|
|
void switchTextDirection();
|
2001-03-27 23:11:08 +00:00
|
|
|
|
2002-03-14 22:11:14 +00:00
|
|
|
/* ------------ Output methods -------------- */
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Output methods:
|
|
|
|
* aFormatType is a mime type, like text/plain.
|
|
|
|
*/
|
2002-03-25 22:39:19 +00:00
|
|
|
AString outputToString(in AString formatType,
|
|
|
|
in unsigned long flags);
|
2002-03-14 22:11:14 +00:00
|
|
|
void outputToStream(in nsIOutputStream aStream,
|
|
|
|
in AString formatType,
|
2003-07-08 20:38:51 +00:00
|
|
|
in ACString charsetOverride,
|
2002-03-14 22:11:14 +00:00
|
|
|
in unsigned long flags);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
|
2007-11-08 04:02:57 +00:00
|
|
|
/* ------------ Various listeners methods --------------
|
|
|
|
* nsIEditor holds strong references to the editor observers, action listeners
|
|
|
|
* and document state listeners.
|
|
|
|
*/
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/** add an EditorObserver to the editors list of observers. */
|
2012-11-14 19:23:35 +00:00
|
|
|
void addEditorObserver(in nsIEditorObserver observer);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/** Remove an EditorObserver from the editor's list of observers. */
|
2012-11-14 19:23:35 +00:00
|
|
|
void removeEditorObserver(in nsIEditorObserver observer);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/** add an EditActionListener to the editors list of listeners. */
|
2002-03-14 22:11:14 +00:00
|
|
|
void addEditActionListener(in nsIEditActionListener listener);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/** Remove an EditActionListener from the editor's list of listeners. */
|
2002-03-14 22:11:14 +00:00
|
|
|
void removeEditActionListener(in nsIEditActionListener listener);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/** Add a DocumentStateListener to the editors list of doc state listeners. */
|
2002-03-14 22:11:14 +00:00
|
|
|
void addDocumentStateListener(in nsIDocumentStateListener listener);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/** Remove a DocumentStateListener to the editors list of doc state listeners. */
|
2002-03-14 22:11:14 +00:00
|
|
|
void removeDocumentStateListener(in nsIDocumentStateListener listener);
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* ------------ Debug methods -------------- */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* And a debug method -- show us what the tree looks like right now
|
|
|
|
*/
|
2002-03-14 22:11:14 +00:00
|
|
|
void dumpContentTree();
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/** Dumps a text representation of the content tree to standard out */
|
2002-03-14 22:11:14 +00:00
|
|
|
void debugDumpContent() ;
|
2001-03-27 23:11:08 +00:00
|
|
|
|
|
|
|
/* Run unit tests. Noop in optimized builds */
|
2002-03-14 22:11:14 +00:00
|
|
|
void debugUnitTests(out long outNumTests, out long outNumTestsFailed);
|
2007-06-28 02:48:16 +00:00
|
|
|
|
|
|
|
/* checks if a node is read-only or not */
|
|
|
|
[notxpcom] boolean isModifiableNode(in nsIDOMNode aNode);
|
2010-12-07 06:30:05 +00:00
|
|
|
|
2012-03-27 01:36:44 +00:00
|
|
|
/* Set true if you want to suppress dispatching input event. */
|
|
|
|
attribute boolean suppressDispatchingInputEvent;
|
2014-08-19 11:54:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* True if an edit action is being handled (in other words, between calls of
|
|
|
|
* nsIEditorObserver::BeforeEditAction() and nsIEditorObserver::EditAction()
|
|
|
|
* or nsIEditorObserver::CancelEditAction(). Otherwise, false.
|
|
|
|
*/
|
2014-08-28 14:33:35 +00:00
|
|
|
[noscript] readonly attribute boolean isInEditAction;
|
2010-12-07 06:30:05 +00:00
|
|
|
};
|