diff --git a/editor/base/nsEditorTxnLog.cpp b/editor/base/nsEditorTxnLog.cpp index a83f611c20d..eb12db0ad40 100644 --- a/editor/base/nsEditorTxnLog.cpp +++ b/editor/base/nsEditorTxnLog.cpp @@ -89,7 +89,7 @@ nsEditorTxnLog::QueryInterface(REFNSIID aIID, void** aInstancePtr) } NS_IMETHODIMP -nsEditorTxnLog::WillDo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction) +nsEditorTxnLog::WillDo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction, PRBool *aInterrupt) { LOCK_LOG(this); @@ -127,7 +127,7 @@ nsEditorTxnLog::DidDo(nsITransactionManager *aTxMgr, nsITransaction *aTransactio } NS_IMETHODIMP -nsEditorTxnLog::WillUndo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction) +nsEditorTxnLog::WillUndo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction, PRBool *aInterrupt) { LOCK_LOG(this); @@ -183,7 +183,7 @@ nsEditorTxnLog::DidUndo(nsITransactionManager *aTxMgr, nsITransaction *aTransact } NS_IMETHODIMP -nsEditorTxnLog::WillRedo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction) +nsEditorTxnLog::WillRedo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction, PRBool *aInterrupt) { LOCK_LOG(this); @@ -239,7 +239,7 @@ nsEditorTxnLog::DidRedo(nsITransactionManager *aTxMgr, nsITransaction *aTransact } NS_IMETHODIMP -nsEditorTxnLog::WillBeginBatch(nsITransactionManager *aTxMgr) +nsEditorTxnLog::WillBeginBatch(nsITransactionManager *aTxMgr, PRBool *aInterrupt) { LOCK_LOG(this); @@ -273,7 +273,7 @@ nsEditorTxnLog::DidBeginBatch(nsITransactionManager *aTxMgr, nsresult aResult) } NS_IMETHODIMP -nsEditorTxnLog::WillEndBatch(nsITransactionManager *aTxMgr) +nsEditorTxnLog::WillEndBatch(nsITransactionManager *aTxMgr, PRBool *aInterrupt) { LOCK_LOG(this); @@ -307,7 +307,7 @@ nsEditorTxnLog::DidEndBatch(nsITransactionManager *aTxMgr, nsresult aResult) } NS_IMETHODIMP -nsEditorTxnLog::WillMerge(nsITransactionManager *aTxMgr, nsITransaction *aTopTransaction, nsITransaction *aTransaction) +nsEditorTxnLog::WillMerge(nsITransactionManager *aTxMgr, nsITransaction *aTopTransaction, nsITransaction *aTransaction, PRBool *aInterrupt) { LOCK_LOG(this); diff --git a/editor/base/nsEditorTxnLog.h b/editor/base/nsEditorTxnLog.h index 0976e3f5dee..9271a3cd6d9 100644 --- a/editor/base/nsEditorTxnLog.h +++ b/editor/base/nsEditorTxnLog.h @@ -54,17 +54,17 @@ public: NS_DECL_ISUPPORTS /* nsITransactionListener method implementations. */ - NS_IMETHOD WillDo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction); + NS_IMETHOD WillDo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction, PRBool *aInterrupt); NS_IMETHOD DidDo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction, nsresult aDoResult); - NS_IMETHOD WillUndo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction); + NS_IMETHOD WillUndo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction, PRBool *aInterrupt); NS_IMETHOD DidUndo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction, nsresult aUndoResult); - NS_IMETHOD WillRedo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction); + NS_IMETHOD WillRedo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction, PRBool *aInterrupt); NS_IMETHOD DidRedo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction, nsresult aRedoResult); - NS_IMETHOD WillBeginBatch(nsITransactionManager *aTxMgr); + NS_IMETHOD WillBeginBatch(nsITransactionManager *aTxMgr, PRBool *aInterrupt); NS_IMETHOD DidBeginBatch(nsITransactionManager *aTxMgr, nsresult aResult); - NS_IMETHOD WillEndBatch(nsITransactionManager *aTxMgr); + NS_IMETHOD WillEndBatch(nsITransactionManager *aTxMgr, PRBool *aInterrupt); NS_IMETHOD DidEndBatch(nsITransactionManager *aTxMgr, nsresult aResult); - NS_IMETHOD WillMerge(nsITransactionManager *aTxMgr, nsITransaction *aTopTransaction, nsITransaction *aTransaction); + NS_IMETHOD WillMerge(nsITransactionManager *aTxMgr, nsITransaction *aTopTransaction, nsITransaction *aTransaction, PRBool *aInterrupt); NS_IMETHOD DidMerge(nsITransactionManager *aTxMgr, nsITransaction *aTopTransaction, nsITransaction *aTransaction, PRBool aDidMerge, nsresult aMergeResult); diff --git a/editor/libeditor/html/nsEditorTxnLog.cpp b/editor/libeditor/html/nsEditorTxnLog.cpp index a83f611c20d..eb12db0ad40 100644 --- a/editor/libeditor/html/nsEditorTxnLog.cpp +++ b/editor/libeditor/html/nsEditorTxnLog.cpp @@ -89,7 +89,7 @@ nsEditorTxnLog::QueryInterface(REFNSIID aIID, void** aInstancePtr) } NS_IMETHODIMP -nsEditorTxnLog::WillDo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction) +nsEditorTxnLog::WillDo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction, PRBool *aInterrupt) { LOCK_LOG(this); @@ -127,7 +127,7 @@ nsEditorTxnLog::DidDo(nsITransactionManager *aTxMgr, nsITransaction *aTransactio } NS_IMETHODIMP -nsEditorTxnLog::WillUndo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction) +nsEditorTxnLog::WillUndo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction, PRBool *aInterrupt) { LOCK_LOG(this); @@ -183,7 +183,7 @@ nsEditorTxnLog::DidUndo(nsITransactionManager *aTxMgr, nsITransaction *aTransact } NS_IMETHODIMP -nsEditorTxnLog::WillRedo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction) +nsEditorTxnLog::WillRedo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction, PRBool *aInterrupt) { LOCK_LOG(this); @@ -239,7 +239,7 @@ nsEditorTxnLog::DidRedo(nsITransactionManager *aTxMgr, nsITransaction *aTransact } NS_IMETHODIMP -nsEditorTxnLog::WillBeginBatch(nsITransactionManager *aTxMgr) +nsEditorTxnLog::WillBeginBatch(nsITransactionManager *aTxMgr, PRBool *aInterrupt) { LOCK_LOG(this); @@ -273,7 +273,7 @@ nsEditorTxnLog::DidBeginBatch(nsITransactionManager *aTxMgr, nsresult aResult) } NS_IMETHODIMP -nsEditorTxnLog::WillEndBatch(nsITransactionManager *aTxMgr) +nsEditorTxnLog::WillEndBatch(nsITransactionManager *aTxMgr, PRBool *aInterrupt) { LOCK_LOG(this); @@ -307,7 +307,7 @@ nsEditorTxnLog::DidEndBatch(nsITransactionManager *aTxMgr, nsresult aResult) } NS_IMETHODIMP -nsEditorTxnLog::WillMerge(nsITransactionManager *aTxMgr, nsITransaction *aTopTransaction, nsITransaction *aTransaction) +nsEditorTxnLog::WillMerge(nsITransactionManager *aTxMgr, nsITransaction *aTopTransaction, nsITransaction *aTransaction, PRBool *aInterrupt) { LOCK_LOG(this); diff --git a/editor/libeditor/html/nsEditorTxnLog.h b/editor/libeditor/html/nsEditorTxnLog.h index 0976e3f5dee..9271a3cd6d9 100644 --- a/editor/libeditor/html/nsEditorTxnLog.h +++ b/editor/libeditor/html/nsEditorTxnLog.h @@ -54,17 +54,17 @@ public: NS_DECL_ISUPPORTS /* nsITransactionListener method implementations. */ - NS_IMETHOD WillDo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction); + NS_IMETHOD WillDo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction, PRBool *aInterrupt); NS_IMETHOD DidDo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction, nsresult aDoResult); - NS_IMETHOD WillUndo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction); + NS_IMETHOD WillUndo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction, PRBool *aInterrupt); NS_IMETHOD DidUndo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction, nsresult aUndoResult); - NS_IMETHOD WillRedo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction); + NS_IMETHOD WillRedo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction, PRBool *aInterrupt); NS_IMETHOD DidRedo(nsITransactionManager *aTxMgr, nsITransaction *aTransaction, nsresult aRedoResult); - NS_IMETHOD WillBeginBatch(nsITransactionManager *aTxMgr); + NS_IMETHOD WillBeginBatch(nsITransactionManager *aTxMgr, PRBool *aInterrupt); NS_IMETHOD DidBeginBatch(nsITransactionManager *aTxMgr, nsresult aResult); - NS_IMETHOD WillEndBatch(nsITransactionManager *aTxMgr); + NS_IMETHOD WillEndBatch(nsITransactionManager *aTxMgr, PRBool *aInterrupt); NS_IMETHOD DidEndBatch(nsITransactionManager *aTxMgr, nsresult aResult); - NS_IMETHOD WillMerge(nsITransactionManager *aTxMgr, nsITransaction *aTopTransaction, nsITransaction *aTransaction); + NS_IMETHOD WillMerge(nsITransactionManager *aTxMgr, nsITransaction *aTopTransaction, nsITransaction *aTransaction, PRBool *aInterrupt); NS_IMETHOD DidMerge(nsITransactionManager *aTxMgr, nsITransaction *aTopTransaction, nsITransaction *aTransaction, PRBool aDidMerge, nsresult aMergeResult); diff --git a/editor/txmgr/public/nsITransactionListener.h b/editor/txmgr/public/nsITransactionListener.h index 8b601a627be..e69de29bb2d 100644 --- a/editor/txmgr/public/nsITransactionListener.h +++ b/editor/txmgr/public/nsITransactionListener.h @@ -1,204 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * The contents of this file are subject to the Netscape Public - * License Version 1.1 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.mozilla.org/NPL/ - * - * Software distributed under the License is distributed on an "AS - * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - * implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is Netscape - * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All - * Rights Reserved. - * - * Contributor(s): - */ - -#ifndef nsITransactionListener_h__ -#define nsITransactionListener_h__ - -#include "nsISupports.h" - -class nsITransaction; -class nsITransactionManager; - -/* -Transaction Listener interface to outside world -*/ - -#define NS_ITRANSACTIONLISTENER_IID \ -{ /* 58E330C4-7B48-11d2-98B9-00805F297D89 */ \ -0x58e330c4, 0x7b48, 0x11d2, \ -{ 0x98, 0xb9, 0x0, 0x80, 0x5f, 0x29, 0x7d, 0x89 } } - -/** - * A transaction listener specific interface. - *
- * It's implemented by an object that tracks transactions. - */ -class nsITransactionListener : public nsISupports { -public: - - static const nsIID& GetIID() { static nsIID iid = NS_ITRANSACTIONLISTENER_IID; return iid; } - - /** - * Called before a transaction manager calls a transaction's - * Do() method. - * @param aManager the transaction manager doing the transaction. - * @param aTransaction the transaction being done. - * @result error status returned by the listener. NS_OK - * should be used to indicate no error, proceed with normal control - * flow. NS_COMFALSE can be returned by the listener to - * indicate no error, interrupt normal control flow. - */ - NS_IMETHOD WillDo(nsITransactionManager *aManager, - nsITransaction *aTransaction) = 0; - - /** - * Called after a transaction manager calls the Do() method of - * a transaction. - * @param aManager the transaction manager that did the transaction. - * @param aTransaction the transaction that was done. - * @param aDoResult the nsresult returned after doing the transaction. - * @result error status returned by the listener. - */ - NS_IMETHOD DidDo(nsITransactionManager *aManager, - nsITransaction *aTransaction, - nsresult aDoResult) = 0; - - /** - * Called before a transaction manager calls the Undo() method of - * a transaction. - * @param aManager the transaction manager undoing the transaction. - * @param aTransaction the transaction being undone. - * @result error status returned by the listener. NS_OK - * should be used to indicate no error, proceed with normal control - * flow. NS_COMFALSE can be returned by the listener to - * indicate no error, interrupt normal control flow. - */ - NS_IMETHOD WillUndo(nsITransactionManager *aManager, - nsITransaction *aTransaction) = 0; - - /** - * Called after a transaction manager calls the Undo() method of - * a transaction. - * @param aManager the transaction manager undoing the transaction. - * @param aTransaction the transaction being undone. - * @param aUndoResult the nsresult returned after undoing the transaction. - * @result error status returned by the listener. - */ - NS_IMETHOD DidUndo(nsITransactionManager *aManager, - nsITransaction *aTransaction, - nsresult aUndoResult) = 0; - - /** - * Called before a transaction manager calls the Redo() method of - * a transaction. - * @param aManager the transaction manager redoing the transaction. - * @param aTransaction the transaction being redone. - * @result error status returned by the listener. NS_OK - * should be used to indicate no error, proceed with normal control - * flow. NS_COMFALSE can be returned by the listener to - * indicate no error, interrupt normal control flow. - */ - NS_IMETHOD WillRedo(nsITransactionManager *aManager, - nsITransaction *aTransaction) = 0; - - /** - * Called after a transaction manager calls the Redo() method of - * a transaction. - * @param aManager the transaction manager redoing the transaction. - * @param aTransaction the transaction being redone. - * @param aRedoResult the nsresult returned after redoing the transaction. - * @result error status returned by the listener. - */ - NS_IMETHOD DidRedo(nsITransactionManager *aManager, - nsITransaction *aTransaction, - nsresult aRedoResult) = 0; - - /** - * Called before a transaction manager begins a batch. - * @param aManager the transaction manager beginning a batch. - * @result error status returned by the listener. NS_OK - * should be used to indicate no error, proceed with normal control - * flow. NS_COMFALSE can be returned by the listener to - * indicate no error, interrupt normal control flow. - */ - NS_IMETHOD WillBeginBatch(nsITransactionManager *aManager) = 0; - - /** - * Called after a transaction manager begins a batch. - * @param aManager the transaction manager that began a batch. - * @param aResult the nsresult returned after beginning a batch. - * @result error status returned by the listener. - */ - NS_IMETHOD DidBeginBatch(nsITransactionManager *aManager, - nsresult aResult) = 0; - - /** - * Called before a transaction manager ends a batch. - * @param aManager the transaction manager ending a batch. - * @result error status returned by the listener. NS_OK - * should be used to indicate no error, proceed with normal control - * flow. NS_COMFALSE can be returned by the listener to - * indicate no error, interrupt normal control flow. - */ - NS_IMETHOD WillEndBatch(nsITransactionManager *aManager) = 0; - - /** - * Called after a transaction manager ends a batch. - * @param aManager the transaction manager ending a batch. - * @param aResult the nsresult returned after ending a batch. - * @result error status returned by the listener. - */ - NS_IMETHOD DidEndBatch(nsITransactionManager *aManager, - nsresult aResult) = 0; - - /** - * Called before a transaction manager tries to merge - * a transaction, that was just executed, with the - * transaction at the top of the undo stack. - * @param aManager the transaction manager ending a batch. - * @param aTopTransaction the transaction at the top of the undo stack. - * @param aTransactionToMerge the transaction to merge. - * @result error status returned by the listener. NS_OK - * should be used to indicate no error, proceed with normal control - * flow. NS_COMFALSE can be returned by the listener to - * indicate no error, interrupt normal control flow. - */ - NS_IMETHOD WillMerge(nsITransactionManager *aManager, - nsITransaction *aTopTransaction, - nsITransaction *aTransactionToMerge) = 0; - - /** - * Called after a transaction manager tries to merge - * a transaction, that was just executed, with the - * transaction at the top of the undo stack. - * @param aManager the transaction manager ending a batch. - * @param aTopTransaction the transaction at the top of the undo stack. - * @param aTransactionToMerge the transaction to merge. - * @param aDidMerge true if transaction was merged, else false. - * @param aMergeResult the nsresult returned after the merge attempt. - * @result error status returned by the listener. NS_OK - * should be used to indicate no error, proceed with normal control - * flow. NS_COMFALSE can be returned by the listener to - * indicate no error, interrupt normal control flow. - */ - NS_IMETHOD DidMerge(nsITransactionManager *aManager, - nsITransaction *aTopTransaction, - nsITransaction *aTransactionToMerge, - PRBool aDidMerge, - nsresult aMergeResult) = 0; - - - /* XXX: We should probably add pruning notification methods. */ -}; - -#endif // nsITransactionListener_h__ - diff --git a/editor/txmgr/src/nsTransactionItem.cpp b/editor/txmgr/src/nsTransactionItem.cpp index 5f472b6845d..520521e961c 100644 --- a/editor/txmgr/src/nsTransactionItem.cpp +++ b/editor/txmgr/src/nsTransactionItem.cpp @@ -165,13 +165,15 @@ nsTransactionItem::UndoChildren(nsTransactionManager *aTxMgr) return result; } - result = aTxMgr->WillUndoNotify(t); + PRBool doInterrupt = PR_FALSE; + + result = aTxMgr->WillUndoNotify(t, &doInterrupt); if (NS_FAILED(result)) { return result; } - if (result == NS_COMFALSE) { + if (doInterrupt) { return NS_OK; } @@ -254,13 +256,15 @@ nsTransactionItem::RedoChildren(nsTransactionManager *aTxMgr) return result; } - result = aTxMgr->WillRedoNotify(t); + PRBool doInterrupt = PR_FALSE; + + result = aTxMgr->WillRedoNotify(t, &doInterrupt); if (NS_FAILED(result)) { return result; } - if (result == NS_COMFALSE) { + if (doInterrupt) { return NS_OK; } diff --git a/editor/txmgr/src/nsTransactionManager.cpp b/editor/txmgr/src/nsTransactionManager.cpp index 3281a75e189..eda1c4639b5 100644 --- a/editor/txmgr/src/nsTransactionManager.cpp +++ b/editor/txmgr/src/nsTransactionManager.cpp @@ -135,14 +135,16 @@ nsTransactionManager::Do(nsITransaction *aTransaction) LOCK_TX_MANAGER(this); - result = WillDoNotify(aTransaction); + PRBool doInterrupt = PR_FALSE; + + result = WillDoNotify(aTransaction, &doInterrupt); if (NS_FAILED(result)) { UNLOCK_TX_MANAGER(this); return result; } - if (result == NS_COMFALSE) { + if (doInterrupt) { UNLOCK_TX_MANAGER(this); return NS_OK; } @@ -215,14 +217,16 @@ nsTransactionManager::Undo() return result; } - result = WillUndoNotify(t); + PRBool doInterrupt = PR_FALSE; + + result = WillUndoNotify(t, &doInterrupt); if (NS_FAILED(result)) { UNLOCK_TX_MANAGER(this); return result; } - if (result == NS_COMFALSE) { + if (doInterrupt) { UNLOCK_TX_MANAGER(this); return NS_OK; } @@ -294,14 +298,16 @@ nsTransactionManager::Redo() return result; } - result = WillRedoNotify(t); + PRBool doInterrupt = PR_FALSE; + + result = WillRedoNotify(t, &doInterrupt); if (NS_FAILED(result)) { UNLOCK_TX_MANAGER(this); return result; } - if (result == NS_COMFALSE) { + if (doInterrupt) { UNLOCK_TX_MANAGER(this); return NS_OK; } @@ -358,14 +364,16 @@ nsTransactionManager::BeginBatch() LOCK_TX_MANAGER(this); - result = WillBeginBatchNotify(); + PRBool doInterrupt = PR_FALSE; + + result = WillBeginBatchNotify(&doInterrupt); if (NS_FAILED(result)) { UNLOCK_TX_MANAGER(this); return result; } - if (result == NS_COMFALSE) { + if (doInterrupt) { UNLOCK_TX_MANAGER(this); return NS_OK; } @@ -417,14 +425,16 @@ nsTransactionManager::EndBatch() return NS_ERROR_FAILURE; } - result = WillEndBatchNotify(); + PRBool doInterrupt = PR_FALSE; + + result = WillEndBatchNotify(&doInterrupt); if (NS_FAILED(result)) { UNLOCK_TX_MANAGER(this); return result; } - if (result == NS_COMFALSE) { + if (doInterrupt) { UNLOCK_TX_MANAGER(this); return NS_OK; } @@ -722,7 +732,7 @@ nsTransactionManager::ClearRedoStack() } nsresult -nsTransactionManager::WillDoNotify(nsITransaction *aTransaction) +nsTransactionManager::WillDoNotify(nsITransaction *aTransaction, PRBool *aInterrupt) { if (!mListeners) return NS_OK; @@ -737,9 +747,9 @@ nsTransactionManager::WillDoNotify(nsITransaction *aTransaction) if (!listener) return NS_ERROR_FAILURE; - result = listener->WillDo(this, aTransaction); + result = listener->WillDo(this, aTransaction, aInterrupt); - if (NS_FAILED(result) || result == NS_COMFALSE) + if (NS_FAILED(result) || *aInterrupt) break; } @@ -772,7 +782,7 @@ nsTransactionManager::DidDoNotify(nsITransaction *aTransaction, nsresult aDoResu } nsresult -nsTransactionManager::WillUndoNotify(nsITransaction *aTransaction) +nsTransactionManager::WillUndoNotify(nsITransaction *aTransaction, PRBool *aInterrupt) { if (!mListeners) return NS_OK; @@ -787,9 +797,9 @@ nsTransactionManager::WillUndoNotify(nsITransaction *aTransaction) if (!listener) return NS_ERROR_FAILURE; - result = listener->WillUndo(this, aTransaction); + result = listener->WillUndo(this, aTransaction, aInterrupt); - if (NS_FAILED(result) || result == NS_COMFALSE) + if (NS_FAILED(result) || *aInterrupt) break; } @@ -822,7 +832,7 @@ nsTransactionManager::DidUndoNotify(nsITransaction *aTransaction, nsresult aUndo } nsresult -nsTransactionManager::WillRedoNotify(nsITransaction *aTransaction) +nsTransactionManager::WillRedoNotify(nsITransaction *aTransaction, PRBool *aInterrupt) { if (!mListeners) return NS_OK; @@ -837,9 +847,9 @@ nsTransactionManager::WillRedoNotify(nsITransaction *aTransaction) if (!listener) return NS_ERROR_FAILURE; - result = listener->WillRedo(this, aTransaction); + result = listener->WillRedo(this, aTransaction, aInterrupt); - if (NS_FAILED(result) || result == NS_COMFALSE) + if (NS_FAILED(result) || *aInterrupt) break; } @@ -872,7 +882,7 @@ nsTransactionManager::DidRedoNotify(nsITransaction *aTransaction, nsresult aRedo } nsresult -nsTransactionManager::WillBeginBatchNotify() +nsTransactionManager::WillBeginBatchNotify(PRBool *aInterrupt) { if (!mListeners) return NS_OK; @@ -887,9 +897,9 @@ nsTransactionManager::WillBeginBatchNotify() if (!listener) return NS_ERROR_FAILURE; - result = listener->WillBeginBatch(this); + result = listener->WillBeginBatch(this, aInterrupt); - if (NS_FAILED(result) || result == NS_COMFALSE) + if (NS_FAILED(result) || *aInterrupt) break; } @@ -922,7 +932,7 @@ nsTransactionManager::DidBeginBatchNotify(nsresult aResult) } nsresult -nsTransactionManager::WillEndBatchNotify() +nsTransactionManager::WillEndBatchNotify(PRBool *aInterrupt) { if (!mListeners) return NS_OK; @@ -937,9 +947,9 @@ nsTransactionManager::WillEndBatchNotify() if (!listener) return NS_ERROR_FAILURE; - result = listener->WillEndBatch(this); + result = listener->WillEndBatch(this, aInterrupt); - if (NS_FAILED(result) || result == NS_COMFALSE) + if (NS_FAILED(result) || *aInterrupt) break; } @@ -972,7 +982,7 @@ nsTransactionManager::DidEndBatchNotify(nsresult aResult) } nsresult -nsTransactionManager::WillMergeNotify(nsITransaction *aTop, nsITransaction *aTransaction) +nsTransactionManager::WillMergeNotify(nsITransaction *aTop, nsITransaction *aTransaction, PRBool *aInterrupt) { if (!mListeners) return NS_OK; @@ -987,9 +997,9 @@ nsTransactionManager::WillMergeNotify(nsITransaction *aTop, nsITransaction *aTra if (!listener) return NS_ERROR_FAILURE; - result = listener->WillMerge(this, aTop, aTransaction); + result = listener->WillMerge(this, aTop, aTransaction, aInterrupt); - if (NS_FAILED(result) || result == NS_COMFALSE) + if (NS_FAILED(result) || *aInterrupt) break; } @@ -1150,12 +1160,14 @@ nsTransactionManager::EndTransaction() if (topTransaction) { - result = WillMergeNotify(topTransaction, tint); + PRBool doInterrupt = PR_FALSE; + + result = WillMergeNotify(topTransaction, tint, &doInterrupt); if (NS_FAILED(result)) return result; - if (result != NS_COMFALSE) { + if (!doInterrupt) { result = topTransaction->Merge(&didMerge, tint); nsresult result2 = DidMergeNotify(topTransaction, tint, didMerge, result); diff --git a/editor/txmgr/src/nsTransactionManager.h b/editor/txmgr/src/nsTransactionManager.h index fe8a9cbf7f7..ca8e63ae806 100644 --- a/editor/txmgr/src/nsTransactionManager.h +++ b/editor/txmgr/src/nsTransactionManager.h @@ -81,18 +81,19 @@ public: virtual nsresult ClearUndoStack(void); virtual nsresult ClearRedoStack(void); - virtual nsresult WillDoNotify(nsITransaction *aTransaction); + virtual nsresult WillDoNotify(nsITransaction *aTransaction, PRBool *aInterrupt); virtual nsresult DidDoNotify(nsITransaction *aTransaction, nsresult aDoResult); - virtual nsresult WillUndoNotify(nsITransaction *aTransaction); + virtual nsresult WillUndoNotify(nsITransaction *aTransaction, PRBool *aInterrupt); virtual nsresult DidUndoNotify(nsITransaction *aTransaction, nsresult aUndoResult); - virtual nsresult WillRedoNotify(nsITransaction *aTransaction); + virtual nsresult WillRedoNotify(nsITransaction *aTransaction, PRBool *aInterrupt); virtual nsresult DidRedoNotify(nsITransaction *aTransaction, nsresult aRedoResult); - virtual nsresult WillBeginBatchNotify(); + virtual nsresult WillBeginBatchNotify(PRBool *aInterrupt); virtual nsresult DidBeginBatchNotify(nsresult aResult); - virtual nsresult WillEndBatchNotify(); + virtual nsresult WillEndBatchNotify(PRBool *aInterrupt); virtual nsresult DidEndBatchNotify(nsresult aResult); virtual nsresult WillMergeNotify(nsITransaction *aTop, - nsITransaction *aTransaction); + nsITransaction *aTransaction, + PRBool *aInterrupt); virtual nsresult DidMergeNotify(nsITransaction *aTop, nsITransaction *aTransaction, PRBool aDidMerge,