nsITransaction.idl (2897B)
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 %{ C++ 9 namespace mozilla { 10 class EditTransactionBase; 11 } 12 template <typename T> 13 struct already_AddRefed; 14 %} 15 16 [ptr] native EditTransactionBasePtr(mozilla::EditTransactionBase); 17 18 /* 19 * The nsITransaction interface. 20 * <P> 21 * This interface is implemented by an object that needs to 22 * execute some behavior that must be tracked by the transaction manager. 23 */ 24 [scriptable, uuid(58e330c1-7b48-11d2-98b9-00805f297d89)] 25 interface nsITransaction : nsISupports 26 { 27 /** 28 * Executes the transaction. 29 */ 30 [can_run_script] 31 void doTransaction(); 32 33 /** 34 * Restores the state to what it was before the transaction was executed. 35 */ 36 [can_run_script] 37 void undoTransaction(); 38 39 /** 40 * Executes the transaction again. Can only be called on a transaction that 41 * was previously undone. 42 * <P> 43 * In most cases, the redoTransaction() method will actually call the 44 * doTransaction() method to execute the transaction again. 45 */ 46 [can_run_script] 47 void redoTransaction(); 48 49 /** 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. 59 */ 60 readonly attribute boolean isTransient; 61 62 /** 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. 73 */ 74 boolean merge(in nsITransaction aTransaction); 75 76 [noscript] EditTransactionBasePtr getAsEditTransactionBase(); 77 78 %{ C++ 79 inline already_AddRefed<mozilla::EditTransactionBase> 80 GetAsEditTransactionBase(); 81 %} 82 };