gecko-dev/editor/base/nsHTMLEditRules.h

101 lines
3.4 KiB
C
Raw Normal View History

1999-03-29 06:21:01 +00:00
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsHTMLEditRules_h__
#define nsHTMLEditRules_h__
#include "nsTextEditRules.h"
1999-04-12 12:01:32 +00:00
#include "nsCOMPtr.h"
1999-04-12 14:10:24 +00:00
#include "nsIContent.h"
1999-03-29 06:21:01 +00:00
class nsHTMLEditRules : public nsTextEditRules
{
public:
nsHTMLEditRules();
virtual ~nsHTMLEditRules();
1999-04-05 17:21:59 +00:00
// nsEditRules methods
1999-04-12 12:01:32 +00:00
NS_IMETHOD WillDoAction(nsIDOMSelection *aSelection, nsRulesInfo *aInfo, PRBool *aCancel);
NS_IMETHOD DidDoAction(nsIDOMSelection *aSelection, nsRulesInfo *aInfo, nsresult aResult);
1999-04-05 17:21:59 +00:00
// nsHTMLEditRules action id's
enum
{
kInsertBreak = 3000
};
protected:
// nsHTMLEditRules implementation methods
1999-04-12 12:01:32 +00:00
nsresult WillInsertText(nsIDOMSelection *aSelection,
PRBool *aCancel,
PlaceholderTxn **aTxn,
const nsString *inString,
nsString *outString,
TypeInState typeInState);
nsresult DidInsertText(nsIDOMSelection *aSelection, nsresult aResult);
nsresult WillInsertBreak(nsIDOMSelection *aSelection, PRBool *aCancel);
nsresult DidInsertBreak(nsIDOMSelection *aSelection, nsresult aResult);
nsresult InsertTab(nsIDOMSelection *aSelection, PRBool *aCancel, PlaceholderTxn **aTxn, nsString *outString);
nsresult InsertSpace(nsIDOMSelection *aSelection, PRBool *aCancel, PlaceholderTxn **aTxn, nsString *outString);
// helper methods
1999-04-12 14:10:24 +00:00
PRBool IsBlockNode(nsCOMPtr <nsIContent> aContent);
1999-04-12 12:01:32 +00:00
nsCOMPtr<nsIContent> GetBlockNodeParent(nsCOMPtr<nsIContent> aContent);
nsresult GetStartNodeAndOffset(nsIDOMSelection *aSelection, nsCOMPtr<nsIDOMNode> *outStartNode, PRInt32 *outStartOffset);
1999-04-12 12:01:32 +00:00
nsresult IsPreformatted(nsCOMPtr<nsIDOMNode> aNode, PRBool *aResult);
nsresult IsNextCharWhitespace(nsCOMPtr<nsIDOMNode> aParentNode, PRInt32 aOffset, PRBool *aResult);
nsresult IsPrevCharWhitespace(nsCOMPtr<nsIDOMNode> aParentNode, PRInt32 aOffset, PRBool *aResult);
1999-03-29 06:21:01 +00:00
1999-04-12 12:01:32 +00:00
// data
static nsIAtom *sAAtom;
static nsIAtom *sAddressAtom;
static nsIAtom *sBigAtom;
static nsIAtom *sBlinkAtom;
static nsIAtom *sBAtom;
static nsIAtom *sCiteAtom;
static nsIAtom *sCodeAtom;
static nsIAtom *sDfnAtom;
static nsIAtom *sEmAtom;
static nsIAtom *sFontAtom;
static nsIAtom *sIAtom;
static nsIAtom *sKbdAtom;
static nsIAtom *sKeygenAtom;
static nsIAtom *sNobrAtom;
static nsIAtom *sSAtom;
static nsIAtom *sSampAtom;
static nsIAtom *sSmallAtom;
static nsIAtom *sSpacerAtom;
static nsIAtom *sSpanAtom;
static nsIAtom *sStrikeAtom;
static nsIAtom *sStrongAtom;
static nsIAtom *sSubAtom;
static nsIAtom *sSupAtom;
static nsIAtom *sTtAtom;
static nsIAtom *sUAtom;
static nsIAtom *sVarAtom;
static nsIAtom *sWbrAtom;
static PRInt32 sInstanceCount;
1999-03-29 06:21:01 +00:00
};
#endif //nsHTMLEditRules_h__