From e752937005b02a05a50d85dea0d996fc635119ed Mon Sep 17 00:00:00 2001 From: "akkana%netscape.com" Date: Mon, 25 Mar 2002 22:39:19 +0000 Subject: [PATCH] 131277: change signature of outputToString to return the string. r=jfrancis sr=sfraser a=asa git-svn-id: svn://10.0.0.236/trunk@117419 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/editor/composer/src/nsEditorShell.cpp | 2 +- mozilla/editor/idl/nsIEditor.idl | 5 ++-- mozilla/editor/libeditor/base/nsEditor.cpp | 8 +++--- .../editor/libeditor/html/nsHTMLEditor.cpp | 7 ++--- .../libeditor/text/nsPlaintextEditor.cpp | 26 ++++++++++--------- .../editor/libeditor/text/nsPlaintextEditor.h | 6 ++--- .../html/forms/src/nsGfxTextControlFrame2.cpp | 2 +- .../webshell/tests/viewer/nsEditorMode.cpp | 4 +-- 8 files changed, 30 insertions(+), 30 deletions(-) diff --git a/mozilla/editor/composer/src/nsEditorShell.cpp b/mozilla/editor/composer/src/nsEditorShell.cpp index c8db52049d8..a23ffd50196 100644 --- a/mozilla/editor/composer/src/nsEditorShell.cpp +++ b/mozilla/editor/composer/src/nsEditorShell.cpp @@ -2493,7 +2493,7 @@ nsEditorShell::GetContentsAs(const PRUnichar *format, PRUint32 flags, nsCOMPtr editor = do_QueryInterface(mEditor); if (editor) - err = editor->OutputToString(contentsAs, aFormat, flags); + err = editor->OutputToString(aFormat, flags, contentsAs); *aContentsAs = ToNewUnicode(contentsAs); diff --git a/mozilla/editor/idl/nsIEditor.idl b/mozilla/editor/idl/nsIEditor.idl index 77413747498..7212df7654a 100644 --- a/mozilla/editor/idl/nsIEditor.idl +++ b/mozilla/editor/idl/nsIEditor.idl @@ -451,9 +451,8 @@ interface nsIEditor : nsISupports * Output methods: * aFormatType is a mime type, like text/plain. */ - void outputToString(out AString outputString, - in AString formatType, - in unsigned long flags); + AString outputToString(in AString formatType, + in unsigned long flags); void outputToStream(in nsIOutputStream aStream, in AString formatType, in AString charsetOverride, diff --git a/mozilla/editor/libeditor/base/nsEditor.cpp b/mozilla/editor/libeditor/base/nsEditor.cpp index 47a1240164c..52ddd146361 100644 --- a/mozilla/editor/libeditor/base/nsEditor.cpp +++ b/mozilla/editor/libeditor/base/nsEditor.cpp @@ -1706,9 +1706,9 @@ nsEditor::RemoveDocumentStateListener(nsIDocumentStateListener *aListener) #pragma mark - #endif -NS_IMETHODIMP nsEditor::OutputToString(nsAString& aOutputString, - const nsAString& aFormatType, - PRUint32 aFlags) +NS_IMETHODIMP nsEditor::OutputToString(const nsAString& aFormatType, + PRUint32 aFlags, + nsAString& aOutputString) { // these should be implemented by derived classes. return NS_ERROR_NOT_IMPLEMENTED; @@ -3373,7 +3373,6 @@ nsCOMPtr nsEditor::GetRightmostChild(nsIDOMNode *aCurrentNode, PRBool bNoBlockCrossing) { if (!aCurrentNode) return nsnull; - nsresult result = NS_OK; nsCOMPtr resultNode, temp=aCurrentNode; PRBool hasChildren; aCurrentNode->HasChildNodes(&hasChildren); @@ -3398,7 +3397,6 @@ nsCOMPtr nsEditor::GetLeftmostChild(nsIDOMNode *aCurrentNode, PRBool bNoBlockCrossing) { if (!aCurrentNode) return nsnull; - nsresult result = NS_OK; nsCOMPtr resultNode, temp=aCurrentNode; PRBool hasChildren; aCurrentNode->HasChildNodes(&hasChildren); diff --git a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp index 60cd5f2f92c..dc7ba7ed5eb 100644 --- a/mozilla/editor/libeditor/html/nsHTMLEditor.cpp +++ b/mozilla/editor/libeditor/html/nsHTMLEditor.cpp @@ -1967,7 +1967,7 @@ nsHTMLEditor::SetCaretAfterElement(nsIDOMElement* aElement) printf(" Offset: %d\n\nHTML:\n", offsetInParent+1); nsAutoString Format("text/html"); nsAutoString ContentsAs; - OutputToString(ContentsAs, Format, 2); + OutputToString(Format, 2, ContentsAs); wprintf(ContentsAs.get()); } #endif @@ -3654,8 +3654,9 @@ nsHTMLEditor::GetHeadContentsAsHTML(nsAString& aOutputString) res = SetSelectionAroundHeadChildren(selection, mDocWeak); if (NS_FAILED(res)) return res; - res = OutputToString(aOutputString, NS_LITERAL_STRING("text/html"), - nsIDocumentEncoder::OutputSelectionOnly); + res = OutputToString(NS_LITERAL_STRING("text/html"), + nsIDocumentEncoder::OutputSelectionOnly, + aOutputString); if (NS_SUCCEEDED(res)) { // Selection always includes , diff --git a/mozilla/editor/libeditor/text/nsPlaintextEditor.cpp b/mozilla/editor/libeditor/text/nsPlaintextEditor.cpp index e285080073a..ddab27d0a5f 100644 --- a/mozilla/editor/libeditor/text/nsPlaintextEditor.cpp +++ b/mozilla/editor/libeditor/text/nsPlaintextEditor.cpp @@ -1515,9 +1515,9 @@ nsPlaintextEditor::GetAndInitDocEncoder(const nsAString& aFormatType, NS_IMETHODIMP -nsPlaintextEditor::OutputToString(nsAString& aOutputString, - const nsAString& aFormatType, - PRUint32 aFlags) +nsPlaintextEditor::OutputToString(const nsAString& aFormatType, + PRUint32 aFlags, + nsAString& aOutputString) { PRBool cancel, handled; nsString resultString; @@ -1772,9 +1772,10 @@ nsPlaintextEditor::Rewrap(PRBool aRespectNewlines) if (isCollapsed) // rewrap the whole document { - rv = OutputToString(current, format, + rv = OutputToString(format, nsIDocumentEncoder::OutputFormatted - | nsIDocumentEncoder::OutputLFLineBreak); + | nsIDocumentEncoder::OutputLFLineBreak, + current); if (NS_FAILED(rv)) return rv; nsCOMPtr citer = dont_AddRef(MakeACiter()); @@ -1791,10 +1792,11 @@ nsPlaintextEditor::Rewrap(PRBool aRespectNewlines) } else // rewrap only the selection { - rv = OutputToString(current, format, + rv = OutputToString(format, nsIDocumentEncoder::OutputFormatted | nsIDocumentEncoder::OutputLFLineBreak - | nsIDocumentEncoder::OutputSelectionOnly); + | nsIDocumentEncoder::OutputSelectionOnly, + current); if (NS_FAILED(rv)) return rv; nsCOMPtr citer = dont_AddRef(MakeACiter()); @@ -1835,8 +1837,7 @@ nsPlaintextEditor::StripCites() if (isCollapsed) // rewrap the whole document { - rv = OutputToString(current, format, - nsIDocumentEncoder::OutputFormatted); + rv = OutputToString(format, nsIDocumentEncoder::OutputFormatted, current); if (NS_FAILED(rv)) return rv; nsCOMPtr citer = dont_AddRef(MakeACiter()); @@ -1853,9 +1854,10 @@ nsPlaintextEditor::StripCites() } else // rewrap only the selection { - rv = OutputToString(current, format, - nsIDocumentEncoder::OutputFormatted - | nsIDocumentEncoder::OutputSelectionOnly); + rv = OutputToString(format, + nsIDocumentEncoder::OutputFormatted + | nsIDocumentEncoder::OutputSelectionOnly, + current); if (NS_FAILED(rv)) return rv; nsCOMPtr citer = dont_AddRef(MakeACiter()); diff --git a/mozilla/editor/libeditor/text/nsPlaintextEditor.h b/mozilla/editor/libeditor/text/nsPlaintextEditor.h index 3dad700304f..2ce949e94ac 100644 --- a/mozilla/editor/libeditor/text/nsPlaintextEditor.h +++ b/mozilla/editor/libeditor/text/nsPlaintextEditor.h @@ -142,9 +142,9 @@ public: NS_IMETHOD DoDrag(nsIDOMEvent *aDragEvent); NS_IMETHOD InsertFromDrop(nsIDOMEvent* aDropEvent); - NS_IMETHOD OutputToString(nsAString& aOutputString, - const nsAString& aFormatType, - PRUint32 aFlags); + NS_IMETHOD OutputToString(const nsAString& aFormatType, + PRUint32 aFlags, + nsAString& aOutputString); NS_IMETHOD OutputToStream(nsIOutputStream* aOutputStream, const nsAString& aFormatType, diff --git a/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp b/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp index fcb04713a50..b3c1aa1bf4b 100644 --- a/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp +++ b/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp @@ -3324,7 +3324,7 @@ void nsGfxTextControlFrame2::GetTextControlFrameState(nsAString& aValue) } } - mEditor->OutputToString(aValue, NS_LITERAL_STRING("text/plain"), flags); + mEditor->OutputToString(NS_LITERAL_STRING("text/plain"), flags, aValue); } else { diff --git a/mozilla/webshell/tests/viewer/nsEditorMode.cpp b/mozilla/webshell/tests/viewer/nsEditorMode.cpp index 5048b881ca0..9d029274072 100644 --- a/mozilla/webshell/tests/viewer/nsEditorMode.cpp +++ b/mozilla/webshell/tests/viewer/nsEditorMode.cpp @@ -120,12 +120,12 @@ static nsresult PrintEditorOutput(nsIEditor* editor, PRInt32 aCommandID) case VIEWER_DISPLAYTEXT: formatString.Assign(NS_LITERAL_STRING("text/plain")); flags = nsIDocumentEncoder::OutputFormatted; - editor->OutputToString(outString, formatString, flags); + editor->OutputToString(formatString, flags, outString); break; case VIEWER_DISPLAYHTML: formatString.Assign(NS_LITERAL_STRING("text/html")); - editor->OutputToString(outString, formatString, flags); + editor->OutputToString(formatString, flags, outString); break; }