michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: #include "domstubs.idl" michael@0: michael@0: interface nsISelection; michael@0: michael@0: michael@0: /* michael@0: Editor Action Listener interface to outside world michael@0: */ michael@0: michael@0: michael@0: /** michael@0: * A generic editor action listener interface. michael@0: *
michael@0: * nsIEditActionListener is the interface used by applications wishing to be notified michael@0: * when the editor modifies the DOM tree. michael@0: * michael@0: * Note: this is the wrong class to implement if you are interested in generic michael@0: * change notifications. For generic notifications, you should implement michael@0: * nsIDocumentObserver. michael@0: */ michael@0: [scriptable, uuid(b22907b1-ee93-11d2-8d50-000064657374)] michael@0: michael@0: interface nsIEditActionListener : nsISupports{ michael@0: michael@0: /** michael@0: * Called before the editor creates a node. michael@0: * @param aTag The tag name of the DOM Node to create. michael@0: * @param aParent The node to insert the new object into michael@0: * @param aPosition The place in aParent to insert the new node michael@0: * 0=first child, 1=second child, etc. michael@0: * any number > number of current children = last child michael@0: */ michael@0: void WillCreateNode(in DOMString aTag, michael@0: in nsIDOMNode aParent, michael@0: in long aPosition); michael@0: michael@0: /** michael@0: * Called after the editor creates a node. michael@0: * @param aTag The tag name of the DOM Node to create. michael@0: * @param aNode The DOM Node that was created. michael@0: * @param aParent The node to insert the new object into michael@0: * @param aPosition The place in aParent to insert the new node michael@0: * 0=first child, 1=second child, etc. michael@0: * any number > number of current children = last child michael@0: * @param aResult The result of the create node operation. michael@0: */ michael@0: void DidCreateNode(in DOMString aTag, michael@0: in nsIDOMNode aNode, michael@0: in nsIDOMNode aParent, michael@0: in long aPosition, michael@0: in nsresult aResult); michael@0: michael@0: /** michael@0: * Called before the editor inserts a node. michael@0: * @param aNode The DOM Node to insert. michael@0: * @param aParent The node to insert the new object into michael@0: * @param aPosition The place in aParent to insert the new node michael@0: * 0=first child, 1=second child, etc. michael@0: * any number > number of current children = last child michael@0: */ michael@0: void WillInsertNode(in nsIDOMNode aNode, michael@0: in nsIDOMNode aParent, michael@0: in long aPosition); michael@0: michael@0: /** michael@0: * Called after the editor inserts a node. michael@0: * @param aNode The DOM Node to insert. michael@0: * @param aParent The node to insert the new object into michael@0: * @param aPosition The place in aParent to insert the new node michael@0: * 0=first child, 1=second child, etc. michael@0: * any number > number of current children = last child michael@0: * @param aResult The result of the insert node operation. michael@0: */ michael@0: void DidInsertNode(in nsIDOMNode aNode, michael@0: in nsIDOMNode aParent, michael@0: in long aPosition, michael@0: in nsresult aResult); michael@0: michael@0: /** michael@0: * Called before the editor deletes a node. michael@0: * @param aChild The node to delete michael@0: */ michael@0: void WillDeleteNode(in nsIDOMNode aChild); michael@0: michael@0: /** michael@0: * Called after the editor deletes a node. michael@0: * @param aChild The node to delete michael@0: * @param aResult The result of the delete node operation. michael@0: */ michael@0: void DidDeleteNode(in nsIDOMNode aChild, in nsresult aResult); michael@0: michael@0: /** michael@0: * Called before the editor splits a node. michael@0: * @param aExistingRightNode the node to split. It will become the new node's next sibling. michael@0: * @param aOffset the offset of aExistingRightNode's content|children to do the split at michael@0: * @param aNewLeftNode [OUT] the new node resulting from the split, becomes aExistingRightNode's previous sibling. michael@0: */ michael@0: void WillSplitNode(in nsIDOMNode aExistingRightNode, michael@0: in long aOffset); michael@0: michael@0: /** michael@0: * Called after the editor splits a node. michael@0: * @param aExistingRightNode the node to split. It will become the new node's next sibling. michael@0: * @param aOffset the offset of aExistingRightNode's content|children to do the split at michael@0: * @param aNewLeftNode [OUT] the new node resulting from the split, becomes aExistingRightNode's previous sibling. michael@0: */ michael@0: void DidSplitNode(in nsIDOMNode aExistingRightNode, michael@0: in long aOffset, michael@0: in nsIDOMNode aNewLeftNode, michael@0: in nsresult aResult); michael@0: michael@0: /** michael@0: * Called before the editor joins 2 nodes. michael@0: * @param aLeftNode This node will be merged into the right node michael@0: * @param aRightNode The node that will be merged into. michael@0: * There is no requirement that the two nodes be of michael@0: * the same type. michael@0: * @param aParent The parent of aRightNode michael@0: */ michael@0: void WillJoinNodes(in nsIDOMNode aLeftNode, michael@0: in nsIDOMNode aRightNode, michael@0: in nsIDOMNode aParent); michael@0: michael@0: /** michael@0: * Called after the editor joins 2 nodes. michael@0: * @param aLeftNode This node will be merged into the right node michael@0: * @param aRightNode The node that will be merged into. michael@0: * There is no requirement that the two nodes be of michael@0: * the same type. michael@0: * @param aParent The parent of aRightNode michael@0: * @param aResult The result of the join operation. michael@0: */ michael@0: void DidJoinNodes(in nsIDOMNode aLeftNode, michael@0: in nsIDOMNode aRightNode, michael@0: in nsIDOMNode aParent, michael@0: in nsresult aResult); michael@0: michael@0: /** michael@0: * Called before the editor inserts text. michael@0: * @param aTextNode This node getting inserted text michael@0: * @param aOffset The offset in aTextNode to insert at. michael@0: * @param aString The string that gets inserted. michael@0: */ michael@0: void WillInsertText(in nsIDOMCharacterData aTextNode, michael@0: in long aOffset, michael@0: in DOMString aString); michael@0: michael@0: /** michael@0: * Called after the editor inserts text. michael@0: * @param aTextNode This node getting inserted text michael@0: * @param aOffset The offset in aTextNode to insert at. michael@0: * @param aString The string that gets inserted. michael@0: * @param aResult The result of the insert text operation. michael@0: */ michael@0: void DidInsertText(in nsIDOMCharacterData aTextNode, michael@0: in long aOffset, michael@0: in DOMString aString, michael@0: in nsresult aResult); michael@0: michael@0: /** michael@0: * Called before the editor deletes text. michael@0: * @param aTextNode This node getting text deleted michael@0: * @param aOffset The offset in aTextNode to delete at. michael@0: * @param aLength The amount of text to delete. michael@0: */ michael@0: void WillDeleteText(in nsIDOMCharacterData aTextNode, michael@0: in long aOffset, michael@0: in long aLength); michael@0: michael@0: /** michael@0: * Called before the editor deletes text. michael@0: * @param aTextNode This node getting text deleted michael@0: * @param aOffset The offset in aTextNode to delete at. michael@0: * @param aLength The amount of text to delete. michael@0: * @param aResult The result of the delete text operation. michael@0: */ michael@0: void DidDeleteText(in nsIDOMCharacterData aTextNode, michael@0: in long aOffset, michael@0: in long aLength, michael@0: in nsresult aResult); michael@0: michael@0: /** michael@0: * Called before the editor deletes the selection. michael@0: * @param aSelection The selection to be deleted michael@0: */ michael@0: void WillDeleteSelection(in nsISelection aSelection); michael@0: michael@0: /** michael@0: * Called after the editor deletes the selection. michael@0: * @param aSelection The selection, after deletion michael@0: */ michael@0: void DidDeleteSelection(in nsISelection aSelection); michael@0: };