redoing rules architecture

This commit is contained in:
jfrancis%netscape.com 1999-04-05 17:21:59 +00:00
parent 7c1be30e3d
commit fffd5158c3
12 changed files with 273 additions and 90 deletions

View File

@ -35,6 +35,9 @@ const static char* kMOZEditorBogusNodeValue="TRUE";
static NS_DEFINE_IID(kPlaceholderTxnIID, PLACEHOLDER_TXN_IID);
/********************************************************
* Constructor/Destructor
********************************************************/
nsHTMLEditRules::nsHTMLEditRules()
{
@ -44,6 +47,45 @@ nsHTMLEditRules::~nsHTMLEditRules()
{
}
/********************************************************
* Public methods
********************************************************/
NS_IMETHODIMP
nsHTMLEditRules::WillDoAction(int aAction, nsIDOMSelection *aSelection,
void **aOtherInfo, PRBool *aCancel)
{
if (!aSelection)
return NS_ERROR_NULL_POINTER;
switch (aAction)
{
case kInsertBreak:
return WillInsertBreak(aSelection, aCancel);
}
return nsTextEditRules::WillDoAction(aAction, aSelection, aOtherInfo, aCancel);
}
NS_IMETHODIMP
nsHTMLEditRules::DidDoAction(int aAction, nsIDOMSelection *aSelection,
void **aOtherInfo, nsresult aResult)
{
if (!aSelection)
return NS_ERROR_NULL_POINTER;
switch (aAction)
{
case kInsertBreak:
return DidInsertBreak(aSelection, aResult);
}
return nsTextEditRules::DidDoAction(aAction, aSelection, aOtherInfo, aResult);
}
/********************************************************
* Protected methods
********************************************************/
NS_IMETHODIMP
nsHTMLEditRules::WillInsertBreak(nsIDOMSelection *aSelection, PRBool *aCancel)
{

View File

@ -28,6 +28,18 @@ public:
nsHTMLEditRules();
virtual ~nsHTMLEditRules();
// nsEditRules methods
NS_IMETHOD WillDoAction(int aAction, nsIDOMSelection *aSelection, void **aOtherInfo, PRBool *aCancel);
NS_IMETHOD DidDoAction(int aAction, nsIDOMSelection *aSelection, void **aOtherInfo, nsresult aResult);
// nsHTMLEditRules action id's
enum
{
kInsertBreak = 3000
};
protected:
// nsHTMLEditRules implementation methods
NS_IMETHOD WillInsertBreak(nsIDOMSelection *aSelection, PRBool *aCancel);
NS_IMETHOD DidInsertBreak(nsIDOMSelection *aSelection, nsresult aResult);

View File

@ -146,7 +146,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertBreak()
// pre-process
nsEditor::GetSelection(getter_AddRefs(selection));
result = mRules->WillInsertBreak(selection, &cancel);
result = mRules->WillDoAction(nsHTMLEditRules::kInsertBreak, selection, nsnull, &cancel);
if ((PR_FALSE==cancel) && (NS_SUCCEEDED(result)))
{
// create the new BR node
@ -196,7 +196,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertBreak()
}
}
// post-process, always called if WillInsertBreak didn't return cancel==PR_TRUE
result = mRules->DidInsertBreak(selection, result);
result = mRules->DidDoAction(nsHTMLEditRules::kInsertBreak, selection, nsnull, result);
}
nsresult endTxnResult = nsEditor::EndTransaction(); // don't return this result!
NS_ASSERTION ((NS_SUCCEEDED(endTxnResult)), "bad end transaction result");

View File

