1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/editor/idl/nsIEditActionListener.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,199 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "nsISupports.idl" 1.10 +#include "domstubs.idl" 1.11 + 1.12 +interface nsISelection; 1.13 + 1.14 + 1.15 +/* 1.16 +Editor Action Listener interface to outside world 1.17 +*/ 1.18 + 1.19 + 1.20 +/** 1.21 + * A generic editor action listener interface. 1.22 + * <P> 1.23 + * nsIEditActionListener is the interface used by applications wishing to be notified 1.24 + * when the editor modifies the DOM tree. 1.25 + * 1.26 + * Note: this is the wrong class to implement if you are interested in generic 1.27 + * change notifications. For generic notifications, you should implement 1.28 + * nsIDocumentObserver. 1.29 + */ 1.30 +[scriptable, uuid(b22907b1-ee93-11d2-8d50-000064657374)] 1.31 + 1.32 +interface nsIEditActionListener : nsISupports{ 1.33 + 1.34 + /** 1.35 + * Called before the editor creates a node. 1.36 + * @param aTag The tag name of the DOM Node to create. 1.37 + * @param aParent The node to insert the new object into 1.38 + * @param aPosition The place in aParent to insert the new node 1.39 + * 0=first child, 1=second child, etc. 1.40 + * any number > number of current children = last child 1.41 + */ 1.42 + void WillCreateNode(in DOMString aTag, 1.43 + in nsIDOMNode aParent, 1.44 + in long aPosition); 1.45 + 1.46 + /** 1.47 + * Called after the editor creates a node. 1.48 + * @param aTag The tag name of the DOM Node to create. 1.49 + * @param aNode The DOM Node that was created. 1.50 + * @param aParent The node to insert the new object into 1.51 + * @param aPosition The place in aParent to insert the new node 1.52 + * 0=first child, 1=second child, etc. 1.53 + * any number > number of current children = last child 1.54 + * @param aResult The result of the create node operation. 1.55 + */ 1.56 + void DidCreateNode(in DOMString aTag, 1.57 + in nsIDOMNode aNode, 1.58 + in nsIDOMNode aParent, 1.59 + in long aPosition, 1.60 + in nsresult aResult); 1.61 + 1.62 + /** 1.63 + * Called before the editor inserts a node. 1.64 + * @param aNode The DOM Node to insert. 1.65 + * @param aParent The node to insert the new object into 1.66 + * @param aPosition The place in aParent to insert the new node 1.67 + * 0=first child, 1=second child, etc. 1.68 + * any number > number of current children = last child 1.69 + */ 1.70 + void WillInsertNode(in nsIDOMNode aNode, 1.71 + in nsIDOMNode aParent, 1.72 + in long aPosition); 1.73 + 1.74 + /** 1.75 + * Called after the editor inserts a node. 1.76 + * @param aNode The DOM Node to insert. 1.77 + * @param aParent The node to insert the new object into 1.78 + * @param aPosition The place in aParent to insert the new node 1.79 + * 0=first child, 1=second child, etc. 1.80 + * any number > number of current children = last child 1.81 + * @param aResult The result of the insert node operation. 1.82 + */ 1.83 + void DidInsertNode(in nsIDOMNode aNode, 1.84 + in nsIDOMNode aParent, 1.85 + in long aPosition, 1.86 + in nsresult aResult); 1.87 + 1.88 + /** 1.89 + * Called before the editor deletes a node. 1.90 + * @param aChild The node to delete 1.91 + */ 1.92 + void WillDeleteNode(in nsIDOMNode aChild); 1.93 + 1.94 + /** 1.95 + * Called after the editor deletes a node. 1.96 + * @param aChild The node to delete 1.97 + * @param aResult The result of the delete node operation. 1.98 + */ 1.99 + void DidDeleteNode(in nsIDOMNode aChild, in nsresult aResult); 1.100 + 1.101 + /** 1.102 + * Called before the editor splits a node. 1.103 + * @param aExistingRightNode the node to split. It will become the new node's next sibling. 1.104 + * @param aOffset the offset of aExistingRightNode's content|children to do the split at 1.105 + * @param aNewLeftNode [OUT] the new node resulting from the split, becomes aExistingRightNode's previous sibling. 1.106 + */ 1.107 + void WillSplitNode(in nsIDOMNode aExistingRightNode, 1.108 + in long aOffset); 1.109 + 1.110 + /** 1.111 + * Called after the editor splits a node. 1.112 + * @param aExistingRightNode the node to split. It will become the new node's next sibling. 1.113 + * @param aOffset the offset of aExistingRightNode's content|children to do the split at 1.114 + * @param aNewLeftNode [OUT] the new node resulting from the split, becomes aExistingRightNode's previous sibling. 1.115 + */ 1.116 + void DidSplitNode(in nsIDOMNode aExistingRightNode, 1.117 + in long aOffset, 1.118 + in nsIDOMNode aNewLeftNode, 1.119 + in nsresult aResult); 1.120 + 1.121 + /** 1.122 + * Called before the editor joins 2 nodes. 1.123 + * @param aLeftNode This node will be merged into the right node 1.124 + * @param aRightNode The node that will be merged into. 1.125 + * There is no requirement that the two nodes be of 1.126 + * the same type. 1.127 + * @param aParent The parent of aRightNode 1.128 + */ 1.129 + void WillJoinNodes(in nsIDOMNode aLeftNode, 1.130 + in nsIDOMNode aRightNode, 1.131 + in nsIDOMNode aParent); 1.132 + 1.133 + /** 1.134 + * Called after the editor joins 2 nodes. 1.135 + * @param aLeftNode This node will be merged into the right node 1.136 + * @param aRightNode The node that will be merged into. 1.137 + * There is no requirement that the two nodes be of 1.138 + * the same type. 1.139 + * @param aParent The parent of aRightNode 1.140 + * @param aResult The result of the join operation. 1.141 + */ 1.142 + void DidJoinNodes(in nsIDOMNode aLeftNode, 1.143 + in nsIDOMNode aRightNode, 1.144 + in nsIDOMNode aParent, 1.145 + in nsresult aResult); 1.146 + 1.147 + /** 1.148 + * Called before the editor inserts text. 1.149 + * @param aTextNode This node getting inserted text 1.150 + * @param aOffset The offset in aTextNode to insert at. 1.151 + * @param aString The string that gets inserted. 1.152 + */ 1.153 + void WillInsertText(in nsIDOMCharacterData aTextNode, 1.154 + in long aOffset, 1.155 + in DOMString aString); 1.156 + 1.157 + /** 1.158 + * Called after the editor inserts text. 1.159 + * @param aTextNode This node getting inserted text 1.160 + * @param aOffset The offset in aTextNode to insert at. 1.161 + * @param aString The string that gets inserted. 1.162 + * @param aResult The result of the insert text operation. 1.163 + */ 1.164 + void DidInsertText(in nsIDOMCharacterData aTextNode, 1.165 + in long aOffset, 1.166 + in DOMString aString, 1.167 + in nsresult aResult); 1.168 + 1.169 + /** 1.170 + * Called before the editor deletes text. 1.171 + * @param aTextNode This node getting text deleted 1.172 + * @param aOffset The offset in aTextNode to delete at. 1.173 + * @param aLength The amount of text to delete. 1.174 + */ 1.175 + void WillDeleteText(in nsIDOMCharacterData aTextNode, 1.176 + in long aOffset, 1.177 + in long aLength); 1.178 + 1.179 + /** 1.180 + * Called before the editor deletes text. 1.181 + * @param aTextNode This node getting text deleted 1.182 + * @param aOffset The offset in aTextNode to delete at. 1.183 + * @param aLength The amount of text to delete. 1.184 + * @param aResult The result of the delete text operation. 1.185 + */ 1.186 + void DidDeleteText(in nsIDOMCharacterData aTextNode, 1.187 + in long aOffset, 1.188 + in long aLength, 1.189 + in nsresult aResult); 1.190 + 1.191 + /** 1.192 + * Called before the editor deletes the selection. 1.193 + * @param aSelection The selection to be deleted 1.194 + */ 1.195 + void WillDeleteSelection(in nsISelection aSelection); 1.196 + 1.197 + /** 1.198 + * Called after the editor deletes the selection. 1.199 + * @param aSelection The selection, after deletion 1.200 + */ 1.201 + void DidDeleteSelection(in nsISelection aSelection); 1.202 +};