nsDOMSelection::ToString(const nsString& aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, nsString& aReturn)
nsDOMSelection::ToString(const nsAReadableString& aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, nsAWritableString& aReturn)
nsDOMSelection::ToString(const nsString& aFormatType, PRUint32 aFlags, PRInt32 aWrapCount, nsString& aReturn){  nsresult rv = NS_OK;  nsCOMPtr<nsIDocumentEncoder> encoder;  nsCAutoString formatType( NS_DOC_ENCODER_PROGID_BASE );  formatType.AppendWithConversion(aFormatType);  rv = nsComponentManager::CreateInstance(formatType,                                          nsnull,                                          NS_GET_IID(nsIDocumentEncoder),                                          getter_AddRefs(encoder));  NS_ENSURE_SUCCESS(rv, rv);  nsCOMPtr<nsIPresShell> shell;  rv = GetPresShell(getter_AddRefs(shell));  if (NS_FAILED(rv) || !shell) {    return NS_ERROR_FAILURE;  }  nsCOMPtr<nsIDocument> doc;  rv = shell->GetDocument(getter_AddRefs(doc));  NS_ENSURE_SUCCESS(rv, rv);  // Flags should always include OutputSelectionOnly if we're coming from here:  aFlags |= nsIDocumentEncoder::OutputSelectionOnly;  rv = encoder->Init(doc, aFormatType, aFlags);  NS_ENSURE_SUCCESS(rv, rv);  encoder->SetSelection(this);  if (aWrapCount != 0)    encoder->SetWrapColumn(aWrapCount);  rv = encoder->EncodeToString(aReturn);  return rv;}