Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Member Functions | Private Attributes
nsEditorTxnLog Class Reference

implementation of a transaction listener object. More...

#include <nsEditorTxnLog.h>

Inheritance diagram for nsEditorTxnLog:
Inheritance graph
[legend]
Collaboration diagram for nsEditorTxnLog:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsEditorTxnLog (nsHTMLEditorLog *aEditorLog=0)
 The default constructor.
virtual ~nsEditorTxnLog ()
 The default destructor.
boolean willDo (in nsITransactionManager aManager, in nsITransaction aTransaction)
 Called before a transaction manager calls a transaction's doTransaction() method.
void didDo (in nsITransactionManager aManager, in nsITransaction aTransaction, in nsresult aDoResult)
 Called after a transaction manager calls the doTransaction() method of a transaction.
boolean willUndo (in nsITransactionManager aManager, in nsITransaction aTransaction)
 Called before a transaction manager calls the Undo() method of a transaction.
void didUndo (in nsITransactionManager aManager, in nsITransaction aTransaction, in nsresult aUndoResult)
 Called after a transaction manager calls the Undo() method of a transaction.
boolean willRedo (in nsITransactionManager aManager, in nsITransaction aTransaction)
 Called before a transaction manager calls the Redo() method of a transaction.
void didRedo (in nsITransactionManager aManager, in nsITransaction aTransaction, in nsresult aRedoResult)
 Called after a transaction manager calls the Redo() method of a transaction.
boolean willBeginBatch (in nsITransactionManager aManager)
 Called before a transaction manager begins a batch.
void didBeginBatch (in nsITransactionManager aManager, in nsresult aResult)
 Called after a transaction manager begins a batch.
boolean willEndBatch (in nsITransactionManager aManager)
 Called before a transaction manager ends a batch.
void didEndBatch (in nsITransactionManager aManager, in nsresult aResult)
 Called after a transaction manager ends a batch.
boolean willMerge (in nsITransactionManager aManager, in nsITransaction aTopTransaction, in nsITransaction aTransactionToMerge)
 Called before a transaction manager tries to merge a transaction, that was just executed, with the transaction at the top of the undo stack.
void didMerge (in nsITransactionManager aManager, in nsITransaction aTopTransaction, in nsITransaction aTransactionToMerge, in boolean aDidMerge, in nsresult aMergeResult)
 Called after a transaction manager tries to merge a transaction, that was just executed, with the transaction at the top of the undo stack.

Private Member Functions

nsresult PrintIndent (PRInt32 aIndentLevel)
nsresult Write (const char *aBuffer)
nsresult WriteInt (PRInt32 aInt)
nsresult WriteTransaction (nsITransaction *aTransaction)
nsresult Flush ()

Private Attributes

nsHTMLEditorLogmEditorLog
PRInt32 mIndentLevel
PRInt32 mBatchCount

Detailed Description

implementation of a transaction listener object.

Definition at line 50 of file nsEditorTxnLog.h.


Constructor & Destructor Documentation

The default constructor.

Definition at line 48 of file nsEditorTxnLog.cpp.

{
  mRefCnt      = 0;
  mIndentLevel = 0;
  mBatchCount  = 0;
  mEditorLog   = aEditorLog;
}

The default destructor.

Definition at line 56 of file nsEditorTxnLog.cpp.

{
}

Member Function Documentation

Called after a transaction manager begins a batch.

Parameters:
aManagerthe transaction manager that began a batch.
aResultthe nsresult returned after beginning a batch.
void nsITransactionListener::didDo ( in nsITransactionManager  aManager,
in nsITransaction  aTransaction,
in nsresult  aDoResult 
) [inherited]

Called after a transaction manager calls the doTransaction() method of a transaction.

Parameters:
aManagerthe transaction manager that did the transaction.
aTransactionthe transaction that was executed.
aDoResultthe nsresult returned after executing the transaction.

Called after a transaction manager ends a batch.

Parameters:
aManagerthe transaction manager ending a batch.
aResultthe nsresult returned after ending a batch.
void nsITransactionListener::didMerge ( in nsITransactionManager  aManager,
in nsITransaction  aTopTransaction,
in nsITransaction  aTransactionToMerge,
in boolean  aDidMerge,
in nsresult  aMergeResult 
) [inherited]

Called after a transaction manager tries to merge a transaction, that was just executed, with the transaction at the top of the undo stack.

Parameters:
aManagerthe transaction manager ending a batch.
aTopTransactionthe transaction at the top of the undo stack.
aTransactionToMergethe transaction to merge.
aDidMergetrue if transaction was merged, else false.
aMergeResultthe nsresult returned after the merge attempt.
aInterruptlisteners should set this to PR_TRUE if they want to interrupt normal control flow, without throwing an error.
void nsITransactionListener::didRedo ( in nsITransactionManager  aManager,
in nsITransaction  aTransaction,
in nsresult  aRedoResult 
) [inherited]

Called after a transaction manager calls the Redo() method of a transaction.

Parameters:
aManagerthe transaction manager redoing the transaction.
aTransactionthe transaction being redone.
aRedoResultthe nsresult returned after redoing the transaction.
void nsITransactionListener::didUndo ( in nsITransactionManager  aManager,
in nsITransaction  aTransaction,
in nsresult  aUndoResult 
) [inherited]

