2001-09-25 22:53:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 14:21:17 +00:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1999-03-10 19:53:26 +00:00
|
|
|
*
|
2004-04-18 14:21:17 +00:00
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
1999-03-10 19:53:26 +00:00
|
|
|
*
|
2001-09-25 22:53:13 +00:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1999-03-10 19:53:26 +00:00
|
|
|
*
|
1999-11-06 03:43:54 +00:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-18 14:21:17 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-25 22:53:13 +00:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 03:43:54 +00:00
|
|
|
*
|
2001-09-25 22:53:13 +00:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 14:21:17 +00:00
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
2001-09-25 22:53:13 +00:00
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
2004-04-18 14:21:17 +00:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-25 22:53:13 +00:00
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
2004-04-18 14:21:17 +00:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-25 22:53:13 +00:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1999-03-10 19:53:26 +00:00
|
|
|
|
|
|
|
#ifndef nsTextEditRules_h__
|
|
|
|
#define nsTextEditRules_h__
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
1999-08-09 01:37:50 +00:00
|
|
|
|
2001-01-28 20:13:07 +00:00
|
|
|
#include "nsPlaintextEditor.h"
|
1999-03-15 00:57:32 +00:00
|
|
|
#include "nsIDOMNode.h"
|
1999-08-09 01:37:50 +00:00
|
|
|
|
|
|
|
#include "nsEditRules.h"
|
1999-03-10 19:53:26 +00:00
|
|
|
|
|
|
|
/** Object that encapsulates HTML text-specific editing rules.
|
|
|
|
*
|
|
|
|
* To be a good citizen, edit rules must live by these restrictions:
|
|
|
|
* 1. All data manipulation is through the editor.
|
|
|
|
* 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.
|
|
|
|
* 2. Selection must not be explicitly set by the rule method.
|
|
|
|
* Any manipulation of Selection must be done by the editor.
|
|
|
|
*/
|
2000-03-24 00:26:47 +00:00
|
|
|
class nsTextEditRules : public nsIEditRules
|
1999-03-10 19:53:26 +00:00
|
|
|
{
|
|
|
|
public:
|
2000-03-24 00:26:47 +00:00
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
1999-08-09 18:39:49 +00:00
|
|
|
nsTextEditRules();
|
1999-08-09 01:37:50 +00:00
|
|
|
virtual ~nsTextEditRules();
|
1999-03-10 19:53:26 +00:00
|
|
|
|
2000-03-24 00:26:47 +00:00
|
|
|
// nsIEditRules methods
|
2001-01-28 20:13:07 +00:00
|
|
|
NS_IMETHOD Init(nsPlaintextEditor *aEditor, PRUint32 aFlags);
|
1999-12-07 08:30:19 +00:00
|
|
|
NS_IMETHOD BeforeEdit(PRInt32 action, nsIEditor::EDirection aDirection);
|
2000-03-24 00:26:47 +00:00
|
|
|
NS_IMETHOD AfterEdit(PRInt32 action, nsIEditor::EDirection aDirection);
|
2000-09-14 11:45:01 +00:00
|
|
|
NS_IMETHOD WillDoAction(nsISelection *aSelection, nsRulesInfo *aInfo, PRBool *aCancel, PRBool *aHandled);
|
|
|
|
NS_IMETHOD DidDoAction(nsISelection *aSelection, nsRulesInfo *aInfo, 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-28 21:24:18 +00:00
|
|
|
NS_IMETHOD GetFlags(PRUint32 *aFlags);
|
|
|
|
NS_IMETHOD SetFlags(PRUint32 aFlags);
|
1999-09-08 23:32:04 +00:00
|
|
|
NS_IMETHOD DocumentIsEmpty(PRBool *aDocumentIsEmpty);
|
1999-04-05 17:21:59 +00:00
|
|
|
|
|
|
|
// nsTextEditRules action id's
|
|
|
|
enum
|
|
|
|
{
|
1999-09-17 23:15:12 +00:00
|
|
|
kDefault = 0,
|
1999-06-03 06:01:08 +00:00
|
|
|
// any editor that has a txn mgr
|
1999-09-17 23:15:12 +00:00
|
|
|
kUndo = 1000,
|
|
|
|
kRedo = 1001,
|
1999-06-03 06:01:08 +00:00
|
|
|
// text actions
|
1999-09-17 23:15:12 +00:00
|
|
|
kInsertText = 2000,
|
|
|
|
kInsertTextIME = 2001,
|
|
|
|
kDeleteSelection = 2002,
|
|
|
|
kSetTextProperty = 2003,
|
|
|
|
kRemoveTextProperty = 2004,
|
|
|
|
kOutputText = 2005,
|
1999-06-03 06:01:08 +00:00
|
|
|
// html only action
|
1999-09-17 23:15:12 +00:00
|
|
|
kInsertBreak = 3000,
|
|
|
|
kMakeList = 3001,
|
|
|
|
kIndent = 3002,
|
|
|
|
kOutdent = 3003,
|
|
|
|
kAlign = 3004,
|
|
|
|
kMakeBasicBlock = 3005,
|
|
|
|
kRemoveList = 3006,
|
fixes:
14753, 29843, 39864, 40141,
40139, 36679, 39542, 34729,
34855, 37216, 39292, 26447
r=sfraser,cmanske,fm; a=beppe
2000-05-24 23:00:24 +00:00
|
|
|
kMakeDefListItem = 3007,
|
2001-11-09 15:16:03 +00:00
|
|
|
kInsertElement = 3008,
|
2003-06-25 08:50:48 +00:00
|
|
|
kLoadHTML = 3013,
|
|
|
|
kSetAbsolutePosition = 3015,
|
|
|
|
kRemoveAbsolutePosition = 3016,
|
|
|
|
kDecreaseZIndex = 3017,
|
|
|
|
kIncreaseZIndex = 3018
|
|
|
|
|
1999-04-05 17:21:59 +00:00
|
|
|
};
|
|
|
|
|
2001-06-06 01:21:05 +00:00
|
|
|
public:
|
|
|
|
nsresult ResetIMETextPWBuf();
|
|
|
|
|
1999-04-05 17:21:59 +00:00
|
|
|
protected:
|
1999-03-10 19:53:26 +00:00
|
|
|
|
1999-04-05 17:21:59 +00:00
|
|
|
// nsTextEditRules implementation methods
|
2000-02-07 01:42:14 +00:00
|
|
|
nsresult WillInsertText( PRInt32 aAction,
|
2000-09-14 11:45:01 +00:00
|
|
|
nsISelection *aSelection,
|
2000-02-07 01:42:14 +00:00
|
|
|
PRBool *aCancel,
|
|
|
|
PRBool *aHandled,
|
2002-03-23 22:08:20 +00:00
|
|
|
const nsAString *inString,
|
|
|
|
nsAString *outString,
|
2000-02-07 01:42:14 +00:00
|
|
|
PRInt32 aMaxLength);
|
2000-09-14 11:45:01 +00:00
|
|
|
nsresult DidInsertText(nsISelection *aSelection, nsresult aResult);
|
1999-11-13 00:26:45 +00:00
|
|
|
nsresult GetTopEnclosingPre(nsIDOMNode *aNode, nsIDOMNode** aOutPreNode);
|
1999-03-13 04:53:21 +00:00
|
|
|
|
2000-09-14 11:45:01 +00:00
|
|
|
nsresult WillInsertBreak(nsISelection *aSelection, PRBool *aCancel, PRBool *aHandled);
|
|
|
|
nsresult DidInsertBreak(nsISelection *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-28 21:24:18 +00:00
|
|
|
|
2000-09-14 11:45:01 +00:00
|
|
|
nsresult WillInsert(nsISelection *aSelection, PRBool *aCancel);
|
|
|
|
nsresult DidInsert(nsISelection *aSelection, nsresult aResult);
|
1999-03-13 04:53:21 +00:00
|
|
|
|
2000-09-14 11:45:01 +00:00
|
|
|
nsresult WillDeleteSelection(nsISelection *aSelection,
|
1999-12-07 08:30:19 +00:00
|
|
|
nsIEditor::EDirection aCollapsedAction,
|
1999-10-06 19:34:09 +00:00
|
|
|
PRBool *aCancel,
|
|
|
|
PRBool *aHandled);
|
2000-09-14 11:45:01 +00:00
|
|
|
nsresult DidDeleteSelection(nsISelection *aSelection,
|
1999-12-07 08:30:19 +00:00
|
|
|
nsIEditor::EDirection aCollapsedAction,
|
1999-06-24 23:36:56 +00:00
|
|
|
nsresult aResult);
|
1999-03-12 02:28:24 +00:00
|
|
|
|
2000-09-14 11:45:01 +00:00
|
|
|
nsresult WillSetTextProperty(nsISelection *aSelection, PRBool *aCancel, PRBool *aHandled);
|
|
|
|
nsresult DidSetTextProperty(nsISelection *aSelection, nsresult aResult);
|
1999-06-08 06:04:51 +00:00
|
|
|
|
2000-09-14 11:45:01 +00:00
|
|
|
nsresult WillRemoveTextProperty(nsISelection *aSelection, PRBool *aCancel, PRBool *aHandled);
|
|
|
|
nsresult DidRemoveTextProperty(nsISelection *aSelection, nsresult aResult);
|
1999-06-08 06:04:51 +00:00
|
|
|
|
2000-09-14 11:45:01 +00:00
|
|
|
nsresult WillUndo(nsISelection *aSelection, PRBool *aCancel, PRBool *aHandled);
|
|
|
|
nsresult DidUndo(nsISelection *aSelection, nsresult aResult);
|
1999-03-15 05:08:30 +00:00
|
|
|
|
2000-09-14 11:45:01 +00:00
|
|
|
nsresult WillRedo(nsISelection *aSelection, PRBool *aCancel, PRBool *aHandled);
|
|
|
|
nsresult DidRedo(nsISelection *aSelection, nsresult aResult);
|
1999-03-15 05:08:30 +00:00
|
|
|
|
1999-09-09 19:39:36 +00: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
|
|
|
|
* @param aOutCancel if set to PR_TRUE, the caller should cancel the operation
|
|
|
|
* and use aOutText as the result.
|
|
|
|
*/
|
2000-09-14 11:45:01 +00:00
|
|
|
nsresult WillOutputText(nsISelection *aSelection,
|
2002-03-23 22:08:20 +00:00
|
|
|
const nsAString *aInFormat,
|
|
|
|
nsAString *aOutText,
|
1999-10-06 19:34:09 +00:00
|
|
|
PRBool *aOutCancel,
|
|
|
|
PRBool *aHandled);
|
1999-09-09 19:39:36 +00:00
|
|
|
|
2000-09-14 11:45:01 +00:00
|
|
|
nsresult DidOutputText(nsISelection *aSelection, nsresult aResult);
|
1999-06-24 23:36:56 +00:00
|
|
|
|
|
|
|
|
1999-03-29 08:02:05 +00:00
|
|
|
// helper functions
|
|
|
|
|
2000-01-13 10:17:35 +00:00
|
|
|
/** replaces newllines with breaks, if needed. acts on doc portion in aRange */
|
|
|
|
nsresult ReplaceNewlines(nsIDOMRange *aRange);
|
|
|
|
|
2002-04-06 19:07:47 +00:00
|
|
|
/** creates a trailing break in the text doc if there is not one already */
|
2005-03-24 19:00:01 +00:00
|
|
|
nsresult CreateTrailingBRIfNeeded();
|
2002-04-06 19:07:47 +00:00
|
|
|
|
|
|
|
/** creates a bogus text node if the document has no editable content */
|
2000-09-14 11:45:01 +00:00
|
|
|
nsresult CreateBogusNodeIfNeeded(nsISelection *aSelection);
|
1999-06-24 23:36:56 +00:00
|
|
|
|
1999-08-24 08:56:51 +00:00
|
|
|
/** returns a truncated insertion string if insertion would place us
|
|
|
|
over aMaxLength */
|
2001-05-21 23:57:55 +00:00
|
|
|
nsresult TruncateInsertionIfNeeded(nsISelection *aSelection,
|
2002-03-23 22:08:20 +00:00
|
|
|
const nsAString *aInString,
|
|
|
|
nsAString *aOutString,
|
2001-05-21 23:57:55 +00:00
|
|
|
PRInt32 aMaxLength);
|
1999-08-24 08:56:51 +00:00
|
|
|
|
|
|
|
/** Echo's the insertion text into the password buffer, and converts
|
|
|
|
insertion text to '*'s */
|
2002-03-23 22:08:20 +00:00
|
|
|
nsresult EchoInsertionToPWBuff(PRInt32 aStart, PRInt32 aEnd, nsAString *aOutString);
|
1999-08-24 08:56:51 +00:00
|
|
|
|
2001-06-06 01:21:05 +00:00
|
|
|
/** Remove IME composition text from password buffer */
|
2005-10-17 00:54:02 +00:00
|
|
|
nsresult RemoveIMETextFromPWBuf(PRUint32 &aStart, nsAString *aIMEString);
|
2001-06-06 01:21:05 +00:00
|
|
|
|
1999-11-29 08:28:46 +00:00
|
|
|
nsresult CreateMozBR(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outBRNode);
|
|
|
|
|
2001-05-21 23:57:55 +00:00
|
|
|
nsresult CheckBidiLevelForDeletion(nsIDOMNode *aSelNode,
|
|
|
|
PRInt32 aSelOffset,
|
|
|
|
nsIEditor::EDirection aAction,
|
|
|
|
PRBool *aCancel);
|
|
|
|
|
2005-03-24 19:00:01 +00:00
|
|
|
nsIDOMNode *GetBody();
|
|
|
|
|
1999-12-07 08:30:19 +00:00
|
|
|
// data members
|
2001-01-28 20:13:07 +00: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 01:21:05 +00:00
|
|
|
nsString mPasswordIMEText; // a buffer we use to track the IME composition string
|
2005-10-17 00:54:02 +00:00
|
|
|
PRUint32 mPasswordIMEIndex;
|
2001-01-28 20:13:07 +00:00
|
|
|
nsCOMPtr<nsIDOMNode> mBogusNode; // magic node acts as placeholder in empty doc
|
|
|
|
nsCOMPtr<nsIDOMNode> mBody; // cached root node
|
2005-02-01 21:12:53 +00:00
|
|
|
nsCOMPtr<nsIDOMNode> mCachedSelectionNode; // cached selected node
|
|
|
|
PRInt32 mCachedSelectionOffset; // cached selected offset
|
2001-01-28 20:13:07 +00:00
|
|
|
PRUint32 mFlags;
|
|
|
|
PRUint32 mActionNesting;
|
2003-05-14 13:20:09 +00:00
|
|
|
PRPackedBool mLockRulesSniffing;
|
|
|
|
PRPackedBool mDidExplicitlySetInterline;
|
2001-01-28 20:13:07 +00:00
|
|
|
PRInt32 mTheAction; // the top level editor action
|
1999-12-07 08:30:19 +00:00
|
|
|
// friends
|
|
|
|
friend class nsAutoLockRulesSniffing;
|
|
|
|
|
1999-03-10 19:53:26 +00:00
|
|
|
};
|
|
|
|
|
1999-04-12 12:01:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
class nsTextRulesInfo : public nsRulesInfo
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
1999-06-24 23:36:56 +00:00
|
|
|
nsTextRulesInfo(int aAction) :
|
|
|
|
nsRulesInfo(aAction),
|
|
|
|
inString(0),
|
|
|
|
outString(0),
|
1999-09-09 19:39:36 +00:00
|
|
|
outputFormat(0),
|
1999-06-24 23:36:56 +00:00
|
|
|
maxLength(-1),
|
1999-12-07 08:30:19 +00:00
|
|
|
collapsedAction(nsIEditor::eNext),
|
2000-09-14 05:59:19 +00:00
|
|
|
bOrdered(PR_FALSE),
|
|
|
|
entireList(PR_FALSE),
|
2001-12-12 03:57:32 +00:00
|
|
|
bulletType(0),
|
1999-08-09 22:51:40 +00:00
|
|
|
alignType(0),
|
1999-08-18 08:13:06 +00:00
|
|
|
blockType(0),
|
1999-08-09 22:51:40 +00:00
|
|
|
insertElement(0)
|
1999-06-24 23:36:56 +00:00
|
|
|
{};
|
|
|
|
|
|
|
|
virtual ~nsTextRulesInfo() {};
|
1999-04-12 12:01:32 +00:00
|
|
|
|
1999-06-16 05:02:43 +00:00
|
|
|
// kInsertText
|
2002-03-23 22:08:20 +00:00
|
|
|
const nsAString *inString;
|
|
|
|
nsAString *outString;
|
|
|
|
const nsAString *outputFormat;
|
1999-06-08 06:04:51 +00:00
|
|
|
PRInt32 maxLength;
|
1999-04-26 14:08:52 +00:00
|
|
|
|
1999-06-16 05:02:43 +00:00
|
|
|
// kDeleteSelection
|
1999-12-07 08:30:19 +00:00
|
|
|
nsIEditor::EDirection collapsedAction;
|
1999-06-16 05:02:43 +00:00
|
|
|
|
|
|
|
// kMakeList
|
|
|
|
PRBool bOrdered;
|
2000-09-14 05:59:19 +00:00
|
|
|
PRBool entireList;
|
2002-03-23 22:08:20 +00:00
|
|
|
const nsAString *bulletType;
|
2000-09-14 05:59:19 +00:00
|
|
|
|
1999-06-16 05:02:43 +00:00
|
|
|
// kAlign
|
2002-03-23 22:08:20 +00:00
|
|
|
const nsAString *alignType;
|
1999-08-09 22:51:40 +00:00
|
|
|
|
1999-08-18 08:13:06 +00:00
|
|
|
// kMakeBasicBlock
|
2002-03-23 22:08:20 +00:00
|
|
|
const nsAString *blockType;
|
1999-08-18 08:13:06 +00:00
|
|
|
|
1999-08-09 22:51:40 +00:00
|
|
|
// kInsertElement
|
|
|
|
const nsIDOMElement* insertElement;
|
1999-04-12 12:01:32 +00:00
|
|
|
};
|
|
|
|
|
1999-12-07 08:30:19 +00:00
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
* stack based helper class for StartOperation()/EndOperation() sandwich.
|
|
|
|
* this class sets a bool letting us know to ignore any rules sniffing
|
|
|
|
* that tries to occur reentrantly.
|
|
|
|
*/
|
|
|
|
class nsAutoLockRulesSniffing
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
nsAutoLockRulesSniffing(nsTextEditRules *rules) : mRules(rules)
|
|
|
|
{if (mRules) mRules->mLockRulesSniffing = PR_TRUE;}
|
|
|
|
~nsAutoLockRulesSniffing()
|
|
|
|
{if (mRules) mRules->mLockRulesSniffing = PR_FALSE;}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
nsTextEditRules *mRules;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-03-24 00:26:47 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* stack based helper class for turning on/off the edit listener.
|
|
|
|
*/
|
|
|
|
class nsAutoLockListener
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2003-03-23 20:22:15 +00:00
|
|
|
nsAutoLockListener(PRPackedBool *enabled) : mEnabled(enabled)
|
2000-03-24 00:26:47 +00:00
|
|
|
{if (mEnabled) { mOldState=*mEnabled; *mEnabled = PR_FALSE;}}
|
|
|
|
~nsAutoLockListener()
|
|
|
|
{if (mEnabled) *mEnabled = mOldState;}
|
|
|
|
|
|
|
|
protected:
|
2003-03-23 20:22:15 +00:00
|
|
|
PRPackedBool *mEnabled;
|
|
|
|
PRPackedBool mOldState;
|
2000-03-24 00:26:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
nsresult NS_NewTextEditRules(nsIEditRules** aInstancePtrResult);
|
|
|
|
|
1999-03-10 19:53:26 +00:00
|
|
|
#endif //nsTextEditRules_h__
|
|
|
|
|