Back to index

lightning-sunbird  0.9+nobinonly
nsHTMLEditor.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Daniel Glazman <glazman@netscape.com>
00024  *   Kathleen Brade <brade@netscape.com>
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either of the GNU General Public License Version 2 or later (the "GPL"),
00028  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 
00040 #ifndef nsHTMLEditor_h__
00041 #define nsHTMLEditor_h__
00042 
00043 #include "nsCOMPtr.h"
00044 #include "nsCOMArray.h"
00045 #include "nsPlaintextEditor.h"
00046 #include "nsIEditor.h"
00047 #include "nsIHTMLEditor.h"
00048 #include "nsITableEditor.h"
00049 #include "nsIEditorMailSupport.h"
00050 #include "nsIEditorStyleSheets.h"
00051 #include "nsITextServicesDocument.h"
00052 
00053 #include "nsEditor.h"
00054 #include "nsIDOMElement.h"
00055 #include "nsIDOMEventListener.h"
00056 #include "nsICSSLoader.h"
00057 #include "nsICSSLoaderObserver.h"
00058 #include "nsITableLayout.h"
00059 
00060 #include "nsEditRules.h"
00061 
00062 #include "nsEditProperty.h"
00063 #include "nsHTMLCSSUtils.h"
00064 
00065 #include "nsVoidArray.h"
00066 
00067 #include "nsHTMLObjectResizer.h"
00068 #include "nsIHTMLAbsPosEditor.h"
00069 #include "nsIHTMLInlineTableEditor.h"
00070 #include "nsIHTMLObjectResizeListener.h"
00071 
00072 #include "nsIDocumentObserver.h"
00073 
00074 #include "nsPoint.h"
00075 
00076 class nsIDOMKeyEvent;
00077 class nsITransferable;
00078 class nsIDOMEventReceiver;
00079 class nsIDOMNSRange;
00080 class nsIDocumentEncoder;
00081 class nsIClipboard;
00082 class TypeInState;
00083 class nsIContentFilter;
00084 class nsIURL;
00085 class nsIRangeUtils;
00086 class nsILinkHandler;
00087 
00092 class nsHTMLEditor : public nsPlaintextEditor,
00093                      public nsIHTMLEditor,
00094                      public nsIHTMLObjectResizer,
00095                      public nsIHTMLAbsPosEditor,
00096                      public nsITableEditor,
00097                      public nsIHTMLInlineTableEditor,
00098                      public nsIEditorStyleSheets,
00099                      public nsICSSLoaderObserver
00100 {
00101   typedef enum {eNoOp, eReplaceParent=1, eInsertParent=2} BlockTransformationType;
00102 
00103 public:
00104 
00105   enum OperationID
00106   {
00107     kOpInsertBreak         = 3000,
00108     kOpMakeList            = 3001,
00109     kOpIndent              = 3002,
00110     kOpOutdent             = 3003,
00111     kOpAlign               = 3004,
00112     kOpMakeBasicBlock      = 3005,
00113     kOpRemoveList          = 3006,
00114     kOpMakeDefListItem     = 3007,
00115     kOpInsertElement       = 3008,
00116     kOpInsertQuotation     = 3009,
00117     kOpSetTextProperty     = 3010,
00118     kOpRemoveTextProperty  = 3011,
00119     kOpHTMLPaste           = 3012,
00120     kOpLoadHTML            = 3013,
00121     kOpResetTextProperties = 3014,
00122     kOpSetAbsolutePosition = 3015,
00123     kOpRemoveAbsolutePosition = 3016,
00124     kOpDecreaseZIndex      = 3017,
00125     kOpIncreaseZIndex      = 3018
00126   };
00127 
00128   enum ResizingRequestID
00129   {
00130     kX      = 0,
00131     kY      = 1,
00132     kWidth  = 2,
00133     kHeight = 3
00134   };
00135 
00136   // see nsIHTMLEditor for documentation
00137 
00138 //Interfaces for addref and release and queryinterface
00139 //NOTE macro used is for classes that inherit from 
00140 // another class. Only the base class should use NS_DECL_ISUPPORTS
00141   NS_DECL_ISUPPORTS_INHERITED
00142 
00143 
00144            nsHTMLEditor();
00145   virtual  ~nsHTMLEditor();
00146 
00147   /* ------------ nsPlaintextEditor overrides -------------- */
00148   NS_IMETHODIMP HandleKeyPress(nsIDOMKeyEvent* aKeyEvent);
00149   NS_IMETHOD GetIsDocumentEditable(PRBool *aIsDocumentEditable);
00150   NS_IMETHODIMP BeginningOfDocument();
00151 
00152   /* ------------ nsIHTMLEditor methods -------------- */
00153 
00154   NS_DECL_NSIHTMLEDITOR
00155 
00156   /* ------------ nsIHTMLObjectResizer methods -------------- */
00157   /* -------- Implemented in nsHTMLObjectResizer.cpp -------- */
00158   NS_DECL_NSIHTMLOBJECTRESIZER
00159 
00160   /* ------------ nsIHTMLAbsPosEditor methods -------------- */
00161   /* -------- Implemented in nsHTMLAbsPosition.cpp --------- */
00162   NS_DECL_NSIHTMLABSPOSEDITOR
00163 
00164   /* ------------ nsIHTMLInlineTableEditor methods -------------- */
00165   /* ------- Implemented in nsHTMLInlineTableEditor.cpp --------- */
00166   NS_DECL_NSIHTMLINLINETABLEEDITOR
00167 
00168   /* ------------ nsIHTMLEditor methods -------------- */
00169   NS_IMETHOD CopyLastEditableChildStyles(nsIDOMNode *aPreviousBlock, nsIDOMNode *aNewBlock,
00170                                          nsIDOMNode **aOutBrNode);
00171 
00172   NS_IMETHOD LoadHTML(const nsAString &aInputString);
00173 
00174   NS_IMETHOD GetParentBlockTags(nsStringArray *aTagList, PRBool aGetLists);
00175 
00176   nsresult GetCSSBackgroundColorState(PRBool *aMixed, nsAString &aOutColor,
00177                                       PRBool aBlockLevel);
00178   NS_IMETHOD GetHTMLBackgroundColorState(PRBool *aMixed, nsAString &outColor);
00179   NS_IMETHOD GetHighlightColor(PRBool *mixed, PRUnichar **_retval);
00180 
00181   NS_IMETHOD GetNextElementByTagName(nsIDOMElement *aCurrentElement, const nsAString *aTagName, nsIDOMElement **aReturn);
00182 
00183   /* ------------ nsIEditorStyleSheets methods -------------- */
00184 
00185   NS_IMETHOD AddStyleSheet(const nsAString & aURL);
00186   NS_IMETHOD ReplaceStyleSheet(const nsAString& aURL);
00187   NS_IMETHOD RemoveStyleSheet(const nsAString &aURL);
00188 
00189   NS_IMETHOD AddOverrideStyleSheet(const nsAString & aURL);
00190   NS_IMETHOD ReplaceOverrideStyleSheet(const nsAString& aURL);
00191   NS_IMETHOD RemoveOverrideStyleSheet(const nsAString &aURL);
00192 
00193   NS_IMETHOD EnableStyleSheet(const nsAString& aURL, PRBool aEnable);
00194 
00195   /* ------------ nsIEditorMailSupport methods -------------- */
00196 
00197   NS_DECL_NSIEDITORMAILSUPPORT
00198 
00199   /* ------------ nsITableEditor methods -------------- */
00200 
00201   NS_IMETHOD InsertTableCell(PRInt32 aNumber, PRBool aAfter);
00202   NS_IMETHOD InsertTableColumn(PRInt32 aNumber, PRBool aAfter);
00203   NS_IMETHOD InsertTableRow(PRInt32 aNumber, PRBool aAfter);
00204   NS_IMETHOD DeleteTable();
00205   NS_IMETHOD DeleteTableCell(PRInt32 aNumber);
00206   NS_IMETHOD DeleteTableCellContents();
00207   NS_IMETHOD DeleteTableColumn(PRInt32 aNumber);
00208   NS_IMETHOD DeleteTableRow(PRInt32 aNumber);
00209   NS_IMETHOD SelectTableCell();
00210   NS_IMETHOD SelectBlockOfCells(nsIDOMElement *aStartCell, nsIDOMElement *aEndCell);
00211   NS_IMETHOD SelectTableRow();
00212   NS_IMETHOD SelectTableColumn();
00213   NS_IMETHOD SelectTable();
00214   NS_IMETHOD SelectAllTableCells();
00215   NS_IMETHOD SwitchTableCellHeaderType(nsIDOMElement *aSourceCell, nsIDOMElement **aNewCell);
00216   NS_IMETHOD JoinTableCells(PRBool aMergeNonContiguousContents);
00217   NS_IMETHOD SplitTableCell();
00218   NS_IMETHOD NormalizeTable(nsIDOMElement *aTable);
00219   NS_IMETHOD GetCellIndexes(nsIDOMElement *aCell,
00220                             PRInt32* aRowIndex, PRInt32* aColIndex);
00221   NS_IMETHOD GetTableSize(nsIDOMElement *aTable,
00222                           PRInt32* aRowCount, PRInt32* aColCount);
00223   NS_IMETHOD GetCellAt(nsIDOMElement* aTable, PRInt32 aRowIndex, PRInt32 aColIndex, nsIDOMElement **aCell);
00224   NS_IMETHOD GetCellDataAt(nsIDOMElement* aTable,
00225                            PRInt32 aRowIndex, PRInt32 aColIndex,
00226                            nsIDOMElement **aCell,
00227                            PRInt32* aStartRowIndex, PRInt32* aStartColIndex,
00228                            PRInt32* aRowSpan, PRInt32* aColSpan, 
00229                            PRInt32* aActualRowSpan, PRInt32* aActualColSpan, 
00230                            PRBool* aIsSelected);
00231   NS_IMETHOD GetFirstRow(nsIDOMElement* aTableElement, nsIDOMNode** aRowNode);
00232   NS_IMETHOD GetNextRow(nsIDOMNode* aCurrentRowNode, nsIDOMNode** aRowNode);
00233   NS_IMETHOD GetFirstCellInRow(nsIDOMNode* aRowNode, nsIDOMNode** aCellNode);
00234   NS_IMETHOD GetNextCellInRow(nsIDOMNode* aCurrentCellNode, nsIDOMNode** aRowNode);
00235   NS_IMETHOD GetLastCellInRow(nsIDOMNode* aRowNode, nsIDOMNode** aCellNode);
00236 
00237   NS_IMETHOD SetSelectionAfterTableEdit(nsIDOMElement* aTable, PRInt32 aRow, PRInt32 aCol, 
00238                                         PRInt32 aDirection, PRBool aSelected);
00239   NS_IMETHOD GetSelectedOrParentTableElement(nsAString& aTagName,
00240                                              PRInt32 *aSelectedCount,
00241                                              nsIDOMElement** aTableElement);
00242   NS_IMETHOD GetSelectedCellsType(nsIDOMElement *aElement, PRUint32 *aSelectionType);
00243 
00244   nsresult GetCellFromRange(nsIDOMRange *aRange, nsIDOMElement **aCell);
00245 
00246   // Finds the first selected cell in first range of selection
00247   // This is in the *order of selection*, not order in the table
00248   // (i.e., each cell added to selection is added in another range 
00249   //  in the selection's rangelist, independent of location in table)
00250   // aRange is optional: returns the range around the cell
00251   NS_IMETHOD GetFirstSelectedCell(nsIDOMRange **aRange, nsIDOMElement **aCell);
00252   // Get next cell until no more are found. Always use GetFirstSelected cell first
00253   // aRange is optional: returns the range around the cell
00254   NS_IMETHOD GetNextSelectedCell(nsIDOMRange **aRange, nsIDOMElement **aCell);
00255 
00256   // Upper-left-most selected cell in table
00257   NS_IMETHOD GetFirstSelectedCellInTable(PRInt32 *aRowIndex, PRInt32 *aColIndex, nsIDOMElement **aCell);
00258     
00259   /* miscellaneous */
00260   // This sets background on the appropriate container element (table, cell,)
00261   //   or calls into nsTextEditor to set the page background
00262   NS_IMETHOD SetCSSBackgroundColor(const nsAString& aColor);
00263   NS_IMETHOD SetHTMLBackgroundColor(const nsAString& aColor);
00264 
00265   /* ------------ Block methods moved from nsEditor -------------- */
00266   static nsCOMPtr<nsIDOMNode> GetBlockNodeParent(nsIDOMNode *aNode);
00267   static PRBool HasSameBlockNodeParent(nsIDOMNode *aNode1, nsIDOMNode *aNode2);
00285   static nsresult GetBlockSection(nsIDOMNode  *aNode,
00286                                   nsIDOMNode **aLeftNode, 
00287                                   nsIDOMNode **aRightNode);
00288 
00298   static nsresult GetBlockSectionsForRange(nsIDOMRange      *aRange, 
00299                                            nsCOMArray<nsIDOMRange>& aSections);
00300 
00301   static nsCOMPtr<nsIDOMNode> NextNodeInBlock(nsIDOMNode *aNode, IterDirection aDir);
00302   nsresult IsNextCharWhitespace(nsIDOMNode *aParentNode, 
00303                                 PRInt32 aOffset, 
00304                                 PRBool *outIsSpace, 
00305                                 PRBool *outIsNBSP,
00306                                 nsCOMPtr<nsIDOMNode> *outNode = 0,
00307                                 PRInt32 *outOffset = 0);
00308   nsresult IsPrevCharWhitespace(nsIDOMNode *aParentNode, 
00309                                 PRInt32 aOffset, 
00310                                 PRBool *outIsSpace, 
00311                                 PRBool *outIsNBSP,
00312                                 nsCOMPtr<nsIDOMNode> *outNode = 0,
00313                                 PRInt32 *outOffset = 0);
00314 
00315   /* ------------ Overrides of nsEditor interface methods -------------- */
00316 
00317   nsresult EndUpdateViewBatch();
00318 
00320   NS_IMETHOD Init(nsIDOMDocument *aDoc, nsIPresShell *aPresShell,  nsIContent *aRoot, nsISelectionController *aSelCon, PRUint32 aFlags);
00321   
00323   static nsresult NodeIsBlockStatic(nsIDOMNode *aNode, PRBool *aIsBlock);
00324 
00325   NS_IMETHOD GetFlags(PRUint32 *aFlags);
00326   NS_IMETHOD SetFlags(PRUint32 aFlags);
00327 
00328   NS_IMETHOD Paste(PRInt32 aSelectionType);
00329   NS_IMETHOD CanPaste(PRInt32 aSelectionType, PRBool *aCanPaste);
00330 
00331   NS_IMETHOD DebugUnitTests(PRInt32 *outNumTests, PRInt32 *outNumTestsFailed);
00332 
00335   NS_IMETHOD StartOperation(PRInt32 opID, nsIEditor::EDirection aDirection);
00336 
00339   NS_IMETHOD EndOperation();
00340 
00342   virtual PRBool TagCanContainTag(const nsAString& aParentTag, const nsAString& aChildTag);
00343   
00345   NS_IMETHOD SelectEntireDocument(nsISelection *aSelection);
00346 
00347   NS_IMETHOD SetAttributeOrEquivalent(nsIDOMElement * aElement,
00348                                       const nsAString & aAttribute,
00349                                       const nsAString & aValue,
00350                                       PRBool aSuppressTransaction);
00351   NS_IMETHOD RemoveAttributeOrEquivalent(nsIDOMElement * aElement,
00352                                          const nsAString & aAttribute,
00353                                          PRBool aSuppressTransaction);
00354 
00356   NS_IMETHOD CollapseAdjacentTextNodes(nsIDOMRange *aInRange);
00357 
00358   virtual PRBool NodesSameType(nsIDOMNode *aNode1, nsIDOMNode *aNode2);
00359 
00360   NS_IMETHODIMP DeleteNode(nsIDOMNode * aNode);
00361   NS_IMETHODIMP DeleteText(nsIDOMCharacterData *aTextNode,
00362                            PRUint32             aOffset,
00363                            PRUint32             aLength);
00364 
00365   /* ------------ nsICSSLoaderObserver -------------- */
00366   NS_IMETHOD StyleSheetLoaded(nsICSSStyleSheet*aSheet, PRBool aNotify);
00367 
00368   /* ------------ Utility Routines, not part of public API -------------- */
00369   NS_IMETHOD TypedText(const nsAString& aString, PRInt32 aAction);
00370   nsresult InsertNodeAtPoint( nsIDOMNode *aNode, 
00371                               nsCOMPtr<nsIDOMNode> *ioParent, 
00372                               PRInt32 *ioOffset, 
00373                               PRBool aNoEmptyNodes);
00374   nsCOMPtr<nsIDOMNode> FindUserSelectAllNode(nsIDOMNode *aNode);
00375                                 
00376 
00380   nsresult GetTextSelectionOffsets(nsISelection *aSelection,
00381                                    PRInt32 &aStartOffset, 
00382                                    PRInt32 &aEndOffset);
00383 
00384   nsresult GetAbsoluteOffsetsForPoints(nsIDOMNode *aInStartNode,
00385                                        PRInt32 aInStartOffset,
00386                                        nsIDOMNode *aInEndNode,
00387                                        PRInt32 aInEndOffset,
00388                                        nsIDOMNode *aInCommonParentNode,
00389                                        PRInt32 &aOutStartOffset, 
00390                                        PRInt32 &aEndOffset);
00391   
00392   // Use this to assure that selection is set after attribute nodes when 
00393   //  trying to collapse selection at begining of a block node
00394   //  e.g., when setting at beginning of a table cell
00395   // This will stop at a table, however, since we don't want to
00396   //  "drill down" into nested tables.
00397   // aSelection is optional -- if null, we get current seletion
00398   nsresult CollapseSelectionToDeepestNonTableFirstChild(nsISelection *aSelection, nsIDOMNode *aNode);
00399 
00400   virtual PRBool IsTextInDirtyFrameVisible(nsIDOMNode *aNode);
00401 
00402   nsresult IsVisTextNode( nsIDOMNode *aNode, 
00403                           PRBool *outIsEmptyNode, 
00404                           PRBool aSafeToAskFrames);
00405   nsresult IsEmptyNode(nsIDOMNode *aNode, PRBool *outIsEmptyBlock, 
00406                        PRBool aMozBRDoesntCount = PR_FALSE,
00407                        PRBool aListOrCellNotEmpty = PR_FALSE,
00408                        PRBool aSafeToAskFrames = PR_FALSE);
00409   nsresult IsEmptyNodeImpl(nsIDOMNode *aNode,
00410                            PRBool *outIsEmptyBlock, 
00411                            PRBool aMozBRDoesntCount,
00412                            PRBool aListOrCellNotEmpty,
00413                            PRBool aSafeToAskFrames,
00414                            PRBool *aSeenBR);
00415 
00416   // Stylesheet-related methods that aren't part of nsIEditorStyleSheets.
00417   nsresult AddCSSStyleSheet(nsICSSStyleSheet* aSheet);
00418   nsresult GetCSSLoader(const nsAString& aURL, nsICSSLoader** aCSSLoader);
00419 
00420   // Returns TRUE if sheet was loaded, false if it wasn't
00421   PRBool   EnableExistingStyleSheet(const nsAString& aURL);
00422 
00423   // Dealing with the internal style sheet lists:
00424   NS_IMETHOD GetStyleSheetForURL(const nsAString &aURL,
00425                                nsICSSStyleSheet **_retval);
00426   NS_IMETHOD GetURLForStyleSheet(nsICSSStyleSheet *aStyleSheet, nsAString &aURL);
00427 
00428   // Add a url + known style sheet to the internal lists:
00429   nsresult AddNewStyleSheetToList(const nsAString &aURL,
00430                                   nsICSSStyleSheet *aStyleSheet);
00431 
00432   nsresult RemoveStyleSheetFromList(const nsAString &aURL);
00433                        
00434 protected:
00435 
00436   NS_IMETHOD  InitRules();
00437 
00438   // Create the event listeners for the editor to install
00439   virtual nsresult CreateEventListeners();
00440 
00441   virtual void RemoveEventListeners();
00442 
00449   NS_IMETHOD GetLayoutObject(nsIDOMNode *aInNode, nsISupports **aOutLayoutObject);
00450 
00451   // Return TRUE if aElement is a table-related elemet and caret was set
00452   PRBool SetCaretInTableCell(nsIDOMElement* aElement);
00453   PRBool IsElementInBody(nsIDOMElement* aElement);
00454 
00455   // inline style caching
00456   void ClearInlineStylesCache();
00457   
00458   // key event helpers
00459   NS_IMETHOD TabInTable(PRBool inIsShift, PRBool *outHandled);
00460   NS_IMETHOD CreateBR(nsIDOMNode *aNode, PRInt32 aOffset, 
00461                       nsCOMPtr<nsIDOMNode> *outBRNode, nsIEditor::EDirection aSelect = nsIEditor::eNone);
00462   NS_IMETHOD CreateBRImpl(nsCOMPtr<nsIDOMNode> *aInOutParent, 
00463                          PRInt32 *aInOutOffset, 
00464                          nsCOMPtr<nsIDOMNode> *outBRNode, 
00465                          nsIEditor::EDirection aSelect);
00466   NS_IMETHOD InsertBR(nsCOMPtr<nsIDOMNode> *outBRNode);
00467 
00468 // Table Editing (implemented in nsTableEditor.cpp)
00469 
00470   // Table utilities
00471 
00472   // Insert a new cell after or before supplied aCell. 
00473   //  Optional: If aNewCell supplied, returns the newly-created cell (addref'd, of course)
00474   // This doesn't change or use the current selection
00475   NS_IMETHOD InsertCell(nsIDOMElement *aCell, PRInt32 aRowSpan, PRInt32 aColSpan,
00476                         PRBool aAfter, PRBool aIsHeader, nsIDOMElement **aNewCell);
00477 
00478   // Helpers that don't touch the selection or do batch transactions
00479   NS_IMETHOD DeleteRow(nsIDOMElement *aTable, PRInt32 aRowIndex);
00480   NS_IMETHOD DeleteColumn(nsIDOMElement *aTable, PRInt32 aColIndex);
00481   NS_IMETHOD DeleteCellContents(nsIDOMElement *aCell);
00482 
00483   // Move all contents from aCellToMerge into aTargetCell (append at end)
00484   NS_IMETHOD MergeCells(nsCOMPtr<nsIDOMElement> aTargetCell, nsCOMPtr<nsIDOMElement> aCellToMerge, PRBool aDeleteCellToMerge);
00485 
00486   NS_IMETHOD DeleteTable2(nsIDOMElement *aTable, nsISelection *aSelection);
00487   NS_IMETHOD SetColSpan(nsIDOMElement *aCell, PRInt32 aColSpan);
00488   NS_IMETHOD SetRowSpan(nsIDOMElement *aCell, PRInt32 aRowSpan);
00489 
00490   // Helper used to get nsITableLayout interface for methods implemented in nsTableFrame
00491   NS_IMETHOD GetTableLayoutObject(nsIDOMElement* aTable, nsITableLayout **tableLayoutObject);
00492   // Needed to do appropriate deleting when last cell or row is about to be deleted
00493   // This doesn't count cells that don't start in the given row (are spanning from row above)
00494   PRInt32  GetNumberOfCellsInRow(nsIDOMElement* aTable, PRInt32 rowIndex);
00495   // Test if all cells in row or column at given index are selected
00496   PRBool AllCellsInRowSelected(nsIDOMElement *aTable, PRInt32 aRowIndex, PRInt32 aNumberOfColumns);
00497   PRBool AllCellsInColumnSelected(nsIDOMElement *aTable, PRInt32 aColIndex, PRInt32 aNumberOfRows);
00498 
00499   PRBool   IsEmptyCell(nsIDOMElement *aCell);
00500 
00501   // Most insert methods need to get the same basic context data
00502   // Any of the pointers may be null if you don't need that datum (for more efficiency)
00503   // Input: *aCell is a known cell,
00504   //        if null, cell is obtained from the anchor node of the selection
00505   // Returns NS_EDITOR_ELEMENT_NOT_FOUND if cell is not found even if aCell is null
00506   NS_IMETHOD GetCellContext(nsISelection **aSelection,
00507                             nsIDOMElement   **aTable,
00508                             nsIDOMElement   **aCell,
00509                             nsIDOMNode      **aCellParent, PRInt32 *aCellOffset,
00510                             PRInt32 *aRowIndex, PRInt32 *aColIndex);
00511 
00512   NS_IMETHOD GetCellSpansAt(nsIDOMElement* aTable, PRInt32 aRowIndex, PRInt32 aColIndex, 
00513                             PRInt32& aActualRowSpan, PRInt32& aActualColSpan);
00514 
00515   NS_IMETHOD SplitCellIntoColumns(nsIDOMElement *aTable, PRInt32 aRowIndex, PRInt32 aColIndex,
00516                                   PRInt32 aColSpanLeft, PRInt32 aColSpanRight, nsIDOMElement **aNewCell);
00517 
00518   NS_IMETHOD SplitCellIntoRows(nsIDOMElement *aTable, PRInt32 aRowIndex, PRInt32 aColIndex,
00519                                PRInt32 aRowSpanAbove, PRInt32 aRowSpanBelow, nsIDOMElement **aNewCell);
00520 
00521   nsresult CopyCellBackgroundColor(nsIDOMElement *destCell, nsIDOMElement *sourceCell);
00522 
00523   // Reduce rowspan/colspan when cells span into non-existent rows/columns
00524   NS_IMETHOD FixBadRowSpan(nsIDOMElement *aTable, PRInt32 aRowIndex, PRInt32& aNewRowCount);
00525   NS_IMETHOD FixBadColSpan(nsIDOMElement *aTable, PRInt32 aColIndex, PRInt32& aNewColCount);
00526 
00527   // Fallback method: Call this after using ClearSelection() and you
00528   //  failed to set selection to some other content in the document
00529   NS_IMETHOD SetSelectionAtDocumentStart(nsISelection *aSelection);
00530 
00531 // End of Table Editing utilities
00532   
00533   NS_IMETHOD IsRootTag(nsString &aTag, PRBool &aIsTag);
00534 
00535   NS_IMETHOD IsSubordinateBlock(nsString &aTag, PRBool &aIsTag);
00536 
00537   virtual PRBool IsBlockNode(nsIDOMNode *aNode);
00538   
00539   static nsCOMPtr<nsIDOMNode> GetEnclosingTable(nsIDOMNode *aNode);
00540 
00556   virtual void IsTextPropertySetByContent(nsIDOMNode        *aNode,
00557                                           nsIAtom           *aProperty, 
00558                                           const nsAString   *aAttribute,
00559                                           const nsAString   *aValue,
00560                                           PRBool            &aIsSet,
00561                                           nsIDOMNode       **aStyleNode,
00562                                           nsAString *outValue = nsnull);
00563 
00564   void ResetTextSelectionForRange(nsIDOMNode *aParent,
00565                                   PRInt32     aStartOffset,
00566                                   PRInt32     aEndOffset,
00567                                   nsISelection *aSelection);
00568 
00569   // Methods for handling plaintext quotations
00570   NS_IMETHOD PasteAsPlaintextQuotation(PRInt32 aSelectionType);
00571 
00581   NS_IMETHOD InsertAsPlaintextQuotation(const nsAString & aQuotedText,
00582                                         PRBool aAddCites,
00583                                         nsIDOMNode **aNodeInserted);
00584 
00585   // factored methods for handling insertion of data from transferables (drag&drop or clipboard)
00586   NS_IMETHOD PrepareTransferable(nsITransferable **transferable);
00587   NS_IMETHOD PrepareHTMLTransferable(nsITransferable **transferable, PRBool havePrivFlavor);
00588   nsresult   PutDragDataInTransferable(nsITransferable **aTransferable);
00589   NS_IMETHOD InsertFromTransferable(nsITransferable *transferable, 
00590                                     nsIDOMDocument *aSourceDoc,
00591                                     const nsAString & aContextStr,
00592                                     const nsAString & aInfoStr,
00593                                     nsIDOMNode *aDestinationNode,
00594                                     PRInt32 aDestinationOffset,
00595                                     PRBool aDoDeleteSelection);
00596   PRBool HavePrivateHTMLFlavor( nsIClipboard *clipboard );
00597   nsresult   ParseCFHTML(nsCString & aCfhtml, PRUnichar **aStuffToPaste, PRUnichar **aCfcontext);
00598   nsresult   DoContentFilterCallback(const nsAString &aFlavor,
00599                                      nsIDOMDocument *aSourceDoc,
00600                                      PRBool aWillDeleteSelection,
00601                                      nsIDOMNode **aFragmentAsNode,      
00602                                      nsIDOMNode **aFragStartNode,
00603                                      PRInt32 *aFragStartOffset,
00604                                      nsIDOMNode **aFragEndNode,
00605                                      PRInt32 *aFragEndOffset,
00606                                      nsIDOMNode **aTargetNode,       
00607                                      PRInt32 *aTargetOffset,   
00608                                      PRBool *aDoContinue);
00609   nsresult   RelativizeURIInFragmentList(nsCOMArray<nsIDOMNode> aNodeList,
00610                                         const nsAString &aFlavor,
00611                                         nsIDOMDocument *aSourceDoc,
00612                                         nsIDOMNode *aTargetNode);
00613   nsresult   RelativizeURIForNode(nsIDOMNode *aNode, nsIURL *aDestURL);
00614   nsresult   GetAttributeToModifyOnNode(nsIDOMNode *aNode, nsAString &aAttrib);
00615 
00616   PRBool     IsInLink(nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *outLink = nsnull);
00617   nsresult   StripFormattingNodes(nsIDOMNode *aNode, PRBool aOnlyList = PR_FALSE);
00618   nsresult   CreateDOMFragmentFromPaste(const nsAString & aInputString,
00619                                         const nsAString & aContextStr,
00620                                         const nsAString & aInfoStr,
00621                                         nsCOMPtr<nsIDOMNode> *outFragNode,
00622                                         PRInt32 *outRangeStartHint,
00623                                         PRInt32 *outRangeEndHint);
00624   nsresult   ParseFragment(const nsAString & aStr, nsVoidArray &aTagStack,
00625                            nsIDocument* aTargetDoc,
00626                            nsCOMPtr<nsIDOMNode> *outNode);
00627   nsresult   CreateListOfNodesToPaste(nsIDOMNode  *aFragmentAsNode,
00628                                       nsCOMArray<nsIDOMNode>& outNodeList,
00629                                       nsIDOMNode *aStartNode,
00630                                       PRInt32 aStartOffset,
00631                                       nsIDOMNode *aEndNode,
00632                                       PRInt32 aEndOffset);
00633   nsresult CreateTagStack(nsVoidArray &aTagStack, nsIDOMNode *aNode);
00634   void     FreeTagStackStrings(nsVoidArray &tagStack);
00635   nsresult GetListAndTableParents( PRBool aEnd, 
00636                                    nsCOMArray<nsIDOMNode>& aListOfNodes,
00637                                    nsCOMArray<nsIDOMNode>& outArray);
00638   nsresult DiscoverPartialListsAndTables(nsCOMArray<nsIDOMNode>& aPasteNodes,
00639                                          nsCOMArray<nsIDOMNode>& aListsAndTables,
00640                                          PRInt32 *outHighWaterMark);
00641   nsresult ScanForListAndTableStructure(PRBool aEnd,
00642                                         nsCOMArray<nsIDOMNode>& aNodes,
00643                                         nsIDOMNode *aListOrTable,
00644                                         nsCOMPtr<nsIDOMNode> *outReplaceNode);
00645   nsresult ReplaceOrphanedStructure( PRBool aEnd,
00646                                      nsCOMArray<nsIDOMNode>& aNodeArray,
00647                                      nsCOMArray<nsIDOMNode>& aListAndTableArray,
00648                                      PRInt32 aHighWaterMark);
00649   nsIDOMNode* GetArrayEndpoint(PRBool aEnd, nsCOMArray<nsIDOMNode>& aNodeArray);
00650 
00651   /* small utility routine to test if a break node is visible to user */
00652   PRBool   IsVisBreak(nsIDOMNode *aNode);
00653 
00654   /* utility routine to possibly adjust the insertion position when 
00655      inserting a block level element */
00656   void NormalizeEOLInsertPosition(nsIDOMNode *firstNodeToInsert,
00657                                   nsCOMPtr<nsIDOMNode> *insertParentNode,
00658                                   PRInt32 *insertOffset);
00659 
00660   /* small utility routine to test the eEditorReadonly bit */
00661   PRBool IsModifiable();
00662 
00663   /* helpers for block transformations */
00664   nsresult MakeDefinitionItem(const nsAString & aItemType);
00665   nsresult InsertBasicBlock(const nsAString & aBlockType);
00666   
00667   /* increase/decrease the font size of selection */
00668   nsresult RelativeFontChange( PRInt32 aSizeChange);
00669   
00670   /* helper routines for font size changing */
00671   nsresult RelativeFontChangeOnTextNode( PRInt32 aSizeChange, 
00672                                          nsIDOMCharacterData *aTextNode, 
00673                                          PRInt32 aStartOffset,
00674                                          PRInt32 aEndOffset);
00675   nsresult RelativeFontChangeOnNode( PRInt32 aSizeChange, 
00676                                      nsIDOMNode *aNode);
00677   nsresult RelativeFontChangeHelper( PRInt32 aSizeChange, 
00678                                      nsIDOMNode *aNode);
00679 
00680   /* helper routines for inline style */
00681   nsresult SetInlinePropertyOnTextNode( nsIDOMCharacterData *aTextNode, 
00682                                         PRInt32 aStartOffset,
00683                                         PRInt32 aEndOffset,
00684                                         nsIAtom *aProperty, 
00685                                         const nsAString *aAttribute,
00686                                         const nsAString *aValue);
00687   nsresult SetInlinePropertyOnNode( nsIDOMNode *aNode,
00688                                     nsIAtom *aProperty, 
00689                                     const nsAString *aAttribute,
00690                                     const nsAString *aValue);
00691 
00692   nsresult PromoteInlineRange(nsIDOMRange *inRange);
00693   nsresult PromoteRangeIfStartsOrEndsInNamedAnchor(nsIDOMRange *inRange);
00694   nsresult SplitStyleAboveRange(nsIDOMRange *aRange, 
00695                                 nsIAtom *aProperty, 
00696                                 const nsAString *aAttribute);
00697   nsresult SplitStyleAbovePoint(nsCOMPtr<nsIDOMNode> *aNode,
00698                                 PRInt32 *aOffset,
00699                                 nsIAtom *aProperty, 
00700                                 const nsAString *aAttribute,
00701                                 nsCOMPtr<nsIDOMNode> *outLeftNode = nsnull,
00702                                 nsCOMPtr<nsIDOMNode> *outRightNode = nsnull);
00703   nsresult ApplyDefaultProperties();
00704   nsresult RemoveStyleInside(nsIDOMNode *aNode, 
00705                              nsIAtom *aProperty, 
00706                              const nsAString *aAttribute, 
00707                              PRBool aChildrenOnly = PR_FALSE);
00708   nsresult RemoveInlinePropertyImpl(nsIAtom *aProperty, const nsAString *aAttribute);
00709 
00710   PRBool NodeIsProperty(nsIDOMNode *aNode);
00711   PRBool HasAttr(nsIDOMNode *aNode, const nsAString *aAttribute);
00712   PRBool HasAttrVal(nsIDOMNode *aNode, const nsAString *aAttribute, const nsAString *aValue);
00713   PRBool IsAtFrontOfNode(nsIDOMNode *aNode, PRInt32 aOffset);
00714   PRBool IsAtEndOfNode(nsIDOMNode *aNode, PRInt32 aOffset);
00715   PRBool IsOnlyAttribute(nsIDOMNode *aElement, const nsAString *aAttribute);
00716 
00717   nsresult RemoveBlockContainer(nsIDOMNode *inNode);
00718   nsresult GetPriorHTMLSibling(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode);
00719   nsresult GetPriorHTMLSibling(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode);
00720   nsresult GetNextHTMLSibling(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode);
00721   nsresult GetNextHTMLSibling(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode);
00722   nsresult GetPriorHTMLNode(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode, PRBool bNoBlockCrossing = PR_FALSE);
00723   nsresult GetPriorHTMLNode(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode, PRBool bNoBlockCrossing = PR_FALSE);
00724   nsresult GetNextHTMLNode(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode, PRBool bNoBlockCrossing = PR_FALSE);
00725   nsresult GetNextHTMLNode(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode, PRBool bNoBlockCrossing = PR_FALSE);
00726 
00727   nsresult IsFirstEditableChild( nsIDOMNode *aNode, PRBool *aOutIsFirst);
00728   nsresult IsLastEditableChild( nsIDOMNode *aNode, PRBool *aOutIsLast);
00729   nsresult GetFirstEditableChild( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutFirstChild);
00730   nsresult GetLastEditableChild( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutLastChild);
00731 
00732   nsresult GetFirstEditableLeaf( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutFirstLeaf);
00733   nsresult GetLastEditableLeaf( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutLastLeaf);
00734 
00735   //XXX Kludge: Used to suppress spurious drag/drop events (bug 50703)
00736   PRBool   mIgnoreSpuriousDragEvent;
00737 
00738   nsresult GetInlinePropertyBase(nsIAtom *aProperty, 
00739                              const nsAString *aAttribute,
00740                              const nsAString *aValue,
00741                              PRBool *aFirst, 
00742                              PRBool *aAny, 
00743                              PRBool *aAll,
00744                              nsAString *outValue,
00745                              PRBool aCheckDefaults = PR_TRUE);
00746   nsresult HasStyleOrIdOrClass(nsIDOMElement * aElement, PRBool *aHasStyleOrIdOrClass);
00747   nsresult RemoveElementIfNoStyleOrIdOrClass(nsIDOMElement * aElement, nsIAtom * aTag);
00748 
00749 // Data members
00750 protected:
00751 
00752   nsCOMArray<nsIContentFilter> mContentFilters;
00753 
00754   TypeInState*         mTypeInState;
00755 
00756   nsCOMPtr<nsIDOMNode> mCachedNode;
00757 
00758   PRPackedBool mCRInParagraphCreatesParagraph;
00759 
00760   PRPackedBool mCSSAware;
00761   nsHTMLCSSUtils *mHTMLCSSUtils;
00762 
00763   // Used by GetFirstSelectedCell and GetNextSelectedCell
00764   PRInt32  mSelectedCellIndex;
00765 
00766   nsString mLastStyleSheetURL;
00767   nsString mLastOverrideStyleSheetURL;
00768 
00769   // Maintain a list of associated style sheets and their urls.
00770   nsStringArray mStyleSheetURLs;
00771   nsCOMArray<nsICSSStyleSheet> mStyleSheets;
00772   
00773   // an array for holding default style settings
00774   nsVoidArray mDefaultStyles;
00775 
00776    // for real-time spelling
00777    nsCOMPtr<nsITextServicesDocument> mTextServices;
00778 
00779   // And a static range utils service
00780   static nsIRangeUtils* sRangeHelper;
00781 
00782 public:
00783   // ... which means that we need to listen to shutdown
00784   static void Shutdown();
00785 
00786 protected:
00787 
00788   /* ANONYMOUS UTILS */
00789   void     RemoveListenerAndDeleteRef(const nsAString& aEvent,
00790                                       nsIDOMEventListener* aListener,
00791                                       PRBool aUseCapture,
00792                                       nsIDOMElement* aElement,
00793                                       nsIContent* aParentContent,
00794                                       nsIPresShell* aShell);
00795   void     DeleteRefToAnonymousNode(nsIDOMElement* aElement,
00796                                     nsIContent * aParentContent,
00797                                     nsIPresShell* aShell);
00798   nsresult GetElementOrigin(nsIDOMElement * aElement, PRInt32 & aX, PRInt32 & aY);
00799   nsresult GetPositionAndDimensions(nsIDOMElement * aElement,
00800                                     PRInt32 & aX, PRInt32 & aY,
00801                                     PRInt32 & aW, PRInt32 & aH,
00802                                     PRInt32 & aBorderLeft,
00803                                     PRInt32 & aBorderTop,
00804                                     PRInt32 & aMarginLeft,
00805                                     PRInt32 & aMarginTop);
00806 
00807   /* PACKED BOOLEANS FOR RESIZING, ABSOLUTE POSITIONING AND */
00808   /* INLINE TABLE EDITING */
00809 
00810   // resizing
00811   PRPackedBool mIsObjectResizingEnabled;
00812   PRPackedBool mIsResizing;
00813   PRPackedBool mPreserveRatio;
00814   PRPackedBool mResizedObjectIsAnImage;
00815 
00816   // absolute positioning
00817   PRPackedBool mIsAbsolutelyPositioningEnabled;
00818   PRPackedBool mResizedObjectIsAbsolutelyPositioned;
00819 
00820   PRPackedBool mGrabberClicked;
00821   PRPackedBool mIsMoving;
00822 
00823   PRPackedBool mSnapToGridEnabled;
00824 
00825   // inline table editing
00826   PRPackedBool mIsInlineTableEditingEnabled;
00827 
00828   /* RESIZING */
00829 
00830   nsCOMPtr<nsIDOMElement> mTopLeftHandle;
00831   nsCOMPtr<nsIDOMElement> mTopHandle;
00832   nsCOMPtr<nsIDOMElement> mTopRightHandle;
00833   nsCOMPtr<nsIDOMElement> mLeftHandle;
00834   nsCOMPtr<nsIDOMElement> mRightHandle;
00835   nsCOMPtr<nsIDOMElement> mBottomLeftHandle;
00836   nsCOMPtr<nsIDOMElement> mBottomHandle;
00837   nsCOMPtr<nsIDOMElement> mBottomRightHandle;
00838 
00839   nsCOMPtr<nsIDOMElement> mActivatedHandle;
00840 
00841   nsCOMPtr<nsIDOMElement> mResizingShadow;
00842   nsCOMPtr<nsIDOMElement> mResizingInfo;
00843 
00844   nsCOMPtr<nsIDOMElement> mResizedObject;
00845 
00846   nsCOMPtr<nsIDOMEventListener>  mMouseMotionListenerP;
00847   nsCOMPtr<nsISelectionListener> mSelectionListenerP;
00848   nsCOMPtr<nsIDOMEventListener>  mResizeEventListenerP;
00849 
00850   nsCOMArray<nsIHTMLObjectResizeListener> objectResizeEventListeners;
00851 
00852   PRInt32 mOriginalX;
00853   PRInt32 mOriginalY;
00854 
00855   PRInt32 mResizedObjectX;
00856   PRInt32 mResizedObjectY;
00857   PRInt32 mResizedObjectWidth;
00858   PRInt32 mResizedObjectHeight;
00859 
00860   PRInt32 mResizedObjectMarginLeft;
00861   PRInt32 mResizedObjectMarginTop;
00862   PRInt32 mResizedObjectBorderLeft;
00863   PRInt32 mResizedObjectBorderTop;
00864 
00865   PRInt32 mXIncrementFactor;
00866   PRInt32 mYIncrementFactor;
00867   PRInt32 mWidthIncrementFactor;
00868   PRInt32 mHeightIncrementFactor;
00869 
00870   PRInt8  mInfoXIncrement;
00871   PRInt8  mInfoYIncrement;
00872 
00873   nsresult SetAllResizersPosition();
00874 
00875   nsresult CreateResizer(nsIDOMElement ** aReturn, PRInt16 aLocation, nsIDOMNode * aParentNode);
00876   void     SetAnonymousElementPosition(PRInt32 aX, PRInt32 aY, nsIDOMElement *aResizer);
00877 
00878   nsresult CreateShadow(nsIDOMElement ** aReturn, nsIDOMNode * aParentNode,
00879                         nsIDOMElement * aOriginalObject);
00880   nsresult SetShadowPosition(nsIDOMElement * aShadow,
00881                              nsIDOMElement * aOriginalObject,
00882                              PRInt32 aOriginalObjectX,
00883                              PRInt32 aOriginalObjectY);
00884 
00885   nsresult CreateResizingInfo(nsIDOMElement ** aReturn, nsIDOMNode * aParentNode);
00886   nsresult SetResizingInfoPosition(PRInt32 aX, PRInt32 aY,
00887                                    PRInt32 aW, PRInt32 aH);
00888 
00889   PRInt32  GetNewResizingIncrement(PRInt32 aX, PRInt32 aY, PRInt32 aID);
00890   nsresult StartResizing(nsIDOMElement * aHandle);
00891   PRInt32  GetNewResizingX(PRInt32 aX, PRInt32 aY);
00892   PRInt32  GetNewResizingY(PRInt32 aX, PRInt32 aY);
00893   PRInt32  GetNewResizingWidth(PRInt32 aX, PRInt32 aY);
00894   PRInt32  GetNewResizingHeight(PRInt32 aX, PRInt32 aY);
00895   void     HideShadowAndInfo();
00896   void     SetFinalSize(PRInt32 aX, PRInt32 aY);
00897   void     DeleteRefToAnonymousNode(nsIDOMNode * aNode);
00898   void     SetResizeIncrements(PRInt32 aX, PRInt32 aY, PRInt32 aW, PRInt32 aH, PRBool aPreserveRatio);
00899   void     SetInfoIncrements(PRInt8 aX, PRInt8 aY);
00900 
00901   /* ABSOLUTE POSITIONING */
00902 
00903   PRInt32 mPositionedObjectX;
00904   PRInt32 mPositionedObjectY;
00905   PRInt32 mPositionedObjectWidth;
00906   PRInt32 mPositionedObjectHeight;
00907 
00908   PRInt32 mPositionedObjectMarginLeft;
00909   PRInt32 mPositionedObjectMarginTop;
00910   PRInt32 mPositionedObjectBorderLeft;
00911   PRInt32 mPositionedObjectBorderTop;
00912 
00913   nsCOMPtr<nsIDOMElement> mAbsolutelyPositionedObject;
00914   nsCOMPtr<nsIDOMElement> mGrabber;
00915   nsCOMPtr<nsIDOMElement> mPositioningShadow;
00916 
00917   PRInt32      mGridSize;
00918 
00919   nsresult CreateGrabber(nsIDOMNode * aParentNode, nsIDOMElement ** aReturn);
00920   nsresult StartMoving(nsIDOMElement * aHandle);
00921   nsresult SetFinalPosition(PRInt32 aX, PRInt32 aY);
00922   void     AddPositioningOffet(PRInt32 & aX, PRInt32 & aY);
00923   void     SnapToGrid(PRInt32 & newX, PRInt32 & newY);
00924   nsresult GrabberClicked();
00925   nsresult EndMoving();
00926   nsresult CheckPositionedElementBGandFG(nsIDOMElement * aElement,
00927                                          nsAString & aReturn);
00928 
00929   /* INLINE TABLE EDITING */
00930 
00931   nsCOMPtr<nsIDOMElement> mInlineEditedCell;
00932 
00933   nsCOMPtr<nsIDOMElement> mAddColumnBeforeButton;
00934   nsCOMPtr<nsIDOMElement> mRemoveColumnButton;
00935   nsCOMPtr<nsIDOMElement> mAddColumnAfterButton;
00936 
00937   nsCOMPtr<nsIDOMElement> mAddRowBeforeButton;
00938   nsCOMPtr<nsIDOMElement> mRemoveRowButton;
00939   nsCOMPtr<nsIDOMElement> mAddRowAfterButton;
00940 
00941   void     AddMouseClickListener(nsIDOMElement * aElement);
00942   void     RemoveMouseClickListener(nsIDOMElement * aElement);
00943 
00944   nsCOMPtr<nsILinkHandler> mLinkHandler;
00945 
00946 public:
00947 
00948 // friends
00949 friend class nsHTMLEditRules;
00950 friend class nsTextEditRules;
00951 friend class nsWSRunObject;
00952 
00953 };
00954 #endif //nsHTMLEditor_h__
00955