diff --git a/mozilla/xpfe/AppCores/src/nsEditorAppCore.cpp b/mozilla/xpfe/AppCores/src/nsEditorAppCore.cpp index 07dcafa4eed..8db63702ac0 100755 --- a/mozilla/xpfe/AppCores/src/nsEditorAppCore.cpp +++ b/mozilla/xpfe/AppCores/src/nsEditorAppCore.cpp @@ -953,6 +953,64 @@ nsEditorAppCore::GetContentsAsHTML(nsString& aContentsAsHTML) return err; } + + +NS_IMETHODIMP +nsEditorAppCore::GetContentsAsText(nsIOutputStream* aContentsAsText) +{ + nsresult err = NS_NOINTERFACE; + + switch (mEditorType) + { + case ePlainTextEditorType: + { + nsCOMPtr textEditor = do_QueryInterface(mEditor); + if (textEditor) + err = textEditor->OutputText(aContentsAsText); + } + break; + case eHTMLTextEditorType: + { + nsCOMPtr htmlEditor = do_QueryInterface(mEditor); + if (htmlEditor) + err = htmlEditor->OutputText(aContentsAsText); + } + break; + default: + err = NS_ERROR_NOT_IMPLEMENTED; + } + + return err; +} + +NS_IMETHODIMP +nsEditorAppCore::GetContentsAsHTML(nsIOutputStream* aContentsAsHTML) +{ + nsresult err = NS_NOINTERFACE; + + switch (mEditorType) + { + case ePlainTextEditorType: + { + nsCOMPtr textEditor = do_QueryInterface(mEditor); + if (textEditor) + err = textEditor->OutputHTML(aContentsAsHTML); + } + break; + case eHTMLTextEditorType: + { + nsCOMPtr htmlEditor = do_QueryInterface(mEditor); + if (htmlEditor) + err = htmlEditor->OutputHTML(aContentsAsHTML); + } + break; + default: + err = NS_ERROR_NOT_IMPLEMENTED; + } + + return err; +} + NS_METHOD nsEditorAppCore::GetEditorDocument(nsIDOMDocument** aEditorDocument) { diff --git a/mozilla/xpfe/AppCores/src/nsEditorAppCore.h b/mozilla/xpfe/AppCores/src/nsEditorAppCore.h index 64e5796e679..bf02df59656 100755 --- a/mozilla/xpfe/AppCores/src/nsEditorAppCore.h +++ b/mozilla/xpfe/AppCores/src/nsEditorAppCore.h @@ -38,6 +38,7 @@ class nsIWebShellWindow; class nsIPresShell; class nsIHTMLEditor; class nsITextEditor; +class nsIOutputStream; //#define TEXT_EDITOR 1 @@ -79,6 +80,9 @@ class nsEditorAppCore : public nsBaseAppCore, NS_IMETHOD GetContentsAsText(nsString& aContentsAsText); NS_IMETHOD GetContentsAsHTML(nsString& aContentsAsHTML); + NS_IMETHOD GetContentsAsText(nsIOutputStream* aContentsAsText); + NS_IMETHOD GetContentsAsHTML(nsIOutputStream* aContentsAsHTML); + NS_IMETHOD GetEditorSelection(nsIDOMSelection** aEditorSelection); NS_IMETHOD Undo();