2002-03-15 01:11:14 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
2001-03-28 03:11:08 +04:00
|
|
|
*
|
2004-04-18 18:21:17 +04:00
|
|
|
* ***** 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.
|
|
|
|
*
|
2001-03-28 03:11:08 +04:00
|
|
|
* The Original Code is the Mozilla browser.
|
2004-04-18 18:21:17 +04:00
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications, Inc.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1999
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
2001-03-28 03:11:08 +04:00
|
|
|
* Contributor(s):
|
2002-01-09 16:51:37 +03:00
|
|
|
* Daniel Glazman <glazman@netscape.com>
|
2002-03-15 01:11:14 +03:00
|
|
|
* Akkana Peck <akkana@netscape.com>
|
2004-04-18 18:21:17 +04:00
|
|
|
*
|
|
|
|
* 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 ***** */
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
#include "domstubs.idl"
|
2001-07-16 06:40:48 +04:00
|
|
|
|
2001-11-01 18:26:34 +03:00
|
|
|
interface nsIURI;
|
2001-07-16 06:40:48 +04:00
|
|
|
interface nsIAtom;
|
|
|
|
interface nsISelection;
|
|
|
|
interface nsISelectionController;
|
|
|
|
interface nsIDocumentStateListener;
|
|
|
|
interface nsIOutputStream;
|
|
|
|
interface nsITransactionManager;
|
|
|
|
interface nsITransaction;
|
|
|
|
interface nsIEditorObserver;
|
|
|
|
interface nsIEditActionListener;
|
2005-02-02 00:12:53 +03:00
|
|
|
interface nsIInlineSpellChecker;
|
2001-04-13 03:37:08 +04:00
|
|
|
|
2001-03-28 03:11:08 +04:00
|
|
|
%{C++
|
|
|
|
class nsIPresShell;
|
|
|
|
class nsIContent;
|
|
|
|
typedef short EDirection;
|
|
|
|
%}
|
|
|
|
|
|
|
|
|
|
|
|
[ptr] native nsIPresShellPtr(nsIPresShell);
|
|
|
|
[ptr] native nsIContentPtr(nsIContent);
|
|
|
|
|
2006-07-29 04:57:42 +04:00
|
|
|
[scriptable, uuid(36fc45c1-c4ea-4fbe-a305-9e463b134449)]
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
interface nsIEditor : nsISupports
|
|
|
|
{
|
|
|
|
%{C++
|
|
|
|
typedef short EDirection;
|
|
|
|
%}
|
|
|
|
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;
|
|
|
|
|
2002-03-15 01:11:14 +03:00
|
|
|
readonly attribute nsISelection selection;
|
|
|
|
|
2001-03-28 03:11:08 +04:00
|
|
|
/**
|
|
|
|
* Init is to tell the implementation of nsIEditor to begin its services
|
2002-03-15 01:11:14 +03:00
|
|
|
* @param aDoc The dom document interface being observed
|
|
|
|
* @param aPresShell TEMP: The presentation shell displaying the document.
|
|
|
|
* Once events can tell us from what pres shell
|
|
|
|
* they originated, this will no longer be
|
|
|
|
* necessary, and the editor will no longer be
|
|
|
|
* linked to a single pres shell.
|
|
|
|
* @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
|
|
|
|
* @param aFlags A bitmask of flags for specifying the behavior
|
|
|
|
* of the editor.
|
2001-03-28 03:11:08 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
[noscript] void init(in nsIDOMDocument doc, in nsIPresShellPtr shell,
|
|
|
|
in nsIContentPtr aRoot,
|
|
|
|
in nsISelectionController aSelCon,
|
|
|
|
in unsigned long aFlags);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2002-03-15 01:11:14 +03:00
|
|
|
void setAttributeOrEquivalent(in nsIDOMElement element,
|
|
|
|
in AString sourceAttrName,
|
2002-09-17 16:04:59 +04:00
|
|
|
in AString sourceAttrValue,
|
|
|
|
in boolean aSuppressTransaction);
|
2002-03-15 18:33:29 +03:00
|
|
|
void removeAttributeOrEquivalent(in nsIDOMElement element,
|
2002-09-17 16:04:59 +04:00
|
|
|
in DOMString sourceAttrName,
|
|
|
|
in boolean aSuppressTransaction);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
2002-03-15 01:11:14 +03: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-28 03:11:08 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void postCreate();
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
2002-03-15 01:11:14 +03: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.
|
2001-03-28 03:11:08 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void preDestroy();
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2002-03-15 01:11:14 +03:00
|
|
|
/** edit flags for this editor. May be set at any time. */
|
|
|
|
attribute unsigned long flags;
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2002-09-18 23:42:38 +04: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;
|
|
|
|
|
2001-03-28 03:11:08 +04:00
|
|
|
/**
|
2002-03-15 01:11:14 +03:00
|
|
|
* the DOM Document this editor is associated with, refcounted.
|
2001-03-28 03:11:08 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
readonly attribute nsIDOMDocument document;
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2002-03-15 01:11:14 +03:00
|
|
|
/** the body element, i.e. the root of the editable document.
|
2001-03-28 03:11:08 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
readonly attribute nsIDOMElement rootElement;
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2002-03-15 01:11:14 +03:00
|
|
|
/**
|
|
|
|
* the selection controller for the current presentation, refcounted.
|
2001-03-28 03:11:08 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
readonly attribute nsISelectionController selectionController;
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
|
|
|
|
/* ------------ Selected content removal -------------- */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* DeleteSelection removes all nodes in the current selection.
|
2002-09-18 23:42:38 +04: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)
|
2001-03-28 03:11:08 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void deleteSelection(in short action);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
|
|
|
|
/* ------------ Document info and file methods -------------- */
|
|
|
|
|
|
|
|
/** Returns true if the document has no *meaningful* content */
|
2002-03-15 01:11:14 +03:00
|
|
|
readonly attribute boolean documentIsEmpty;
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/** Returns true if the document is modifed and needs saving */
|
2002-03-15 01:11:14 +03:00
|
|
|
readonly attribute boolean documentModified;
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/** Sets the current 'Save' document character set */
|
2003-06-17 20:40:34 +04:00
|
|
|
attribute ACString documentCharacterSet;
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2002-03-15 01:11:14 +03:00
|
|
|
/** to be used ONLY when we need to override the doc's modification
|
|
|
|
* state (such as when it's saved).
|
2001-12-10 18:23:11 +03:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void resetModificationCount();
|
2001-12-10 18:23:11 +03:00
|
|
|
|
2002-03-15 01:11:14 +03: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 18:23:11 +03:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
long getModificationCount();
|
2001-12-10 18:23:11 +03:00
|
|
|
|
2002-03-15 01:11:14 +03: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 18:23:11 +03:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void incrementModificationCount(in long aModCount);
|
2001-12-10 18:23:11 +03:00
|
|
|
|
2001-03-28 03:11:08 +04:00
|
|
|
/* ------------ Transaction methods -------------- */
|
|
|
|
|
2002-03-15 01:11:14 +03:00
|
|
|
/** transactionManager Get the transaction manager the editor is using.
|
2001-03-28 03:11:08 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
readonly attribute nsITransactionManager transactionManager;
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2003-04-05 00:50:25 +04:00
|
|
|
/** doTransaction() fires a transaction.
|
2002-03-15 01:11:14 +03:00
|
|
|
* It is provided here so clients can create their own transactions.
|
2001-03-28 03:11:08 +04: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-05 00:50:25 +04:00
|
|
|
void doTransaction(in nsITransaction txn);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
|
|
|
|
/** turn the undo system on or off
|
2002-03-15 01:11:14 +03: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
|
|
|
|
* was previously on
|
|
|
|
* @return if aEnable is PR_TRUE, returns NS_OK if
|
|
|
|
* the undo system could be initialized properly
|
2001-03-28 03:11:08 +04:00
|
|
|
* if aEnable is PR_FALSE, returns NS_OK.
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void enableUndo(in boolean enable);
|
|
|
|
|
|
|
|
/** 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-28 03:11:08 +04:00
|
|
|
*
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void undo(in unsigned long count);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/** returns state information about the undo system.
|
|
|
|
* @param aIsEnabled [OUT] PR_TRUE if undo is enabled
|
2002-03-15 01:11:14 +03:00
|
|
|
* @param aCanUndo [OUT] PR_TRUE if at least one transaction is
|
|
|
|
* currently ready to be undone.
|
2001-03-28 03:11:08 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03: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-28 03:11:08 +04:00
|
|
|
*
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void redo(in unsigned long count);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/** returns state information about the redo system.
|
|
|
|
* @param aIsEnabled [OUT] PR_TRUE if redo is enabled
|
2002-03-15 01:11:14 +03:00
|
|
|
* @param aCanRedo [OUT] PR_TRUE if at least one transaction is
|
|
|
|
currently ready to be redone.
|
2001-03-28 03:11:08 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void canRedo(out boolean isEnabled, out boolean canRedo);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2002-03-15 01:11:14 +03: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-28 03:11:08 +04:00
|
|
|
* in the most efficient way possible.<br>
|
2002-03-15 01:11:14 +03: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-28 03:11:08 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void beginTransaction();
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2002-03-15 01:11:14 +03: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-28 03:11:08 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void endTransaction();
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2002-03-15 01:11:14 +03:00
|
|
|
void beginPlaceHolderTransaction(in nsIAtom name);
|
|
|
|
void endPlaceHolderTransaction();
|
|
|
|
boolean shouldTxnSetSelection();
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2002-03-15 01:11:14 +03:00
|
|
|
/** Set the flag that prevents insertElementTxn from changing the selection
|
2001-04-12 07:41:06 +04:00
|
|
|
* @param should Set false to suppress changing the selection;
|
2002-03-15 01:11:14 +03:00
|
|
|
* i.e., before using InsertElement() to insert
|
|
|
|
* under <head> element
|
2001-04-12 07:41:06 +04:00
|
|
|
* WARNING: You must be very careful to reset back to PR_TRUE after
|
|
|
|
* setting PR_FALSE, else selection/caret is trashed
|
2002-03-15 01:11:14 +03:00
|
|
|
* for further editing.
|
2001-04-12 07:41:06 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void setShouldTxnSetSelection(in boolean should);
|
2001-04-12 07:41:06 +04:00
|
|
|
|
2005-02-02 00:12:53 +03:00
|
|
|
/* ------------ Inline Spell Checking methods -------------- */
|
|
|
|
|
2005-12-05 21:07:33 +03: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-02 00:12:53 +03:00
|
|
|
|
2006-07-29 04:04:40 +04: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-28 03:11:08 +04: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-15 01:11:14 +03:00
|
|
|
void cut();
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/** Can we cut? True if the doc is modifiable, and we have a non-
|
|
|
|
* collapsed selection.
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
boolean canCut();
|
2001-03-28 03:11:08 +04: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-15 01:11:14 +03:00
|
|
|
void copy();
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/** Can we copy? True if we have a non-collapsed selection.
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
boolean canCopy();
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/** paste the text in the OS clipboard at the cursor position, replacing
|
|
|
|
* the selected text (if any)
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void paste(in long aSelectionType);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/** Can we paste? True if the doc is modifiable, and we have
|
|
|
|
* pasteable data in the clipboard.
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
boolean canPaste(in long aSelectionType);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/* ------------ Selection methods -------------- */
|
|
|
|
|
|
|
|
/** sets the document selection to the entire contents of the document */
|
2002-03-15 01:11:14 +03:00
|
|
|
void selectAll();
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/** sets the document selection to the beginning of the document */
|
2002-03-15 01:11:14 +03:00
|
|
|
void beginningOfDocument();
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/** sets the document selection to the end of the document */
|
2002-03-15 01:11:14 +03:00
|
|
|
void endOfDocument();
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/* ------------ Drag/Drop methods -------------- */
|
|
|
|
|
|
|
|
/**
|
2002-03-15 01:11:14 +03:00
|
|
|
* canDrag decides if a drag should be started
|
2001-03-28 03:11:08 +04:00
|
|
|
* (for example, based on the current selection and mousepoint).
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
boolean canDrag(in nsIDOMEvent aEvent);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
2002-03-15 01:11:14 +03:00
|
|
|
* doDrag transfers the relevant data (as appropriate)
|
2001-03-28 03:11:08 +04:00
|
|
|
* to a transferable so it can later be dropped.
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void doDrag(in nsIDOMEvent aEvent);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
2002-03-15 01:11:14 +03:00
|
|
|
* insertFromDrop looks for a dragsession and inserts the
|
2001-03-28 03:11:08 +04:00
|
|
|
* relevant data in response to a drop.
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void insertFromDrop(in nsIDOMEvent aEvent);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/* ------------ Node manipulation methods -------------- */
|
|
|
|
|
|
|
|
/**
|
2002-03-15 01:11:14 +03:00
|
|
|
* setAttribute() sets the attribute of aElement.
|
2001-03-28 03:11:08 +04: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-15 01:11:14 +03:00
|
|
|
void setAttribute(in nsIDOMElement aElement, in AString attributestr,
|
|
|
|
in AString attvalue);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
2002-03-15 01:11:14 +03:00
|
|
|
* getAttributeValue() retrieves the attribute's value for aElement.
|
2001-03-28 03:11:08 +04:00
|
|
|
*
|
|
|
|
* @param aElement the content element to operate on
|
|
|
|
* @param aAttribute the string representation of the attribute to get
|
2002-03-15 01:11:14 +03:00
|
|
|
* @param aResultValue [OUT] the value of aAttribute.
|
|
|
|
* 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-28 03:11:08 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
boolean getAttributeValue(in nsIDOMElement aElement,
|
|
|
|
in AString attributestr,
|
|
|
|
out AString resultValue);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
2002-03-15 01:11:14 +03:00
|
|
|
* removeAttribute() deletes aAttribute from the attribute list of aElement.
|
2001-03-28 03:11:08 +04: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-15 01:11:14 +03:00
|
|
|
void removeAttribute(in nsIDOMElement aElement,
|
|
|
|
in AString aAttribute);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2003-06-17 12:45:54 +04: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-28 03:11:08 +04:00
|
|
|
/**
|
2002-03-15 01:11:14 +03: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-28 03:11:08 +04: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-15 01:11:14 +03:00
|
|
|
void cloneAttributes(in nsIDOMNode destNode, in nsIDOMNode sourceNode);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
2002-03-15 01:11:14 +03:00
|
|
|
* createNode instantiates a new element of type aTag and inserts it
|
|
|
|
* into aParent at aPosition.
|
2001-03-28 03:11:08 +04: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-15 01:11:14 +03:00
|
|
|
* @return The node created. Caller must release aNewNode.
|
2001-03-28 03:11:08 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
nsIDOMNode createNode(in AString tag,
|
2001-03-28 03:11:08 +04:00
|
|
|
in nsIDOMNode parent,
|
2002-03-15 01:11:14 +03:00
|
|
|
in long position);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
2002-03-15 01:11:14 +03: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-28 03:11:08 +04: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-15 01:11:14 +03:00
|
|
|
void insertNode(in nsIDOMNode node,
|
|
|
|
in nsIDOMNode parent,
|
|
|
|
in long aPosition);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2002-03-15 01:11:14 +03: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-28 03:11:08 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void splitNode(in nsIDOMNode existingRightNode,
|
|
|
|
in long offset,
|
|
|
|
out nsIDOMNode newLeftNode);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
2002-03-15 01:11:14 +03:00
|
|
|
* joinNodes() takes 2 nodes and merge their content|children.
|
2001-03-28 03:11:08 +04: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-15 01:11:14 +03: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-28 03:11:08 +04:00
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void joinNodes(in nsIDOMNode leftNode,
|
|
|
|
in nsIDOMNode rightNode,
|
|
|
|
in nsIDOMNode parent);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
2002-03-15 01:11:14 +03:00
|
|
|
* deleteNode removes aChild from aParent.
|
2001-03-28 03:11:08 +04:00
|
|
|
* @param aChild The node to delete
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void deleteNode(in nsIDOMNode child);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
2002-03-15 01:11:14 +03:00
|
|
|
* markNodeDirty() sets a special dirty attribute on the node.
|
2001-03-28 03:11:08 +04:00
|
|
|
* Usually this will be called immediately after creating a new node.
|
|
|
|
* @param aNode The node for which to insert formatting.
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void markNodeDirty(in nsIDOMNode node);
|
|
|
|
|
2005-01-26 04:40:30 +03:00
|
|
|
/* ---------- direction controller ---------- */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Switches the editor element direction; from "Left-to-Right" to
|
|
|
|
* "Right-to-Left", and vice versa.
|
|
|
|
*/
|
|
|
|
void switchTextDirection();
|
2001-03-28 03:11:08 +04:00
|
|
|
|
2002-03-15 01:11:14 +03:00
|
|
|
/* ------------ Output methods -------------- */
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Output methods:
|
|
|
|
* aFormatType is a mime type, like text/plain.
|
|
|
|
*/
|
2002-03-26 01:39:19 +03:00
|
|
|
AString outputToString(in AString formatType,
|
|
|
|
in unsigned long flags);
|
2002-03-15 01:11:14 +03:00
|
|
|
void outputToStream(in nsIOutputStream aStream,
|
|
|
|
in AString formatType,
|
2003-07-09 00:38:51 +04:00
|
|
|
in ACString charsetOverride,
|
2002-03-15 01:11:14 +03:00
|
|
|
in unsigned long flags);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
|
|
|
|
/* ------------ Various listeners methods -------------- */
|
|
|
|
|
|
|
|
/** add an EditorObserver to the editors list of observers. */
|
2002-03-15 01:11:14 +03:00
|
|
|
void addEditorObserver(in nsIEditorObserver observer);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/** Remove an EditorObserver from the editor's list of observers. */
|
2002-03-15 01:11:14 +03:00
|
|
|
void removeEditorObserver(in nsIEditorObserver observer);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/** add an EditActionListener to the editors list of listeners. */
|
2002-03-15 01:11:14 +03:00
|
|
|
void addEditActionListener(in nsIEditActionListener listener);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/** Remove an EditActionListener from the editor's list of listeners. */
|
2002-03-15 01:11:14 +03:00
|
|
|
void removeEditActionListener(in nsIEditActionListener listener);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/** Add a DocumentStateListener to the editors list of doc state listeners. */
|
2002-03-15 01:11:14 +03:00
|
|
|
void addDocumentStateListener(in nsIDocumentStateListener listener);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/** Remove a DocumentStateListener to the editors list of doc state listeners. */
|
2002-03-15 01:11:14 +03:00
|
|
|
void removeDocumentStateListener(in nsIDocumentStateListener listener);
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
|
|
|
|
/* ------------ Debug methods -------------- */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* And a debug method -- show us what the tree looks like right now
|
|
|
|
*/
|
2002-03-15 01:11:14 +03:00
|
|
|
void dumpContentTree();
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/** Dumps a text representation of the content tree to standard out */
|
2002-03-15 01:11:14 +03:00
|
|
|
void debugDumpContent() ;
|
2001-03-28 03:11:08 +04:00
|
|
|
|
|
|
|
/* Run unit tests. Noop in optimized builds */
|
2002-03-15 01:11:14 +03:00
|
|
|
void debugUnitTests(out long outNumTests, out long outNumTestsFailed);
|
2001-03-28 03:11:08 +04:00
|
|
|
};
|