Logo Search packages:      
Sourcecode: firefox-3.5 version File versions  Download package

nsEditor Class Reference

#include <nsEditor.h>

Inheritance diagram for nsEditor:

nsIPhonetic nsStubMutationObserver nsISupports nsISupports nsISupportsWeakReference nsISupports nsIMutationObserver nsISupports nsISupports nsPlaintextEditor nsHTMLEditor nsHTMLEditorLog

List of all members.

Detailed Description

implementation of an editor object. it will be the controller/focal point for the main editor services. i.e. the GUIManager, publishing, transaction manager, event interfaces. the idea for the event interfaces is to have them delegate the actual commands to the editor independent of the XPFE implementation.

Definition at line 98 of file nsEditor.h.

Public Types

enum  IterDirection { kIterForward, kIterBackward }
enum  OperationID {
  kOpIgnore = -1, kOpNone = 0, kOpUndo, kOpRedo,
  kOpInsertNode, kOpCreateNode, kOpDeleteNode, kOpSplitNode,
  kOpJoinNode, kOpDeleteSelection, kOpInsertBreak = 1000, kOpInsertText = 1001,
  kOpInsertIMEText = 1002, kOpDeleteText = 1003

Public Member Functions

void addDocumentStateListener (in nsIDocumentStateListener listener)
void addEditActionListener (in nsIEditActionListener listener)
void addEditorObserver (in nsIEditorObserver observer)
nsresult AppendNodeToSelectionAsRange (nsIDOMNode *aNode)
PRBool ArePreservingSelection ()
virtual void AttributeChanged (nsIDocument *aDocument, nsIContent *aContent, PRInt32 aNameSpaceID, nsIAtom *aAttribute, PRInt32 aModType, PRUint32 aStateMask)=0
void beginComposition (in nsTextEventReplyPtr aReply)
void beginningOfDocument ()
void beginPlaceHolderTransaction (in nsIAtom name)
void beginTransaction ()
nsresult BeginUpdateViewBatch (void)
PRBool CanContainTag (nsIDOMNode *aParent, const nsAString &aTag)
boolean canCopy ()
boolean canCut ()
boolean canDrag (in nsIDOMEvent aEvent)
boolean canPaste (in long aSelectionType)
void canRedo (out boolean isEnabled, out boolean canRedo)
void canUndo (out boolean isEnabled, out boolean canUndo)
virtual void CharacterDataChanged (nsIDocument *aDocument, nsIContent *aContent, CharacterDataChangeInfo *aInfo)=0
virtual void CharacterDataWillChange (nsIDocument *aDocument, nsIContent *aContent, CharacterDataChangeInfo *aInfo)=0
nsresult ClearSelection ()
void cloneAttribute (in AString aAttribute, in nsIDOMNode aDestNode, in nsIDOMNode aSourceNode)
void cloneAttributes (in nsIDOMNode destNode, in nsIDOMNode sourceNode)
virtual void ContentAppended (nsIDocument *aDocument, nsIContent *aContainer, PRInt32 aNewIndexInContainer)=0
virtual void ContentInserted (nsIDocument *aDocument, nsIContent *aContainer, nsIContent *aChild, PRInt32 aIndexInContainer)=0
virtual void ContentRemoved (nsIDocument *aDocument, nsIContent *aContainer, nsIContent *aChild, PRInt32 aIndexInContainer)=0
void copy ()
nsresult CountEditableChildren (nsIDOMNode *aNode, PRUint32 &outCount)
nsresult CreateHTMLContent (const nsAString &aTag, nsIContent **aContent)
nsIDOMNode createNode (in AString tag, in nsIDOMNode parent, in long position)
nsresult CreateRange (nsIDOMNode *aStartParent, PRInt32 aStartOffset, nsIDOMNode *aEndParent, PRInt32 aEndOffset, nsIDOMRange **aRange)
void cut ()
void debugDumpContent ()
void debugUnitTests (out long outNumTests, out long outNumTestsFailed)
void deleteNode (in nsIDOMNode child)
void deleteSelection (in short action)
NS_IMETHOD DeleteSelectionAndCreateNode (const nsAString &aTag, nsIDOMNode **aNewNode)
NS_IMETHOD DeleteSelectionImpl (EDirection aAction)
void doDrag (in nsIDOMEvent aEvent)
void doTransaction (in nsITransaction txn)
void dumpContentTree ()
void enableUndo (in boolean enable)
void endComposition ()
void endOfDocument ()
NS_IMETHOD EndOperation ()
void endPlaceHolderTransaction ()
void endTransaction ()
virtual nsresult EndUpdateViewBatch (void)
void forceCompositionEnd ()
boolean getAttributeValue (in nsIDOMElement aElement, in AString attributestr, out AString resultValue)
nsresult GetFirstEditableNode (nsIDOMNode *aRoot, nsCOMPtr< nsIDOMNode > *outFirstNode)
nsresult GetIMEBufferLength (PRInt32 *length)
nsIInlineSpellChecker getInlineSpellChecker (in boolean autoCreate)
nsCOMPtr< nsIDOMNodeGetLeftmostChild (nsIDOMNode *aCurrentNode, PRBool bNoBlockCrossing=PR_FALSE)
long getModificationCount ()
nsresult GetNextNode (nsIDOMNode *aParentNode, PRInt32 aOffset, PRBool aEditableNode, nsCOMPtr< nsIDOMNode > *aResultNode, PRBool bNoBlockCrossing=PR_FALSE)
nsresult GetNextNode (nsIDOMNode *aCurrentNode, PRBool aEditableNode, nsCOMPtr< nsIDOMNode > *aResultNode, PRBool bNoBlockCrossing=PR_FALSE)
< nsPIDOMEventTarget > 
GetPIDOMEventTarget ()
void getPreferredIMEState (out unsigned long aState)
nsresult GetPriorNode (nsIDOMNode *aParentNode, PRInt32 aOffset, PRBool aEditableNode, nsCOMPtr< nsIDOMNode > *aResultNode, PRBool bNoBlockCrossing=PR_FALSE)
nsresult GetPriorNode (nsIDOMNode *aCurrentNode, PRBool aEditableNode, nsCOMPtr< nsIDOMNode > *aResultNode, PRBool bNoBlockCrossing=PR_FALSE)
nsCOMPtr< nsIDOMNodeGetRightmostChild (nsIDOMNode *aCurrentNode, PRBool bNoBlockCrossing=PR_FALSE)
nsIDOMElementGetRoot ()
PRBool GetShouldTxnSetSelection ()
nsresult GetString (const nsAString &name, nsAString &value)
nsIWeakReference GetWeakReference ()
nsresult HandleInlineSpellCheck (PRInt32 action, nsISelection *aSelection, nsIDOMNode *previousSelectedNode, PRInt32 previousSelectedOffset, nsIDOMNode *aStartNode, PRInt32 aStartOffset, nsIDOMNode *aEndNode, PRInt32 aEndOffset)
void incrementModificationCount (in long aModCount)
void init (in nsIDOMDocument doc, in nsIPresShellPtr shell, in nsIContent aRoot, in nsISelectionController aSelCon, in unsigned long aFlags)
nsresult InsertContainerAbove (nsIDOMNode *inNode, nsCOMPtr< nsIDOMNode > *outNode, const nsAString &aNodeType, const nsAString *aAttribute=nsnull, const nsAString *aValue=nsnull)
void insertFromDrop (in nsIDOMEvent aEvent)
void insertNode (in nsIDOMNode node, in nsIDOMNode parent, in long aPosition)
NS_IMETHOD InsertTextImpl (const nsAString &aStringToInsert, nsCOMPtr< nsIDOMNode > *aInOutNode, PRInt32 *aInOutOffset, nsIDOMDocument *aDoc)
NS_IMETHOD InsertTextIntoTextNodeImpl (const nsAString &aStringToInsert, nsIDOMCharacterData *aTextNode, PRInt32 aOffset, PRBool suppressIME=PR_FALSE)
virtual PRBool IsContainer (nsIDOMNode *aNode)
PRBool IsDescendantOfBody (nsIDOMNode *inNode)
PRBool IsEditable (nsIDOMNode *aNode)
PRBool IsIMEComposing ()
boolean isModifiableNode (in nsIDOMNode aNode)
PRBool IsMozEditorBogusNode (nsIDOMNode *aNode)
nsresult IsPreformatted (nsIDOMNode *aNode, PRBool *aResult)
PRBool IsRootNode (nsIDOMNode *inNode)
virtual PRBool IsTextInDirtyFrameVisible (nsIDOMNode *aNode)
nsresult JoinNodeDeep (nsIDOMNode *aLeftNode, nsIDOMNode *aRightNode, nsCOMPtr< nsIDOMNode > *aOutJoinNode, PRInt32 *outOffset)
void joinNodes (in nsIDOMNode leftNode, in nsIDOMNode rightNode, in nsIDOMNode parent)
nsresult JoinNodesImpl (nsIDOMNode *aNodeToKeep, nsIDOMNode *aNodeToJoin, nsIDOMNode *aParent, PRBool aNodeToKeepIsFirst)
void markNodeDirty (in nsIDOMNode node)
nsresult MoveNode (nsIDOMNode *aNode, nsIDOMNode *aParent, PRInt32 aOffset)
virtual PRBool NodesSameType (nsIDOMNode *aNode1, nsIDOMNode *aNode2)
virtual void NodeWillBeDestroyed (const nsINode *aNode)=0
void NotifyEditorObservers (void)
 nsEditor ()
void outputToStream (in nsIOutputStream aStream, in AString formatType, in ACString charsetOverride, in unsigned long flags)
AString outputToString (in AString formatType, in unsigned long flags)
virtual void ParentChainChanged (nsIContent *aContent)=0
void paste (in long aSelectionType)
void postCreate ()
void preDestroy (in boolean aDestroyingFrames)
nsresult PreserveSelectionAcrossActions (nsISelection *aSel)
void queryComposition (in nsTextEventReplyPtr aReply)
void redo (in unsigned long count)
void removeAttribute (in nsIDOMElement aElement, in AString aAttribute)
void removeAttributeOrEquivalent (in nsIDOMElement element, in DOMString sourceAttrName, in boolean aSuppressTransaction)
nsresult RemoveContainer (nsIDOMNode *inNode)
void removeDocumentStateListener (in nsIDocumentStateListener listener)
void removeEditActionListener (in nsIEditActionListener listener)
void removeEditorObserver (in nsIEditorObserver observer)
nsresult ReplaceContainer (nsIDOMNode *inNode, nsCOMPtr< nsIDOMNode > *outNode, const nsAString &aNodeType, const nsAString *aAttribute=nsnull, const nsAString *aValue=nsnull, PRBool aCloneAttributes=PR_FALSE)
void resetModificationCount ()
nsresult RestorePreservedSelection (nsISelection *aSel)
void selectAll ()
void setAttribute (in nsIDOMElement aElement, in AString attributestr, in AString attvalue)
void setAttributeOrEquivalent (in nsIDOMElement element, in AString sourceAttrName, in AString sourceAttrValue, in boolean aSuppressTransaction)
void setCompositionString (in DOMString aCompositionString, in nsIPrivateTextRangeListPtr aTextRange, in nsTextEventReplyPtr aReply)
void SetIsIMEComposing ()
void setShouldTxnSetSelection (in boolean should)
void setSpellcheckUserOverride (in boolean enable)
boolean shouldTxnSetSelection ()
void splitNode (in nsIDOMNode existingRightNode, in long offset, out nsIDOMNode newLeftNode)
nsresult SplitNodeDeep (nsIDOMNode *aNode, nsIDOMNode *aSplitPointParent, PRInt32 aSplitPointOffset, PRInt32 *outOffset, PRBool aNoEmptyContainers=PR_FALSE, nsCOMPtr< nsIDOMNode > *outLeftNode=0, nsCOMPtr< nsIDOMNode > *outRightNode=0)
nsresult SplitNodeImpl (nsIDOMNode *aExistingRightNode, PRInt32 aOffset, nsIDOMNode *aNewLeftNode, nsIDOMNode *aParent)
NS_IMETHOD StartOperation (PRInt32 opID, nsIEditor::EDirection aDirection)
void StopPreservingSelection ()
void switchTextDirection ()
void syncRealTimeSpell ()
PRBool TagCanContain (const nsAString &aParentTag, nsIDOMNode *aChild)
virtual PRBool TagCanContainTag (const nsAString &aParentTag, const nsAString &aChildTag)
void undo (in unsigned long count)
virtual ~nsEditor ()
 NS_IMETHOD_ (nsrefcnt) Release(void)=0
 NS_IMETHOD_ (nsrefcnt) AddRef(void)=0
NS_IMETHOD QueryInterface (REFNSIID aIID, void **aInstancePtr)=0

Static Public Member Functions

static nsCOMPtr< nsIDOMNodeGetChildAt (nsIDOMNode *aParent, PRInt32 aOffset)
static nsresult GetChildOffset (nsIDOMNode *aChild, nsIDOMNode *aParent, PRInt32 &aOffset)
static nsresult GetEndNodeAndOffset (nsISelection *aSelection, nsCOMPtr< nsIDOMNode > *outEndNode, PRInt32 *outEndOffset)
static PRInt32 GetIndexOf (nsIDOMNode *aParent, nsIDOMNode *aChild)
static nsresult GetLengthOfDOMNode (nsIDOMNode *aNode, PRUint32 &aCount)
static nsresult GetNodeLocation (nsIDOMNode *aChild, nsCOMPtr< nsIDOMNode > *aParent, PRInt32 *aOffset)
static nsresult GetStartNodeAndOffset (nsISelection *aSelection, nsCOMPtr< nsIDOMNode > *outStartNode, PRInt32 *outStartOffset)
static nsIAtom * GetTag (nsIDOMNode *aNode)
static nsresult GetTagString (nsIDOMNode *aNode, nsAString &outString)
static PRBool IsTextNode (nsIDOMNode *aNode)
static PRBool IsTextOrElementNode (nsIDOMNode *aNode)
static PRBool NodeIsType (nsIDOMNode *aNode, nsIAtom *aTag)
static PRBool NodeIsTypeString (nsIDOMNode *aNode, const nsAString &aTag)

Public Attributes

readonly attribute boolean composing
attribute string contentsMIMEType
readonly attribute nsIDOMDocument document
attribute ACString documentCharacterSet
readonly attribute boolean documentIsEmpty
readonly attribute boolean documentModified
const short eNext = 1
const short eNextWord = 3
const short ePrevious = 2
const short ePreviousWord = 4
const short eToBeginningOfLine = 5
const short eToEndOfLine = 6
attribute unsigned long flags
readonly attribute boolean isDocumentEditable
readonly attribute DOMString phonetic
readonly attribute nsIDOMElement rootElement
readonly attribute nsISelection selection
readonly attribute
attribute nsITransactionManager transactionManager

Protected Types

enum  TDocumentListenerNotification { eDocumentCreated, eDocumentToBeDestroyed, eDocumentStateChanged }
enum  Tristate { eTriUnset, eTriFalse, eTriTrue }

Protected Member Functions

void ClearWeakReferences ()
virtual nsresult CreateEventListeners ()=0
NS_IMETHOD CreateTxnForAddStyleSheet (nsICSSStyleSheet *aSheet, AddStyleSheetTxn **aTxn)
NS_IMETHOD CreateTxnForCreateElement (const nsAString &aTag, nsIDOMNode *aParent, PRInt32 aPosition, CreateElementTxn **aTxn)
nsresult CreateTxnForDeleteCharacter (nsIDOMCharacterData *aData, PRUint32 aOffset, nsIEditor::EDirection aDirection, DeleteTextTxn **aTxn)
NS_IMETHOD CreateTxnForDeleteElement (nsIDOMNode *aElement, DeleteElementTxn **aTxn)
NS_IMETHOD CreateTxnForDeleteInsertionPoint (nsIDOMRange *aRange, EDirection aAction, EditAggregateTxn *aTxn, nsIDOMNode **aNode, PRInt32 *aOffset, PRInt32 *aLength)
NS_IMETHOD CreateTxnForDeleteSelection (EDirection aAction, EditAggregateTxn **aTxn, nsIDOMNode **aNode, PRInt32 *aOffset, PRInt32 *aLength)
NS_IMETHOD CreateTxnForDeleteText (nsIDOMCharacterData *aElement, PRUint32 aOffset, PRUint32 aLength, DeleteTextTxn **aTxn)
NS_IMETHOD CreateTxnForIMEText (const nsAString &aStringToInsert, IMETextTxn **aTxn)
NS_IMETHOD CreateTxnForInsertElement (nsIDOMNode *aNode, nsIDOMNode *aParent, PRInt32 aOffset, InsertElementTxn **aTxn)
NS_IMETHOD CreateTxnForInsertText (const nsAString &aStringToInsert, nsIDOMCharacterData *aTextNode, PRInt32 aOffset, InsertTextTxn **aTxn)
NS_IMETHOD CreateTxnForJoinNode (nsIDOMNode *aLeftNode, nsIDOMNode *aRightNode, JoinElementTxn **aTxn)
NS_IMETHOD CreateTxnForRemoveAttribute (nsIDOMElement *aElement, const nsAString &aAttribute, ChangeAttributeTxn **aTxn)
NS_IMETHOD CreateTxnForRemoveStyleSheet (nsICSSStyleSheet *aSheet, RemoveStyleSheetTxn **aTxn)
NS_IMETHOD CreateTxnForSetAttribute (nsIDOMElement *aElement, const nsAString &aAttribute, const nsAString &aValue, ChangeAttributeTxn **aTxn)
NS_IMETHOD CreateTxnForSplitNode (nsIDOMNode *aNode, PRUint32 aOffset, SplitElementTxn **aTxn)
NS_IMETHOD DeleteSelectionAndPrepareToCreateNode (nsCOMPtr< nsIDOMNode > &parentSelectedNode, PRInt32 &offsetOfNewNode)
NS_IMETHOD DeleteText (nsIDOMCharacterData *aElement, PRUint32 aOffset, PRUint32 aLength)
NS_IMETHOD DoAfterDoTransaction (nsITransaction *aTxn)
NS_IMETHOD DoAfterRedoTransaction ()
NS_IMETHOD DoAfterUndoTransaction ()
PRBool GetDesiredSpellCheckState ()
nsresult GetNextNodeImpl (nsIDOMNode *aCurrentNode, PRBool aEditableNode, nsCOMPtr< nsIDOMNode > *aResultNode, PRBool bNoBlockCrossing=PR_FALSE)
nsresult GetPriorNodeImpl (nsIDOMNode *aCurrentNode, PRBool aEditableNode, nsCOMPtr< nsIDOMNode > *aResultNode, PRBool bNoBlockCrossing=PR_FALSE)
nsresult GetWidget (nsIWidget **aWidget)
NS_IMETHOD GetWrapWidth (PRInt32 *aWrapCol)
PRBool HasWeakReferences () const
nsresult InstallEventListeners ()
virtual PRBool IsBlockNode (nsIDOMNode *aNode)
NS_IMETHOD NotifyDocumentListeners (TDocumentListenerNotification aNotificationType)
virtual void RemoveEventListeners ()
NS_IMETHOD ScrollSelectionIntoView (PRBool aScrollToAnchor)
NS_IMETHOD SelectEntireDocument (nsISelection *aSelection)

Protected Attributes

PRInt32 mAction
nsCOMArray< nsIEditActionListenermActionListeners
nsIViewManager::UpdateViewBatch mBatch
nsCOMPtr< nsIDOMEventListenermCompositionListenerP
nsCString mContentMIMEType
PRPackedBool mDidPreDestroy
EDirection mDirection
PRInt8 mDocDirtyState
< nsIDocumentStateListener > 
nsWeakPtr mDocWeak
nsCOMPtr< nsIDOMEventListenermDragListenerP
nsCOMArray< nsIEditorObservermEditorObservers
nsCOMPtr< nsPIDOMEventTarget > mEventTarget
PRUint32 mFlags
nsCOMPtr< nsIDOMEventListenermFocusListenerP
PRUint32 mIMEBufferLength
nsCOMPtr< nsIDOMCharacterDatamIMETextNode
PRUint32 mIMETextOffset
nsCOMPtr< nsIPrivateTextRangeList > mIMETextRangeList
PRPackedBool mInIMEMode
nsCOMPtr< nsIInlineSpellChecker > mInlineSpellChecker
PRPackedBool mIsIMEComposing
nsCOMPtr< nsIDOMEventListenermKeyListenerP
PRUint32 mModCount
nsCOMPtr< nsIDOMEventListenermMouseListenerP
PRInt32 mPlaceHolderBatch
nsIAtom * mPlaceHolderName
nsWeakPtr mPlaceHolderTxn
nsWeakPtr mPresShellWeak
nsRangeUpdater mRangeUpdater
nsCOMPtr< nsIDOMElementmRootElement
nsSelectionState mSavedSel
nsWeakPtr mSelConWeak
nsSelectionState * mSelState
PRPackedBool mShouldTxnSetSelection
enum nsEditor::Tristate mSpellcheckCheckboxState
nsCOMPtr< nsIDOMEventListenermTextListenerP
nsCOMPtr< nsITransactionManager > mTxnMgr
PRInt32 mUpdateCount
nsIViewManager * mViewManager


class nsAutoRules
class nsAutoSelectionReset
class nsAutoTxnsConserveSelection
PRBool NSCanUnload (nsISupports *serviceMgr)
class nsRangeUpdater

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index