@ -36,9 +36,9 @@ const static char* kMOZEditorBogusNodeValue="TRUE";
static NS_DEFINE_IID(kPlaceholderTxnIID, PLACEHOLDER_TXN_IID);
/*-------------------------------------------------------------------*
/********************************************************
* Helper Functions
*-------------------------------------------------------------------*/
********************************************************/
PRBool nsTextEditRules::NodeIsType(nsIDOMNode *aNode, nsIAtom *aTag)
{
@ -96,10 +96,9 @@ PRBool nsTextEditRules::IsEditable(nsIDOMNode *aNode)
}
/*-------------------------------------------------------------------*
/********************************************************
* Constructor/Destructor
*-------------------------------------------------------------------*/
********************************************************/
nsTextEditRules::nsTextEditRules()
{
@ -112,32 +111,66 @@ nsTextEditRules::~nsTextEditRules()
}
/*-------------------------------------------------------------------*
/********************************************************
* Public methods
*-------------------------------------------------------------------*/
********************************************************/
NS_IMETHODIMP
nsTextEditRules::Init(nsTextEditor *aEditor)
nsTextEditRules::Init(nsIEditor *aEditor)
{
// null aNextRule is ok
if (!aEditor) { return NS_ERROR_NULL_POINTER; }
mEditor = aEditor; // we hold a non-refcounted reference back to our editor
mEditor = (nsTextEditor*)aEditor; // we hold a non-refcounted reference back to our editor
return NS_OK;
}
NS_IMETHODIMP
nsTextEditRules::WillInsertBreak(nsIDOMSelection *aSelection, PRBool *aCancel)
NS_IMETHODIMP
nsTextEditRules::WillDoAction(int aAction, nsIDOMSelection *aSelection,
void **aOtherInfo, PRBool *aCancel)
{
return NS_ERROR_NOT_IMPLEMENTED;
if (!aSelection)
return NS_ERROR_NULL_POINTER;
switch (aAction)
{
case kInsertText:
return WillInsertText(aSelection, aCancel, (PlaceholderTxn**)aOtherInfo);
case kDeleteSelection:
return WillDeleteSelection(aSelection, aCancel);
case kUndo:
return WillUndo(aSelection, aCancel);
case kRedo:
return WillRedo(aSelection, aCancel);
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsTextEditRules::DidDoAction(int aAction, nsIDOMSelection *aSelection,
void **aOtherInfo, nsresult aResult)
{
if (!aSelection)
return NS_ERROR_NULL_POINTER;
switch (aAction)
{
case kInsertText:
return DidInsertText(aSelection, aResult);
case kDeleteSelection:
return DidDeleteSelection(aSelection, aResult);
case kUndo:
return DidUndo(aSelection, aResult);
case kRedo:
return DidRedo(aSelection, aResult);
}
return NS_ERROR_FAILURE;
}
/********************************************************
* Protected methods
********************************************************/
NS_IMETHODIMP
nsTextEditRules::DidInsertBreak(nsIDOMSelection *aSelection, nsresult aResult)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsTextEditRules::WillInsert(nsIDOMSelection *aSelection, PRBool *aCancel)
@ -166,18 +199,13 @@ nsTextEditRules::DidInsert(nsIDOMSelection *aSelection, nsresult aResult)
NS_IMETHODIMP
nsTextEditRules::WillInsertText(nsIDOMSelection *aSelection,
const nsString &aInputString,
PRBool *aCancel,
nsString &aOutputString,
TypeInState &aTypeInState,
PRBool *aCancel,
PlaceholderTxn **aTxn)
{
if (!aSelection || !aCancel) { return NS_ERROR_NULL_POINTER; }
// initialize out param
*aCancel = PR_FALSE;
// by default, we insert what we're told to insert
aOutputString = aInputString;
TypeInState typeInState = aTypeInState; // remember the initial type-in state
TypeInState typeInState = mEditor->GetTypeInState();
if (mBogusNode || (PR_TRUE==typeInState.IsAnySet()))
{
nsresult result = TransactionFactory::GetNewTransaction(kPlaceholderTxnIID, (EditTxn **)aTxn);
@ -199,7 +227,6 @@ nsTextEditRules::WillInsertText(nsIDOMSelection *aSelection,
NS_IMETHODIMP
nsTextEditRules::DidInsertText(nsIDOMSelection *aSelection,
const nsString& aStringToInsert,
nsresult aResult)
{
return DidInsert(aSelection, aResult);

View File

@ -20,12 +20,13 @@
#define nsTextEditRules_h__
#include "nsIEditor.h"
#include "nsEditRules.h"
#include "nsCOMPtr.h"
#include "nsIDOMNode.h"
#include "TypeInState.h"
class nsTextEditor;
class PlaceholderTxn;
class nsTextEditor;
/** Object that encapsulates HTML text-specific editing rules.
*
@ -38,25 +39,34 @@ class PlaceholderTxn;
* 2. Selection must not be explicitly set by the rule method.
* Any manipulation of Selection must be done by the editor.
*/
class nsTextEditRules
class nsTextEditRules : public nsEditRules
{
public:
nsTextEditRules();
virtual ~nsTextEditRules();
NS_IMETHOD Init(nsTextEditor *aEditor);
// nsEditRules methods
NS_IMETHOD Init(nsIEditor *aEditor);
NS_IMETHOD WillDoAction(int aAction, nsIDOMSelection *aSelection, void **aOtherInfo, PRBool *aCancel);
NS_IMETHOD DidDoAction(int aAction, nsIDOMSelection *aSelection, void **aOtherInfo, nsresult aResult);
NS_IMETHOD WillInsertBreak(nsIDOMSelection *aSelection, PRBool *aCancel);
NS_IMETHOD DidInsertBreak(nsIDOMSelection *aSelection, nsresult aResult);
// nsTextEditRules action id's
enum
{
kUndo = 1000,
kRedo = 1001,
kInsertText = 2000,
kDeleteSelection = 2001
};
protected:
// nsTextEditRules implementation methods
NS_IMETHOD WillInsertText(nsIDOMSelection *aSelection,
const nsString &aInputString,
PRBool *aCancel,
nsString &aOutputString,
TypeInState &aTypeInState,
PlaceholderTxn **aTxn);
NS_IMETHOD DidInsertText(nsIDOMSelection *aSelection, const nsString& aStringToInsert, nsresult aResult);
NS_IMETHOD DidInsertText(nsIDOMSelection *aSelection, nsresult aResult);
NS_IMETHOD CreateStyleForInsertText(nsIDOMSelection *aSelection, TypeInState &aTypeInState);
NS_IMETHOD WillInsert(nsIDOMSelection *aSelection, PRBool *aCancel);
@ -71,8 +81,6 @@ public:
NS_IMETHOD WillRedo(nsIDOMSelection *aSelection, PRBool *aCancel);
NS_IMETHOD DidRedo(nsIDOMSelection *aSelection, nsresult aResult);
protected:
// helper functions
static PRBool NodeIsType(nsIDOMNode *aNode, nsIAtom *aTag);
static PRBool IsEditable(nsIDOMNode *aNode);
@ -83,6 +91,7 @@ protected:
*/
NS_IMETHOD InsertStyleNode(nsIDOMNode *aNode, nsIAtom *aTag, nsIDOMSelection *aSelection);
// data
nsTextEditor *mEditor; // note that we do not refcount the editor
nsCOMPtr<nsIDOMNode> mBogusNode; // magic node acts as placeholder in empty doc
};

View File

@ -650,12 +650,12 @@ NS_IMETHODIMP nsTextEditor::DeleteSelection(nsIEditor::Direction aDir)
// pre-process
nsEditor::GetSelection(getter_AddRefs(selection));
result = mRules->WillDeleteSelection(selection, &cancel);
result = mRules->WillDoAction(nsTextEditRules::kDeleteSelection, selection, nsnull, &cancel);
if ((PR_FALSE==cancel) && (NS_SUCCEEDED(result)))
{
result = nsEditor::DeleteSelection(aDir);
// post-process
result = mRules->DidDeleteSelection(selection, result);
result = mRules->DidDoAction(nsTextEditRules::kDeleteSelection, selection, nsnull, result);
}
nsresult endTxnResult = nsEditor::EndTransaction(); // don't return this result!
@ -683,13 +683,12 @@ NS_IMETHODIMP nsTextEditor::InsertText(const nsString& aStringToInsert)
nsEditor::GetSelection(getter_AddRefs(selection));
nsAutoString stringToInsert;
PlaceholderTxn *placeholderTxn=nsnull;
nsresult result = mRules->WillInsertText(selection, aStringToInsert, &cancel, stringToInsert,
mTypeInState, &placeholderTxn);
nsresult result = mRules->WillDoAction(nsTextEditRules::kInsertText, selection, (void**)&placeholderTxn, &cancel);
if ((PR_FALSE==cancel) && (NS_SUCCEEDED(result)))
{
result = nsEditor::InsertText(stringToInsert);
// post-process
result = mRules->DidInsertText(selection, stringToInsert, result);
result = mRules->DidDoAction(nsTextEditRules::kInsertText, selection, nsnull, result);
}
if (placeholderTxn)
placeholderTxn->SetAbsorb(PR_FALSE); // this ends the merging of txns into placeholderTxn
@ -721,12 +720,12 @@ NS_IMETHODIMP nsTextEditor::Undo(PRUint32 aCount)
// pre-process
nsEditor::GetSelection(getter_AddRefs(selection));
nsresult result = mRules->WillUndo(selection, &cancel);
nsresult result = mRules->WillDoAction(nsTextEditRules::kUndo, selection, nsnull, &cancel);
if ((PR_FALSE==cancel) && (NS_SUCCEEDED(result)))
{
result = nsEditor::Undo(aCount);
nsEditor::GetSelection(getter_AddRefs(selection));
result = mRules->DidUndo(selection, result);
result = mRules->DidDoAction(nsTextEditRules::kUndo, selection, nsnull, result);
}
return result;
}
@ -743,12 +742,12 @@ NS_IMETHODIMP nsTextEditor::Redo(PRUint32 aCount)
// pre-process
nsEditor::GetSelection(getter_AddRefs(selection));
nsresult result = mRules->WillRedo(selection, &cancel);
nsresult result = mRules->WillDoAction(nsTextEditRules::kRedo, selection, nsnull, &cancel);
if ((PR_FALSE==cancel) && (NS_SUCCEEDED(result)))
{
result = nsEditor::Redo(aCount);
nsEditor::GetSelection(getter_AddRefs(selection));
result = mRules->DidRedo(selection, result);
result = mRules->DidDoAction(nsTextEditRules::kRedo, selection, nsnull, result);
}
return result;
}

View File

@ -161,17 +161,21 @@ protected:
NS_IMETHOD SetTypeInStateForProperty(TypeInState &aTypeInState, nsIAtom *aPropName);
TypeInState GetTypeInState() { return mTypeInState;}
// Data members
protected:
TypeInState mTypeInState;
TypeInState mTypeInState; // xxx - isn't it wrong to have xpcom classes as members? shouldn't it be a pointer?
nsTextEditRules* mRules;
nsCOMPtr<nsIDOMEventListener> mKeyListenerP;
nsCOMPtr<nsIDOMEventListener> mMouseListenerP;
nsCOMPtr<nsIDOMEventListener> mTextListenerP;
nsCOMPtr<nsIDOMEventListener> mDragListenerP;
// friends
friend class nsTextEditRules;
};
#endif //nsTextEditor_h__

View File

@ -35,6 +35,9 @@ const static char* kMOZEditorBogusNodeValue="TRUE";
static NS_DEFINE_IID(kPlaceholderTxnIID, PLACEHOLDER_TXN_IID);
/********************************************************
* Constructor/Destructor
********************************************************/
nsHTMLEditRules::nsHTMLEditRules()
{
@ -44,6 +47,45 @@ nsHTMLEditRules::~nsHTMLEditRules()
{
}
/********************************************************
* Public methods
********************************************************/
NS_IMETHODIMP
nsHTMLEditRules::WillDoAction(int aAction, nsIDOMSelection *aSelection,
void **aOtherInfo, PRBool *aCancel)
{
if (!aSelection)
return NS_ERROR_NULL_POINTER;
switch (aAction)
{
case kInsertBreak:
return WillInsertBreak(aSelection, aCancel);
}
return nsTextEditRules::WillDoAction(aAction, aSelection, aOtherInfo, aCancel);
}
NS_IMETHODIMP
nsHTMLEditRules::DidDoAction(int aAction, nsIDOMSelection *aSelection,
void **aOtherInfo, nsresult aResult)
{
if (!aSelection)
return NS_ERROR_NULL_POINTER;
switch (aAction)
{
case kInsertBreak:
return DidInsertBreak(aSelection, aResult);
}
return nsTextEditRules::DidDoAction(aAction, aSelection, aOtherInfo, aResult);
}
/********************************************************
* Protected methods
********************************************************/
NS_IMETHODIMP
nsHTMLEditRules::WillInsertBreak(nsIDOMSelection *aSelection, PRBool *aCancel)
{

View File

@ -28,6 +28,18 @@ public:
nsHTMLEditRules();
virtual ~nsHTMLEditRules();
// nsEditRules methods
NS_IMETHOD WillDoAction(int aAction, nsIDOMSelection *aSelection, void **aOtherInfo, PRBool *aCancel);
NS_IMETHOD DidDoAction(int aAction, nsIDOMSelection *aSelection, void **aOtherInfo, nsresult aResult);
// nsHTMLEditRules action id's
enum
{
kInsertBreak = 3000
};
protected:
// nsHTMLEditRules implementation methods
NS_IMETHOD WillInsertBreak(nsIDOMSelection *aSelection, PRBool *aCancel);
NS_IMETHOD DidInsertBreak(nsIDOMSelection *aSelection, nsresult aResult);

View File

@ -146,7 +146,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertBreak()
// pre-process
nsEditor::GetSelection(getter_AddRefs(selection));
result = mRules->WillInsertBreak(selection, &cancel);
result = mRules->WillDoAction(nsHTMLEditRules::kInsertBreak, selection, nsnull, &cancel);
if ((PR_FALSE==cancel) && (NS_SUCCEEDED(result)))
{
// create the new BR node
@ -196,7 +196,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertBreak()
}
}
// post-process, always called if WillInsertBreak didn't return cancel==PR_TRUE
result = mRules->DidInsertBreak(selection, result);
result = mRules->DidDoAction(nsHTMLEditRules::kInsertBreak, selection, nsnull, result);
}
nsresult endTxnResult = nsEditor::EndTransaction(); // don't return this result!
NS_ASSERTION ((NS_SUCCEEDED(endTxnResult)), "bad end transaction result");

View File

@ -36,9 +36,9 @@ const static char* kMOZEditorBogusNodeValue="TRUE";
static NS_DEFINE_IID(kPlaceholderTxnIID, PLACEHOLDER_TXN_IID);
/*-------------------------------------------------------------------*
/********************************************************
* Helper Functions
*-------------------------------------------------------------------*/
********************************************************/
PRBool nsTextEditRules::NodeIsType(nsIDOMNode *aNode, nsIAtom *aTag)
{
@ -96,10 +96,9 @@ PRBool nsTextEditRules::IsEditable(nsIDOMNode *aNode)
}
/*-------------------------------------------------------------------*
/********************************************************
* Constructor/Destructor
*-------------------------------------------------------------------*/
********************************************************/
nsTextEditRules::nsTextEditRules()
{
@ -112,32 +111,66 @@ nsTextEditRules::~nsTextEditRules()
}
/*-------------------------------------------------------------------*
/********************************************************
* Public methods
*-------------------------------------------------------------------*/
********************************************************/
NS_IMETHODIMP
nsTextEditRules::Init(nsTextEditor *aEditor)
nsTextEditRules::Init(nsIEditor *aEditor)
{
// null aNextRule is ok
if (!aEditor) { return NS_ERROR_NULL_POINTER; }
mEditor = aEditor; // we hold a non-refcounted reference back to our editor
mEditor = (nsTextEditor*)aEditor; // we hold a non-refcounted reference back to our editor
return NS_OK;
}
NS_IMETHODIMP
nsTextEditRules::WillInsertBreak(nsIDOMSelection *aSelection, PRBool *aCancel)
NS_IMETHODIMP
nsTextEditRules::WillDoAction(int aAction, nsIDOMSelection *aSelection,
void **aOtherInfo, PRBool *aCancel)
{
return NS_ERROR_NOT_IMPLEMENTED;
if (!aSelection)
return NS_ERROR_NULL_POINTER;
switch (aAction)
{
case kInsertText:
return WillInsertText(aSelection, aCancel, (PlaceholderTxn**)aOtherInfo);
case kDeleteSelection:
return WillDeleteSelection(aSelection, aCancel);
case kUndo:
return WillUndo(aSelection, aCancel);
case kRedo:
return WillRedo(aSelection, aCancel);
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsTextEditRules::DidDoAction(int aAction, nsIDOMSelection *aSelection,
void **aOtherInfo, nsresult aResult)
{
if (!aSelection)
return NS_ERROR_NULL_POINTER;
switch (aAction)
{
case kInsertText:
return DidInsertText(aSelection, aResult);
case kDeleteSelection:
return DidDeleteSelection(aSelection, aResult);
case kUndo:
return DidUndo(aSelection, aResult);
case kRedo:
return DidRedo(aSelection, aResult);
}
return NS_ERROR_FAILURE;
}
/********************************************************
* Protected methods
********************************************************/
NS_IMETHODIMP
nsTextEditRules::DidInsertBreak(nsIDOMSelection *aSelection, nsresult aResult)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsTextEditRules::WillInsert(nsIDOMSelection *aSelection, PRBool *aCancel)
@ -166,18 +199,13 @@ nsTextEditRules::DidInsert(nsIDOMSelection *aSelection, nsresult aResult)
NS_IMETHODIMP
nsTextEditRules::WillInsertText(nsIDOMSelection *aSelection,
const nsString &aInputString,
PRBool *aCancel,
nsString &aOutputString,
TypeInState &aTypeInState,
PRBool *aCancel,
PlaceholderTxn **aTxn)
{
if (!aSelection || !aCancel) { return NS_ERROR_NULL_POINTER; }
// initialize out param
*aCancel = PR_FALSE;
// by default, we insert what we're told to insert
aOutputString = aInputString;
TypeInState typeInState = aTypeInState; // remember the initial type-in state
TypeInState typeInState = mEditor->GetTypeInState();
if (mBogusNode || (PR_TRUE==typeInState.IsAnySet()))
{
nsresult result = TransactionFactory::GetNewTransaction(kPlaceholderTxnIID, (EditTxn **)aTxn);
@ -199,7 +227,6 @@ nsTextEditRules::WillInsertText(nsIDOMSelection *aSelection,
NS_IMETHODIMP
nsTextEditRules::DidInsertText(nsIDOMSelection *aSelection,
const nsString& aStringToInsert,
nsresult aResult)
{
return DidInsert(aSelection, aResult);

View File

@ -20,12 +20,13 @@
#define nsTextEditRules_h__
#include "nsIEditor.h"
#include "nsEditRules.h"
#include "nsCOMPtr.h"
#include "nsIDOMNode.h"
#include "TypeInState.h"
class nsTextEditor;
class PlaceholderTxn;
class nsTextEditor;
/** Object that encapsulates HTML text-specific editing rules.
*
@ -38,25 +39,34 @@ class PlaceholderTxn;
* 2. Selection must not be explicitly set by the rule method.
* Any manipulation of Selection must be done by the editor.
*/
class nsTextEditRules
class nsTextEditRules : public nsEditRules
{
public:
nsTextEditRules();
virtual ~nsTextEditRules();
NS_IMETHOD Init(nsTextEditor *aEditor);
// nsEditRules methods
NS_IMETHOD Init(nsIEditor *aEditor);
NS_IMETHOD WillDoAction(int aAction, nsIDOMSelection *aSelection, void **aOtherInfo, PRBool *aCancel);
NS_IMETHOD DidDoAction(int aAction, nsIDOMSelection *aSelection, void **aOtherInfo, nsresult aResult);
NS_IMETHOD WillInsertBreak(nsIDOMSelection *aSelection, PRBool *aCancel);
NS_IMETHOD DidInsertBreak(nsIDOMSelection *aSelection, nsresult aResult);
// nsTextEditRules action id's
enum
{
kUndo = 1000,
kRedo = 1001,
kInsertText = 2000,
kDeleteSelection = 2001
};
protected:
// nsTextEditRules implementation methods
NS_IMETHOD WillInsertText(nsIDOMSelection *aSelection,
const nsString &aInputString,
PRBool *aCancel,
nsString &aOutputString,
TypeInState &aTypeInState,
PlaceholderTxn **aTxn);
NS_IMETHOD DidInsertText(nsIDOMSelection *aSelection, const nsString& aStringToInsert, nsresult aResult);
NS_IMETHOD DidInsertText(nsIDOMSelection *aSelection, nsresult aResult);
NS_IMETHOD CreateStyleForInsertText(nsIDOMSelection *aSelection, TypeInState &aTypeInState);
NS_IMETHOD WillInsert(nsIDOMSelection *aSelection, PRBool *aCancel);
@ -71,8 +81,6 @@ public:
NS_IMETHOD WillRedo(nsIDOMSelection *aSelection, PRBool *aCancel);
NS_IMETHOD DidRedo(nsIDOMSelection *aSelection, nsresult aResult);
protected:
// helper functions
static PRBool NodeIsType(nsIDOMNode *aNode, nsIAtom *aTag);
static PRBool IsEditable(nsIDOMNode *aNode);
@ -83,6 +91,7 @@ protected:
*/
NS_IMETHOD InsertStyleNode(nsIDOMNode *aNode, nsIAtom *aTag, nsIDOMSelection *aSelection);
// data
nsTextEditor *mEditor; // note that we do not refcount the editor
nsCOMPtr<nsIDOMNode> mBogusNode; // magic node acts as placeholder in empty doc
};