mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 633066: Remove nsICiter and make nsInternetCiter a static class. r=ehsan
This commit is contained in:
parent
987825ce70
commit
c90dd3913b
@ -46,7 +46,6 @@ MODULE = editor
|
||||
GRE_MODULE = 1
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsICiter.idl \
|
||||
nsIDocumentStateListener.idl \
|
||||
nsIEditActionListener.idl \
|
||||
nsIEditor.idl \
|
||||
|
@ -1,61 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "domstubs.idl"
|
||||
%{C++
|
||||
#include "nsString.h"
|
||||
%}
|
||||
/** Handle plaintext citations, as in mail quoting.
|
||||
* Used by the editor but not dependant on it.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(a6cf9102-15b3-11d2-932e-00805f8add32)]
|
||||
|
||||
interface nsICiter : nsISupports
|
||||
{
|
||||
|
||||
DOMString GetCiteString(in DOMString aInString);
|
||||
|
||||
DOMString StripCites(in DOMString aInString);
|
||||
|
||||
DOMString Rewrap(in DOMString aInString,
|
||||
in unsigned long aWrapCol, in unsigned long aFirstLineOffset,
|
||||
in boolean aRespectNewlines);
|
||||
};
|
||||
|
||||
|
@ -58,18 +58,7 @@ const PRUnichar cr('\r');
|
||||
/** Mail citations using the Internet style: > This is a citation
|
||||
*/
|
||||
|
||||
|
||||
nsInternetCiter::nsInternetCiter()
|
||||
{
|
||||
}
|
||||
|
||||
nsInternetCiter::~nsInternetCiter()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsInternetCiter, nsICiter)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsInternetCiter::GetCiteString(const nsAString& aInString, nsAString& aOutString)
|
||||
{
|
||||
aOutString.Truncate();
|
||||
@ -155,7 +144,7 @@ nsInternetCiter::StripCitesAndLinebreaks(const nsAString& aInString,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsInternetCiter::StripCites(const nsAString& aInString, nsAString& aOutString)
|
||||
{
|
||||
return StripCitesAndLinebreaks(aInString, aOutString, PR_FALSE, 0);
|
||||
@ -188,7 +177,7 @@ static inline PRBool IsSpace(PRUnichar c)
|
||||
return (nsCRT::IsAsciiSpace(c) || (c == nl) || (c == cr) || (c == nbsp));
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsInternetCiter::Rewrap(const nsAString& aInString,
|
||||
PRUint32 aWrapCol, PRUint32 aFirstLineOffset,
|
||||
PRBool aRespectNewlines,
|
||||
|
@ -38,33 +38,25 @@
|
||||
#ifndef nsInternetCiter_h__
|
||||
#define nsInternetCiter_h__
|
||||
|
||||
#include "nsICiter.h"
|
||||
|
||||
#include "nsString.h"
|
||||
|
||||
/** Mail citations using standard Internet style.
|
||||
*/
|
||||
class nsInternetCiter : public nsICiter
|
||||
class nsInternetCiter
|
||||
{
|
||||
public:
|
||||
nsInternetCiter();
|
||||
virtual ~nsInternetCiter();
|
||||
//Interfaces for addref and release and queryinterface
|
||||
//NOTE: Use NS_DECL_ISUPPORTS_INHERITED in any class inherited from nsEditor
|
||||
NS_DECL_ISUPPORTS
|
||||
static nsresult GetCiteString(const nsAString & aInString, nsAString & aOutString);
|
||||
|
||||
NS_IMETHOD GetCiteString(const nsAString & aInString, nsAString & aOutString);
|
||||
static nsresult StripCites(const nsAString & aInString, nsAString & aOutString);
|
||||
|
||||
NS_IMETHOD StripCites(const nsAString & aInString, nsAString & aOutString);
|
||||
|
||||
NS_IMETHOD Rewrap(const nsAString & aInString,
|
||||
PRUint32 aWrapCol, PRUint32 aFirstLineOffset,
|
||||
PRBool aRespectNewlines,
|
||||
nsAString & aOutString);
|
||||
static nsresult Rewrap(const nsAString & aInString,
|
||||
PRUint32 aWrapCol, PRUint32 aFirstLineOffset,
|
||||
PRBool aRespectNewlines,
|
||||
nsAString & aOutString);
|
||||
|
||||
protected:
|
||||
nsresult StripCitesAndLinebreaks(const nsAString& aInString, nsAString& aOutString,
|
||||
PRBool aLinebreaksToo, PRInt32* aCiteLevel);
|
||||
static nsresult StripCitesAndLinebreaks(const nsAString& aInString, nsAString& aOutString,
|
||||
PRBool aLinebreaksToo, PRInt32* aCiteLevel);
|
||||
};
|
||||
|
||||
#endif //nsInternetCiter_h__
|
||||
|
@ -1530,12 +1530,9 @@ nsPlaintextEditor::InsertAsQuotation(const nsAString& aQuotedText,
|
||||
// Protect the edit rules object from dying
|
||||
nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
|
||||
|
||||
// We have the text. Cite it appropriately:
|
||||
nsCOMPtr<nsICiter> citer = new nsInternetCiter();
|
||||
|
||||
// Let the citer quote it for us:
|
||||
nsString quotedStuff;
|
||||
nsresult rv = citer->GetCiteString(aQuotedText, quotedStuff);
|
||||
nsresult rv = nsInternetCiter::GetCiteString(aQuotedText, quotedStuff);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// It's best to put a blank line after the quoted text so that mails
|
||||
@ -1630,13 +1627,9 @@ nsPlaintextEditor::Rewrap(PRBool aRespectNewlines)
|
||||
&isCollapsed, current);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsICiter> citer = new nsInternetCiter();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(citer, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsString wrapped;
|
||||
PRUint32 firstLineOffset = 0; // XXX need to reset this if there is a selection
|
||||
rv = citer->Rewrap(current, wrapCol, firstLineOffset, aRespectNewlines,
|
||||
rv = nsInternetCiter::Rewrap(current, wrapCol, firstLineOffset, aRespectNewlines,
|
||||
wrapped);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -1659,11 +1652,8 @@ nsPlaintextEditor::StripCites()
|
||||
&isCollapsed, current);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsICiter> citer = new nsInternetCiter();
|
||||
NS_ENSURE_TRUE(citer, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsString stripped;
|
||||
rv = citer->StripCites(current, stripped);
|
||||
rv = nsInternetCiter::StripCites(current, stripped);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (isCollapsed) // rewrap the whole document
|
||||
|
Loading…
Reference in New Issue
Block a user