From 19ec219fb70fb8da5b68456bee05f6edefcf7581 Mon Sep 17 00:00:00 2001 From: "brade%netscape.com" Date: Tue, 21 Sep 1999 22:31:27 +0000 Subject: [PATCH] allow for txn to have id/string for get/set --- editor/base/ChangeAttributeTxn.cpp | 2 + editor/base/ChangeAttributeTxn.h | 4 +- editor/base/CreateElementTxn.cpp | 4 +- editor/base/CreateElementTxn.h | 4 +- editor/base/DeleteElementTxn.cpp | 4 +- editor/base/DeleteElementTxn.h | 4 +- editor/base/DeleteRangeTxn.cpp | 4 +- editor/base/DeleteRangeTxn.h | 4 +- editor/base/DeleteTextTxn.cpp | 2 + editor/base/DeleteTextTxn.h | 4 +- editor/base/EditTxn.cpp | 39 +++++++++++++++++++- editor/base/EditTxn.h | 9 ++++- editor/base/IMECommitTxn.cpp | 4 +- editor/base/IMECommitTxn.h | 4 +- editor/base/IMETextTxn.cpp | 4 +- editor/base/IMETextTxn.h | 4 +- editor/base/InsertElementTxn.cpp | 4 +- editor/base/InsertElementTxn.h | 4 +- editor/base/InsertTextTxn.cpp | 32 ++++++++++------ editor/base/InsertTextTxn.h | 4 +- editor/base/JoinElementTxn.cpp | 4 +- editor/base/JoinElementTxn.h | 4 +- editor/base/PlaceholderTxn.cpp | 5 ++- editor/base/PlaceholderTxn.h | 4 +- editor/base/SplitElementTxn.cpp | 4 +- editor/base/SplitElementTxn.h | 4 +- editor/base/nsStyleSheetTxns.cpp | 12 ++++-- editor/base/nsStyleSheetTxns.h | 6 ++- editor/libeditor/base/ChangeAttributeTxn.cpp | 2 + editor/libeditor/base/ChangeAttributeTxn.h | 4 +- editor/libeditor/base/CreateElementTxn.cpp | 4 +- editor/libeditor/base/CreateElementTxn.h | 4 +- editor/libeditor/base/DeleteElementTxn.cpp | 4 +- editor/libeditor/base/DeleteElementTxn.h | 4 +- editor/libeditor/base/DeleteRangeTxn.cpp | 4 +- editor/libeditor/base/DeleteRangeTxn.h | 4 +- editor/libeditor/base/DeleteTextTxn.cpp | 2 + editor/libeditor/base/DeleteTextTxn.h | 4 +- editor/libeditor/base/EditTxn.cpp | 39 +++++++++++++++++++- editor/libeditor/base/EditTxn.h | 9 ++++- editor/libeditor/base/IMETextTxn.cpp | 4 +- editor/libeditor/base/IMETextTxn.h | 4 +- editor/libeditor/base/InsertElementTxn.cpp | 4 +- editor/libeditor/base/InsertElementTxn.h | 4 +- editor/libeditor/base/InsertTextTxn.cpp | 32 ++++++++++------ editor/libeditor/base/InsertTextTxn.h | 4 +- editor/libeditor/base/JoinElementTxn.cpp | 4 +- editor/libeditor/base/JoinElementTxn.h | 4 +- editor/libeditor/base/PlaceholderTxn.cpp | 5 ++- editor/libeditor/base/PlaceholderTxn.h | 4 +- editor/libeditor/base/SplitElementTxn.cpp | 4 +- editor/libeditor/base/SplitElementTxn.h | 4 +- editor/libeditor/base/nsStyleSheetTxns.cpp | 12 ++++-- editor/libeditor/base/nsStyleSheetTxns.h | 6 ++- 54 files changed, 284 insertions(+), 82 deletions(-) diff --git a/editor/base/ChangeAttributeTxn.cpp b/editor/base/ChangeAttributeTxn.cpp index ee7b5dd0ff9..6b634f69df9 100644 --- a/editor/base/ChangeAttributeTxn.cpp +++ b/editor/base/ChangeAttributeTxn.cpp @@ -23,6 +23,8 @@ ChangeAttributeTxn::ChangeAttributeTxn() : EditTxn() { + SetTransactionDescriptionID( kTransactionID ); + /* log description initialized in parent constructor */ } ChangeAttributeTxn::~ChangeAttributeTxn() diff --git a/editor/base/ChangeAttributeTxn.h b/editor/base/ChangeAttributeTxn.h index 4e0880695a3..47355b5f99e 100644 --- a/editor/base/ChangeAttributeTxn.h +++ b/editor/base/ChangeAttributeTxn.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -73,6 +73,8 @@ public: NS_IMETHOD GetRedoString(nsString *aString); + enum { kTransactionID = 11180 }; + protected: /** the editor that created this transaction */ diff --git a/editor/base/CreateElementTxn.cpp b/editor/base/CreateElementTxn.cpp index 10fef19224a..2a0b87300e8 100644 --- a/editor/base/CreateElementTxn.cpp +++ b/editor/base/CreateElementTxn.cpp @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -33,6 +33,8 @@ static const PRBool gNoisy = PR_FALSE; CreateElementTxn::CreateElementTxn() : EditTxn() { + SetTransactionDescriptionID( kTransactionID ); + /* log description initialized in parent constructor */ } NS_IMETHODIMP CreateElementTxn::Init(nsIEditor *aEditor, diff --git a/editor/base/CreateElementTxn.h b/editor/base/CreateElementTxn.h index 743a7a8b91f..ef260f1bc85 100644 --- a/editor/base/CreateElementTxn.h +++ b/editor/base/CreateElementTxn.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -75,6 +75,8 @@ public: NS_IMETHOD GetNewNode(nsIDOMNode **aNewNode); + enum { kTransactionID = 11140 }; + protected: /** the document into which the new node will be inserted */ diff --git a/editor/base/DeleteElementTxn.cpp b/editor/base/DeleteElementTxn.cpp index 66d03062ef0..fb7570a191a 100644 --- a/editor/base/DeleteElementTxn.cpp +++ b/editor/base/DeleteElementTxn.cpp @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -31,6 +31,8 @@ static const PRBool gNoisy = PR_FALSE; DeleteElementTxn::DeleteElementTxn() : EditTxn() { + SetTransactionDescriptionID( kTransactionID ); + /* log description initialized in parent constructor */ } NS_IMETHODIMP DeleteElementTxn::Init(nsIDOMNode *aElement) diff --git a/editor/base/DeleteElementTxn.h b/editor/base/DeleteElementTxn.h index b7ef8665801..028c26168ef 100644 --- a/editor/base/DeleteElementTxn.h +++ b/editor/base/DeleteElementTxn.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -63,6 +63,8 @@ public: NS_IMETHOD GetRedoString(nsString *aString); + enum { kTransactionID = 11160 }; + protected: /** the element to delete */ diff --git a/editor/base/DeleteRangeTxn.cpp b/editor/base/DeleteRangeTxn.cpp index 8cc9dbf21d4..07c5b994f5a 100644 --- a/editor/base/DeleteRangeTxn.cpp +++ b/editor/base/DeleteRangeTxn.cpp @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -42,6 +42,8 @@ static const PRBool gNoisy = PR_FALSE; DeleteRangeTxn::DeleteRangeTxn() : EditAggregateTxn() { + SetTransactionDescriptionID( kTransactionID ); + /* log description initialized in parent constructor */ } NS_IMETHODIMP DeleteRangeTxn::Init(nsIEditor *aEditor, nsIDOMRange *aRange) diff --git a/editor/base/DeleteRangeTxn.h b/editor/base/DeleteRangeTxn.h index 0d1fe5af79f..ca56c472266 100644 --- a/editor/base/DeleteRangeTxn.h +++ b/editor/base/DeleteRangeTxn.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -71,6 +71,8 @@ public: NS_IMETHOD GetRedoString(nsString *aString); + enum { kTransactionID = 11170 }; + protected: NS_IMETHOD CreateTxnsToDeleteBetween(nsIDOMNode *aStartParent, diff --git a/editor/base/DeleteTextTxn.cpp b/editor/base/DeleteTextTxn.cpp index 05a6e19db53..c61825a7cca 100644 --- a/editor/base/DeleteTextTxn.cpp +++ b/editor/base/DeleteTextTxn.cpp @@ -29,6 +29,8 @@ static const PRBool gNoisy = PR_FALSE; DeleteTextTxn::DeleteTextTxn() : EditTxn() { + SetTransactionDescriptionID( kTransactionID ); + /* log description initialized in parent constructor */ } DeleteTextTxn::~DeleteTextTxn() diff --git a/editor/base/DeleteTextTxn.h b/editor/base/DeleteTextTxn.h index 14ce511218c..4130bee367b 100644 --- a/editor/base/DeleteTextTxn.h +++ b/editor/base/DeleteTextTxn.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -67,6 +67,8 @@ public: NS_IMETHOD GetRedoString(nsString *aString); + enum { kTransactionID = 11130 }; + protected: /** the provider of basic editing operations */ diff --git a/editor/base/EditTxn.cpp b/editor/base/EditTxn.cpp index 712ca4b5e9c..ecd47a5361b 100644 --- a/editor/base/EditTxn.cpp +++ b/editor/base/EditTxn.cpp @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -29,6 +29,7 @@ NS_IMPL_RELEASE(EditTxn) // note that aEditor is not refcounted EditTxn::EditTxn() + : mTransactionID(-1) { NS_INIT_REFCNT(); } @@ -83,6 +84,32 @@ NS_IMETHODIMP EditTxn::GetRedoString(nsString *aString) return NS_OK; } +NS_IMETHODIMP EditTxn::GetLogDescription(PRUnichar * *aString) +{ + if (nsnull!=aString) + *aString = mLogDescription.ToNewUnicode(); + return NS_OK; +} + +NS_IMETHODIMP EditTxn::SetLogDescription(const PRUnichar *aString) +{ + mLogDescription = (PRUnichar *)aString; + return NS_OK; +} + +NS_IMETHODIMP EditTxn::GetTransactionDescriptionID(int *aID) +{ + if (nsnull!=aID) + *aID = mTransactionID; + return NS_OK; +} + +NS_IMETHODIMP EditTxn::SetTransactionDescriptionID(int aID) +{ + mTransactionID = aID; + return NS_OK; +} + NS_IMETHODIMP EditTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr) { @@ -90,7 +117,9 @@ EditTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr) return NS_ERROR_NULL_POINTER; } if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*)(nsISupports*)this; + nsITransaction *tmp = this; + nsISupports *tmp2 = tmp; + *aInstancePtr = (void*)(nsISupports*)tmp2; NS_ADDREF_THIS(); return NS_OK; } @@ -99,6 +128,12 @@ EditTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr) NS_ADDREF_THIS(); return NS_OK; } + if (aIID.Equals(nsITransactionDescription::GetIID())) { + *aInstancePtr = (void*)(nsITransactionDescription*)this; + NS_ADDREF_THIS(); + return NS_OK; + } + *aInstancePtr = 0; return NS_NOINTERFACE; } diff --git a/editor/base/EditTxn.h b/editor/base/EditTxn.h index 8a3bfe4446e..fd8144047dd 100644 --- a/editor/base/EditTxn.h +++ b/editor/base/EditTxn.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -20,6 +20,7 @@ #define EditTxn_h__ #include "nsITransaction.h" +#include "nsITransactionDescription.h" #include "nsCOMPtr.h" #define EDIT_TXN_CID \ @@ -34,6 +35,7 @@ * it is never seen by the user or by any external entity. */ class EditTxn : public nsITransaction + , public nsITransactionDescription { public: @@ -61,6 +63,11 @@ public: NS_IMETHOD GetRedoString(nsString *aString); + enum { kTransactionID = 11100 }; + + NS_DECL_NSITRANSACTIONDESCRIPTION + nsString mLogDescription; + int mTransactionID; }; #endif diff --git a/editor/base/IMECommitTxn.cpp b/editor/base/IMECommitTxn.cpp index b5ceaa47ac4..0bb3faecb1d 100644 --- a/editor/base/IMECommitTxn.cpp +++ b/editor/base/IMECommitTxn.cpp @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -31,6 +31,8 @@ nsresult IMECommitTxn::ClassInit() IMECommitTxn::IMECommitTxn() : EditTxn() { + SetTransactionDescriptionID( kTransactionID ); + /* log description initialized in parent constructor */ } IMECommitTxn::~IMECommitTxn() diff --git a/editor/base/IMECommitTxn.h b/editor/base/IMECommitTxn.h index 8a7a86d2f18..6d70868a144 100644 --- a/editor/base/IMECommitTxn.h +++ b/editor/base/IMECommitTxn.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -71,6 +71,8 @@ public: /** must be called before any IMECommitTxn is instantiated */ static nsresult ClassInit(); + enum { kTransactionID = 11230 }; + protected: friend class TransactionFactory; diff --git a/editor/base/IMETextTxn.cpp b/editor/base/IMETextTxn.cpp index 5cdcad7a39c..093a0e1851b 100644 --- a/editor/base/IMETextTxn.cpp +++ b/editor/base/IMETextTxn.cpp @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -39,6 +39,8 @@ nsresult IMETextTxn::ClassInit() IMETextTxn::IMETextTxn() : EditTxn() { + SetTransactionDescriptionID( kTransactionID ); + /* log description initialized in parent constructor */ } IMETextTxn::~IMETextTxn() diff --git a/editor/base/IMETextTxn.h b/editor/base/IMETextTxn.h index 9e4a70dd167..cb9c6032525 100644 --- a/editor/base/IMETextTxn.h +++ b/editor/base/IMETextTxn.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -93,6 +93,8 @@ public: /** must be called before any IMETextTxn is instantiated */ static nsresult ClassInit(); + enum { kTransactionID = 11220 }; + protected: NS_IMETHOD CollapseTextSelection(void); diff --git a/editor/base/InsertElementTxn.cpp b/editor/base/InsertElementTxn.cpp index a16f58f6f1d..9e30bfb2af8 100644 --- a/editor/base/InsertElementTxn.cpp +++ b/editor/base/InsertElementTxn.cpp @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -30,6 +30,8 @@ static const PRBool gNoisy = PR_FALSE; InsertElementTxn::InsertElementTxn() : EditTxn() { + SetTransactionDescriptionID( kTransactionID ); + /* log description initialized in parent constructor */ } NS_IMETHODIMP InsertElementTxn::Init(nsIDOMNode *aNode, diff --git a/editor/base/InsertElementTxn.h b/editor/base/InsertElementTxn.h index 6d1da7db628..bdda95f8ef8 100644 --- a/editor/base/InsertElementTxn.h +++ b/editor/base/InsertElementTxn.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -67,6 +67,8 @@ public: NS_IMETHOD GetRedoString(nsString *aString); + enum { kTransactionID = 11150 }; + protected: /** the element to insert */ diff --git a/editor/base/InsertTextTxn.cpp b/editor/base/InsertTextTxn.cpp index 22608b2c0b9..a1ae58ea465 100644 --- a/editor/base/InsertTextTxn.cpp +++ b/editor/base/InsertTextTxn.cpp @@ -43,6 +43,8 @@ nsresult InsertTextTxn::ClassInit() InsertTextTxn::InsertTextTxn() : EditTxn() { + SetTransactionDescriptionID( kTransactionID ); + /* log description initialized in parent constructor */ } InsertTextTxn::~InsertTextTxn() @@ -153,23 +155,29 @@ NS_IMETHODIMP InsertTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransacti { // yep, it's one of ours. By definition, it must contain only // another aggregate with a single child, // or a single InsertTextTxn - nsCOMPtr childTxn; - otherTxn->GetTxnAt(0, getter_AddRefs(childTxn)); + EditTxn * childTxn; + otherTxn->GetTxnAt(0, (&childTxn)); if (childTxn) { - nsCOMPtr otherInsertTxn; - otherInsertTxn = do_QueryInterface(childTxn); - if (otherInsertTxn) + InsertTextTxn * otherInsertTxn = nsnull; + result = childTxn->QueryInterface(InsertTextTxn::GetCID(), (void**)&otherInsertTxn); + if (NS_SUCCEEDED(result)) { - if (PR_TRUE==IsSequentialInsert(otherInsertTxn)) + if (otherInsertTxn) { - nsAutoString otherData; - otherInsertTxn->GetData(otherData); - mStringToInsert += otherData; - *aDidMerge = PR_TRUE; - if (gNoisy) { printf("InsertTextTxn assimilated %p\n", aTransaction); } - } + if (PR_TRUE==IsSequentialInsert(otherInsertTxn)) + { + nsAutoString otherData; + otherInsertTxn->GetData(otherData); + mStringToInsert += otherData; + *aDidMerge = PR_TRUE; + if (gNoisy) { printf("InsertTextTxn assimilated %p\n", aTransaction); } + } + NS_RELEASE(otherInsertTxn); + } } + + NS_RELEASE(childTxn); } } NS_RELEASE(otherTxn); diff --git a/editor/base/InsertTextTxn.h b/editor/base/InsertTextTxn.h index 72995eb7372..3162b837741 100644 --- a/editor/base/InsertTextTxn.h +++ b/editor/base/InsertTextTxn.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -87,6 +87,8 @@ public: /** must be called before any InsertTextTxn is instantiated */ static nsresult ClassInit(); + enum { kTransactionID = 11120 }; + protected: /** return PR_TRUE if aOtherTxn immediately follows this txn */ diff --git a/editor/base/JoinElementTxn.cpp b/editor/base/JoinElementTxn.cpp index fee5981dfcf..ad0df3e10a9 100644 --- a/editor/base/JoinElementTxn.cpp +++ b/editor/base/JoinElementTxn.cpp @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -31,6 +31,8 @@ static const PRBool gNoisy = PR_FALSE; JoinElementTxn::JoinElementTxn() : EditTxn() { + SetTransactionDescriptionID( kTransactionID ); + /* log description initialized in parent constructor */ } NS_IMETHODIMP JoinElementTxn::Init(nsIEditor *aEditor, diff --git a/editor/base/JoinElementTxn.h b/editor/base/JoinElementTxn.h index 7b951252b74..20f13f530b2 100644 --- a/editor/base/JoinElementTxn.h +++ b/editor/base/JoinElementTxn.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -73,6 +73,8 @@ public: NS_IMETHOD GetRedoString(nsString *aString); + enum { kTransactionID = 11200 }; + protected: /** the elements to operate upon. diff --git a/editor/base/PlaceholderTxn.cpp b/editor/base/PlaceholderTxn.cpp index 667a5873bcd..6201acfcaad 100644 --- a/editor/base/PlaceholderTxn.cpp +++ b/editor/base/PlaceholderTxn.cpp @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -30,6 +30,8 @@ PlaceholderTxn::PlaceholderTxn() : EditAggregateTxn() { mAbsorb=PR_TRUE; + SetTransactionDescriptionID( kTransactionID ); + /* log description initialized in parent constructor */ } @@ -73,4 +75,3 @@ NS_IMETHODIMP PlaceholderTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransact } return result; } - diff --git a/editor/base/PlaceholderTxn.h b/editor/base/PlaceholderTxn.h index 74441711026..3d214e34d30 100644 --- a/editor/base/PlaceholderTxn.h +++ b/editor/base/PlaceholderTxn.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -53,6 +53,8 @@ public: friend class TransactionFactory; + enum { kTransactionID = 11260 }; + protected: PRBool mAbsorb; diff --git a/editor/base/SplitElementTxn.cpp b/editor/base/SplitElementTxn.cpp index 5bc467f3549..754d0ad7fac 100644 --- a/editor/base/SplitElementTxn.cpp +++ b/editor/base/SplitElementTxn.cpp @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -33,6 +33,8 @@ static const PRBool gNoisy = PR_FALSE; SplitElementTxn::SplitElementTxn() : EditTxn() { + SetTransactionDescriptionID( kTransactionID ); + /* log description initialized in parent constructor */ } NS_IMETHODIMP SplitElementTxn::Init(nsIEditor *aEditor, diff --git a/editor/base/SplitElementTxn.h b/editor/base/SplitElementTxn.h index cb12f7d81af..e174e8186b0 100644 --- a/editor/base/SplitElementTxn.h +++ b/editor/base/SplitElementTxn.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -71,6 +71,8 @@ public: NS_IMETHOD GetNewNode(nsIDOMNode **aNewNode); + enum { kTransactionID = 11190 }; + protected: /** the element to operate upon */ diff --git a/editor/base/nsStyleSheetTxns.cpp b/editor/base/nsStyleSheetTxns.cpp index cfb2c5011fe..202a9385417 100644 --- a/editor/base/nsStyleSheetTxns.cpp +++ b/editor/base/nsStyleSheetTxns.cpp @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -31,8 +31,11 @@ AddStyleSheetTxn::AddStyleSheetTxn() -: mEditor(NULL) +: EditTxn() +, mEditor(NULL) { + SetTransactionDescriptionID( kTransactionID ); + /* log description initialized in parent constructor */ } AddStyleSheetTxn::~AddStyleSheetTxn() @@ -160,15 +163,16 @@ AddStyleSheetTxn::GetRedoString(nsString *aString) return NS_OK; } - #ifdef XP_MAC #pragma mark - #endif RemoveStyleSheetTxn::RemoveStyleSheetTxn() -: mEditor(NULL) +: EditTxn() +, mEditor(NULL) { + SetTransactionDescriptionID( kTransactionID ); } RemoveStyleSheetTxn::~RemoveStyleSheetTxn() diff --git a/editor/base/nsStyleSheetTxns.h b/editor/base/nsStyleSheetTxns.h index e6eea9195af..34a2b302f78 100644 --- a/editor/base/nsStyleSheetTxns.h +++ b/editor/base/nsStyleSheetTxns.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -69,6 +69,8 @@ public: NS_IMETHOD GetRedoString(nsString *aString); + enum { kTransactionID = 11240 }; + protected: nsIEditor* mEditor; // the editor that created this transaction @@ -113,6 +115,8 @@ public: NS_IMETHOD GetRedoString(nsString *aString); + enum { kTransactionID = 11250 }; + protected: nsIEditor* mEditor; // the editor that created this transaction diff --git a/editor/libeditor/base/ChangeAttributeTxn.cpp b/editor/libeditor/base/ChangeAttributeTxn.cpp index ee7b5dd0ff9..6b634f69df9 100644 --- a/editor/libeditor/base/ChangeAttributeTxn.cpp +++ b/editor/libeditor/base/ChangeAttributeTxn.cpp @@ -23,6 +23,8 @@ ChangeAttributeTxn::ChangeAttributeTxn() : EditTxn() { + SetTransactionDescriptionID( kTransactionID ); + /* log description initialized in parent constructor */ } ChangeAttributeTxn::~ChangeAttributeTxn() diff --git a/editor/libeditor/base/ChangeAttributeTxn.h b/editor/libeditor/base/ChangeAttributeTxn.h index 4e0880695a3..47355b5f99e 100644 --- a/editor/libeditor/base/ChangeAttributeTxn.h +++ b/editor/libeditor/base/ChangeAttributeTxn.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -73,6 +73,8 @@ public: NS_IMETHOD GetRedoString(nsString *aString); + enum { kTransactionID = 11180 }; + protected: /** the editor that created this transaction */ diff --git a/editor/libeditor/base/CreateElementTxn.cpp b/editor/libeditor/base/CreateElementTxn.cpp index 10fef19224a..2a0b87300e8 100644 --- a/editor/libeditor/base/CreateElementTxn.cpp +++ b/editor/libeditor/base/CreateElementTxn.cpp @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -33,6 +33,8 @@ static const PRBool gNoisy = PR_FALSE; CreateElementTxn::CreateElementTxn() : EditTxn() { + SetTransactionDescriptionID( kTransactionID ); + /* log description initialized in parent constructor */ } NS_IMETHODIMP CreateElementTxn::Init(nsIEditor *aEditor, diff --git a/editor/libeditor/base/CreateElementTxn.h b/editor/libeditor/base/CreateElementTxn.h index 743a7a8b91f..ef260f1bc85 100644 --- a/editor/libeditor/base/CreateElementTxn.h +++ b/editor/libeditor/base/CreateElementTxn.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -75,6 +75,8 @@ public: NS_IMETHOD GetNewNode(nsIDOMNode **aNewNode); + enum { kTransactionID = 11140 }; + protected: /** the document into which the new node will be inserted */ diff --git a/editor/libeditor/base/DeleteElementTxn.cpp b/editor/libeditor/base/DeleteElementTxn.cpp index 66d03062ef0..fb7570a191a 100644 --- a/editor/libeditor/base/DeleteElementTxn.cpp +++ b/editor/libeditor/base/DeleteElementTxn.cpp @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -31,6 +31,8 @@ static const PRBool gNoisy = PR_FALSE; DeleteElementTxn::DeleteElementTxn() : EditTxn() { + SetTransactionDescriptionID( kTransactionID ); + /* log description initialized in parent constructor */ } NS_IMETHODIMP DeleteElementTxn::Init(nsIDOMNode *aElement) diff --git a/editor/libeditor/base/DeleteElementTxn.h b/editor/libeditor/base/DeleteElementTxn.h index b7ef8665801..028c26168ef 100644 --- a/editor/libeditor/base/DeleteElementTxn.h +++ b/editor/libeditor/base/DeleteElementTxn.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -63,6 +63,8 @@ public: NS_IMETHOD GetRedoString(nsString *aString); + enum { kTransactionID = 11160 }; + protected: /** the element to delete */ diff --git a/editor/libeditor/base/DeleteRangeTxn.cpp b/editor/libeditor/base/DeleteRangeTxn.cpp index 8cc9dbf21d4..07c5b994f5a 100644 --- a/editor/libeditor/base/DeleteRangeTxn.cpp +++ b/editor/libeditor/base/DeleteRangeTxn.cpp @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -42,6 +42,8 @@ static const PRBool gNoisy = PR_FALSE; DeleteRangeTxn::DeleteRangeTxn() : EditAggregateTxn() { + SetTransactionDescriptionID( kTransactionID ); + /* log description initialized in parent constructor */ } NS_IMETHODIMP DeleteRangeTxn::Init(nsIEditor *aEditor, nsIDOMRange *aRange) diff --git a/editor/libeditor/base/DeleteRangeTxn.h b/editor/libeditor/base/DeleteRangeTxn.h index 0d1fe5af79f..ca56c472266 100644 --- a/editor/libeditor/base/DeleteRangeTxn.h +++ b/editor/libeditor/base/DeleteRangeTxn.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -71,6 +71,8 @@ public: NS_IMETHOD GetRedoString(nsString *aString); + enum { kTransactionID = 11170 }; + protected: NS_IMETHOD CreateTxnsToDeleteBetween(nsIDOMNode *aStartParent, diff --git a/editor/libeditor/base/DeleteTextTxn.cpp b/editor/libeditor/base/DeleteTextTxn.cpp index 05a6e19db53..c61825a7cca 100644 --- a/editor/libeditor/base/DeleteTextTxn.cpp +++ b/editor/libeditor/base/DeleteTextTxn.cpp @@ -29,6 +29,8 @@ static const PRBool gNoisy = PR_FALSE; DeleteTextTxn::DeleteTextTxn() : EditTxn() { + SetTransactionDescriptionID( kTransactionID ); + /* log description initialized in parent constructor */ } DeleteTextTxn::~DeleteTextTxn() diff --git a/editor/libeditor/base/DeleteTextTxn.h b/editor/libeditor/base/DeleteTextTxn.h index 14ce511218c..4130bee367b 100644 --- a/editor/libeditor/base/DeleteTextTxn.h +++ b/editor/libeditor/base/DeleteTextTxn.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -67,6 +67,8 @@ public: NS_IMETHOD GetRedoString(nsString *aString); + enum { kTransactionID = 11130 }; + protected: /** the provider of basic editing operations */ diff --git a/editor/libeditor/base/EditTxn.cpp b/editor/libeditor/base/EditTxn.cpp index 712ca4b5e9c..ecd47a5361b 100644 --- a/editor/libeditor/base/EditTxn.cpp +++ b/editor/libeditor/base/EditTxn.cpp @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -29,6 +29,7 @@ NS_IMPL_RELEASE(EditTxn) // note that aEditor is not refcounted EditTxn::EditTxn() + : mTransactionID(-1) { NS_INIT_REFCNT(); } @@ -83,6 +84,32 @@ NS_IMETHODIMP EditTxn::GetRedoString(nsString *aString) return NS_OK; } +NS_IMETHODIMP EditTxn::GetLogDescription(PRUnichar * *aString) +{ + if (nsnull!=aString) + *aString = mLogDescription.ToNewUnicode(); + return NS_OK; +} + +NS_IMETHODIMP EditTxn::SetLogDescription(const PRUnichar *aString) +{ + mLogDescription = (PRUnichar *)aString; + return NS_OK; +} + +NS_IMETHODIMP EditTxn::GetTransactionDescriptionID(int *aID) +{ + if (nsnull!=aID) + *aID = mTransactionID; + return NS_OK; +} + +NS_IMETHODIMP EditTxn::SetTransactionDescriptionID(int aID) +{ + mTransactionID = aID; + return NS_OK; +} + NS_IMETHODIMP EditTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr) { @@ -90,7 +117,9 @@ EditTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr) return NS_ERROR_NULL_POINTER; } if (aIID.Equals(kISupportsIID)) { - *aInstancePtr = (void*)(nsISupports*)this; + nsITransaction *tmp = this; + nsISupports *tmp2 = tmp; + *aInstancePtr = (void*)(nsISupports*)tmp2; NS_ADDREF_THIS(); return NS_OK; } @@ -99,6 +128,12 @@ EditTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr) NS_ADDREF_THIS(); return NS_OK; } + if (aIID.Equals(nsITransactionDescription::GetIID())) { + *aInstancePtr = (void*)(nsITransactionDescription*)this; + NS_ADDREF_THIS(); + return NS_OK; + } + *aInstancePtr = 0; return NS_NOINTERFACE; } diff --git a/editor/libeditor/base/EditTxn.h b/editor/libeditor/base/EditTxn.h index 8a3bfe4446e..fd8144047dd 100644 --- a/editor/libeditor/base/EditTxn.h +++ b/editor/libeditor/base/EditTxn.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -20,6 +20,7 @@ #define EditTxn_h__ #include "nsITransaction.h" +#include "nsITransactionDescription.h" #include "nsCOMPtr.h" #define EDIT_TXN_CID \ @@ -34,6 +35,7 @@ * it is never seen by the user or by any external entity. */ class EditTxn : public nsITransaction + , public nsITransactionDescription { public: @@ -61,6 +63,11 @@ public: NS_IMETHOD GetRedoString(nsString *aString); + enum { kTransactionID = 11100 }; + + NS_DECL_NSITRANSACTIONDESCRIPTION + nsString mLogDescription; + int mTransactionID; }; #endif diff --git a/editor/libeditor/base/IMETextTxn.cpp b/editor/libeditor/base/IMETextTxn.cpp index 5cdcad7a39c..093a0e1851b 100644 --- a/editor/libeditor/base/IMETextTxn.cpp +++ b/editor/libeditor/base/IMETextTxn.cpp @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -39,6 +39,8 @@ nsresult IMETextTxn::ClassInit() IMETextTxn::IMETextTxn() : EditTxn() { + SetTransactionDescriptionID( kTransactionID ); + /* log description initialized in parent constructor */ } IMETextTxn::~IMETextTxn() diff --git a/editor/libeditor/base/IMETextTxn.h b/editor/libeditor/base/IMETextTxn.h index 9e4a70dd167..cb9c6032525 100644 --- a/editor/libeditor/base/IMETextTxn.h +++ b/editor/libeditor/base/IMETextTxn.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -93,6 +93,8 @@ public: /** must be called before any IMETextTxn is instantiated */ static nsresult ClassInit(); + enum { kTransactionID = 11220 }; + protected: NS_IMETHOD CollapseTextSelection(void); diff --git a/editor/libeditor/base/InsertElementTxn.cpp b/editor/libeditor/base/InsertElementTxn.cpp index a16f58f6f1d..9e30bfb2af8 100644 --- a/editor/libeditor/base/InsertElementTxn.cpp +++ b/editor/libeditor/base/InsertElementTxn.cpp @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -30,6 +30,8 @@ static const PRBool gNoisy = PR_FALSE; InsertElementTxn::InsertElementTxn() : EditTxn() { + SetTransactionDescriptionID( kTransactionID ); + /* log description initialized in parent constructor */ } NS_IMETHODIMP InsertElementTxn::Init(nsIDOMNode *aNode, diff --git a/editor/libeditor/base/InsertElementTxn.h b/editor/libeditor/base/InsertElementTxn.h index 6d1da7db628..bdda95f8ef8 100644 --- a/editor/libeditor/base/InsertElementTxn.h +++ b/editor/libeditor/base/InsertElementTxn.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -67,6 +67,8 @@ public: NS_IMETHOD GetRedoString(nsString *aString); + enum { kTransactionID = 11150 }; + protected: /** the element to insert */ diff --git a/editor/libeditor/base/InsertTextTxn.cpp b/editor/libeditor/base/InsertTextTxn.cpp index 22608b2c0b9..a1ae58ea465 100644 --- a/editor/libeditor/base/InsertTextTxn.cpp +++ b/editor/libeditor/base/InsertTextTxn.cpp @@ -43,6 +43,8 @@ nsresult InsertTextTxn::ClassInit() InsertTextTxn::InsertTextTxn() : EditTxn() { + SetTransactionDescriptionID( kTransactionID ); + /* log description initialized in parent constructor */ } InsertTextTxn::~InsertTextTxn() @@ -153,23 +155,29 @@ NS_IMETHODIMP InsertTextTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransacti { // yep, it's one of ours. By definition, it must contain only // another aggregate with a single child, // or a single InsertTextTxn - nsCOMPtr childTxn; - otherTxn->GetTxnAt(0, getter_AddRefs(childTxn)); + EditTxn * childTxn; + otherTxn->GetTxnAt(0, (&childTxn)); if (childTxn) { - nsCOMPtr otherInsertTxn; - otherInsertTxn = do_QueryInterface(childTxn); - if (otherInsertTxn) + InsertTextTxn * otherInsertTxn = nsnull; + result = childTxn->QueryInterface(InsertTextTxn::GetCID(), (void**)&otherInsertTxn); + if (NS_SUCCEEDED(result)) { - if (PR_TRUE==IsSequentialInsert(otherInsertTxn)) + if (otherInsertTxn) { - nsAutoString otherData; - otherInsertTxn->GetData(otherData); - mStringToInsert += otherData; - *aDidMerge = PR_TRUE; - if (gNoisy) { printf("InsertTextTxn assimilated %p\n", aTransaction); } - } + if (PR_TRUE==IsSequentialInsert(otherInsertTxn)) + { + nsAutoString otherData; + otherInsertTxn->GetData(otherData); + mStringToInsert += otherData; + *aDidMerge = PR_TRUE; + if (gNoisy) { printf("InsertTextTxn assimilated %p\n", aTransaction); } + } + NS_RELEASE(otherInsertTxn); + } } + + NS_RELEASE(childTxn); } } NS_RELEASE(otherTxn); diff --git a/editor/libeditor/base/InsertTextTxn.h b/editor/libeditor/base/InsertTextTxn.h index 72995eb7372..3162b837741 100644 --- a/editor/libeditor/base/InsertTextTxn.h +++ b/editor/libeditor/base/InsertTextTxn.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -87,6 +87,8 @@ public: /** must be called before any InsertTextTxn is instantiated */ static nsresult ClassInit(); + enum { kTransactionID = 11120 }; + protected: /** return PR_TRUE if aOtherTxn immediately follows this txn */ diff --git a/editor/libeditor/base/JoinElementTxn.cpp b/editor/libeditor/base/JoinElementTxn.cpp index fee5981dfcf..ad0df3e10a9 100644 --- a/editor/libeditor/base/JoinElementTxn.cpp +++ b/editor/libeditor/base/JoinElementTxn.cpp @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -31,6 +31,8 @@ static const PRBool gNoisy = PR_FALSE; JoinElementTxn::JoinElementTxn() : EditTxn() { + SetTransactionDescriptionID( kTransactionID ); + /* log description initialized in parent constructor */ } NS_IMETHODIMP JoinElementTxn::Init(nsIEditor *aEditor, diff --git a/editor/libeditor/base/JoinElementTxn.h b/editor/libeditor/base/JoinElementTxn.h index 7b951252b74..20f13f530b2 100644 --- a/editor/libeditor/base/JoinElementTxn.h +++ b/editor/libeditor/base/JoinElementTxn.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -73,6 +73,8 @@ public: NS_IMETHOD GetRedoString(nsString *aString); + enum { kTransactionID = 11200 }; + protected: /** the elements to operate upon. diff --git a/editor/libeditor/base/PlaceholderTxn.cpp b/editor/libeditor/base/PlaceholderTxn.cpp index 667a5873bcd..6201acfcaad 100644 --- a/editor/libeditor/base/PlaceholderTxn.cpp +++ b/editor/libeditor/base/PlaceholderTxn.cpp @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -30,6 +30,8 @@ PlaceholderTxn::PlaceholderTxn() : EditAggregateTxn() { mAbsorb=PR_TRUE; + SetTransactionDescriptionID( kTransactionID ); + /* log description initialized in parent constructor */ } @@ -73,4 +75,3 @@ NS_IMETHODIMP PlaceholderTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransact } return result; } - diff --git a/editor/libeditor/base/PlaceholderTxn.h b/editor/libeditor/base/PlaceholderTxn.h index 74441711026..3d214e34d30 100644 --- a/editor/libeditor/base/PlaceholderTxn.h +++ b/editor/libeditor/base/PlaceholderTxn.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -53,6 +53,8 @@ public: friend class TransactionFactory; + enum { kTransactionID = 11260 }; + protected: PRBool mAbsorb; diff --git a/editor/libeditor/base/SplitElementTxn.cpp b/editor/libeditor/base/SplitElementTxn.cpp index 5bc467f3549..754d0ad7fac 100644 --- a/editor/libeditor/base/SplitElementTxn.cpp +++ b/editor/libeditor/base/SplitElementTxn.cpp @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -33,6 +33,8 @@ static const PRBool gNoisy = PR_FALSE; SplitElementTxn::SplitElementTxn() : EditTxn() { + SetTransactionDescriptionID( kTransactionID ); + /* log description initialized in parent constructor */ } NS_IMETHODIMP SplitElementTxn::Init(nsIEditor *aEditor, diff --git a/editor/libeditor/base/SplitElementTxn.h b/editor/libeditor/base/SplitElementTxn.h index cb12f7d81af..e174e8186b0 100644 --- a/editor/libeditor/base/SplitElementTxn.h +++ b/editor/libeditor/base/SplitElementTxn.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -71,6 +71,8 @@ public: NS_IMETHOD GetNewNode(nsIDOMNode **aNewNode); + enum { kTransactionID = 11190 }; + protected: /** the element to operate upon */ diff --git a/editor/libeditor/base/nsStyleSheetTxns.cpp b/editor/libeditor/base/nsStyleSheetTxns.cpp index cfb2c5011fe..202a9385417 100644 --- a/editor/libeditor/base/nsStyleSheetTxns.cpp +++ b/editor/libeditor/base/nsStyleSheetTxns.cpp @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -31,8 +31,11 @@ AddStyleSheetTxn::AddStyleSheetTxn() -: mEditor(NULL) +: EditTxn() +, mEditor(NULL) { + SetTransactionDescriptionID( kTransactionID ); + /* log description initialized in parent constructor */ } AddStyleSheetTxn::~AddStyleSheetTxn() @@ -160,15 +163,16 @@ AddStyleSheetTxn::GetRedoString(nsString *aString) return NS_OK; } - #ifdef XP_MAC #pragma mark - #endif RemoveStyleSheetTxn::RemoveStyleSheetTxn() -: mEditor(NULL) +: EditTxn() +, mEditor(NULL) { + SetTransactionDescriptionID( kTransactionID ); } RemoveStyleSheetTxn::~RemoveStyleSheetTxn() diff --git a/editor/libeditor/base/nsStyleSheetTxns.h b/editor/libeditor/base/nsStyleSheetTxns.h index e6eea9195af..34a2b302f78 100644 --- a/editor/libeditor/base/nsStyleSheetTxns.h +++ b/editor/libeditor/base/nsStyleSheetTxns.h @@ -12,7 +12,7 @@ * * The Initial Developer of this code under the NPL is Netscape * Communications Corporation. Portions created by Netscape are - * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights * Reserved. */ @@ -69,6 +69,8 @@ public: NS_IMETHOD GetRedoString(nsString *aString); + enum { kTransactionID = 11240 }; + protected: nsIEditor* mEditor; // the editor that created this transaction @@ -113,6 +115,8 @@ public: NS_IMETHOD GetRedoString(nsString *aString); + enum { kTransactionID = 11250 }; + protected: nsIEditor* mEditor; // the editor that created this transaction