2001-09-26 02:53:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1998-11-20 00:43:21 +03:00
|
|
|
|
1998-11-20 00:58:58 +03:00
|
|
|
#ifndef nsTransactionManager_h__
|
|
|
|
#define nsTransactionManager_h__
|
1998-11-20 00:43:21 +03:00
|
|
|
|
2009-04-25 02:45:34 +04:00
|
|
|
#include "nsCOMArray.h"
|
2012-07-13 10:33:42 +04:00
|
|
|
#include "nsCOMPtr.h"
|
2009-05-09 08:59:25 +04:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2013-01-04 10:54:26 +04:00
|
|
|
#include "nsTransactionStack.h"
|
2012-07-13 10:33:42 +04:00
|
|
|
#include "nsISupportsImpl.h"
|
|
|
|
#include "nsITransactionManager.h"
|
2012-06-19 17:23:36 +04:00
|
|
|
#include "nsTransactionStack.h"
|
2012-07-13 10:33:42 +04:00
|
|
|
#include "nsWeakReference.h"
|
|
|
|
#include "nscore.h"
|
1999-06-03 19:26:48 +04:00
|
|
|
|
1999-05-27 01:16:25 +04:00
|
|
|
class nsITransaction;
|
|
|
|
class nsITransactionListener;
|
1998-11-20 00:43:21 +03:00
|
|
|
|
|
|
|
/** implementation of a transaction manager object.
|
|
|
|
*
|
|
|
|
*/
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsTransactionManager final : public nsITransactionManager
|
2015-03-27 21:52:19 +03:00
|
|
|
, public nsSupportsWeakReference
|
1998-11-20 00:43:21 +03:00
|
|
|
{
|
1998-11-21 04:02:55 +03:00
|
|
|
private:
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mMaxTransactionCount;
|
1998-12-01 21:38:52 +03:00
|
|
|
nsTransactionStack mDoStack;
|
1998-11-24 03:45:21 +03:00
|
|
|
nsTransactionStack mUndoStack;
|
2012-03-03 00:08:40 +04:00
|
|
|
nsTransactionStack mRedoStack;
|
2009-04-25 02:45:34 +04:00
|
|
|
nsCOMArray<nsITransactionListener> mListeners;
|
1998-11-21 04:02:55 +03:00
|
|
|
|
2014-06-24 02:40:02 +04:00
|
|
|
/** The default destructor.
|
|
|
|
*/
|
|
|
|
virtual ~nsTransactionManager();
|
|
|
|
|
1998-11-20 00:43:21 +03:00
|
|
|
public:
|
|
|
|
|
|
|
|
/** The default constructor.
|
|
|
|
*/
|
2014-09-01 07:33:43 +04:00
|
|
|
explicit nsTransactionManager(int32_t aMaxTransactionCount=-1);
|
1998-11-20 00:43:21 +03:00
|
|
|
|
|
|
|
/* Macro for AddRef(), Release(), and QueryInterface() */
|
2009-05-09 08:59:25 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsTransactionManager,
|
|
|
|
nsITransactionManager)
|
1998-11-20 00:43:21 +03:00
|
|
|
|
1998-11-20 03:43:07 +03:00
|
|
|
/* nsITransactionManager method implementations. */
|
2001-03-09 17:23:59 +03:00
|
|
|
NS_DECL_NSITRANSACTIONMANAGER
|
1998-11-21 04:02:55 +03:00
|
|
|
|
2012-06-19 17:23:36 +04:00
|
|
|
already_AddRefed<nsITransaction> PeekUndoStack();
|
|
|
|
already_AddRefed<nsITransaction> PeekRedoStack();
|
1999-02-08 20:28:33 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual nsresult WillDoNotify(nsITransaction *aTransaction, bool *aInterrupt);
|
2001-03-09 17:23:59 +03:00
|
|
|
virtual nsresult DidDoNotify(nsITransaction *aTransaction, nsresult aExecuteResult);
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual nsresult WillUndoNotify(nsITransaction *aTransaction, bool *aInterrupt);
|
1999-05-27 01:16:25 +04:00
|
|
|
virtual nsresult DidUndoNotify(nsITransaction *aTransaction, nsresult aUndoResult);
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual nsresult WillRedoNotify(nsITransaction *aTransaction, bool *aInterrupt);
|
1999-05-27 01:16:25 +04:00
|
|
|
virtual nsresult DidRedoNotify(nsITransaction *aTransaction, nsresult aRedoResult);
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual nsresult WillBeginBatchNotify(bool *aInterrupt);
|
1999-05-27 01:16:25 +04:00
|
|
|
virtual nsresult DidBeginBatchNotify(nsresult aResult);
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual nsresult WillEndBatchNotify(bool *aInterrupt);
|
1999-05-27 01:16:25 +04:00
|
|
|
virtual nsresult DidEndBatchNotify(nsresult aResult);
|
|
|
|
virtual nsresult WillMergeNotify(nsITransaction *aTop,
|
1999-11-11 22:35:40 +03:00
|
|
|
nsITransaction *aTransaction,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool *aInterrupt);
|
1999-05-27 01:16:25 +04:00
|
|
|
virtual nsresult DidMergeNotify(nsITransaction *aTop,
|
|
|
|
nsITransaction *aTransaction,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aDidMerge,
|
1999-05-27 01:16:25 +04:00
|
|
|
nsresult aMergeResult);
|
|
|
|
|
1999-02-08 20:28:33 +03:00
|
|
|
private:
|
|
|
|
|
|
|
|
/* nsTransactionManager specific private methods. */
|
2013-01-04 10:54:26 +04:00
|
|
|
virtual nsresult BeginTransaction(nsITransaction *aTransaction,
|
|
|
|
nsISupports *aData);
|
|
|
|
virtual nsresult EndTransaction(bool aAllowEmpty);
|
1998-11-20 00:43:21 +03:00
|
|
|
};
|
|
|
|
|
1998-11-20 00:58:58 +03:00
|
|
|
#endif // nsTransactionManager_h__
|