Added GetContentsAsText and GetContentsAsHTML that take in a nsIOutputStream

as a parameter.
This commit is contained in:
kostello%netscape.com 1999-05-03 18:44:54 +00:00
Родитель 69a841f3b2
Коммит ac8dc35665
2 изменённых файлов: 62 добавлений и 0 удалений

Просмотреть файл

@ -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<nsITextEditor> textEditor = do_QueryInterface(mEditor);
if (textEditor)
err = textEditor->OutputText(aContentsAsText);
}
break;
case eHTMLTextEditorType:
{
nsCOMPtr<nsIHTMLEditor> 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<nsITextEditor> textEditor = do_QueryInterface(mEditor);
if (textEditor)
err = textEditor->OutputHTML(aContentsAsHTML);
}
break;
case eHTMLTextEditorType:
{
nsCOMPtr<nsIHTMLEditor> 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)
{

Просмотреть файл

@ -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();