2001-09-26 02:53:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
1999-03-01 22:54:47 +03:00
|
|
|
*
|
2001-09-26 02:53:13 +04:00
|
|
|
* The contents of this file are subject to the Netscape 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/NPL/
|
1999-03-01 22:54:47 +03: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-01 22:54:47 +03:00
|
|
|
*
|
1999-11-06 06:43:54 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2001-09-26 02:53:13 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* 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>
|
2003-04-15 18:07:30 +04:00
|
|
|
* Kathleen Brade <brade@netscape.com>
|
2001-09-26 02:53:13 +04:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either 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"),
|
|
|
|
* 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
|
|
|
|
* use your version of this file under the terms of the NPL, indicate your
|
|
|
|
* 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
|
|
|
|
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1999-03-01 22:54:47 +03:00
|
|
|
|
|
|
|
#ifndef nsHTMLEditor_h__
|
|
|
|
#define nsHTMLEditor_h__
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
2002-11-12 22:40:11 +03:00
|
|
|
#include "nsCOMArray.h"
|
2001-01-28 23:13:07 +03:00
|
|
|
#include "nsPlaintextEditor.h"
|
|
|
|
#include "nsIEditor.h"
|
1999-08-09 05:37:50 +04:00
|
|
|
#include "nsIHTMLEditor.h"
|
|
|
|
#include "nsITableEditor.h"
|
|
|
|
#include "nsIEditorMailSupport.h"
|
|
|
|
#include "nsIEditorStyleSheets.h"
|
2003-03-25 18:24:08 +03:00
|
|
|
#include "nsIDocumentObserver.h"
|
1999-08-09 05:37:50 +04:00
|
|
|
|
|
|
|
#include "nsEditor.h"
|
|
|
|
#include "nsIDOMElement.h"
|
1999-03-01 22:54:47 +03:00
|
|
|
#include "nsIDOMEventListener.h"
|
1999-09-30 01:45:50 +04:00
|
|
|
#include "nsICSSLoader.h"
|
1999-12-04 04:29:18 +03:00
|
|
|
#include "nsICSSLoaderObserver.h"
|
1999-08-02 02:37:58 +04:00
|
|
|
#include "nsITableLayout.h"
|
2001-05-11 16:43:22 +04:00
|
|
|
#include "nsIRangeUtils.h"
|
1999-03-01 22:54:47 +03:00
|
|
|
|
1999-08-09 05:37:50 +04:00
|
|
|
#include "nsEditRules.h"
|
2001-04-06 03:48:01 +04:00
|
|
|
|
2003-04-17 09:42:33 +04:00
|
|
|
#include "nsEditProperty.h"
|
2002-01-09 16:51:37 +03:00
|
|
|
#include "nsHTMLCSSUtils.h"
|
2002-06-12 00:43:49 +04:00
|
|
|
#include "nsIParserService.h"
|
2002-01-09 16:51:37 +03:00
|
|
|
|
2002-09-13 23:47:38 +04:00
|
|
|
#include "nsVoidArray.h"
|
|
|
|
|
2003-02-24 12:37:18 +03:00
|
|
|
#include "nsHTMLObjectResizer.h"
|
|
|
|
|
|
|
|
#include "nsPoint.h"
|
|
|
|
|
1999-11-03 10:11:45 +03:00
|
|
|
class nsIDOMKeyEvent;
|
2000-04-25 18:14:48 +04:00
|
|
|
class nsITransferable;
|
2000-06-01 06:38:13 +04:00
|
|
|
class nsIDOMEventReceiver;
|
2000-12-07 02:11:21 +03:00
|
|
|
class nsIDOMNSRange;
|
2001-01-09 00:01:29 +03:00
|
|
|
class nsIDocumentEncoder;
|
2002-11-22 06:30:59 +03:00
|
|
|
class nsIClipboard;
|
2001-04-06 03:48:01 +04:00
|
|
|
class TypeInState;
|
2003-04-15 18:07:30 +04:00
|
|
|
class nsIContentFilter;
|
1999-11-03 10:11:45 +03:00
|
|
|
|
1999-03-01 22:54:47 +03:00
|
|
|
/**
|
|
|
|
* The HTML editor implementation.<br>
|
|
|
|
* Use to edit HTML document represented as a DOM tree.
|
|
|
|
*/
|
2001-01-28 23:13:07 +03:00
|
|
|
class nsHTMLEditor : public nsPlaintextEditor,
|
1999-08-09 05:37:50 +04:00
|
|
|
public nsIHTMLEditor,
|
2003-02-24 12:37:18 +03:00
|
|
|
public nsIHTMLObjectResizer,
|
1999-08-09 05:37:50 +04:00
|
|
|
public nsITableEditor,
|
1999-12-04 04:29:18 +03:00
|
|
|
public nsIEditorStyleSheets,
|
|
|
|
public nsICSSLoaderObserver
|
1999-03-01 22:54:47 +03:00
|
|
|
{
|
1999-08-09 05:37:50 +04:00
|
|
|
typedef enum {eNoOp, eReplaceParent=1, eInsertParent=2} BlockTransformationType;
|
1999-05-01 02:40:18 +04:00
|
|
|
|
1999-03-01 22:54:47 +03:00
|
|
|
public:
|
1999-12-07 11:30:19 +03:00
|
|
|
|
|
|
|
enum OperationID
|
|
|
|
{
|
|
|
|
kOpInsertBreak = 3000,
|
|
|
|
kOpMakeList = 3001,
|
|
|
|
kOpIndent = 3002,
|
|
|
|
kOpOutdent = 3003,
|
|
|
|
kOpAlign = 3004,
|
|
|
|
kOpMakeBasicBlock = 3005,
|
|
|
|
kOpRemoveList = 3006,
|
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
|
|
|
kOpMakeDefListItem = 3007,
|
2000-02-25 07:39:30 +03:00
|
|
|
kOpInsertElement = 3008,
|
2001-01-28 23:13:07 +03:00
|
|
|
kOpInsertQuotation = 3009,
|
|
|
|
kOpSetTextProperty = 3010,
|
|
|
|
kOpRemoveTextProperty = 3011,
|
2001-10-22 10:22:52 +04:00
|
|
|
kOpHTMLPaste = 3012,
|
2003-06-03 02:21:06 +04:00
|
|
|
kOpLoadHTML = 3013,
|
|
|
|
kOpResetTextProperties = 3014
|
1999-12-07 11:30:19 +03:00
|
|
|
};
|
|
|
|
|
2003-02-24 12:37:18 +03:00
|
|
|
enum ResizingRequestID
|
|
|
|
{
|
|
|
|
kX = 0,
|
|
|
|
kY = 1,
|
|
|
|
kWidth = 2,
|
|
|
|
kHeight = 3
|
|
|
|
};
|
1999-12-07 11:30:19 +03:00
|
|
|
|
1999-03-01 22:54:47 +03:00
|
|
|
// see nsIHTMLEditor for documentation
|
|
|
|
|
|
|
|
//Interfaces for addref and release and queryinterface
|
1999-03-06 00:05:35 +03:00
|
|
|
//NOTE macro used is for classes that inherit from
|
|
|
|
// another class. Only the base class should use NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
1999-03-01 22:54:47 +03:00
|
|
|
|
2000-02-08 04:11:13 +03:00
|
|
|
|
1999-08-09 05:37:50 +04:00
|
|
|
nsHTMLEditor();
|
|
|
|
virtual ~nsHTMLEditor();
|
1999-03-01 22:54:47 +03:00
|
|
|
|
2001-01-28 23:13:07 +03:00
|
|
|
/* ------------ nsPlaintextEditor overrides -------------- */
|
|
|
|
NS_IMETHODIMP HandleKeyPress(nsIDOMKeyEvent* aKeyEvent);
|
|
|
|
NS_IMETHODIMP CollapseSelectionToStart();
|
2002-09-18 23:42:38 +04:00
|
|
|
NS_IMETHOD GetIsDocumentEditable(PRBool *aIsDocumentEditable);
|
2002-10-09 02:53:55 +04:00
|
|
|
NS_IMETHODIMP BeginningOfDocument();
|
1999-03-01 22:54:47 +03:00
|
|
|
|
2003-02-24 12:37:18 +03:00
|
|
|
/* ------------ nsIHTMLObjectResizer methods -------------- */
|
|
|
|
NS_DECL_NSIHTMLOBJECTRESIZER
|
|
|
|
|
2000-11-17 03:25:31 +03:00
|
|
|
/* ------------ nsIHTMLEditor methods -------------- */
|
2002-11-27 03:35:09 +03:00
|
|
|
NS_IMETHOD UpdateBaseURL();
|
|
|
|
|
2002-03-11 16:11:48 +03:00
|
|
|
NS_IMETHOD CopyLastEditableChildStyles(nsIDOMNode *aPreviousBlock, nsIDOMNode *aNewBlock,
|
|
|
|
nsIDOMNode **aOutBrNode);
|
|
|
|
|
2002-03-15 01:11:14 +03:00
|
|
|
NS_IMETHOD ParseStyleAttrIntoCSSRule(const nsAString& aString,
|
|
|
|
nsIDOMCSSStyleRule **_retval);
|
2002-01-28 19:00:12 +03:00
|
|
|
|
2003-06-03 02:21:06 +04:00
|
|
|
NS_IMETHOD AddDefaultProperty(nsIAtom *aProperty,
|
|
|
|
const nsAString & aAttribute,
|
|
|
|
const nsAString & aValue);
|
|
|
|
|
|
|
|
NS_IMETHOD RemoveDefaultProperty(nsIAtom *aProperty,
|
|
|
|
const nsAString & aAttribute,
|
|
|
|
const nsAString & aValue);
|
|
|
|
|
|
|
|
NS_IMETHOD RemoveAllDefaultProperties();
|
|
|
|
|
2002-01-09 16:51:37 +03:00
|
|
|
NS_IMETHOD SetCSSInlineProperty(nsIAtom *aProperty,
|
2002-03-24 01:08:20 +03:00
|
|
|
const nsAString & aAttribute,
|
|
|
|
const nsAString & aValue);
|
2002-01-09 16:51:37 +03:00
|
|
|
|
1999-08-09 05:37:50 +04:00
|
|
|
NS_IMETHOD SetInlineProperty(nsIAtom *aProperty,
|
2002-03-24 01:08:20 +03:00
|
|
|
const nsAString & aAttribute,
|
|
|
|
const nsAString & aValue);
|
2001-04-07 04:45:26 +04:00
|
|
|
|
1999-08-09 05:37:50 +04:00
|
|
|
NS_IMETHOD GetInlineProperty(nsIAtom *aProperty,
|
2002-03-24 01:08:20 +03:00
|
|
|
const nsAString & aAttribute,
|
|
|
|
const nsAString & aValue,
|
2001-04-07 04:45:26 +04:00
|
|
|
PRBool *aFirst,
|
|
|
|
PRBool *aAny,
|
|
|
|
PRBool *aAll);
|
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
|
|
|
NS_IMETHOD GetInlinePropertyWithAttrValue(nsIAtom *aProperty,
|
2002-03-24 01:08:20 +03:00
|
|
|
const nsAString &aAttribute,
|
|
|
|
const nsAString &aValue,
|
2001-04-07 04:45:26 +04:00
|
|
|
PRBool *aFirst,
|
|
|
|
PRBool *aAny,
|
|
|
|
PRBool *aAll,
|
2002-03-24 01:08:20 +03:00
|
|
|
nsAString &outValue);
|
2000-04-14 01:50:19 +04:00
|
|
|
NS_IMETHOD RemoveAllInlineProperties();
|
2002-03-24 01:08:20 +03:00
|
|
|
NS_IMETHOD RemoveInlineProperty(nsIAtom *aProperty, const nsAString & aAttribute);
|
1999-11-13 19:37:58 +03:00
|
|
|
NS_IMETHOD IncreaseFontSize();
|
|
|
|
NS_IMETHOD DecreaseFontSize();
|
1999-08-09 05:37:50 +04:00
|
|
|
|
2002-10-06 05:23:18 +04:00
|
|
|
NS_IMETHOD PasteNoFormatting(PRInt32 aSelectionType);
|
2002-03-24 01:08:20 +03:00
|
|
|
NS_IMETHOD InsertHTML(const nsAString &aInputString);
|
2003-06-12 18:51:37 +04:00
|
|
|
NS_IMETHOD InsertHTMLWithContext(const nsAString & aInputString,
|
|
|
|
const nsAString & aContextStr,
|
|
|
|
const nsAString & aInfoStr,
|
|
|
|
const nsAString & aFlavor,
|
|
|
|
nsIDOMDocument *aSourceDoc,
|
|
|
|
nsIDOMNode *aDestinationNode,
|
|
|
|
PRInt32 aDestinationOffset,
|
|
|
|
PRBool aDeleteSelection);
|
2002-10-06 05:23:18 +04:00
|
|
|
|
2002-03-24 01:08:20 +03:00
|
|
|
NS_IMETHOD LoadHTML(const nsAString &aInputString);
|
|
|
|
NS_IMETHOD RebuildDocumentFromSource(const nsAString& aSourceString);
|
1999-10-14 04:13:27 +04:00
|
|
|
NS_IMETHOD InsertElementAtSelection(nsIDOMElement* aElement, PRBool aDeleteSelection);
|
1999-08-09 05:37:50 +04:00
|
|
|
|
|
|
|
NS_IMETHOD SelectElement(nsIDOMElement* aElement);
|
|
|
|
NS_IMETHOD SetCaretAfterElement(nsIDOMElement* aElement);
|
|
|
|
|
2002-03-24 01:08:20 +03:00
|
|
|
NS_IMETHOD SetParagraphFormat(const nsAString& aParagraphFormat);
|
1999-08-09 05:37:50 +04:00
|
|
|
|
1999-09-22 09:52:44 +04:00
|
|
|
NS_IMETHOD GetParentBlockTags(nsStringArray *aTagList, PRBool aGetLists);
|
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
|
|
|
|
2002-03-24 01:08:20 +03:00
|
|
|
NS_IMETHOD GetParagraphState(PRBool *aMixed, nsAString &outFormat);
|
|
|
|
NS_IMETHOD GetFontFaceState(PRBool *aMixed, nsAString &outFace);
|
|
|
|
NS_IMETHOD GetFontColorState(PRBool *aMixed, nsAString &outColor);
|
|
|
|
NS_IMETHOD GetCSSBackgroundColorState(PRBool *aMixed, nsAString &aOutColor, PRBool aBlockLevel);
|
|
|
|
NS_IMETHOD GetHTMLBackgroundColorState(PRBool *aMixed, nsAString &outColor);
|
|
|
|
NS_IMETHOD GetBackgroundColorState(PRBool *aMixed, nsAString &outColor);
|
|
|
|
NS_IMETHOD GetHighlightColorState(PRBool *aMixed, nsAString &outColor);
|
2002-01-09 16:51:37 +03:00
|
|
|
NS_IMETHOD GetHighlightColor(PRBool *mixed, PRUnichar **_retval);
|
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 GetAlignment(PRBool *aMixed, nsIHTMLEditor::EAlignment *aAlign);
|
|
|
|
NS_IMETHOD GetIndentState(PRBool *aCanIndent, PRBool *aCanOutdent);
|
1999-08-09 05:37:50 +04:00
|
|
|
|
2002-03-24 01:08:20 +03:00
|
|
|
NS_IMETHOD MakeOrChangeList(const nsAString& aListType, PRBool entireList, const nsAString& aBulletType);
|
|
|
|
NS_IMETHOD RemoveList(const nsAString& aListType);
|
|
|
|
NS_IMETHOD Indent(const nsAString& aIndent);
|
|
|
|
NS_IMETHOD Align(const nsAString& aAlign);
|
1999-08-09 05:37:50 +04:00
|
|
|
|
2002-03-24 01:08:20 +03:00
|
|
|
NS_IMETHOD GetElementOrParentByTagName(const nsAString& aTagName, nsIDOMNode *aNode, nsIDOMElement** aReturn);
|
|
|
|
NS_IMETHOD GetSelectedElement(const nsAString& aTagName, nsIDOMElement** aReturn);
|
|
|
|
NS_IMETHOD CreateElementWithDefaults(const nsAString& aTagName, nsIDOMElement** aReturn);
|
|
|
|
NS_IMETHOD GetNextElementByTagName(nsIDOMElement *aCurrentElement, const nsAString *aTagName, nsIDOMElement **aReturn);
|
2000-01-26 17:57:43 +03:00
|
|
|
|
1999-08-09 05:37:50 +04:00
|
|
|
|
|
|
|
NS_IMETHOD InsertLinkAroundSelection(nsIDOMElement* aAnchorElement);
|
|
|
|
|
2001-08-08 01:39:07 +04:00
|
|
|
NS_IMETHOD GetLinkedObjects(nsISupportsArray** aNodeList);
|
|
|
|
|
2002-03-15 01:11:14 +03:00
|
|
|
NS_IMETHOD SetIsCSSEnabled(PRBool aIsCSSPrefChecked);
|
|
|
|
NS_IMETHOD GetIsCSSEnabled(PRBool *aIsCSSEnabled);
|
2003-04-15 18:07:30 +04:00
|
|
|
NS_IMETHOD AddInsertionListener(nsIContentFilter *aFilter);
|
|
|
|
NS_IMETHOD RemoveInsertionListener(nsIContentFilter *aFilter);
|
2002-01-09 16:51:37 +03:00
|
|
|
|
1999-09-18 03:15:12 +04:00
|
|
|
/* ------------ nsIEditorIMESupport overrides -------------- */
|
|
|
|
|
2002-03-24 01:08:20 +03:00
|
|
|
NS_IMETHOD SetCompositionString(const nsAString& aCompositionString, nsIPrivateTextRangeList* aTextRangeList,nsTextEventReply* aReply);
|
2000-08-05 01:43:29 +04:00
|
|
|
NS_IMETHOD GetReconversionString(nsReconversionEventReply* aReply);
|
1999-08-09 05:37:50 +04:00
|
|
|
|
|
|
|
/* ------------ nsIEditorStyleSheets methods -------------- */
|
|
|
|
|
2002-09-13 23:47:38 +04:00
|
|
|
NS_IMETHOD AddStyleSheet(const nsAString & aURL);
|
|
|
|
NS_IMETHOD ReplaceStyleSheet(const nsAString& aURL);
|
|
|
|
NS_IMETHOD RemoveStyleSheet(const nsAString &aURL);
|
|
|
|
|
|
|
|
NS_IMETHOD AddOverrideStyleSheet(const nsAString & aURL);
|
|
|
|
NS_IMETHOD ReplaceOverrideStyleSheet(const nsAString& aURL);
|
|
|
|
NS_IMETHOD RemoveOverrideStyleSheet(const nsAString &aURL);
|
|
|
|
|
|
|
|
NS_IMETHOD EnableStyleSheet(const nsAString& aURL, PRBool aEnable);
|
1999-08-09 05:37:50 +04:00
|
|
|
|
|
|
|
/* ------------ nsIEditorMailSupport methods -------------- */
|
|
|
|
|
2000-04-15 03:38:21 +04:00
|
|
|
NS_IMETHOD PasteAsQuotation(PRInt32 aSelectionType);
|
2002-10-09 00:24:23 +04:00
|
|
|
NS_IMETHOD InsertTextWithQuotations(const nsAString & aQuotedText);
|
|
|
|
NS_IMETHOD InsertAsQuotation(const nsAString & aQuotedText,
|
|
|
|
nsIDOMNode **aNodeInserted);
|
2002-03-24 01:08:20 +03:00
|
|
|
NS_IMETHOD PasteAsCitedQuotation(const nsAString & aCitation,
|
2000-04-15 03:38:21 +04:00
|
|
|
PRInt32 aSelectionType);
|
2002-03-24 01:08:20 +03:00
|
|
|
NS_IMETHOD InsertAsCitedQuotation(const nsAString & aQuotedText,
|
|
|
|
const nsAString & aCitation,
|
2000-03-21 02:13:25 +03:00
|
|
|
PRBool aInsertHTML,
|
2000-01-04 23:38:12 +03:00
|
|
|
nsIDOMNode **aNodeInserted);
|
1999-08-09 05:37:50 +04:00
|
|
|
NS_IMETHOD GetEmbeddedObjects(nsISupportsArray** aNodeList);
|
|
|
|
|
|
|
|
/* ------------ nsITableEditor methods -------------- */
|
|
|
|
|
|
|
|
NS_IMETHOD InsertTableCell(PRInt32 aNumber, PRBool aAfter);
|
|
|
|
NS_IMETHOD InsertTableColumn(PRInt32 aNumber, PRBool aAfter);
|
|
|
|
NS_IMETHOD InsertTableRow(PRInt32 aNumber, PRBool aAfter);
|
|
|
|
NS_IMETHOD DeleteTable();
|
|
|
|
NS_IMETHOD DeleteTableCell(PRInt32 aNumber);
|
2000-01-14 02:33:00 +03:00
|
|
|
NS_IMETHOD DeleteTableCellContents();
|
1999-08-09 05:37:50 +04:00
|
|
|
NS_IMETHOD DeleteTableColumn(PRInt32 aNumber);
|
|
|
|
NS_IMETHOD DeleteTableRow(PRInt32 aNumber);
|
2000-02-10 08:14:52 +03:00
|
|
|
NS_IMETHOD SelectTableCell();
|
2000-03-17 02:45:41 +03:00
|
|
|
NS_IMETHOD SelectBlockOfCells(nsIDOMElement *aStartCell, nsIDOMElement *aEndCell);
|
2000-02-10 08:14:52 +03:00
|
|
|
NS_IMETHOD SelectTableRow();
|
|
|
|
NS_IMETHOD SelectTableColumn();
|
|
|
|
NS_IMETHOD SelectTable();
|
|
|
|
NS_IMETHOD SelectAllTableCells();
|
2000-06-14 08:58:29 +04:00
|
|
|
NS_IMETHOD SwitchTableCellHeaderType(nsIDOMElement *aSourceCell, nsIDOMElement **aNewCell);
|
2000-07-01 04:37:12 +04:00
|
|
|
NS_IMETHOD JoinTableCells(PRBool aMergeNonContiguousContents);
|
2000-05-05 02:32:24 +04:00
|
|
|
NS_IMETHOD SplitTableCell();
|
1999-08-09 05:37:50 +04:00
|
|
|
NS_IMETHOD NormalizeTable(nsIDOMElement *aTable);
|
2002-03-15 01:11:14 +03:00
|
|
|
NS_IMETHOD GetCellIndexes(nsIDOMElement *aCell,
|
|
|
|
PRInt32* aRowIndex, PRInt32* aColIndex);
|
|
|
|
NS_IMETHOD GetTableSize(nsIDOMElement *aTable,
|
|
|
|
PRInt32* aRowCount, PRInt32* aColCount);
|
2001-02-27 01:02:58 +03:00
|
|
|
NS_IMETHOD GetCellAt(nsIDOMElement* aTable, PRInt32 aRowIndex, PRInt32 aColIndex, nsIDOMElement **aCell);
|
2002-03-15 01:11:14 +03:00
|
|
|
NS_IMETHOD GetCellDataAt(nsIDOMElement* aTable,
|
|
|
|
PRInt32 aRowIndex, PRInt32 aColIndex,
|
|
|
|
nsIDOMElement **aCell,
|
|
|
|
PRInt32* aStartRowIndex, PRInt32* aStartColIndex,
|
|
|
|
PRInt32* aRowSpan, PRInt32* aColSpan,
|
|
|
|
PRInt32* aActualRowSpan, PRInt32* aActualColSpan,
|
|
|
|
PRBool* aIsSelected);
|
2001-02-27 01:02:58 +03:00
|
|
|
NS_IMETHOD GetFirstRow(nsIDOMElement* aTableElement, nsIDOMNode** aRowNode);
|
|
|
|
NS_IMETHOD GetNextRow(nsIDOMNode* aCurrentRowNode, nsIDOMNode** aRowNode);
|
|
|
|
NS_IMETHOD GetFirstCellInRow(nsIDOMNode* aRowNode, nsIDOMNode** aCellNode);
|
|
|
|
NS_IMETHOD GetNextCellInRow(nsIDOMNode* aCurrentCellNode, nsIDOMNode** aRowNode);
|
|
|
|
NS_IMETHOD GetLastCellInRow(nsIDOMNode* aRowNode, nsIDOMNode** aCellNode);
|
|
|
|
|
2000-05-15 07:06:29 +04:00
|
|
|
NS_IMETHOD SetSelectionAfterTableEdit(nsIDOMElement* aTable, PRInt32 aRow, PRInt32 aCol,
|
|
|
|
PRInt32 aDirection, PRBool aSelected);
|
2002-09-13 08:19:30 +04:00
|
|
|
NS_IMETHOD GetSelectedOrParentTableElement(nsAString& aTagName,
|
|
|
|
PRInt32 *aSelectedCount,
|
|
|
|
nsIDOMElement** aTableElement);
|
2002-03-15 01:11:14 +03:00
|
|
|
NS_IMETHOD GetSelectedCellsType(nsIDOMElement *aElement, PRUint32 *aSelectionType);
|
2000-07-01 04:37:12 +04:00
|
|
|
|
|
|
|
nsresult GetCellFromRange(nsIDOMRange *aRange, nsIDOMElement **aCell);
|
|
|
|
|
2000-03-21 09:05:24 +03:00
|
|
|
// Finds the first selected cell in first range of selection
|
|
|
|
// This is in the *order of selection*, not order in the table
|
|
|
|
// (i.e., each cell added to selection is added in another range
|
|
|
|
// in the selection's rangelist, independent of location in table)
|
2000-03-31 08:18:29 +04:00
|
|
|
// aRange is optional: returns the range around the cell
|
2002-09-13 08:19:30 +04:00
|
|
|
NS_IMETHOD GetFirstSelectedCell(nsIDOMRange **aRange, nsIDOMElement **aCell);
|
2000-03-21 09:05:24 +03:00
|
|
|
// Get next cell until no more are found. Always use GetFirstSelected cell first
|
2000-03-31 08:18:29 +04:00
|
|
|
// aRange is optional: returns the range around the cell
|
2002-09-13 08:19:30 +04:00
|
|
|
NS_IMETHOD GetNextSelectedCell(nsIDOMRange **aRange, nsIDOMElement **aCell);
|
1999-03-01 22:54:47 +03:00
|
|
|
|
2000-05-15 07:06:29 +04:00
|
|
|
// Upper-left-most selected cell in table
|
2002-09-13 08:19:30 +04:00
|
|
|
NS_IMETHOD GetFirstSelectedCellInTable(PRInt32 *aRowIndex, PRInt32 *aColIndex, nsIDOMElement **aCell);
|
2000-03-21 09:05:24 +03:00
|
|
|
|
1999-08-09 05:37:50 +04:00
|
|
|
/* miscellaneous */
|
|
|
|
// This sets background on the appropriate container element (table, cell,)
|
|
|
|
// or calls into nsTextEditor to set the page background
|
2002-03-24 01:08:20 +03:00
|
|
|
NS_IMETHOD SetCSSBackgroundColor(const nsAString& aColor);
|
|
|
|
NS_IMETHOD SetHTMLBackgroundColor(const nsAString& aColor);
|
|
|
|
NS_IMETHOD SetBackgroundColor(const nsAString& aColor);
|
|
|
|
NS_IMETHOD SetBodyAttribute(const nsAString& aAttr, const nsAString& aValue);
|
2001-02-27 01:02:58 +03:00
|
|
|
// aTitle may be null or empty string to remove child contents of <title>
|
2001-04-07 04:45:26 +04:00
|
|
|
|
2002-03-24 01:08:20 +03:00
|
|
|
NS_IMETHOD SetDocumentTitle(const nsAString &aTitle);
|
1999-08-09 05:37:50 +04:00
|
|
|
|
2001-04-06 03:48:01 +04:00
|
|
|
/* ------------ Block methods moved from nsEditor -------------- */
|
|
|
|
static nsCOMPtr<nsIDOMNode> GetBlockNodeParent(nsIDOMNode *aNode);
|
|
|
|
static PRBool HasSameBlockNodeParent(nsIDOMNode *aNode1, nsIDOMNode *aNode2);
|
|
|
|
/** Determines the bounding nodes for the block section containing aNode.
|
|
|
|
* The calculation is based on some nodes intrinsically being block elements
|
|
|
|
* acording to HTML. Style sheets are not considered in this calculation.
|
|
|
|
* <BR> tags separate block content sections. So the HTML markup:
|
|
|
|
* <PRE>
|
|
|
|
* <P>text1<BR>text2<B>text3</B></P>
|
|
|
|
* </PRE>
|
|
|
|
* contains two block content sections. The first has the text node "text1"
|
|
|
|
* for both endpoints. The second has "text2" as the left endpoint and
|
|
|
|
* "text3" as the right endpoint.
|
|
|
|
* Notice that offsets aren't required, only leaf nodes. Offsets are implicit.
|
|
|
|
*
|
|
|
|
* @param aNode the block content returned includes aNode
|
|
|
|
* @param aLeftNode [OUT] the left endpoint of the block content containing aNode
|
|
|
|
* @param aRightNode [OUT] the right endpoint of the block content containing aNode
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static nsresult GetBlockSection(nsIDOMNode *aNode,
|
|
|
|
nsIDOMNode **aLeftNode,
|
|
|
|
nsIDOMNode **aRightNode);
|
|
|
|
|
|
|
|
/** Compute the set of block sections in a given range.
|
|
|
|
* A block section is the set of (leftNode, rightNode) pairs given
|
|
|
|
* by GetBlockSection. The set is computed by computing the
|
|
|
|
* block section for every leaf node in the range and throwing
|
|
|
|
* out duplicates.
|
|
|
|
*
|
|
|
|
* @param aRange The range to compute block sections for.
|
|
|
|
* @param aSections Allocated storage for the resulting set, stored as nsIDOMRanges.
|
|
|
|
*/
|
|
|
|
static nsresult GetBlockSectionsForRange(nsIDOMRange *aRange,
|
2002-11-12 22:40:11 +03:00
|
|
|
nsCOMArray<nsIDOMRange>& aSections);
|
2001-04-06 03:48:01 +04:00
|
|
|
|
|
|
|
static nsCOMPtr<nsIDOMNode> NextNodeInBlock(nsIDOMNode *aNode, IterDirection aDir);
|
|
|
|
nsresult IsNextCharWhitespace(nsIDOMNode *aParentNode,
|
|
|
|
PRInt32 aOffset,
|
|
|
|
PRBool *outIsSpace,
|
|
|
|
PRBool *outIsNBSP,
|
|
|
|
nsCOMPtr<nsIDOMNode> *outNode = 0,
|
|
|
|
PRInt32 *outOffset = 0);
|
|
|
|
nsresult IsPrevCharWhitespace(nsIDOMNode *aParentNode,
|
|
|
|
PRInt32 aOffset,
|
|
|
|
PRBool *outIsSpace,
|
|
|
|
PRBool *outIsNBSP,
|
|
|
|
nsCOMPtr<nsIDOMNode> *outNode = 0,
|
|
|
|
PRInt32 *outOffset = 0);
|
|
|
|
|
1999-08-09 05:37:50 +04:00
|
|
|
/* ------------ Overrides of nsEditor interface methods -------------- */
|
|
|
|
|
2003-03-25 18:24:08 +03:00
|
|
|
nsresult EndUpdateViewBatch();
|
|
|
|
|
1999-08-23 10:42:04 +04:00
|
|
|
/** prepare the editor for use */
|
2000-05-04 12:33:48 +04:00
|
|
|
NS_IMETHOD Init(nsIDOMDocument *aDoc, nsIPresShell *aPresShell, nsIContent *aRoot, nsISelectionController *aSelCon, PRUint32 aFlags);
|
1999-08-23 10:42:04 +04:00
|
|
|
|
2001-04-06 03:48:01 +04:00
|
|
|
/** Internal, static version */
|
2001-04-07 04:45:26 +04:00
|
|
|
static nsresult NodeIsBlockStatic(nsIDOMNode *aNode, PRBool *aIsBlock);
|
2001-04-06 03:48:01 +04:00
|
|
|
|
|
|
|
/** This version is for exposure to JavaScript */
|
2001-04-07 04:45:26 +04:00
|
|
|
NS_IMETHOD NodeIsBlock(nsIDOMNode *aNode, PRBool *aIsBlock);
|
2001-04-06 03:48:01 +04:00
|
|
|
|
1999-08-23 10:42:04 +04:00
|
|
|
/** we override this here to install event listeners */
|
|
|
|
NS_IMETHOD PostCreate();
|
1999-08-09 05:37:50 +04:00
|
|
|
|
|
|
|
NS_IMETHOD GetFlags(PRUint32 *aFlags);
|
|
|
|
NS_IMETHOD SetFlags(PRUint32 aFlags);
|
1999-05-07 09:02:35 +04:00
|
|
|
|
2000-04-15 03:38:21 +04:00
|
|
|
NS_IMETHOD Paste(PRInt32 aSelectionType);
|
2001-04-07 04:45:26 +04:00
|
|
|
NS_IMETHOD CanPaste(PRInt32 aSelectionType, PRBool *aCanPaste);
|
1999-07-14 22:54:29 +04:00
|
|
|
|
2001-04-07 04:45:26 +04:00
|
|
|
NS_IMETHOD CanDrag(nsIDOMEvent *aDragEvent, PRBool *aCanDrag);
|
2000-06-08 18:47:29 +04:00
|
|
|
NS_IMETHOD DoDrag(nsIDOMEvent *aDragEvent);
|
|
|
|
NS_IMETHOD InsertFromDrop(nsIDOMEvent* aDropEvent);
|
2000-04-25 18:14:48 +04:00
|
|
|
|
2002-03-24 01:08:20 +03:00
|
|
|
NS_IMETHOD GetHeadContentsAsHTML(nsAString& aOutputString);
|
|
|
|
NS_IMETHOD ReplaceHeadContentsWithHTML(const nsAString &aSourceToInsert);
|
2000-04-28 09:59:16 +04:00
|
|
|
|
1999-08-09 05:37:50 +04:00
|
|
|
NS_IMETHOD DebugUnitTests(PRInt32 *outNumTests, PRInt32 *outNumTestsFailed);
|
1999-07-01 23:32:35 +04:00
|
|
|
|
1999-12-07 11:30:19 +03:00
|
|
|
/** All editor operations which alter the doc should be prefaced
|
|
|
|
* with a call to StartOperation, naming the action and direction */
|
|
|
|
NS_IMETHOD StartOperation(PRInt32 opID, nsIEditor::EDirection aDirection);
|
|
|
|
|
|
|
|
/** All editor operations which alter the doc should be followed
|
2000-08-14 06:39:37 +04:00
|
|
|
* with a call to EndOperation */
|
|
|
|
NS_IMETHOD EndOperation();
|
1999-12-07 11:30:19 +03:00
|
|
|
|
2000-06-29 13:23:41 +04:00
|
|
|
/** returns PR_TRUE if aParentTag can contain a child of type aChildTag */
|
2002-03-24 01:08:20 +03:00
|
|
|
virtual PRBool TagCanContainTag(const nsAString& aParentTag, const nsAString& aChildTag);
|
2000-01-10 13:13:58 +03:00
|
|
|
|
2000-01-13 13:17:35 +03:00
|
|
|
/** make the given selection span the entire document */
|
2000-09-14 15:45:01 +04:00
|
|
|
NS_IMETHOD SelectEntireDocument(nsISelection *aSelection);
|
2000-01-13 13:17:35 +03:00
|
|
|
|
2002-01-25 13:16:52 +03:00
|
|
|
NS_IMETHOD SetAttributeOrEquivalent(nsIDOMElement * aElement,
|
2002-03-24 01:08:20 +03:00
|
|
|
const nsAString & aAttribute,
|
2002-09-17 16:04:59 +04:00
|
|
|
const nsAString & aValue,
|
|
|
|
PRBool aSuppressTransaction);
|
2002-03-15 18:33:29 +03:00
|
|
|
NS_IMETHOD RemoveAttributeOrEquivalent(nsIDOMElement * aElement,
|
2002-09-17 16:04:59 +04:00
|
|
|
const nsAString & aAttribute,
|
|
|
|
PRBool aSuppressTransaction);
|
2002-01-09 16:51:37 +03:00
|
|
|
|
2000-03-29 16:53:23 +04:00
|
|
|
/** join together any afjacent editable text nodes in the range */
|
|
|
|
NS_IMETHOD CollapseAdjacentTextNodes(nsIDOMRange *aInRange);
|
|
|
|
|
2002-01-09 16:51:37 +03:00
|
|
|
virtual PRBool NodesSameType(nsIDOMNode *aNode1, nsIDOMNode *aNode2);
|
|
|
|
|
2002-12-22 04:51:14 +03:00
|
|
|
NS_IMETHODIMP DeleteNode(nsIDOMNode * aNode);
|
|
|
|
NS_IMETHODIMP DeleteText(nsIDOMCharacterData *aTextNode,
|
|
|
|
PRUint32 aOffset,
|
|
|
|
PRUint32 aLength);
|
|
|
|
|
2000-01-13 13:17:35 +03:00
|
|
|
/* ------------ nsICSSLoaderObserver -------------- */
|
|
|
|
NS_IMETHOD StyleSheetLoaded(nsICSSStyleSheet*aSheet, PRBool aNotify);
|
|
|
|
|
1999-08-20 02:11:58 +04:00
|
|
|
/* ------------ Utility Routines, not part of public API -------------- */
|
2002-03-24 01:08:20 +03:00
|
|
|
NS_IMETHOD TypedText(const nsAString& aString, PRInt32 aAction);
|
2001-06-16 02:29:07 +04:00
|
|
|
nsresult InsertNodeAtPoint( nsIDOMNode *aNode,
|
|
|
|
nsCOMPtr<nsIDOMNode> *ioParent,
|
|
|
|
PRInt32 *ioOffset,
|
|
|
|
PRBool aNoEmptyNodes);
|
2002-12-22 04:51:14 +03:00
|
|
|
nsCOMPtr<nsIDOMNode> FindUserSelectAllNode(nsIDOMNode *aNode);
|
Checking in for bug 50742, this change removes the use of XIF in mozilla and replaces the XIF converter with a HTML (and XML) serializer.
Contextual information added to HTML copy and intelligence added to HTML paste in the editor (fixes bugs 47014, 50568 and 46554, and partly (at least) fixes bug 53188).
Code written by vidur, jfrancis, jst, akkana. Tested by jfrancis, akkana, vidur, jst, kin. Reviwed (and super reviewed) by waterson, vidur, kin, jfrancis, jst
2000-10-07 14:57:30 +04:00
|
|
|
|
1999-08-20 02:11:58 +04:00
|
|
|
|
2000-03-29 16:53:23 +04:00
|
|
|
/** returns the absolute position of the end points of aSelection
|
|
|
|
* in the document as a text stream.
|
|
|
|
*/
|
2000-09-14 15:45:01 +04:00
|
|
|
nsresult GetTextSelectionOffsets(nsISelection *aSelection,
|
2000-03-29 16:53:23 +04:00
|
|
|
PRInt32 &aStartOffset,
|
|
|
|
PRInt32 &aEndOffset);
|
|
|
|
|
|
|
|
nsresult GetAbsoluteOffsetsForPoints(nsIDOMNode *aInStartNode,
|
|
|
|
PRInt32 aInStartOffset,
|
|
|
|
nsIDOMNode *aInEndNode,
|
|
|
|
PRInt32 aInEndOffset,
|
|
|
|
nsIDOMNode *aInCommonParentNode,
|
|
|
|
PRInt32 &aOutStartOffset,
|
|
|
|
PRInt32 &aEndOffset);
|
2000-04-04 18:51:26 +04:00
|
|
|
|
|
|
|
// Use this to assure that selection is set after attribute nodes when
|
|
|
|
// trying to collapse selection at begining of a block node
|
|
|
|
// e.g., when setting at beginning of a table cell
|
|
|
|
// This will stop at a table, however, since we don't want to
|
|
|
|
// "drill down" into nested tables.
|
|
|
|
// aSelection is optional -- if null, we get current seletion
|
2000-09-14 15:45:01 +04:00
|
|
|
nsresult CollapseSelectionToDeepestNonTableFirstChild(nsISelection *aSelection, nsIDOMNode *aNode);
|
2000-03-29 16:53:23 +04:00
|
|
|
|
2003-06-11 15:50:36 +04:00
|
|
|
virtual PRBool IsTextInDirtyFrameVisible(nsIDOMNode *aNode);
|
|
|
|
|
2002-04-14 06:37:23 +04:00
|
|
|
nsresult IsVisTextNode( nsIDOMNode *aNode,
|
|
|
|
PRBool *outIsEmptyNode,
|
|
|
|
PRBool aSafeToAskFrames);
|
2000-08-26 08:03:50 +04:00
|
|
|
nsresult IsEmptyNode(nsIDOMNode *aNode, PRBool *outIsEmptyBlock,
|
|
|
|
PRBool aMozBRDoesntCount = PR_FALSE,
|
|
|
|
PRBool aListOrCellNotEmpty = PR_FALSE,
|
|
|
|
PRBool aSafeToAskFrames = PR_FALSE);
|
2002-04-14 06:37:23 +04:00
|
|
|
nsresult IsEmptyNodeImpl(nsIDOMNode *aNode,
|
|
|
|
PRBool *outIsEmptyBlock,
|
|
|
|
PRBool aMozBRDoesntCount,
|
|
|
|
PRBool aListOrCellNotEmpty,
|
|
|
|
PRBool aSafeToAskFrames,
|
|
|
|
PRBool *aSeenBR);
|
2002-09-13 23:47:38 +04:00
|
|
|
|
|
|
|
// Stylesheet-related methods that aren't part of nsIEditorStyleSheets.
|
|
|
|
nsresult AddCSSStyleSheet(nsICSSStyleSheet* aSheet);
|
|
|
|
nsresult GetCSSLoader(const nsAString& aURL, nsICSSLoader** aCSSLoader);
|
|
|
|
|
|
|
|
// Returns TRUE if sheet was loaded, false if it wasn't
|
|
|
|
PRBool EnableExistingStyleSheet(const nsAString& aURL);
|
|
|
|
|
|
|
|
// Dealing with the internal style sheet lists:
|
|
|
|
NS_IMETHOD GetStyleSheetForURL(const nsAString &aURL,
|
|
|
|
nsICSSStyleSheet **_retval);
|
|
|
|
NS_IMETHOD GetURLForStyleSheet(nsICSSStyleSheet *aStyleSheet, nsAString &aURL);
|
|
|
|
|
|
|
|
// Add a url + known style sheet to the internal lists:
|
|
|
|
nsresult AddNewStyleSheetToList(const nsAString &aURL,
|
|
|
|
nsICSSStyleSheet *aStyleSheet);
|
|
|
|
|
|
|
|
nsresult RemoveStyleSheetFromList(const nsAString &aURL);
|
2001-04-17 14:15:05 +04:00
|
|
|
|
1999-08-09 05:37:50 +04:00
|
|
|
protected:
|
1999-06-15 00:02:46 +04:00
|
|
|
|
2000-03-24 03:26:47 +03:00
|
|
|
NS_IMETHOD InitRules();
|
1999-06-15 00:02:46 +04:00
|
|
|
|
1999-08-23 10:42:04 +04:00
|
|
|
/** install the event listeners for the editor
|
|
|
|
* used to be part of Init, but now broken out into a separate method
|
|
|
|
* called by PostCreate, giving the caller the chance to interpose
|
|
|
|
* their own listeners before we install our own backstops.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD InstallEventListeners();
|
|
|
|
|
1999-08-19 17:30:48 +04:00
|
|
|
/** returns the layout object (nsIFrame in the real world) for aNode
|
|
|
|
* @param aNode the content to get a frame for
|
|
|
|
* @param aLayoutObject the "primary frame" for aNode, if one exists. May be null
|
|
|
|
* @return NS_OK whether a frame is found or not
|
|
|
|
* an error if some serious error occurs
|
|
|
|
*/
|
|
|
|
NS_IMETHOD GetLayoutObject(nsIDOMNode *aInNode, nsISupports **aOutLayoutObject);
|
|
|
|
|
1999-07-23 04:52:17 +04:00
|
|
|
// Return TRUE if aElement is a table-related elemet and caret was set
|
1999-12-04 04:46:23 +03:00
|
|
|
PRBool SetCaretInTableCell(nsIDOMElement* aElement);
|
|
|
|
PRBool IsElementInBody(nsIDOMElement* aElement);
|
|
|
|
|
2000-01-31 13:30:12 +03:00
|
|
|
// inline style caching
|
|
|
|
void ClearInlineStylesCache();
|
|
|
|
|
1999-09-13 13:37:51 +04:00
|
|
|
// key event helpers
|
|
|
|
NS_IMETHOD TabInTable(PRBool inIsShift, PRBool *outHandled);
|
2000-02-25 07:39:30 +03:00
|
|
|
NS_IMETHOD CreateBR(nsIDOMNode *aNode, PRInt32 aOffset,
|
2001-01-28 23:13:07 +03:00
|
|
|
nsCOMPtr<nsIDOMNode> *outBRNode, nsIEditor::EDirection aSelect = nsIEditor::eNone);
|
2000-04-14 01:50:19 +04:00
|
|
|
NS_IMETHOD CreateBRImpl(nsCOMPtr<nsIDOMNode> *aInOutParent,
|
2000-03-24 03:26:47 +03:00
|
|
|
PRInt32 *aInOutOffset,
|
|
|
|
nsCOMPtr<nsIDOMNode> *outBRNode,
|
2001-01-28 23:13:07 +03:00
|
|
|
nsIEditor::EDirection aSelect);
|
1999-09-30 00:08:15 +04:00
|
|
|
NS_IMETHOD InsertBR(nsCOMPtr<nsIDOMNode> *outBRNode);
|
1999-09-13 13:37:51 +04:00
|
|
|
|
2000-02-10 08:14:52 +03:00
|
|
|
// Table Editing (implemented in nsTableEditor.cpp)
|
1999-08-02 02:37:58 +04:00
|
|
|
|
1999-12-04 04:46:23 +03:00
|
|
|
// Table utilities
|
|
|
|
|
2000-02-03 05:06:10 +03:00
|
|
|
// Insert a new cell after or before supplied aCell.
|
|
|
|
// Optional: If aNewCell supplied, returns the newly-created cell (addref'd, of course)
|
|
|
|
// This doesn't change or use the current selection
|
|
|
|
NS_IMETHOD InsertCell(nsIDOMElement *aCell, PRInt32 aRowSpan, PRInt32 aColSpan,
|
2000-06-14 08:58:29 +04:00
|
|
|
PRBool aAfter, PRBool aIsHeader, nsIDOMElement **aNewCell);
|
2000-05-02 07:24:11 +04:00
|
|
|
|
2000-07-01 04:37:12 +04:00
|
|
|
// Helpers that don't touch the selection or do batch transactions
|
|
|
|
NS_IMETHOD DeleteRow(nsIDOMElement *aTable, PRInt32 aRowIndex);
|
|
|
|
NS_IMETHOD DeleteColumn(nsIDOMElement *aTable, PRInt32 aColIndex);
|
|
|
|
NS_IMETHOD DeleteCellContents(nsIDOMElement *aCell);
|
|
|
|
|
2000-05-02 07:24:11 +04:00
|
|
|
// Move all contents from aCellToMerge into aTargetCell (append at end)
|
|
|
|
NS_IMETHOD MergeCells(nsCOMPtr<nsIDOMElement> aTargetCell, nsCOMPtr<nsIDOMElement> aCellToMerge, PRBool aDeleteCellToMerge);
|
|
|
|
|
2000-09-14 15:45:01 +04:00
|
|
|
NS_IMETHOD DeleteTable2(nsIDOMElement *aTable, nsISelection *aSelection);
|
2000-02-03 05:06:10 +03:00
|
|
|
NS_IMETHOD SetColSpan(nsIDOMElement *aCell, PRInt32 aColSpan);
|
|
|
|
NS_IMETHOD SetRowSpan(nsIDOMElement *aCell, PRInt32 aRowSpan);
|
|
|
|
|
1999-08-02 02:37:58 +04:00
|
|
|
// Helper used to get nsITableLayout interface for methods implemented in nsTableFrame
|
|
|
|
NS_IMETHOD GetTableLayoutObject(nsIDOMElement* aTable, nsITableLayout **tableLayoutObject);
|
1999-12-07 04:12:10 +03:00
|
|
|
// Needed to do appropriate deleting when last cell or row is about to be deleted
|
|
|
|
// This doesn't count cells that don't start in the given row (are spanning from row above)
|
2000-01-26 17:57:43 +03:00
|
|
|
PRInt32 GetNumberOfCellsInRow(nsIDOMElement* aTable, PRInt32 rowIndex);
|
2000-03-21 09:05:24 +03:00
|
|
|
// Test if all cells in row or column at given index are selected
|
|
|
|
PRBool AllCellsInRowSelected(nsIDOMElement *aTable, PRInt32 aRowIndex, PRInt32 aNumberOfColumns);
|
|
|
|
PRBool AllCellsInColumnSelected(nsIDOMElement *aTable, PRInt32 aColIndex, PRInt32 aNumberOfRows);
|
|
|
|
|
2000-07-12 03:41:22 +04:00
|
|
|
PRBool IsEmptyCell(nsIDOMElement *aCell);
|
2000-06-22 09:39:54 +04:00
|
|
|
|
1999-12-04 04:46:23 +03:00
|
|
|
// Most insert methods need to get the same basic context data
|
2000-05-02 07:24:11 +04:00
|
|
|
// Any of the pointers may be null if you don't need that datum (for more efficiency)
|
|
|
|
// Input: *aCell is a known cell,
|
|
|
|
// if null, cell is obtained from the anchor node of the selection
|
|
|
|
// Returns NS_EDITOR_ELEMENT_NOT_FOUND if cell is not found even if aCell is null
|
2000-09-14 15:45:01 +04:00
|
|
|
NS_IMETHOD GetCellContext(nsISelection **aSelection,
|
2000-05-02 07:24:11 +04:00
|
|
|
nsIDOMElement **aTable,
|
|
|
|
nsIDOMElement **aCell,
|
|
|
|
nsIDOMNode **aCellParent, PRInt32 *aCellOffset,
|
|
|
|
PRInt32 *aRowIndex, PRInt32 *aColIndex);
|
1999-08-04 06:06:03 +04:00
|
|
|
|
2000-05-15 07:06:29 +04:00
|
|
|
NS_IMETHOD GetCellSpansAt(nsIDOMElement* aTable, PRInt32 aRowIndex, PRInt32 aColIndex,
|
|
|
|
PRInt32& aActualRowSpan, PRInt32& aActualColSpan);
|
|
|
|
|
|
|
|
NS_IMETHOD SplitCellIntoColumns(nsIDOMElement *aTable, PRInt32 aRowIndex, PRInt32 aColIndex,
|
|
|
|
PRInt32 aColSpanLeft, PRInt32 aColSpanRight, nsIDOMElement **aNewCell);
|
|
|
|
|
|
|
|
NS_IMETHOD SplitCellIntoRows(nsIDOMElement *aTable, PRInt32 aRowIndex, PRInt32 aColIndex,
|
|
|
|
PRInt32 aRowSpanAbove, PRInt32 aRowSpanBelow, nsIDOMElement **aNewCell);
|
|
|
|
|
2000-08-30 06:44:08 +04:00
|
|
|
nsresult CopyCellBackgroundColor(nsIDOMElement *destCell, nsIDOMElement *sourceCell);
|
|
|
|
|
2000-07-01 04:37:12 +04:00
|
|
|
// Reduce rowspan/colspan when cells span into non-existent rows/columns
|
2000-05-15 07:06:29 +04:00
|
|
|
NS_IMETHOD FixBadRowSpan(nsIDOMElement *aTable, PRInt32 aRowIndex, PRInt32& aNewRowCount);
|
2000-07-01 04:37:12 +04:00
|
|
|
NS_IMETHOD FixBadColSpan(nsIDOMElement *aTable, PRInt32 aColIndex, PRInt32& aNewColCount);
|
2000-05-15 07:06:29 +04:00
|
|
|
|
2000-02-10 08:14:52 +03:00
|
|
|
// Fallback method: Call this after using ClearSelection() and you
|
|
|
|
// failed to set selection to some other content in the document
|
2000-09-14 15:45:01 +04:00
|
|
|
NS_IMETHOD SetSelectionAtDocumentStart(nsISelection *aSelection);
|
1999-08-06 00:04:58 +04:00
|
|
|
|
2000-03-21 09:05:24 +03:00
|
|
|
// End of Table Editing utilities
|
|
|
|
|
1999-05-05 08:05:19 +04:00
|
|
|
NS_IMETHOD IsRootTag(nsString &aTag, PRBool &aIsTag);
|
|
|
|
|
|
|
|
NS_IMETHOD IsSubordinateBlock(nsString &aTag, PRBool &aIsTag);
|
|
|
|
|
2001-12-09 12:24:33 +03:00
|
|
|
virtual PRBool IsBlockNode(nsIDOMNode *aNode);
|
|
|
|
|
1999-09-19 14:32:21 +04:00
|
|
|
static nsCOMPtr<nsIDOMNode> GetEnclosingTable(nsIDOMNode *aNode);
|
1999-05-05 08:05:19 +04:00
|
|
|
|
1999-08-09 05:37:50 +04:00
|
|
|
/** content-based query returns PR_TRUE if <aProperty aAttribute=aValue> effects aNode
|
|
|
|
* If <aProperty aAttribute=aValue> contains aNode,
|
|
|
|
* but <aProperty aAttribute=SomeOtherValue> also contains aNode and the second is
|
|
|
|
* more deeply nested than the first, then the first does not effect aNode.
|
|
|
|
*
|
|
|
|
* @param aNode The target of the query
|
|
|
|
* @param aProperty The property that we are querying for
|
|
|
|
* @param aAttribute The attribute of aProperty, example: color in <FONT color="blue">
|
|
|
|
* May be null.
|
|
|
|
* @param aValue The value of aAttribute, example: blue in <FONT color="blue">
|
|
|
|
* May be null. Ignored if aAttribute is null.
|
|
|
|
* @param aIsSet [OUT] PR_TRUE if <aProperty aAttribute=aValue> effects aNode.
|
|
|
|
* @param aStyleNode [OUT] set to the node representing <aProperty aAttribute=aValue>, if found.
|
|
|
|
* null if aIsSet is returned as PR_FALSE;
|
|
|
|
*/
|
2001-11-29 13:08:25 +03:00
|
|
|
virtual void IsTextPropertySetByContent(nsIDOMNode *aNode,
|
|
|
|
nsIAtom *aProperty,
|
2002-03-24 01:08:20 +03:00
|
|
|
const nsAString *aAttribute,
|
|
|
|
const nsAString *aValue,
|
2001-11-29 13:08:25 +03:00
|
|
|
PRBool &aIsSet,
|
|
|
|
nsIDOMNode **aStyleNode,
|
2003-06-03 02:21:06 +04:00
|
|
|
nsAString *outValue = nsnull);
|
1999-08-09 05:37:50 +04:00
|
|
|
|
|
|
|
void ResetTextSelectionForRange(nsIDOMNode *aParent,
|
|
|
|
PRInt32 aStartOffset,
|
|
|
|
PRInt32 aEndOffset,
|
2000-09-14 15:45:01 +04:00
|
|
|
nsISelection *aSelection);
|
1999-08-09 05:37:50 +04:00
|
|
|
|
|
|
|
// Methods for handling plaintext quotations
|
2000-04-15 03:38:21 +04:00
|
|
|
NS_IMETHOD PasteAsPlaintextQuotation(PRInt32 aSelectionType);
|
2002-10-09 00:24:23 +04:00
|
|
|
|
|
|
|
/** Insert a string as quoted text,
|
|
|
|
* replacing the selected text (if any).
|
|
|
|
* @param aQuotedText The string to insert.
|
|
|
|
* @param aAddCites Whether to prepend extra ">" to each line
|
|
|
|
* (usually true, unless those characters
|
|
|
|
* have already been added.)
|
|
|
|
* @return aNodeInserted The node spanning the insertion, if applicable.
|
|
|
|
* If aAddCites is false, this will be null.
|
|
|
|
*/
|
2002-03-24 01:08:20 +03:00
|
|
|
NS_IMETHOD InsertAsPlaintextQuotation(const nsAString & aQuotedText,
|
2002-10-09 00:24:23 +04:00
|
|
|
PRBool aAddCites,
|
1999-11-24 23:48:59 +03:00
|
|
|
nsIDOMNode **aNodeInserted);
|
1999-08-09 05:37:50 +04:00
|
|
|
|
2000-04-25 18:14:48 +04:00
|
|
|
// factored methods for handling insertion of data from transferables (drag&drop or clipboard)
|
|
|
|
NS_IMETHOD PrepareTransferable(nsITransferable **transferable);
|
2002-11-22 06:30:59 +03:00
|
|
|
NS_IMETHOD PrepareHTMLTransferable(nsITransferable **transferable, PRBool havePrivFlavor);
|
2003-04-17 17:18:51 +04:00
|
|
|
nsresult PutDragDataInTransferable(nsITransferable **aTransferable);
|
Checking in for bug 50742, this change removes the use of XIF in mozilla and replaces the XIF converter with a HTML (and XML) serializer.
Contextual information added to HTML copy and intelligence added to HTML paste in the editor (fixes bugs 47014, 50568 and 46554, and partly (at least) fixes bug 53188).
Code written by vidur, jfrancis, jst, akkana. Tested by jfrancis, akkana, vidur, jst, kin. Reviwed (and super reviewed) by waterson, vidur, kin, jfrancis, jst
2000-10-07 14:57:30 +04:00
|
|
|
NS_IMETHOD InsertFromTransferable(nsITransferable *transferable,
|
2003-06-10 22:52:31 +04:00
|
|
|
nsIDOMDocument *aSourceDoc,
|
2002-03-24 01:08:20 +03:00
|
|
|
const nsAString & aContextStr,
|
2003-04-15 18:07:30 +04:00
|
|
|
const nsAString & aInfoStr,
|
|
|
|
nsIDOMNode *aDestinationNode,
|
|
|
|
PRInt32 aDestinationOffset,
|
|
|
|
PRBool aDoDeleteSelection);
|
2002-11-22 06:30:59 +03:00
|
|
|
PRBool HavePrivateHTMLFlavor( nsIClipboard *clipboard );
|
|
|
|
nsresult ParseCFHTML(nsCString & aCfhtml, PRUnichar **aStuffToPaste, PRUnichar **aCfcontext);
|
2003-04-15 18:07:30 +04:00
|
|
|
nsresult DoContentFilterCallback(const nsAString &aFlavor,
|
2003-06-10 22:52:31 +04:00
|
|
|
nsIDOMDocument *aSourceDoc,
|
2003-05-09 22:33:14 +04:00
|
|
|
PRBool aWillDeleteSelection,
|
2003-04-15 18:07:30 +04:00
|
|
|
nsIDOMNode **aFragmentAsNode,
|
|
|
|
nsIDOMNode **aFragStartNode,
|
|
|
|
PRInt32 *aFragStartOffset,
|
|
|
|
nsIDOMNode **aFragEndNode,
|
|
|
|
PRInt32 *aFragEndOffset,
|
|
|
|
nsIDOMNode **aTargetNode,
|
|
|
|
PRInt32 *aTargetOffset,
|
|
|
|
PRBool *aDoContinue);
|
2002-05-14 04:05:37 +04:00
|
|
|
PRBool IsInLink(nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *outLink = nsnull);
|
2002-03-11 12:30:51 +03:00
|
|
|
nsresult StripFormattingNodes(nsIDOMNode *aNode, PRBool aOnlyList = PR_FALSE);
|
2003-04-15 18:07:30 +04:00
|
|
|
nsresult CreateDOMFragmentFromPaste(const nsAString & aInputString,
|
2002-03-24 01:08:20 +03:00
|
|
|
const nsAString & aContextStr,
|
|
|
|
const nsAString & aInfoStr,
|
2000-12-07 02:11:21 +03:00
|
|
|
nsCOMPtr<nsIDOMNode> *outFragNode,
|
|
|
|
PRInt32 *outRangeStartHint,
|
|
|
|
PRInt32 *outRangeEndHint);
|
2003-04-15 05:09:09 +04:00
|
|
|
nsresult ParseFragment(const nsAString & aStr, nsVoidArray &aTagStack,
|
|
|
|
nsIDocument* aTargetDoc,
|
|
|
|
nsCOMPtr<nsIDOMNode> *outNode);
|
2000-12-07 02:11:21 +03:00
|
|
|
nsresult CreateListOfNodesToPaste(nsIDOMNode *aFragmentAsNode,
|
2002-11-12 22:40:11 +03:00
|
|
|
nsCOMArray<nsIDOMNode>& outNodeList,
|
2003-04-15 18:07:30 +04:00
|
|
|
nsIDOMNode *aStartNode,
|
|
|
|
PRInt32 aStartOffset,
|
|
|
|
nsIDOMNode *aEndNode,
|
|
|
|
PRInt32 aEndOffset);
|
2003-03-23 23:45:47 +03:00
|
|
|
nsresult CreateTagStack(nsVoidArray &aTagStack, nsIDOMNode *aNode);
|
|
|
|
void FreeTagStackStrings(nsVoidArray &tagStack);
|
2001-06-16 02:29:07 +04:00
|
|
|
nsresult GetListAndTableParents( PRBool aEnd,
|
2002-11-12 22:40:11 +03:00
|
|
|
nsCOMArray<nsIDOMNode>& aListOfNodes,
|
|
|
|
nsCOMArray<nsIDOMNode>& outArray);
|
|
|
|
nsresult DiscoverPartialListsAndTables(nsCOMArray<nsIDOMNode>& aPasteNodes,
|
|
|
|
nsCOMArray<nsIDOMNode>& aListsAndTables,
|
|
|
|
PRInt32 *outHighWaterMark);
|
2001-06-16 02:29:07 +04:00
|
|
|
nsresult ScanForListAndTableStructure(PRBool aEnd,
|
2002-11-12 22:40:11 +03:00
|
|
|
nsCOMArray<nsIDOMNode>& aNodes,
|
2001-06-16 02:29:07 +04:00
|
|
|
nsIDOMNode *aListOrTable,
|
|
|
|
nsCOMPtr<nsIDOMNode> *outReplaceNode);
|
|
|
|
nsresult ReplaceOrphanedStructure( PRBool aEnd,
|
2002-11-12 22:40:11 +03:00
|
|
|
nsCOMArray<nsIDOMNode>& aNodeArray,
|
|
|
|
nsCOMArray<nsIDOMNode>& aListAndTableArray,
|
2001-06-16 02:29:07 +04:00
|
|
|
PRInt32 aHighWaterMark);
|
2002-11-12 22:40:11 +03:00
|
|
|
nsIDOMNode* GetArrayEndpoint(PRBool aEnd, nsCOMArray<nsIDOMNode>& aNodeArray);
|
Checking in for bug 50742, this change removes the use of XIF in mozilla and replaces the XIF converter with a HTML (and XML) serializer.
Contextual information added to HTML copy and intelligence added to HTML paste in the editor (fixes bugs 47014, 50568 and 46554, and partly (at least) fixes bug 53188).
Code written by vidur, jfrancis, jst, akkana. Tested by jfrancis, akkana, vidur, jst, kin. Reviwed (and super reviewed) by waterson, vidur, kin, jfrancis, jst
2000-10-07 14:57:30 +04:00
|
|
|
|
1999-08-09 05:37:50 +04:00
|
|
|
/** simple utility to handle any error with event listener allocation or registration */
|
|
|
|
void HandleEventListenerError();
|
|
|
|
|
2002-05-14 04:05:37 +04:00
|
|
|
/* small utility routine to test if a break node is visible to user */
|
|
|
|
PRBool IsVisBreak(nsIDOMNode *aNode);
|
|
|
|
|
2003-04-16 00:53:15 +04:00
|
|
|
/* utility routine to possibly adjust the insertion position when
|
|
|
|
inserting a block level element */
|
|
|
|
void NormalizeEOLInsertPosition(nsIDOMNode *firstNodeToInsert,
|
|
|
|
nsCOMPtr<nsIDOMNode> *insertParentNode,
|
|
|
|
PRInt32 *insertOffset);
|
|
|
|
|
2000-01-19 00:50:15 +03:00
|
|
|
/* small utility routine to test the eEditorReadonly bit */
|
|
|
|
PRBool IsModifiable();
|
2000-08-14 06:39:37 +04:00
|
|
|
|
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
|
|
|
/* helpers for block transformations */
|
2002-03-24 01:08:20 +03:00
|
|
|
nsresult MakeDefinitionItem(const nsAString & aItemType);
|
|
|
|
nsresult InsertBasicBlock(const nsAString & aBlockType);
|
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
|
|
|
|
2000-02-08 15:53:34 +03:00
|
|
|
/* increase/decrease the font size of selection */
|
|
|
|
nsresult RelativeFontChange( PRInt32 aSizeChange);
|
|
|
|
|
|
|
|
/* helper routines for font size changing */
|
|
|
|
nsresult RelativeFontChangeOnTextNode( PRInt32 aSizeChange,
|
|
|
|
nsIDOMCharacterData *aTextNode,
|
|
|
|
PRInt32 aStartOffset,
|
|
|
|
PRInt32 aEndOffset);
|
|
|
|
nsresult RelativeFontChangeOnNode( PRInt32 aSizeChange,
|
|
|
|
nsIDOMNode *aNode);
|
2001-10-22 10:22:52 +04:00
|
|
|
nsresult RelativeFontChangeHelper( PRInt32 aSizeChange,
|
|
|
|
nsIDOMNode *aNode);
|
2000-02-08 15:53:34 +03:00
|
|
|
|
2000-03-24 03:26:47 +03:00
|
|
|
/* helper routines for inline style */
|
|
|
|
nsresult SetInlinePropertyOnTextNode( nsIDOMCharacterData *aTextNode,
|
|
|
|
PRInt32 aStartOffset,
|
|
|
|
PRInt32 aEndOffset,
|
|
|
|
nsIAtom *aProperty,
|
2002-03-24 01:08:20 +03:00
|
|
|
const nsAString *aAttribute,
|
|
|
|
const nsAString *aValue);
|
2000-03-24 03:26:47 +03:00
|
|
|
nsresult SetInlinePropertyOnNode( nsIDOMNode *aNode,
|
|
|
|
nsIAtom *aProperty,
|
2002-03-24 01:08:20 +03:00
|
|
|
const nsAString *aAttribute,
|
|
|
|
const nsAString *aValue);
|
2000-03-24 03:26:47 +03:00
|
|
|
|
|
|
|
nsresult PromoteInlineRange(nsIDOMRange *inRange);
|
2002-04-11 17:33:30 +04:00
|
|
|
nsresult PromoteRangeIfStartsOrEndsInNamedAnchor(nsIDOMRange *inRange);
|
2000-03-24 03:26:47 +03:00
|
|
|
nsresult SplitStyleAboveRange(nsIDOMRange *aRange,
|
|
|
|
nsIAtom *aProperty,
|
2002-03-24 01:08:20 +03:00
|
|
|
const nsAString *aAttribute);
|
2000-03-24 03:26:47 +03:00
|
|
|
nsresult SplitStyleAbovePoint(nsCOMPtr<nsIDOMNode> *aNode,
|
|
|
|
PRInt32 *aOffset,
|
|
|
|
nsIAtom *aProperty,
|
2002-03-24 01:08:20 +03:00
|
|
|
const nsAString *aAttribute,
|
2000-08-30 08:33:20 +04:00
|
|
|
nsCOMPtr<nsIDOMNode> *outLeftNode = nsnull,
|
|
|
|
nsCOMPtr<nsIDOMNode> *outRightNode = nsnull);
|
2003-06-03 02:21:06 +04:00
|
|
|
nsresult ApplyDefaultProperties();
|
2000-03-24 03:26:47 +03:00
|
|
|
nsresult RemoveStyleInside(nsIDOMNode *aNode,
|
|
|
|
nsIAtom *aProperty,
|
2002-03-24 01:08:20 +03:00
|
|
|
const nsAString *aAttribute,
|
2000-03-24 03:26:47 +03:00
|
|
|
PRBool aChildrenOnly = PR_FALSE);
|
2002-03-24 01:08:20 +03:00
|
|
|
nsresult RemoveInlinePropertyImpl(nsIAtom *aProperty, const nsAString *aAttribute);
|
2002-01-09 16:51:37 +03:00
|
|
|
|
2000-04-14 01:50:19 +04:00
|
|
|
PRBool NodeIsProperty(nsIDOMNode *aNode);
|
2002-03-24 01:08:20 +03:00
|
|
|
PRBool HasAttr(nsIDOMNode *aNode, const nsAString *aAttribute);
|
|
|
|
PRBool HasAttrVal(nsIDOMNode *aNode, const nsAString *aAttribute, const nsAString *aValue);
|
2000-03-24 03:26:47 +03:00
|
|
|
PRBool IsAtFrontOfNode(nsIDOMNode *aNode, PRInt32 aOffset);
|
|
|
|
PRBool IsAtEndOfNode(nsIDOMNode *aNode, PRInt32 aOffset);
|
2002-03-24 01:08:20 +03:00
|
|
|
PRBool IsOnlyAttribute(nsIDOMNode *aElement, const nsAString *aAttribute);
|
2000-03-24 03:26:47 +03:00
|
|
|
|
2001-06-19 01:15:43 +04:00
|
|
|
nsresult RemoveBlockContainer(nsIDOMNode *inNode);
|
2000-03-24 03:26:47 +03:00
|
|
|
nsresult GetPriorHTMLSibling(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode);
|
|
|
|
nsresult GetPriorHTMLSibling(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode);
|
|
|
|
nsresult GetNextHTMLSibling(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode);
|
|
|
|
nsresult GetNextHTMLSibling(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode);
|
2001-08-22 09:32:44 +04:00
|
|
|
nsresult GetPriorHTMLNode(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode, PRBool bNoBlockCrossing = PR_FALSE);
|
|
|
|
nsresult GetPriorHTMLNode(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode, PRBool bNoBlockCrossing = PR_FALSE);
|
|
|
|
nsresult GetNextHTMLNode(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode, PRBool bNoBlockCrossing = PR_FALSE);
|
|
|
|
nsresult GetNextHTMLNode(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode, PRBool bNoBlockCrossing = PR_FALSE);
|
2000-03-24 03:26:47 +03:00
|
|
|
|
|
|
|
nsresult IsFirstEditableChild( nsIDOMNode *aNode, PRBool *aOutIsFirst);
|
|
|
|
nsresult IsLastEditableChild( nsIDOMNode *aNode, PRBool *aOutIsLast);
|
|
|
|
nsresult GetFirstEditableChild( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutFirstChild);
|
|
|
|
nsresult GetLastEditableChild( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutLastChild);
|
2002-01-14 23:31:47 +03:00
|
|
|
|
2000-08-26 08:03:50 +04:00
|
|
|
nsresult GetFirstEditableLeaf( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutFirstLeaf);
|
2002-05-14 04:05:37 +04:00
|
|
|
nsresult GetLastEditableLeaf( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutLastLeaf);
|
2000-02-08 15:53:34 +03:00
|
|
|
|
2000-06-01 06:38:13 +04:00
|
|
|
nsresult GetDOMEventReceiver(nsIDOMEventReceiver **aEventReceiver);
|
|
|
|
|
2000-09-06 03:26:48 +04:00
|
|
|
//XXX Kludge: Used to suppress spurious drag/drop events (bug 50703)
|
|
|
|
PRBool mIgnoreSpuriousDragEvent;
|
|
|
|
NS_IMETHOD IgnoreSpuriousDragEvent(PRBool aIgnoreSpuriousDragEvent) {mIgnoreSpuriousDragEvent = aIgnoreSpuriousDragEvent; return NS_OK;}
|
|
|
|
|
2001-04-07 04:45:26 +04:00
|
|
|
nsresult GetInlinePropertyBase(nsIAtom *aProperty,
|
2002-03-24 01:08:20 +03:00
|
|
|
const nsAString *aAttribute,
|
|
|
|
const nsAString *aValue,
|
2001-04-07 04:45:26 +04:00
|
|
|
PRBool *aFirst,
|
|
|
|
PRBool *aAny,
|
|
|
|
PRBool *aAll,
|
2003-06-03 02:21:06 +04:00
|
|
|
nsAString *outValue,
|
|
|
|
PRBool aCheckDefaults = PR_TRUE);
|
2002-02-18 13:49:15 +03:00
|
|
|
nsresult HasStyleOrIdOrClass(nsIDOMElement * aElement, PRBool *aHasStyleOrIdOrClass);
|
|
|
|
nsresult RemoveElementIfNoStyleOrIdOrClass(nsIDOMElement * aElement, nsIAtom * aTag);
|
2001-04-07 04:45:26 +04:00
|
|
|
|
1999-08-09 05:37:50 +04:00
|
|
|
// Data members
|
|
|
|
protected:
|
|
|
|
|
2003-04-15 18:07:30 +04:00
|
|
|
nsCOMArray<nsIContentFilter> mContentFilters;
|
|
|
|
|
2001-01-28 23:13:07 +03:00
|
|
|
TypeInState* mTypeInState;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIAtom> mBoldAtom;
|
|
|
|
nsCOMPtr<nsIAtom> mItalicAtom;
|
|
|
|
nsCOMPtr<nsIAtom> mUnderlineAtom;
|
|
|
|
nsCOMPtr<nsIAtom> mFontAtom;
|
|
|
|
nsCOMPtr<nsIAtom> mLinkAtom;
|
2001-04-06 03:48:01 +04:00
|
|
|
|
2000-01-31 13:30:12 +03:00
|
|
|
nsCOMPtr<nsIDOMNode> mCachedNode;
|
|
|
|
|
2001-01-28 23:13:07 +03:00
|
|
|
PRBool mCachedBoldStyle;
|
|
|
|
PRBool mCachedItalicStyle;
|
|
|
|
PRBool mCachedUnderlineStyle;
|
2000-01-31 13:30:12 +03:00
|
|
|
nsString mCachedFontName;
|
1999-08-09 05:37:50 +04:00
|
|
|
|
2002-09-13 23:47:38 +04:00
|
|
|
// Used to disable HTML formatting commands during HTML source editing
|
|
|
|
PRBool mCanEditHTML;
|
|
|
|
|
2000-03-21 09:05:24 +03:00
|
|
|
// Used by GetFirstSelectedCell and GetNextSelectedCell
|
|
|
|
PRInt32 mSelectedCellIndex;
|
2000-03-17 02:45:41 +03:00
|
|
|
|
2001-05-11 16:43:22 +04:00
|
|
|
nsCOMPtr<nsIRangeUtils> mRangeHelper;
|
|
|
|
|
2002-09-13 23:47:38 +04:00
|
|
|
nsString mLastStyleSheetURL;
|
|
|
|
nsString mLastOverrideStyleSheetURL;
|
|
|
|
|
2002-01-09 16:51:37 +03:00
|
|
|
PRBool mCSSAware;
|
|
|
|
nsHTMLCSSUtils *mHTMLCSSUtils;
|
2002-06-12 00:43:49 +04:00
|
|
|
|
2002-09-13 23:47:38 +04:00
|
|
|
// Maintain a list of associated style sheets and their urls.
|
|
|
|
nsStringArray mStyleSheetURLs;
|
2002-11-12 22:40:11 +03:00
|
|
|
nsCOMArray<nsICSSStyleSheet> mStyleSheets;
|
2002-09-13 23:47:38 +04:00
|
|
|
PRInt32 mNumStyleSheets;
|
2003-06-03 02:21:06 +04:00
|
|
|
|
|
|
|
// an array for holding default style settings
|
|
|
|
nsVoidArray mDefaultStyles;
|
2002-09-13 23:47:38 +04:00
|
|
|
|
2002-06-12 00:43:49 +04:00
|
|
|
// Maintain a static parser service ...
|
|
|
|
static nsCOMPtr<nsIParserService> sParserService;
|
|
|
|
// ... which means that we need an instance count to know when to delete it
|
|
|
|
static PRInt32 sInstanceCount;
|
|
|
|
|
2003-02-24 12:37:18 +03:00
|
|
|
protected:
|
|
|
|
PRPackedBool mIsImageResizingEnabled;
|
|
|
|
PRPackedBool mIsShowingResizeHandles;
|
|
|
|
PRPackedBool mIsResizing;
|
|
|
|
PRPackedBool mPreserveRatio;
|
|
|
|
PRPackedBool mResizedObjectIsAnImage;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMElement> mTopLeftHandle;
|
|
|
|
nsCOMPtr<nsIDOMElement> mTopHandle;
|
|
|
|
nsCOMPtr<nsIDOMElement> mTopRightHandle;
|
|
|
|
nsCOMPtr<nsIDOMElement> mLeftHandle;
|
|
|
|
nsCOMPtr<nsIDOMElement> mRightHandle;
|
|
|
|
nsCOMPtr<nsIDOMElement> mBottomLeftHandle;
|
|
|
|
nsCOMPtr<nsIDOMElement> mBottomHandle;
|
|
|
|
nsCOMPtr<nsIDOMElement> mBottomRightHandle;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMElement> mResizingShadow;
|
|
|
|
nsCOMPtr<nsIDOMElement> mResizingInfo;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMElement> mResizedObject;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMEventListener> mMouseMotionListenerP;
|
|
|
|
nsCOMPtr<nsISelectionListener> mSelectionListenerP;
|
|
|
|
nsCOMPtr<nsIDOMEventListener> mResizeEventListenerP;
|
|
|
|
|
|
|
|
PRInt32 mOriginalX;
|
|
|
|
PRInt32 mOriginalY;
|
|
|
|
|
|
|
|
PRInt32 mResizedObjectX;
|
|
|
|
PRInt32 mResizedObjectY;
|
|
|
|
PRInt32 mResizedObjectWidth;
|
|
|
|
PRInt32 mResizedObjectHeight;
|
|
|
|
|
|
|
|
PRInt32 mXIncrementFactor;
|
|
|
|
PRInt32 mYIncrementFactor;
|
|
|
|
PRInt32 mWidthIncrementFactor;
|
|
|
|
PRInt32 mHeightIncrementFactor;
|
|
|
|
|
|
|
|
nsresult CreateResizer(nsIDOMElement ** aReturn, PRInt16 aLocation, nsISupportsArray * aArray);
|
|
|
|
void SetResizerPosition(PRInt32 aX, PRInt32 aY, nsIDOMElement *aResizer);
|
|
|
|
nsresult SetAllResizersPosition(nsIDOMElement * aResizedElement, PRInt32 & aX, PRInt32 & aY);
|
|
|
|
nsresult CreateShadow(nsIDOMElement ** aReturn, nsISupportsArray * aArray);
|
|
|
|
nsresult SetShadowPosition(nsIDOMElement *aResizedObject,
|
|
|
|
PRInt32 aX, PRInt32 aY);
|
|
|
|
nsresult CreateResizingInfo(nsIDOMElement ** aReturn, nsISupportsArray * aArray);
|
|
|
|
nsresult SetResizingInfoPosition(PRInt32 aX, PRInt32 aY,
|
|
|
|
PRInt32 aW, PRInt32 aH);
|
|
|
|
|
|
|
|
PRInt32 GetNewResizingIncrement(PRInt32 aX, PRInt32 aY, PRInt32 aID);
|
|
|
|
nsresult StartResizing(nsIDOMElement * aHandle);
|
|
|
|
PRInt32 GetNewResizingX(PRInt32 aX, PRInt32 aY);
|
|
|
|
PRInt32 GetNewResizingY(PRInt32 aX, PRInt32 aY);
|
|
|
|
PRInt32 GetNewResizingWidth(PRInt32 aX, PRInt32 aY);
|
|
|
|
PRInt32 GetNewResizingHeight(PRInt32 aX, PRInt32 aY);
|
|
|
|
void HideShadowAndInfo();
|
|
|
|
void SetFinalSize(PRInt32 aX, PRInt32 aY);
|
2003-03-25 18:24:08 +03:00
|
|
|
void DeleteRefToAnonymousNode(nsIDOMElement* aElement,
|
|
|
|
nsIContent * aParentContent,
|
|
|
|
nsIDocumentObserver * aDocObserver);
|
2003-02-24 12:37:18 +03:00
|
|
|
void SetResizeIncrements(PRInt32 aX, PRInt32 aY, PRInt32 aW, PRInt32 aH, PRBool aPreserveRatio);
|
|
|
|
nsresult GetElementOrigin(nsIDOMElement * aElement, PRInt32 & aX, PRInt32 & aY);
|
1999-09-30 00:08:15 +04:00
|
|
|
public:
|
|
|
|
|
1999-08-09 05:37:50 +04:00
|
|
|
// friends
|
|
|
|
friend class nsHTMLEditRules;
|
|
|
|
friend class nsTextEditRules;
|
2001-05-11 16:43:22 +04:00
|
|
|
friend class nsWSRunObject;
|
1999-05-03 22:48:39 +04:00
|
|
|
|
1999-03-01 22:54:47 +03:00
|
|
|
};
|
|
|
|
#endif //nsHTMLEditor_h__
|
|
|
|
|