2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2003-04-12 07:08:23 +04:00
|
|
|
|
|
|
|
|
|
|
|
#include "nsGlobalWindowCommands.h"
|
|
|
|
|
|
|
|
#include "nsIComponentManager.h"
|
2013-08-22 10:30:55 +04:00
|
|
|
#include "nsIDOMElement.h"
|
2003-04-12 07:08:23 +04:00
|
|
|
#include "nsIInterfaceRequestor.h"
|
|
|
|
#include "nsIInterfaceRequestorUtils.h"
|
|
|
|
#include "nsCRT.h"
|
2003-04-22 22:11:12 +04:00
|
|
|
#include "nsString.h"
|
2013-12-09 06:52:54 +04:00
|
|
|
#include "mozilla/ArrayUtils.h"
|
2011-05-25 10:31:59 +04:00
|
|
|
#include "mozilla/Preferences.h"
|
2003-04-12 07:08:23 +04:00
|
|
|
|
|
|
|
#include "nsIControllerCommandTable.h"
|
|
|
|
#include "nsICommandParams.h"
|
|
|
|
|
2005-11-29 02:56:44 +03:00
|
|
|
#include "nsPIDOMWindow.h"
|
2003-04-12 07:08:23 +04:00
|
|
|
#include "nsIPresShell.h"
|
|
|
|
#include "nsIDocShell.h"
|
|
|
|
#include "nsISelectionController.h"
|
|
|
|
#include "nsIWebNavigation.h"
|
|
|
|
#include "nsIContentViewerEdit.h"
|
|
|
|
#include "nsIContentViewer.h"
|
Bug 178324, refactor focus by moving all focus handling into one place and simplifying it, add many tests, fixes many other bugs too numerous to mention in this small checkin comment, r=josh,smichaud,ere,dbaron,marco,neil,gavin,smaug,sr=smaug (CLOSED TREE)
2009-06-10 22:00:39 +04:00
|
|
|
#include "nsFocusManager.h"
|
2010-03-19 21:32:13 +03:00
|
|
|
#include "nsCopySupport.h"
|
2013-08-07 22:52:38 +04:00
|
|
|
#include "nsIClipboard.h"
|
2012-06-15 06:31:55 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-09-25 15:21:22 +04:00
|
|
|
#include "mozilla/BasicEvents.h"
|
2014-11-27 01:06:00 +03:00
|
|
|
#include "mozilla/dom/Selection.h"
|
2003-04-12 07:08:23 +04:00
|
|
|
|
2003-04-17 17:21:19 +04:00
|
|
|
#include "nsIClipboardDragDropHooks.h"
|
|
|
|
#include "nsIClipboardDragDropHookList.h"
|
|
|
|
|
2011-05-25 10:31:59 +04:00
|
|
|
using namespace mozilla;
|
|
|
|
|
2003-04-12 07:08:23 +04:00
|
|
|
const char * const sSelectAllString = "cmd_selectAll";
|
|
|
|
const char * const sSelectNoneString = "cmd_selectNone";
|
|
|
|
const char * const sCopyImageLocationString = "cmd_copyImageLocation";
|
|
|
|
const char * const sCopyImageContentsString = "cmd_copyImageContents";
|
2005-05-05 20:14:00 +04:00
|
|
|
const char * const sCopyImageString = "cmd_copyImage";
|
2003-04-12 07:08:23 +04:00
|
|
|
|
|
|
|
const char * const sScrollTopString = "cmd_scrollTop";
|
|
|
|
const char * const sScrollBottomString = "cmd_scrollBottom";
|
|
|
|
const char * const sScrollPageUpString = "cmd_scrollPageUp";
|
|
|
|
const char * const sScrollPageDownString = "cmd_scrollPageDown";
|
2012-01-06 01:33:41 +04:00
|
|
|
const char * const sScrollLineUpString = "cmd_scrollLineUp";
|
|
|
|
const char * const sScrollLineDownString = "cmd_scrollLineDown";
|
|
|
|
const char * const sScrollLeftString = "cmd_scrollLeft";
|
|
|
|
const char * const sScrollRightString = "cmd_scrollRight";
|
2011-12-24 04:11:30 +04:00
|
|
|
const char * const sMoveTopString = "cmd_moveTop";
|
|
|
|
const char * const sMoveBottomString = "cmd_moveBottom";
|
2003-04-12 07:08:23 +04:00
|
|
|
const char * const sMovePageUpString = "cmd_movePageUp";
|
|
|
|
const char * const sMovePageDownString = "cmd_movePageDown";
|
2011-12-24 04:11:30 +04:00
|
|
|
const char * const sLinePreviousString = "cmd_linePrevious";
|
|
|
|
const char * const sLineNextString = "cmd_lineNext";
|
|
|
|
const char * const sCharPreviousString = "cmd_charPrevious";
|
|
|
|
const char * const sCharNextString = "cmd_charNext";
|
2003-04-12 07:08:23 +04:00
|
|
|
|
|
|
|
// These are so the browser can use editor navigation key bindings
|
|
|
|
// helps with accessibility (boolean pref accessibility.browsewithcaret)
|
|
|
|
|
|
|
|
const char * const sSelectCharPreviousString = "cmd_selectCharPrevious";
|
|
|
|
const char * const sSelectCharNextString = "cmd_selectCharNext";
|
|
|
|
|
|
|
|
const char * const sWordPreviousString = "cmd_wordPrevious";
|
|
|
|
const char * const sWordNextString = "cmd_wordNext";
|
|
|
|
const char * const sSelectWordPreviousString = "cmd_selectWordPrevious";
|
|
|
|
const char * const sSelectWordNextString = "cmd_selectWordNext";
|
|
|
|
|
|
|
|
const char * const sBeginLineString = "cmd_beginLine";
|
|
|
|
const char * const sEndLineString = "cmd_endLine";
|
|
|
|
const char * const sSelectBeginLineString = "cmd_selectBeginLine";
|
|
|
|
const char * const sSelectEndLineString = "cmd_selectEndLine";
|
|
|
|
|
|
|
|
const char * const sSelectLinePreviousString = "cmd_selectLinePrevious";
|
|
|
|
const char * const sSelectLineNextString = "cmd_selectLineNext";
|
|
|
|
|
2011-12-24 04:11:30 +04:00
|
|
|
const char * const sSelectPageUpString = "cmd_selectPageUp";
|
|
|
|
const char * const sSelectPageDownString = "cmd_selectPageDown";
|
2003-04-12 07:08:23 +04:00
|
|
|
|
2005-02-18 10:29:40 +03:00
|
|
|
const char * const sSelectTopString = "cmd_selectTop";
|
|
|
|
const char * const sSelectBottomString = "cmd_selectBottom";
|
2003-04-12 07:08:23 +04:00
|
|
|
|
2014-11-22 17:39:04 +03:00
|
|
|
// Physical-direction movement and selection commands
|
|
|
|
const char * const sMoveLeftString = "cmd_moveLeft";
|
|
|
|
const char * const sMoveRightString = "cmd_moveRight";
|
|
|
|
const char * const sMoveUpString = "cmd_moveUp";
|
|
|
|
const char * const sMoveDownString = "cmd_moveDown";
|
|
|
|
const char * const sMoveLeft2String = "cmd_moveLeft2";
|
|
|
|
const char * const sMoveRight2String = "cmd_moveRight2";
|
|
|
|
const char * const sMoveUp2String = "cmd_moveUp2";
|
|
|
|
const char * const sMoveDown2String = "cmd_moveDown2";
|
|
|
|
|
|
|
|
const char * const sSelectLeftString = "cmd_selectLeft";
|
|
|
|
const char * const sSelectRightString = "cmd_selectRight";
|
|
|
|
const char * const sSelectUpString = "cmd_selectUp";
|
|
|
|
const char * const sSelectDownString = "cmd_selectDown";
|
|
|
|
const char * const sSelectLeft2String = "cmd_selectLeft2";
|
|
|
|
const char * const sSelectRight2String = "cmd_selectRight2";
|
|
|
|
const char * const sSelectUp2String = "cmd_selectUp2";
|
|
|
|
const char * const sSelectDown2String = "cmd_selectDown2";
|
2003-04-12 07:08:23 +04:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
#pragma mark -
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// a base class for selection-related commands, for code sharing
|
|
|
|
class nsSelectionCommandsBase : public nsIControllerCommand
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD IsCommandEnabled(const char* aCommandName, nsISupports* aCommandContext, bool* _retval) override;
|
|
|
|
NS_IMETHOD GetCommandStateParams(const char* aCommandName, nsICommandParams* aParams, nsISupports* aCommandContext) override;
|
|
|
|
NS_IMETHOD DoCommandParams(const char* aCommandName, nsICommandParams* aParams, nsISupports* aCommandContext) override;
|
2003-04-12 07:08:23 +04:00
|
|
|
|
|
|
|
protected:
|
2014-06-23 23:56:07 +04:00
|
|
|
virtual ~nsSelectionCommandsBase() {}
|
2003-04-12 07:08:23 +04:00
|
|
|
|
2012-01-06 01:33:41 +04:00
|
|
|
static nsresult GetPresShellFromWindow(nsPIDOMWindow *aWindow, nsIPresShell **aPresShell);
|
|
|
|
static nsresult GetSelectionControllerFromWindow(nsPIDOMWindow *aWindow, nsISelectionController **aSelCon);
|
2003-04-12 07:08:23 +04:00
|
|
|
|
|
|
|
// no member variables, please, we're stateless!
|
|
|
|
};
|
|
|
|
|
|
|
|
// this class implements commands whose behavior depends on the 'browse with caret' setting
|
|
|
|
class nsSelectMoveScrollCommand : public nsSelectionCommandsBase
|
|
|
|
{
|
2012-01-06 01:33:41 +04:00
|
|
|
public:
|
2003-04-12 07:08:23 +04:00
|
|
|
|
2012-01-06 01:33:41 +04:00
|
|
|
NS_IMETHOD DoCommand(const char * aCommandName, nsISupports *aCommandContext);
|
2003-04-12 07:08:23 +04:00
|
|
|
|
|
|
|
// no member variables, please, we're stateless!
|
|
|
|
};
|
|
|
|
|
2014-11-22 17:39:04 +03:00
|
|
|
// this class implements physical-movement versions of the above
|
|
|
|
class nsPhysicalSelectMoveScrollCommand : public nsSelectionCommandsBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
NS_IMETHOD DoCommand(const char * aCommandName, nsISupports *aCommandContext);
|
|
|
|
|
|
|
|
// no member variables, please, we're stateless!
|
|
|
|
};
|
|
|
|
|
2003-04-12 07:08:23 +04:00
|
|
|
// this class implements other selection commands
|
|
|
|
class nsSelectCommand : public nsSelectionCommandsBase
|
|
|
|
{
|
2012-01-06 01:33:41 +04:00
|
|
|
public:
|
2003-04-12 07:08:23 +04:00
|
|
|
|
2012-01-06 01:33:41 +04:00
|
|
|
NS_IMETHOD DoCommand(const char * aCommandName, nsISupports *aCommandContext);
|
2003-04-12 07:08:23 +04:00
|
|
|
|
|
|
|
// no member variables, please, we're stateless!
|
|
|
|
};
|
|
|
|
|
2014-11-22 17:39:04 +03:00
|
|
|
// this class implements physical-movement versions of selection commands
|
|
|
|
class nsPhysicalSelectCommand : public nsSelectionCommandsBase
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
NS_IMETHOD DoCommand(const char * aCommandName, nsISupports *aCommandContext);
|
|
|
|
|
|
|
|
// no member variables, please, we're stateless!
|
|
|
|
};
|
|
|
|
|
2003-04-12 07:08:23 +04:00
|
|
|
#if 0
|
|
|
|
#pragma mark -
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2014-04-27 11:06:00 +04:00
|
|
|
NS_IMPL_ISUPPORTS(nsSelectionCommandsBase, nsIControllerCommand)
|
2003-04-12 07:08:23 +04:00
|
|
|
|
|
|
|
/* boolean isCommandEnabled (in string aCommandName, in nsISupports aCommandContext); */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSelectionCommandsBase::IsCommandEnabled(const char * aCommandName,
|
|
|
|
nsISupports *aCommandContext,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool *outCmdEnabled)
|
2003-04-12 07:08:23 +04:00
|
|
|
{
|
|
|
|
// XXX this needs fixing. e.g. you can't scroll up if you're already at the top of
|
|
|
|
// the document.
|
2011-10-17 18:59:28 +04:00
|
|
|
*outCmdEnabled = true;
|
2003-04-12 07:08:23 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* void getCommandStateParams (in string aCommandName, in nsICommandParams aParams, in nsISupports aCommandContext); */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSelectionCommandsBase::GetCommandStateParams(const char *aCommandName,
|
|
|
|
nsICommandParams *aParams, nsISupports *aCommandContext)
|
|
|
|
{
|
|
|
|
// XXX we should probably return the enabled state
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* void doCommandParams (in string aCommandName, in nsICommandParams aParams, in nsISupports aCommandContext); */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsSelectionCommandsBase::DoCommandParams(const char *aCommandName,
|
|
|
|
nsICommandParams *aParams, nsISupports *aCommandContext)
|
|
|
|
{
|
|
|
|
return DoCommand(aCommandName, aCommandContext);
|
|
|
|
}
|
|
|
|
|
|
|
|
// protected methods
|
|
|
|
|
|
|
|
nsresult
|
2012-01-06 01:33:41 +04:00
|
|
|
nsSelectionCommandsBase::GetPresShellFromWindow(nsPIDOMWindow *aWindow, nsIPresShell **aPresShell)
|
2003-04-12 07:08:23 +04:00
|
|
|
{
|
2012-07-30 18:20:58 +04:00
|
|
|
*aPresShell = nullptr;
|
2012-01-06 01:33:41 +04:00
|
|
|
NS_ENSURE_TRUE(aWindow, NS_ERROR_FAILURE);
|
2003-04-12 07:08:23 +04:00
|
|
|
|
2012-01-06 01:33:41 +04:00
|
|
|
nsIDocShell *docShell = aWindow->GetDocShell();
|
2003-04-12 07:08:23 +04:00
|
|
|
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
|
|
|
|
|
2012-12-29 05:56:42 +04:00
|
|
|
NS_IF_ADDREF(*aPresShell = docShell->GetPresShell());
|
|
|
|
return NS_OK;
|
2003-04-12 07:08:23 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2012-01-06 01:33:41 +04:00
|
|
|
nsSelectionCommandsBase::GetSelectionControllerFromWindow(nsPIDOMWindow *aWindow, nsISelectionController **aSelCon)
|
2003-04-12 07:08:23 +04:00
|
|
|
{
|
2012-07-30 18:20:58 +04:00
|
|
|
*aSelCon = nullptr;
|
2003-04-12 07:08:23 +04:00
|
|
|
|
|
|
|
nsCOMPtr<nsIPresShell> presShell;
|
|
|
|
GetPresShellFromWindow(aWindow, getter_AddRefs(presShell));
|
|
|
|
if (presShell)
|
|
|
|
return CallQueryInterface(presShell, aSelCon);
|
|
|
|
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
#pragma mark -
|
|
|
|
#endif
|
|
|
|
|
2014-11-22 17:39:04 +03:00
|
|
|
// Helpers for nsSelectMoveScrollCommand and nsPhysicalSelectMoveScrollCommand
|
|
|
|
static void
|
|
|
|
AdjustFocusAfterCaretMove(nsPIDOMWindow* aWindow)
|
|
|
|
{
|
|
|
|
// adjust the focus to the new caret position
|
|
|
|
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
|
|
|
|
if (fm) {
|
|
|
|
nsCOMPtr<nsIDOMElement> result;
|
|
|
|
fm->MoveFocus(aWindow, nullptr, nsIFocusManager::MOVEFOCUS_CARET,
|
|
|
|
nsIFocusManager::FLAG_NOSCROLL, getter_AddRefs(result));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
IsCaretOnInWindow(nsPIDOMWindow* aWindow, nsISelectionController* aSelCont)
|
|
|
|
{
|
|
|
|
// We allow the caret to be moved with arrow keys on any window for which
|
|
|
|
// the caret is enabled. In particular, this includes caret-browsing mode
|
|
|
|
// in non-chrome documents.
|
|
|
|
bool caretOn = false;
|
|
|
|
aSelCont->GetCaretEnabled(&caretOn);
|
|
|
|
if (!caretOn) {
|
|
|
|
caretOn = Preferences::GetBool("accessibility.browsewithcaret");
|
|
|
|
if (caretOn) {
|
|
|
|
nsCOMPtr<nsIDocShell> docShell = aWindow->GetDocShell();
|
|
|
|
if (docShell && docShell->ItemType() == nsIDocShellTreeItem::typeChrome) {
|
|
|
|
caretOn = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return caretOn;
|
|
|
|
}
|
|
|
|
|
2012-01-06 02:42:24 +04:00
|
|
|
static const struct BrowseCommand {
|
2012-01-06 01:33:41 +04:00
|
|
|
const char *reverse, *forward;
|
|
|
|
nsresult (NS_STDCALL nsISelectionController::*scroll)(bool);
|
|
|
|
nsresult (NS_STDCALL nsISelectionController::*move)(bool, bool);
|
|
|
|
} browseCommands[] = {
|
|
|
|
{ sScrollTopString, sScrollBottomString,
|
|
|
|
&nsISelectionController::CompleteScroll },
|
|
|
|
{ sScrollPageUpString, sScrollPageDownString,
|
|
|
|
&nsISelectionController::ScrollPage },
|
|
|
|
{ sScrollLineUpString, sScrollLineDownString,
|
|
|
|
&nsISelectionController::ScrollLine },
|
|
|
|
{ sScrollLeftString, sScrollRightString,
|
|
|
|
&nsISelectionController::ScrollCharacter },
|
|
|
|
{ sMoveTopString, sMoveBottomString,
|
|
|
|
&nsISelectionController::CompleteScroll,
|
|
|
|
&nsISelectionController::CompleteMove },
|
|
|
|
{ sMovePageUpString, sMovePageDownString,
|
|
|
|
&nsISelectionController::ScrollPage,
|
|
|
|
&nsISelectionController::PageMove },
|
|
|
|
{ sLinePreviousString, sLineNextString,
|
|
|
|
&nsISelectionController::ScrollLine,
|
|
|
|
&nsISelectionController::LineMove },
|
|
|
|
{ sWordPreviousString, sWordNextString,
|
|
|
|
&nsISelectionController::ScrollCharacter,
|
|
|
|
&nsISelectionController::WordMove },
|
|
|
|
{ sCharPreviousString, sCharNextString,
|
|
|
|
&nsISelectionController::ScrollCharacter,
|
|
|
|
&nsISelectionController::CharacterMove },
|
|
|
|
{ sBeginLineString, sEndLineString,
|
|
|
|
&nsISelectionController::CompleteScroll,
|
|
|
|
&nsISelectionController::IntraLineMove }
|
|
|
|
};
|
|
|
|
|
2003-04-12 07:08:23 +04:00
|
|
|
nsresult
|
2012-01-06 01:33:41 +04:00
|
|
|
nsSelectMoveScrollCommand::DoCommand(const char *aCommandName, nsISupports *aCommandContext)
|
2003-04-12 07:08:23 +04:00
|
|
|
{
|
2012-01-06 01:33:41 +04:00
|
|
|
nsCOMPtr<nsPIDOMWindow> piWindow(do_QueryInterface(aCommandContext));
|
2003-04-12 07:08:23 +04:00
|
|
|
nsCOMPtr<nsISelectionController> selCont;
|
2012-01-06 01:33:41 +04:00
|
|
|
GetSelectionControllerFromWindow(piWindow, getter_AddRefs(selCont));
|
2003-04-12 07:08:23 +04:00
|
|
|
NS_ENSURE_TRUE(selCont, NS_ERROR_NOT_INITIALIZED);
|
|
|
|
|
2014-11-22 17:39:04 +03:00
|
|
|
bool caretOn = IsCaretOnInWindow(piWindow, selCont);
|
2003-04-12 07:08:23 +04:00
|
|
|
|
2012-02-21 13:34:01 +04:00
|
|
|
for (size_t i = 0; i < ArrayLength(browseCommands); i++) {
|
2012-01-06 01:33:41 +04:00
|
|
|
bool forward = !strcmp(aCommandName, browseCommands[i].forward);
|
|
|
|
if (forward || !strcmp(aCommandName, browseCommands[i].reverse)) {
|
|
|
|
if (caretOn && browseCommands[i].move &&
|
|
|
|
NS_SUCCEEDED((selCont->*(browseCommands[i].move))(forward, false))) {
|
2014-11-22 17:39:04 +03:00
|
|
|
AdjustFocusAfterCaretMove(piWindow);
|
2012-01-06 01:33:41 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
return (selCont->*(browseCommands[i].scroll))(forward);
|
Bug 178324, refactor focus by moving all focus handling into one place and simplifying it, add many tests, fixes many other bugs too numerous to mention in this small checkin comment, r=josh,smichaud,ere,dbaron,marco,neil,gavin,smaug,sr=smaug (CLOSED TREE)
2009-06-10 22:00:39 +04:00
|
|
|
}
|
2003-04-12 07:08:23 +04:00
|
|
|
}
|
2014-11-22 17:39:04 +03:00
|
|
|
|
2012-01-06 01:33:41 +04:00
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
2003-04-12 07:08:23 +04:00
|
|
|
}
|
|
|
|
|
2014-11-22 17:39:04 +03:00
|
|
|
// XXX It's not clear to me yet how we should handle the "scroll" option
|
|
|
|
// for these commands; for now, I'm mapping them back to ScrollCharacter,
|
|
|
|
// ScrollLine, etc., as if for horizontal-mode content, but this may need
|
|
|
|
// to be reconsidered once we have more experience with vertical content.
|
|
|
|
static const struct PhysicalBrowseCommand {
|
|
|
|
const char *command;
|
|
|
|
int16_t direction, amount;
|
|
|
|
nsresult (NS_STDCALL nsISelectionController::*scroll)(bool);
|
|
|
|
} physicalBrowseCommands[] = {
|
|
|
|
{ sMoveLeftString, nsISelectionController::MOVE_LEFT, 0,
|
|
|
|
&nsISelectionController::ScrollCharacter },
|
|
|
|
{ sMoveRightString, nsISelectionController::MOVE_RIGHT, 0,
|
|
|
|
&nsISelectionController::ScrollCharacter },
|
|
|
|
{ sMoveUpString, nsISelectionController::MOVE_UP, 0,
|
|
|
|
&nsISelectionController::ScrollLine },
|
|
|
|
{ sMoveDownString, nsISelectionController::MOVE_DOWN, 0,
|
|
|
|
&nsISelectionController::ScrollLine },
|
|
|
|
{ sMoveLeft2String, nsISelectionController::MOVE_LEFT, 1,
|
|
|
|
&nsISelectionController::ScrollCharacter },
|
|
|
|
{ sMoveRight2String, nsISelectionController::MOVE_RIGHT, 1,
|
|
|
|
&nsISelectionController::ScrollCharacter },
|
|
|
|
{ sMoveUp2String, nsISelectionController::MOVE_UP, 1,
|
|
|
|
&nsISelectionController::CompleteScroll },
|
|
|
|
{ sMoveDown2String, nsISelectionController::MOVE_DOWN, 1,
|
|
|
|
&nsISelectionController::CompleteScroll },
|
|
|
|
};
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsPhysicalSelectMoveScrollCommand::DoCommand(const char *aCommandName,
|
|
|
|
nsISupports *aCommandContext)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsPIDOMWindow> piWindow(do_QueryInterface(aCommandContext));
|
|
|
|
nsCOMPtr<nsISelectionController> selCont;
|
|
|
|
GetSelectionControllerFromWindow(piWindow, getter_AddRefs(selCont));
|
|
|
|
NS_ENSURE_TRUE(selCont, NS_ERROR_NOT_INITIALIZED);
|
|
|
|
|
|
|
|
bool caretOn = IsCaretOnInWindow(piWindow, selCont);
|
|
|
|
|
|
|
|
for (size_t i = 0; i < ArrayLength(physicalBrowseCommands); i++) {
|
|
|
|
const PhysicalBrowseCommand& cmd = physicalBrowseCommands[i];
|
|
|
|
if (!strcmp(aCommandName, cmd.command)) {
|
|
|
|
int16_t dir = cmd.direction;
|
|
|
|
if (caretOn &&
|
|
|
|
NS_SUCCEEDED(selCont->PhysicalMove(dir, cmd.amount, false))) {
|
|
|
|
AdjustFocusAfterCaretMove(piWindow);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool forward = (dir == nsISelectionController::MOVE_RIGHT ||
|
|
|
|
dir == nsISelectionController::MOVE_DOWN);
|
|
|
|
return (selCont->*(cmd.scroll))(forward);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
2003-04-12 07:08:23 +04:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
#pragma mark -
|
|
|
|
#endif
|
|
|
|
|
2014-11-22 17:39:04 +03:00
|
|
|
static const struct SelectCommand {
|
|
|
|
const char *reverse, *forward;
|
|
|
|
nsresult (NS_STDCALL nsISelectionController::*select)(bool, bool);
|
|
|
|
} selectCommands[] = {
|
|
|
|
{ sSelectCharPreviousString, sSelectCharNextString,
|
|
|
|
&nsISelectionController::CharacterMove },
|
|
|
|
{ sSelectWordPreviousString, sSelectWordNextString,
|
|
|
|
&nsISelectionController::WordMove },
|
|
|
|
{ sSelectBeginLineString, sSelectEndLineString,
|
|
|
|
&nsISelectionController::IntraLineMove },
|
|
|
|
{ sSelectLinePreviousString, sSelectLineNextString,
|
|
|
|
&nsISelectionController::LineMove },
|
|
|
|
{ sSelectPageUpString, sSelectPageDownString,
|
|
|
|
&nsISelectionController::PageMove },
|
|
|
|
{ sSelectTopString, sSelectBottomString,
|
|
|
|
&nsISelectionController::CompleteMove }
|
|
|
|
};
|
|
|
|
|
2003-04-12 07:08:23 +04:00
|
|
|
nsresult
|
2014-11-22 17:39:04 +03:00
|
|
|
nsSelectCommand::DoCommand(const char *aCommandName,
|
|
|
|
nsISupports *aCommandContext)
|
2003-04-12 07:08:23 +04:00
|
|
|
{
|
2012-01-06 01:33:41 +04:00
|
|
|
nsCOMPtr<nsPIDOMWindow> piWindow(do_QueryInterface(aCommandContext));
|
2003-04-12 07:08:23 +04:00
|
|
|
nsCOMPtr<nsISelectionController> selCont;
|
2012-01-06 01:33:41 +04:00
|
|
|
GetSelectionControllerFromWindow(piWindow, getter_AddRefs(selCont));
|
2003-04-12 07:08:23 +04:00
|
|
|
NS_ENSURE_TRUE(selCont, NS_ERROR_NOT_INITIALIZED);
|
|
|
|
|
|
|
|
// These commands are so the browser can use caret navigation key bindings -
|
|
|
|
// Helps with accessibility - aaronl@netscape.com
|
2014-11-22 17:39:04 +03:00
|
|
|
for (size_t i = 0; i < ArrayLength(selectCommands); i++) {
|
|
|
|
bool forward = !strcmp(aCommandName, selectCommands[i].forward);
|
|
|
|
if (forward || !strcmp(aCommandName, selectCommands[i].reverse)) {
|
|
|
|
return (selCont->*(selectCommands[i].select))(forward, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
#pragma mark -
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static const struct PhysicalSelectCommand {
|
|
|
|
const char *command;
|
|
|
|
int16_t direction, amount;
|
|
|
|
} physicalSelectCommands[] = {
|
|
|
|
{ sSelectLeftString, nsISelectionController::MOVE_LEFT, 0 },
|
|
|
|
{ sSelectRightString, nsISelectionController::MOVE_RIGHT, 0 },
|
|
|
|
{ sSelectUpString, nsISelectionController::MOVE_UP, 0 },
|
|
|
|
{ sSelectDownString, nsISelectionController::MOVE_DOWN, 0 },
|
|
|
|
{ sSelectLeft2String, nsISelectionController::MOVE_LEFT, 1 },
|
|
|
|
{ sSelectRight2String, nsISelectionController::MOVE_RIGHT, 1 },
|
|
|
|
{ sSelectUp2String, nsISelectionController::MOVE_UP, 1 },
|
|
|
|
{ sSelectDown2String, nsISelectionController::MOVE_DOWN, 1 }
|
|
|
|
};
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsPhysicalSelectCommand::DoCommand(const char *aCommandName,
|
|
|
|
nsISupports *aCommandContext)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsPIDOMWindow> piWindow(do_QueryInterface(aCommandContext));
|
|
|
|
nsCOMPtr<nsISelectionController> selCont;
|
|
|
|
GetSelectionControllerFromWindow(piWindow, getter_AddRefs(selCont));
|
|
|
|
NS_ENSURE_TRUE(selCont, NS_ERROR_NOT_INITIALIZED);
|
|
|
|
|
|
|
|
for (size_t i = 0; i < ArrayLength(physicalSelectCommands); i++) {
|
|
|
|
if (!strcmp(aCommandName, physicalSelectCommands[i].command)) {
|
|
|
|
return selCont->PhysicalMove(physicalSelectCommands[i].direction,
|
|
|
|
physicalSelectCommands[i].amount,
|
|
|
|
true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
2003-04-12 07:08:23 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
#pragma mark -
|
|
|
|
#endif
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsClipboardCommand final : public nsIControllerCommand
|
2010-03-19 21:32:13 +03:00
|
|
|
{
|
2014-06-23 23:56:07 +04:00
|
|
|
~nsClipboardCommand() {}
|
|
|
|
|
2010-03-19 21:32:13 +03:00
|
|
|
public:
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSICONTROLLERCOMMAND
|
|
|
|
};
|
|
|
|
|
2014-04-27 11:06:00 +04:00
|
|
|
NS_IMPL_ISUPPORTS(nsClipboardCommand, nsIControllerCommand)
|
2010-03-19 21:32:13 +03:00
|
|
|
|
|
|
|
nsresult
|
2011-09-29 10:19:26 +04:00
|
|
|
nsClipboardCommand::IsCommandEnabled(const char* aCommandName, nsISupports *aContext, bool *outCmdEnabled)
|
2010-03-19 21:32:13 +03:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(outCmdEnabled);
|
2011-10-17 18:59:28 +04:00
|
|
|
*outCmdEnabled = false;
|
2010-03-19 21:32:13 +03:00
|
|
|
|
2014-11-27 01:06:00 +03:00
|
|
|
if (strcmp(aCommandName, "cmd_copy") &&
|
|
|
|
strcmp(aCommandName, "cmd_copyAndCollapseToEnd"))
|
2010-03-19 21:32:13 +03:00
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aContext);
|
|
|
|
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
|
|
|
|
|
2013-04-24 08:22:37 +04:00
|
|
|
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
|
2010-03-19 21:32:13 +03:00
|
|
|
*outCmdEnabled = nsCopySupport::CanCopy(doc);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsClipboardCommand::DoCommand(const char *aCommandName, nsISupports *aContext)
|
|
|
|
{
|
2014-11-27 01:06:00 +03:00
|
|
|
if (strcmp(aCommandName, "cmd_copy") &&
|
|
|
|
strcmp(aCommandName, "cmd_copyAndCollapseToEnd"))
|
2010-03-19 21:32:13 +03:00
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aContext);
|
|
|
|
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
|
|
|
|
|
|
|
|
nsIDocShell *docShell = window->GetDocShell();
|
|
|
|
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
|
|
|
|
|
2012-12-29 05:56:42 +04:00
|
|
|
nsCOMPtr<nsIPresShell> presShell = docShell->GetPresShell();
|
2010-03-19 21:32:13 +03:00
|
|
|
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
|
|
|
|
|
2013-08-07 22:52:38 +04:00
|
|
|
nsCopySupport::FireClipboardEvent(NS_COPY, nsIClipboard::kGlobalClipboard, presShell, nullptr);
|
2014-11-27 01:06:00 +03:00
|
|
|
|
|
|
|
if (!strcmp(aCommandName, "cmd_copyAndCollapseToEnd")) {
|
|
|
|
dom::Selection *sel =
|
|
|
|
presShell->GetCurrentSelection(nsISelectionController::SELECTION_NORMAL);
|
|
|
|
NS_ENSURE_TRUE(sel, NS_ERROR_FAILURE);
|
|
|
|
sel->CollapseToEnd();
|
|
|
|
}
|
|
|
|
|
2010-03-19 21:32:13 +03:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsClipboardCommand::GetCommandStateParams(const char *aCommandName,
|
|
|
|
nsICommandParams *aParams, nsISupports *aCommandContext)
|
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsClipboardCommand::DoCommandParams(const char *aCommandName, nsICommandParams* aParams, nsISupports *aContext)
|
|
|
|
{
|
|
|
|
return DoCommand(aCommandName, aContext);
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
#pragma mark -
|
|
|
|
#endif
|
|
|
|
|
|
|
|
class nsSelectionCommand : public nsIControllerCommand
|
2003-04-12 07:08:23 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSICONTROLLERCOMMAND
|
|
|
|
|
|
|
|
protected:
|
2014-06-23 23:56:07 +04:00
|
|
|
virtual ~nsSelectionCommand() {}
|
2003-04-12 07:08:23 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual nsresult IsClipboardCommandEnabled(const char * aCommandName, nsIContentViewerEdit* aEdit, bool *outCmdEnabled) = 0;
|
2003-04-22 22:11:12 +04:00
|
|
|
virtual nsresult DoClipboardCommand(const char *aCommandName, nsIContentViewerEdit* aEdit, nsICommandParams* aParams) = 0;
|
2003-04-12 07:08:23 +04:00
|
|
|
|
|
|
|
static nsresult GetContentViewerEditFromContext(nsISupports *aContext, nsIContentViewerEdit **aEditInterface);
|
|
|
|
|
|
|
|
// no member variables, please, we're stateless!
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-04-27 11:06:00 +04:00
|
|
|
NS_IMPL_ISUPPORTS(nsSelectionCommand, nsIControllerCommand)
|
2003-04-12 07:08:23 +04:00
|
|
|
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------
|
|
|
|
|
2010-03-19 21:32:13 +03:00
|
|
|
nsSelectionCommand
|
2003-04-12 07:08:23 +04:00
|
|
|
|
|
|
|
----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2010-03-19 21:32:13 +03:00
|
|
|
nsSelectionCommand::IsCommandEnabled(const char * aCommandName,
|
|
|
|
nsISupports *aCommandContext,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool *outCmdEnabled)
|
2003-04-12 07:08:23 +04:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(outCmdEnabled);
|
2011-10-17 18:59:28 +04:00
|
|
|
*outCmdEnabled = false;
|
2003-04-12 07:08:23 +04:00
|
|
|
|
|
|
|
nsCOMPtr<nsIContentViewerEdit> contentEdit;
|
|
|
|
GetContentViewerEditFromContext(aCommandContext, getter_AddRefs(contentEdit));
|
|
|
|
NS_ENSURE_TRUE(contentEdit, NS_ERROR_NOT_INITIALIZED);
|
|
|
|
|
|
|
|
return IsClipboardCommandEnabled(aCommandName, contentEdit, outCmdEnabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2010-03-19 21:32:13 +03:00
|
|
|
nsSelectionCommand::DoCommand(const char *aCommandName,
|
|
|
|
nsISupports *aCommandContext)
|
2003-04-12 07:08:23 +04:00
|
|
|
{
|
|
|
|
nsCOMPtr<nsIContentViewerEdit> contentEdit;
|
|
|
|
GetContentViewerEditFromContext(aCommandContext, getter_AddRefs(contentEdit));
|
|
|
|
NS_ENSURE_TRUE(contentEdit, NS_ERROR_NOT_INITIALIZED);
|
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
return DoClipboardCommand(aCommandName, contentEdit, nullptr);
|
2003-04-12 07:08:23 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2010-03-19 21:32:13 +03:00
|
|
|
nsSelectionCommand::GetCommandStateParams(const char *aCommandName,
|
|
|
|
nsICommandParams *aParams,
|
|
|
|
nsISupports *aCommandContext)
|
2003-04-12 07:08:23 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2010-03-19 21:32:13 +03:00
|
|
|
nsSelectionCommand::DoCommandParams(const char *aCommandName,
|
|
|
|
nsICommandParams *aParams,
|
|
|
|
nsISupports *aCommandContext)
|
2003-04-12 07:08:23 +04:00
|
|
|
{
|
2003-04-22 22:11:12 +04:00
|
|
|
nsCOMPtr<nsIContentViewerEdit> contentEdit;
|
|
|
|
GetContentViewerEditFromContext(aCommandContext, getter_AddRefs(contentEdit));
|
|
|
|
NS_ENSURE_TRUE(contentEdit, NS_ERROR_NOT_INITIALIZED);
|
|
|
|
|
|
|
|
return DoClipboardCommand(aCommandName, contentEdit, aParams);
|
2003-04-12 07:08:23 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2010-03-19 21:32:13 +03:00
|
|
|
nsSelectionCommand::GetContentViewerEditFromContext(nsISupports *aContext,
|
|
|
|
nsIContentViewerEdit **aEditInterface)
|
2003-04-12 07:08:23 +04:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG(aEditInterface);
|
2012-07-30 18:20:58 +04:00
|
|
|
*aEditInterface = nullptr;
|
2003-04-12 07:08:23 +04:00
|
|
|
|
2005-11-29 02:56:44 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aContext);
|
2003-04-12 07:08:23 +04:00
|
|
|
NS_ENSURE_TRUE(window, NS_ERROR_INVALID_ARG);
|
|
|
|
|
2005-11-29 02:56:44 +03:00
|
|
|
nsIDocShell *docShell = window->GetDocShell();
|
2003-04-12 07:08:23 +04:00
|
|
|
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
|
|
|
|
|
|
|
|
nsCOMPtr<nsIContentViewer> viewer;
|
|
|
|
docShell->GetContentViewer(getter_AddRefs(viewer));
|
|
|
|
nsCOMPtr<nsIContentViewerEdit> edit(do_QueryInterface(viewer));
|
|
|
|
NS_ENSURE_TRUE(edit, NS_ERROR_FAILURE);
|
|
|
|
|
|
|
|
*aEditInterface = edit;
|
|
|
|
NS_ADDREF(*aEditInterface);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
#pragma mark -
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define NS_DECL_CLIPBOARD_COMMAND(_cmd) \
|
2012-06-15 06:31:55 +04:00
|
|
|
class _cmd : public nsSelectionCommand \
|
2003-04-12 07:08:23 +04:00
|
|
|
{ \
|
|
|
|
protected: \
|
|
|
|
\
|
|
|
|
virtual nsresult IsClipboardCommandEnabled(const char* aCommandName, \
|
2012-06-15 06:31:55 +04:00
|
|
|
nsIContentViewerEdit* aEdit, bool *outCmdEnabled); \
|
2003-04-12 07:08:23 +04:00
|
|
|
virtual nsresult DoClipboardCommand(const char* aCommandName, \
|
2003-04-22 22:11:12 +04:00
|
|
|
nsIContentViewerEdit* aEdit, nsICommandParams* aParams); \
|
2003-04-12 07:08:23 +04:00
|
|
|
/* no member variables, please, we're stateless! */ \
|
|
|
|
};
|
|
|
|
|
|
|
|
NS_DECL_CLIPBOARD_COMMAND(nsClipboardCopyLinkCommand)
|
|
|
|
NS_DECL_CLIPBOARD_COMMAND(nsClipboardImageCommands)
|
|
|
|
NS_DECL_CLIPBOARD_COMMAND(nsClipboardSelectAllNoneCommands)
|
2003-04-22 22:11:12 +04:00
|
|
|
NS_DECL_CLIPBOARD_COMMAND(nsClipboardGetContentsCommand)
|
2003-04-12 07:08:23 +04:00
|
|
|
|
|
|
|
nsresult
|
2011-09-29 10:19:26 +04:00
|
|
|
nsClipboardCopyLinkCommand::IsClipboardCommandEnabled(const char* aCommandName, nsIContentViewerEdit* aEdit, bool *outCmdEnabled)
|
2003-04-12 07:08:23 +04:00
|
|
|
{
|
|
|
|
return aEdit->GetInLink(outCmdEnabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2003-04-22 22:11:12 +04:00
|
|
|
nsClipboardCopyLinkCommand::DoClipboardCommand(const char *aCommandName, nsIContentViewerEdit* aEdit, nsICommandParams* aParams)
|
2003-04-12 07:08:23 +04:00
|
|
|
{
|
|
|
|
return aEdit->CopyLinkLocation();
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
#pragma mark -
|
|
|
|
#endif
|
|
|
|
|
|
|
|
nsresult
|
2011-09-29 10:19:26 +04:00
|
|
|
nsClipboardImageCommands::IsClipboardCommandEnabled(const char* aCommandName, nsIContentViewerEdit* aEdit, bool *outCmdEnabled)
|
2003-04-12 07:08:23 +04:00
|
|
|
{
|
|
|
|
return aEdit->GetInImage(outCmdEnabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2003-04-22 22:11:12 +04:00
|
|
|
nsClipboardImageCommands::DoClipboardCommand(const char *aCommandName, nsIContentViewerEdit* aEdit, nsICommandParams* aParams)
|
2003-04-12 07:08:23 +04:00
|
|
|
{
|
|
|
|
if (!nsCRT::strcmp(sCopyImageLocationString, aCommandName))
|
2005-03-11 14:12:15 +03:00
|
|
|
return aEdit->CopyImage(nsIContentViewerEdit::COPY_IMAGE_TEXT);
|
2005-05-05 20:14:00 +04:00
|
|
|
if (!nsCRT::strcmp(sCopyImageContentsString, aCommandName))
|
|
|
|
return aEdit->CopyImage(nsIContentViewerEdit::COPY_IMAGE_DATA);
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t copyFlags = nsIContentViewerEdit::COPY_IMAGE_DATA |
|
2012-04-30 21:08:16 +04:00
|
|
|
nsIContentViewerEdit::COPY_IMAGE_HTML;
|
2005-03-11 14:12:15 +03:00
|
|
|
if (aParams)
|
|
|
|
aParams->GetLongValue("imageCopy", ©Flags);
|
|
|
|
return aEdit->CopyImage(copyFlags);
|
2003-04-12 07:08:23 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
#pragma mark -
|
|
|
|
#endif
|
|
|
|
|
|
|
|
nsresult
|
2011-09-29 10:19:26 +04:00
|
|
|
nsClipboardSelectAllNoneCommands::IsClipboardCommandEnabled(const char* aCommandName, nsIContentViewerEdit* aEdit, bool *outCmdEnabled)
|
2003-04-12 07:08:23 +04:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
*outCmdEnabled = true;
|
2003-04-12 07:08:23 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2003-04-22 22:11:12 +04:00
|
|
|
nsClipboardSelectAllNoneCommands::DoClipboardCommand(const char *aCommandName, nsIContentViewerEdit* aEdit, nsICommandParams* aParams)
|
2003-04-12 07:08:23 +04:00
|
|
|
{
|
|
|
|
if (!nsCRT::strcmp(sSelectAllString, aCommandName))
|
|
|
|
return aEdit->SelectAll();
|
|
|
|
|
|
|
|
return aEdit->ClearSelection();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-04-22 22:11:12 +04:00
|
|
|
#if 0
|
|
|
|
#pragma mark -
|
|
|
|
#endif
|
|
|
|
|
|
|
|
nsresult
|
2011-09-29 10:19:26 +04:00
|
|
|
nsClipboardGetContentsCommand::IsClipboardCommandEnabled(const char* aCommandName, nsIContentViewerEdit* aEdit, bool *outCmdEnabled)
|
2003-04-22 22:11:12 +04:00
|
|
|
{
|
|
|
|
return aEdit->GetCanGetContents(outCmdEnabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsClipboardGetContentsCommand::DoClipboardCommand(const char *aCommandName, nsIContentViewerEdit* aEdit, nsICommandParams* aParams)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG(aParams);
|
|
|
|
|
2012-09-02 06:35:17 +04:00
|
|
|
nsAutoCString mimeType("text/plain");
|
2003-04-22 22:11:12 +04:00
|
|
|
|
|
|
|
nsXPIDLCString format; // nsICommandParams needs to use nsACString
|
|
|
|
if (NS_SUCCEEDED(aParams->GetCStringValue("format", getter_Copies(format))))
|
|
|
|
mimeType.Assign(format);
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool selectionOnly = false;
|
2003-04-22 22:11:12 +04:00
|
|
|
aParams->GetBooleanValue("selection_only", &selectionOnly);
|
|
|
|
|
|
|
|
nsAutoString contents;
|
|
|
|
nsresult rv = aEdit->GetContents(mimeType.get(), selectionOnly, contents);
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
|
|
|
|
|
|
|
return aParams->SetStringValue("result", contents);
|
|
|
|
}
|
|
|
|
|
2012-06-15 06:31:55 +04:00
|
|
|
#if 0 // Remove unless needed again, bug 204777
|
2003-04-12 07:08:23 +04:00
|
|
|
class nsWebNavigationBaseCommand : public nsIControllerCommand
|
|
|
|
{
|
|
|
|
public:
|
2012-06-15 06:31:55 +04:00
|
|
|
virtual ~nsWebNavigationBaseCommand() {}
|
2003-04-12 07:08:23 +04:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSICONTROLLERCOMMAND
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual nsresult IsWebNavCommandEnabled(const char * aCommandName, nsIWebNavigation* aWebNavigation, bool *outCmdEnabled) = 0;
|
2003-04-12 07:08:23 +04:00
|
|
|
virtual nsresult DoWebNavCommand(const char *aCommandName, nsIWebNavigation* aWebNavigation) = 0;
|
|
|
|
|
|
|
|
static nsresult GetWebNavigationFromContext(nsISupports *aContext, nsIWebNavigation **aWebNavigation);
|
|
|
|
|
|
|
|
// no member variables, please, we're stateless!
|
|
|
|
};
|
|
|
|
|
|
|
|
class nsGoForwardCommand : public nsWebNavigationBaseCommand
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual nsresult IsWebNavCommandEnabled(const char * aCommandName, nsIWebNavigation* aWebNavigation, bool *outCmdEnabled);
|
2003-04-12 07:08:23 +04:00
|
|
|
virtual nsresult DoWebNavCommand(const char *aCommandName, nsIWebNavigation* aWebNavigation);
|
|
|
|
// no member variables, please, we're stateless!
|
|
|
|
};
|
|
|
|
|
|
|
|
class nsGoBackCommand : public nsWebNavigationBaseCommand
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual nsresult IsWebNavCommandEnabled(const char * aCommandName, nsIWebNavigation* aWebNavigation, bool *outCmdEnabled);
|
2003-04-12 07:08:23 +04:00
|
|
|
virtual nsresult DoWebNavCommand(const char *aCommandName, nsIWebNavigation* aWebNavigation);
|
|
|
|
// no member variables, please, we're stateless!
|
|
|
|
};
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
nsWebNavigationCommands
|
|
|
|
no params
|
|
|
|
----------------------------------------------------------------------------*/
|
|
|
|
|
2014-04-27 11:06:00 +04:00
|
|
|
NS_IMPL_ISUPPORTS(nsWebNavigationBaseCommand, nsIControllerCommand)
|
2003-04-12 07:08:23 +04:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsWebNavigationBaseCommand::IsCommandEnabled(const char * aCommandName,
|
|
|
|
nsISupports *aCommandContext,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool *outCmdEnabled)
|
2003-04-12 07:08:23 +04:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(outCmdEnabled);
|
2011-10-17 18:59:28 +04:00
|
|
|
*outCmdEnabled = false;
|
2003-04-12 07:08:23 +04:00
|
|
|
|
|
|
|
nsCOMPtr<nsIWebNavigation> webNav;
|
|
|
|
GetWebNavigationFromContext(aCommandContext, getter_AddRefs(webNav));
|
|
|
|
NS_ENSURE_TRUE(webNav, NS_ERROR_INVALID_ARG);
|
|
|
|
|
|
|
|
return IsCommandEnabled(aCommandName, webNav, outCmdEnabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsWebNavigationBaseCommand::GetCommandStateParams(const char *aCommandName,
|
|
|
|
nsICommandParams *aParams, nsISupports *aCommandContext)
|
|
|
|
{
|
|
|
|
// XXX we should probably return the enabled state
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsWebNavigationBaseCommand::DoCommand(const char *aCommandName,
|
|
|
|
nsISupports *aCommandContext)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIWebNavigation> webNav;
|
|
|
|
GetWebNavigationFromContext(aCommandContext, getter_AddRefs(webNav));
|
|
|
|
NS_ENSURE_TRUE(webNav, NS_ERROR_INVALID_ARG);
|
|
|
|
|
2003-04-14 20:10:47 +04:00
|
|
|
return DoWebNavCommand(aCommandName, webNav);
|
2003-04-12 07:08:23 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* void doCommandParams (in string aCommandName, in nsICommandParams aParams, in nsISupports aCommandContext); */
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsWebNavigationBaseCommand::DoCommandParams(const char *aCommandName,
|
|
|
|
nsICommandParams *aParams, nsISupports *aCommandContext)
|
|
|
|
{
|
|
|
|
return DoCommand(aCommandName, aCommandContext);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsWebNavigationBaseCommand::GetWebNavigationFromContext(nsISupports *aContext, nsIWebNavigation **aWebNavigation)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIInterfaceRequestor> windowReq = do_QueryInterface(aContext);
|
|
|
|
CallGetInterface(windowReq.get(), aWebNavigation);
|
|
|
|
return (*aWebNavigation) ? NS_OK : NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2011-09-29 10:19:26 +04:00
|
|
|
nsGoForwardCommand::IsWebNavCommandEnabled(const char * aCommandName, nsIWebNavigation* aWebNavigation, bool *outCmdEnabled)
|
2003-04-12 07:08:23 +04:00
|
|
|
{
|
|
|
|
return aWebNavigation->GetCanGoForward(outCmdEnabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsGoForwardCommand::DoWebNavCommand(const char *aCommandName, nsIWebNavigation* aWebNavigation)
|
|
|
|
{
|
|
|
|
return aWebNavigation->GoForward();
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2011-09-29 10:19:26 +04:00
|
|
|
nsGoBackCommand::IsWebNavCommandEnabled(const char * aCommandName, nsIWebNavigation* aWebNavigation, bool *outCmdEnabled)
|
2003-04-12 07:08:23 +04:00
|
|
|
{
|
|
|
|
return aWebNavigation->GetCanGoBack(outCmdEnabled);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsGoBackCommand::DoWebNavCommand(const char *aCommandName, nsIWebNavigation* aWebNavigation)
|
|
|
|
{
|
|
|
|
return aWebNavigation->GoBack();
|
|
|
|
}
|
2003-05-25 23:39:21 +04:00
|
|
|
#endif
|
2003-04-12 07:08:23 +04:00
|
|
|
|
2003-04-17 17:21:19 +04:00
|
|
|
/*---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
nsClipboardDragDropHookCommand
|
|
|
|
params value type possible values
|
|
|
|
"addhook" isupports nsIClipboardDragDropHooks as nsISupports
|
|
|
|
"removehook" isupports nsIClipboardDragDropHooks as nsISupports
|
|
|
|
|
|
|
|
----------------------------------------------------------------------------*/
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsClipboardDragDropHookCommand final : public nsIControllerCommand
|
2003-04-17 17:21:19 +04:00
|
|
|
{
|
2014-06-23 23:56:07 +04:00
|
|
|
~nsClipboardDragDropHookCommand() {}
|
|
|
|
|
2003-04-17 17:21:19 +04:00
|
|
|
public:
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSICONTROLLERCOMMAND
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// no member variables, please, we're stateless!
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-04-27 11:06:00 +04:00
|
|
|
NS_IMPL_ISUPPORTS(nsClipboardDragDropHookCommand, nsIControllerCommand)
|
2003-04-17 17:21:19 +04:00
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsClipboardDragDropHookCommand::IsCommandEnabled(const char * aCommandName,
|
|
|
|
nsISupports *aCommandContext,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool *outCmdEnabled)
|
2003-04-17 17:21:19 +04:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
*outCmdEnabled = true;
|
2003-04-17 17:21:19 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsClipboardDragDropHookCommand::DoCommand(const char *aCommandName,
|
|
|
|
nsISupports *aCommandContext)
|
|
|
|
{
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsClipboardDragDropHookCommand::DoCommandParams(const char *aCommandName,
|
|
|
|
nsICommandParams *aParams,
|
|
|
|
nsISupports *aCommandContext)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG(aParams);
|
|
|
|
|
2005-11-29 02:56:44 +03:00
|
|
|
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aCommandContext);
|
|
|
|
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
|
2003-04-17 17:21:19 +04:00
|
|
|
|
2005-11-29 02:56:44 +03:00
|
|
|
nsIDocShell *docShell = window->GetDocShell();
|
2003-04-17 17:21:19 +04:00
|
|
|
|
|
|
|
nsCOMPtr<nsIClipboardDragDropHookList> obj = do_GetInterface(docShell);
|
|
|
|
if (!obj) return NS_ERROR_INVALID_ARG;
|
|
|
|
|
|
|
|
nsCOMPtr<nsISupports> isuppHook;
|
|
|
|
|
|
|
|
nsresult returnValue = NS_OK;
|
|
|
|
nsresult rv = aParams->GetISupportsValue("addhook", getter_AddRefs(isuppHook));
|
|
|
|
if (NS_SUCCEEDED(rv))
|
|
|
|
{
|
2003-04-23 00:30:54 +04:00
|
|
|
nsCOMPtr<nsIClipboardDragDropHooks> hook = do_QueryInterface(isuppHook);
|
2003-04-17 17:21:19 +04:00
|
|
|
if (hook)
|
|
|
|
returnValue = obj->AddClipboardDragDropHooks(hook);
|
|
|
|
else
|
|
|
|
returnValue = NS_ERROR_INVALID_ARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
rv = aParams->GetISupportsValue("removehook", getter_AddRefs(isuppHook));
|
|
|
|
if (NS_SUCCEEDED(rv))
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIClipboardDragDropHooks> hook = do_QueryInterface(isuppHook);
|
|
|
|
if (hook)
|
|
|
|
{
|
|
|
|
rv = obj->RemoveClipboardDragDropHooks(hook);
|
|
|
|
if (NS_FAILED(rv) && NS_SUCCEEDED(returnValue))
|
|
|
|
returnValue = rv;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
returnValue = NS_ERROR_INVALID_ARG;
|
|
|
|
}
|
|
|
|
|
|
|
|
return returnValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsClipboardDragDropHookCommand::GetCommandStateParams(const char *aCommandName,
|
|
|
|
nsICommandParams *aParams,
|
|
|
|
nsISupports *aCommandContext)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aParams);
|
2011-10-17 18:59:28 +04:00
|
|
|
return aParams->SetBooleanValue("state_enabled", true);
|
2003-04-17 17:21:19 +04:00
|
|
|
}
|
|
|
|
|
2003-04-12 07:08:23 +04:00
|
|
|
/*---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
RegisterWindowCommands
|
|
|
|
|
|
|
|
----------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
#define NS_REGISTER_ONE_COMMAND(_cmdClass, _cmdName) \
|
|
|
|
{ \
|
2010-07-05 13:42:18 +04:00
|
|
|
_cmdClass* theCmd = new _cmdClass(); \
|
2003-04-12 07:08:23 +04:00
|
|
|
if (!theCmd) return NS_ERROR_OUT_OF_MEMORY; \
|
|
|
|
rv = inCommandTable->RegisterCommand(_cmdName, \
|
2007-07-11 12:46:44 +04:00
|
|
|
static_cast<nsIControllerCommand *>(theCmd)); \
|
2003-04-12 07:08:23 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#define NS_REGISTER_FIRST_COMMAND(_cmdClass, _cmdName) \
|
|
|
|
{ \
|
2010-07-05 13:42:18 +04:00
|
|
|
_cmdClass* theCmd = new _cmdClass(); \
|
2003-04-12 07:08:23 +04:00
|
|
|
if (!theCmd) return NS_ERROR_OUT_OF_MEMORY; \
|
|
|
|
rv = inCommandTable->RegisterCommand(_cmdName, \
|
2007-07-08 11:08:04 +04:00
|
|
|
static_cast<nsIControllerCommand *>(theCmd));
|
2003-04-12 07:08:23 +04:00
|
|
|
|
|
|
|
#define NS_REGISTER_NEXT_COMMAND(_cmdClass, _cmdName) \
|
|
|
|
rv = inCommandTable->RegisterCommand(_cmdName, \
|
2007-07-08 11:08:04 +04:00
|
|
|
static_cast<nsIControllerCommand *>(theCmd));
|
2003-04-12 07:08:23 +04:00
|
|
|
|
|
|
|
#define NS_REGISTER_LAST_COMMAND(_cmdClass, _cmdName) \
|
|
|
|
rv = inCommandTable->RegisterCommand(_cmdName, \
|
2007-07-11 12:46:44 +04:00
|
|
|
static_cast<nsIControllerCommand *>(theCmd)); \
|
2003-04-12 07:08:23 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// static
|
|
|
|
nsresult
|
|
|
|
nsWindowCommandRegistration::RegisterWindowCommands(
|
|
|
|
nsIControllerCommandTable *inCommandTable)
|
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
// XXX rework the macros to use a loop is possible, reducing code size
|
|
|
|
|
|
|
|
// this set of commands is affected by the 'browse with caret' setting
|
|
|
|
NS_REGISTER_FIRST_COMMAND(nsSelectMoveScrollCommand, sScrollTopString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sScrollBottomString);
|
2012-01-06 01:33:41 +04:00
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sScrollPageUpString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sScrollPageDownString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sScrollLineUpString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sScrollLineDownString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sScrollLeftString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sScrollRightString);
|
2011-12-24 04:11:30 +04:00
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sMoveTopString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sMoveBottomString);
|
2004-12-21 08:28:59 +03:00
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sWordPreviousString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sWordNextString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sBeginLineString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sEndLineString);
|
2003-04-12 07:08:23 +04:00
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sMovePageUpString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sMovePageDownString);
|
2011-12-24 04:11:30 +04:00
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sLinePreviousString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sLineNextString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectMoveScrollCommand, sCharPreviousString);
|
|
|
|
NS_REGISTER_LAST_COMMAND(nsSelectMoveScrollCommand, sCharNextString);
|
2003-04-12 07:08:23 +04:00
|
|
|
|
2014-11-22 17:39:04 +03:00
|
|
|
NS_REGISTER_FIRST_COMMAND(nsPhysicalSelectMoveScrollCommand, sMoveLeftString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectMoveScrollCommand, sMoveRightString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectMoveScrollCommand, sMoveUpString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectMoveScrollCommand, sMoveDownString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectMoveScrollCommand, sMoveLeft2String);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectMoveScrollCommand, sMoveRight2String);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectMoveScrollCommand, sMoveUp2String);
|
|
|
|
NS_REGISTER_LAST_COMMAND(nsPhysicalSelectMoveScrollCommand, sMoveDown2String);
|
|
|
|
|
2003-04-12 07:08:23 +04:00
|
|
|
NS_REGISTER_FIRST_COMMAND(nsSelectCommand, sSelectCharPreviousString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectCharNextString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectWordPreviousString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectWordNextString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectBeginLineString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectEndLineString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectLinePreviousString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectLineNextString);
|
2011-12-24 04:11:30 +04:00
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectPageUpString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectPageDownString);
|
2005-02-18 10:29:40 +03:00
|
|
|
NS_REGISTER_NEXT_COMMAND(nsSelectCommand, sSelectTopString);
|
|
|
|
NS_REGISTER_LAST_COMMAND(nsSelectCommand, sSelectBottomString);
|
2014-11-22 17:39:04 +03:00
|
|
|
|
|
|
|
NS_REGISTER_FIRST_COMMAND(nsPhysicalSelectCommand, sSelectLeftString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectCommand, sSelectRightString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectCommand, sSelectUpString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectCommand, sSelectDownString);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectCommand, sSelectLeft2String);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectCommand, sSelectRight2String);
|
|
|
|
NS_REGISTER_NEXT_COMMAND(nsPhysicalSelectCommand, sSelectUp2String);
|
|
|
|
NS_REGISTER_LAST_COMMAND(nsPhysicalSelectCommand, sSelectDown2String);
|
2003-04-12 07:08:23 +04:00
|
|
|
|
2010-03-19 21:32:13 +03:00
|
|
|
NS_REGISTER_ONE_COMMAND(nsClipboardCommand, "cmd_cut");
|
|
|
|
NS_REGISTER_ONE_COMMAND(nsClipboardCommand, "cmd_copy");
|
2014-11-27 01:06:00 +03:00
|
|
|
NS_REGISTER_ONE_COMMAND(nsClipboardCommand, "cmd_copyAndCollapseToEnd");
|
2010-03-19 21:32:13 +03:00
|
|
|
NS_REGISTER_ONE_COMMAND(nsClipboardCommand, "cmd_paste");
|
2003-04-12 07:08:23 +04:00
|
|
|
NS_REGISTER_ONE_COMMAND(nsClipboardCopyLinkCommand, "cmd_copyLink");
|
|
|
|
NS_REGISTER_FIRST_COMMAND(nsClipboardImageCommands, sCopyImageLocationString);
|
2005-05-05 20:14:00 +04:00
|
|
|
NS_REGISTER_NEXT_COMMAND(nsClipboardImageCommands, sCopyImageContentsString);
|
|
|
|
NS_REGISTER_LAST_COMMAND(nsClipboardImageCommands, sCopyImageString);
|
2003-04-12 07:08:23 +04:00
|
|
|
NS_REGISTER_FIRST_COMMAND(nsClipboardSelectAllNoneCommands, sSelectAllString);
|
|
|
|
NS_REGISTER_LAST_COMMAND(nsClipboardSelectAllNoneCommands, sSelectNoneString);
|
|
|
|
|
2003-04-22 22:11:12 +04:00
|
|
|
NS_REGISTER_ONE_COMMAND(nsClipboardGetContentsCommand, "cmd_getContents");
|
|
|
|
|
2003-05-25 23:39:21 +04:00
|
|
|
#if 0 // Remove unless needed again, bug 204777
|
2003-04-15 23:55:10 +04:00
|
|
|
NS_REGISTER_ONE_COMMAND(nsGoBackCommand, "cmd_browserBack");
|
|
|
|
NS_REGISTER_ONE_COMMAND(nsGoForwardCommand, "cmd_browserForward");
|
2003-05-25 23:39:21 +04:00
|
|
|
#endif
|
2003-04-12 07:08:23 +04:00
|
|
|
|
2003-04-17 17:21:19 +04:00
|
|
|
NS_REGISTER_ONE_COMMAND(nsClipboardDragDropHookCommand, "cmd_clipboardDragDropHook");
|
|
|
|
|
2003-04-12 07:08:23 +04:00
|
|
|
return rv;
|
|
|
|
}
|