From 08d2ae207b448aa617fbd231ea8e4fdb043f588f Mon Sep 17 00:00:00 2001 From: "cmanske%netscape.com" Date: Tue, 2 Mar 1999 05:32:25 +0000 Subject: [PATCH] Changed editor AppCore to use nsHTMLEditor instead of nsTextEditor --- xpfe/AppCores/src/nsEditorAppCore.cpp | 20 ++++++++++---- xpfe/AppCores/src/nsEditorAppCore.h | 4 +-- xpfe/AppCores/src/nsEditorMode.cpp | 39 +++++++++++++++++---------- xpfe/AppCores/src/nsEditorMode.h | 4 +-- 4 files changed, 44 insertions(+), 23 deletions(-) diff --git a/xpfe/AppCores/src/nsEditorAppCore.cpp b/xpfe/AppCores/src/nsEditorAppCore.cpp index dcf312c738fe..da47b6fa3222 100755 --- a/xpfe/AppCores/src/nsEditorAppCore.cpp +++ b/xpfe/AppCores/src/nsEditorAppCore.cpp @@ -68,6 +68,7 @@ #include "nsIEditor.h" #include "nsITextEditor.h" +#include "nsIHTMLEditor.h" #include "nsEditorCID.h" #include "nsRepository.h" @@ -504,6 +505,14 @@ nsEditorAppCore::SetToEditorMode(nsIDOMDocument *aDOMDocument, nsIPresShell* aPr if (PR_TRUE==needsInit) { needsInit=PR_FALSE; + result = nsRepository::RegisterFactory(kHTMLEditorCID, EDITOR_DLL, + PR_FALSE, PR_FALSE); + if (NS_ERROR_FACTORY_EXISTS!=result) + { + if (NS_FAILED(result)) + return result; + } + result = nsRepository::RegisterFactory(kTextEditorCID, EDITOR_DLL, PR_FALSE, PR_FALSE); if (NS_ERROR_FACTORY_EXISTS!=result) @@ -511,6 +520,7 @@ nsEditorAppCore::SetToEditorMode(nsIDOMDocument *aDOMDocument, nsIPresShell* aPr if (NS_FAILED(result)) return result; } + result = nsRepository::RegisterFactory(kEditorCID, EDITOR_DLL, PR_FALSE, PR_FALSE); if (NS_ERROR_FACTORY_EXISTS!=result) @@ -522,19 +532,19 @@ nsEditorAppCore::SetToEditorMode(nsIDOMDocument *aDOMDocument, nsIPresShell* aPr /** end temp code **/ /* nsISupports *isup = nsnull; - result = nsServiceManager::GetService(kTextEditorCID, - kITextEditorIID, &isup); + result = nsServiceManager::GetService(kHTMLEditorCID, + kIHTMLEditorIID, &isup); */ - result = nsRepository::CreateInstance(kTextEditorCID, + result = nsRepository::CreateInstance(kHTMLEditorCID, nsnull, - kITextEditorIID, (void **)&gEditor); + kIHTMLEditorIID, (void **)&gEditor); if (NS_FAILED(result)) return result; if (!gEditor) { return NS_ERROR_OUT_OF_MEMORY; } - gEditor->InitTextEditor(aDOMDocument, aPresShell); + gEditor->InitHTMLEditor(aDOMDocument, aPresShell); gEditor->EnableUndo(PR_TRUE); #endif return result; diff --git a/xpfe/AppCores/src/nsEditorAppCore.h b/xpfe/AppCores/src/nsEditorAppCore.h index 69b4e508461f..4f35e8b1ade5 100755 --- a/xpfe/AppCores/src/nsEditorAppCore.h +++ b/xpfe/AppCores/src/nsEditorAppCore.h @@ -36,7 +36,7 @@ class nsIDOMWindow; class nsIURL; class nsIWebShellWindow; class nsIPresShell; -class nsITextEditor; +class nsIHTMLEditor; //////////////////////////////////////////////////////////////////////////////// // nsEditorAppCore: @@ -92,7 +92,7 @@ class nsEditorAppCore : public nsBaseAppCore, nsIWebShellWindow *mWebShellWin; nsIWebShell * mWebShell; - nsITextEditor * mEditor; + nsIHTMLEditor * mEditor; nsIDOMDocument* mDomDoc; nsIDOMNode* mCurrentNode; diff --git a/xpfe/AppCores/src/nsEditorMode.cpp b/xpfe/AppCores/src/nsEditorMode.cpp index 0bdc44ae5f22..47c33345c04f 100755 --- a/xpfe/AppCores/src/nsEditorMode.cpp +++ b/xpfe/AppCores/src/nsEditorMode.cpp @@ -19,18 +19,21 @@ #include "nsString.h" #include "nsIDOMDocument.h" -#include "nsITextEditor.h" +#include "nsIHTMLEditor.h" #include "nsEditorCID.h" #include "nsRepository.h" #include "nsIServiceManager.h" -static nsITextEditor *gEditor; +static nsIHTMLEditor *gEditor; -static NS_DEFINE_IID(kITextEditorIID, NS_ITEXTEDITOR_IID); -static NS_DEFINE_CID(kTextEditorCID, NS_TEXTEDITOR_CID); +static NS_DEFINE_IID(kIHTMLEditorIID, NS_IHTMLEDITOR_IID); +static NS_DEFINE_CID(kHTMLEditorCID, NS_HTMLEDITOR_CID); static NS_DEFINE_IID(kIEditorIID, NS_IEDITOR_IID); static NS_DEFINE_CID(kEditorCID, NS_EDITOR_CID); +static NS_DEFINE_CID(kTextEditorCID, NS_TEXTEDITOR_CID); // Still needed to register factory +//Don't think we these - switched to using HTMLEditor +//static NS_DEFINE_IID(kITextEditorIID, NS_ITEXTEDITOR_IID); #ifdef XP_PC #define EDITOR_DLL "ender.dll" @@ -42,7 +45,7 @@ static NS_DEFINE_CID(kEditorCID, NS_EDITOR_CID); #endif #endif -nsITextEditor * GetEditor() +nsIHTMLEditor * GetEditor() { return gEditor; } @@ -65,15 +68,22 @@ nsresult NS_InitEditorMode(nsIDOMDocument *aDOMDocument, nsIPresShell* aPresShel if (PR_TRUE==needsInit) { needsInit=PR_FALSE; - result = nsRepository::RegisterComponent(kTextEditorCID, NULL, NULL, - EDITOR_DLL, PR_FALSE, PR_FALSE); + result = nsRepository::RegisterComponent(kHTMLEditorCID, NULL, NULL, EDITOR_DLL, + PR_FALSE, PR_FALSE); if (NS_ERROR_FACTORY_EXISTS!=result) { if (NS_FAILED(result)) return result; } - result = nsRepository::RegisterComponent(kEditorCID, NULL, NULL, - EDITOR_DLL, PR_FALSE, PR_FALSE); + result = nsRepository::RegisterComponent(kTextEditorCID, NULL, NULL, EDITOR_DLL, + PR_FALSE, PR_FALSE); + if (NS_ERROR_FACTORY_EXISTS!=result) + { + if (NS_FAILED(result)) + return result; + } + result = nsRepository::RegisterComponent(kEditorCID, NULL, NULL, EDITOR_DLL, + PR_FALSE, PR_FALSE); if (NS_ERROR_FACTORY_EXISTS!=result) { if (NS_FAILED(result)) @@ -83,20 +93,21 @@ nsresult NS_InitEditorMode(nsIDOMDocument *aDOMDocument, nsIPresShell* aPresShel /** end temp code **/ /* nsISupports *isup = nsnull; - result = nsServiceManager::GetService(kTextEditorCID, - kITextEditorIID, &isup); + result = nsServiceManager::GetService(kHTMLEditorCID, + kIHTMLEditorIID, &isup); */ - result = nsRepository::CreateInstance(kTextEditorCID, + result = nsRepository::CreateInstance(kHTMLEditorCID, nsnull, - kITextEditorIID, (void **)&gEditor); + kIHTMLEditorIID, (void **)&gEditor); if (NS_FAILED(result)) return result; if (!gEditor) { return NS_ERROR_OUT_OF_MEMORY; } - gEditor->InitTextEditor(aDOMDocument, aPresShell); + gEditor->InitHTMLEditor(aDOMDocument, aPresShell); gEditor->EnableUndo(PR_TRUE); return result; } + diff --git a/xpfe/AppCores/src/nsEditorMode.h b/xpfe/AppCores/src/nsEditorMode.h index 14e1cf8e2bdd..5efa3f72ccaa 100755 --- a/xpfe/AppCores/src/nsEditorMode.h +++ b/xpfe/AppCores/src/nsEditorMode.h @@ -23,9 +23,9 @@ class nsIDOMDocument; class nsIPresShell; -class nsITextEditor; +class nsIHTMLEditor; extern nsresult NS_InitEditorMode(nsIDOMDocument * aDOMDocument, nsIPresShell* aPresShell); -extern nsITextEditor * GetEditor(); +extern nsIHTMLEditor * GetEditor(); #endif //nsEditorMode_h__