From c525b695b9c9428002707a88b8ff5a2c86591414 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Thu, 22 Mar 2018 22:15:54 +0900 Subject: [PATCH] Bug 1447924 - part 1: Rename nsTransactionManager to mozilla::TransactionManager r=m_kato We should rename nsTransactionManager to mozilla::TransactionManager before adding new non-virtual methods. MozReview-Commit-ID: JsivNVfDhex --HG-- rename : editor/txmgr/nsTransactionManager.cpp => editor/txmgr/TransactionManager.cpp rename : editor/txmgr/nsTransactionManager.h => editor/txmgr/TransactionManager.h rename : editor/txmgr/nsTransactionManagerFactory.cpp => editor/txmgr/TransactionManagerFactory.cpp extra : rebase_source : ff5bf76fec8be8f6a1202c17d488cf6c607d8f03 --- editor/libeditor/EditorBase.cpp | 93 +++++++-------- editor/libeditor/EditorBase.h | 4 +- ...tionManager.cpp => TransactionManager.cpp} | 109 ++++++++++-------- editor/txmgr/TransactionManager.h | 73 ++++++++++++ ...tory.cpp => TransactionManagerFactory.cpp} | 23 ++-- editor/txmgr/moz.build | 8 +- editor/txmgr/nsITransactionManager.idl | 16 ++- editor/txmgr/nsTransactionItem.cpp | 45 ++++---- editor/txmgr/nsTransactionItem.h | 40 ++++--- editor/txmgr/nsTransactionManager.h | 83 ------------- editor/txmgr/nsTransactionManagerCID.h | 11 +- 11 files changed, 260 insertions(+), 245 deletions(-) rename editor/txmgr/{nsTransactionManager.cpp => TransactionManager.cpp} (85%) create mode 100644 editor/txmgr/TransactionManager.h rename editor/txmgr/{nsTransactionManagerFactory.cpp => TransactionManagerFactory.cpp} (70%) delete mode 100644 editor/txmgr/nsTransactionManager.h diff --git a/editor/libeditor/EditorBase.cpp b/editor/libeditor/EditorBase.cpp index 7206193c6455..a52707c08e5d 100644 --- a/editor/libeditor/EditorBase.cpp +++ b/editor/libeditor/EditorBase.cpp @@ -48,6 +48,7 @@ #include "mozilla/TextInputListener.h" // for TextInputListener #include "mozilla/TextServicesDocument.h" // for TextServicesDocument #include "mozilla/TextEvents.h" +#include "mozilla/TransactionManager.h" // for TransactionManager #include "mozilla/dom/CharacterData.h" // for CharacterData #include "mozilla/dom/Element.h" // for Element, nsINode::AsElement #include "mozilla/dom/HTMLBodyElement.h" @@ -108,7 +109,6 @@ #include "nsStyleStructFwd.h" // for nsIFrame::StyleUIReset, etc. #include "nsTextNode.h" // for nsTextNode #include "nsThreadUtils.h" // for nsRunnable -#include "nsTransactionManager.h" // for nsTransactionManager #include "prtime.h" // for PR_Now class nsIOutputStream; @@ -180,7 +180,7 @@ EditorBase::~EditorBase() } // If this editor is still hiding the caret, we need to restore it. HideCaret(false); - mTxnMgr = nullptr; + mTransactionManager = nullptr; } NS_IMPL_CYCLE_COLLECTION_CLASS(EditorBase) @@ -193,7 +193,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(EditorBase) NS_IMPL_CYCLE_COLLECTION_UNLINK(mInlineSpellChecker) NS_IMPL_CYCLE_COLLECTION_UNLINK(mTextServicesDocument) NS_IMPL_CYCLE_COLLECTION_UNLINK(mTextInputListener) - NS_IMPL_CYCLE_COLLECTION_UNLINK(mTxnMgr) + NS_IMPL_CYCLE_COLLECTION_UNLINK(mTransactionManager) NS_IMPL_CYCLE_COLLECTION_UNLINK(mActionListeners) NS_IMPL_CYCLE_COLLECTION_UNLINK(mEditorObservers) NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocStateListeners) @@ -223,7 +223,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(EditorBase) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mInlineSpellChecker) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTextServicesDocument) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTextInputListener) - NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTxnMgr) + NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTransactionManager) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mActionListeners) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mEditorObservers) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocStateListeners) @@ -525,9 +525,9 @@ EditorBase::PreDestroy(bool aDestroyingFrames) // Transaction may grab this instance. Therefore, they should be released // here for stopping the circular reference with this instance. - if (mTxnMgr) { - mTxnMgr->Clear(); - mTxnMgr = nullptr; + if (mTransactionManager) { + mTransactionManager->Clear(); + mTransactionManager = nullptr; } mDidPreDestroy = true; @@ -746,8 +746,9 @@ EditorBase::DoTransaction(Selection* aSelection, nsITransaction* aTxn) // We will recurse, but will not hit this case in the nested call DoTransaction(mPlaceholderTransaction); - if (mTxnMgr) { - nsCOMPtr topTransaction = mTxnMgr->PeekUndoStack(); + if (mTransactionManager) { + nsCOMPtr topTransaction = + mTransactionManager->PeekUndoStack(); nsCOMPtr topAbsorbingTransaction = do_QueryInterface(topTransaction); if (topAbsorbingTransaction) { @@ -791,9 +792,9 @@ EditorBase::DoTransaction(Selection* aSelection, nsITransaction* aTxn) SelectionBatcher selectionBatcher(selection); nsresult rv; - if (mTxnMgr) { - RefPtr txnMgr = mTxnMgr; - rv = txnMgr->DoTransaction(aTxn); + if (mTransactionManager) { + RefPtr transactionManager(mTransactionManager); + rv = transactionManager->DoTransaction(aTxn); } else { rv = aTxn->DoTransaction(); } @@ -811,14 +812,14 @@ NS_IMETHODIMP EditorBase::EnableUndo(bool aEnable) { if (aEnable) { - if (!mTxnMgr) { - mTxnMgr = new nsTransactionManager(); + if (!mTransactionManager) { + mTransactionManager = new TransactionManager(); } - mTxnMgr->SetMaxTransactionCount(-1); - } else if (mTxnMgr) { + mTransactionManager->SetMaxTransactionCount(-1); + } else if (mTransactionManager) { // disable the transaction manager if it is enabled - mTxnMgr->Clear(); - mTxnMgr->SetMaxTransactionCount(0); + mTransactionManager->Clear(); + mTransactionManager->SetMaxTransactionCount(0); } return NS_OK; @@ -834,11 +835,12 @@ EditorBase::GetNumberOfUndoItems(int32_t* aNumItems) int32_t EditorBase::NumberOfUndoItems() const { - if (!mTxnMgr) { + if (!mTransactionManager) { return 0; } int32_t numItems = 0; - if (NS_WARN_IF(NS_FAILED(mTxnMgr->GetNumberOfUndoItems(&numItems)))) { + nsresult rv = mTransactionManager->GetNumberOfUndoItems(&numItems); + if (NS_WARN_IF(NS_FAILED(rv))) { return -1; } return numItems; @@ -854,11 +856,12 @@ EditorBase::GetNumberOfRedoItems(int32_t* aNumItems) int32_t EditorBase::NumberOfRedoItems() const { - if (!mTxnMgr) { + if (!mTransactionManager) { return 0; } int32_t numItems = 0; - if (NS_WARN_IF(NS_FAILED(mTxnMgr->GetNumberOfRedoItems(&numItems)))) { + nsresult rv = mTransactionManager->GetNumberOfRedoItems(&numItems); + if (NS_WARN_IF(NS_FAILED(rv))) { return -1; } return numItems; @@ -882,7 +885,7 @@ EditorBase::GetTransactionManager(nsITransactionManager** aTxnManager) already_AddRefed EditorBase::GetTransactionManager() const { - nsCOMPtr transactionManager = mTxnMgr.get(); + nsCOMPtr transactionManager(mTransactionManager); return transactionManager.forget(); } @@ -891,19 +894,19 @@ EditorBase::Undo(uint32_t aCount) { ForceCompositionEnd(); - bool hasTxnMgr, hasTransaction = false; - CanUndo(&hasTxnMgr, &hasTransaction); + bool hasTransactionManager, hasTransaction = false; + CanUndo(&hasTransactionManager, &hasTransaction); NS_ENSURE_TRUE(hasTransaction, NS_OK); AutoRules beginRulesSniffing(this, EditAction::undo, nsIEditor::eNone); - if (!mTxnMgr) { + if (!mTransactionManager) { return NS_OK; } - RefPtr txnMgr = mTxnMgr; + RefPtr transactionManager(mTransactionManager); for (uint32_t i = 0; i < aCount; ++i) { - nsresult rv = txnMgr->UndoTransaction(); + nsresult rv = transactionManager->UndoTransaction(); NS_ENSURE_SUCCESS(rv, rv); DoAfterUndoTransaction(); @@ -917,10 +920,10 @@ EditorBase::CanUndo(bool* aIsEnabled, bool* aCanUndo) { NS_ENSURE_TRUE(aIsEnabled && aCanUndo, NS_ERROR_NULL_POINTER); - *aIsEnabled = !!mTxnMgr; + *aIsEnabled = !!mTransactionManager; if (*aIsEnabled) { int32_t numTxns = 0; - mTxnMgr->GetNumberOfUndoItems(&numTxns); + mTransactionManager->GetNumberOfUndoItems(&numTxns); *aCanUndo = !!numTxns; } else { *aCanUndo = false; @@ -931,19 +934,19 @@ EditorBase::CanUndo(bool* aIsEnabled, NS_IMETHODIMP EditorBase::Redo(uint32_t aCount) { - bool hasTxnMgr, hasTransaction = false; - CanRedo(&hasTxnMgr, &hasTransaction); + bool hasTransactionManager, hasTransaction = false; + CanRedo(&hasTransactionManager, &hasTransaction); NS_ENSURE_TRUE(hasTransaction, NS_OK); AutoRules beginRulesSniffing(this, EditAction::redo, nsIEditor::eNone); - if (!mTxnMgr) { + if (!mTransactionManager) { return NS_OK; } - RefPtr txnMgr = mTxnMgr; + RefPtr transactionManager(mTransactionManager); for (uint32_t i = 0; i < aCount; ++i) { - nsresult rv = txnMgr->RedoTransaction(); + nsresult rv = transactionManager->RedoTransaction(); NS_ENSURE_SUCCESS(rv, rv); DoAfterRedoTransaction(); @@ -957,10 +960,10 @@ EditorBase::CanRedo(bool* aIsEnabled, bool* aCanRedo) { NS_ENSURE_TRUE(aIsEnabled && aCanRedo, NS_ERROR_NULL_POINTER); - *aIsEnabled = !!mTxnMgr; + *aIsEnabled = !!mTransactionManager; if (*aIsEnabled) { int32_t numTxns = 0; - mTxnMgr->GetNumberOfRedoItems(&numTxns); + mTransactionManager->GetNumberOfRedoItems(&numTxns); *aCanRedo = !!numTxns; } else { *aCanRedo = false; @@ -973,9 +976,9 @@ EditorBase::BeginTransaction() { BeginUpdateViewBatch(); - if (mTxnMgr) { - RefPtr txnMgr = mTxnMgr; - txnMgr->BeginBatch(nullptr); + if (mTransactionManager) { + RefPtr transactionManager(mTransactionManager); + transactionManager->BeginBatch(nullptr); } return NS_OK; @@ -984,9 +987,9 @@ EditorBase::BeginTransaction() NS_IMETHODIMP EditorBase::EndTransaction() { - if (mTxnMgr) { - RefPtr txnMgr = mTxnMgr; - txnMgr->EndBatch(false); + if (mTransactionManager) { + RefPtr transactionManager(mTransactionManager); + transactionManager->EndBatch(false); } EndUpdateViewBatch(); @@ -2471,8 +2474,8 @@ EditorBase::EndIMEComposition() // commit the IME transaction..we can get at it via the transaction mgr. // Note that this means IME won't work without an undo stack! - if (mTxnMgr) { - nsCOMPtr txn = mTxnMgr->PeekUndoStack(); + if (mTransactionManager) { + nsCOMPtr txn = mTransactionManager->PeekUndoStack(); nsCOMPtr plcTxn = do_QueryInterface(txn); if (plcTxn) { DebugOnly rv = plcTxn->Commit(); diff --git a/editor/libeditor/EditorBase.h b/editor/libeditor/EditorBase.h index e274fc79da24..d86ecda78ede 100644 --- a/editor/libeditor/EditorBase.h +++ b/editor/libeditor/EditorBase.h @@ -51,7 +51,6 @@ class nsISupports; class nsITransaction; class nsIWidget; class nsRange; -class nsTransactionManager; namespace mozilla { class AddStyleSheetTransaction; @@ -80,6 +79,7 @@ class TextComposition; class TextEditor; class TextInputListener; class TextServicesDocument; +class TransactionManager; enum class EditAction : int32_t; namespace dom { @@ -1513,7 +1513,7 @@ protected: // Reference to text services document for mInlineSpellChecker. RefPtr mTextServicesDocument; - RefPtr mTxnMgr; + RefPtr mTransactionManager; // Cached root node. nsCOMPtr mRootElement; // The form field as an event receiver. diff --git a/editor/txmgr/nsTransactionManager.cpp b/editor/txmgr/TransactionManager.cpp similarity index 85% rename from editor/txmgr/nsTransactionManager.cpp rename to editor/txmgr/TransactionManager.cpp index 1d11cc688c59..4ad6722e1475 100644 --- a/editor/txmgr/nsTransactionManager.cpp +++ b/editor/txmgr/TransactionManager.cpp @@ -3,6 +3,8 @@ * 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/. */ +#include "mozilla/TransactionManager.h" + #include "mozilla/Assertions.h" #include "mozilla/mozalloc.h" #include "nsCOMPtr.h" @@ -14,10 +16,11 @@ #include "nsITransactionListener.h" #include "nsIWeakReference.h" #include "nsTransactionItem.h" -#include "nsTransactionManager.h" #include "nsTransactionStack.h" -nsTransactionManager::nsTransactionManager(int32_t aMaxTransactionCount) +namespace mozilla { + +TransactionManager::TransactionManager(int32_t aMaxTransactionCount) : mMaxTransactionCount(aMaxTransactionCount) , mDoStack(nsTransactionStack::FOR_UNDO) , mUndoStack(nsTransactionStack::FOR_UNDO) @@ -25,37 +28,33 @@ nsTransactionManager::nsTransactionManager(int32_t aMaxTransactionCount) { } -nsTransactionManager::~nsTransactionManager() -{ -} +NS_IMPL_CYCLE_COLLECTION_CLASS(TransactionManager) -NS_IMPL_CYCLE_COLLECTION_CLASS(nsTransactionManager) - -NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsTransactionManager) +NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(TransactionManager) NS_IMPL_CYCLE_COLLECTION_UNLINK(mListeners) tmp->mDoStack.DoUnlink(); tmp->mUndoStack.DoUnlink(); tmp->mRedoStack.DoUnlink(); NS_IMPL_CYCLE_COLLECTION_UNLINK_END -NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsTransactionManager) +NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(TransactionManager) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mListeners) tmp->mDoStack.DoTraverse(cb); tmp->mUndoStack.DoTraverse(cb); tmp->mRedoStack.DoTraverse(cb); NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END -NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsTransactionManager) +NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TransactionManager) NS_INTERFACE_MAP_ENTRY(nsITransactionManager) NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsITransactionManager) NS_INTERFACE_MAP_END -NS_IMPL_CYCLE_COLLECTING_ADDREF(nsTransactionManager) -NS_IMPL_CYCLE_COLLECTING_RELEASE(nsTransactionManager) +NS_IMPL_CYCLE_COLLECTING_ADDREF(TransactionManager) +NS_IMPL_CYCLE_COLLECTING_RELEASE(TransactionManager) NS_IMETHODIMP -nsTransactionManager::DoTransaction(nsITransaction *aTransaction) +TransactionManager::DoTransaction(nsITransaction* aTransaction) { NS_ENSURE_TRUE(aTransaction, NS_ERROR_NULL_POINTER); @@ -88,7 +87,7 @@ nsTransactionManager::DoTransaction(nsITransaction *aTransaction) } NS_IMETHODIMP -nsTransactionManager::UndoTransaction() +TransactionManager::UndoTransaction() { // It is illegal to call UndoTransaction() while the transaction manager is // executing a transaction's DoTransaction() method! If this happens, @@ -132,7 +131,7 @@ nsTransactionManager::UndoTransaction() } NS_IMETHODIMP -nsTransactionManager::RedoTransaction() +TransactionManager::RedoTransaction() { // It is illegal to call RedoTransaction() while the transaction manager is // executing a transaction's DoTransaction() method! If this happens, @@ -176,7 +175,7 @@ nsTransactionManager::RedoTransaction() } NS_IMETHODIMP -nsTransactionManager::Clear() +TransactionManager::Clear() { nsresult rv = ClearRedoStack(); if (NS_FAILED(rv)) { @@ -186,7 +185,7 @@ nsTransactionManager::Clear() } NS_IMETHODIMP -nsTransactionManager::BeginBatch(nsISupports* aData) +TransactionManager::BeginBatch(nsISupports* aData) { // We can batch independent transactions together by simply pushing // a dummy transaction item on the do stack. This dummy transaction item @@ -214,7 +213,7 @@ nsTransactionManager::BeginBatch(nsISupports* aData) } NS_IMETHODIMP -nsTransactionManager::EndBatch(bool aAllowEmpty) +TransactionManager::EndBatch(bool aAllowEmpty) { // XXX: Need to add some mechanism to detect the case where the transaction // at the top of the do stack isn't the dummy transaction, so we can @@ -256,21 +255,21 @@ nsTransactionManager::EndBatch(bool aAllowEmpty) } NS_IMETHODIMP -nsTransactionManager::GetNumberOfUndoItems(int32_t *aNumItems) +TransactionManager::GetNumberOfUndoItems(int32_t* aNumItems) { *aNumItems = mUndoStack.GetSize(); return NS_OK; } NS_IMETHODIMP -nsTransactionManager::GetNumberOfRedoItems(int32_t *aNumItems) +TransactionManager::GetNumberOfRedoItems(int32_t* aNumItems) { *aNumItems = mRedoStack.GetSize(); return NS_OK; } NS_IMETHODIMP -nsTransactionManager::GetMaxTransactionCount(int32_t *aMaxCount) +TransactionManager::GetMaxTransactionCount(int32_t* aMaxCount) { NS_ENSURE_TRUE(aMaxCount, NS_ERROR_NULL_POINTER); *aMaxCount = mMaxTransactionCount; @@ -278,7 +277,7 @@ nsTransactionManager::GetMaxTransactionCount(int32_t *aMaxCount) } NS_IMETHODIMP -nsTransactionManager::SetMaxTransactionCount(int32_t aMaxCount) +TransactionManager::SetMaxTransactionCount(int32_t aMaxCount) { // It is illegal to call SetMaxTransactionCount() while the transaction // manager is executing a transaction's DoTransaction() method because @@ -332,7 +331,7 @@ nsTransactionManager::SetMaxTransactionCount(int32_t aMaxCount) } NS_IMETHODIMP -nsTransactionManager::PeekUndoStack(nsITransaction **aTransaction) +TransactionManager::PeekUndoStack(nsITransaction** aTransaction) { MOZ_ASSERT(aTransaction); *aTransaction = PeekUndoStack().take(); @@ -340,7 +339,7 @@ nsTransactionManager::PeekUndoStack(nsITransaction **aTransaction) } already_AddRefed -nsTransactionManager::PeekUndoStack() +TransactionManager::PeekUndoStack() { RefPtr tx = mUndoStack.Peek(); if (!tx) { @@ -350,7 +349,7 @@ nsTransactionManager::PeekUndoStack() } NS_IMETHODIMP -nsTransactionManager::PeekRedoStack(nsITransaction** aTransaction) +TransactionManager::PeekRedoStack(nsITransaction** aTransaction) { MOZ_ASSERT(aTransaction); *aTransaction = PeekRedoStack().take(); @@ -358,7 +357,7 @@ nsTransactionManager::PeekRedoStack(nsITransaction** aTransaction) } already_AddRefed -nsTransactionManager::PeekRedoStack() +TransactionManager::PeekRedoStack() { RefPtr tx = mRedoStack.Peek(); if (!tx) { @@ -368,7 +367,7 @@ nsTransactionManager::PeekRedoStack() } nsresult -nsTransactionManager::BatchTopUndo() +TransactionManager::BatchTopUndo() { if (mUndoStack.GetSize() < 2) { // Not enough transactions to merge into one batch. @@ -396,7 +395,7 @@ nsTransactionManager::BatchTopUndo() } nsresult -nsTransactionManager::RemoveTopUndo() +TransactionManager::RemoveTopUndo() { if (mUndoStack.IsEmpty()) { return NS_OK; @@ -407,35 +406,36 @@ nsTransactionManager::RemoveTopUndo() } NS_IMETHODIMP -nsTransactionManager::AddListener(nsITransactionListener *aListener) +TransactionManager::AddListener(nsITransactionListener* aListener) { NS_ENSURE_TRUE(aListener, NS_ERROR_NULL_POINTER); return mListeners.AppendObject(aListener) ? NS_OK : NS_ERROR_FAILURE; } NS_IMETHODIMP -nsTransactionManager::RemoveListener(nsITransactionListener *aListener) +TransactionManager::RemoveListener(nsITransactionListener* aListener) { NS_ENSURE_TRUE(aListener, NS_ERROR_NULL_POINTER); return mListeners.RemoveObject(aListener) ? NS_OK : NS_ERROR_FAILURE; } NS_IMETHODIMP -nsTransactionManager::ClearUndoStack() +TransactionManager::ClearUndoStack() { mUndoStack.Clear(); return NS_OK; } NS_IMETHODIMP -nsTransactionManager::ClearRedoStack() +TransactionManager::ClearRedoStack() { mRedoStack.Clear(); return NS_OK; } nsresult -nsTransactionManager::WillDoNotify(nsITransaction *aTransaction, bool *aInterrupt) +TransactionManager::WillDoNotify(nsITransaction* aTransaction, + bool* aInterrupt) { for (int32_t i = 0, lcount = mListeners.Count(); i < lcount; i++) { nsITransactionListener* listener = mListeners[i]; @@ -450,7 +450,8 @@ nsTransactionManager::WillDoNotify(nsITransaction *aTransaction, bool *aInterrup } nsresult -nsTransactionManager::DidDoNotify(nsITransaction *aTransaction, nsresult aDoResult) +TransactionManager::DidDoNotify(nsITransaction* aTransaction, + nsresult aDoResult) { for (int32_t i = 0, lcount = mListeners.Count(); i < lcount; i++) { nsITransactionListener* listener = mListeners[i]; @@ -465,7 +466,8 @@ nsTransactionManager::DidDoNotify(nsITransaction *aTransaction, nsresult aDoResu } nsresult -nsTransactionManager::WillUndoNotify(nsITransaction *aTransaction, bool *aInterrupt) +TransactionManager::WillUndoNotify(nsITransaction* aTransaction, + bool* aInterrupt) { for (int32_t i = 0, lcount = mListeners.Count(); i < lcount; i++) { nsITransactionListener* listener = mListeners[i]; @@ -480,7 +482,8 @@ nsTransactionManager::WillUndoNotify(nsITransaction *aTransaction, bool *aInterr } nsresult -nsTransactionManager::DidUndoNotify(nsITransaction *aTransaction, nsresult aUndoResult) +TransactionManager::DidUndoNotify(nsITransaction* aTransaction, + nsresult aUndoResult) { for (int32_t i = 0, lcount = mListeners.Count(); i < lcount; i++) { nsITransactionListener* listener = mListeners[i]; @@ -495,7 +498,8 @@ nsTransactionManager::DidUndoNotify(nsITransaction *aTransaction, nsresult aUndo } nsresult -nsTransactionManager::WillRedoNotify(nsITransaction *aTransaction, bool *aInterrupt) +TransactionManager::WillRedoNotify(nsITransaction* aTransaction, + bool* aInterrupt) { for (int32_t i = 0, lcount = mListeners.Count(); i < lcount; i++) { nsITransactionListener* listener = mListeners[i]; @@ -510,7 +514,8 @@ nsTransactionManager::WillRedoNotify(nsITransaction *aTransaction, bool *aInterr } nsresult -nsTransactionManager::DidRedoNotify(nsITransaction *aTransaction, nsresult aRedoResult) +TransactionManager::DidRedoNotify(nsITransaction* aTransaction, + nsresult aRedoResult) { for (int32_t i = 0, lcount = mListeners.Count(); i < lcount; i++) { nsITransactionListener* listener = mListeners[i]; @@ -525,7 +530,7 @@ nsTransactionManager::DidRedoNotify(nsITransaction *aTransaction, nsresult aRedo } nsresult -nsTransactionManager::WillBeginBatchNotify(bool *aInterrupt) +TransactionManager::WillBeginBatchNotify(bool* aInterrupt) { for (int32_t i = 0, lcount = mListeners.Count(); i < lcount; i++) { nsITransactionListener* listener = mListeners[i]; @@ -540,7 +545,7 @@ nsTransactionManager::WillBeginBatchNotify(bool *aInterrupt) } nsresult -nsTransactionManager::DidBeginBatchNotify(nsresult aResult) +TransactionManager::DidBeginBatchNotify(nsresult aResult) { for (int32_t i = 0, lcount = mListeners.Count(); i < lcount; i++) { nsITransactionListener* listener = mListeners[i]; @@ -555,7 +560,7 @@ nsTransactionManager::DidBeginBatchNotify(nsresult aResult) } nsresult -nsTransactionManager::WillEndBatchNotify(bool *aInterrupt) +TransactionManager::WillEndBatchNotify(bool* aInterrupt) { for (int32_t i = 0, lcount = mListeners.Count(); i < lcount; i++) { nsITransactionListener* listener = mListeners[i]; @@ -570,7 +575,7 @@ nsTransactionManager::WillEndBatchNotify(bool *aInterrupt) } nsresult -nsTransactionManager::DidEndBatchNotify(nsresult aResult) +TransactionManager::DidEndBatchNotify(nsresult aResult) { for (int32_t i = 0, lcount = mListeners.Count(); i < lcount; i++) { nsITransactionListener* listener = mListeners[i]; @@ -585,7 +590,9 @@ nsTransactionManager::DidEndBatchNotify(nsresult aResult) } nsresult -nsTransactionManager::WillMergeNotify(nsITransaction *aTop, nsITransaction *aTransaction, bool *aInterrupt) +TransactionManager::WillMergeNotify(nsITransaction* aTop, + nsITransaction* aTransaction, + bool* aInterrupt) { for (int32_t i = 0, lcount = mListeners.Count(); i < lcount; i++) { nsITransactionListener* listener = mListeners[i]; @@ -600,10 +607,10 @@ nsTransactionManager::WillMergeNotify(nsITransaction *aTop, nsITransaction *aTra } nsresult -nsTransactionManager::DidMergeNotify(nsITransaction *aTop, - nsITransaction *aTransaction, - bool aDidMerge, - nsresult aMergeResult) +TransactionManager::DidMergeNotify(nsITransaction* aTop, + nsITransaction* aTransaction, + bool aDidMerge, + nsresult aMergeResult) { for (int32_t i = 0, lcount = mListeners.Count(); i < lcount; i++) { nsITransactionListener* listener = mListeners[i]; @@ -619,8 +626,8 @@ nsTransactionManager::DidMergeNotify(nsITransaction *aTop, } nsresult -nsTransactionManager::BeginTransaction(nsITransaction *aTransaction, - nsISupports *aData) +TransactionManager::BeginTransaction(nsITransaction* aTransaction, + nsISupports* aData) { // XXX: POSSIBLE OPTIMIZATION // We could use a factory that pre-allocates/recycles transaction items. @@ -645,7 +652,7 @@ nsTransactionManager::BeginTransaction(nsITransaction *aTransaction, } nsresult -nsTransactionManager::EndTransaction(bool aAllowEmpty) +TransactionManager::EndTransaction(bool aAllowEmpty) { RefPtr tx = mDoStack.Pop(); if (!tx) { @@ -728,3 +735,5 @@ nsTransactionManager::EndTransaction(bool aAllowEmpty) mUndoStack.Push(tx.forget()); return NS_OK; } + +} // namespace mozilla diff --git a/editor/txmgr/TransactionManager.h b/editor/txmgr/TransactionManager.h new file mode 100644 index 000000000000..12688b79d03b --- /dev/null +++ b/editor/txmgr/TransactionManager.h @@ -0,0 +1,73 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* 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/. */ + +#ifndef mozilla_TransactionManager_h +#define mozilla_TransactionManager_h + +#include "nsCOMArray.h" +#include "nsCOMPtr.h" +#include "nsCycleCollectionParticipant.h" +#include "nsTransactionStack.h" +#include "nsISupportsImpl.h" +#include "nsITransactionManager.h" +#include "nsTransactionStack.h" +#include "nsWeakReference.h" +#include "nscore.h" + +class nsITransaction; +class nsITransactionListener; + +namespace mozilla { + +class TransactionManager final : public nsITransactionManager + , public nsSupportsWeakReference +{ +public: + explicit TransactionManager(int32_t aMaxTransactionCount = -1); + + NS_DECL_CYCLE_COLLECTING_ISUPPORTS + NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(TransactionManager, + nsITransactionManager) + + NS_DECL_NSITRANSACTIONMANAGER + + already_AddRefed PeekUndoStack(); + already_AddRefed PeekRedoStack(); + + nsresult WillDoNotify(nsITransaction* aTransaction, bool* aInterrupt); + nsresult DidDoNotify(nsITransaction* aTransaction, nsresult aExecuteResult); + nsresult WillUndoNotify(nsITransaction* aTransaction, bool* aInterrupt); + nsresult DidUndoNotify(nsITransaction* aTransaction, nsresult aUndoResult); + nsresult WillRedoNotify(nsITransaction* aTransaction, bool *aInterrupt); + nsresult DidRedoNotify(nsITransaction* aTransaction, nsresult aRedoResult); + nsresult WillBeginBatchNotify(bool* aInterrupt); + nsresult DidBeginBatchNotify(nsresult aResult); + nsresult WillEndBatchNotify(bool* aInterrupt); + nsresult DidEndBatchNotify(nsresult aResult); + nsresult WillMergeNotify(nsITransaction* aTop, + nsITransaction* aTransaction, + bool* aInterrupt); + nsresult DidMergeNotify(nsITransaction* aTop, + nsITransaction* aTransaction, + bool aDidMerge, + nsresult aMergeResult); + +private: + virtual ~TransactionManager() = default; + + nsresult BeginTransaction(nsITransaction* aTransaction, + nsISupports* aData); + nsresult EndTransaction(bool aAllowEmpty); + + int32_t mMaxTransactionCount; + nsTransactionStack mDoStack; + nsTransactionStack mUndoStack; + nsTransactionStack mRedoStack; + nsCOMArray mListeners; +}; + +} // namespace mozilla + +#endif // #ifndef mozilla_TransactionManager_h diff --git a/editor/txmgr/nsTransactionManagerFactory.cpp b/editor/txmgr/TransactionManagerFactory.cpp similarity index 70% rename from editor/txmgr/nsTransactionManagerFactory.cpp rename to editor/txmgr/TransactionManagerFactory.cpp index a4cbb5950046..94876e8462cc 100644 --- a/editor/txmgr/nsTransactionManagerFactory.cpp +++ b/editor/txmgr/TransactionManagerFactory.cpp @@ -7,32 +7,35 @@ #include "mozilla/Module.h" #include "mozilla/ModuleUtils.h" +#include "mozilla/TransactionManager.h" #include "nsID.h" #include "nsITransactionManager.h" -#include "nsTransactionManager.h" -#include "nsTransactionManagerCID.h" + +using mozilla::TransactionManager; //////////////////////////////////////////////////////////////////////// // Define the contructor function for the objects // // NOTE: This creates an instance of objects by using the default constructor // -NS_GENERIC_FACTORY_CONSTRUCTOR(nsTransactionManager) +NS_GENERIC_FACTORY_CONSTRUCTOR(TransactionManager) NS_DEFINE_NAMED_CID(NS_TRANSACTIONMANAGER_CID); static const mozilla::Module::CIDEntry kTxMgrCIDs[] = { - { &kNS_TRANSACTIONMANAGER_CID, false, nullptr, nsTransactionManagerConstructor }, - { nullptr } + { &kNS_TRANSACTIONMANAGER_CID, false, nullptr, + TransactionManagerConstructor }, + { nullptr } }; static const mozilla::Module::ContractIDEntry kTxMgrContracts[] = { - { NS_TRANSACTIONMANAGER_CONTRACTID, &kNS_TRANSACTIONMANAGER_CID }, - { nullptr } + { NS_TRANSACTIONMANAGER_CONTRACTID, &kNS_TRANSACTIONMANAGER_CID }, + { nullptr } }; static const mozilla::Module kTxMgrModule = { - mozilla::Module::kVersion, - kTxMgrCIDs, - kTxMgrContracts + mozilla::Module::kVersion, + kTxMgrCIDs, + kTxMgrContracts }; + NSMODULE_DEFN(nsTransactionManagerModule) = &kTxMgrModule; diff --git a/editor/txmgr/moz.build b/editor/txmgr/moz.build index 38f54f9681d8..d624c6b82f71 100644 --- a/editor/txmgr/moz.build +++ b/editor/txmgr/moz.build @@ -18,11 +18,15 @@ EXPORTS += [ 'nsTransactionManagerCID.h', ] +EXPORTS.mozilla += [ + 'TransactionManager.h', +] + UNIFIED_SOURCES += [ 'nsTransactionItem.cpp', - 'nsTransactionManager.cpp', - 'nsTransactionManagerFactory.cpp', 'nsTransactionStack.cpp', + 'TransactionManager.cpp', + 'TransactionManagerFactory.cpp', ] FINAL_LIBRARY = 'xul' diff --git a/editor/txmgr/nsITransactionManager.idl b/editor/txmgr/nsITransactionManager.idl index e2e3b0a509e7..1109f5b2a598 100644 --- a/editor/txmgr/nsITransactionManager.idl +++ b/editor/txmgr/nsITransactionManager.idl @@ -7,12 +7,6 @@ #include "nsITransaction.idl" #include "nsITransactionListener.idl" -%{ C++ - -#define NS_TRANSACTIONMANAGER_CONTRACTID "@mozilla.org/transactionmanager;1" - -%} C++ - /** * The nsITransactionManager interface. *

