gecko-dev/editor/libeditor/HTMLEditorCommands.cpp

1597 строки
45 KiB
C++
Исходник Обычный вид История

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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/. */
2000-05-02 01:37:38 +04:00
#include <stdio.h> // for printf
2000-05-02 01:37:38 +04:00
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc
#include "mozilla/EditorBase.h" // for EditorBase
#include "mozilla/ErrorResult.h"
#include "mozilla/HTMLEditor.h" // for HTMLEditor
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
#include "mozilla/HTMLEditorCommands.h"
#include "mozilla/dom/Element.h"
#include "nsAString.h"
#include "nsCommandParams.h" // for nsCommandParams, etc
#include "nsCOMPtr.h" // for nsCOMPtr, do_QueryInterface, etc
#include "nsComponentManagerUtils.h" // for do_CreateInstance
#include "nsDebug.h" // for NS_ENSURE_TRUE, etc
#include "nsError.h" // for NS_OK, NS_ERROR_FAILURE, etc
#include "nsGkAtoms.h" // for nsGkAtoms, nsGkAtoms::font, etc
#include "nsAtom.h" // for nsAtom, etc
#include "nsIClipboard.h" // for nsIClipboard, etc
#include "nsID.h"
#include "nsIEditor.h" // for nsIEditor
#include "nsIHTMLEditor.h" // for nsIHTMLEditor, etc
#include "nsLiteralString.h" // for NS_LITERAL_STRING
#include "nsReadableUtils.h" // for EmptyString
#include "nsString.h" // for nsAutoString, nsString, etc
#include "nsStringFwd.h" // for nsString
class nsISupports;
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
namespace mozilla {
using dom::Element;
//prototype
static nsresult
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
GetListState(HTMLEditor* aHTMLEditor, bool* aMixed, nsAString& aLocalName);
//defines
#define STATE_ENABLED "state_enabled"
#define STATE_ALL "state_all"
#define STATE_ANY "state_any"
#define STATE_MIXED "state_mixed"
#define STATE_BEGIN "state_begin"
#define STATE_END "state_end"
#define STATE_ATTRIBUTE "state_attribute"
#define STATE_DATA "state_data"
2000-05-02 01:37:38 +04:00
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
HTMLEditorCommandBase::HTMLEditorCommandBase()
{
}
2000-05-02 01:37:38 +04:00
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
NS_IMPL_ISUPPORTS(HTMLEditorCommandBase, nsIControllerCommand)
2000-05-02 01:37:38 +04:00
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
StateUpdatingCommandBase::StateUpdatingCommandBase(nsAtom* aTagName)
: HTMLEditorCommandBase()
, mTagName(aTagName)
2000-05-02 01:37:38 +04:00
{
MOZ_ASSERT(mTagName);
2000-05-02 01:37:38 +04:00
}
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
StateUpdatingCommandBase::~StateUpdatingCommandBase()
2000-05-02 01:37:38 +04:00
{
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
StateUpdatingCommandBase::IsCommandEnabled(const char* aCommandName,
nsISupports* refCon,
bool* outCmdEnabled)
2000-05-02 01:37:38 +04:00
{
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (!editor) {
*outCmdEnabled = false;
return NS_OK;
}
mozilla::EditorBase* editorBase = editor->AsEditorBase();
MOZ_ASSERT(editorBase);
*outCmdEnabled = editorBase->IsSelectionEditable();
return NS_OK;
2000-05-02 01:37:38 +04:00
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
StateUpdatingCommandBase::DoCommand(const char* aCommandName,
nsISupports* refCon)
2000-05-02 01:37:38 +04:00
{
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (NS_WARN_IF(!editor)) {
return NS_ERROR_FAILURE;
}
mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
if (NS_WARN_IF(!htmlEditor)) {
return NS_ERROR_FAILURE;
}
return ToggleState(htmlEditor);
2000-05-02 01:37:38 +04:00
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
StateUpdatingCommandBase::DoCommandParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* refCon)
{
return DoCommand(aCommandName, refCon);
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
StateUpdatingCommandBase::GetCommandStateParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* refCon)
2000-05-02 01:37:38 +04:00
{
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (!editor) {
return NS_OK;
}
mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
if (NS_WARN_IF(!htmlEditor)) {
return NS_ERROR_FAILURE;
}
return GetCurrentState(htmlEditor, aParams);
}
2000-05-02 01:37:38 +04:00
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
PasteNoFormattingCommand::IsCommandEnabled(const char* aCommandName,
nsISupports* refCon,
bool* outCmdEnabled)
{
NS_ENSURE_ARG_POINTER(outCmdEnabled);
*outCmdEnabled = false;
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (NS_WARN_IF(!editor)) {
return NS_ERROR_FAILURE;
}
// This command is only implemented by nsIHTMLEditor, since
// pasting in a plaintext editor automatically only supplies
// "unformatted" text
mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
if (NS_WARN_IF(!htmlEditor)) {
return NS_ERROR_FAILURE;
}
return htmlEditor->CanPaste(nsIClipboard::kGlobalClipboard, outCmdEnabled);
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
PasteNoFormattingCommand::DoCommand(const char* aCommandName,
nsISupports* refCon)
{
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (NS_WARN_IF(!editor)) {
return NS_ERROR_FAILURE;
}
mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
if (NS_WARN_IF(!htmlEditor)) {
return NS_ERROR_FAILURE;
}
return htmlEditor->PasteNoFormatting(nsIClipboard::kGlobalClipboard);
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
PasteNoFormattingCommand::DoCommandParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* refCon)
{
return DoCommand(aCommandName, refCon);
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
PasteNoFormattingCommand::GetCommandStateParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* refCon)
{
NS_ENSURE_ARG_POINTER(aParams);
bool enabled = false;
nsresult rv = IsCommandEnabled(aCommandName, refCon, &enabled);
NS_ENSURE_SUCCESS(rv, rv);
return aParams->AsCommandParams()->SetBool(STATE_ENABLED, enabled);
}
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
StyleUpdatingCommand::StyleUpdatingCommand(nsAtom* aTagName)
: StateUpdatingCommandBase(aTagName)
2000-05-02 01:37:38 +04:00
{
}
nsresult
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
StyleUpdatingCommand::GetCurrentState(HTMLEditor* aHTMLEditor,
nsICommandParams *aParams)
{
if (NS_WARN_IF(!aHTMLEditor)) {
return NS_ERROR_INVALID_ARG;
}
bool firstOfSelectionHasProp = false;
bool anyOfSelectionHasProp = false;
bool allOfSelectionHasProp = false;
nsresult rv = aHTMLEditor->GetInlineProperty(mTagName, nullptr,
EmptyString(),
&firstOfSelectionHasProp,
&anyOfSelectionHasProp,
&allOfSelectionHasProp);
nsCommandParams* params = aParams->AsCommandParams();
params->SetBool(STATE_ENABLED, NS_SUCCEEDED(rv));
params->SetBool(STATE_ALL, allOfSelectionHasProp);
params->SetBool(STATE_ANY, anyOfSelectionHasProp);
params->SetBool(STATE_MIXED, anyOfSelectionHasProp && !allOfSelectionHasProp);
params->SetBool(STATE_BEGIN, firstOfSelectionHasProp);
params->SetBool(STATE_END, allOfSelectionHasProp); //not completely accurate
return NS_OK;
}
nsresult
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
StyleUpdatingCommand::ToggleState(HTMLEditor* aHTMLEditor)
{
if (NS_WARN_IF(!aHTMLEditor)) {
return NS_ERROR_INVALID_ARG;
}
RefPtr<nsCommandParams> params = new nsCommandParams();
// tags "href" and "name" are special cases in the core editor
// they are used to remove named anchor/link and shouldn't be used for insertion
bool doTagRemoval;
if (mTagName == nsGkAtoms::href || mTagName == nsGkAtoms::name) {
doTagRemoval = true;
} else {
// check current selection; set doTagRemoval if formatting should be removed
nsresult rv = GetCurrentState(aHTMLEditor, params);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
ErrorResult error;
doTagRemoval = params->GetBool(STATE_ALL, error);
if (NS_WARN_IF(error.Failed())) {
return error.StealNSResult();
}
}
if (doTagRemoval) {
// Also remove equivalent properties (bug 317093)
if (mTagName == nsGkAtoms::b) {
nsresult rv =
aHTMLEditor->RemoveInlineProperty(nsGkAtoms::strong, nullptr);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
} else if (mTagName == nsGkAtoms::i) {
nsresult rv =
aHTMLEditor->RemoveInlineProperty(nsGkAtoms::em, nullptr);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
} else if (mTagName == nsGkAtoms::strike) {
nsresult rv =
aHTMLEditor->RemoveInlineProperty(nsGkAtoms::s, nullptr);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
}
nsresult rv = aHTMLEditor->RemoveInlineProperty(mTagName, nullptr);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
return NS_OK;
}
// Superscript and Subscript styles are mutually exclusive
aHTMLEditor->BeginTransaction();
nsresult rv = NS_OK;
if (mTagName == nsGkAtoms::sub || mTagName == nsGkAtoms::sup) {
rv = aHTMLEditor->RemoveInlineProperty(mTagName, nullptr);
}
if (NS_SUCCEEDED(rv)) {
rv = aHTMLEditor->SetInlineProperty(mTagName, nullptr, EmptyString());
}
aHTMLEditor->EndTransaction();
return rv;
}
2000-05-02 01:37:38 +04:00
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
ListCommand::ListCommand(nsAtom* aTagName)
: StateUpdatingCommandBase(aTagName)
2000-05-02 01:37:38 +04:00
{
}
nsresult
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
ListCommand::GetCurrentState(HTMLEditor* aHTMLEditor,
nsICommandParams* aParams)
{
if (NS_WARN_IF(!aHTMLEditor)) {
return NS_ERROR_INVALID_ARG;
}
bool bMixed;
nsAutoString localName;
nsresult rv = GetListState(aHTMLEditor, &bMixed, localName);
NS_ENSURE_SUCCESS(rv, rv);
bool inList = mTagName->Equals(localName);
nsCommandParams* params = aParams->AsCommandParams();
params->SetBool(STATE_ALL, !bMixed && inList);
params->SetBool(STATE_MIXED, bMixed);
params->SetBool(STATE_ENABLED, true);
return NS_OK;
}
2000-05-02 01:37:38 +04:00
nsresult
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
ListCommand::ToggleState(HTMLEditor* aHTMLEditor)
{
if (NS_WARN_IF(!aHTMLEditor)) {
return NS_ERROR_INVALID_ARG;
}
nsresult rv;
RefPtr<nsCommandParams> params = new nsCommandParams();
rv = GetCurrentState(aHTMLEditor, params);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
ErrorResult error;
bool inList = params->GetBool(STATE_ALL, error);
if (NS_WARN_IF(error.Failed())) {
return error.StealNSResult();
}
nsDependentAtomString listType(mTagName);
if (inList) {
rv = aHTMLEditor->RemoveList(listType);
} else {
rv = aHTMLEditor->MakeOrChangeList(listType, false, EmptyString());
}
return rv;
}
2000-05-02 01:37:38 +04:00
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
ListItemCommand::ListItemCommand(nsAtom* aTagName)
: StateUpdatingCommandBase(aTagName)
{
}
nsresult
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
ListItemCommand::GetCurrentState(HTMLEditor* aHTMLEditor,
nsICommandParams *aParams)
{
if (NS_WARN_IF(!aHTMLEditor)) {
return NS_ERROR_INVALID_ARG;
}
bool bMixed, bLI, bDT, bDD;
nsresult rv = aHTMLEditor->GetListItemState(&bMixed, &bLI, &bDT, &bDD);
NS_ENSURE_SUCCESS(rv, rv);
bool inList = false;
if (!bMixed) {
if (bLI) {
inList = mTagName == nsGkAtoms::li;
} else if (bDT) {
inList = mTagName == nsGkAtoms::dt;
} else if (bDD) {
inList = mTagName == nsGkAtoms::dd;
}
}
nsCommandParams* params = aParams->AsCommandParams();
params->SetBool(STATE_ALL, !bMixed && inList);
params->SetBool(STATE_MIXED, bMixed);
return NS_OK;
}
nsresult
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
ListItemCommand::ToggleState(HTMLEditor* aHTMLEditor)
{
if (NS_WARN_IF(!aHTMLEditor)) {
return NS_ERROR_INVALID_ARG;
}
// Need to use mTagName????
RefPtr<nsCommandParams> params = new nsCommandParams();
GetCurrentState(aHTMLEditor, params);
ErrorResult error;
bool inList = params->GetBool(STATE_ALL, error);
if (NS_WARN_IF(error.Failed())) {
return error.StealNSResult();
}
if (inList) {
// To remove a list, first get what kind of list we're in
bool bMixed;
nsAutoString localName;
nsresult rv = GetListState(aHTMLEditor, &bMixed, localName);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
if (localName.IsEmpty() || bMixed) {
return NS_OK;
}
return aHTMLEditor->RemoveList(localName);
}
// Set to the requested paragraph type
//XXX Note: This actually doesn't work for "LI",
// but we currently don't use this for non DL lists anyway.
// Problem: won't this replace any current block paragraph style?
return aHTMLEditor->SetParagraphFormat(nsDependentAtomString(mTagName));
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
RemoveListCommand::IsCommandEnabled(const char* aCommandName,
nsISupports* refCon,
bool* outCmdEnabled)
{
*outCmdEnabled = false;
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (!editor) {
return NS_OK;
}
mozilla::EditorBase* editorBase = editor->AsEditorBase();
MOZ_ASSERT(editorBase);
if (!editorBase->IsSelectionEditable()) {
return NS_OK;
}
// It is enabled if we are in any list type
mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
if (NS_WARN_IF(!htmlEditor)) {
return NS_ERROR_FAILURE;
}
bool bMixed;
nsAutoString localName;
nsresult rv = GetListState(htmlEditor, &bMixed, localName);
NS_ENSURE_SUCCESS(rv, rv);
*outCmdEnabled = bMixed || !localName.IsEmpty();
return NS_OK;
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
RemoveListCommand::DoCommand(const char* aCommandName, nsISupports* refCon)
{
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (!editor) {
return NS_OK;
}
mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
if (!htmlEditor) {
return NS_OK;
}
// This removes any list type
return htmlEditor->RemoveList(EmptyString());
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
RemoveListCommand::DoCommandParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* refCon)
{
return DoCommand(aCommandName, refCon);
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
RemoveListCommand::GetCommandStateParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* refCon)
{
bool outCmdEnabled = false;
IsCommandEnabled(aCommandName, refCon, &outCmdEnabled);
return aParams->AsCommandParams()->SetBool(STATE_ENABLED, outCmdEnabled);
}
2000-05-02 01:37:38 +04:00
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
IndentCommand::IsCommandEnabled(const char* aCommandName,
nsISupports* refCon, bool* outCmdEnabled)
2000-05-02 01:37:38 +04:00
{
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (!editor) {
*outCmdEnabled = false;
return NS_OK;
}
mozilla::EditorBase* editorBase = editor->AsEditorBase();
MOZ_ASSERT(editorBase);
*outCmdEnabled = editorBase->IsSelectionEditable();
return NS_OK;
2000-05-02 01:37:38 +04:00
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
IndentCommand::DoCommand(const char* aCommandName, nsISupports* refCon)
2000-05-02 01:37:38 +04:00
{
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (!editor) {
return NS_OK;
2000-05-02 01:37:38 +04:00
}
mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
if (!htmlEditor) {
return NS_OK;
}
return htmlEditor->Indent(NS_LITERAL_STRING("indent"));
2000-05-02 01:37:38 +04:00
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
IndentCommand::DoCommandParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* refCon)
{
return DoCommand(aCommandName, refCon);
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
IndentCommand::GetCommandStateParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* refCon)
{
bool outCmdEnabled = false;
IsCommandEnabled(aCommandName, refCon, &outCmdEnabled);
return aParams->AsCommandParams()->SetBool(STATE_ENABLED, outCmdEnabled);
}
//OUTDENT
2000-05-02 01:37:38 +04:00
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
OutdentCommand::IsCommandEnabled(const char* aCommandName,
nsISupports* refCon,
bool* outCmdEnabled)
2000-05-02 01:37:38 +04:00
{
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (!editor) {
*outCmdEnabled = false;
return NS_OK;
2000-05-02 01:37:38 +04:00
}
mozilla::EditorBase* editorBase = editor->AsEditorBase();
MOZ_ASSERT(editorBase);
*outCmdEnabled = editorBase->IsSelectionEditable();
return NS_OK;
2000-05-02 01:37:38 +04:00
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
OutdentCommand::DoCommand(const char* aCommandName, nsISupports* refCon)
2000-05-02 01:37:38 +04:00
{
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (!editor) {
return NS_OK;
}
mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
if (!htmlEditor) {
return NS_OK;
}
return htmlEditor->Indent(NS_LITERAL_STRING("outdent"));
2000-05-02 01:37:38 +04:00
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
OutdentCommand::DoCommandParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* refCon)
{
return DoCommand(aCommandName, refCon);
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
OutdentCommand::GetCommandStateParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* refCon)
{
bool outCmdEnabled = false;
IsCommandEnabled(aCommandName, refCon, &outCmdEnabled);
return aParams->AsCommandParams()->SetBool(STATE_ENABLED, outCmdEnabled);
}
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
MultiStateCommandBase::MultiStateCommandBase()
: HTMLEditorCommandBase()
{
}
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
MultiStateCommandBase::~MultiStateCommandBase()
{
}
2000-05-02 01:37:38 +04:00
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
MultiStateCommandBase::IsCommandEnabled(const char* aCommandName,
nsISupports* refCon,
bool *outCmdEnabled)
2000-05-02 01:37:38 +04:00
{
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (!editor) {
*outCmdEnabled = false;
return NS_OK;
}
mozilla::EditorBase* editorBase = editor->AsEditorBase();
MOZ_ASSERT(editorBase);
// should be disabled sometimes, like if the current selection is an image
*outCmdEnabled = editorBase->IsSelectionEditable();
return NS_OK;
2000-05-02 01:37:38 +04:00
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
MultiStateCommandBase::DoCommand(const char* aCommandName, nsISupports* refCon)
2000-05-02 01:37:38 +04:00
{
#ifdef DEBUG
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
printf("who is calling MultiStateCommandBase::DoCommand \
(no implementation)? %s\n", aCommandName);
#endif
return NS_OK;
2000-05-02 01:37:38 +04:00
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
MultiStateCommandBase::DoCommandParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* refCon)
{
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (!editor) {
return NS_OK;
}
mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
if (NS_WARN_IF(!htmlEditor)) {
return NS_ERROR_FAILURE;
}
nsAutoString attribute;
if (aParams) {
nsCommandParams* params = aParams->AsCommandParams();
nsAutoCString asciiAttribute;
nsresult rv = params->GetCString(STATE_ATTRIBUTE, asciiAttribute);
if (NS_SUCCEEDED(rv)) {
CopyASCIItoUTF16(asciiAttribute, attribute);
} else {
params->GetString(STATE_ATTRIBUTE, attribute);
}
}
return SetState(htmlEditor, attribute);
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
MultiStateCommandBase::GetCommandStateParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* refCon)
{
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (!editor) {
return NS_OK;
}
mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
if (NS_WARN_IF(!htmlEditor)) {
return NS_ERROR_FAILURE;
}
return GetCurrentState(htmlEditor, aParams);
}
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
ParagraphStateCommand::ParagraphStateCommand()
: MultiStateCommandBase()
{
}
nsresult
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
ParagraphStateCommand::GetCurrentState(HTMLEditor* aHTMLEditor,
nsICommandParams* aParams)
{
if (NS_WARN_IF(!aHTMLEditor)) {
return NS_ERROR_INVALID_ARG;
}
bool outMixed;
nsAutoString outStateString;
nsresult rv = aHTMLEditor->GetParagraphState(&outMixed, outStateString);
if (NS_SUCCEEDED(rv)) {
nsAutoCString tOutStateString;
LossyCopyUTF16toASCII(outStateString, tOutStateString);
nsCommandParams* params = aParams->AsCommandParams();
params->SetBool(STATE_MIXED, outMixed);
params->SetCString(STATE_ATTRIBUTE, tOutStateString);
}
return rv;
}
nsresult
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
ParagraphStateCommand::SetState(HTMLEditor* aHTMLEditor,
const nsString& newState)
{
if (NS_WARN_IF(!aHTMLEditor)) {
return NS_ERROR_INVALID_ARG;
}
return aHTMLEditor->SetParagraphFormat(newState);
}
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
FontFaceStateCommand::FontFaceStateCommand()
: MultiStateCommandBase()
{
}
nsresult
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
FontFaceStateCommand::GetCurrentState(HTMLEditor* aHTMLEditor,
nsICommandParams* aParams)
{
if (NS_WARN_IF(!aHTMLEditor)) {
return NS_ERROR_INVALID_ARG;
}
nsAutoString outStateString;
bool outMixed;
nsresult rv = aHTMLEditor->GetFontFaceState(&outMixed, outStateString);
if (NS_SUCCEEDED(rv)) {
nsCommandParams* params = aParams->AsCommandParams();
params->SetBool(STATE_MIXED, outMixed);
params->SetCString(STATE_ATTRIBUTE, NS_ConvertUTF16toUTF8(outStateString));
}
return rv;
}
nsresult
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
FontFaceStateCommand::SetState(HTMLEditor* aHTMLEditor,
const nsString& newState)
{
if (NS_WARN_IF(!aHTMLEditor)) {
return NS_ERROR_INVALID_ARG;
}
if (newState.EqualsLiteral("tt")) {
// The old "teletype" attribute
nsresult rv = aHTMLEditor->SetInlineProperty(nsGkAtoms::tt, nullptr,
EmptyString());
NS_ENSURE_SUCCESS(rv, rv);
// Clear existing font face
return aHTMLEditor->RemoveInlineProperty(nsGkAtoms::font, nsGkAtoms::face);
}
// Remove any existing TT nodes
nsresult rv = aHTMLEditor->RemoveInlineProperty(nsGkAtoms::tt, nullptr);
NS_ENSURE_SUCCESS(rv, rv);
if (newState.IsEmpty() || newState.EqualsLiteral("normal")) {
return aHTMLEditor->RemoveInlineProperty(nsGkAtoms::font, nsGkAtoms::face);
}
return aHTMLEditor->SetInlineProperty(nsGkAtoms::font, nsGkAtoms::face,
newState);
}
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
FontSizeStateCommand::FontSizeStateCommand()
: MultiStateCommandBase()
{
}
nsresult
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
FontSizeStateCommand::GetCurrentState(HTMLEditor* aHTMLEditor,
nsICommandParams* aParams)
{
if (NS_WARN_IF(!aHTMLEditor)) {
return NS_ERROR_INVALID_ARG;
}
nsAutoString outStateString;
bool firstHas, anyHas, allHas;
nsresult rv = aHTMLEditor->GetInlinePropertyWithAttrValue(
nsGkAtoms::font,
nsGkAtoms::size,
EmptyString(),
&firstHas, &anyHas, &allHas,
outStateString);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoCString tOutStateString;
LossyCopyUTF16toASCII(outStateString, tOutStateString);
nsCommandParams* params = aParams->AsCommandParams();
params->SetBool(STATE_MIXED, anyHas && !allHas);
params->SetCString(STATE_ATTRIBUTE, tOutStateString);
params->SetBool(STATE_ENABLED, true);
return rv;
}
// acceptable values for "newState" are:
// -2
// -1
// 0
// +1
// +2
// +3
// medium
// normal
nsresult
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
FontSizeStateCommand::SetState(HTMLEditor* aHTMLEditor,
const nsString& newState)
{
if (NS_WARN_IF(!aHTMLEditor)) {
return NS_ERROR_INVALID_ARG;
}
if (!newState.IsEmpty() &&
!newState.EqualsLiteral("normal") &&
!newState.EqualsLiteral("medium")) {
return aHTMLEditor->SetInlineProperty(nsGkAtoms::font,
nsGkAtoms::size, newState);
}
// remove any existing font size, big or small
nsresult rv = aHTMLEditor->RemoveInlineProperty(nsGkAtoms::font,
nsGkAtoms::size);
NS_ENSURE_SUCCESS(rv, rv);
rv = aHTMLEditor->RemoveInlineProperty(nsGkAtoms::big, nullptr);
NS_ENSURE_SUCCESS(rv, rv);
return aHTMLEditor->RemoveInlineProperty(nsGkAtoms::small, nullptr);
}
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
FontColorStateCommand::FontColorStateCommand()
: MultiStateCommandBase()
{
}
nsresult
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
FontColorStateCommand::GetCurrentState(HTMLEditor* aHTMLEditor,
nsICommandParams* aParams)
{
if (NS_WARN_IF(!aHTMLEditor)) {
return NS_ERROR_INVALID_ARG;
}
bool outMixed;
nsAutoString outStateString;
nsresult rv = aHTMLEditor->GetFontColorState(&outMixed, outStateString);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoCString tOutStateString;
LossyCopyUTF16toASCII(outStateString, tOutStateString);
nsCommandParams* params = aParams->AsCommandParams();
params->SetBool(STATE_MIXED, outMixed);
params->SetCString(STATE_ATTRIBUTE, tOutStateString);
return NS_OK;
}
nsresult
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
FontColorStateCommand::SetState(HTMLEditor* aHTMLEditor,
const nsString& newState)
{
if (NS_WARN_IF(!aHTMLEditor)) {
return NS_ERROR_INVALID_ARG;
}
if (newState.IsEmpty() || newState.EqualsLiteral("normal")) {
return aHTMLEditor->RemoveInlineProperty(nsGkAtoms::font,
nsGkAtoms::color);
}
return aHTMLEditor->SetInlineProperty(nsGkAtoms::font, nsGkAtoms::color,
newState);
}
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
HighlightColorStateCommand::HighlightColorStateCommand()
: MultiStateCommandBase()
{
}
nsresult
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
HighlightColorStateCommand::GetCurrentState(HTMLEditor* aHTMLEditor,
nsICommandParams* aParams)
{
if (NS_WARN_IF(!aHTMLEditor)) {
return NS_ERROR_INVALID_ARG;
}
bool outMixed;
nsAutoString outStateString;
nsresult rv = aHTMLEditor->GetHighlightColorState(&outMixed, outStateString);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoCString tOutStateString;
LossyCopyUTF16toASCII(outStateString, tOutStateString);
nsCommandParams* params = aParams->AsCommandParams();
params->SetBool(STATE_MIXED, outMixed);
params->SetCString(STATE_ATTRIBUTE, tOutStateString);
return NS_OK;
}
nsresult
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
HighlightColorStateCommand::SetState(HTMLEditor* aHTMLEditor,
const nsString& newState)
{
if (NS_WARN_IF(!aHTMLEditor)) {
return NS_ERROR_INVALID_ARG;
}
if (newState.IsEmpty() || newState.EqualsLiteral("normal")) {
return aHTMLEditor->RemoveInlineProperty(nsGkAtoms::font,
nsGkAtoms::bgcolor);
}
return aHTMLEditor->SetInlineProperty(nsGkAtoms::font,
nsGkAtoms::bgcolor,
newState);
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
HighlightColorStateCommand::IsCommandEnabled(const char* aCommandName,
nsISupports* refCon,
bool* outCmdEnabled)
{
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (!editor) {
*outCmdEnabled = false;
return NS_OK;
}
mozilla::EditorBase* editorBase = editor->AsEditorBase();
MOZ_ASSERT(editorBase);
*outCmdEnabled = editorBase->IsSelectionEditable();
return NS_OK;
}
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
BackgroundColorStateCommand::BackgroundColorStateCommand()
: MultiStateCommandBase()
{
}
nsresult
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
BackgroundColorStateCommand::GetCurrentState(HTMLEditor* aHTMLEditor,
nsICommandParams* aParams)
{
if (NS_WARN_IF(!aHTMLEditor)) {
return NS_ERROR_INVALID_ARG;
}
bool outMixed;
nsAutoString outStateString;
nsresult rv = aHTMLEditor->GetBackgroundColorState(&outMixed, outStateString);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoCString tOutStateString;
LossyCopyUTF16toASCII(outStateString, tOutStateString);
nsCommandParams* params = aParams->AsCommandParams();
params->SetBool(STATE_MIXED, outMixed);
params->SetCString(STATE_ATTRIBUTE, tOutStateString);
return NS_OK;
}
nsresult
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
BackgroundColorStateCommand::SetState(HTMLEditor* aHTMLEditor,
const nsString& newState)
{
if (NS_WARN_IF(!aHTMLEditor)) {
return NS_ERROR_INVALID_ARG;
}
return aHTMLEditor->SetBackgroundColor(newState);
}
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
AlignCommand::AlignCommand()
: MultiStateCommandBase()
2000-05-02 01:37:38 +04:00
{
}
nsresult
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
AlignCommand::GetCurrentState(HTMLEditor* aHTMLEditor,
nsICommandParams* aParams)
{
if (NS_WARN_IF(!aHTMLEditor)) {
return NS_ERROR_INVALID_ARG;
}
nsIHTMLEditor::EAlignment firstAlign;
bool outMixed;
nsresult rv = aHTMLEditor->GetAlignment(&outMixed, &firstAlign);
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString outStateString;
switch (firstAlign) {
default:
case nsIHTMLEditor::eLeft:
outStateString.AssignLiteral("left");
break;
case nsIHTMLEditor::eCenter:
outStateString.AssignLiteral("center");
break;
case nsIHTMLEditor::eRight:
outStateString.AssignLiteral("right");
break;
case nsIHTMLEditor::eJustify:
outStateString.AssignLiteral("justify");
break;
}
nsAutoCString tOutStateString;
LossyCopyUTF16toASCII(outStateString, tOutStateString);
nsCommandParams* params = aParams->AsCommandParams();
params->SetBool(STATE_MIXED, outMixed);
params->SetCString(STATE_ATTRIBUTE, tOutStateString);
return NS_OK;
}
nsresult
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
AlignCommand::SetState(HTMLEditor* aHTMLEditor,
const nsString& newState)
{
if (NS_WARN_IF(!aHTMLEditor)) {
return NS_ERROR_INVALID_ARG;
}
return aHTMLEditor->Align(newState);
}
2000-05-02 01:37:38 +04:00
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
AbsolutePositioningCommand::AbsolutePositioningCommand()
: StateUpdatingCommandBase(nsGkAtoms::_empty)
{
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
AbsolutePositioningCommand::IsCommandEnabled(const char* aCommandName,
nsISupports* aCommandRefCon,
bool* outCmdEnabled)
{
*outCmdEnabled = false;
nsCOMPtr<nsIEditor> editor = do_QueryInterface(aCommandRefCon);
if (!editor) {
return NS_OK;
}
mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
if (!htmlEditor) {
return NS_OK;
}
if (!htmlEditor->IsSelectionEditable()) {
return NS_OK;
}
*outCmdEnabled = htmlEditor->AbsolutePositioningEnabled();
return NS_OK;
}
nsresult
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
AbsolutePositioningCommand::GetCurrentState(HTMLEditor* aHTMLEditor,
nsICommandParams* aParams)
{
if (NS_WARN_IF(!aHTMLEditor)) {
return NS_ERROR_INVALID_ARG;
}
nsCommandParams* params = aParams->AsCommandParams();
bool isEnabled = aHTMLEditor->AbsolutePositioningEnabled();
if (!isEnabled) {
params->SetBool(STATE_MIXED, false);
params->SetCString(STATE_ATTRIBUTE, EmptyCString());
return NS_OK;
}
RefPtr<Element> container =
aHTMLEditor->GetAbsolutelyPositionedSelectionContainer();
params->SetBool(STATE_MIXED, false);
params->SetCString(STATE_ATTRIBUTE,
container ? NS_LITERAL_CSTRING("absolute") :
EmptyCString());
return NS_OK;
}
nsresult
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
AbsolutePositioningCommand::ToggleState(HTMLEditor* aHTMLEditor)
{
if (NS_WARN_IF(!aHTMLEditor)) {
return NS_ERROR_INVALID_ARG;
}
RefPtr<Element> container =
aHTMLEditor->GetAbsolutelyPositionedSelectionContainer();
return aHTMLEditor->SetSelectionToAbsoluteOrStatic(!container);
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
DecreaseZIndexCommand::IsCommandEnabled(const char* aCommandName,
nsISupports* refCon,
bool* outCmdEnabled)
{
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (NS_WARN_IF(!editor)) {
return NS_ERROR_FAILURE;
}
mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
if (NS_WARN_IF(!htmlEditor)) {
return NS_ERROR_FAILURE;
}
*outCmdEnabled = htmlEditor->AbsolutePositioningEnabled();
if (!(*outCmdEnabled))
return NS_OK;
RefPtr<Element> positionedElement = htmlEditor->GetPositionedElement();
*outCmdEnabled = false;
if (!positionedElement) {
return NS_OK;
}
int32_t z = htmlEditor->GetZIndex(*positionedElement);
*outCmdEnabled = (z > 0);
return NS_OK;
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
DecreaseZIndexCommand::DoCommand(const char* aCommandName,
nsISupports* refCon)
{
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (NS_WARN_IF(!editor)) {
return NS_ERROR_FAILURE;
}
mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
if (NS_WARN_IF(!htmlEditor)) {
return NS_ERROR_FAILURE;
}
return htmlEditor->AddZIndex(-1);
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
DecreaseZIndexCommand::DoCommandParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* refCon)
{
return DoCommand(aCommandName, refCon);
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
DecreaseZIndexCommand::GetCommandStateParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* refCon)
{
NS_ENSURE_ARG_POINTER(aParams);
bool enabled = false;
nsresult rv = IsCommandEnabled(aCommandName, refCon, &enabled);
NS_ENSURE_SUCCESS(rv, rv);
return aParams->AsCommandParams()->SetBool(STATE_ENABLED, enabled);
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
IncreaseZIndexCommand::IsCommandEnabled(const char* aCommandName,
nsISupports* refCon,
bool* outCmdEnabled)
{
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (NS_WARN_IF(!editor)) {
return NS_ERROR_FAILURE;
}
mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
if (NS_WARN_IF(!htmlEditor)) {
return NS_ERROR_FAILURE;
}
*outCmdEnabled = htmlEditor->AbsolutePositioningEnabled();
if (!(*outCmdEnabled))
return NS_OK;
Element* positionedElement = htmlEditor->GetPositionedElement();
*outCmdEnabled = (nullptr != positionedElement);
return NS_OK;
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
IncreaseZIndexCommand::DoCommand(const char* aCommandName,
nsISupports* refCon)
{
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (NS_WARN_IF(!editor)) {
return NS_ERROR_FAILURE;
}
mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
if (NS_WARN_IF(!htmlEditor)) {
return NS_ERROR_FAILURE;
}
return htmlEditor->AddZIndex(1);
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
IncreaseZIndexCommand::DoCommandParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* refCon)
{
return DoCommand(aCommandName, refCon);
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
IncreaseZIndexCommand::GetCommandStateParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* refCon)
{
NS_ENSURE_ARG_POINTER(aParams);
bool enabled = false;
nsresult rv = IsCommandEnabled(aCommandName, refCon, &enabled);
NS_ENSURE_SUCCESS(rv, rv);
return aParams->AsCommandParams()->SetBool(STATE_ENABLED, enabled);
}
2000-05-02 01:37:38 +04:00
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
RemoveStylesCommand::IsCommandEnabled(const char* aCommandName,
nsISupports* refCon,
bool* outCmdEnabled)
2000-05-02 01:37:38 +04:00
{
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (!editor) {
*outCmdEnabled = false;
return NS_OK;
}
mozilla::EditorBase* editorBase = editor->AsEditorBase();
MOZ_ASSERT(editorBase);
// test if we have any styles?
*outCmdEnabled = editorBase->IsSelectionEditable();
return NS_OK;
2000-05-02 01:37:38 +04:00
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
RemoveStylesCommand::DoCommand(const char* aCommandName,
nsISupports* refCon)
2000-05-02 01:37:38 +04:00
{
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (!editor) {
return NS_OK;
2000-05-02 01:37:38 +04:00
}
mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
if (!htmlEditor) {
return NS_OK;
}
return htmlEditor->RemoveAllInlineProperties();
2000-05-02 01:37:38 +04:00
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
RemoveStylesCommand::DoCommandParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* refCon)
{
return DoCommand(aCommandName, refCon);
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
RemoveStylesCommand::GetCommandStateParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* refCon)
{
bool outCmdEnabled = false;
IsCommandEnabled(aCommandName, refCon, &outCmdEnabled);
return aParams->AsCommandParams()->SetBool(STATE_ENABLED, outCmdEnabled);
}
2000-05-02 01:37:38 +04:00
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
IncreaseFontSizeCommand::IsCommandEnabled(const char* aCommandName,
nsISupports* refCon,
bool* outCmdEnabled)
2000-05-02 01:37:38 +04:00
{
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (!editor) {
*outCmdEnabled = false;
return NS_OK;
}
mozilla::EditorBase* editorBase = editor->AsEditorBase();
MOZ_ASSERT(editorBase);
// test if we are at max size?
*outCmdEnabled = editorBase->IsSelectionEditable();
return NS_OK;
}
2000-05-02 01:37:38 +04:00
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
IncreaseFontSizeCommand::DoCommand(const char* aCommandName,
nsISupports* refCon)
2000-05-02 01:37:38 +04:00
{
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (!editor) {
return NS_OK;
2000-05-02 01:37:38 +04:00
}
mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
if (!htmlEditor) {
return NS_OK;
}
return htmlEditor->IncreaseFontSize();
2000-05-02 01:37:38 +04:00
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
IncreaseFontSizeCommand::DoCommandParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* refCon)
{
return DoCommand(aCommandName, refCon);
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
IncreaseFontSizeCommand::GetCommandStateParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* refCon)
{
bool outCmdEnabled = false;
IsCommandEnabled(aCommandName, refCon, &outCmdEnabled);
return aParams->AsCommandParams()->SetBool(STATE_ENABLED, outCmdEnabled);
}
2000-05-02 01:37:38 +04:00
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
DecreaseFontSizeCommand::IsCommandEnabled(const char* aCommandName,
nsISupports* refCon,
bool* outCmdEnabled)
2000-05-02 01:37:38 +04:00
{
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (!editor) {
*outCmdEnabled = false;
return NS_OK;
}
mozilla::EditorBase* editorBase = editor->AsEditorBase();
MOZ_ASSERT(editorBase);
// test if we are at min size?
*outCmdEnabled = editorBase->IsSelectionEditable();
return NS_OK;
2000-05-02 01:37:38 +04:00
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
DecreaseFontSizeCommand::DoCommand(const char* aCommandName,
nsISupports* refCon)
2000-05-02 01:37:38 +04:00
{
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (!editor) {
return NS_OK;
2000-05-02 01:37:38 +04:00
}
mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
if (!htmlEditor) {
return NS_OK;
}
return htmlEditor->DecreaseFontSize();
2000-05-02 01:37:38 +04:00
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
DecreaseFontSizeCommand::DoCommandParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* refCon)
{
return DoCommand(aCommandName, refCon);
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
DecreaseFontSizeCommand::GetCommandStateParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* refCon)
{
bool outCmdEnabled = false;
IsCommandEnabled(aCommandName, refCon, &outCmdEnabled);
return aParams->AsCommandParams()->SetBool(STATE_ENABLED, outCmdEnabled);
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
InsertHTMLCommand::IsCommandEnabled(const char* aCommandName,
nsISupports* refCon,
bool* outCmdEnabled)
{
NS_ENSURE_ARG_POINTER(outCmdEnabled);
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (!editor) {
*outCmdEnabled = false;
return NS_OK;
}
mozilla::EditorBase* editorBase = editor->AsEditorBase();
MOZ_ASSERT(editorBase);
*outCmdEnabled = editorBase->IsSelectionEditable();
return NS_OK;
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
InsertHTMLCommand::DoCommand(const char* aCommandName, nsISupports* refCon)
{
// If nsInsertHTMLCommand is called with no parameters, it was probably called with
// an empty string parameter ''. In this case, it should act the same as the delete command
NS_ENSURE_ARG_POINTER(refCon);
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (NS_WARN_IF(!editor)) {
return NS_ERROR_FAILURE;
}
mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
if (NS_WARN_IF(!htmlEditor)) {
return NS_ERROR_FAILURE;
}
nsAutoString html;
return htmlEditor->InsertHTML(html);
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
InsertHTMLCommand::DoCommandParams(const char* aCommandName,
nsICommandParams* aParams,
nsISupports* refCon)
{
NS_ENSURE_ARG_POINTER(aParams);
NS_ENSURE_ARG_POINTER(refCon);
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (NS_WARN_IF(!editor)) {
return NS_ERROR_FAILURE;
}
mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
if (NS_WARN_IF(!htmlEditor)) {
return NS_ERROR_FAILURE;
}
// Get HTML source string to insert from command params
nsAutoString html;
nsresult rv = aParams->AsCommandParams()->GetString(STATE_DATA, html);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
return htmlEditor->InsertHTML(html);
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
InsertHTMLCommand::GetCommandStateParams(const char *aCommandName,
nsICommandParams *aParams,
nsISupports *refCon)
{
NS_ENSURE_ARG_POINTER(aParams);
NS_ENSURE_ARG_POINTER(refCon);
bool outCmdEnabled = false;
IsCommandEnabled(aCommandName, refCon, &outCmdEnabled);
return aParams->AsCommandParams()->SetBool(STATE_ENABLED, outCmdEnabled);
}
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
InsertTagCommand::InsertTagCommand(nsAtom* aTagName)
: HTMLEditorCommandBase()
, mTagName(aTagName)
{
MOZ_ASSERT(mTagName);
}
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
InsertTagCommand::~InsertTagCommand()
{
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
InsertTagCommand::IsCommandEnabled(const char* aCommandName,
nsISupports* refCon,
bool* outCmdEnabled)
{
NS_ENSURE_ARG_POINTER(outCmdEnabled);
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (!editor) {
*outCmdEnabled = false;
return NS_OK;
}
mozilla::EditorBase* editorBase = editor->AsEditorBase();
MOZ_ASSERT(editorBase);
*outCmdEnabled = editorBase->IsSelectionEditable();
return NS_OK;
}
// corresponding STATE_ATTRIBUTE is: src (img) and href (a)
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
InsertTagCommand::DoCommand(const char* aCmdName, nsISupports* refCon)
{
NS_ENSURE_TRUE(mTagName == nsGkAtoms::hr, NS_ERROR_NOT_IMPLEMENTED);
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (NS_WARN_IF(!editor)) {
return NS_ERROR_FAILURE;
}
mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
if (NS_WARN_IF(!htmlEditor)) {
return NS_ERROR_FAILURE;
}
RefPtr<Element> newElement;
nsresult rv = htmlEditor->CreateElementWithDefaults(
nsDependentAtomString(mTagName), getter_AddRefs(newElement));
NS_ENSURE_SUCCESS(rv, rv);
return htmlEditor->InsertElementAtSelection(newElement, true);
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
InsertTagCommand::DoCommandParams(const char *aCommandName,
nsICommandParams *aParams,
nsISupports *refCon)
{
NS_ENSURE_ARG_POINTER(refCon);
// inserting an hr shouldn't have an parameters, just call DoCommand for that
if (mTagName == nsGkAtoms::hr) {
return DoCommand(aCommandName, refCon);
}
NS_ENSURE_ARG_POINTER(aParams);
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
if (NS_WARN_IF(!editor)) {
return NS_ERROR_FAILURE;
}
mozilla::HTMLEditor* htmlEditor = editor->AsHTMLEditor();
if (NS_WARN_IF(!htmlEditor)) {
return NS_ERROR_FAILURE;
}
// do we have an href to use for creating link?
nsAutoCString asciiAttribute;
nsresult rv =
aParams->AsCommandParams()->GetCString(STATE_ATTRIBUTE, asciiAttribute);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
nsAutoString attribute;
CopyASCIItoUTF16(asciiAttribute, attribute);
if (attribute.IsEmpty()) {
return NS_ERROR_INVALID_ARG;
}
// filter out tags we don't know how to insert
nsAutoString attributeType;
if (mTagName == nsGkAtoms::a) {
attributeType.AssignLiteral("href");
} else if (mTagName == nsGkAtoms::img) {
attributeType.AssignLiteral("src");
} else {
return NS_ERROR_NOT_IMPLEMENTED;
}
RefPtr<Element> elem;
rv = htmlEditor->CreateElementWithDefaults(nsDependentAtomString(mTagName),
getter_AddRefs(elem));
NS_ENSURE_SUCCESS(rv, rv);
ErrorResult err;
elem->SetAttribute(attributeType, attribute, err);
if (NS_WARN_IF(err.Failed())) {
return err.StealNSResult();
}
// do actual insertion
if (mTagName == nsGkAtoms::a) {
return htmlEditor->InsertLinkAroundSelection(elem);
}
return htmlEditor->InsertElementAtSelection(elem, true);
}
NS_IMETHODIMP
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
InsertTagCommand::GetCommandStateParams(const char *aCommandName,
nsICommandParams *aParams,
nsISupports *refCon)
{
NS_ENSURE_ARG_POINTER(aParams);
NS_ENSURE_ARG_POINTER(refCon);
bool outCmdEnabled = false;
IsCommandEnabled(aCommandName, refCon, &outCmdEnabled);
return aParams->AsCommandParams()->SetBool(STATE_ENABLED, outCmdEnabled);
}
/****************************/
//HELPER METHODS
/****************************/
static nsresult
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
GetListState(HTMLEditor* aHTMLEditor, bool* aMixed, nsAString& aLocalName)
{
MOZ_ASSERT(aHTMLEditor);
MOZ_ASSERT(aMixed);
*aMixed = false;
aLocalName.Truncate();
bool bOL, bUL, bDL;
nsresult rv = aHTMLEditor->GetListState(aMixed, &bOL, &bUL, &bDL);
NS_ENSURE_SUCCESS(rv, rv);
if (*aMixed) {
return NS_OK;
}
if (bOL) {
aLocalName.AssignLiteral("ol");
} else if (bUL) {
aLocalName.AssignLiteral("ul");
} else if (bDL) {
aLocalName.AssignLiteral("dl");
}
return NS_OK;
}
Bug 1468708 - Part 5. Rename nsComposer*Commands to HTMLEditor*Commands. r=masayuki Rename nsComposerCommands to mozilla::*Command Base class - nsBaseComposerCommand -> mozilla::HTMLEditorCommandBase - nsBaseStateUpdatingCommand -> mozilla::StateUpdatingCommandBase - nsMultiStateCommand -> mozilla::MultiStateCommandBase Command class (HTMLEditorCommands) - nsPasteNoFormattingCommand -> mozilla::PasteNoFormattingCommand - nsStyleUpdatingCommand -> mozilla::StyleUpdatingCommand - nsListCommand -> mozilla::ListCommand - nsListItemCommand -> mozilla::ListItemCommand - nsRemoveListCommand -> mozilla::RemoveListCommand - nsIndentCommand -> mozilla::IndentCommand - nsOutdentCommand -> mozilla::OutdentCommand - nsParagraphStateCommand -> mozilla::ParagraphStateCommand - nsFontFaceStateCommand -> mozilla::FontFaceStateCommand - nsFontSizeStateCommand -> mozilla::FontSizeStateCommand - nsFontColorStateCommand -> mozilla::FontColorStateCommand - nsHighlightColorStateCommand -> mozilla::HighlightColorStateCommand - nsBackgroundColorStateCommand -> mozilla::BackgroundColorStateCommand - nsAlignCommand -> mozilla::AlignCommand - nsAbsolutePositioningCommand -> mozilla::AbsolutePositioningCommand - nsDecreaseZIndexCommand -> mozilla::DecreaseZIndexCommand - nsIncreaseZIndexCommand -> mozilla::IncreaseZIndexCommand - nsRemoveStylesCommand -> mozilla::RemoveStylesCommand - nsIncreaseFontSizeCommand -> mozilla::IncreaseFontSizeCommand - nsDecreaseFontSizeCommand -> mozilla::DecreaseFontSizeCommand - nsInsertHTMLCommand -> mozilla::InsertHTMLCommand - nsInsertTagCommand -> mozilla::InsertTagCommand (HTMLEditorDocumentCommands) - nsSetDocumentOptionsCommand -> mozilla::SetDocumentOptionsCommand - nsSetDocumentStateCommand -> mozilla::SetDocumentStateCommand - nsDocumentStateCommand -> mozilla::DocumentStateCommand MozReview-Commit-ID: ImCLDU2JpXT --HG-- rename : editor/composer/nsComposerCommands.cpp => editor/composer/HTMLEditorCommands.cpp rename : editor/composer/nsComposerCommands.h => editor/composer/HTMLEditorCommands.h rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/HTMLEditorDocumentCommands.cpp extra : rebase_source : a9cf88e9efe9f00dc63cca4e3e4fa1f25df9de14
2018-06-15 19:13:31 +03:00
} // namespace mozilla