Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "nsISupports.idl" |
michael@0 | 7 | #include "domstubs.idl" |
michael@0 | 8 | |
michael@0 | 9 | interface nsISelection; |
michael@0 | 10 | |
michael@0 | 11 | |
michael@0 | 12 | /* |
michael@0 | 13 | Editor Action Listener interface to outside world |
michael@0 | 14 | */ |
michael@0 | 15 | |
michael@0 | 16 | |
michael@0 | 17 | /** |
michael@0 | 18 | * A generic editor action listener interface. |
michael@0 | 19 | * <P> |
michael@0 | 20 | * nsIEditActionListener is the interface used by applications wishing to be notified |
michael@0 | 21 | * when the editor modifies the DOM tree. |
michael@0 | 22 | * |
michael@0 | 23 | * Note: this is the wrong class to implement if you are interested in generic |
michael@0 | 24 | * change notifications. For generic notifications, you should implement |
michael@0 | 25 | * nsIDocumentObserver. |
michael@0 | 26 | */ |
michael@0 | 27 | [scriptable, uuid(b22907b1-ee93-11d2-8d50-000064657374)] |
michael@0 | 28 | |
michael@0 | 29 | interface nsIEditActionListener : nsISupports{ |
michael@0 | 30 | |
michael@0 | 31 | /** |
michael@0 | 32 | * Called before the editor creates a node. |
michael@0 | 33 | * @param aTag The tag name of the DOM Node to create. |
michael@0 | 34 | * @param aParent The node to insert the new object into |
michael@0 | 35 | * @param aPosition The place in aParent to insert the new node |
michael@0 | 36 | * 0=first child, 1=second child, etc. |
michael@0 | 37 | * any number > number of current children = last child |
michael@0 | 38 | */ |
michael@0 | 39 | void WillCreateNode(in DOMString aTag, |
michael@0 | 40 | in nsIDOMNode aParent, |
michael@0 | 41 | in long aPosition); |
michael@0 | 42 | |
michael@0 | 43 | /** |
michael@0 | 44 | * Called after the editor creates a node. |
michael@0 | 45 | * @param aTag The tag name of the DOM Node to create. |
michael@0 | 46 | * @param aNode The DOM Node that was created. |
michael@0 | 47 | * @param aParent The node to insert the new object into |
michael@0 | 48 | * @param aPosition The place in aParent to insert the new node |
michael@0 | 49 | * 0=first child, 1=second child, etc. |
michael@0 | 50 | * any number > number of current children = last child |
michael@0 | 51 | * @param aResult The result of the create node operation. |
michael@0 | 52 | */ |
michael@0 | 53 | void DidCreateNode(in DOMString aTag, |
michael@0 | 54 | in nsIDOMNode aNode, |
michael@0 | 55 | in nsIDOMNode aParent, |
michael@0 | 56 | in long aPosition, |
michael@0 | 57 | in nsresult aResult); |
michael@0 | 58 | |
michael@0 | 59 | /** |
michael@0 | 60 | * Called before the editor inserts a node. |
michael@0 | 61 | * @param aNode The DOM Node to insert. |
michael@0 | 62 | * @param aParent The node to insert the new object into |
michael@0 | 63 | * @param aPosition The place in aParent to insert the new node |
michael@0 | 64 | * 0=first child, 1=second child, etc. |
michael@0 | 65 | * any number > number of current children = last child |
michael@0 | 66 | */ |
michael@0 | 67 | void WillInsertNode(in nsIDOMNode aNode, |
michael@0 | 68 | in nsIDOMNode aParent, |
michael@0 | 69 | in long aPosition); |
michael@0 | 70 | |
michael@0 | 71 | /** |
michael@0 | 72 | * Called after the editor inserts a node. |
michael@0 | 73 | * @param aNode The DOM Node to insert. |
michael@0 | 74 | * @param aParent The node to insert the new object into |
michael@0 | 75 | * @param aPosition The place in aParent to insert the new node |
michael@0 | 76 | * 0=first child, 1=second child, etc. |
michael@0 | 77 | * any number > number of current children = last child |
michael@0 | 78 | * @param aResult The result of the insert node operation. |
michael@0 | 79 | */ |
michael@0 | 80 | void DidInsertNode(in nsIDOMNode aNode, |
michael@0 | 81 | in nsIDOMNode aParent, |
michael@0 | 82 | in long aPosition, |
michael@0 | 83 | in nsresult aResult); |
michael@0 | 84 | |
michael@0 | 85 | /** |
michael@0 | 86 | * Called before the editor deletes a node. |
michael@0 | 87 | * @param aChild The node to delete |
michael@0 | 88 | */ |
michael@0 | 89 | void WillDeleteNode(in nsIDOMNode aChild); |
michael@0 | 90 | |
michael@0 | 91 | /** |
michael@0 | 92 | * Called after the editor deletes a node. |
michael@0 | 93 | * @param aChild The node to delete |
michael@0 | 94 | * @param aResult The result of the delete node operation. |
michael@0 | 95 | */ |
michael@0 | 96 | void DidDeleteNode(in nsIDOMNode aChild, in nsresult aResult); |
michael@0 | 97 | |
michael@0 | 98 | /** |
michael@0 | 99 | * Called before the editor splits a node. |
michael@0 | 100 | * @param aExistingRightNode the node to split. It will become the new node's next sibling. |
michael@0 | 101 | * @param aOffset the offset of aExistingRightNode's content|children to do the split at |
michael@0 | 102 | * @param aNewLeftNode [OUT] the new node resulting from the split, becomes aExistingRightNode's previous sibling. |
michael@0 | 103 | */ |
michael@0 | 104 | void WillSplitNode(in nsIDOMNode aExistingRightNode, |
michael@0 | 105 | in long aOffset); |
michael@0 | 106 | |
michael@0 | 107 | /** |
michael@0 | 108 | * Called after the editor splits a node. |
michael@0 | 109 | * @param aExistingRightNode the node to split. It will become the new node's next sibling. |
michael@0 | 110 | * @param aOffset the offset of aExistingRightNode's content|children to do the split at |
michael@0 | 111 | * @param aNewLeftNode [OUT] the new node resulting from the split, becomes aExistingRightNode's previous sibling. |
michael@0 | 112 | */ |
michael@0 | 113 | void DidSplitNode(in nsIDOMNode aExistingRightNode, |
michael@0 | 114 | in long aOffset, |
michael@0 | 115 | in nsIDOMNode aNewLeftNode, |
michael@0 | 116 | in nsresult aResult); |
michael@0 | 117 | |
michael@0 | 118 | /** |
michael@0 | 119 | * Called before the editor joins 2 nodes. |
michael@0 | 120 | * @param aLeftNode This node will be merged into the right node |
michael@0 | 121 | * @param aRightNode The node that will be merged into. |
michael@0 | 122 | * There is no requirement that the two nodes be of |
michael@0 | 123 | * the same type. |
michael@0 | 124 | * @param aParent The parent of aRightNode |
michael@0 | 125 | */ |
michael@0 | 126 | void WillJoinNodes(in nsIDOMNode aLeftNode, |
michael@0 | 127 | in nsIDOMNode aRightNode, |
michael@0 | 128 | in nsIDOMNode aParent); |
michael@0 | 129 | |
michael@0 | 130 | /** |
michael@0 | 131 | * Called after the editor joins 2 nodes. |
michael@0 | 132 | * @param aLeftNode This node will be merged into the right node |
michael@0 | 133 | * @param aRightNode The node that will be merged into. |
michael@0 | 134 | * There is no requirement that the two nodes be of |
michael@0 | 135 | * the same type. |
michael@0 | 136 | * @param aParent The parent of aRightNode |
michael@0 | 137 | * @param aResult The result of the join operation. |
michael@0 | 138 | */ |
michael@0 | 139 | void DidJoinNodes(in nsIDOMNode aLeftNode, |
michael@0 | 140 | in nsIDOMNode aRightNode, |
michael@0 | 141 | in nsIDOMNode aParent, |
michael@0 | 142 | in nsresult aResult); |
michael@0 | 143 | |
michael@0 | 144 | /** |
michael@0 | 145 | * Called before the editor inserts text. |
michael@0 | 146 | * @param aTextNode This node getting inserted text |
michael@0 | 147 | * @param aOffset The offset in aTextNode to insert at. |
michael@0 | 148 | * @param aString The string that gets inserted. |
michael@0 | 149 | */ |
michael@0 | 150 | void WillInsertText(in nsIDOMCharacterData aTextNode, |
michael@0 | 151 | in long aOffset, |
michael@0 | 152 | in DOMString aString); |
michael@0 | 153 | |
michael@0 | 154 | /** |
michael@0 | 155 | * Called after the editor inserts text. |
michael@0 | 156 | * @param aTextNode This node getting inserted text |
michael@0 | 157 | * @param aOffset The offset in aTextNode to insert at. |
michael@0 | 158 | * @param aString The string that gets inserted. |
michael@0 | 159 | * @param aResult The result of the insert text operation. |
michael@0 | 160 | */ |
michael@0 | 161 | void DidInsertText(in nsIDOMCharacterData aTextNode, |
michael@0 | 162 | in long aOffset, |
michael@0 | 163 | in DOMString aString, |
michael@0 | 164 | in nsresult aResult); |
michael@0 | 165 | |
michael@0 | 166 | /** |
michael@0 | 167 | * Called before the editor deletes text. |
michael@0 | 168 | * @param aTextNode This node getting text deleted |
michael@0 | 169 | * @param aOffset The offset in aTextNode to delete at. |
michael@0 | 170 | * @param aLength The amount of text to delete. |
michael@0 | 171 | */ |
michael@0 | 172 | void WillDeleteText(in nsIDOMCharacterData aTextNode, |
michael@0 | 173 | in long aOffset, |
michael@0 | 174 | in long aLength); |
michael@0 | 175 | |
michael@0 | 176 | /** |
michael@0 | 177 | * Called before the editor deletes text. |
michael@0 | 178 | * @param aTextNode This node getting text deleted |
michael@0 | 179 | * @param aOffset The offset in aTextNode to delete at. |
michael@0 | 180 | * @param aLength The amount of text to delete. |
michael@0 | 181 | * @param aResult The result of the delete text operation. |
michael@0 | 182 | */ |
michael@0 | 183 | void DidDeleteText(in nsIDOMCharacterData aTextNode, |
michael@0 | 184 | in long aOffset, |
michael@0 | 185 | in long aLength, |
michael@0 | 186 | in nsresult aResult); |
michael@0 | 187 | |
michael@0 | 188 | /** |
michael@0 | 189 | * Called before the editor deletes the selection. |
michael@0 | 190 | * @param aSelection The selection to be deleted |
michael@0 | 191 | */ |
michael@0 | 192 | void WillDeleteSelection(in nsISelection aSelection); |
michael@0 | 193 | |
michael@0 | 194 | /** |
michael@0 | 195 | * Called after the editor deletes the selection. |
michael@0 | 196 | * @param aSelection The selection, after deletion |
michael@0 | 197 | */ |
michael@0 | 198 | void DidDeleteSelection(in nsISelection aSelection); |
michael@0 | 199 | }; |