Wed, 31 Dec 2014 07:16:47 +0100
Revert simplistic fix pending revisit of Mozilla integration attempt.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef nsTransactionManager_h__ |
michael@0 | 7 | #define nsTransactionManager_h__ |
michael@0 | 8 | |
michael@0 | 9 | #include "nsCOMArray.h" |
michael@0 | 10 | #include "nsCOMPtr.h" |
michael@0 | 11 | #include "nsCycleCollectionParticipant.h" |
michael@0 | 12 | #include "nsTransactionStack.h" |
michael@0 | 13 | #include "nsISupportsImpl.h" |
michael@0 | 14 | #include "nsITransactionManager.h" |
michael@0 | 15 | #include "nsTransactionStack.h" |
michael@0 | 16 | #include "nsWeakReference.h" |
michael@0 | 17 | #include "nscore.h" |
michael@0 | 18 | |
michael@0 | 19 | class nsITransaction; |
michael@0 | 20 | class nsITransactionListener; |
michael@0 | 21 | class nsTransactionItem; |
michael@0 | 22 | |
michael@0 | 23 | /** implementation of a transaction manager object. |
michael@0 | 24 | * |
michael@0 | 25 | */ |
michael@0 | 26 | class nsTransactionManager : public nsITransactionManager |
michael@0 | 27 | , public nsSupportsWeakReference |
michael@0 | 28 | { |
michael@0 | 29 | private: |
michael@0 | 30 | |
michael@0 | 31 | int32_t mMaxTransactionCount; |
michael@0 | 32 | nsTransactionStack mDoStack; |
michael@0 | 33 | nsTransactionStack mUndoStack; |
michael@0 | 34 | nsTransactionStack mRedoStack; |
michael@0 | 35 | nsCOMArray<nsITransactionListener> mListeners; |
michael@0 | 36 | |
michael@0 | 37 | public: |
michael@0 | 38 | |
michael@0 | 39 | /** The default constructor. |
michael@0 | 40 | */ |
michael@0 | 41 | nsTransactionManager(int32_t aMaxTransactionCount=-1); |
michael@0 | 42 | |
michael@0 | 43 | /** The default destructor. |
michael@0 | 44 | */ |
michael@0 | 45 | virtual ~nsTransactionManager(); |
michael@0 | 46 | |
michael@0 | 47 | /* Macro for AddRef(), Release(), and QueryInterface() */ |
michael@0 | 48 | NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
michael@0 | 49 | NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsTransactionManager, |
michael@0 | 50 | nsITransactionManager) |
michael@0 | 51 | |
michael@0 | 52 | /* nsITransactionManager method implementations. */ |
michael@0 | 53 | NS_DECL_NSITRANSACTIONMANAGER |
michael@0 | 54 | |
michael@0 | 55 | already_AddRefed<nsITransaction> PeekUndoStack(); |
michael@0 | 56 | already_AddRefed<nsITransaction> PeekRedoStack(); |
michael@0 | 57 | |
michael@0 | 58 | virtual nsresult WillDoNotify(nsITransaction *aTransaction, bool *aInterrupt); |
michael@0 | 59 | virtual nsresult DidDoNotify(nsITransaction *aTransaction, nsresult aExecuteResult); |
michael@0 | 60 | virtual nsresult WillUndoNotify(nsITransaction *aTransaction, bool *aInterrupt); |
michael@0 | 61 | virtual nsresult DidUndoNotify(nsITransaction *aTransaction, nsresult aUndoResult); |
michael@0 | 62 | virtual nsresult WillRedoNotify(nsITransaction *aTransaction, bool *aInterrupt); |
michael@0 | 63 | virtual nsresult DidRedoNotify(nsITransaction *aTransaction, nsresult aRedoResult); |
michael@0 | 64 | virtual nsresult WillBeginBatchNotify(bool *aInterrupt); |
michael@0 | 65 | virtual nsresult DidBeginBatchNotify(nsresult aResult); |
michael@0 | 66 | virtual nsresult WillEndBatchNotify(bool *aInterrupt); |
michael@0 | 67 | virtual nsresult DidEndBatchNotify(nsresult aResult); |
michael@0 | 68 | virtual nsresult WillMergeNotify(nsITransaction *aTop, |
michael@0 | 69 | nsITransaction *aTransaction, |
michael@0 | 70 | bool *aInterrupt); |
michael@0 | 71 | virtual nsresult DidMergeNotify(nsITransaction *aTop, |
michael@0 | 72 | nsITransaction *aTransaction, |
michael@0 | 73 | bool aDidMerge, |
michael@0 | 74 | nsresult aMergeResult); |
michael@0 | 75 | |
michael@0 | 76 | private: |
michael@0 | 77 | |
michael@0 | 78 | /* nsTransactionManager specific private methods. */ |
michael@0 | 79 | virtual nsresult BeginTransaction(nsITransaction *aTransaction, |
michael@0 | 80 | nsISupports *aData); |
michael@0 | 81 | virtual nsresult EndTransaction(bool aAllowEmpty); |
michael@0 | 82 | }; |
michael@0 | 83 | |
michael@0 | 84 | #endif // nsTransactionManager_h__ |