From f1990d8cbfb6de9605791af1c8f9fbe2c008b4b7 Mon Sep 17 00:00:00 2001 From: "mjudge%netscape.com" Date: Wed, 18 Nov 1998 00:49:02 +0000 Subject: [PATCH] editor changes will not affect build. working on typing git-svn-id: svn://10.0.0.236/trunk@14826 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/editor/base/editor.cpp | 115 ++++++++++++++++++++--- mozilla/editor/base/editor.h | 42 +++++++-- mozilla/editor/base/editorInterfaces.cpp | 11 ++- mozilla/editor/base/editorInterfaces.h | 24 ++--- mozilla/editor/core/editor.cpp | 115 ++++++++++++++++++++--- mozilla/editor/core/editor.h | 42 +++++++-- mozilla/editor/core/editorInterfaces.cpp | 11 ++- mozilla/editor/core/editorInterfaces.h | 24 ++--- mozilla/editor/public/nsIEditor.h | 10 +- 9 files changed, 319 insertions(+), 75 deletions(-) diff --git a/mozilla/editor/base/editor.cpp b/mozilla/editor/base/editor.cpp index bff5cdff395..e79e4acfd49 100644 --- a/mozilla/editor/base/editor.cpp +++ b/mozilla/editor/base/editor.cpp @@ -19,11 +19,13 @@ #include "editor.h" #include "nsIDOMEventReceiver.h" +#include "nsIDOMText.h" +#include "nsIDOMElement.h" //class implementations are in order they are declared in editor.h -Editor::Editor() +nsEditor::nsEditor() { //initialize member variables here } @@ -32,8 +34,9 @@ Editor::Editor() static NS_DEFINE_IID(kIDOMEventReceiverIID, NS_IDOMEVENTRECEIVER_IID); static NS_DEFINE_IID(kIDOMMouseListenerIID, NS_IDOMMOUSELISTENER_IID); static NS_DEFINE_IID(kIDOMKeyListenerIID, NS_IDOMKEYLISTENER_IID); +static NS_DEFINE_IID(kIDOMTextIID, NS_IDOMTEXT_IID); -Editor::~Editor() +nsEditor::~nsEditor() { //the autopointers will clear themselves up. //but we need to also remove the listeners or we have a leak @@ -53,14 +56,14 @@ Editor::~Editor() //BEGIN nsIEditor interface implementations -NS_IMPL_ADDREF(Editor) +NS_IMPL_ADDREF(nsEditor) -NS_IMPL_RELEASE(Editor) +NS_IMPL_RELEASE(nsEditor) nsresult -Editor::QueryInterface(REFNSIID aIID, void** aInstancePtr) +nsEditor::QueryInterface(REFNSIID aIID, void** aInstancePtr) { if (NULL == aInstancePtr) { return NS_ERROR_NULL_POINTER; @@ -83,10 +86,10 @@ Editor::QueryInterface(REFNSIID aIID, void** aInstancePtr) nsresult -Editor::Init(nsIDOMDocument *aDomInterface) +nsEditor::Init(nsIDOMDocument *aDomInterface) { if (!aDomInterface) - return NS_ERROR_ILLEGAL_VALUE; + return NS_ERROR_NULL_POINTER; mDomInterfaceP = aDomInterface; @@ -119,12 +122,20 @@ Editor::Init(nsIDOMDocument *aDomInterface) +nsresult +nsEditor::InsertString(nsString *aString) +{ + return AppendText(aString); +} + + + //END nsIEditorInterfaces -//BEGIN Editor Calls from public +//BEGIN nsEditor Calls from public PRBool -Editor::KeyDown(int aKeycode) +nsEditor::KeyDown(int aKeycode) { return PR_TRUE; } @@ -132,16 +143,92 @@ Editor::KeyDown(int aKeycode) PRBool -Editor::MouseClick(int aX,int aY) +nsEditor::MouseClick(int aX,int aY) { return PR_FALSE; } -//END Editor Calls from public +//END nsEditor Calls from public -//BEGIN Editor Private methods -//END Editor Private methods +//BEGIN nsEditor Private methods + + + +nsresult +nsEditor::AppendText(nsString *aStr) +{ + COM_auto_ptr mNode; + COM_auto_ptr mText; + if (!aStr) + return NS_ERROR_NULL_POINTER; + if (NS_SUCCEEDED(GetCurrentNode(func_AddRefs(mNode))) && + NS_SUCCEEDED(mNode->QueryInterface(kIDOMTextIID, func_AddRefs(mText)))) { + mText->AppendData(*aStr); + } + + return NS_OK; +} + + + +nsresult +nsEditor::GetCurrentNode(nsIDOMNode ** aNode) +{ + /* If no node set, get first text node */ + COM_auto_ptr docNode; + + if (NS_SUCCEEDED(mDomInterfaceP->GetFirstChild(func_AddRefs(docNode)))) + { + *aNode = docNode; + NS_ADDREF(*aNode); + return NS_OK; + } + return NS_ERROR_FAILURE; +} + + + +nsresult +nsEditor::GetFirstTextNode(nsIDOMNode *aNode, nsIDOMNode **aRetNode) +{ + assert(aRetNode != 0); // they better give me a place to put the answer + + PRUint16 mType; + PRBool mCNodes; + + COM_auto_ptr answer; + + aNode->GetNodeType(&mType); + + if (nsIDOMNode::ELEMENT_NODE == mType) { + if (NS_SUCCEEDED(aNode->HasChildNodes(&mCNodes)) && PR_TRUE == mCNodes) + { + COM_auto_ptr mNode; + + aNode->GetFirstChild(func_AddRefs(mNode)); + while(!answer) + { + GetFirstTextNode(mNode, func_AddRefs(answer)); + mNode->GetNextSibling(func_AddRefs(mNode)); + } + } + } + else if (nsIDOMNode::TEXT_NODE == mType) { + answer = aNode; + } + + // OK, now return the answer, if any + *aRetNode = answer; + if (*aRetNode) + NS_IF_ADDREF(*aRetNode); + else + return NS_ERROR_FAILURE; + + return NS_OK; +} + +//END nsEditor Private methods @@ -152,7 +239,7 @@ Editor::MouseClick(int aX,int aY) nsresult NS_InitEditor(nsIEditor ** aInstancePtrResult, nsIDOMDocument *aDomDoc) { - Editor* editor = new Editor(); + nsEditor* editor = new nsEditor(); if (NULL == editor) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/mozilla/editor/base/editor.h b/mozilla/editor/base/editor.h index 82209cb10ed..a7f6683fb39 100644 --- a/mozilla/editor/base/editor.h +++ b/mozilla/editor/base/editor.h @@ -25,7 +25,7 @@ * manager, event interfaces. the idea for the event interfaces is to have them * delegate the actual commands to the editor independent of the XPFE implementation. */ -class Editor : public nsIEditor +class nsEditor : public nsIEditor { private: COM_auto_ptr mDomInterfaceP; @@ -35,11 +35,11 @@ public: /** The default constructor. This should suffice. the setting of the interfaces is done * after the construction of the editor class. */ - Editor(); + nsEditor(); /** The default destructor. This should suffice. Should this be pure virtual - * for someone to derive from the Editor later? I dont believe so. + * for someone to derive from the nsEditor later? I dont believe so. */ - ~Editor(); + ~nsEditor(); /*BEGIN nsIEditor interfaces*/ /*see the nsIEditor for more details*/ @@ -47,15 +47,19 @@ public: /*interfaces for addref and release and queryinterface*/ NS_DECL_ISUPPORTS - virtual nsresult Init(nsIDOMDocument *aDomInterface); + virtual nsresult Init(nsIDOMDocument *aDomInterface); virtual nsresult GetDomInterface(nsIDOMDocument **aDomInterface){*aDomInterface = mDomInterfaceP; return NS_OK;} virtual nsresult SetProperties(PROPERTIES aProperty){return NS_OK;} - virtual nsresult GetProperties(PROPERTIES &){return NS_OK;} + + virtual nsresult GetProperties(PROPERTIES **){return NS_OK;} + + virtual nsresult InsertString(nsString *aString); + /*END nsIEditor interfaces*/ -/*BEGIN Editor interfaces*/ +/*BEGIN nsEditor interfaces*/ /*KeyListener Methods*/ @@ -72,6 +76,30 @@ public: * @param int y the yposition of the click */ PRBool MouseClick(int aX,int aY); //it should also tell us the dom element that was selected. + +/*BEGIN private methods used by the implementations of the above functions*/ + + /** AppendText is a private method that accepts a pointer to a string + * and will append it to the current node. this will be depricated + * @param nsString *aStr is the pointer to the valid string + */ + nsresult AppendText(nsString *aStr); + + /** GetCurrentNode ADDREFFS and will get the current node from selection. + * now it simply returns the first node in the dom + * @param nsIDOMNode **aNode is the return location of the dom node + */ + nsresult GetCurrentNode(nsIDOMNode ** aNode); + + /** GetFirstTextNode ADDREFFS and will get the next available text node from the passed + * in node parameter it can also return NS_ERROR_FAILURE if no text nodes are available + * now it simply returns the first node in the dom + * @param nsIDOMNode *aNode is the node to start looking from + * @param nsIDOMNode **aRetNode is the return location of the text dom node + */ + nsresult GetFirstTextNode(nsIDOMNode *aNode, nsIDOMNode **aRetNode); + +/*END private methods of nsEditor*/ }; diff --git a/mozilla/editor/base/editorInterfaces.cpp b/mozilla/editor/base/editorInterfaces.cpp index d326fe3f5a3..d3179f302de 100644 --- a/mozilla/editor/base/editorInterfaces.cpp +++ b/mozilla/editor/base/editorInterfaces.cpp @@ -124,6 +124,8 @@ editorKeyListener::KeyDown(nsIDOMEvent* aKeyEvent) if (!mIsShift) { key->ToLowerCase(); } + mEditor->InsertString(key); + delete key; } break; } @@ -234,6 +236,7 @@ editorMouseListener::MouseUp(nsIDOMEvent* aMouseEvent) nsresult editorMouseListener::MouseClick(nsIDOMEvent* aMouseEvent) { + mEditor->MouseClick(0,0); return NS_OK; } @@ -270,14 +273,14 @@ editorMouseListener::MouseOut(nsIDOMEvent* aMouseEvent) nsresult -NS_NewEditorKeyListener(nsIDOMEventListener ** aInstancePtrResult, Editor *aEditorP) +NS_NewEditorKeyListener(nsIDOMEventListener ** aInstancePtrResult, nsEditor *aEditor) { editorKeyListener* it = new editorKeyListener(); if (NULL == it) { return NS_ERROR_OUT_OF_MEMORY; } - it->SetEditor(aEditorP); + it->SetEditor(aEditor); static NS_DEFINE_IID(kIDOMEventListenerIID, NS_IDOMEVENTLISTENER_IID); @@ -287,14 +290,14 @@ NS_NewEditorKeyListener(nsIDOMEventListener ** aInstancePtrResult, Editor *aEdit nsresult -NS_NewEditorMouseListener(nsIDOMEventListener ** aInstancePtrResult, Editor *aEditorP) +NS_NewEditorMouseListener(nsIDOMEventListener ** aInstancePtrResult, nsEditor *aEditor) { editorMouseListener* it = new editorMouseListener(); if (NULL == it) { return NS_ERROR_OUT_OF_MEMORY; } - it->SetEditor(aEditorP); + it->SetEditor(aEditor); static NS_DEFINE_IID(kIDOMEventListenerIID, NS_IDOMEVENTLISTENER_IID); diff --git a/mozilla/editor/base/editorInterfaces.h b/mozilla/editor/base/editorInterfaces.h index bc378fc74e6..c16ba04f434 100644 --- a/mozilla/editor/base/editorInterfaces.h +++ b/mozilla/editor/base/editorInterfaces.h @@ -23,8 +23,8 @@ #include "nsIDOMKeyListener.h" #include "nsIDOMMouseListener.h" -//prototype for the Editor class that will be included in the .cpp file -class Editor; +//prototype for the nsEditor class that will be included in the .cpp file +class nsEditor; //nsIDOMKeyListener interface /** The editorKeyListener public nsIDOMKeyListener @@ -33,7 +33,7 @@ class Editor; * This should be done through contexts that are loaded from URLs */ class editorKeyListener : public nsIDOMKeyListener { - Editor *mEditorP; + nsEditor *mEditor; public: /** the default constructor */ @@ -43,14 +43,14 @@ public: virtual ~editorKeyListener(); /** SetEditor gives an address to the editor that will be accessed - * @param Editor *aEditor simple + * @param nsEditor *aEditor simple */ - void SetEditor(Editor *aEditorP){mEditorP = mEditorP;} + void SetEditor(nsEditor *aEditor){mEditor = aEditor;} /** GetEditor returns a copy of the address the keylistener has * @return copy of the editor address */ - Editor *GetEditor(){ return mEditorP; } + nsEditor *GetEditor(){ return mEditor; } /*interfaces for addref and release and queryinterface*/ NS_DECL_ISUPPORTS @@ -74,7 +74,7 @@ private: */ class editorMouseListener : public nsIDOMMouseListener { - Editor *mEditorP; + nsEditor *mEditor; public: /** default constructor */ @@ -84,14 +84,14 @@ public: virtual ~editorMouseListener(); /** SetEditor gives an address to the editor that will be accessed - * @param Editor *aEditor simple + * @param nsEditor *aEditor simple */ - void SetEditor(Editor *aEditorP){mEditorP = mEditorP;} + void SetEditor(nsEditor *aEditor){mEditor = aEditor;} /** GetEditor returns a copy of the address the keylistener has * @return copy of the editor address */ - Editor *GetEditor(){ return mEditorP; } + nsEditor *GetEditor(){ return mEditor; } /*interfaces for addref and release and queryinterface*/ NS_DECL_ISUPPORTS @@ -110,11 +110,11 @@ public: /** factory for the editor key listener */ -extern nsresult NS_NewEditorKeyListener(nsIDOMEventListener ** aInstancePtrResult, Editor *aEditorP); +extern nsresult NS_NewEditorKeyListener(nsIDOMEventListener ** aInstancePtrResult, nsEditor *aEditor); /** factory for the editor mouse listener */ -extern nsresult NS_NewEditorMouseListener(nsIDOMEventListener ** aInstancePtrResult, Editor *aEditorP); +extern nsresult NS_NewEditorMouseListener(nsIDOMEventListener ** aInstancePtrResult, nsEditor *aEditor); #endif //editorInterfaces_h__ diff --git a/mozilla/editor/core/editor.cpp b/mozilla/editor/core/editor.cpp index bff5cdff395..e79e4acfd49 100644 --- a/mozilla/editor/core/editor.cpp +++ b/mozilla/editor/core/editor.cpp @@ -19,11 +19,13 @@ #include "editor.h" #include "nsIDOMEventReceiver.h" +#include "nsIDOMText.h" +#include "nsIDOMElement.h" //class implementations are in order they are declared in editor.h -Editor::Editor() +nsEditor::nsEditor() { //initialize member variables here } @@ -32,8 +34,9 @@ Editor::Editor() static NS_DEFINE_IID(kIDOMEventReceiverIID, NS_IDOMEVENTRECEIVER_IID); static NS_DEFINE_IID(kIDOMMouseListenerIID, NS_IDOMMOUSELISTENER_IID); static NS_DEFINE_IID(kIDOMKeyListenerIID, NS_IDOMKEYLISTENER_IID); +static NS_DEFINE_IID(kIDOMTextIID, NS_IDOMTEXT_IID); -Editor::~Editor() +nsEditor::~nsEditor() { //the autopointers will clear themselves up. //but we need to also remove the listeners or we have a leak @@ -53,14 +56,14 @@ Editor::~Editor() //BEGIN nsIEditor interface implementations -NS_IMPL_ADDREF(Editor) +NS_IMPL_ADDREF(nsEditor) -NS_IMPL_RELEASE(Editor) +NS_IMPL_RELEASE(nsEditor) nsresult -Editor::QueryInterface(REFNSIID aIID, void** aInstancePtr) +nsEditor::QueryInterface(REFNSIID aIID, void** aInstancePtr) { if (NULL == aInstancePtr) { return NS_ERROR_NULL_POINTER; @@ -83,10 +86,10 @@ Editor::QueryInterface(REFNSIID aIID, void** aInstancePtr) nsresult -Editor::Init(nsIDOMDocument *aDomInterface) +nsEditor::Init(nsIDOMDocument *aDomInterface) { if (!aDomInterface) - return NS_ERROR_ILLEGAL_VALUE; + return NS_ERROR_NULL_POINTER; mDomInterfaceP = aDomInterface; @@ -119,12 +122,20 @@ Editor::Init(nsIDOMDocument *aDomInterface) +nsresult +nsEditor::InsertString(nsString *aString) +{ + return AppendText(aString); +} + + + //END nsIEditorInterfaces -//BEGIN Editor Calls from public +//BEGIN nsEditor Calls from public PRBool -Editor::KeyDown(int aKeycode) +nsEditor::KeyDown(int aKeycode) { return PR_TRUE; } @@ -132,16 +143,92 @@ Editor::KeyDown(int aKeycode) PRBool -Editor::MouseClick(int aX,int aY) +nsEditor::MouseClick(int aX,int aY) { return PR_FALSE; } -//END Editor Calls from public +//END nsEditor Calls from public -//BEGIN Editor Private methods -//END Editor Private methods +//BEGIN nsEditor Private methods + + + +nsresult +nsEditor::AppendText(nsString *aStr) +{ + COM_auto_ptr mNode; + COM_auto_ptr mText; + if (!aStr) + return NS_ERROR_NULL_POINTER; + if (NS_SUCCEEDED(GetCurrentNode(func_AddRefs(mNode))) && + NS_SUCCEEDED(mNode->QueryInterface(kIDOMTextIID, func_AddRefs(mText)))) { + mText->AppendData(*aStr); + } + + return NS_OK; +} + + + +nsresult +nsEditor::GetCurrentNode(nsIDOMNode ** aNode) +{ + /* If no node set, get first text node */ + COM_auto_ptr docNode; + + if (NS_SUCCEEDED(mDomInterfaceP->GetFirstChild(func_AddRefs(docNode)))) + { + *aNode = docNode; + NS_ADDREF(*aNode); + return NS_OK; + } + return NS_ERROR_FAILURE; +} + + + +nsresult +nsEditor::GetFirstTextNode(nsIDOMNode *aNode, nsIDOMNode **aRetNode) +{ + assert(aRetNode != 0); // they better give me a place to put the answer + + PRUint16 mType; + PRBool mCNodes; + + COM_auto_ptr answer; + + aNode->GetNodeType(&mType); + + if (nsIDOMNode::ELEMENT_NODE == mType) { + if (NS_SUCCEEDED(aNode->HasChildNodes(&mCNodes)) && PR_TRUE == mCNodes) + { + COM_auto_ptr mNode; + + aNode->GetFirstChild(func_AddRefs(mNode)); + while(!answer) + { + GetFirstTextNode(mNode, func_AddRefs(answer)); + mNode->GetNextSibling(func_AddRefs(mNode)); + } + } + } + else if (nsIDOMNode::TEXT_NODE == mType) { + answer = aNode; + } + + // OK, now return the answer, if any + *aRetNode = answer; + if (*aRetNode) + NS_IF_ADDREF(*aRetNode); + else + return NS_ERROR_FAILURE; + + return NS_OK; +} + +//END nsEditor Private methods @@ -152,7 +239,7 @@ Editor::MouseClick(int aX,int aY) nsresult NS_InitEditor(nsIEditor ** aInstancePtrResult, nsIDOMDocument *aDomDoc) { - Editor* editor = new Editor(); + nsEditor* editor = new nsEditor(); if (NULL == editor) { return NS_ERROR_OUT_OF_MEMORY; } diff --git a/mozilla/editor/core/editor.h b/mozilla/editor/core/editor.h index 82209cb10ed..a7f6683fb39 100644 --- a/mozilla/editor/core/editor.h +++ b/mozilla/editor/core/editor.h @@ -25,7 +25,7 @@ * manager, event interfaces. the idea for the event interfaces is to have them * delegate the actual commands to the editor independent of the XPFE implementation. */ -class Editor : public nsIEditor +class nsEditor : public nsIEditor { private: COM_auto_ptr mDomInterfaceP; @@ -35,11 +35,11 @@ public: /** The default constructor. This should suffice. the setting of the interfaces is done * after the construction of the editor class. */ - Editor(); + nsEditor(); /** The default destructor. This should suffice. Should this be pure virtual - * for someone to derive from the Editor later? I dont believe so. + * for someone to derive from the nsEditor later? I dont believe so. */ - ~Editor(); + ~nsEditor(); /*BEGIN nsIEditor interfaces*/ /*see the nsIEditor for more details*/ @@ -47,15 +47,19 @@ public: /*interfaces for addref and release and queryinterface*/ NS_DECL_ISUPPORTS - virtual nsresult Init(nsIDOMDocument *aDomInterface); + virtual nsresult Init(nsIDOMDocument *aDomInterface); virtual nsresult GetDomInterface(nsIDOMDocument **aDomInterface){*aDomInterface = mDomInterfaceP; return NS_OK;} virtual nsresult SetProperties(PROPERTIES aProperty){return NS_OK;} - virtual nsresult GetProperties(PROPERTIES &){return NS_OK;} + + virtual nsresult GetProperties(PROPERTIES **){return NS_OK;} + + virtual nsresult InsertString(nsString *aString); + /*END nsIEditor interfaces*/ -/*BEGIN Editor interfaces*/ +/*BEGIN nsEditor interfaces*/ /*KeyListener Methods*/ @@ -72,6 +76,30 @@ public: * @param int y the yposition of the click */ PRBool MouseClick(int aX,int aY); //it should also tell us the dom element that was selected. + +/*BEGIN private methods used by the implementations of the above functions*/ + + /** AppendText is a private method that accepts a pointer to a string + * and will append it to the current node. this will be depricated + * @param nsString *aStr is the pointer to the valid string + */ + nsresult AppendText(nsString *aStr); + + /** GetCurrentNode ADDREFFS and will get the current node from selection. + * now it simply returns the first node in the dom + * @param nsIDOMNode **aNode is the return location of the dom node + */ + nsresult GetCurrentNode(nsIDOMNode ** aNode); + + /** GetFirstTextNode ADDREFFS and will get the next available text node from the passed + * in node parameter it can also return NS_ERROR_FAILURE if no text nodes are available + * now it simply returns the first node in the dom + * @param nsIDOMNode *aNode is the node to start looking from + * @param nsIDOMNode **aRetNode is the return location of the text dom node + */ + nsresult GetFirstTextNode(nsIDOMNode *aNode, nsIDOMNode **aRetNode); + +/*END private methods of nsEditor*/ }; diff --git a/mozilla/editor/core/editorInterfaces.cpp b/mozilla/editor/core/editorInterfaces.cpp index d326fe3f5a3..d3179f302de 100644 --- a/mozilla/editor/core/editorInterfaces.cpp +++ b/mozilla/editor/core/editorInterfaces.cpp @@ -124,6 +124,8 @@ editorKeyListener::KeyDown(nsIDOMEvent* aKeyEvent) if (!mIsShift) { key->ToLowerCase(); } + mEditor->InsertString(key); + delete key; } break; } @@ -234,6 +236,7 @@ editorMouseListener::MouseUp(nsIDOMEvent* aMouseEvent) nsresult editorMouseListener::MouseClick(nsIDOMEvent* aMouseEvent) { + mEditor->MouseClick(0,0); return NS_OK; } @@ -270,14 +273,14 @@ editorMouseListener::MouseOut(nsIDOMEvent* aMouseEvent) nsresult -NS_NewEditorKeyListener(nsIDOMEventListener ** aInstancePtrResult, Editor *aEditorP) +NS_NewEditorKeyListener(nsIDOMEventListener ** aInstancePtrResult, nsEditor *aEditor) { editorKeyListener* it = new editorKeyListener(); if (NULL == it) { return NS_ERROR_OUT_OF_MEMORY; } - it->SetEditor(aEditorP); + it->SetEditor(aEditor); static NS_DEFINE_IID(kIDOMEventListenerIID, NS_IDOMEVENTLISTENER_IID); @@ -287,14 +290,14 @@ NS_NewEditorKeyListener(nsIDOMEventListener ** aInstancePtrResult, Editor *aEdit nsresult -NS_NewEditorMouseListener(nsIDOMEventListener ** aInstancePtrResult, Editor *aEditorP) +NS_NewEditorMouseListener(nsIDOMEventListener ** aInstancePtrResult, nsEditor *aEditor) { editorMouseListener* it = new editorMouseListener(); if (NULL == it) { return NS_ERROR_OUT_OF_MEMORY; } - it->SetEditor(aEditorP); + it->SetEditor(aEditor); static NS_DEFINE_IID(kIDOMEventListenerIID, NS_IDOMEVENTLISTENER_IID); diff --git a/mozilla/editor/core/editorInterfaces.h b/mozilla/editor/core/editorInterfaces.h index bc378fc74e6..c16ba04f434 100644 --- a/mozilla/editor/core/editorInterfaces.h +++ b/mozilla/editor/core/editorInterfaces.h @@ -23,8 +23,8 @@ #include "nsIDOMKeyListener.h" #include "nsIDOMMouseListener.h" -//prototype for the Editor class that will be included in the .cpp file -class Editor; +//prototype for the nsEditor class that will be included in the .cpp file +class nsEditor; //nsIDOMKeyListener interface /** The editorKeyListener public nsIDOMKeyListener @@ -33,7 +33,7 @@ class Editor; * This should be done through contexts that are loaded from URLs */ class editorKeyListener : public nsIDOMKeyListener { - Editor *mEditorP; + nsEditor *mEditor; public: /** the default constructor */ @@ -43,14 +43,14 @@ public: virtual ~editorKeyListener(); /** SetEditor gives an address to the editor that will be accessed - * @param Editor *aEditor simple + * @param nsEditor *aEditor simple */ - void SetEditor(Editor *aEditorP){mEditorP = mEditorP;} + void SetEditor(nsEditor *aEditor){mEditor = aEditor;} /** GetEditor returns a copy of the address the keylistener has * @return copy of the editor address */ - Editor *GetEditor(){ return mEditorP; } + nsEditor *GetEditor(){ return mEditor; } /*interfaces for addref and release and queryinterface*/ NS_DECL_ISUPPORTS @@ -74,7 +74,7 @@ private: */ class editorMouseListener : public nsIDOMMouseListener { - Editor *mEditorP; + nsEditor *mEditor; public: /** default constructor */ @@ -84,14 +84,14 @@ public: virtual ~editorMouseListener(); /** SetEditor gives an address to the editor that will be accessed - * @param Editor *aEditor simple + * @param nsEditor *aEditor simple */ - void SetEditor(Editor *aEditorP){mEditorP = mEditorP;} + void SetEditor(nsEditor *aEditor){mEditor = aEditor;} /** GetEditor returns a copy of the address the keylistener has * @return copy of the editor address */ - Editor *GetEditor(){ return mEditorP; } + nsEditor *GetEditor(){ return mEditor; } /*interfaces for addref and release and queryinterface*/ NS_DECL_ISUPPORTS @@ -110,11 +110,11 @@ public: /** factory for the editor key listener */ -extern nsresult NS_NewEditorKeyListener(nsIDOMEventListener ** aInstancePtrResult, Editor *aEditorP); +extern nsresult NS_NewEditorKeyListener(nsIDOMEventListener ** aInstancePtrResult, nsEditor *aEditor); /** factory for the editor mouse listener */ -extern nsresult NS_NewEditorMouseListener(nsIDOMEventListener ** aInstancePtrResult, Editor *aEditorP); +extern nsresult NS_NewEditorMouseListener(nsIDOMEventListener ** aInstancePtrResult, nsEditor *aEditor); #endif //editorInterfaces_h__ diff --git a/mozilla/editor/public/nsIEditor.h b/mozilla/editor/public/nsIEditor.h index a842e2ecf5c..8157a0a15bd 100644 --- a/mozilla/editor/public/nsIEditor.h +++ b/mozilla/editor/public/nsIEditor.h @@ -67,7 +67,15 @@ public: * * @param aProperty An enum that will recieve the various properties that can be applied from the current selection. */ - virtual nsresult GetProperties(PROPERTIES &aProperty)=0; + virtual nsresult GetProperties(PROPERTIES **aProperty)=0; + + /** + * InsertString() Inserts a string at the current location + * + * @param aString An nsString that is the string to be inserted + */ + virtual nsresult InsertString(nsString *aString)=0; + }; /*Factory Method to create an Editor*/