1999-06-30 00:31:22 +04:00
|
|
|
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
|
|
|
* compliance with the NPL. You may obtain a copy of the NPL at
|
|
|
|
* http://www.mozilla.org/NPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* NPL.
|
|
|
|
*
|
|
|
|
* The Initial Developer of this code under the NPL is Netscape
|
|
|
|
* Communications Corporation. Portions created by Netscape are
|
1999-09-22 02:31:27 +04:00
|
|
|
* Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights
|
1999-06-30 00:31:22 +04:00
|
|
|
* Reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "IMECommitTxn.h"
|
|
|
|
#include "nsEditor.h"
|
|
|
|
|
|
|
|
nsIAtom *IMECommitTxn::gIMECommitTxnName = nsnull;
|
|
|
|
|
|
|
|
nsresult IMECommitTxn::ClassInit()
|
|
|
|
{
|
|
|
|
if (nsnull==gIMECommitTxnName)
|
|
|
|
gIMECommitTxnName = NS_NewAtom("NS_IMECommitTxn");
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-10-07 00:27:41 +04:00
|
|
|
nsresult IMECommitTxn::ClassShutdown()
|
|
|
|
{
|
|
|
|
NS_IF_RELEASE(gIMECommitTxnName);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-06-30 00:31:22 +04:00
|
|
|
IMECommitTxn::IMECommitTxn()
|
|
|
|
: EditTxn()
|
|
|
|
{
|
1999-09-22 02:31:27 +04:00
|
|
|
SetTransactionDescriptionID( kTransactionID );
|
|
|
|
/* log description initialized in parent constructor */
|
1999-06-30 00:31:22 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
IMECommitTxn::~IMECommitTxn()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP IMECommitTxn::Init(void)
|
|
|
|
{
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP IMECommitTxn::Do(void)
|
|
|
|
{
|
1999-10-27 00:04:47 +04:00
|
|
|
#if defined(DEBUG_tague) || defined(DEBUG_ftang)
|
1999-06-30 01:12:43 +04:00
|
|
|
printf("Do IME Commit");
|
1999-06-30 00:31:22 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP IMECommitTxn::Undo(void)
|
|
|
|
{
|
1999-10-27 00:04:47 +04:00
|
|
|
#if defined(DEBUG_TAGUE) || defined(DEBUG_ftang)
|
1999-06-30 00:31:22 +04:00
|
|
|
printf("Undo IME Commit");
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP IMECommitTxn::Merge(PRBool *aDidMerge, nsITransaction *aTransaction)
|
|
|
|
{
|
1999-10-27 00:04:47 +04:00
|
|
|
#if defined(DEBUG_TAGUE) || defined(DEBUG_ftang)
|
1999-06-30 00:31:22 +04:00
|
|
|
printf("Merge IME Commit");
|
|
|
|
#endif
|
|
|
|
|
1999-10-18 18:48:41 +04:00
|
|
|
NS_ASSERTION(aDidMerge, "null ptr- aDidMerge");
|
|
|
|
NS_ASSERTION(aTransaction, "null ptr- aTransaction");
|
|
|
|
if((nsnull == aDidMerge) || (nsnull == aTransaction))
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
|
1999-06-30 00:31:22 +04:00
|
|
|
*aDidMerge=PR_FALSE;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP IMECommitTxn::Write(nsIOutputStream *aOutputStream)
|
|
|
|
{
|
1999-10-18 18:48:41 +04:00
|
|
|
NS_ASSERTION(aOutputStream, "null ptr- aOutputStream");
|
|
|
|
if(nsnull == aOutputStream)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
else
|
|
|
|
return NS_OK;
|
1999-06-30 00:31:22 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP IMECommitTxn::GetUndoString(nsString *aString)
|
|
|
|
{
|
1999-10-18 18:48:41 +04:00
|
|
|
NS_ASSERTION(aString, "null ptr- aString");
|
|
|
|
if(nsnull == aString) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
} else {
|
1999-06-30 00:31:22 +04:00
|
|
|
*aString="Remove IMECommit: ";
|
1999-10-18 18:48:41 +04:00
|
|
|
return NS_OK;
|
1999-06-30 00:31:22 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP IMECommitTxn::GetRedoString(nsString *aString)
|
|
|
|
{
|
1999-10-18 18:48:41 +04:00
|
|
|
NS_ASSERTION(aString, "null ptr- aString");
|
|
|
|
if(nsnull == aString) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
} else {
|
1999-06-30 00:31:22 +04:00
|
|
|
*aString="Insert IMECommit: ";
|
1999-10-18 18:48:41 +04:00
|
|
|
return NS_OK;
|
1999-06-30 00:31:22 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ============= nsISupports implementation ====================== */
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
IMECommitTxn::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|
|
|
{
|
|
|
|
if (nsnull == aInstancePtr) {
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
1999-07-15 23:13:46 +04:00
|
|
|
if (aIID.Equals(IMECommitTxn::GetCID())) {
|
1999-06-30 00:31:22 +04:00
|
|
|
*aInstancePtr = (void*)(IMECommitTxn*)this;
|
|
|
|
NS_ADDREF_THIS();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
return (EditTxn::QueryInterface(aIID, aInstancePtr));
|
|
|
|
}
|
|
|
|
|
|
|
|
|