1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* ***** BEGIN LICENSE BLOCK *****
3
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
5
* The contents of this file are subject to the Netscape Public License
6
* Version 1.1 (the "License"); you may not use this file except in
7
* compliance with the License. You may obtain a copy of the License at
8
* http://www.mozilla.org/NPL/
10
* Software distributed under the License is distributed on an "AS IS" basis,
11
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12
* for the specific language governing rights and limitations under the
15
* The Original Code is mozilla.org code.
17
* The Initial Developer of the Original Code is
18
* Netscape Communications Corporation.
19
* Portions created by the Initial Developer are Copyright (C) 1998
20
* the Initial Developer. All Rights Reserved.
25
* Alternatively, the contents of this file may be used under the terms of
26
* either the GNU General Public License Version 2 or later (the "GPL"), or
27
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28
* in which case the provisions of the GPL or the LGPL are applicable instead
29
* of those above. If you wish to allow use of your version of this file only
30
* under the terms of either the GPL or the LGPL, and not to allow others to
31
* use your version of this file under the terms of the NPL, indicate your
32
* decision by deleting the provisions above and replace them with the notice
33
* and other provisions required by the GPL or the LGPL. If you do not delete
34
* the provisions above, a recipient may use your version of this file under
35
* the terms of any one of the NPL, the GPL or the LGPL.
37
* ***** END LICENSE BLOCK ***** */
39
#include "nsISupports.idl"
40
#include "domstubs.idl"
42
interface nsISelection;
46
Editor Action Listener interface to outside world
51
* A generic editor action listener interface.
53
* nsIEditActionListener is the interface used by applications wishing to be notified
54
* when the editor modifies the DOM tree.
56
* Note: this is the wrong class to implement if you are interested in generic
57
* change notifications. For generic notifications, you should implement
58
* nsIDocumentObserver.
60
[scriptable, uuid(b22907b1-ee93-11d2-8d50-000064657374)]
62
interface nsIEditActionListener : nsISupports{
65
* Called before the editor creates a node.
66
* @param aTag The tag name of the DOM Node to create.
67
* @param aParent The node to insert the new object into
68
* @param aPosition The place in aParent to insert the new node
69
* 0=first child, 1=second child, etc.
70
* any number > number of current children = last child
72
void WillCreateNode(in DOMString aTag,
73
in nsIDOMNode aParent,
77
* Called after the editor creates a node.
78
* @param aTag The tag name of the DOM Node to create.
79
* @param aNode The DOM Node that was created.
80
* @param aParent The node to insert the new object into
81
* @param aPosition The place in aParent to insert the new node
82
* 0=first child, 1=second child, etc.
83
* any number > number of current children = last child
84
* @param aResult The result of the create node operation.
86
void DidCreateNode(in DOMString aTag,
88
in nsIDOMNode aParent,
93
* Called before the editor inserts a node.
94
* @param aNode The DOM Node to insert.
95
* @param aParent The node to insert the new object into
96
* @param aPosition The place in aParent to insert the new node
97
* 0=first child, 1=second child, etc.
98
* any number > number of current children = last child
100
void WillInsertNode(in nsIDOMNode aNode,
101
in nsIDOMNode aParent,
105
* Called after the editor inserts a node.
106
* @param aNode The DOM Node to insert.
107
* @param aParent The node to insert the new object into
108
* @param aPosition The place in aParent to insert the new node
109
* 0=first child, 1=second child, etc.
110
* any number > number of current children = last child
111
* @param aResult The result of the insert node operation.
113
void DidInsertNode(in nsIDOMNode aNode,
114
in nsIDOMNode aParent,
116
in nsresult aResult);
119
* Called before the editor deletes a node.
120
* @param aChild The node to delete
122
void WillDeleteNode(in nsIDOMNode aChild);
125
* Called after the editor deletes a node.
126
* @param aChild The node to delete
127
* @param aResult The result of the delete node operation.
129
void DidDeleteNode(in nsIDOMNode aChild, in nsresult aResult);
132
* Called before the editor splits a node.
133
* @param aExistingRightNode the node to split. It will become the new node's next sibling.
134
* @param aOffset the offset of aExistingRightNode's content|children to do the split at
135
* @param aNewLeftNode [OUT] the new node resulting from the split, becomes aExistingRightNode's previous sibling.
137
void WillSplitNode(in nsIDOMNode aExistingRightNode,
141
* Called after the editor splits a node.
142
* @param aExistingRightNode the node to split. It will become the new node's next sibling.
143
* @param aOffset the offset of aExistingRightNode's content|children to do the split at
144
* @param aNewLeftNode [OUT] the new node resulting from the split, becomes aExistingRightNode's previous sibling.
146
void DidSplitNode(in nsIDOMNode aExistingRightNode,
148
in nsIDOMNode aNewLeftNode,
149
in nsresult aResult);
152
* Called before the editor joins 2 nodes.
153
* @param aLeftNode This node will be merged into the right node
154
* @param aRightNode The node that will be merged into.
155
* There is no requirement that the two nodes be of
157
* @param aParent The parent of aRightNode
159
void WillJoinNodes(in nsIDOMNode aLeftNode,
160
in nsIDOMNode aRightNode,
161
in nsIDOMNode aParent);
164
* Called after the editor joins 2 nodes.
165
* @param aLeftNode This node will be merged into the right node
166
* @param aRightNode The node that will be merged into.
167
* There is no requirement that the two nodes be of
169
* @param aParent The parent of aRightNode
170
* @param aResult The result of the join operation.
172
void DidJoinNodes(in nsIDOMNode aLeftNode,
173
in nsIDOMNode aRightNode,
174
in nsIDOMNode aParent,
175
in nsresult aResult);
178
* Called before the editor inserts text.
179
* @param aTextNode This node getting inserted text
180
* @param aOffset The offset in aTextNode to insert at.
181
* @param aString The string that gets inserted.
183
void WillInsertText(in nsIDOMCharacterData aTextNode,
185
in DOMString aString);
188
* Called after the editor inserts text.
189
* @param aTextNode This node getting inserted text
190
* @param aOffset The offset in aTextNode to insert at.
191
* @param aString The string that gets inserted.
192
* @param aResult The result of the insert text operation.
194
void DidInsertText(in nsIDOMCharacterData aTextNode,
196
in DOMString aString,
197
in nsresult aResult);
200
* Called before the editor deletes text.
201
* @param aTextNode This node getting text deleted
202
* @param aOffset The offset in aTextNode to delete at.
203
* @param aLength The amount of text to delete.
205
void WillDeleteText(in nsIDOMCharacterData aTextNode,
210
* Called before the editor deletes text.
211
* @param aTextNode This node getting text deleted
212
* @param aOffset The offset in aTextNode to delete at.
213
* @param aLength The amount of text to delete.
214
* @param aResult The result of the delete text operation.
216
void DidDeleteText(in nsIDOMCharacterData aTextNode,
219
in nsresult aResult);
222
* Called before the editor deletes the selection.
223
* @param aSelection The selection to be deleted
225
void WillDeleteSelection(in nsISelection aSelection);
228
* Called after the editor deletes the selection.
229
* @param aSelection The selection, after deletion
231
void DidDeleteSelection(in nsISelection aSelection);