2001-09-25 22:53:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00: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-12-01 18:35:49 +00:00
|
|
|
|
|
|
|
#ifndef nsTransactionItem_h__
|
|
|
|
#define nsTransactionItem_h__
|
|
|
|
|
2008-12-10 16:46:36 +00:00
|
|
|
#include "nsCOMPtr.h"
|
2013-01-04 06:54:26 +00:00
|
|
|
#include "nsCOMArray.h"
|
2009-05-09 04:59:25 +00:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2012-07-13 06:33:42 +00:00
|
|
|
#include "nsISupportsImpl.h"
|
|
|
|
#include "nscore.h"
|
2008-12-10 16:46:36 +00:00
|
|
|
|
2012-07-13 06:33:42 +00:00
|
|
|
class nsITransaction;
|
1999-05-26 21:16:25 +00:00
|
|
|
class nsTransactionManager;
|
2012-07-13 06:33:42 +00:00
|
|
|
class nsTransactionStack;
|
1998-12-01 18:35:49 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
class nsTransactionItem final
|
1998-12-01 18:35:49 +00:00
|
|
|
{
|
2013-01-04 06:54:26 +00:00
|
|
|
nsCOMArray<nsISupports> mData;
|
2008-12-10 16:46:36 +00:00
|
|
|
nsCOMPtr<nsITransaction> mTransaction;
|
|
|
|
nsTransactionStack *mUndoStack;
|
2012-03-02 20:08:40 +00:00
|
|
|
nsTransactionStack *mRedoStack;
|
1998-12-01 18:35:49 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2014-09-01 03:49:37 +00:00
|
|
|
explicit nsTransactionItem(nsITransaction *aTransaction);
|
2014-03-27 20:38:33 +00:00
|
|
|
NS_METHOD_(MozExternalRefCountType) AddRef();
|
|
|
|
NS_METHOD_(MozExternalRefCountType) Release();
|
1998-12-01 18:35:49 +00:00
|
|
|
|
2009-05-09 04:59:25 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsTransactionItem)
|
|
|
|
|
1998-12-01 18:35:49 +00:00
|
|
|
virtual nsresult AddChild(nsTransactionItem *aTransactionItem);
|
2012-06-19 13:23:36 +00:00
|
|
|
already_AddRefed<nsITransaction> GetTransaction();
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual nsresult GetIsBatch(bool *aIsBatch);
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual nsresult GetNumberOfChildren(int32_t *aNumChildren);
|
|
|
|
virtual nsresult GetChild(int32_t aIndex, nsTransactionItem **aChild);
|
1998-12-01 18:35:49 +00:00
|
|
|
|
2001-03-09 14:23:59 +00:00
|
|
|
virtual nsresult DoTransaction(void);
|
|
|
|
virtual nsresult UndoTransaction(nsTransactionManager *aTxMgr);
|
|
|
|
virtual nsresult RedoTransaction(nsTransactionManager *aTxMgr);
|
1998-12-01 18:35:49 +00:00
|
|
|
|
2013-01-04 06:54:26 +00:00
|
|
|
nsCOMArray<nsISupports>& GetData()
|
|
|
|
{
|
|
|
|
return mData;
|
|
|
|
}
|
|
|
|
|
1998-12-01 18:35:49 +00:00
|
|
|
private:
|
|
|
|
|
1999-05-26 21:16:25 +00:00
|
|
|
virtual nsresult UndoChildren(nsTransactionManager *aTxMgr);
|
|
|
|
virtual nsresult RedoChildren(nsTransactionManager *aTxMgr);
|
1998-12-04 21:50:09 +00:00
|
|
|
|
1999-05-26 21:16:25 +00:00
|
|
|
virtual nsresult RecoverFromUndoError(nsTransactionManager *aTxMgr);
|
|
|
|
virtual nsresult RecoverFromRedoError(nsTransactionManager *aTxMgr);
|
1998-12-01 18:35:49 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
virtual nsresult GetNumberOfUndoItems(int32_t *aNumItems);
|
|
|
|
virtual nsresult GetNumberOfRedoItems(int32_t *aNumItems);
|
2012-08-24 16:50:06 +00:00
|
|
|
|
2013-07-09 17:30:58 +00:00
|
|
|
void CleanUp();
|
2012-08-24 16:50:06 +00:00
|
|
|
protected:
|
2014-06-23 22:40:02 +00:00
|
|
|
virtual ~nsTransactionItem();
|
|
|
|
|
2012-08-24 16:50:06 +00:00
|
|
|
nsCycleCollectingAutoRefCnt mRefCnt;
|
|
|
|
NS_DECL_OWNINGTHREAD
|
1998-12-01 18:35:49 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsTransactionItem_h__
|