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
4 *
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/
9 *
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
13 * License.
14 *
15 * The Original Code is mozilla.org code.
16 *
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.
21 *
22 * Contributor(s):
23 *
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.
35 *
36 * ***** END LICENSE BLOCK ***** */
37
38 #include "nsISupports.idl"
39 interface nsITransaction;
40
41 /*
42 * The nsITransactionList interface.
43 * <P>
44 * The implementation for this interface is provided by the Transaction Manager.
45 * This interface provides a mechanism for accessing the transactions on the
46 * Undo or Redo stacks as well as any auto-aggregated children that a
47 * transaction may have.
48 */
49 [scriptable, uuid(97f863f3-f886-11d4-9d39-0060b0f8baff)]
50
51 interface nsITransactionList : nsISupports
52 {
53 /**
54 * The number of transactions contained in this list.
55 */
56 readonly attribute long numItems;
57
58 /**
59 * itemIsBatch() returns true if the item at aIndex is a batch. Note that
60 * currently there is no requirement for a TransactionManager implementation
61 * to associate a toplevel nsITransaction with a batch so it is possible for
62 * itemIsBatch() to return true and getItem() to return null. However, you
63 * can still access the transactions contained in the batch with a call to
64 * getChildListForItem().
65 * @param aIndex The index of the item in the list.
66 */
67 boolean itemIsBatch(in long aIndex);
68
69 /**
70 * getItem() returns the transaction at the given index in the list. Note that
71 * a null can be returned here if the item is a batch. The transaction
72 * returned is AddRef'd so it is up to the caller to Release the transaction
73 * when it is done.
74 * @param aIndex The index of the item in the list.
75 */
76 nsITransaction getItem(in long aIndex);
77
78 /**
79 * getNumChildrenForItem() returns the number of child (auto-aggreated)
80 * transactions the item at aIndex has.
81 * @param aIndex The index of the item in the list.
82 */
83 long getNumChildrenForItem(in long aIndex);
84
85 /**
86 * getChildListForItem() returns the list of children associated with the
87 * item at aIndex. Implementations may return null if there are no children,
88 * or an empty list. The list returned is AddRef'd so it is up to the caller
89 * to Release the transaction when it is done.
90 * @param aIndex The index of the item in the list.
91 */
92 nsITransactionList getChildListForItem(in long aIndex);
93 };