Blame editor/nsIEditor.idl

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