Added GetContentsAsText and GetContentsAsHTML that take in a nsIOutputStream
as a parameter. git-svn-id: svn://10.0.0.236/trunk@29965 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user