@@ -151,3 +145,13 @@ interface nsITransactionManager : nsISupports void RemoveListener(in nsITransactionListener aListener); }; +%{ C++ + +#define NS_TRANSACTIONMANAGER_CONTRACTID "@mozilla.org/transactionmanager;1" + +// 9C8F9601-801A-11d2-98BA-00805F297D89 +#define NS_TRANSACTIONMANAGER_CID \ +{ 0x9c8f9601, 0x801a, 0x11d2, \ + { 0x98, 0xba, 0x0, 0x80, 0x5f, 0x29, 0x7d, 0x89 } } + +%} C++ diff --git a/editor/txmgr/nsTransactionItem.cpp b/editor/txmgr/nsTransactionItem.cpp index afea20a0be42..73051953c49f 100644 --- a/editor/txmgr/nsTransactionItem.cpp +++ b/editor/txmgr/nsTransactionItem.cpp @@ -3,16 +3,19 @@ * 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/. */ +#include "nsTransactionItem.h" + #include "mozilla/mozalloc.h" +#include "mozilla/TransactionManager.h" #include "nsCOMPtr.h" #include "nsDebug.h" #include "nsError.h" #include "nsISupportsImpl.h" #include "nsITransaction.h" -#include "nsTransactionItem.h" -#include "nsTransactionManager.h" #include "nsTransactionStack.h" +using namespace mozilla; + nsTransactionItem::nsTransactionItem(nsITransaction *aTransaction) : mTransaction(aTransaction), mUndoStack(0), mRedoStack(0) { @@ -159,11 +162,11 @@ nsTransactionItem::DoTransaction() } nsresult -nsTransactionItem::UndoTransaction(nsTransactionManager *aTxMgr) +nsTransactionItem::UndoTransaction(TransactionManager* aTransactionManager) { - nsresult rv = UndoChildren(aTxMgr); + nsresult rv = UndoChildren(aTransactionManager); if (NS_FAILED(rv)) { - RecoverFromUndoError(aTxMgr); + RecoverFromUndoError(aTransactionManager); return rv; } @@ -173,7 +176,7 @@ nsTransactionItem::UndoTransaction(nsTransactionManager *aTxMgr) rv = mTransaction->UndoTransaction(); if (NS_FAILED(rv)) { - RecoverFromUndoError(aTxMgr); + RecoverFromUndoError(aTransactionManager); return rv; } @@ -181,7 +184,7 @@ nsTransactionItem::UndoTransaction(nsTransactionManager *aTxMgr) } nsresult -nsTransactionItem::UndoChildren(nsTransactionManager *aTxMgr) +nsTransactionItem::UndoChildren(TransactionManager* aTransactionManager) { if (mUndoStack) { if (!mRedoStack && mUndoStack) { @@ -200,7 +203,7 @@ nsTransactionItem::UndoChildren(nsTransactionManager *aTxMgr) nsCOMPtr t = item->GetTransaction(); bool doInterrupt = false; - rv = aTxMgr->WillUndoNotify(t, &doInterrupt); + rv = aTransactionManager->WillUndoNotify(t, &doInterrupt); if (NS_FAILED(rv)) { return rv; } @@ -208,13 +211,13 @@ nsTransactionItem::UndoChildren(nsTransactionManager *aTxMgr) return NS_OK; } - rv = item->UndoTransaction(aTxMgr); + rv = item->UndoTransaction(aTransactionManager); if (NS_SUCCEEDED(rv)) { item = mUndoStack->Pop(); mRedoStack->Push(item.forget()); } - nsresult rv2 = aTxMgr->DidUndoNotify(t, rv); + nsresult rv2 = aTransactionManager->DidUndoNotify(t, rv); if (NS_SUCCEEDED(rv)) { rv = rv2; } @@ -229,7 +232,7 @@ nsTransactionItem::UndoChildren(nsTransactionManager *aTxMgr) } nsresult -nsTransactionItem::RedoTransaction(nsTransactionManager *aTxMgr) +nsTransactionItem::RedoTransaction(TransactionManager* aTransactionManager) { nsCOMPtr transaction(mTransaction); if (transaction) { @@ -237,9 +240,9 @@ nsTransactionItem::RedoTransaction(nsTransactionManager *aTxMgr) NS_ENSURE_SUCCESS(rv, rv); } - nsresult rv = RedoChildren(aTxMgr); + nsresult rv = RedoChildren(aTransactionManager); if (NS_FAILED(rv)) { - RecoverFromRedoError(aTxMgr); + RecoverFromRedoError(aTransactionManager); return rv; } @@ -247,7 +250,7 @@ nsTransactionItem::RedoTransaction(nsTransactionManager *aTxMgr) } nsresult -nsTransactionItem::RedoChildren(nsTransactionManager *aTxMgr) +nsTransactionItem::RedoChildren(TransactionManager* aTransactionManager) { if (!mRedoStack) { return NS_OK; @@ -265,7 +268,7 @@ nsTransactionItem::RedoChildren(nsTransactionManager *aTxMgr) nsCOMPtr t = item->GetTransaction(); bool doInterrupt = false; - rv = aTxMgr->WillRedoNotify(t, &doInterrupt); + rv = aTransactionManager->WillRedoNotify(t, &doInterrupt); if (NS_FAILED(rv)) { return rv; } @@ -273,14 +276,14 @@ nsTransactionItem::RedoChildren(nsTransactionManager *aTxMgr) return NS_OK; } - rv = item->RedoTransaction(aTxMgr); + rv = item->RedoTransaction(aTransactionManager); if (NS_SUCCEEDED(rv)) { item = mRedoStack->Pop(); mUndoStack->Push(item.forget()); } // XXX Shouldn't this DidRedoNotify()? (bug 1311626) - nsresult rv2 = aTxMgr->DidUndoNotify(t, rv); + nsresult rv2 = aTransactionManager->DidUndoNotify(t, rv); if (NS_SUCCEEDED(rv)) { rv = rv2; } @@ -320,22 +323,22 @@ nsTransactionItem::GetNumberOfRedoItems(int32_t *aNumItems) } nsresult -nsTransactionItem::RecoverFromUndoError(nsTransactionManager *aTxMgr) +nsTransactionItem::RecoverFromUndoError(TransactionManager* aTransactionManager) { // If this method gets called, we never got to the point where we // successfully called UndoTransaction() for the transaction item itself. // Just redo any children that successfully called undo! - return RedoChildren(aTxMgr); + return RedoChildren(aTransactionManager); } nsresult -nsTransactionItem::RecoverFromRedoError(nsTransactionManager *aTxMgr) +nsTransactionItem::RecoverFromRedoError(TransactionManager* aTransactionManager) { // If this method gets called, we already successfully called // RedoTransaction() for the transaction item itself. Undo all // the children that successfully called RedoTransaction(), // then undo the transaction item itself. - nsresult rv = UndoChildren(aTxMgr); + nsresult rv = UndoChildren(aTransactionManager); if (NS_FAILED(rv)) { return rv; } diff --git a/editor/txmgr/nsTransactionItem.h b/editor/txmgr/nsTransactionItem.h index dc868203ba54..d7470a1be770 100644 --- a/editor/txmgr/nsTransactionItem.h +++ b/editor/txmgr/nsTransactionItem.h @@ -13,9 +13,12 @@ #include "nscore.h" class nsITransaction; -class nsTransactionManager; class nsTransactionStack; +namespace mozilla { +class TransactionManager; +} // namespace mozilla + class nsTransactionItem final { nsCOMArray mData; @@ -24,22 +27,21 @@ class nsTransactionItem final nsTransactionStack *mRedoStack; public: - - explicit nsTransactionItem(nsITransaction *aTransaction); + explicit nsTransactionItem(nsITransaction* aTransaction); NS_METHOD_(MozExternalRefCountType) AddRef(); NS_METHOD_(MozExternalRefCountType) Release(); NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsTransactionItem) - virtual nsresult AddChild(nsTransactionItem *aTransactionItem); + nsresult AddChild(nsTransactionItem* aTransactionItem); already_AddRefed GetTransaction(); - virtual nsresult GetIsBatch(bool *aIsBatch); - virtual nsresult GetNumberOfChildren(int32_t *aNumChildren); - virtual nsresult GetChild(int32_t aIndex, nsTransactionItem **aChild); + nsresult GetIsBatch(bool *aIsBatch); + nsresult GetNumberOfChildren(int32_t *aNumChildren); + nsresult GetChild(int32_t aIndex, nsTransactionItem** aChild); - virtual nsresult DoTransaction(void); - virtual nsresult UndoTransaction(nsTransactionManager *aTxMgr); - virtual nsresult RedoTransaction(nsTransactionManager *aTxMgr); + nsresult DoTransaction(); + nsresult UndoTransaction(mozilla::TransactionManager* aTransactionManager); + nsresult RedoTransaction(mozilla::TransactionManager* aTransactionManager); nsCOMArray& GetData() { @@ -47,19 +49,21 @@ public: } private: + nsresult UndoChildren(mozilla::TransactionManager* aTransactionManager); + nsresult RedoChildren(mozilla::TransactionManager* aTransactionManager); - virtual nsresult UndoChildren(nsTransactionManager *aTxMgr); - virtual nsresult RedoChildren(nsTransactionManager *aTxMgr); + nsresult + RecoverFromUndoError(mozilla::TransactionManager* aTransactionManager); + nsresult + RecoverFromRedoError(mozilla::TransactionManager* aTransactionManager); - virtual nsresult RecoverFromUndoError(nsTransactionManager *aTxMgr); - virtual nsresult RecoverFromRedoError(nsTransactionManager *aTxMgr); - - virtual nsresult GetNumberOfUndoItems(int32_t *aNumItems); - virtual nsresult GetNumberOfRedoItems(int32_t *aNumItems); + nsresult GetNumberOfUndoItems(int32_t* aNumItems); + nsresult GetNumberOfRedoItems(int32_t* aNumItems); void CleanUp(); + protected: - virtual ~nsTransactionItem(); + ~nsTransactionItem(); nsCycleCollectingAutoRefCnt mRefCnt; NS_DECL_OWNINGTHREAD diff --git a/editor/txmgr/nsTransactionManager.h b/editor/txmgr/nsTransactionManager.h deleted file mode 100644 index 17d21819f31a..000000000000 --- a/editor/txmgr/nsTransactionManager.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* 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/. */ - -#ifndef nsTransactionManager_h__ -#define nsTransactionManager_h__ - -#include "nsCOMArray.h" -#include "nsCOMPtr.h" -#include "nsCycleCollectionParticipant.h" -#include "nsTransactionStack.h" -#include "nsISupportsImpl.h" -#include "nsITransactionManager.h" -#include "nsTransactionStack.h" -#include "nsWeakReference.h" -#include "nscore.h" - -class nsITransaction; -class nsITransactionListener; - -/** implementation of a transaction manager object. - * - */ -class nsTransactionManager final : public nsITransactionManager - , public nsSupportsWeakReference -{ -private: - - int32_t mMaxTransactionCount; - nsTransactionStack mDoStack; - nsTransactionStack mUndoStack; - nsTransactionStack mRedoStack; - nsCOMArray mListeners; - - /** The default destructor. - */ - virtual ~nsTransactionManager(); - -public: - - /** The default constructor. - */ - explicit nsTransactionManager(int32_t aMaxTransactionCount=-1); - - /* Macro for AddRef(), Release(), and QueryInterface() */ - NS_DECL_CYCLE_COLLECTING_ISUPPORTS - NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsTransactionManager, - nsITransactionManager) - - /* nsITransactionManager method implementations. */ - NS_DECL_NSITRANSACTIONMANAGER - - already_AddRefed PeekUndoStack(); - already_AddRefed PeekRedoStack(); - - virtual nsresult WillDoNotify(nsITransaction *aTransaction, bool *aInterrupt); - virtual nsresult DidDoNotify(nsITransaction *aTransaction, nsresult aExecuteResult); - virtual nsresult WillUndoNotify(nsITransaction *aTransaction, bool *aInterrupt); - virtual nsresult DidUndoNotify(nsITransaction *aTransaction, nsresult aUndoResult); - virtual nsresult WillRedoNotify(nsITransaction *aTransaction, bool *aInterrupt); - virtual nsresult DidRedoNotify(nsITransaction *aTransaction, nsresult aRedoResult); - virtual nsresult WillBeginBatchNotify(bool *aInterrupt); - virtual nsresult DidBeginBatchNotify(nsresult aResult); - virtual nsresult WillEndBatchNotify(bool *aInterrupt); - virtual nsresult DidEndBatchNotify(nsresult aResult); - virtual nsresult WillMergeNotify(nsITransaction *aTop, - nsITransaction *aTransaction, - bool *aInterrupt); - virtual nsresult DidMergeNotify(nsITransaction *aTop, - nsITransaction *aTransaction, - bool aDidMerge, - nsresult aMergeResult); - -private: - - /* nsTransactionManager specific private methods. */ - virtual nsresult BeginTransaction(nsITransaction *aTransaction, - nsISupports *aData); - virtual nsresult EndTransaction(bool aAllowEmpty); -}; - -#endif // nsTransactionManager_h__ diff --git a/editor/txmgr/nsTransactionManagerCID.h b/editor/txmgr/nsTransactionManagerCID.h index f65e98579de3..5cdbfff16075 100644 --- a/editor/txmgr/nsTransactionManagerCID.h +++ b/editor/txmgr/nsTransactionManagerCID.h @@ -3,12 +3,7 @@ * 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/. */ -#ifndef nsTransactionManagerCID_h__ -#define nsTransactionManagerCID_h__ +// XXX Needs to modify mailnews/base/src/nsMsgWindow.cpp before removing this +// header file. +#include "nsITransactionManager.h" -#define NS_TRANSACTIONMANAGER_CID \ -{ /* 9C8F9601-801A-11d2-98BA-00805F297D89 */ \ -0x9c8f9601, 0x801a, 0x11d2, \ -{ 0x98, 0xba, 0x0, 0x80, 0x5f, 0x29, 0x7d, 0x89 } } - -#endif /* nsTransactionManagerCID_h__ */