зеркало из https://github.com/mozilla/pjs.git
35814: add clipboard type to editor paste methods, and call the right type
This commit is contained in:
Родитель
9913f693e1
Коммит
2d3cd3acbb
|
@ -223,8 +223,8 @@ public:
|
|||
NS_IMETHOD CanCut(PRBool &aCanCut)=0;
|
||||
NS_IMETHOD Copy() = 0;
|
||||
NS_IMETHOD CanCopy(PRBool &aCanCopy)=0;
|
||||
NS_IMETHOD Paste() = 0;
|
||||
NS_IMETHOD CanPaste(PRBool &aCanPaste)=0;
|
||||
NS_IMETHOD Paste(PRInt32 aSelectionType) = 0;
|
||||
NS_IMETHOD CanPaste(PRInt32 aSelectionType, PRBool &aCanPaste)=0;
|
||||
|
||||
NS_IMETHOD SelectAll();
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "nsIEditorMailSupport.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIClipboard.h"
|
||||
|
||||
#include "nsEditorCommands.h"
|
||||
|
||||
|
@ -147,7 +148,7 @@ nsPasteCommand::IsCommandEnabled(const PRUnichar *aCommand, nsISupports * refCon
|
|||
nsCOMPtr<nsIEditor> aEditor = do_QueryInterface(refCon);
|
||||
*outCmdEnabled = PR_FALSE;
|
||||
if (aEditor)
|
||||
return aEditor->CanPaste(*outCmdEnabled);
|
||||
return aEditor->CanPaste(nsIClipboard::kGlobalClipboard, *outCmdEnabled);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -163,12 +164,12 @@ nsPasteCommand::DoCommand(const PRUnichar *aCommand, nsISupports * refCon)
|
|||
nsresult rv = NS_OK;
|
||||
nsAutoString cmdString(aCommand);
|
||||
if (cmdString.Equals("cmd_paste"))
|
||||
rv = aEditor->Paste();
|
||||
rv = aEditor->Paste(nsIClipboard::kGlobalClipboard);
|
||||
else if (cmdString.Equals("cmd_pasteQuote"))
|
||||
{
|
||||
nsCOMPtr<nsIEditorMailSupport> mailEditor = do_QueryInterface(aEditor, &rv);
|
||||
if (mailEditor)
|
||||
rv = mailEditor->PasteAsQuotation();
|
||||
rv = mailEditor->PasteAsQuotation(nsIClipboard::kGlobalClipboard);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
// Drag & Drop, Clipboard
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsIClipboard.h"
|
||||
#include "nsIDragService.h"
|
||||
#include "nsIDragSession.h"
|
||||
#include "nsITransferable.h"
|
||||
|
@ -305,7 +306,7 @@ nsTextEditorKeyListener::ProcessShortCutKeys(nsIDOMEvent* aKeyEvent, PRBool& aPr
|
|||
// XXX: hard-coded paste
|
||||
case (PRUint32)('v'):
|
||||
if (mEditor)
|
||||
mEditor->Paste();
|
||||
mEditor->Paste(nsIClipboard::kGlobalClipboard);
|
||||
break;
|
||||
|
||||
// XXX: hard-coded undo
|
||||
|
@ -525,9 +526,9 @@ nsTextEditorMouseListener::MouseDown(nsIDOMEvent* aMouseEvent)
|
|||
mailEditor = do_QueryInterface(mEditor);
|
||||
|
||||
if (mailEditor)
|
||||
mailEditor->PasteAsQuotation();
|
||||
mailEditor->PasteAsQuotation(nsIClipboard::kSelectionClipboard);
|
||||
else
|
||||
editor->Paste();
|
||||
editor->Paste(nsIClipboard::kSelectionClipboard);
|
||||
|
||||
// We processed the event, whether paste succeeded or not:
|
||||
return NS_ERROR_BASE; // NS_ERROR_BASE means "We did process the event".
|
||||
|
|
|
@ -2016,7 +2016,7 @@ nsEditorShell::Copy()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditorShell::Paste()
|
||||
nsEditorShell::Paste(PRInt32 aSelectionType)
|
||||
{
|
||||
nsresult err = NS_NOINTERFACE;
|
||||
|
||||
|
@ -2027,7 +2027,7 @@ nsEditorShell::Paste()
|
|||
{
|
||||
nsCOMPtr<nsIEditor> editor = do_QueryInterface(mEditor);
|
||||
if (editor)
|
||||
err = editor->Paste();
|
||||
err = editor->Paste(aSelectionType);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -2039,7 +2039,7 @@ nsEditorShell::Paste()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditorShell::PasteAsQuotation()
|
||||
nsEditorShell::PasteAsQuotation(PRInt32 aSelectionType)
|
||||
{
|
||||
nsresult err = NS_NOINTERFACE;
|
||||
|
||||
|
@ -2050,7 +2050,7 @@ nsEditorShell::PasteAsQuotation()
|
|||
{
|
||||
nsCOMPtr<nsIEditorMailSupport> mailEditor = do_QueryInterface(mEditor);
|
||||
if (mailEditor)
|
||||
err = mailEditor->PasteAsQuotation();
|
||||
err = mailEditor->PasteAsQuotation(aSelectionType);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -2062,7 +2062,7 @@ nsEditorShell::PasteAsQuotation()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditorShell::PasteAsCitedQuotation(const PRUnichar *cite)
|
||||
nsEditorShell::PasteAsCitedQuotation(const PRUnichar *cite, PRInt32 aSelectionType)
|
||||
{
|
||||
nsresult err = NS_NOINTERFACE;
|
||||
|
||||
|
@ -2075,7 +2075,7 @@ nsEditorShell::PasteAsCitedQuotation(const PRUnichar *cite)
|
|||
{
|
||||
nsCOMPtr<nsIEditorMailSupport> mailEditor = do_QueryInterface(mEditor);
|
||||
if (mailEditor)
|
||||
err = mailEditor->PasteAsCitedQuotation(aCiteString);
|
||||
err = mailEditor->PasteAsCitedQuotation(aCiteString, aSelectionType);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -4227,7 +4227,7 @@ NS_IMETHODIMP nsHTMLEditor::CanCopy(PRBool &aCanCopy)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::Paste()
|
||||
NS_IMETHODIMP nsHTMLEditor::Paste(PRInt32 aSelectionType)
|
||||
{
|
||||
ForceCompositionEnd();
|
||||
nsAutoString stuffToPaste;
|
||||
|
@ -4258,7 +4258,7 @@ NS_IMETHODIMP nsHTMLEditor::Paste()
|
|||
trans->AddDataFlavor(kUnicodeMime);
|
||||
|
||||
// Get the Data from the clipboard
|
||||
if (NS_SUCCEEDED(clipboard->GetData(trans, nsIClipboard::kGlobalClipboard)))
|
||||
if (NS_SUCCEEDED(clipboard->GetData(trans, aSelectionType)))
|
||||
{
|
||||
char* bestFlavor = nsnull;
|
||||
nsCOMPtr<nsISupports> genericDataObj;
|
||||
|
@ -4319,7 +4319,7 @@ NS_IMETHODIMP nsHTMLEditor::Paste()
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::CanPaste(PRBool &aCanPaste)
|
||||
NS_IMETHODIMP nsHTMLEditor::CanPaste(PRInt32 aSelectionType, PRBool &aCanPaste)
|
||||
{
|
||||
aCanPaste = PR_FALSE;
|
||||
|
||||
|
@ -4369,7 +4369,7 @@ NS_IMETHODIMP nsHTMLEditor::CanPaste(PRBool &aCanPaste)
|
|||
}
|
||||
|
||||
PRBool haveFlavors;
|
||||
rv = clipboard->HasDataMatchingFlavors(flavorsList, nsIClipboard::kGlobalClipboard, &haveFlavors);
|
||||
rv = clipboard->HasDataMatchingFlavors(flavorsList, aSelectionType, &haveFlavors);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
aCanPaste = haveFlavors;
|
||||
|
@ -4380,16 +4380,17 @@ NS_IMETHODIMP nsHTMLEditor::CanPaste(PRBool &aCanPaste)
|
|||
//
|
||||
// HTML PasteAsQuotation: Paste in a blockquote type=cite
|
||||
//
|
||||
NS_IMETHODIMP nsHTMLEditor::PasteAsQuotation()
|
||||
NS_IMETHODIMP nsHTMLEditor::PasteAsQuotation(PRInt32 aSelectionType)
|
||||
{
|
||||
if (mFlags & eEditorPlaintextMask)
|
||||
return PasteAsPlaintextQuotation();
|
||||
return PasteAsPlaintextQuotation(aSelectionType);
|
||||
|
||||
nsAutoString citation("");
|
||||
return PasteAsCitedQuotation(citation);
|
||||
return PasteAsCitedQuotation(citation, aSelectionType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::PasteAsCitedQuotation(const nsString& aCitation)
|
||||
NS_IMETHODIMP nsHTMLEditor::PasteAsCitedQuotation(const nsString& aCitation,
|
||||
PRInt32 aSelectionType)
|
||||
{
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
nsAutoRules beginRulesSniffing(this, kOpInsertQuotation, nsIEditor::eNext);
|
||||
|
@ -4433,7 +4434,7 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsCitedQuotation(const nsString& aCitation)
|
|||
// XXX: error result: should res be returned here?
|
||||
}
|
||||
|
||||
res = Paste();
|
||||
res = Paste(aSelectionType);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
@ -4441,7 +4442,7 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsCitedQuotation(const nsString& aCitation)
|
|||
//
|
||||
// Paste a plaintext quotation
|
||||
//
|
||||
NS_IMETHODIMP nsHTMLEditor::PasteAsPlaintextQuotation()
|
||||
NS_IMETHODIMP nsHTMLEditor::PasteAsPlaintextQuotation(PRInt32 aSelectionType)
|
||||
{
|
||||
// Get Clipboard Service
|
||||
nsresult rv;
|
||||
|
@ -4459,7 +4460,7 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsPlaintextQuotation()
|
|||
trans->AddDataFlavor(kUnicodeMime);
|
||||
|
||||
// Get the Data from the clipboard
|
||||
clipboard->GetData(trans, nsIClipboard::kGlobalClipboard);
|
||||
clipboard->GetData(trans, aSelectionType);
|
||||
|
||||
// Now we ask the transferable for the data
|
||||
// it still owns the data, we just have a pointer to it.
|
||||
|
|
|
@ -165,9 +165,10 @@ public:
|
|||
|
||||
NS_IMETHOD GetBodyWrapWidth(PRInt32 *aWrapColumn);
|
||||
NS_IMETHOD SetBodyWrapWidth(PRInt32 aWrapColumn);
|
||||
NS_IMETHOD PasteAsQuotation();
|
||||
NS_IMETHOD PasteAsQuotation(PRInt32 aSelectionType);
|
||||
NS_IMETHOD InsertAsQuotation(const nsString& aQuotedText, nsIDOMNode **aNodeInserted);
|
||||
NS_IMETHOD PasteAsCitedQuotation(const nsString& aCitation);
|
||||
NS_IMETHOD PasteAsCitedQuotation(const nsString& aCitation,
|
||||
PRInt32 aSelectionType);
|
||||
NS_IMETHOD InsertAsCitedQuotation(const nsString& aQuotedText,
|
||||
const nsString& aCitation,
|
||||
PRBool aInsertHTML,
|
||||
|
@ -257,8 +258,8 @@ public:
|
|||
NS_IMETHOD CanCut(PRBool &aCanCut);
|
||||
NS_IMETHOD Copy();
|
||||
NS_IMETHOD CanCopy(PRBool &aCanCopy);
|
||||
NS_IMETHOD Paste();
|
||||
NS_IMETHOD CanPaste(PRBool &aCanPaste);
|
||||
NS_IMETHOD Paste(PRInt32 aSelectionType);
|
||||
NS_IMETHOD CanPaste(PRInt32 aSelectionType, PRBool &aCanPaste);
|
||||
|
||||
NS_IMETHOD OutputToString(nsString& aOutputString,
|
||||
const nsString& aFormatType,
|
||||
|
@ -444,7 +445,7 @@ protected:
|
|||
|
||||
|
||||
// Methods for handling plaintext quotations
|
||||
NS_IMETHOD PasteAsPlaintextQuotation();
|
||||
NS_IMETHOD PasteAsPlaintextQuotation(PRInt32 aSelectionType);
|
||||
NS_IMETHOD InsertAsPlaintextQuotation(const nsString& aQuotedText,
|
||||
nsIDOMNode **aNodeInserted);
|
||||
|
||||
|
|
|
@ -344,7 +344,7 @@ nsHTMLEditorLog::Copy()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditorLog::Paste()
|
||||
nsHTMLEditorLog::Paste(PRInt32 aSelectionType)
|
||||
{
|
||||
nsAutoHTMLEditorLogLock logLock(this);
|
||||
|
||||
|
@ -355,11 +355,11 @@ nsHTMLEditorLog::Paste()
|
|||
Flush();
|
||||
}
|
||||
|
||||
return nsHTMLEditor::Paste();
|
||||
return nsHTMLEditor::Paste(aSelectionType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditorLog::PasteAsQuotation()
|
||||
nsHTMLEditorLog::PasteAsQuotation(PRInt32 aSelectionType)
|
||||
{
|
||||
nsAutoHTMLEditorLogLock logLock(this);
|
||||
|
||||
|
@ -370,11 +370,11 @@ nsHTMLEditorLog::PasteAsQuotation()
|
|||
Flush();
|
||||
}
|
||||
|
||||
return nsHTMLEditor::PasteAsQuotation();
|
||||
return nsHTMLEditor::PasteAsQuotation(aSelectionType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditorLog::PasteAsPlaintextQuotation()
|
||||
nsHTMLEditorLog::PasteAsPlaintextQuotation(PRInt32 aSelectionType)
|
||||
{
|
||||
nsAutoHTMLEditorLogLock logLock(this);
|
||||
|
||||
|
@ -385,11 +385,12 @@ nsHTMLEditorLog::PasteAsPlaintextQuotation()
|
|||
Flush();
|
||||
}
|
||||
|
||||
return nsHTMLEditor::PasteAsPlaintextQuotation();
|
||||
return nsHTMLEditor::PasteAsPlaintextQuotation(aSelectionType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditorLog::PasteAsCitedQuotation(const nsString& aCitation)
|
||||
nsHTMLEditorLog::PasteAsCitedQuotation(const nsString& aCitation,
|
||||
PRInt32 aSelectionType)
|
||||
{
|
||||
nsAutoHTMLEditorLogLock logLock(this);
|
||||
|
||||
|
@ -402,7 +403,7 @@ nsHTMLEditorLog::PasteAsCitedQuotation(const nsString& aCitation)
|
|||
Flush();
|
||||
}
|
||||
|
||||
return nsHTMLEditor::PasteAsCitedQuotation(aCitation);
|
||||
return nsHTMLEditor::PasteAsCitedQuotation(aCitation, aSelectionType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -71,10 +71,11 @@ public:
|
|||
|
||||
NS_IMETHOD Cut();
|
||||
NS_IMETHOD Copy();
|
||||
NS_IMETHOD Paste();
|
||||
NS_IMETHOD PasteAsQuotation();
|
||||
NS_IMETHOD PasteAsPlaintextQuotation();
|
||||
NS_IMETHOD PasteAsCitedQuotation(const nsString& aCitation);
|
||||
NS_IMETHOD Paste(PRInt32 aSelectionType);
|
||||
NS_IMETHOD PasteAsQuotation(PRInt32 aSelectionType);
|
||||
NS_IMETHOD PasteAsPlaintextQuotation(PRInt32 aSelectionType);
|
||||
NS_IMETHOD PasteAsCitedQuotation(const nsString& aCitation,
|
||||
PRInt32 aSelectionType);
|
||||
NS_IMETHOD InsertAsQuotation(const nsString& aQuotedText, nsIDOMNode** aNodeInserted);
|
||||
NS_IMETHOD InsertAsPlaintextQuotation(const nsString& aQuotedText, nsIDOMNode** aNodeInserted);
|
||||
NS_IMETHOD InsertAsCitedQuotation(const nsString& aQuotedText, const nsString& aCitation, PRBool aInsertHTML, const nsString& aCharset, nsIDOMNode** aNodeInserted);
|
||||
|
|
|
@ -2016,7 +2016,7 @@ nsEditorShell::Copy()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditorShell::Paste()
|
||||
nsEditorShell::Paste(PRInt32 aSelectionType)
|
||||
{
|
||||
nsresult err = NS_NOINTERFACE;
|
||||
|
||||
|
@ -2027,7 +2027,7 @@ nsEditorShell::Paste()
|
|||
{
|
||||
nsCOMPtr<nsIEditor> editor = do_QueryInterface(mEditor);
|
||||
if (editor)
|
||||
err = editor->Paste();
|
||||
err = editor->Paste(aSelectionType);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -2039,7 +2039,7 @@ nsEditorShell::Paste()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditorShell::PasteAsQuotation()
|
||||
nsEditorShell::PasteAsQuotation(PRInt32 aSelectionType)
|
||||
{
|
||||
nsresult err = NS_NOINTERFACE;
|
||||
|
||||
|
@ -2050,7 +2050,7 @@ nsEditorShell::PasteAsQuotation()
|
|||
{
|
||||
nsCOMPtr<nsIEditorMailSupport> mailEditor = do_QueryInterface(mEditor);
|
||||
if (mailEditor)
|
||||
err = mailEditor->PasteAsQuotation();
|
||||
err = mailEditor->PasteAsQuotation(aSelectionType);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -2062,7 +2062,7 @@ nsEditorShell::PasteAsQuotation()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsEditorShell::PasteAsCitedQuotation(const PRUnichar *cite)
|
||||
nsEditorShell::PasteAsCitedQuotation(const PRUnichar *cite, PRInt32 aSelectionType)
|
||||
{
|
||||
nsresult err = NS_NOINTERFACE;
|
||||
|
||||
|
@ -2075,7 +2075,7 @@ nsEditorShell::PasteAsCitedQuotation(const PRUnichar *cite)
|
|||
{
|
||||
nsCOMPtr<nsIEditorMailSupport> mailEditor = do_QueryInterface(mEditor);
|
||||
if (mailEditor)
|
||||
err = mailEditor->PasteAsCitedQuotation(aCiteString);
|
||||
err = mailEditor->PasteAsCitedQuotation(aCiteString, aSelectionType);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -138,9 +138,9 @@ interface nsIEditorShell : nsISupports
|
|||
|
||||
void Cut();
|
||||
void Copy();
|
||||
void Paste();
|
||||
void PasteAsQuotation();
|
||||
void PasteAsCitedQuotation(in wstring cite);
|
||||
void Paste(in long selectionType);
|
||||
void PasteAsQuotation(in long selectionType);
|
||||
void PasteAsCitedQuotation(in wstring cite, in long selectionType);
|
||||
|
||||
void InsertAsQuotation(in wstring quotedText, out nsIDOMNode nodeInserted);
|
||||
void InsertAsCitedQuotation(in wstring quotedText, in wstring cite,
|
||||
|
|
|
@ -223,8 +223,8 @@ public:
|
|||
NS_IMETHOD CanCut(PRBool &aCanCut)=0;
|
||||
NS_IMETHOD Copy() = 0;
|
||||
NS_IMETHOD CanCopy(PRBool &aCanCopy)=0;
|
||||
NS_IMETHOD Paste() = 0;
|
||||
NS_IMETHOD CanPaste(PRBool &aCanPaste)=0;
|
||||
NS_IMETHOD Paste(PRInt32 aSelectionType) = 0;
|
||||
NS_IMETHOD CanPaste(PRInt32 aSelectionType, PRBool &aCanPaste)=0;
|
||||
|
||||
NS_IMETHOD SelectAll();
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "nsIEditorMailSupport.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIClipboard.h"
|
||||
|
||||
#include "nsEditorCommands.h"
|
||||
|
||||
|
@ -147,7 +148,7 @@ nsPasteCommand::IsCommandEnabled(const PRUnichar *aCommand, nsISupports * refCon
|
|||
nsCOMPtr<nsIEditor> aEditor = do_QueryInterface(refCon);
|
||||
*outCmdEnabled = PR_FALSE;
|
||||
if (aEditor)
|
||||
return aEditor->CanPaste(*outCmdEnabled);
|
||||
return aEditor->CanPaste(nsIClipboard::kGlobalClipboard, *outCmdEnabled);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -163,12 +164,12 @@ nsPasteCommand::DoCommand(const PRUnichar *aCommand, nsISupports * refCon)
|
|||
nsresult rv = NS_OK;
|
||||
nsAutoString cmdString(aCommand);
|
||||
if (cmdString.Equals("cmd_paste"))
|
||||
rv = aEditor->Paste();
|
||||
rv = aEditor->Paste(nsIClipboard::kGlobalClipboard);
|
||||
else if (cmdString.Equals("cmd_pasteQuote"))
|
||||
{
|
||||
nsCOMPtr<nsIEditorMailSupport> mailEditor = do_QueryInterface(aEditor, &rv);
|
||||
if (mailEditor)
|
||||
rv = mailEditor->PasteAsQuotation();
|
||||
rv = mailEditor->PasteAsQuotation(nsIClipboard::kGlobalClipboard);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -4227,7 +4227,7 @@ NS_IMETHODIMP nsHTMLEditor::CanCopy(PRBool &aCanCopy)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::Paste()
|
||||
NS_IMETHODIMP nsHTMLEditor::Paste(PRInt32 aSelectionType)
|
||||
{
|
||||
ForceCompositionEnd();
|
||||
nsAutoString stuffToPaste;
|
||||
|
@ -4258,7 +4258,7 @@ NS_IMETHODIMP nsHTMLEditor::Paste()
|
|||
trans->AddDataFlavor(kUnicodeMime);
|
||||
|
||||
// Get the Data from the clipboard
|
||||
if (NS_SUCCEEDED(clipboard->GetData(trans, nsIClipboard::kGlobalClipboard)))
|
||||
if (NS_SUCCEEDED(clipboard->GetData(trans, aSelectionType)))
|
||||
{
|
||||
char* bestFlavor = nsnull;
|
||||
nsCOMPtr<nsISupports> genericDataObj;
|
||||
|
@ -4319,7 +4319,7 @@ NS_IMETHODIMP nsHTMLEditor::Paste()
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::CanPaste(PRBool &aCanPaste)
|
||||
NS_IMETHODIMP nsHTMLEditor::CanPaste(PRInt32 aSelectionType, PRBool &aCanPaste)
|
||||
{
|
||||
aCanPaste = PR_FALSE;
|
||||
|
||||
|
@ -4369,7 +4369,7 @@ NS_IMETHODIMP nsHTMLEditor::CanPaste(PRBool &aCanPaste)
|
|||
}
|
||||
|
||||
PRBool haveFlavors;
|
||||
rv = clipboard->HasDataMatchingFlavors(flavorsList, nsIClipboard::kGlobalClipboard, &haveFlavors);
|
||||
rv = clipboard->HasDataMatchingFlavors(flavorsList, aSelectionType, &haveFlavors);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
aCanPaste = haveFlavors;
|
||||
|
@ -4380,16 +4380,17 @@ NS_IMETHODIMP nsHTMLEditor::CanPaste(PRBool &aCanPaste)
|
|||
//
|
||||
// HTML PasteAsQuotation: Paste in a blockquote type=cite
|
||||
//
|
||||
NS_IMETHODIMP nsHTMLEditor::PasteAsQuotation()
|
||||
NS_IMETHODIMP nsHTMLEditor::PasteAsQuotation(PRInt32 aSelectionType)
|
||||
{
|
||||
if (mFlags & eEditorPlaintextMask)
|
||||
return PasteAsPlaintextQuotation();
|
||||
return PasteAsPlaintextQuotation(aSelectionType);
|
||||
|
||||
nsAutoString citation("");
|
||||
return PasteAsCitedQuotation(citation);
|
||||
return PasteAsCitedQuotation(citation, aSelectionType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLEditor::PasteAsCitedQuotation(const nsString& aCitation)
|
||||
NS_IMETHODIMP nsHTMLEditor::PasteAsCitedQuotation(const nsString& aCitation,
|
||||
PRInt32 aSelectionType)
|
||||
{
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
nsAutoRules beginRulesSniffing(this, kOpInsertQuotation, nsIEditor::eNext);
|
||||
|
@ -4433,7 +4434,7 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsCitedQuotation(const nsString& aCitation)
|
|||
// XXX: error result: should res be returned here?
|
||||
}
|
||||
|
||||
res = Paste();
|
||||
res = Paste(aSelectionType);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
@ -4441,7 +4442,7 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsCitedQuotation(const nsString& aCitation)
|
|||
//
|
||||
// Paste a plaintext quotation
|
||||
//
|
||||
NS_IMETHODIMP nsHTMLEditor::PasteAsPlaintextQuotation()
|
||||
NS_IMETHODIMP nsHTMLEditor::PasteAsPlaintextQuotation(PRInt32 aSelectionType)
|
||||
{
|
||||
// Get Clipboard Service
|
||||
nsresult rv;
|
||||
|
@ -4459,7 +4460,7 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsPlaintextQuotation()
|
|||
trans->AddDataFlavor(kUnicodeMime);
|
||||
|
||||
// Get the Data from the clipboard
|
||||
clipboard->GetData(trans, nsIClipboard::kGlobalClipboard);
|
||||
clipboard->GetData(trans, aSelectionType);
|
||||
|
||||
// Now we ask the transferable for the data
|
||||
// it still owns the data, we just have a pointer to it.
|
||||
|
|
|
@ -165,9 +165,10 @@ public:
|
|||
|
||||
NS_IMETHOD GetBodyWrapWidth(PRInt32 *aWrapColumn);
|
||||
NS_IMETHOD SetBodyWrapWidth(PRInt32 aWrapColumn);
|
||||
NS_IMETHOD PasteAsQuotation();
|
||||
NS_IMETHOD PasteAsQuotation(PRInt32 aSelectionType);
|
||||
NS_IMETHOD InsertAsQuotation(const nsString& aQuotedText, nsIDOMNode **aNodeInserted);
|
||||
NS_IMETHOD PasteAsCitedQuotation(const nsString& aCitation);
|
||||
NS_IMETHOD PasteAsCitedQuotation(const nsString& aCitation,
|
||||
PRInt32 aSelectionType);
|
||||
NS_IMETHOD InsertAsCitedQuotation(const nsString& aQuotedText,
|
||||
const nsString& aCitation,
|
||||
PRBool aInsertHTML,
|
||||
|
@ -257,8 +258,8 @@ public:
|
|||
NS_IMETHOD CanCut(PRBool &aCanCut);
|
||||
NS_IMETHOD Copy();
|
||||
NS_IMETHOD CanCopy(PRBool &aCanCopy);
|
||||
NS_IMETHOD Paste();
|
||||
NS_IMETHOD CanPaste(PRBool &aCanPaste);
|
||||
NS_IMETHOD Paste(PRInt32 aSelectionType);
|
||||
NS_IMETHOD CanPaste(PRInt32 aSelectionType, PRBool &aCanPaste);
|
||||
|
||||
NS_IMETHOD OutputToString(nsString& aOutputString,
|
||||
const nsString& aFormatType,
|
||||
|
@ -444,7 +445,7 @@ protected:
|
|||
|
||||
|
||||
// Methods for handling plaintext quotations
|
||||
NS_IMETHOD PasteAsPlaintextQuotation();
|
||||
NS_IMETHOD PasteAsPlaintextQuotation(PRInt32 aSelectionType);
|
||||
NS_IMETHOD InsertAsPlaintextQuotation(const nsString& aQuotedText,
|
||||
nsIDOMNode **aNodeInserted);
|
||||
|
||||
|
|
|
@ -344,7 +344,7 @@ nsHTMLEditorLog::Copy()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditorLog::Paste()
|
||||
nsHTMLEditorLog::Paste(PRInt32 aSelectionType)
|
||||
{
|
||||
nsAutoHTMLEditorLogLock logLock(this);
|
||||
|
||||
|
@ -355,11 +355,11 @@ nsHTMLEditorLog::Paste()
|
|||
Flush();
|
||||
}
|
||||
|
||||
return nsHTMLEditor::Paste();
|
||||
return nsHTMLEditor::Paste(aSelectionType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditorLog::PasteAsQuotation()
|
||||
nsHTMLEditorLog::PasteAsQuotation(PRInt32 aSelectionType)
|
||||
{
|
||||
nsAutoHTMLEditorLogLock logLock(this);
|
||||
|
||||
|
@ -370,11 +370,11 @@ nsHTMLEditorLog::PasteAsQuotation()
|
|||
Flush();
|
||||
}
|
||||
|
||||
return nsHTMLEditor::PasteAsQuotation();
|
||||
return nsHTMLEditor::PasteAsQuotation(aSelectionType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditorLog::PasteAsPlaintextQuotation()
|
||||
nsHTMLEditorLog::PasteAsPlaintextQuotation(PRInt32 aSelectionType)
|
||||
{
|
||||
nsAutoHTMLEditorLogLock logLock(this);
|
||||
|
||||
|
@ -385,11 +385,12 @@ nsHTMLEditorLog::PasteAsPlaintextQuotation()
|
|||
Flush();
|
||||
}
|
||||
|
||||
return nsHTMLEditor::PasteAsPlaintextQuotation();
|
||||
return nsHTMLEditor::PasteAsPlaintextQuotation(aSelectionType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLEditorLog::PasteAsCitedQuotation(const nsString& aCitation)
|
||||
nsHTMLEditorLog::PasteAsCitedQuotation(const nsString& aCitation,
|
||||
PRInt32 aSelectionType)
|
||||
{
|
||||
nsAutoHTMLEditorLogLock logLock(this);
|
||||
|
||||
|
@ -402,7 +403,7 @@ nsHTMLEditorLog::PasteAsCitedQuotation(const nsString& aCitation)
|
|||
Flush();
|
||||
}
|
||||
|
||||
return nsHTMLEditor::PasteAsCitedQuotation(aCitation);
|
||||
return nsHTMLEditor::PasteAsCitedQuotation(aCitation, aSelectionType);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -71,10 +71,11 @@ public:
|
|||
|
||||
NS_IMETHOD Cut();
|
||||
NS_IMETHOD Copy();
|
||||
NS_IMETHOD Paste();
|
||||
NS_IMETHOD PasteAsQuotation();
|
||||
NS_IMETHOD PasteAsPlaintextQuotation();
|
||||
NS_IMETHOD PasteAsCitedQuotation(const nsString& aCitation);
|
||||
NS_IMETHOD Paste(PRInt32 aSelectionType);
|
||||
NS_IMETHOD PasteAsQuotation(PRInt32 aSelectionType);
|
||||
NS_IMETHOD PasteAsPlaintextQuotation(PRInt32 aSelectionType);
|
||||
NS_IMETHOD PasteAsCitedQuotation(const nsString& aCitation,
|
||||
PRInt32 aSelectionType);
|
||||
NS_IMETHOD InsertAsQuotation(const nsString& aQuotedText, nsIDOMNode** aNodeInserted);
|
||||
NS_IMETHOD InsertAsPlaintextQuotation(const nsString& aQuotedText, nsIDOMNode** aNodeInserted);
|
||||
NS_IMETHOD InsertAsCitedQuotation(const nsString& aQuotedText, const nsString& aCitation, PRBool aInsertHTML, const nsString& aCharset, nsIDOMNode** aNodeInserted);
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
// Drag & Drop, Clipboard
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsIClipboard.h"
|
||||
#include "nsIDragService.h"
|
||||
#include "nsIDragSession.h"
|
||||
#include "nsITransferable.h"
|
||||
|
@ -305,7 +306,7 @@ nsTextEditorKeyListener::ProcessShortCutKeys(nsIDOMEvent* aKeyEvent, PRBool& aPr
|
|||
// XXX: hard-coded paste
|
||||
case (PRUint32)('v'):
|
||||
if (mEditor)
|
||||
mEditor->Paste();
|
||||
mEditor->Paste(nsIClipboard::kGlobalClipboard);
|
||||
break;
|
||||
|
||||
// XXX: hard-coded undo
|
||||
|
@ -525,9 +526,9 @@ nsTextEditorMouseListener::MouseDown(nsIDOMEvent* aMouseEvent)
|
|||
mailEditor = do_QueryInterface(mEditor);
|
||||
|
||||
if (mailEditor)
|
||||
mailEditor->PasteAsQuotation();
|
||||
mailEditor->PasteAsQuotation(nsIClipboard::kSelectionClipboard);
|
||||
else
|
||||
editor->Paste();
|
||||
editor->Paste(nsIClipboard::kSelectionClipboard);
|
||||
|
||||
// We processed the event, whether paste succeeded or not:
|
||||
return NS_ERROR_BASE; // NS_ERROR_BASE means "We did process the event".
|
||||
|
|
|
@ -250,12 +250,12 @@ public:
|
|||
/** paste the text in the OS clipboard at the cursor position, replacing
|
||||
* the selected text (if any)
|
||||
*/
|
||||
NS_IMETHOD Paste()=0;
|
||||
NS_IMETHOD Paste(PRInt32 aSelectionType)=0;
|
||||
|
||||
/** Can we paste? True if the doc is modifiable, and we have
|
||||
* pasteable data in the clipboard.
|
||||
*/
|
||||
NS_IMETHOD CanPaste(PRBool &aCanPaste)=0;
|
||||
NS_IMETHOD CanPaste(PRInt32 aSelectionType, PRBool &aCanPaste)=0;
|
||||
|
||||
/* ------------ Selection methods -------------- */
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
* replacing the selected text (if any)
|
||||
* @param aCitation The "mid" URL of the source message
|
||||
*/
|
||||
NS_IMETHOD PasteAsQuotation()=0;
|
||||
NS_IMETHOD PasteAsQuotation(PRInt32 aSelectionType)=0;
|
||||
|
||||
/** insert a string as quoted text,
|
||||
* as a quotation (whose representation is dependant on the editor type),
|
||||
|
@ -72,7 +72,8 @@ public:
|
|||
* Document me!
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD PasteAsCitedQuotation(const nsString& aCitation)=0;
|
||||
NS_IMETHOD PasteAsCitedQuotation(const nsString& aCitation,
|
||||
PRInt32 aSelectionType)=0;
|
||||
|
||||
/**
|
||||
* Document me!
|
||||
|
|
Загрузка…
Ссылка в новой задаче