2001-09-26 02:53:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 18:21:17 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1999-03-29 10:21:01 +04:00
|
|
|
*
|
2004-04-18 18:21:17 +04: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-29 10:21:01 +04:00
|
|
|
*
|
2001-09-26 02:53:13 +04: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-29 10:21:01 +04:00
|
|
|
*
|
1999-11-06 06:43:54 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-18 18:21:17 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-26 02:53:13 +04:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:43:54 +03:00
|
|
|
*
|
2001-09-26 02:53:13 +04:00
|
|
|
* Contributor(s):
|
2002-01-09 16:51:37 +03:00
|
|
|
* Daniel Glazman <glazman@netscape.com>
|
2001-09-26 02:53:13 +04:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 18:21:17 +04: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-26 02:53:13 +04: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 18:21:17 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-26 02:53:13 +04: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 18:21:17 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-26 02:53:13 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1999-03-29 10:21:01 +04:00
|
|
|
|
|
|
|
#ifndef nsHTMLEditRules_h__
|
|
|
|
#define nsHTMLEditRules_h__
|
|
|
|
|
|
|
|
#include "nsTextEditRules.h"
|
2000-05-03 04:14:28 +04:00
|
|
|
#include "nsIHTMLEditRules.h"
|
1999-11-25 03:19:45 +03:00
|
|
|
#include "nsIEditActionListener.h"
|
2002-11-12 22:40:11 +03:00
|
|
|
#include "nsCOMArray.h"
|
1999-04-12 16:01:32 +04:00
|
|
|
#include "nsCOMPtr.h"
|
1999-11-25 03:19:45 +03:00
|
|
|
#include "nsString.h"
|
2002-08-29 11:49:31 +04:00
|
|
|
#include "nsEditorUtils.h"
|
2003-06-03 02:21:06 +04:00
|
|
|
#include "TypeInState.h"
|
2004-01-30 01:04:45 +03:00
|
|
|
#include "nsReadableUtils.h"
|
1999-03-29 10:21:01 +04:00
|
|
|
|
1999-07-01 17:42:03 +04:00
|
|
|
class nsVoidArray;
|
1999-11-25 03:19:45 +03:00
|
|
|
class nsIDOMElement;
|
2000-05-04 12:33:48 +04:00
|
|
|
class nsIEditor;
|
2001-01-28 23:13:07 +03:00
|
|
|
class nsHTMLEditor;
|
1999-06-16 09:02:43 +04:00
|
|
|
|
2003-06-03 02:21:06 +04:00
|
|
|
struct StyleCache : public PropItem
|
|
|
|
{
|
|
|
|
PRBool mPresent;
|
|
|
|
|
2007-12-12 06:23:34 +03:00
|
|
|
StyleCache() : PropItem(), mPresent(PR_FALSE) {
|
|
|
|
MOZ_COUNT_CTOR(StyleCache);
|
|
|
|
}
|
|
|
|
|
2003-06-03 02:21:06 +04:00
|
|
|
StyleCache(nsIAtom *aTag, const nsAString &aAttr, const nsAString &aValue) :
|
2007-12-12 06:23:34 +03:00
|
|
|
PropItem(aTag, aAttr, aValue), mPresent(PR_FALSE) {
|
|
|
|
MOZ_COUNT_CTOR(StyleCache);
|
|
|
|
}
|
|
|
|
|
|
|
|
~StyleCache() {
|
|
|
|
MOZ_COUNT_DTOR(StyleCache);
|
|
|
|
}
|
2003-06-03 02:21:06 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define SIZE_STYLE_TABLE 19
|
|
|
|
|
2000-09-13 17:50:30 +04:00
|
|
|
class nsHTMLEditRules : public nsIHTMLEditRules, public nsTextEditRules, public nsIEditActionListener
|
1999-03-29 10:21:01 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2000-03-24 03:26:47 +03:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
1999-08-09 22:39:49 +04:00
|
|
|
nsHTMLEditRules();
|
1999-08-09 05:37:50 +04:00
|
|
|
virtual ~nsHTMLEditRules();
|
1999-03-29 10:21:01 +04:00
|
|
|
|
2000-03-24 03:26:47 +03:00
|
|
|
|
|
|
|
// nsIEditRules methods
|
2001-01-28 23:13:07 +03:00
|
|
|
NS_IMETHOD Init(nsPlaintextEditor *aEditor, PRUint32 aFlags);
|
2000-03-24 03:26:47 +03:00
|
|
|
NS_IMETHOD BeforeEdit(PRInt32 action, nsIEditor::EDirection aDirection);
|
|
|
|
NS_IMETHOD AfterEdit(PRInt32 action, nsIEditor::EDirection aDirection);
|
2000-09-14 15:45:01 +04:00
|
|
|
NS_IMETHOD WillDoAction(nsISelection *aSelection, nsRulesInfo *aInfo, PRBool *aCancel, PRBool *aHandled);
|
|
|
|
NS_IMETHOD DidDoAction(nsISelection *aSelection, nsRulesInfo *aInfo, nsresult aResult);
|
1999-04-05 21:21:59 +04:00
|
|
|
|
2000-05-03 04:14:28 +04:00
|
|
|
// nsIHTMLEditRules methods
|
2001-04-07 04:45:26 +04:00
|
|
|
|
|
|
|
NS_IMETHOD GetListState(PRBool *aMixed, PRBool *aOL, PRBool *aUL, PRBool *aDL);
|
|
|
|
NS_IMETHOD GetListItemState(PRBool *aMixed, PRBool *aLI, PRBool *aDT, PRBool *aDD);
|
|
|
|
NS_IMETHOD GetIndentState(PRBool *aCanIndent, PRBool *aCanOutdent);
|
|
|
|
NS_IMETHOD GetAlignment(PRBool *aMixed, nsIHTMLEditor::EAlignment *aAlign);
|
2002-03-24 01:08:20 +03:00
|
|
|
NS_IMETHOD GetParagraphState(PRBool *aMixed, nsAString &outFormat);
|
2003-06-25 12:50:48 +04:00
|
|
|
NS_IMETHOD MakeSureElemStartsOrEndsOnCR(nsIDOMNode *aNode);
|
2000-05-03 04:14:28 +04:00
|
|
|
|
2000-03-24 03:26:47 +03:00
|
|
|
// nsIEditActionListener methods
|
|
|
|
|
2002-03-24 01:08:20 +03:00
|
|
|
NS_IMETHOD WillCreateNode(const nsAString& aTag, nsIDOMNode *aParent, PRInt32 aPosition);
|
|
|
|
NS_IMETHOD DidCreateNode(const nsAString& aTag, nsIDOMNode *aNode, nsIDOMNode *aParent, PRInt32 aPosition, nsresult aResult);
|
2000-03-24 03:26:47 +03:00
|
|
|
NS_IMETHOD WillInsertNode(nsIDOMNode *aNode, nsIDOMNode *aParent, PRInt32 aPosition);
|
|
|
|
NS_IMETHOD DidInsertNode(nsIDOMNode *aNode, nsIDOMNode *aParent, PRInt32 aPosition, nsresult aResult);
|
|
|
|
NS_IMETHOD WillDeleteNode(nsIDOMNode *aChild);
|
|
|
|
NS_IMETHOD DidDeleteNode(nsIDOMNode *aChild, nsresult aResult);
|
|
|
|
NS_IMETHOD WillSplitNode(nsIDOMNode *aExistingRightNode, PRInt32 aOffset);
|
|
|
|
NS_IMETHOD DidSplitNode(nsIDOMNode *aExistingRightNode, PRInt32 aOffset, nsIDOMNode *aNewLeftNode, nsresult aResult);
|
|
|
|
NS_IMETHOD WillJoinNodes(nsIDOMNode *aLeftNode, nsIDOMNode *aRightNode, nsIDOMNode *aParent);
|
|
|
|
NS_IMETHOD DidJoinNodes(nsIDOMNode *aLeftNode, nsIDOMNode *aRightNode, nsIDOMNode *aParent, nsresult aResult);
|
2002-03-24 01:08:20 +03:00
|
|
|
NS_IMETHOD WillInsertText(nsIDOMCharacterData *aTextNode, PRInt32 aOffset, const nsAString &aString);
|
|
|
|
NS_IMETHOD DidInsertText(nsIDOMCharacterData *aTextNode, PRInt32 aOffset, const nsAString &aString, nsresult aResult);
|
2000-03-24 03:26:47 +03:00
|
|
|
NS_IMETHOD WillDeleteText(nsIDOMCharacterData *aTextNode, PRInt32 aOffset, PRInt32 aLength);
|
|
|
|
NS_IMETHOD DidDeleteText(nsIDOMCharacterData *aTextNode, PRInt32 aOffset, PRInt32 aLength, nsresult aResult);
|
2001-05-11 16:43:22 +04:00
|
|
|
NS_IMETHOD WillDeleteRange(nsIDOMRange *aRange);
|
|
|
|
NS_IMETHOD DidDeleteRange(nsIDOMRange *aRange);
|
2000-09-14 15:45:01 +04:00
|
|
|
NS_IMETHOD WillDeleteSelection(nsISelection *aSelection);
|
|
|
|
NS_IMETHOD DidDeleteSelection(nsISelection *aSelection);
|
2000-03-24 03:26:47 +03:00
|
|
|
|
1999-04-05 21:21:59 +04:00
|
|
|
protected:
|
|
|
|
|
1999-06-16 09:02:43 +04:00
|
|
|
enum RulesEndpoint
|
|
|
|
{
|
|
|
|
kStart,
|
|
|
|
kEnd
|
|
|
|
};
|
|
|
|
|
2001-12-09 12:24:33 +03:00
|
|
|
enum BRLocation
|
|
|
|
{
|
|
|
|
kBeforeBlock,
|
|
|
|
kBlockEnd
|
|
|
|
};
|
|
|
|
|
1999-04-05 21:21:59 +04:00
|
|
|
// nsHTMLEditRules implementation methods
|
2000-09-14 15:45:01 +04:00
|
|
|
nsresult WillInsert(nsISelection *aSelection, PRBool *aCancel);
|
2002-01-14 23:31:47 +03:00
|
|
|
#ifdef XXX_DEAD_CODE
|
2000-09-14 15:45:01 +04:00
|
|
|
nsresult DidInsert(nsISelection *aSelection, nsresult aResult);
|
2002-01-14 23:31:47 +03:00
|
|
|
#endif
|
1999-11-01 18:15:35 +03:00
|
|
|
nsresult WillInsertText( PRInt32 aAction,
|
2000-09-14 15:45:01 +04:00
|
|
|
nsISelection *aSelection,
|
1999-11-01 18:15:35 +03:00
|
|
|
PRBool *aCancel,
|
|
|
|
PRBool *aHandled,
|
2002-03-24 01:08:20 +03:00
|
|
|
const nsAString *inString,
|
|
|
|
nsAString *outString,
|
1999-11-01 18:15:35 +03:00
|
|
|
PRInt32 aMaxLength);
|
2001-11-09 18:16:03 +03:00
|
|
|
nsresult WillLoadHTML(nsISelection *aSelection, PRBool *aCancel);
|
2000-09-14 15:45:01 +04:00
|
|
|
nsresult WillInsertBreak(nsISelection *aSelection, PRBool *aCancel, PRBool *aHandled);
|
2002-11-17 04:37:29 +03:00
|
|
|
nsresult StandardBreakImpl(nsIDOMNode *aNode, PRInt32 aOffset, nsISelection *aSelection);
|
2001-01-28 23:13:07 +03:00
|
|
|
nsresult DidInsertBreak(nsISelection *aSelection, nsresult aResult);
|
2002-06-12 18:12:32 +04:00
|
|
|
nsresult SplitMailCites(nsISelection *aSelection, PRBool aPlaintext, PRBool *aHandled);
|
2000-09-14 15:45:01 +04:00
|
|
|
nsresult WillDeleteSelection(nsISelection *aSelection, nsIEditor::EDirection aAction,
|
1999-10-06 23:34:09 +04:00
|
|
|
PRBool *aCancel, PRBool *aHandled);
|
2003-03-23 22:51:03 +03:00
|
|
|
nsresult DidDeleteSelection(nsISelection *aSelection,
|
|
|
|
nsIEditor::EDirection aDir,
|
|
|
|
nsresult aResult);
|
2003-03-23 23:22:15 +03:00
|
|
|
nsresult InsertBRIfNeeded(nsISelection *aSelection);
|
|
|
|
nsresult GetGoodSelPointForNode(nsIDOMNode *aNode, nsIEditor::EDirection aAction,
|
|
|
|
nsCOMPtr<nsIDOMNode> *outSelNode, PRInt32 *outSelOffset);
|
2002-08-29 11:49:31 +04:00
|
|
|
nsresult JoinBlocks(nsCOMPtr<nsIDOMNode> *aLeftBlock, nsCOMPtr<nsIDOMNode> *aRightBlock, PRBool *aCanceled);
|
|
|
|
nsresult MoveBlock(nsIDOMNode *aLeft, nsIDOMNode *aRight, PRInt32 aLeftOffset, PRInt32 aRightOffset);
|
2001-12-09 12:24:33 +03:00
|
|
|
nsresult MoveNodeSmart(nsIDOMNode *aSource, nsIDOMNode *aDest, PRInt32 *aOffset);
|
|
|
|
nsresult MoveContents(nsIDOMNode *aSource, nsIDOMNode *aDest, PRInt32 *aOffset);
|
2000-08-28 09:11:49 +04:00
|
|
|
nsresult DeleteNonTableElements(nsIDOMNode *aNode);
|
2002-03-24 01:08:20 +03:00
|
|
|
nsresult WillMakeList(nsISelection *aSelection, const nsAString *aListType, PRBool aEntireList, const nsAString *aBulletType, PRBool *aCancel, PRBool *aHandled, const nsAString *aItemType=nsnull);
|
2000-09-14 15:45:01 +04:00
|
|
|
nsresult WillRemoveList(nsISelection *aSelection, PRBool aOrderd, PRBool *aCancel, PRBool *aHandled);
|
|
|
|
nsresult WillIndent(nsISelection *aSelection, PRBool *aCancel, PRBool *aHandled);
|
2002-01-09 16:51:37 +03:00
|
|
|
nsresult WillCSSIndent(nsISelection *aSelection, PRBool *aCancel, PRBool *aHandled);
|
|
|
|
nsresult WillHTMLIndent(nsISelection *aSelection, PRBool *aCancel, PRBool *aHandled);
|
2000-09-14 15:45:01 +04:00
|
|
|
nsresult WillOutdent(nsISelection *aSelection, PRBool *aCancel, PRBool *aHandled);
|
2002-03-24 01:08:20 +03:00
|
|
|
nsresult WillAlign(nsISelection *aSelection, const nsAString *alignType, PRBool *aCancel, PRBool *aHandled);
|
2003-06-25 12:50:48 +04:00
|
|
|
nsresult WillAbsolutePosition(nsISelection *aSelection, PRBool *aCancel, PRBool * aHandled);
|
|
|
|
nsresult WillRemoveAbsolutePosition(nsISelection *aSelection, PRBool *aCancel, PRBool * aHandled);
|
|
|
|
nsresult WillRelativeChangeZIndex(nsISelection *aSelection, PRInt32 aChange, PRBool *aCancel, PRBool * aHandled);
|
2002-03-24 01:08:20 +03:00
|
|
|
nsresult WillMakeDefListItem(nsISelection *aSelection, const nsAString *aBlockType, PRBool aEntireList, PRBool *aCancel, PRBool *aHandled);
|
|
|
|
nsresult WillMakeBasicBlock(nsISelection *aSelection, const nsAString *aBlockType, PRBool *aCancel, PRBool *aHandled);
|
2000-09-14 15:45:01 +04:00
|
|
|
nsresult DidMakeBasicBlock(nsISelection *aSelection, nsRulesInfo *aInfo, nsresult aResult);
|
2003-06-25 12:50:48 +04:00
|
|
|
nsresult DidAbsolutePosition();
|
2002-03-24 01:08:20 +03:00
|
|
|
nsresult AlignInnerBlocks(nsIDOMNode *aNode, const nsAString *alignType);
|
|
|
|
nsresult AlignBlockContents(nsIDOMNode *aNode, const nsAString *alignType);
|
2002-11-12 22:40:11 +03:00
|
|
|
nsresult AppendInnerFormatNodes(nsCOMArray<nsIDOMNode>& aArray,
|
|
|
|
nsIDOMNode *aNode);
|
2002-04-14 09:57:14 +04:00
|
|
|
nsresult GetFormatString(nsIDOMNode *aNode, nsAString &outFormat);
|
2002-11-12 22:40:11 +03:00
|
|
|
nsresult GetInnerContent(nsIDOMNode *aNode, nsCOMArray<nsIDOMNode>& outArrayOfNodes, PRInt32 *aIndex, PRBool aList = PR_TRUE, PRBool aTble = PR_TRUE);
|
2001-11-22 22:35:11 +03:00
|
|
|
nsCOMPtr<nsIDOMNode> IsInListItem(nsIDOMNode *aNode);
|
2000-09-14 15:45:01 +04:00
|
|
|
nsresult ReturnInHeader(nsISelection *aSelection, nsIDOMNode *aHeader, nsIDOMNode *aTextNode, PRInt32 aOffset);
|
|
|
|
nsresult ReturnInParagraph(nsISelection *aSelection, nsIDOMNode *aHeader, nsIDOMNode *aTextNode, PRInt32 aOffset, PRBool *aCancel, PRBool *aHandled);
|
2002-02-19 14:52:50 +03:00
|
|
|
nsresult SplitParagraph(nsIDOMNode *aPara,
|
|
|
|
nsIDOMNode *aBRNode,
|
|
|
|
nsISelection *aSelection,
|
|
|
|
nsCOMPtr<nsIDOMNode> *aSelNode,
|
|
|
|
PRInt32 *aOffset);
|
2000-09-14 15:45:01 +04:00
|
|
|
nsresult ReturnInListItem(nsISelection *aSelection, nsIDOMNode *aHeader, nsIDOMNode *aTextNode, PRInt32 aOffset);
|
fixes:
14753, 29843, 39864, 40141,
40139, 36679, 39542, 34729,
34855, 37216, 39292, 26447
r=sfraser,cmanske,fm; a=beppe
2000-05-25 03:00:24 +04:00
|
|
|
nsresult AfterEditInner(PRInt32 action, nsIEditor::EDirection aDirection);
|
2001-12-12 09:02:15 +03:00
|
|
|
nsresult RemovePartOfBlock(nsIDOMNode *aBlock,
|
|
|
|
nsIDOMNode *aStartChild,
|
|
|
|
nsIDOMNode *aEndChild,
|
|
|
|
nsCOMPtr<nsIDOMNode> *aLeftNode = 0,
|
|
|
|
nsCOMPtr<nsIDOMNode> *aRightNode = 0);
|
2003-06-17 13:35:46 +04:00
|
|
|
nsresult SplitBlock(nsIDOMNode *aBlock,
|
|
|
|
nsIDOMNode *aStartChild,
|
|
|
|
nsIDOMNode *aEndChild,
|
|
|
|
nsCOMPtr<nsIDOMNode> *aLeftNode = 0,
|
|
|
|
nsCOMPtr<nsIDOMNode> *aRightNode = 0,
|
|
|
|
nsCOMPtr<nsIDOMNode> *aMiddleNode = 0);
|
|
|
|
nsresult OutdentPartOfBlock(nsIDOMNode *aBlock,
|
|
|
|
nsIDOMNode *aStartChild,
|
|
|
|
nsIDOMNode *aEndChild,
|
|
|
|
PRBool aIsBlockIndentedWithCSS,
|
|
|
|
nsCOMPtr<nsIDOMNode> *aLeftNode = 0,
|
|
|
|
nsCOMPtr<nsIDOMNode> *aRightNode = 0);
|
2002-03-24 01:08:20 +03:00
|
|
|
nsresult ConvertListType(nsIDOMNode *aList, nsCOMPtr<nsIDOMNode> *outList, const nsAString& aListType, const nsAString& aItemType);
|
2000-09-14 15:45:01 +04:00
|
|
|
nsresult CreateStyleForInsertText(nsISelection *aSelection, nsIDOMDocument *aDoc);
|
1999-11-01 18:15:35 +03:00
|
|
|
nsresult IsEmptyBlock(nsIDOMNode *aNode,
|
2000-01-26 03:57:37 +03:00
|
|
|
PRBool *outIsEmptyBlock,
|
|
|
|
PRBool aMozBRDoesntCount = PR_FALSE,
|
|
|
|
PRBool aListItemsNotEmpty = PR_FALSE);
|
2001-06-13 03:17:47 +04:00
|
|
|
nsresult CheckForEmptyBlock(nsIDOMNode *aStartNode,
|
|
|
|
nsIDOMNode *aBodyNode,
|
|
|
|
nsISelection *aSelection,
|
|
|
|
PRBool *aHandled);
|
2002-04-14 09:57:14 +04:00
|
|
|
nsresult CheckForInvisibleBR(nsIDOMNode *aBlock, nsHTMLEditRules::BRLocation aWhere,
|
2001-12-09 12:24:33 +03:00
|
|
|
nsCOMPtr<nsIDOMNode> *outBRNode, PRInt32 aOffset=0);
|
2002-08-23 22:14:30 +04:00
|
|
|
PRBool ExpandSelectionForDeletion(nsISelection *aSelection);
|
1999-07-01 22:42:28 +04:00
|
|
|
PRBool IsFirstNode(nsIDOMNode *aNode);
|
|
|
|
PRBool IsLastNode(nsIDOMNode *aNode);
|
2002-01-14 23:31:47 +03:00
|
|
|
#ifdef XXX_DEAD_CODE
|
1999-09-30 00:08:15 +04:00
|
|
|
PRBool AtStartOfBlock(nsIDOMNode *aNode, PRInt32 aOffset, nsIDOMNode *aBlock);
|
|
|
|
PRBool AtEndOfBlock(nsIDOMNode *aNode, PRInt32 aOffset, nsIDOMNode *aBlock);
|
2002-01-14 23:31:47 +03:00
|
|
|
#endif
|
2002-02-19 14:52:50 +03:00
|
|
|
nsresult NormalizeSelection(nsISelection *inSelection);
|
1999-07-01 22:42:28 +04:00
|
|
|
nsresult GetPromotedPoint(RulesEndpoint aWhere, nsIDOMNode *aNode, PRInt32 aOffset,
|
|
|
|
PRInt32 actionID, nsCOMPtr<nsIDOMNode> *outNode, PRInt32 *outOffset);
|
2000-09-14 15:45:01 +04:00
|
|
|
nsresult GetPromotedRanges(nsISelection *inSelection,
|
2002-11-12 22:40:11 +03:00
|
|
|
nsCOMArray<nsIDOMRange> &outArrayOfRanges,
|
1999-07-01 22:42:28 +04:00
|
|
|
PRInt32 inOperationType);
|
1999-11-25 03:19:45 +03:00
|
|
|
nsresult PromoteRange(nsIDOMRange *inRange, PRInt32 inOperationType);
|
2002-11-12 22:40:11 +03:00
|
|
|
nsresult GetNodesForOperation(nsCOMArray<nsIDOMRange>& inArrayOfRanges,
|
|
|
|
nsCOMArray<nsIDOMNode>& outArrayOfNodes,
|
fixes:
14753, 29843, 39864, 40141,
40139, 36679, 39542, 34729,
34855, 37216, 39292, 26447
r=sfraser,cmanske,fm; a=beppe
2000-05-25 03:00:24 +04:00
|
|
|
PRInt32 inOperationType,
|
|
|
|
PRBool aDontTouchContent=PR_FALSE);
|
1999-08-18 12:13:06 +04:00
|
|
|
nsresult GetChildNodesForOperation(nsIDOMNode *inNode,
|
2002-11-12 22:40:11 +03:00
|
|
|
nsCOMArray<nsIDOMNode>& outArrayOfNodes);
|
2002-08-29 11:49:31 +04:00
|
|
|
nsresult GetNodesFromPoint(DOMPoint point,
|
|
|
|
PRInt32 operation,
|
2002-11-12 22:40:11 +03:00
|
|
|
nsCOMArray<nsIDOMNode>& arrayOfNodes,
|
2002-08-29 11:49:31 +04:00
|
|
|
PRBool dontTouchContent);
|
2001-10-22 10:22:52 +04:00
|
|
|
nsresult GetNodesFromSelection(nsISelection *selection,
|
2002-11-12 22:40:11 +03:00
|
|
|
PRInt32 operation,
|
|
|
|
nsCOMArray<nsIDOMNode>& arrayOfNodes,
|
|
|
|
PRBool aDontTouchContent=PR_FALSE);
|
|
|
|
nsresult GetListActionNodes(nsCOMArray<nsIDOMNode> &outArrayOfNodes, PRBool aEntireList, PRBool aDontTouchContent=PR_FALSE);
|
2000-06-02 11:47:53 +04:00
|
|
|
nsresult GetDefinitionListItemTypes(nsIDOMNode *aNode, PRBool &aDT, PRBool &aDD);
|
2002-11-12 22:40:11 +03:00
|
|
|
nsresult GetParagraphFormatNodes(nsCOMArray<nsIDOMNode>& outArrayOfNodes, PRBool aDontTouchContent=PR_FALSE);
|
|
|
|
nsresult LookInsideDivBQandList(nsCOMArray<nsIDOMNode>& aNodeArray);
|
2000-08-26 08:03:50 +04:00
|
|
|
nsresult BustUpInlinesAtRangeEndpoints(nsRangeStore &inRange);
|
2000-04-24 15:51:12 +04:00
|
|
|
nsresult BustUpInlinesAtBRs(nsIDOMNode *inNode,
|
2002-11-12 22:40:11 +03:00
|
|
|
nsCOMArray<nsIDOMNode>& outArrayOfNodes);
|
2000-08-26 08:03:50 +04:00
|
|
|
nsCOMPtr<nsIDOMNode> GetHighestInlineParent(nsIDOMNode* aNode);
|
2002-11-12 22:40:11 +03:00
|
|
|
nsresult MakeTransitionList(nsCOMArray<nsIDOMNode>& inArrayOfNodes,
|
|
|
|
nsVoidArray &inTransitionArray);
|
|
|
|
nsresult RemoveBlockStyle(nsCOMArray<nsIDOMNode>& arrayOfNodes);
|
|
|
|
nsresult ApplyBlockStyle(nsCOMArray<nsIDOMNode>& arrayOfNodes, const nsAString *aBlockTag);
|
|
|
|
nsresult MakeBlockquote(nsCOMArray<nsIDOMNode>& arrayOfNodes);
|
2002-03-24 01:08:20 +03:00
|
|
|
nsresult SplitAsNeeded(const nsAString *aTag, nsCOMPtr<nsIDOMNode> *inOutParent, PRInt32 *inOutOffset);
|
2000-04-24 15:51:12 +04:00
|
|
|
nsresult AddTerminatingBR(nsIDOMNode *aBlock);
|
1999-09-02 01:23:47 +04:00
|
|
|
nsresult JoinNodesSmart( nsIDOMNode *aNodeLeft,
|
|
|
|
nsIDOMNode *aNodeRight,
|
|
|
|
nsCOMPtr<nsIDOMNode> *aOutMergeParent,
|
|
|
|
PRInt32 *aOutMergeOffset);
|
2001-01-28 23:13:07 +03:00
|
|
|
nsresult GetTopEnclosingMailCite(nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutCiteNode, PRBool aPlaintext);
|
1999-09-06 23:51:59 +04:00
|
|
|
nsresult PopListItem(nsIDOMNode *aListItem, PRBool *aOutOfList);
|
2001-06-15 17:57:01 +04:00
|
|
|
nsresult RemoveListStructure(nsIDOMNode *aList);
|
2003-06-03 02:21:06 +04:00
|
|
|
nsresult CacheInlineStyles(nsIDOMNode *aNode);
|
|
|
|
nsresult ReapplyCachedStyles();
|
|
|
|
nsresult ClearCachedStyles();
|
2000-07-27 05:03:16 +04:00
|
|
|
nsresult AdjustSpecialBreaks(PRBool aSafeToAskFrames = PR_FALSE);
|
2000-09-14 15:45:01 +04:00
|
|
|
nsresult AdjustWhitespace(nsISelection *aSelection);
|
2001-06-20 06:05:37 +04:00
|
|
|
nsresult PinSelectionToNewBlock(nsISelection *aSelection);
|
|
|
|
nsresult CheckInterlinePosition(nsISelection *aSelection);
|
2000-09-14 15:45:01 +04:00
|
|
|
nsresult AdjustSelection(nsISelection *aSelection, nsIEditor::EDirection aAction);
|
2000-01-17 15:41:34 +03:00
|
|
|
nsresult FindNearSelectableNode(nsIDOMNode *aSelNode,
|
|
|
|
PRInt32 aSelOffset,
|
2001-08-22 09:32:44 +04:00
|
|
|
nsIEditor::EDirection &aDirection,
|
2000-01-17 15:41:34 +03:00
|
|
|
nsCOMPtr<nsIDOMNode> *outSelectableNode);
|
2000-05-05 03:54:00 +04:00
|
|
|
nsresult InDifferentTableElements(nsIDOMNode *aNode1, nsIDOMNode *aNode2, PRBool *aResult);
|
1999-11-25 03:19:45 +03:00
|
|
|
nsresult RemoveEmptyNodes();
|
2000-02-25 07:39:30 +03:00
|
|
|
nsresult SelectionEndpointInNode(nsIDOMNode *aNode, PRBool *aResult);
|
1999-11-25 03:19:45 +03:00
|
|
|
nsresult UpdateDocChangeRange(nsIDOMRange *aRange);
|
2000-01-10 13:13:58 +03:00
|
|
|
nsresult ConfirmSelectionInBody();
|
2000-03-31 02:57:19 +04:00
|
|
|
nsresult InsertMozBRIfNeeded(nsIDOMNode *aNode);
|
2001-08-22 09:32:44 +04:00
|
|
|
PRBool IsEmptyInline(nsIDOMNode *aNode);
|
2002-11-12 22:40:11 +03:00
|
|
|
PRBool ListIsEmptyLine(nsCOMArray<nsIDOMNode> &arrayOfNodes);
|
2002-03-24 01:08:20 +03:00
|
|
|
nsresult RemoveAlignment(nsIDOMNode * aNode, const nsAString & aAlignType, PRBool aChildrenOnly);
|
2001-10-09 14:00:33 +04:00
|
|
|
nsresult MakeSureElemStartsOrEndsOnCR(nsIDOMNode *aNode, PRBool aStarts);
|
2002-03-24 01:08:20 +03:00
|
|
|
nsresult AlignBlock(nsIDOMElement * aElement, const nsAString * aAlignType, PRBool aContentsOnly);
|
2003-06-17 13:35:46 +04:00
|
|
|
nsresult RelativeChangeIndentationOfElementNode(nsIDOMNode *aNode, PRInt8 aRelativeChange);
|
1999-11-25 03:19:45 +03:00
|
|
|
|
|
|
|
// data members
|
|
|
|
protected:
|
2001-05-11 16:43:22 +04:00
|
|
|
nsHTMLEditor *mHTMLEditor;
|
|
|
|
nsCOMPtr<nsIDOMRange> mDocChangeRange;
|
2003-03-23 23:22:15 +03:00
|
|
|
PRPackedBool mListenerEnabled;
|
|
|
|
PRPackedBool mReturnInEmptyLIKillsList;
|
2003-06-03 02:21:06 +04:00
|
|
|
PRPackedBool mDidDeleteSelection;
|
2003-03-23 23:22:15 +03:00
|
|
|
PRPackedBool mDidRangedDelete;
|
2001-05-11 16:43:22 +04:00
|
|
|
nsCOMPtr<nsIDOMRange> mUtilRange;
|
|
|
|
PRUint32 mJoinOffset; // need to remember an int across willJoin/didJoin...
|
2001-06-20 06:05:37 +04:00
|
|
|
nsCOMPtr<nsIDOMNode> mNewBlock;
|
2002-11-17 04:25:30 +03:00
|
|
|
nsRangeStore mRangeItem;
|
2003-06-03 02:21:06 +04:00
|
|
|
StyleCache mCachedStyles[SIZE_STYLE_TABLE];
|
1999-11-25 03:19:45 +03:00
|
|
|
};
|
|
|
|
|
2000-03-24 03:26:47 +03:00
|
|
|
nsresult NS_NewHTMLEditRules(nsIEditRules** aInstancePtrResult);
|
1999-03-29 10:21:01 +04:00
|
|
|
|
|
|
|
#endif //nsHTMLEditRules_h__
|
|
|
|
|