allow for txn to have id/string for get/set

This commit is contained in:
brade%netscape.com 1999-09-21 22:31:27 +00:00
Родитель 735237d96e
Коммит 19ec219fb7
54 изменённых файлов: 284 добавлений и 82 удалений

Просмотреть файл

@ -23,6 +23,8 @@
ChangeAttributeTxn::ChangeAttributeTxn()
: EditTxn()
{
SetTransactionDescriptionID( kTransactionID );
/* log description initialized in parent constructor */
}
ChangeAttributeTxn::~ChangeAttributeTxn()

Просмотреть файл

@ -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 */

Просмотреть файл

@ -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,

Просмотреть файл

@ -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 */

Просмотреть файл

@ -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)

Просмотреть файл

@ -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 */

Просмотреть файл

@ -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)

Просмотреть файл

@ -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,

Просмотреть файл

@ -29,6 +29,8 @@ static const PRBool gNoisy = PR_FALSE;
DeleteTextTxn::DeleteTextTxn()
: EditTxn()
{
SetTransactionDescriptionID( kTransactionID );
/* log description initialized in parent constructor */
}
DeleteTextTxn::~DeleteTextTxn()

Просмотреть файл

@ -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 */

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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

Просмотреть файл

@ -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()

Просмотреть файл

@ -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;

Просмотреть файл

@ -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()

Просмотреть файл

@ -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);

Просмотреть файл

@ -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,

Просмотреть файл

@ -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 */

Просмотреть файл

@ -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<EditTxn> childTxn;
otherTxn->GetTxnAt(0, getter_AddRefs(childTxn));
EditTxn * childTxn;
otherTxn->GetTxnAt(0, (&childTxn));
if (childTxn)
{
nsCOMPtr<InsertTextTxn> 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);

Просмотреть файл

@ -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 */

Просмотреть файл

@ -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,

Просмотреть файл

@ -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.

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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,

Просмотреть файл

@ -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 */

Просмотреть файл

@ -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()

Просмотреть файл

@ -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

Просмотреть файл

@ -23,6 +23,8 @@
ChangeAttributeTxn::ChangeAttributeTxn()
: EditTxn()
{
SetTransactionDescriptionID( kTransactionID );
/* log description initialized in parent constructor */
}
ChangeAttributeTxn::~ChangeAttributeTxn()

Просмотреть файл

@ -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 */

Просмотреть файл

@ -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,

Просмотреть файл

@ -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 */

Просмотреть файл

@ -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)

Просмотреть файл

@ -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 */

Просмотреть файл

@ -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)

Просмотреть файл

@ -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,

Просмотреть файл

@ -29,6 +29,8 @@ static const PRBool gNoisy = PR_FALSE;
DeleteTextTxn::DeleteTextTxn()
: EditTxn()
{
SetTransactionDescriptionID( kTransactionID );
/* log description initialized in parent constructor */
}
DeleteTextTxn::~DeleteTextTxn()

Просмотреть файл

@ -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 */

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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

Просмотреть файл

@ -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()

Просмотреть файл

@ -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);

Просмотреть файл

@ -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,

Просмотреть файл

@ -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 */

Просмотреть файл

@ -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<EditTxn> childTxn;
otherTxn->GetTxnAt(0, getter_AddRefs(childTxn));
EditTxn * childTxn;
otherTxn->GetTxnAt(0, (&childTxn));
if (childTxn)
{
nsCOMPtr<InsertTextTxn> 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);

Просмотреть файл

@ -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 */

Просмотреть файл

@ -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,

Просмотреть файл

@ -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.

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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,

Просмотреть файл

@ -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 */

Просмотреть файл

@ -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()

Просмотреть файл

@ -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