Modified nsIEditActionListener to have Will*() and Do*() methods. Added

nsIEditActionListener support to nsEditor.cpp and nsEditor.h.
This commit is contained in:
kin%netscape.com 1999-04-27 17:14:28 +00:00
parent bc0c874c0a
commit 6aa1c4b270
9 changed files with 556 additions and 58 deletions

View File

@ -43,6 +43,8 @@
#include "nsVoidArray.h"
#include "nsICaret.h"
#include "nsIEditActionListener.h"
#include "nsIContent.h"
#include "nsIContentIterator.h"
#include "nsLayoutCID.h"
@ -293,6 +295,7 @@ nsEditor::nsEditor()
NS_INIT_REFCNT();
PR_EnterMonitor(getEditorMonitor());
gInstanceCount++;
mActionListeners = 0;
PR_ExitMonitor(getEditorMonitor());
}
@ -302,6 +305,21 @@ nsEditor::~nsEditor()
{
NS_IF_RELEASE(mPresShell);
NS_IF_RELEASE(mViewManager);
if (mActionListeners)
{
PRInt32 i;
nsIEditActionListener *listener;
for (i = 0; i < mActionListeners->Count(); i++)
{
listener = (nsIEditActionListener *)mActionListeners->ElementAt(i);
NS_IF_RELEASE(listener);
}
delete mActionListeners;
mActionListeners = 0;
}
}
@ -977,6 +995,49 @@ NS_IMETHODIMP nsEditor::Paste()
return InsertText(stuffToPaste);
}
NS_IMETHODIMP
nsEditor::AddEditActionListener(nsIEditActionListener *aListener)
{
if (!aListener)
return NS_ERROR_NULL_POINTER;
if (!mActionListeners)
{
mActionListeners = new nsVoidArray();
if (!mActionListeners)
return NS_ERROR_OUT_OF_MEMORY;
}
if (!mActionListeners->AppendElement((void *)aListener))
return NS_ERROR_FAILURE;
NS_ADDREF(aListener);
return NS_OK;
}
NS_IMETHODIMP
nsEditor::RemoveEditActionListener(nsIEditActionListener *aListener)
{
if (!aListener || !mActionListeners)
return NS_ERROR_FAILURE;
if (!mActionListeners->RemoveElement((void *)aListener))
return NS_ERROR_FAILURE;
NS_IF_RELEASE(aListener);
if (mActionListeners->Count() < 1)
{
delete mActionListeners;
mActionListeners = 0;
}
return NS_OK;
}
nsString & nsIEditor::GetTextNodeTag()
{
static nsString gTextNodeTag("special text node tag");
@ -1023,11 +1084,35 @@ NS_IMETHODIMP nsEditor::InsertNode(nsIDOMNode * aNode,
nsIDOMNode * aParent,
PRInt32 aPosition)
{
PRInt32 i;
nsIEditActionListener *listener;
if (mActionListeners)
{
for (i = 0; i < mActionListeners->Count(); i++)
{
listener = (nsIEditActionListener *)mActionListeners->ElementAt(i);
if (listener)
listener->WillInsertNode(aNode, aParent, aPosition);
}
}
InsertElementTxn *txn;
nsresult result = CreateTxnForInsertElement(aNode, aParent, aPosition, &txn);
if (NS_SUCCEEDED(result)) {
result = Do(txn);
}
if (mActionListeners)
{
for (i = 0; i < mActionListeners->Count(); i++)
{
listener = (nsIEditActionListener *)mActionListeners->ElementAt(i);
if (listener)
listener->DidInsertNode(aNode, aParent, aPosition, result);
}
}
return result;
}
@ -1049,11 +1134,35 @@ NS_IMETHODIMP nsEditor::CreateTxnForInsertElement(nsIDOMNode * aNode,
NS_IMETHODIMP nsEditor::DeleteNode(nsIDOMNode * aElement)
{
PRInt32 i;
nsIEditActionListener *listener;
if (mActionListeners)
{
for (i = 0; i < mActionListeners->Count(); i++)
{
listener = (nsIEditActionListener *)mActionListeners->ElementAt(i);
if (listener)
listener->WillDeleteNode(aElement);
}
}
DeleteElementTxn *txn;
nsresult result = CreateTxnForDeleteElement(aElement, &txn);
if (NS_SUCCEEDED(result)) {
result = Do(txn);
}
if (mActionListeners)
{
for (i = 0; i < mActionListeners->Count(); i++)
{
listener = (nsIEditActionListener *)mActionListeners->ElementAt(i);
if (listener)
listener->DidDeleteNode(aElement, result);
}
}
return result;
}
@ -1818,6 +1927,19 @@ nsEditor::SplitNode(nsIDOMNode * aNode,
PRInt32 aOffset,
nsIDOMNode **aNewLeftNode)
{
PRInt32 i;
nsIEditActionListener *listener;
if (mActionListeners)
{
for (i = 0; i < mActionListeners->Count(); i++)
{
listener = (nsIEditActionListener *)mActionListeners->ElementAt(i);
if (listener)
listener->WillSplitNode(aNode, aOffset);
}
}
SplitElementTxn *txn;
nsresult result = CreateTxnForSplitNode(aNode, aOffset, &txn);
if (NS_SUCCEEDED(result))
@ -1829,6 +1951,20 @@ nsEditor::SplitNode(nsIDOMNode * aNode,
NS_ASSERTION((NS_SUCCEEDED(result)), "result must succeeded for GetNewNode");
}
}
if (mActionListeners)
{
for (i = 0; i < mActionListeners->Count(); i++)
{
listener = (nsIEditActionListener *)mActionListeners->ElementAt(i);
if (listener)
{
nsIDOMNode *ptr = (aNewLeftNode) ? *aNewLeftNode : 0;
listener->DidSplitNode(aNode, aOffset, ptr, result);
}
}
}
return result;
}
@ -1852,11 +1988,35 @@ nsEditor::JoinNodes(nsIDOMNode * aLeftNode,
nsIDOMNode * aRightNode,
nsIDOMNode * aParent)
{
PRInt32 i;
nsIEditActionListener *listener;
if (mActionListeners)
{
for (i = 0; i < mActionListeners->Count(); i++)
{
listener = (nsIEditActionListener *)mActionListeners->ElementAt(i);
if (listener)
listener->WillJoinNodes(aLeftNode, aRightNode, aParent);
}
}
JoinElementTxn *txn;
nsresult result = CreateTxnForJoinNode(aLeftNode, aRightNode, &txn);
if (NS_SUCCEEDED(result)) {
result = Do(txn);
}
if (mActionListeners)
{
for (i = 0; i < mActionListeners->Count(); i++)
{
listener = (nsIEditActionListener *)mActionListeners->ElementAt(i);
if (listener)
listener->DidJoinNodes(aLeftNode, aRightNode, aParent, result);
}
}
return result;
}

View File

@ -30,6 +30,7 @@
#include "TransactionFactory.h"
#include "nsIComponentManager.h"
class nsIEditActionListener;
class nsIDOMCharacterData;
class nsIDOMRange;
class nsIPresShell;
@ -66,6 +67,8 @@ private:
friend PRBool NSCanUnload(nsISupports* serviceMgr);
static PRInt32 gInstanceCount;
nsVoidArray *mActionListeners;
protected:
nsCOMPtr<nsIDOMDocument> mDoc;
@ -167,6 +170,10 @@ public:
NS_IMETHOD Paste();
NS_IMETHOD AddEditActionListener(nsIEditActionListener *aListener);
NS_IMETHOD RemoveEditActionListener(nsIEditActionListener *aListener);
/*END nsIEditor interfaces*/

View File

@ -43,6 +43,8 @@
#include "nsVoidArray.h"
#include "nsICaret.h"
#include "nsIEditActionListener.h"
#include "nsIContent.h"
#include "nsIContentIterator.h"
#include "nsLayoutCID.h"
@ -293,6 +295,7 @@ nsEditor::nsEditor()
NS_INIT_REFCNT();
PR_EnterMonitor(getEditorMonitor());
gInstanceCount++;
mActionListeners = 0;
PR_ExitMonitor(getEditorMonitor());
}
@ -302,6 +305,21 @@ nsEditor::~nsEditor()
{
NS_IF_RELEASE(mPresShell);
NS_IF_RELEASE(mViewManager);
if (mActionListeners)
{
PRInt32 i;
nsIEditActionListener *listener;
for (i = 0; i < mActionListeners->Count(); i++)
{
listener = (nsIEditActionListener *)mActionListeners->ElementAt(i);
NS_IF_RELEASE(listener);
}
delete mActionListeners;
mActionListeners = 0;
}
}
@ -977,6 +995,49 @@ NS_IMETHODIMP nsEditor::Paste()
return InsertText(stuffToPaste);
}
NS_IMETHODIMP
nsEditor::AddEditActionListener(nsIEditActionListener *aListener)
{
if (!aListener)
return NS_ERROR_NULL_POINTER;
if (!mActionListeners)
{
mActionListeners = new nsVoidArray();
if (!mActionListeners)
return NS_ERROR_OUT_OF_MEMORY;
}
if (!mActionListeners->AppendElement((void *)aListener))
return NS_ERROR_FAILURE;
NS_ADDREF(aListener);
return NS_OK;
}
NS_IMETHODIMP
nsEditor::RemoveEditActionListener(nsIEditActionListener *aListener)
{
if (!aListener || !mActionListeners)
return NS_ERROR_FAILURE;
if (!mActionListeners->RemoveElement((void *)aListener))
return NS_ERROR_FAILURE;
NS_IF_RELEASE(aListener);
if (mActionListeners->Count() < 1)
{
delete mActionListeners;
mActionListeners = 0;
}
return NS_OK;
}
nsString & nsIEditor::GetTextNodeTag()
{
static nsString gTextNodeTag("special text node tag");
@ -1023,11 +1084,35 @@ NS_IMETHODIMP nsEditor::InsertNode(nsIDOMNode * aNode,
nsIDOMNode * aParent,
PRInt32 aPosition)
{
PRInt32 i;
nsIEditActionListener *listener;
if (mActionListeners)
{
for (i = 0; i < mActionListeners->Count(); i++)
{
listener = (nsIEditActionListener *)mActionListeners->ElementAt(i);
if (listener)
listener->WillInsertNode(aNode, aParent, aPosition);
}
}
InsertElementTxn *txn;
nsresult result = CreateTxnForInsertElement(aNode, aParent, aPosition, &txn);
if (NS_SUCCEEDED(result)) {
result = Do(txn);
}
if (mActionListeners)
{
for (i = 0; i < mActionListeners->Count(); i++)
{
listener = (nsIEditActionListener *)mActionListeners->ElementAt(i);
if (listener)
listener->DidInsertNode(aNode, aParent, aPosition, result);
}
}
return result;
}
@ -1049,11 +1134,35 @@ NS_IMETHODIMP nsEditor::CreateTxnForInsertElement(nsIDOMNode * aNode,
NS_IMETHODIMP nsEditor::DeleteNode(nsIDOMNode * aElement)
{
PRInt32 i;
nsIEditActionListener *listener;
if (mActionListeners)
{
for (i = 0; i < mActionListeners->Count(); i++)
{
listener = (nsIEditActionListener *)mActionListeners->ElementAt(i);
if (listener)
listener->WillDeleteNode(aElement);
}
}
DeleteElementTxn *txn;
nsresult result = CreateTxnForDeleteElement(aElement, &txn);
if (NS_SUCCEEDED(result)) {
result = Do(txn);
}
if (mActionListeners)
{
for (i = 0; i < mActionListeners->Count(); i++)
{
listener = (nsIEditActionListener *)mActionListeners->ElementAt(i);
if (listener)
listener->DidDeleteNode(aElement, result);
}
}
return result;
}
@ -1818,6 +1927,19 @@ nsEditor::SplitNode(nsIDOMNode * aNode,
PRInt32 aOffset,
nsIDOMNode **aNewLeftNode)
{
PRInt32 i;
nsIEditActionListener *listener;
if (mActionListeners)
{
for (i = 0; i < mActionListeners->Count(); i++)
{
listener = (nsIEditActionListener *)mActionListeners->ElementAt(i);
if (listener)
listener->WillSplitNode(aNode, aOffset);
}
}
SplitElementTxn *txn;
nsresult result = CreateTxnForSplitNode(aNode, aOffset, &txn);
if (NS_SUCCEEDED(result))
@ -1829,6 +1951,20 @@ nsEditor::SplitNode(nsIDOMNode * aNode,
NS_ASSERTION((NS_SUCCEEDED(result)), "result must succeeded for GetNewNode");
}
}
if (mActionListeners)
{
for (i = 0; i < mActionListeners->Count(); i++)
{
listener = (nsIEditActionListener *)mActionListeners->ElementAt(i);
if (listener)
{
nsIDOMNode *ptr = (aNewLeftNode) ? *aNewLeftNode : 0;
listener->DidSplitNode(aNode, aOffset, ptr, result);
}
}
}
return result;
}
@ -1852,11 +1988,35 @@ nsEditor::JoinNodes(nsIDOMNode * aLeftNode,
nsIDOMNode * aRightNode,
nsIDOMNode * aParent)
{
PRInt32 i;
nsIEditActionListener *listener;
if (mActionListeners)
{
for (i = 0; i < mActionListeners->Count(); i++)
{
listener = (nsIEditActionListener *)mActionListeners->ElementAt(i);
if (listener)
listener->WillJoinNodes(aLeftNode, aRightNode, aParent);
}
}
JoinElementTxn *txn;
nsresult result = CreateTxnForJoinNode(aLeftNode, aRightNode, &txn);
if (NS_SUCCEEDED(result)) {
result = Do(txn);
}
if (mActionListeners)
{
for (i = 0; i < mActionListeners->Count(); i++)
{
listener = (nsIEditActionListener *)mActionListeners->ElementAt(i);
if (listener)
listener->DidJoinNodes(aLeftNode, aRightNode, aParent, result);
}
}
return result;
}

View File

@ -30,6 +30,7 @@
#include "TransactionFactory.h"
#include "nsIComponentManager.h"
class nsIEditActionListener;
class nsIDOMCharacterData;
class nsIDOMRange;
class nsIPresShell;
@ -66,6 +67,8 @@ private:
friend PRBool NSCanUnload(nsISupports* serviceMgr);
static PRInt32 gInstanceCount;
nsVoidArray *mActionListeners;
protected:
nsCOMPtr<nsIDOMDocument> mDoc;
@ -167,6 +170,10 @@ public:
NS_IMETHOD Paste();
NS_IMETHOD AddEditActionListener(nsIEditActionListener *aListener);
NS_IMETHOD RemoveEditActionListener(nsIEditActionListener *aListener);
/*END nsIEditor interfaces*/

View File

@ -79,10 +79,22 @@ nsTSDNotifier::QueryInterface(REFNSIID aIID, void** aInstancePtr)
}
NS_IMETHODIMP
nsTSDNotifier::InsertNode(nsIDOMNode *aNode,
nsIDOMNode *aParent,
PRInt32 aPosition)
nsTSDNotifier::WillInsertNode(nsIDOMNode *aNode,
nsIDOMNode *aParent,
PRInt32 aPosition)
{
return NS_OK;
}
NS_IMETHODIMP
nsTSDNotifier::DidInsertNode(nsIDOMNode *aNode,
nsIDOMNode *aParent,
PRInt32 aPosition,
nsresult aResult)
{
if (NS_FAILED(aResult))
return NS_OK;
if (!mDoc)
return NS_ERROR_FAILURE;
@ -90,8 +102,17 @@ nsTSDNotifier::InsertNode(nsIDOMNode *aNode,
}
NS_IMETHODIMP
nsTSDNotifier::DeleteNode(nsIDOMNode *aChild)
nsTSDNotifier::WillDeleteNode(nsIDOMNode *aChild)
{
return NS_OK;
}
NS_IMETHODIMP
nsTSDNotifier::DidDeleteNode(nsIDOMNode *aChild, nsresult aResult)
{
if (NS_FAILED(aResult))
return NS_OK;
if (!mDoc)
return NS_ERROR_FAILURE;
@ -99,10 +120,21 @@ nsTSDNotifier::DeleteNode(nsIDOMNode *aChild)
}
NS_IMETHODIMP
nsTSDNotifier::SplitNode(nsIDOMNode *aExistingRightNode,
PRInt32 aOffset,
nsIDOMNode *aNewLeftNode)
nsTSDNotifier::WillSplitNode(nsIDOMNode *aExistingRightNode,
PRInt32 aOffset)
{
return NS_OK;
}
NS_IMETHODIMP
nsTSDNotifier::DidSplitNode(nsIDOMNode *aExistingRightNode,
PRInt32 aOffset,
nsIDOMNode *aNewLeftNode,
nsresult aResult)
{
if (NS_FAILED(aResult))
return NS_OK;
if (!mDoc)
return NS_ERROR_FAILURE;
@ -110,10 +142,22 @@ nsTSDNotifier::SplitNode(nsIDOMNode *aExistingRightNode,
}
NS_IMETHODIMP
nsTSDNotifier::JoinNodes(nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode,
nsIDOMNode *aParent)
nsTSDNotifier::WillJoinNodes(nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode,
nsIDOMNode *aParent)
{
return NS_OK;
}
NS_IMETHODIMP
nsTSDNotifier::DidJoinNodes(nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode,
nsIDOMNode *aParent,
nsresult aResult)
{
if (NS_FAILED(aResult))
return NS_OK;
if (!mDoc)
return NS_ERROR_FAILURE;

View File

@ -44,16 +44,31 @@ public:
NS_DECL_ISUPPORTS
/* nsIEditActionListener method implementations. */
NS_IMETHOD InsertNode(nsIDOMNode * aNode,
nsIDOMNode * aParent,
PRInt32 aPosition);
NS_IMETHOD DeleteNode(nsIDOMNode * aChild);
NS_IMETHOD SplitNode(nsIDOMNode * aExistingRightNode,
PRInt32 aOffset,
nsIDOMNode * aNewLeftNode);
NS_IMETHOD JoinNodes(nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode,
nsIDOMNode *aParent);
NS_IMETHOD WillInsertNode(nsIDOMNode *aNode,
nsIDOMNode *aParent,
PRInt32 aPosition);
NS_IMETHOD DidInsertNode(nsIDOMNode *aNode,
nsIDOMNode *aParent,
PRInt32 aPosition,
nsresult aResult);
NS_IMETHOD WillDeleteNode(nsIDOMNode *aChild);
NS_IMETHOD DidDeleteNode(nsIDOMNode *aChild, nsresult aResult);
NS_IMETHOD WillSplitNode(nsIDOMNode * aExistingRightNode,
PRInt32 aOffset);
NS_IMETHOD DidSplitNode(nsIDOMNode *aExistingRightNode,
PRInt32 aOffset,
nsIDOMNode *aNewLeftNode,
nsresult aResult);
NS_IMETHOD WillJoinNodes(nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode,
nsIDOMNode *aParent);
NS_IMETHOD DidJoinNodes(nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode,
nsIDOMNode *aParent,
nsresult aResult);
};
#endif // nsTSDNotifier_h__

View File

@ -43,43 +43,89 @@ public:
static const nsIID& GetIID() { static nsIID iid = NS_IEDITACTIONLISTENER_IID; return iid; }
/**
* Called when the editor inserts a node.
* Called before the editor inserts a node.
* @param aNode The DOM Node to insert.
* @param aParent The node to insert the new object into
* @param aPosition The place in aParent to insert the new node
* 0=first child, 1=second child, etc.
* any number > number of current children = last child
*/
NS_IMETHOD InsertNode(nsIDOMNode * aNode,
nsIDOMNode * aParent,
PRInt32 aPosition)=0;
NS_IMETHOD WillInsertNode(nsIDOMNode *aNode,
nsIDOMNode *aParent,
PRInt32 aPosition)=0;
/**
* Called when the editor deletes a node.
* Called after the editor inserts a node.
* @param aNode The DOM Node to insert.
* @param aParent The node to insert the new object into
* @param aPosition The place in aParent to insert the new node
* 0=first child, 1=second child, etc.
* any number > number of current children = last child
* @param aResult The result of the insert node operation.
*/
NS_IMETHOD DidInsertNode(nsIDOMNode *aNode,
nsIDOMNode *aParent,
PRInt32 aPosition,
nsresult aResult)=0;
/**
* Called before the editor deletes a node.
* @param aChild The node to delete
*/
NS_IMETHOD DeleteNode(nsIDOMNode * aChild)=0;
NS_IMETHOD WillDeleteNode(nsIDOMNode *aChild)=0;
/**
* Called when the editor splits a node.
* Called after the editor deletes a node.
* @param aChild The node to delete
* @param aResult The result of the delete node operation.
*/
NS_IMETHOD DidDeleteNode(nsIDOMNode *aChild, nsresult aResult)=0;
/**
* Called before the editor splits a node.
* @param aExistingRightNode the node to split. It will become the new node's next sibling.
* @param aOffset the offset of aExistingRightNode's content|children to do the split at
* @param aNewLeftNode [OUT] the new node resulting from the split, becomes aExistingRightNode's previous sibling.
*/
NS_IMETHOD SplitNode(nsIDOMNode * aExistingRightNode,
PRInt32 aOffset,
nsIDOMNode * aNewLeftNode)=0;
NS_IMETHOD WillSplitNode(nsIDOMNode *aExistingRightNode,
PRInt32 aOffset)=0;
/**
* Called when the editor joins 2 nodes.
* @param aNodeToKeep The left node. It will remain after the join.
* @param aNodeToJoin The right node.
* There is no requirement that the two nodes be of the same type.
* @param aParent The parent of aExistingRightNode
* Called after the editor splits a node.
* @param aExistingRightNode the node to split. It will become the new node's next sibling.
* @param aOffset the offset of aExistingRightNode's content|children to do the split at
* @param aNewLeftNode [OUT] the new node resulting from the split, becomes aExistingRightNode's previous sibling.
*/
NS_IMETHOD JoinNodes(nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode,
nsIDOMNode *aParent)=0;
NS_IMETHOD DidSplitNode(nsIDOMNode *aExistingRightNode,
PRInt32 aOffset,
nsIDOMNode *aNewLeftNode,
nsresult aResult)=0;
/**
* Called before the editor joins 2 nodes.
* @param aLeftNode This node will be merged into the right node
* @param aRightNode The node that will be merged into.
* There is no requirement that the two nodes be of
* the same type.
* @param aParent The parent of aRightNode
*/
NS_IMETHOD WillJoinNodes(nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode,
nsIDOMNode *aParent)=0;
/**
* Called before the editor joins 2 nodes.
* @param aLeftNode This node will be merged into the right node
* @param aRightNode The node that will be merged into.
* There is no requirement that the two nodes be of
* the same type.
* @param aParent The parent of aRightNode
* @param aResult The result of the join operation.
*/
NS_IMETHOD DidJoinNodes(nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode,
nsIDOMNode *aParent,
nsresult aResult)=0;
};

View File

@ -79,10 +79,22 @@ nsTSDNotifier::QueryInterface(REFNSIID aIID, void** aInstancePtr)
}
NS_IMETHODIMP
nsTSDNotifier::InsertNode(nsIDOMNode *aNode,
nsIDOMNode *aParent,
PRInt32 aPosition)
nsTSDNotifier::WillInsertNode(nsIDOMNode *aNode,
nsIDOMNode *aParent,
PRInt32 aPosition)
{
return NS_OK;
}
NS_IMETHODIMP
nsTSDNotifier::DidInsertNode(nsIDOMNode *aNode,
nsIDOMNode *aParent,
PRInt32 aPosition,
nsresult aResult)
{
if (NS_FAILED(aResult))
return NS_OK;
if (!mDoc)
return NS_ERROR_FAILURE;
@ -90,8 +102,17 @@ nsTSDNotifier::InsertNode(nsIDOMNode *aNode,
}
NS_IMETHODIMP
nsTSDNotifier::DeleteNode(nsIDOMNode *aChild)
nsTSDNotifier::WillDeleteNode(nsIDOMNode *aChild)
{
return NS_OK;
}
NS_IMETHODIMP
nsTSDNotifier::DidDeleteNode(nsIDOMNode *aChild, nsresult aResult)
{
if (NS_FAILED(aResult))
return NS_OK;
if (!mDoc)
return NS_ERROR_FAILURE;
@ -99,10 +120,21 @@ nsTSDNotifier::DeleteNode(nsIDOMNode *aChild)
}
NS_IMETHODIMP
nsTSDNotifier::SplitNode(nsIDOMNode *aExistingRightNode,
PRInt32 aOffset,
nsIDOMNode *aNewLeftNode)
nsTSDNotifier::WillSplitNode(nsIDOMNode *aExistingRightNode,
PRInt32 aOffset)
{
return NS_OK;
}
NS_IMETHODIMP
nsTSDNotifier::DidSplitNode(nsIDOMNode *aExistingRightNode,
PRInt32 aOffset,
nsIDOMNode *aNewLeftNode,
nsresult aResult)
{
if (NS_FAILED(aResult))
return NS_OK;
if (!mDoc)
return NS_ERROR_FAILURE;
@ -110,10 +142,22 @@ nsTSDNotifier::SplitNode(nsIDOMNode *aExistingRightNode,
}
NS_IMETHODIMP
nsTSDNotifier::JoinNodes(nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode,
nsIDOMNode *aParent)
nsTSDNotifier::WillJoinNodes(nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode,
nsIDOMNode *aParent)
{
return NS_OK;
}
NS_IMETHODIMP
nsTSDNotifier::DidJoinNodes(nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode,
nsIDOMNode *aParent,
nsresult aResult)
{
if (NS_FAILED(aResult))
return NS_OK;
if (!mDoc)
return NS_ERROR_FAILURE;

View File

@ -44,16 +44,31 @@ public:
NS_DECL_ISUPPORTS
/* nsIEditActionListener method implementations. */
NS_IMETHOD InsertNode(nsIDOMNode * aNode,
nsIDOMNode * aParent,
PRInt32 aPosition);
NS_IMETHOD DeleteNode(nsIDOMNode * aChild);
NS_IMETHOD SplitNode(nsIDOMNode * aExistingRightNode,
PRInt32 aOffset,
nsIDOMNode * aNewLeftNode);
NS_IMETHOD JoinNodes(nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode,
nsIDOMNode *aParent);
NS_IMETHOD WillInsertNode(nsIDOMNode *aNode,
nsIDOMNode *aParent,
PRInt32 aPosition);
NS_IMETHOD DidInsertNode(nsIDOMNode *aNode,
nsIDOMNode *aParent,
PRInt32 aPosition,
nsresult aResult);
NS_IMETHOD WillDeleteNode(nsIDOMNode *aChild);
NS_IMETHOD DidDeleteNode(nsIDOMNode *aChild, nsresult aResult);
NS_IMETHOD WillSplitNode(nsIDOMNode * aExistingRightNode,
PRInt32 aOffset);
NS_IMETHOD DidSplitNode(nsIDOMNode *aExistingRightNode,
PRInt32 aOffset,
nsIDOMNode *aNewLeftNode,
nsresult aResult);
NS_IMETHOD WillJoinNodes(nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode,
nsIDOMNode *aParent);
NS_IMETHOD DidJoinNodes(nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode,
nsIDOMNode *aParent,
nsresult aResult);
};
#endif // nsTSDNotifier_h__