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/. */
6 #include
"nsISupports.idl"
10 class EditTransactionBase
;
13 struct already_AddRefed
;
16 [ptr] native EditTransactionBasePtr
(mozilla
::EditTransactionBase
);
19 * The nsITransaction interface.
21 * This interface is implemented by an object that needs to
22 * execute some behavior that must be tracked by the transaction manager.
24 [scriptable
, uuid(58e330c1
-7b48
-11d2
-98b9
-00805f297d89
)]
25 interface nsITransaction
: nsISupports
28 * Executes the transaction.
34 * Restores the state to what it was before the transaction was executed.
37 void undoTransaction
();
40 * Executes the transaction again. Can only be called on a transaction that
41 * was previously undone.
43 * In most cases, the redoTransaction() method will actually call the
44 * doTransaction() method to execute the transaction again.
47 void redoTransaction
();
50 * The transaction's transient state. This attribute is checked by
51 * the transaction manager after the transaction's Execute() method is called.
52 * If the transient state is false, a reference to the transaction is
53 * held by the transaction manager so that the transactions' undoTransaction()
54 * and redoTransaction() methods can be called. If the transient state is
55 * true, the transaction manager returns immediately after the transaction's
56 * doTransaction() method is called, no references to the transaction are
57 * maintained. Transient transactions cannot be undone or redone by the
58 * transaction manager.
60 readonly attribute
boolean isTransient
;
63 * Attempts to merge a transaction into "this" transaction. Both transactions
64 * must be in their undo state, doTransaction() methods already called. The
65 * transaction manager calls this method to coalesce a new transaction with
66 * the transaction on the top of the undo stack.
67 * This method returns a boolean value that indicates the merge result.
68 * A true value indicates that the transactions were merged successfully,
69 * a false value if the merge was not possible or failed. If true,
70 * the transaction manager will Release() the new transacton instead of
71 * pushing it on the undo stack.
72 * @param aTransaction the previously executed transaction to merge.
74 boolean merge
(in nsITransaction aTransaction
);
76 [noscript
] EditTransactionBasePtr getAsEditTransactionBase
();
79 inline already_AddRefed
<mozilla
::EditTransactionBase
>
80 GetAsEditTransactionBase
();