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