2001-09-26 02:53:13 +04:00
|
|
|
/* -*- 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/. */
|
1999-03-10 22:53:26 +03:00
|
|
|
|
|
|
|
#ifndef nsTextEditRules_h__
|
|
|
|
#define nsTextEditRules_h__
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
2012-07-13 10:33:42 +04:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
1999-08-09 05:37:50 +04:00
|
|
|
#include "nsEditRules.h"
|
2012-07-13 10:33:42 +04:00
|
|
|
#include "nsEditor.h"
|
|
|
|
#include "nsIEditor.h"
|
|
|
|
#include "nsISupportsImpl.h"
|
2009-11-02 18:37:25 +03:00
|
|
|
#include "nsITimer.h"
|
2012-07-13 10:33:42 +04:00
|
|
|
#include "nsPlaintextEditor.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nscore.h"
|
|
|
|
|
|
|
|
class nsIDOMElement;
|
|
|
|
class nsIDOMNode;
|
|
|
|
namespace mozilla {
|
2014-04-10 20:09:40 +04:00
|
|
|
namespace dom {
|
2012-07-13 10:33:42 +04:00
|
|
|
class Selection;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
1999-03-10 22:53:26 +03:00
|
|
|
|
|
|
|
/** Object that encapsulates HTML text-specific editing rules.
|
2015-05-28 18:58:42 +03:00
|
|
|
*
|
1999-03-10 22:53:26 +03:00
|
|
|
* To be a good citizen, edit rules must live by these restrictions:
|
2015-05-28 18:58:42 +03:00
|
|
|
* 1. All data manipulation is through the editor.
|
1999-03-10 22:53:26 +03:00
|
|
|
* Content nodes in the document tree must <B>not</B> be manipulated directly.
|
|
|
|
* Content nodes in document fragments that are not part of the document itself
|
|
|
|
* may be manipulated at will. Operations on document fragments must <B>not</B>
|
|
|
|
* go through the editor.
|
2015-05-28 18:58:42 +03:00
|
|
|
* 2. Selection must not be explicitly set by the rule method.
|
1999-03-10 22:53:26 +03:00
|
|
|
* Any manipulation of Selection must be done by the editor.
|
|
|
|
*/
|
2009-11-02 18:37:25 +03:00
|
|
|
class nsTextEditRules : public nsIEditRules, public nsITimerCallback
|
1999-03-10 22:53:26 +03:00
|
|
|
{
|
|
|
|
public:
|
2009-11-02 18:37:25 +03:00
|
|
|
NS_DECL_NSITIMERCALLBACK
|
2009-05-09 08:59:25 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2009-11-02 18:37:25 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsTextEditRules, nsIEditRules)
|
2014-06-24 02:40:02 +04:00
|
|
|
|
|
|
|
nsTextEditRules();
|
1999-03-10 22:53:26 +03:00
|
|
|
|
2000-03-24 03:26:47 +03:00
|
|
|
// nsIEditRules methods
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD Init(nsPlaintextEditor *aEditor) override;
|
|
|
|
NS_IMETHOD SetInitialValue(const nsAString& aValue) override;
|
|
|
|
NS_IMETHOD DetachEditor() override;
|
2012-08-12 22:28:26 +04:00
|
|
|
NS_IMETHOD BeforeEdit(EditAction action,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIEditor::EDirection aDirection) override;
|
2012-08-12 22:28:26 +04:00
|
|
|
NS_IMETHOD AfterEdit(EditAction action,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIEditor::EDirection aDirection) override;
|
2014-04-10 20:09:40 +04:00
|
|
|
NS_IMETHOD WillDoAction(mozilla::dom::Selection* aSelection,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsRulesInfo* aInfo, bool* aCancel, bool* aHandled) override;
|
2014-11-02 15:04:13 +03:00
|
|
|
NS_IMETHOD DidDoAction(mozilla::dom::Selection* aSelection,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsRulesInfo* aInfo, nsresult aResult) override;
|
|
|
|
NS_IMETHOD DocumentIsEmpty(bool *aDocumentIsEmpty) override;
|
|
|
|
NS_IMETHOD DocumentModified() override;
|
1999-04-05 21:21:59 +04:00
|
|
|
|
2014-06-24 02:40:02 +04:00
|
|
|
protected:
|
|
|
|
virtual ~nsTextEditRules();
|
|
|
|
|
2001-06-06 05:21:05 +04:00
|
|
|
public:
|
2012-06-01 15:03:17 +04:00
|
|
|
void ResetIMETextPWBuf();
|
2001-06-06 05:21:05 +04:00
|
|
|
|
2010-02-01 21:12:31 +03:00
|
|
|
/**
|
|
|
|
* Handles the newline characters either according to aNewLineHandling
|
|
|
|
* or to the default system prefs if aNewLineHandling is negative.
|
|
|
|
*
|
|
|
|
* @param aString the string to be modified in place.
|
|
|
|
* @param aNewLineHandling determine the desired type of newline handling:
|
|
|
|
* * negative values:
|
|
|
|
* handle newlines according to platform defaults.
|
|
|
|
* * nsIPlaintextEditor::eNewlinesReplaceWithSpaces:
|
|
|
|
* replace newlines with spaces.
|
|
|
|
* * nsIPlaintextEditor::eNewlinesStrip:
|
|
|
|
* remove newlines from the string.
|
|
|
|
* * nsIPlaintextEditor::eNewlinesReplaceWithCommas:
|
|
|
|
* replace newlines with commas.
|
|
|
|
* * nsIPlaintextEditor::eNewlinesStripSurroundingWhitespace:
|
|
|
|
* collapse newlines and surrounding whitespace characters and
|
|
|
|
* remove them from the string.
|
|
|
|
* * nsIPlaintextEditor::eNewlinesPasteIntact:
|
|
|
|
* only remove the leading and trailing newlines.
|
|
|
|
* * nsIPlaintextEditor::eNewlinesPasteToFirst or any other value:
|
|
|
|
* remove the first newline and all characters following it.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
static void HandleNewLines(nsString &aString, int32_t aNewLineHandling);
|
2010-02-01 21:12:31 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Prepare a string buffer for being displayed as the contents of a password
|
|
|
|
* field. This function uses the platform-specific character for representing
|
|
|
|
* characters entered into password fields.
|
|
|
|
*
|
|
|
|
* @param aOutString the output string. When this function returns,
|
|
|
|
* aOutString will contain aLength password characters.
|
|
|
|
* @param aLength the number of password characters that aOutString should
|
|
|
|
* contain.
|
|
|
|
*/
|
2012-08-22 19:56:38 +04:00
|
|
|
static void FillBufWithPWChars(nsAString *aOutString, int32_t aLength);
|
2010-02-01 21:12:31 +03:00
|
|
|
|
1999-04-05 21:21:59 +04:00
|
|
|
protected:
|
1999-03-10 22:53:26 +03:00
|
|
|
|
2014-05-10 01:02:29 +04:00
|
|
|
void InitFields();
|
|
|
|
|
1999-04-05 21:21:59 +04:00
|
|
|
// nsTextEditRules implementation methods
|
2012-08-12 22:28:26 +04:00
|
|
|
nsresult WillInsertText( EditAction aAction,
|
2014-04-10 20:09:40 +04:00
|
|
|
mozilla::dom::Selection* aSelection,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool *aCancel,
|
|
|
|
bool *aHandled,
|
2002-03-24 01:08:20 +03:00
|
|
|
const nsAString *inString,
|
|
|
|
nsAString *outString,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aMaxLength);
|
2014-11-02 15:04:13 +03:00
|
|
|
nsresult DidInsertText(mozilla::dom::Selection* aSelection,
|
|
|
|
nsresult aResult);
|
1999-11-13 03:26:45 +03:00
|
|
|
nsresult GetTopEnclosingPre(nsIDOMNode *aNode, nsIDOMNode** aOutPreNode);
|
1999-03-13 07:53:21 +03:00
|
|
|
|
2014-04-10 20:09:40 +04:00
|
|
|
nsresult WillInsertBreak(mozilla::dom::Selection* aSelection, bool* aCancel,
|
2012-08-22 19:56:38 +04:00
|
|
|
bool *aHandled, int32_t aMaxLength);
|
2014-11-02 15:04:13 +03:00
|
|
|
nsresult DidInsertBreak(mozilla::dom::Selection* aSelection,
|
|
|
|
nsresult aResult);
|
Preparation for ender-based text control
* added focus listener. Doesn't do much yet, but when focus notifications start appearing, we'll be ready for them. The code is in
place to hide selection when we lose focus and paint selection when we get focus. That's probably not quite right, but it's a start.
We will need to be able to determine the distinction between losing focus to another control within our app, and losing focus to
another app.
* added support for disabled and readonly states in the editor. This is accomplished by having flags set by the client, and letting the
rules system deal with those flags. The flags I added are:
TEXT_EDITOR_FLAG_PLAINTEXT 0x01 // only plain text editing is allowed
TEXT_EDITOR_FLAG_SINGLELINE 0x02 // enter key and CR-LF handled specially
TEXT_EDITOR_FLAG_PASSWORD 0x04 // text is not entered into content, only a representative character
TEXT_EDITOR_FLAG_READONLY 0x08 // editing events are disabled. Editor may still accept focus.
TEXT_EDITOR_FLAG_DISALBED 0x10 // all events are disabled (like scrolling). Editor will not accept focus.
* added WillInsertBreak/DidInsertBreak into text rules, so flags could be checked. This gets us readonly, disabled, and single line
behavior.
* cleaned up the code that allocates, registers, and destroys event listeners. Thanks to Kin and Simon for cleaning up the
ownership model on the listeners, it was a big help.
* added support for a max text length. You can now tell the text editor, be no bigger than n characters.
1999-05-29 01:24:18 +04:00
|
|
|
|
2014-11-02 15:04:13 +03:00
|
|
|
nsresult WillInsert(mozilla::dom::Selection* aSelection, bool* aCancel);
|
|
|
|
nsresult DidInsert(mozilla::dom::Selection* aSelection, nsresult aResult);
|
1999-03-13 07:53:21 +03:00
|
|
|
|
2014-04-10 20:09:40 +04:00
|
|
|
nsresult WillDeleteSelection(mozilla::dom::Selection* aSelection,
|
2015-05-28 18:58:42 +03:00
|
|
|
nsIEditor::EDirection aCollapsedAction,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool *aCancel,
|
|
|
|
bool *aHandled);
|
2014-11-02 15:04:13 +03:00
|
|
|
nsresult DidDeleteSelection(mozilla::dom::Selection* aSelection,
|
2015-05-28 18:58:42 +03:00
|
|
|
nsIEditor::EDirection aCollapsedAction,
|
1999-06-25 03:36:56 +04:00
|
|
|
nsresult aResult);
|
1999-03-12 05:28:24 +03:00
|
|
|
|
2014-11-02 15:04:13 +03:00
|
|
|
nsresult WillSetTextProperty(mozilla::dom::Selection* aSelection,
|
|
|
|
bool* aCancel, bool* aHandled);
|
|
|
|
nsresult DidSetTextProperty(mozilla::dom::Selection* aSelection,
|
|
|
|
nsresult aResult);
|
1999-06-08 10:04:51 +04:00
|
|
|
|
2014-11-02 15:04:13 +03:00
|
|
|
nsresult WillRemoveTextProperty(mozilla::dom::Selection* aSelection,
|
|
|
|
bool* aCancel, bool* aHandled);
|
|
|
|
nsresult DidRemoveTextProperty(mozilla::dom::Selection* aSelection,
|
|
|
|
nsresult aResult);
|
1999-06-08 10:04:51 +04:00
|
|
|
|
2014-11-02 15:04:13 +03:00
|
|
|
nsresult WillUndo(mozilla::dom::Selection* aSelection, bool* aCancel,
|
|
|
|
bool* aHandled);
|
|
|
|
nsresult DidUndo(mozilla::dom::Selection* aSelection, nsresult aResult);
|
1999-03-15 08:08:30 +03:00
|
|
|
|
2014-11-02 15:04:13 +03:00
|
|
|
nsresult WillRedo(mozilla::dom::Selection* aSelection, bool* aCancel,
|
|
|
|
bool* aHandled);
|
|
|
|
nsresult DidRedo(mozilla::dom::Selection* aSelection, nsresult aResult);
|
1999-03-15 08:08:30 +03:00
|
|
|
|
1999-09-09 23:39:36 +04:00
|
|
|
/** called prior to nsIEditor::OutputToString
|
|
|
|
* @param aSelection
|
|
|
|
* @param aInFormat the format requested for the output, a MIME type
|
|
|
|
* @param aOutText the string to use for output, if aCancel is set to true
|
2011-10-17 18:59:28 +04:00
|
|
|
* @param aOutCancel if set to true, the caller should cancel the operation
|
1999-09-09 23:39:36 +04:00
|
|
|
* and use aOutText as the result.
|
|
|
|
*/
|
2014-11-02 15:04:13 +03:00
|
|
|
nsresult WillOutputText(mozilla::dom::Selection* aSelection,
|
2002-03-24 01:08:20 +03:00
|
|
|
const nsAString *aInFormat,
|
2015-05-28 18:58:42 +03:00
|
|
|
nsAString *aOutText,
|
|
|
|
bool *aOutCancel,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool *aHandled);
|
1999-09-09 23:39:36 +04:00
|
|
|
|
2014-11-02 15:04:13 +03:00
|
|
|
nsresult DidOutputText(mozilla::dom::Selection* aSelection, nsresult aResult);
|
1999-06-25 03:36:56 +04:00
|
|
|
|
|
|
|
|
1999-03-29 12:02:05 +04:00
|
|
|
// helper functions
|
2011-08-12 23:53:10 +04:00
|
|
|
|
|
|
|
/** check for and replace a redundant trailing break */
|
|
|
|
nsresult RemoveRedundantTrailingBR();
|
2015-05-28 18:58:42 +03:00
|
|
|
|
2002-04-06 23:07:47 +04:00
|
|
|
/** creates a trailing break in the text doc if there is not one already */
|
2005-03-24 22:00:01 +03:00
|
|
|
nsresult CreateTrailingBRIfNeeded();
|
2015-05-28 18:58:42 +03:00
|
|
|
|
2002-04-06 23:07:47 +04:00
|
|
|
/** creates a bogus text node if the document has no editable content */
|
2014-11-02 15:04:13 +03:00
|
|
|
nsresult CreateBogusNodeIfNeeded(mozilla::dom::Selection* aSelection);
|
1999-06-25 03:36:56 +04:00
|
|
|
|
1999-08-24 12:56:51 +04:00
|
|
|
/** returns a truncated insertion string if insertion would place us
|
|
|
|
over aMaxLength */
|
2014-04-10 20:09:40 +04:00
|
|
|
nsresult TruncateInsertionIfNeeded(mozilla::dom::Selection* aSelection,
|
2002-03-24 01:08:20 +03:00
|
|
|
const nsAString *aInString,
|
|
|
|
nsAString *aOutString,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aMaxLength,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool *aTruncated);
|
1999-08-24 12:56:51 +04:00
|
|
|
|
2001-06-06 05:21:05 +04:00
|
|
|
/** Remove IME composition text from password buffer */
|
2012-08-22 19:56:38 +04:00
|
|
|
void RemoveIMETextFromPWBuf(int32_t &aStart, nsAString *aIMEString);
|
2001-06-06 05:21:05 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
nsresult CreateMozBR(nsIDOMNode* inParent, int32_t inOffset,
|
2012-07-30 18:20:58 +04:00
|
|
|
nsIDOMNode** outBRNode = nullptr);
|
1999-11-29 11:28:46 +03:00
|
|
|
|
2015-06-04 22:03:54 +03:00
|
|
|
void UndefineCaretBidiLevel(mozilla::dom::Selection* aSelection);
|
2015-06-01 22:19:57 +03:00
|
|
|
|
2014-11-02 15:04:13 +03:00
|
|
|
nsresult CheckBidiLevelForDeletion(mozilla::dom::Selection* aSelection,
|
2015-05-28 18:58:42 +03:00
|
|
|
nsIDOMNode *aSelNode,
|
|
|
|
int32_t aSelOffset,
|
2001-05-22 03:57:55 +04:00
|
|
|
nsIEditor::EDirection aAction,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool *aCancel);
|
2001-05-22 03:57:55 +04:00
|
|
|
|
2009-11-02 18:37:25 +03:00
|
|
|
nsresult HideLastPWInput();
|
|
|
|
|
2014-11-02 15:04:13 +03:00
|
|
|
nsresult CollapseSelectionToTrailingBRIfNeeded(mozilla::dom::Selection* aSelection);
|
2010-09-02 02:06:52 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsPasswordEditor() const
|
2010-04-12 06:35:18 +04:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
return mEditor ? mEditor->IsPasswordEditor() : false;
|
2010-04-12 06:35:18 +04:00
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsSingleLineEditor() const
|
2010-04-12 06:35:18 +04:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
return mEditor ? mEditor->IsSingleLineEditor() : false;
|
2010-04-12 06:35:18 +04:00
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsPlaintextEditor() const
|
2010-04-12 06:35:18 +04:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
return mEditor ? mEditor->IsPlaintextEditor() : false;
|
2010-04-12 06:35:18 +04:00
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsReadonly() const
|
2010-04-12 06:35:18 +04:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
return mEditor ? mEditor->IsReadonly() : false;
|
2010-04-12 06:35:18 +04:00
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsDisabled() const
|
2010-04-12 06:35:18 +04:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
return mEditor ? mEditor->IsDisabled() : false;
|
2010-04-12 06:35:18 +04:00
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
bool IsMailEditor() const
|
2010-04-12 06:35:18 +04:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
return mEditor ? mEditor->IsMailEditor() : false;
|
2010-04-12 06:35:18 +04:00
|
|
|
}
|
2011-09-29 10:19:26 +04:00
|
|
|
bool DontEchoPassword() const
|
2010-04-12 06:35:18 +04:00
|
|
|
{
|
2011-10-17 18:59:28 +04:00
|
|
|
return mEditor ? mEditor->DontEchoPassword() : false;
|
2010-04-12 06:35:18 +04:00
|
|
|
}
|
|
|
|
|
1999-12-07 11:30:19 +03:00
|
|
|
// data members
|
2001-01-28 23:13:07 +03:00
|
|
|
nsPlaintextEditor *mEditor; // note that we do not refcount the editor
|
|
|
|
nsString mPasswordText; // a buffer we use to store the real value of password editors
|
2001-06-06 05:21:05 +04:00
|
|
|
nsString mPasswordIMEText; // a buffer we use to track the IME composition string
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mPasswordIMEIndex;
|
2001-01-28 23:13:07 +03:00
|
|
|
nsCOMPtr<nsIDOMNode> mBogusNode; // magic node acts as placeholder in empty doc
|
2005-02-02 00:12:53 +03:00
|
|
|
nsCOMPtr<nsIDOMNode> mCachedSelectionNode; // cached selected node
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t mCachedSelectionOffset; // cached selected offset
|
|
|
|
uint32_t mActionNesting;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mLockRulesSniffing;
|
|
|
|
bool mDidExplicitlySetInterline;
|
|
|
|
bool mDeleteBidiImmediately; // in bidirectional text, delete
|
2015-05-28 18:58:42 +03:00
|
|
|
// characters not visually
|
2006-03-07 09:03:37 +03:00
|
|
|
// adjacent to the caret without
|
|
|
|
// moving the caret first.
|
2012-08-12 22:28:26 +04:00
|
|
|
EditAction mTheAction; // the top level editor action
|
2009-11-02 18:37:25 +03:00
|
|
|
nsCOMPtr<nsITimer> mTimer;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mLastStart, mLastLength;
|
2009-11-02 18:37:25 +03:00
|
|
|
|
1999-12-07 11:30:19 +03:00
|
|
|
// friends
|
|
|
|
friend class nsAutoLockRulesSniffing;
|
|
|
|
|
1999-03-10 22:53:26 +03:00
|
|
|
};
|
|
|
|
|
1999-04-12 16:01:32 +04:00
|
|
|
|
|
|
|
|
|
|
|
class nsTextRulesInfo : public nsRulesInfo
|
|
|
|
{
|
|
|
|
public:
|
2015-05-28 18:58:42 +03:00
|
|
|
|
2014-09-01 07:33:43 +04:00
|
|
|
explicit nsTextRulesInfo(EditAction aAction) :
|
1999-06-25 03:36:56 +04:00
|
|
|
nsRulesInfo(aAction),
|
|
|
|
inString(0),
|
|
|
|
outString(0),
|
1999-09-09 23:39:36 +04:00
|
|
|
outputFormat(0),
|
1999-06-25 03:36:56 +04:00
|
|
|
maxLength(-1),
|
1999-12-07 11:30:19 +03:00
|
|
|
collapsedAction(nsIEditor::eNext),
|
2012-05-10 18:54:33 +04:00
|
|
|
stripWrappers(nsIEditor::eStrip),
|
2011-10-17 18:59:28 +04:00
|
|
|
bOrdered(false),
|
|
|
|
entireList(false),
|
2001-12-12 06:57:32 +03:00
|
|
|
bulletType(0),
|
1999-08-10 02:51:40 +04:00
|
|
|
alignType(0),
|
1999-08-18 12:13:06 +04:00
|
|
|
blockType(0),
|
1999-08-10 02:51:40 +04:00
|
|
|
insertElement(0)
|
2007-04-23 18:21:53 +04:00
|
|
|
{}
|
1999-06-25 03:36:56 +04:00
|
|
|
|
2007-04-23 18:21:53 +04:00
|
|
|
virtual ~nsTextRulesInfo() {}
|
2015-05-28 18:58:42 +03:00
|
|
|
|
1999-06-16 09:02:43 +04:00
|
|
|
// kInsertText
|
2002-03-24 01:08:20 +03:00
|
|
|
const nsAString *inString;
|
|
|
|
nsAString *outString;
|
|
|
|
const nsAString *outputFormat;
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t maxLength;
|
2015-05-28 18:58:42 +03:00
|
|
|
|
1999-06-16 09:02:43 +04:00
|
|
|
// kDeleteSelection
|
1999-12-07 11:30:19 +03:00
|
|
|
nsIEditor::EDirection collapsedAction;
|
2012-05-10 18:54:33 +04:00
|
|
|
nsIEditor::EStripWrappers stripWrappers;
|
2015-05-28 18:58:42 +03:00
|
|
|
|
1999-06-16 09:02:43 +04:00
|
|
|
// kMakeList
|
2011-09-29 10:19:26 +04:00
|
|
|
bool bOrdered;
|
|
|
|
bool entireList;
|
2002-03-24 01:08:20 +03:00
|
|
|
const nsAString *bulletType;
|
2000-09-14 09:59:19 +04:00
|
|
|
|
1999-06-16 09:02:43 +04:00
|
|
|
// kAlign
|
2002-03-24 01:08:20 +03:00
|
|
|
const nsAString *alignType;
|
2015-05-28 18:58:42 +03:00
|
|
|
|
1999-08-18 12:13:06 +04:00
|
|
|
// kMakeBasicBlock
|
2002-03-24 01:08:20 +03:00
|
|
|
const nsAString *blockType;
|
2015-05-28 18:58:42 +03:00
|
|
|
|
1999-08-10 02:51:40 +04:00
|
|
|
// kInsertElement
|
|
|
|
const nsIDOMElement* insertElement;
|
1999-04-12 16:01:32 +04:00
|
|
|
};
|
|
|
|
|
1999-12-07 11:30:19 +03:00
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
* stack based helper class for StartOperation()/EndOperation() sandwich.
|
|
|
|
* this class sets a bool letting us know to ignore any rules sniffing
|
2015-05-28 18:58:42 +03:00
|
|
|
* that tries to occur reentrantly.
|
1999-12-07 11:30:19 +03:00
|
|
|
*/
|
|
|
|
class nsAutoLockRulesSniffing
|
|
|
|
{
|
|
|
|
public:
|
2015-05-28 18:58:42 +03:00
|
|
|
|
|
|
|
explicit nsAutoLockRulesSniffing(nsTextEditRules *rules) : mRules(rules)
|
2011-10-17 18:59:28 +04:00
|
|
|
{if (mRules) mRules->mLockRulesSniffing = true;}
|
2015-05-28 18:58:42 +03:00
|
|
|
~nsAutoLockRulesSniffing()
|
2011-10-17 18:59:28 +04:00
|
|
|
{if (mRules) mRules->mLockRulesSniffing = false;}
|
2015-05-28 18:58:42 +03:00
|
|
|
|
1999-12-07 11:30:19 +03:00
|
|
|
protected:
|
|
|
|
nsTextEditRules *mRules;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-03-24 03:26:47 +03:00
|
|
|
/***************************************************************************
|
|
|
|
* stack based helper class for turning on/off the edit listener.
|
|
|
|
*/
|
|
|
|
class nsAutoLockListener
|
|
|
|
{
|
|
|
|
public:
|
2015-05-28 18:58:42 +03:00
|
|
|
|
2014-09-01 07:33:43 +04:00
|
|
|
explicit nsAutoLockListener(bool *enabled) : mEnabled(enabled)
|
2011-10-17 18:59:28 +04:00
|
|
|
{if (mEnabled) { mOldState=*mEnabled; *mEnabled = false;}}
|
2015-05-28 18:58:42 +03:00
|
|
|
~nsAutoLockListener()
|
2000-03-24 03:26:47 +03:00
|
|
|
{if (mEnabled) *mEnabled = mOldState;}
|
2015-05-28 18:58:42 +03:00
|
|
|
|
2000-03-24 03:26:47 +03:00
|
|
|
protected:
|
2011-09-29 10:19:26 +04:00
|
|
|
bool *mEnabled;
|
|
|
|
bool mOldState;
|
2000-03-24 03:26:47 +03:00
|
|
|
};
|
|
|
|
|
1999-03-10 22:53:26 +03:00
|
|
|
#endif //nsTextEditRules_h__
|