mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 1260651 part.34 Rename editor command classes and their file names r=mccr8
This patch renames editor command classes listed below: * nsBaseEditorCommand -> mozilla::EditorCommandBase * nsUndoCommand -> mozilla::UndoCommand * nsRedoCommand -> mozilla::RedoCommand * nsClearUndoCommand -> mozilla::ClearUndoCommand * nsCutCommand -> mozilla::CutCommand * nsCutOrDeleteCommand -> mozilla::CutOrDeleteCommand * nsCopyCommand -> mozilla::CopyCommand * nsCopyOrDeleteCommand -> mozilla::CopyOrDeleteCommand * nsCopyAndCollapseToEndCommand -> mozilla::CopyAndCollapseToEndCommand * nsPasteCommand -> mozilla::PasteCommand * nsPasteTransferableCommand -> mozilla::PasteTransferableCommand * nsSwitchTextDirectionCommand -> mozilla::SwitchTextDirectionCommand * nsDeleteCommand -> mozilla::DeleteCommand * nsSelectAllCommand -> mozilla::SelectAllCommand * nsSelectionMoveCommands -> mozilla::SelectionMoveCommands * nsInsertPlaintextCommand -> mozilla::InsertPlaintextCommand * nsPasteQuotationCommand -> mozilla::PasteQuotationCommand MozReview-Commit-ID: Lf6Lc39FpqM --HG-- rename : editor/libeditor/nsEditorCommands.cpp => editor/libeditor/EditorCommands.cpp rename : editor/libeditor/nsEditorCommands.h => editor/libeditor/EditorCommands.h
This commit is contained in:
parent
d074a31e51
commit
26f08a9046
File diff suppressed because it is too large
Load Diff
104
editor/libeditor/EditorCommands.h
Normal file
104
editor/libeditor/EditorCommands.h
Normal file
@ -0,0 +1,104 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef EditorCommands_h_
|
||||
#define EditorCommands_h_
|
||||
|
||||
#include "nsIControllerCommand.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nscore.h"
|
||||
|
||||
class nsICommandParams;
|
||||
class nsISupports;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/**
|
||||
* This is a virtual base class for commands registered with the editor
|
||||
* controller. Note that such commands can be shared by more than on editor
|
||||
* instance, so MUST be stateless. Any state must be stored via the refCon
|
||||
* (an nsIEditor).
|
||||
*/
|
||||
|
||||
class EditorCommandBase : public nsIControllerCommand
|
||||
{
|
||||
public:
|
||||
EditorCommandBase();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD IsCommandEnabled(const char* aCommandName,
|
||||
nsISupports* aCommandRefCon,
|
||||
bool* aIsEnabled) override = 0;
|
||||
NS_IMETHOD DoCommand(const char* aCommandName,
|
||||
nsISupports* aCommandRefCon) override = 0;
|
||||
|
||||
protected:
|
||||
virtual ~EditorCommandBase() {}
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_EDITOR_COMMAND(_cmd) \
|
||||
class _cmd final : public EditorCommandBase \
|
||||
{ \
|
||||
public: \
|
||||
NS_IMETHOD IsCommandEnabled(const char* aCommandName, \
|
||||
nsISupports* aCommandRefCon, \
|
||||
bool* aIsEnabled) override; \
|
||||
NS_IMETHOD DoCommand(const char* aCommandName, \
|
||||
nsISupports* aCommandRefCon) override; \
|
||||
NS_IMETHOD DoCommandParams(const char* aCommandName, \
|
||||
nsICommandParams* aParams, \
|
||||
nsISupports* aCommandRefCon) override; \
|
||||
NS_IMETHOD GetCommandStateParams(const char* aCommandName, \
|
||||
nsICommandParams* aParams, \
|
||||
nsISupports* aCommandRefCon) override; \
|
||||
};
|
||||
|
||||
// basic editor commands
|
||||
NS_DECL_EDITOR_COMMAND(UndoCommand)
|
||||
NS_DECL_EDITOR_COMMAND(RedoCommand)
|
||||
NS_DECL_EDITOR_COMMAND(ClearUndoCommand)
|
||||
|
||||
NS_DECL_EDITOR_COMMAND(CutCommand)
|
||||
NS_DECL_EDITOR_COMMAND(CutOrDeleteCommand)
|
||||
NS_DECL_EDITOR_COMMAND(CopyCommand)
|
||||
NS_DECL_EDITOR_COMMAND(CopyOrDeleteCommand)
|
||||
NS_DECL_EDITOR_COMMAND(CopyAndCollapseToEndCommand)
|
||||
NS_DECL_EDITOR_COMMAND(PasteCommand)
|
||||
NS_DECL_EDITOR_COMMAND(PasteTransferableCommand)
|
||||
NS_DECL_EDITOR_COMMAND(SwitchTextDirectionCommand)
|
||||
NS_DECL_EDITOR_COMMAND(DeleteCommand)
|
||||
NS_DECL_EDITOR_COMMAND(SelectAllCommand)
|
||||
|
||||
NS_DECL_EDITOR_COMMAND(SelectionMoveCommands)
|
||||
|
||||
// Insert content commands
|
||||
NS_DECL_EDITOR_COMMAND(InsertPlaintextCommand)
|
||||
NS_DECL_EDITOR_COMMAND(PasteQuotationCommand)
|
||||
|
||||
|
||||
#if 0
|
||||
// template for new command
|
||||
NS_IMETHODIMP
|
||||
FooCommand::IsCommandEnabled(const char* aCommandName,
|
||||
nsISupports* aCommandRefCon,
|
||||
bool* aIsEnabled)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
FooCommand::DoCommand(const char* aCommandName,
|
||||
const nsAString& aCommandParams,
|
||||
nsISupports* aCommandRefCon)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // #ifndef EditorCommands_h_
|
@ -5,9 +5,9 @@
|
||||
|
||||
#include "mozilla/EditorController.h"
|
||||
|
||||
#include "EditorCommands.h"
|
||||
#include "mozilla/mozalloc.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsEditorCommands.h"
|
||||
#include "nsError.h"
|
||||
#include "nsIControllerCommandTable.h"
|
||||
|
||||
@ -51,34 +51,35 @@ EditorController::RegisterEditingCommands(
|
||||
// now register all our commands
|
||||
// These are commands that will be used in text widgets, and in composer
|
||||
|
||||
NS_REGISTER_ONE_COMMAND(nsUndoCommand, "cmd_undo");
|
||||
NS_REGISTER_ONE_COMMAND(nsRedoCommand, "cmd_redo");
|
||||
NS_REGISTER_ONE_COMMAND(nsClearUndoCommand, "cmd_clearUndo");
|
||||
NS_REGISTER_ONE_COMMAND(UndoCommand, "cmd_undo");
|
||||
NS_REGISTER_ONE_COMMAND(RedoCommand, "cmd_redo");
|
||||
NS_REGISTER_ONE_COMMAND(ClearUndoCommand, "cmd_clearUndo");
|
||||
|
||||
NS_REGISTER_ONE_COMMAND(nsCutCommand, "cmd_cut");
|
||||
NS_REGISTER_ONE_COMMAND(nsCutOrDeleteCommand, "cmd_cutOrDelete");
|
||||
NS_REGISTER_ONE_COMMAND(nsCopyCommand, "cmd_copy");
|
||||
NS_REGISTER_ONE_COMMAND(nsCopyOrDeleteCommand, "cmd_copyOrDelete");
|
||||
NS_REGISTER_ONE_COMMAND(nsCopyAndCollapseToEndCommand,
|
||||
NS_REGISTER_ONE_COMMAND(CutCommand, "cmd_cut");
|
||||
NS_REGISTER_ONE_COMMAND(CutOrDeleteCommand, "cmd_cutOrDelete");
|
||||
NS_REGISTER_ONE_COMMAND(CopyCommand, "cmd_copy");
|
||||
NS_REGISTER_ONE_COMMAND(CopyOrDeleteCommand, "cmd_copyOrDelete");
|
||||
NS_REGISTER_ONE_COMMAND(CopyAndCollapseToEndCommand,
|
||||
"cmd_copyAndCollapseToEnd");
|
||||
NS_REGISTER_ONE_COMMAND(nsSelectAllCommand, "cmd_selectAll");
|
||||
NS_REGISTER_ONE_COMMAND(SelectAllCommand, "cmd_selectAll");
|
||||
|
||||
NS_REGISTER_ONE_COMMAND(nsPasteCommand, "cmd_paste");
|
||||
NS_REGISTER_ONE_COMMAND(nsPasteTransferableCommand, "cmd_pasteTransferable");
|
||||
NS_REGISTER_ONE_COMMAND(PasteCommand, "cmd_paste");
|
||||
NS_REGISTER_ONE_COMMAND(PasteTransferableCommand, "cmd_pasteTransferable");
|
||||
|
||||
NS_REGISTER_ONE_COMMAND(nsSwitchTextDirectionCommand, "cmd_switchTextDirection");
|
||||
NS_REGISTER_ONE_COMMAND(SwitchTextDirectionCommand,
|
||||
"cmd_switchTextDirection");
|
||||
|
||||
NS_REGISTER_FIRST_COMMAND(nsDeleteCommand, "cmd_delete");
|
||||
NS_REGISTER_NEXT_COMMAND(nsDeleteCommand, "cmd_deleteCharBackward");
|
||||
NS_REGISTER_NEXT_COMMAND(nsDeleteCommand, "cmd_deleteCharForward");
|
||||
NS_REGISTER_NEXT_COMMAND(nsDeleteCommand, "cmd_deleteWordBackward");
|
||||
NS_REGISTER_NEXT_COMMAND(nsDeleteCommand, "cmd_deleteWordForward");
|
||||
NS_REGISTER_NEXT_COMMAND(nsDeleteCommand, "cmd_deleteToBeginningOfLine");
|
||||
NS_REGISTER_LAST_COMMAND(nsDeleteCommand, "cmd_deleteToEndOfLine");
|
||||
NS_REGISTER_FIRST_COMMAND(DeleteCommand, "cmd_delete");
|
||||
NS_REGISTER_NEXT_COMMAND(DeleteCommand, "cmd_deleteCharBackward");
|
||||
NS_REGISTER_NEXT_COMMAND(DeleteCommand, "cmd_deleteCharForward");
|
||||
NS_REGISTER_NEXT_COMMAND(DeleteCommand, "cmd_deleteWordBackward");
|
||||
NS_REGISTER_NEXT_COMMAND(DeleteCommand, "cmd_deleteWordForward");
|
||||
NS_REGISTER_NEXT_COMMAND(DeleteCommand, "cmd_deleteToBeginningOfLine");
|
||||
NS_REGISTER_LAST_COMMAND(DeleteCommand, "cmd_deleteToEndOfLine");
|
||||
|
||||
// Insert content
|
||||
NS_REGISTER_ONE_COMMAND(nsInsertPlaintextCommand, "cmd_insertText");
|
||||
NS_REGISTER_ONE_COMMAND(nsPasteQuotationCommand, "cmd_pasteQuote");
|
||||
NS_REGISTER_ONE_COMMAND(InsertPlaintextCommand, "cmd_insertText");
|
||||
NS_REGISTER_ONE_COMMAND(PasteQuotationCommand, "cmd_pasteQuote");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -90,52 +91,52 @@ EditorController::RegisterEditorCommands(
|
||||
{
|
||||
// These are commands that will be used in text widgets only.
|
||||
|
||||
NS_REGISTER_FIRST_COMMAND(nsSelectionMoveCommands, "cmd_scrollTop");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_scrollBottom");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_moveTop");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_moveBottom");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_selectTop");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_selectBottom");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_lineNext");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_linePrevious");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_selectLineNext");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_selectLinePrevious");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_charPrevious");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_charNext");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_selectCharPrevious");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_selectCharNext");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_beginLine");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_endLine");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_selectBeginLine");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_selectEndLine");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_wordPrevious");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_wordNext");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_selectWordPrevious");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_selectWordNext");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_scrollPageUp");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_scrollPageDown");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_scrollLineUp");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_scrollLineDown");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_movePageUp");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_movePageDown");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_selectPageUp");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_selectPageDown");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_moveLeft");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_moveRight");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_moveUp");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_moveDown");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_moveLeft2");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_moveRight2");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_moveUp2");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_moveDown2");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_selectLeft");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_selectRight");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_selectUp");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_selectDown");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_selectLeft2");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_selectRight2");
|
||||
NS_REGISTER_NEXT_COMMAND(nsSelectionMoveCommands, "cmd_selectUp2");
|
||||
NS_REGISTER_LAST_COMMAND(nsSelectionMoveCommands, "cmd_selectDown2");
|
||||
NS_REGISTER_FIRST_COMMAND(SelectionMoveCommands, "cmd_scrollTop");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_scrollBottom");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_moveTop");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_moveBottom");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectTop");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectBottom");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_lineNext");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_linePrevious");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectLineNext");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectLinePrevious");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_charPrevious");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_charNext");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectCharPrevious");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectCharNext");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_beginLine");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_endLine");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectBeginLine");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectEndLine");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_wordPrevious");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_wordNext");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectWordPrevious");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectWordNext");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_scrollPageUp");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_scrollPageDown");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_scrollLineUp");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_scrollLineDown");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_movePageUp");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_movePageDown");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectPageUp");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectPageDown");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_moveLeft");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_moveRight");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_moveUp");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_moveDown");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_moveLeft2");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_moveRight2");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_moveUp2");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_moveDown2");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectLeft");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectRight");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectUp");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectDown");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectLeft2");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectRight2");
|
||||
NS_REGISTER_NEXT_COMMAND(SelectionMoveCommands, "cmd_selectUp2");
|
||||
NS_REGISTER_LAST_COMMAND(SelectionMoveCommands, "cmd_selectDown2");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ UNIFIED_SOURCES += [
|
||||
'DeleteRangeTransaction.cpp',
|
||||
'DeleteTextTransaction.cpp',
|
||||
'EditAggregateTransaction.cpp',
|
||||
'EditorCommands.cpp',
|
||||
'EditorController.cpp',
|
||||
'EditorUtils.cpp',
|
||||
'EditTransactionBase.cpp',
|
||||
@ -34,7 +35,6 @@ UNIFIED_SOURCES += [
|
||||
'InsertTextTransaction.cpp',
|
||||
'JoinNodeTransaction.cpp',
|
||||
'nsEditor.cpp',
|
||||
'nsEditorCommands.cpp',
|
||||
'nsEditorEventListener.cpp',
|
||||
'nsHTMLAbsPosition.cpp',
|
||||
'nsHTMLAnonymousUtils.cpp',
|
||||
|
@ -1,87 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef nsIEditorCommand_h_
|
||||
#define nsIEditorCommand_h_
|
||||
|
||||
#include "nsIControllerCommand.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nscore.h"
|
||||
|
||||
class nsICommandParams;
|
||||
class nsISupports;
|
||||
|
||||
// This is a virtual base class for commands registered with the editor controller.
|
||||
// Note that such commands can be shared by more than on editor instance, so
|
||||
// MUST be stateless. Any state must be stored via the refCon (an nsIEditor).
|
||||
class nsBaseEditorCommand : public nsIControllerCommand
|
||||
{
|
||||
public:
|
||||
nsBaseEditorCommand();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD IsCommandEnabled(const char * aCommandName, nsISupports *aCommandRefCon, bool *_retval) override = 0;
|
||||
NS_IMETHOD DoCommand(const char *aCommandName, nsISupports *aCommandRefCon) override = 0;
|
||||
|
||||
protected:
|
||||
virtual ~nsBaseEditorCommand() {}
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_EDITOR_COMMAND(_cmd) \
|
||||
class _cmd : public nsBaseEditorCommand \
|
||||
{ \
|
||||
public: \
|
||||
NS_IMETHOD IsCommandEnabled(const char * aCommandName, nsISupports *aCommandRefCon, bool *_retval) override; \
|
||||
NS_IMETHOD DoCommand(const char *aCommandName, nsISupports *aCommandRefCon) override; \
|
||||
NS_IMETHOD DoCommandParams(const char *aCommandName,nsICommandParams *aParams, nsISupports *aCommandRefCon) override; \
|
||||
NS_IMETHOD GetCommandStateParams(const char *aCommandName,nsICommandParams *aParams, nsISupports *aCommandRefCon) override; \
|
||||
};
|
||||
|
||||
|
||||
|
||||
// basic editor commands
|
||||
NS_DECL_EDITOR_COMMAND(nsUndoCommand)
|
||||
NS_DECL_EDITOR_COMMAND(nsRedoCommand)
|
||||
NS_DECL_EDITOR_COMMAND(nsClearUndoCommand)
|
||||
|
||||
NS_DECL_EDITOR_COMMAND(nsCutCommand)
|
||||
NS_DECL_EDITOR_COMMAND(nsCutOrDeleteCommand)
|
||||
NS_DECL_EDITOR_COMMAND(nsCopyCommand)
|
||||
NS_DECL_EDITOR_COMMAND(nsCopyOrDeleteCommand)
|
||||
NS_DECL_EDITOR_COMMAND(nsCopyAndCollapseToEndCommand)
|
||||
NS_DECL_EDITOR_COMMAND(nsPasteCommand)
|
||||
NS_DECL_EDITOR_COMMAND(nsPasteTransferableCommand)
|
||||
NS_DECL_EDITOR_COMMAND(nsSwitchTextDirectionCommand)
|
||||
NS_DECL_EDITOR_COMMAND(nsDeleteCommand)
|
||||
NS_DECL_EDITOR_COMMAND(nsSelectAllCommand)
|
||||
|
||||
NS_DECL_EDITOR_COMMAND(nsSelectionMoveCommands)
|
||||
|
||||
// Insert content commands
|
||||
NS_DECL_EDITOR_COMMAND(nsInsertPlaintextCommand)
|
||||
NS_DECL_EDITOR_COMMAND(nsPasteQuotationCommand)
|
||||
|
||||
|
||||
#if 0
|
||||
// template for new command
|
||||
NS_IMETHODIMP
|
||||
nsFooCommand::IsCommandEnabled(const char * aCommandName, nsISupports *aCommandRefCon, bool *_retval)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFooCommand::DoCommand(const char *aCommandName, const nsAString & aCommandParams, nsISupports *aCommandRefCon)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#endif // nsIEditorCommand_h_
|
Loading…
Reference in New Issue
Block a user