1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
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.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #include
"nsISupports.idl"
40 interface nsITransaction
;
41 interface nsITransactionManager
;
44 * The nsITransactionListener interface.
46 * This interface is implemented by an object that tracks transactions.
48 [scriptable
, uuid(58e330c4
-7b48
-11d2
-98b9
-00805f297d89
)]
49 interface nsITransactionListener
: nsISupports
52 * Called before a transaction manager calls a transaction's
53 * doTransaction() method.
54 * @param aManager the transaction manager doing the transaction.
55 * @param aTransaction the transaction being executed.
56 * @result boolean value returned by listener which indicates
57 * it's desire to interrupt normal control flow. Listeners should
58 * return true if they want to interrupt normal control flow, without
61 boolean willDo
(in nsITransactionManager aManager
,
62 in nsITransaction aTransaction
);
65 * Called after a transaction manager calls the doTransaction() method of
67 * @param aManager the transaction manager that did the transaction.
68 * @param aTransaction the transaction that was executed.
69 * @param aDoResult the nsresult returned after executing
72 void didDo
(in nsITransactionManager aManager
,
73 in nsITransaction aTransaction
,
74 in nsresult aDoResult
);
77 * Called before a transaction manager calls the Undo() method of
79 * @param aManager the transaction manager undoing the transaction.
80 * @param aTransaction the transaction being undone.
81 * @result boolean value returned by listener which indicates
82 * it's desire to interrupt normal control flow. Listeners should
83 * return true if they want to interrupt normal control flow, without
84 * throwing an error. Note that listeners can also interrupt normal
85 * control flow by throwing an nsresult that indicates an error.
87 boolean willUndo
(in nsITransactionManager aManager
,
88 in nsITransaction aTransaction
);
91 * Called after a transaction manager calls the Undo() method of
93 * @param aManager the transaction manager undoing the transaction.
94 * @param aTransaction the transaction being undone.
95 * @param aUndoResult the nsresult returned after undoing the transaction.
97 void didUndo
(in nsITransactionManager aManager
,
98 in nsITransaction aTransaction
,
99 in nsresult aUndoResult
);
102 * Called before a transaction manager calls the Redo() method of
104 * @param aManager the transaction manager redoing the transaction.
105 * @param aTransaction the transaction being redone.
106 * @result boolean value returned by listener which indicates
107 * it's desire to interrupt normal control flow. Listeners should
108 * return true if they want to interrupt normal control flow, without
109 * throwing an error. Note that listeners can also interrupt normal
110 * control flow by throwing an nsresult that indicates an error.
112 boolean willRedo
(in nsITransactionManager aManager
,
113 in nsITransaction aTransaction
);
116 * Called after a transaction manager calls the Redo() method of
118 * @param aManager the transaction manager redoing the transaction.
119 * @param aTransaction the transaction being redone.
120 * @param aRedoResult the nsresult returned after redoing the transaction.
122 void didRedo
(in nsITransactionManager aManager
,
123 in nsITransaction aTransaction
,
124 in nsresult aRedoResult
);
127 * Called before a transaction manager begins a batch.
128 * @param aManager the transaction manager beginning a batch.
129 * @result boolean value returned by listener which indicates
130 * it's desire to interrupt normal control flow. Listeners should
131 * return true if they want to interrupt normal control flow, without
132 * throwing an error. Note that listeners can also interrupt normal
133 * control flow by throwing an nsresult that indicates an error.
135 boolean willBeginBatch
(in nsITransactionManager aManager
);
138 * Called after a transaction manager begins a batch.
139 * @param aManager the transaction manager that began a batch.
140 * @param aResult the nsresult returned after beginning a batch.
142 void didBeginBatch
(in nsITransactionManager aManager
,
143 in nsresult aResult
);
146 * Called before a transaction manager ends a batch.
147 * @param aManager the transaction manager ending a batch.
148 * @result boolean value returned by listener which indicates
149 * it's desire to interrupt normal control flow. Listeners should
150 * return true if they want to interrupt normal control flow, without
151 * throwing an error. Note that listeners can also interrupt normal
152 * control flow by throwing an nsresult that indicates an error.
154 boolean willEndBatch
(in nsITransactionManager aManager
);
157 * Called after a transaction manager ends a batch.
158 * @param aManager the transaction manager ending a batch.
159 * @param aResult the nsresult returned after ending a batch.
161 void didEndBatch
(in nsITransactionManager aManager
,
162 in nsresult aResult
);
165 * Called before a transaction manager tries to merge
166 * a transaction, that was just executed, with the
167 * transaction at the top of the undo stack.
168 * @param aManager the transaction manager ending a batch.
169 * @param aTopTransaction the transaction at the top of the undo stack.
170 * @param aTransactionToMerge the transaction to merge.
171 * @result boolean value returned by listener which indicates
172 * it's desire to interrupt normal control flow. Listeners should
173 * return true if they want to interrupt normal control flow, without
174 * throwing an error. Note that listeners can also interrupt normal
175 * control flow by throwing an nsresult that indicates an error.
177 boolean willMerge
(in nsITransactionManager aManager
,
178 in nsITransaction aTopTransaction
,
179 in nsITransaction aTransactionToMerge
);
182 * Called after a transaction manager tries to merge
183 * a transaction, that was just executed, with the
184 * transaction at the top of the undo stack.
185 * @param aManager the transaction manager ending a batch.
186 * @param aTopTransaction the transaction at the top of the undo stack.
187 * @param aTransactionToMerge the transaction to merge.
188 * @param aDidMerge true if transaction was merged, else false.
189 * @param aMergeResult the nsresult returned after the merge attempt.
190 * @param aInterrupt listeners should set this to PR_TRUE if they
191 * want to interrupt normal control flow, without throwing an error.
193 void didMerge
(in nsITransactionManager aManager
,
194 in nsITransaction aTopTransaction
,
195 in nsITransaction aTransactionToMerge
,
196 in boolean aDidMerge
,
197 in nsresult aMergeResult
);
200 /* XXX: We should probably add pruning notification methods. */