Called after a transaction manager calls the Undo() method of a transaction.

Parameters:
aManagerthe transaction manager undoing the transaction.
aTransactionthe transaction being undone.
aUndoResultthe nsresult returned after undoing the transaction.

Definition at line 392 of file nsEditorTxnLog.cpp.

{
  nsresult result = NS_OK;

#ifdef SLOWS_THINGS_WAY_DOWN

  if (mEditorLog)
    result = mEditorLog->Flush();
  else
    fflush(stdout);

#endif // SLOWS_THINGS_WAY_DOWN

  return result;
}

Here is the call graph for this function:

nsresult nsEditorTxnLog::PrintIndent ( PRInt32  aIndentLevel) [private]

Definition at line 350 of file nsEditorTxnLog.cpp.

{
  PRInt32 i;

  Write("    // ");

  for (i = 0; i < aIndentLevel; i++)
    Write("  ");

  return NS_OK;
}

Here is the call graph for this function:

Called before a transaction manager begins a batch.

Parameters:
aManagerthe transaction manager beginning a batch.
Returns:
boolean value returned by listener which indicates it's desire to interrupt normal control flow. Listeners should return true if they want to interrupt normal control flow, without throwing an error. Note that listeners can also interrupt normal control flow by throwing an nsresult that indicates an error.
boolean nsITransactionListener::willDo ( in nsITransactionManager  aManager,
in nsITransaction  aTransaction 
) [inherited]

Called before a transaction manager calls a transaction's doTransaction() method.

Parameters:
aManagerthe transaction manager doing the transaction.
aTransactionthe transaction being executed.
Returns:
boolean value returned by listener which indicates it's desire to interrupt normal control flow. Listeners should return true if they want to interrupt normal control flow, without throwing an error.

Called before a transaction manager ends a batch.

Parameters:
aManagerthe transaction manager ending a batch.
Returns:
boolean value returned by listener which indicates it's desire to interrupt normal control flow. Listeners should return true if they want to interrupt normal control flow, without throwing an error. Note that listeners can also interrupt normal control flow by throwing an nsresult that indicates an error.
boolean nsITransactionListener::willMerge ( in nsITransactionManager  aManager,
in nsITransaction  aTopTransaction,
in nsITransaction  aTransactionToMerge 
) [inherited]

Called before a transaction manager tries to merge a transaction, that was just executed, with the transaction at the top of the undo stack.

Parameters:
aManagerthe transaction manager ending a batch.
aTopTransactionthe transaction at the top of the undo stack.
aTransactionToMergethe transaction to merge.
Returns:
boolean value returned by listener which indicates it's desire to interrupt normal control flow. Listeners should return true if they want to interrupt normal control flow, without throwing an error. Note that listeners can also interrupt normal control flow by throwing an nsresult that indicates an error.
boolean nsITransactionListener::willRedo ( in nsITransactionManager  aManager,
in nsITransaction  aTransaction 
) [inherited]

Called before a transaction manager calls the Redo() method of a transaction.

Parameters:
aManagerthe transaction manager redoing the transaction.
aTransactionthe transaction being redone.
Returns:
boolean value returned by listener which indicates it's desire to interrupt normal control flow. Listeners should return true if they want to interrupt normal control flow, without throwing an error. Note that listeners can also interrupt normal control flow by throwing an nsresult that indicates an error.
boolean nsITransactionListener::willUndo ( in nsITransactionManager  aManager,
in nsITransaction  aTransaction 
) [inherited]

Called before a transaction manager calls the Undo() method of a transaction.

Parameters:
aManagerthe transaction manager undoing the transaction.
aTransactionthe transaction being undone.
Returns:
boolean value returned by listener which indicates it's desire to interrupt normal control flow. Listeners should return true if they want to interrupt normal control flow, without throwing an error. Note that listeners can also interrupt normal control flow by throwing an nsresult that indicates an error.
nsresult nsEditorTxnLog::Write ( const char *  aBuffer) [private]

Definition at line 363 of file nsEditorTxnLog.cpp.

{
  if (!aBuffer)
    return NS_ERROR_NULL_POINTER;

  if (mEditorLog)
    mEditorLog->Write(aBuffer);
  else
  {
    PRInt32 len = strlen(aBuffer);
    if (len > 0)
      fwrite(aBuffer, 1, len, stdout);
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 381 of file nsEditorTxnLog.cpp.

{
  if (mEditorLog)
    mEditorLog->WriteInt(aInt);
  else
    printf("%d", aInt);

  return NS_OK;
}

Here is the call graph for this function:

Definition at line 335 of file nsEditorTxnLog.cpp.

{
  nsString str;

  nsCOMPtr<nsPIEditorTransaction> txn = do_QueryInterface(aTransaction);
  if (txn) {
    txn->GetTxnDescription(str);
    if (str.IsEmpty())
      str.AssignLiteral("<NULL>");
  }

  return Write(NS_LossyConvertUCS2toASCII(str).get());
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 56 of file nsEditorTxnLog.h.

Definition at line 54 of file nsEditorTxnLog.h.

Definition at line 55 of file nsEditorTxnLog.h.


The documentation for this class was generated from the following files: