Source code

Revision control

Other Tools

1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* This Source Code Form is subject to the terms of the Mozilla Public
3
* License, v. 2.0. If a copy of the MPL was not distributed with this
4
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
#include "nsISupports.idl"
7
8
interface nsITransaction;
9
interface nsITransactionManager;
10
11
/**
12
* The nsITransactionListener interface.
13
* <P>
14
* This interface is implemented by an object that tracks transactions.
15
*/
16
[scriptable, uuid(58e330c4-7b48-11d2-98b9-00805f297d89)]
17
interface nsITransactionListener : nsISupports
18
{
19
/**
20
* Called before a transaction manager calls a transaction's
21
* doTransaction() method.
22
* @param aManager the transaction manager doing the transaction.
23
* @param aTransaction the transaction being executed.
24
* @result boolean value returned by listener which indicates
25
* its desire to interrupt normal control flow. Listeners should
26
* return true if they want to interrupt normal control flow, without
27
* throwing an error.
28
*/
29
boolean willDo(in nsITransactionManager aManager,
30
in nsITransaction aTransaction);
31
32
/**
33
* Called after a transaction manager calls the doTransaction() method of
34
* a transaction.
35
* @param aManager the transaction manager that did the transaction.
36
* @param aTransaction the transaction that was executed.
37
* @param aDoResult the nsresult returned after executing
38
* the transaction.
39
*/
40
void didDo(in nsITransactionManager aManager,
41
in nsITransaction aTransaction,
42
in nsresult aDoResult);
43
44
/**
45
* Called before a transaction manager calls the Undo() method of
46
* a transaction.
47
* @param aManager the transaction manager undoing the transaction.
48
* @param aTransaction the transaction being undone.
49
* @result boolean value returned by listener which indicates
50
* its desire to interrupt normal control flow. Listeners should
51
* return true if they want to interrupt normal control flow, without
52
* throwing an error. Note that listeners can also interrupt normal
53
* control flow by throwing an nsresult that indicates an error.
54
*/
55
boolean willUndo(in nsITransactionManager aManager,
56
in nsITransaction aTransaction);
57
58
/**
59
* Called after a transaction manager calls the Undo() method of
60
* a transaction.
61
* @param aManager the transaction manager undoing the transaction.
62
* @param aTransaction the transaction being undone.
63
* @param aUndoResult the nsresult returned after undoing the transaction.
64
*/
65
void didUndo(in nsITransactionManager aManager,
66
in nsITransaction aTransaction,
67
in nsresult aUndoResult);
68
69
/**
70
* Called before a transaction manager calls the Redo() method of
71
* a transaction.
72
* @param aManager the transaction manager redoing the transaction.
73
* @param aTransaction the transaction being redone.
74
* @result boolean value returned by listener which indicates
75
* its desire to interrupt normal control flow. Listeners should
76
* return true if they want to interrupt normal control flow, without
77
* throwing an error. Note that listeners can also interrupt normal
78
* control flow by throwing an nsresult that indicates an error.
79
*/
80
boolean willRedo(in nsITransactionManager aManager,
81
in nsITransaction aTransaction);
82
83
/**
84
* Called after a transaction manager calls the Redo() method of
85
* a transaction.
86
* @param aManager the transaction manager redoing the transaction.
87
* @param aTransaction the transaction being redone.
88
* @param aRedoResult the nsresult returned after redoing the transaction.
89
*/
90
void didRedo(in nsITransactionManager aManager,
91
in nsITransaction aTransaction,
92
in nsresult aRedoResult);
93
94
/**
95
* Called before a transaction manager begins a batch.
96
* @param aManager the transaction manager beginning a batch.
97
* @result boolean value returned by listener which indicates
98
* its desire to interrupt normal control flow. Listeners should
99
* return true if they want to interrupt normal control flow, without
100
* throwing an error. Note that listeners can also interrupt normal
101
* control flow by throwing an nsresult that indicates an error.
102
*/
103
boolean willBeginBatch(in nsITransactionManager aManager);
104
105
/**
106
* Called after a transaction manager begins a batch.
107
* @param aManager the transaction manager that began a batch.
108
* @param aResult the nsresult returned after beginning a batch.
109
*/
110
void didBeginBatch(in nsITransactionManager aManager,
111
in nsresult aResult);
112
113
/**
114
* Called before a transaction manager ends a batch.
115
* @param aManager the transaction manager ending a batch.
116
* @result boolean value returned by listener which indicates
117
* its desire to interrupt normal control flow. Listeners should
118
* return true if they want to interrupt normal control flow, without
119
* throwing an error. Note that listeners can also interrupt normal
120
* control flow by throwing an nsresult that indicates an error.
121
*/
122
boolean willEndBatch(in nsITransactionManager aManager);
123
124
/**
125
* Called after a transaction manager ends a batch.
126
* @param aManager the transaction manager ending a batch.
127
* @param aResult the nsresult returned after ending a batch.
128
*/
129
void didEndBatch(in nsITransactionManager aManager,
130
in nsresult aResult);
131
132
/**
133
* Called before a transaction manager tries to merge
134
* a transaction, that was just executed, with the
135
* transaction at the top of the undo stack.
136
* @param aManager the transaction manager ending a batch.
137
* @param aTopTransaction the transaction at the top of the undo stack.
138
* @param aTransactionToMerge the transaction to merge.
139
* @result boolean value returned by listener which indicates
140
* its desire to interrupt normal control flow. Listeners should
141
* return true if they want to interrupt normal control flow, without
142
* throwing an error. Note that listeners can also interrupt normal
143
* control flow by throwing an nsresult that indicates an error.
144
*/
145
boolean willMerge(in nsITransactionManager aManager,
146
in nsITransaction aTopTransaction,
147
in nsITransaction aTransactionToMerge);
148
149
/**
150
* Called after a transaction manager tries to merge
151
* a transaction, that was just executed, with the
152
* transaction at the top of the undo stack.
153
* @param aManager the transaction manager ending a batch.
154
* @param aTopTransaction the transaction at the top of the undo stack.
155
* @param aTransactionToMerge the transaction to merge.
156
* @param aDidMerge true if transaction was merged, else false.
157
* @param aMergeResult the nsresult returned after the merge attempt.
158
* @param aInterrupt listeners should set this to PR_TRUE if they
159
* want to interrupt normal control flow, without throwing an error.
160
*/
161
void didMerge(in nsITransactionManager aManager,
162
in nsITransaction aTopTransaction,
163
in nsITransaction aTransactionToMerge,
164
in boolean aDidMerge,
165
in nsresult aMergeResult);
166
167
168
/* XXX: We should probably add pruning notification methods. */
169
};
170