CLOSED TREE: TraceMonkey merge head. (a=blockers)
[mozilla-central.git] / editor / libeditor / html / nsHTMLEditor.h
blob628556011258eeb200beec775030de6481b8844f
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
23 * Daniel Glazman <glazman@netscape.com>
24 * Kathleen Brade <brade@netscape.com>
26 * Alternatively, the contents of this file may be used under the terms of
27 * either of the GNU General Public License Version 2 or later (the "GPL"),
28 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
38 * ***** END LICENSE BLOCK ***** */
40 #ifndef nsHTMLEditor_h__
41 #define nsHTMLEditor_h__
43 #include "nsCOMPtr.h"
44 #include "nsCOMArray.h"
45 #include "nsPlaintextEditor.h"
46 #include "nsIEditor.h"
47 #include "nsIHTMLEditor.h"
48 #include "nsIHTMLEditor_MOZILLA_2_0_BRANCH.h"
49 #include "nsITableEditor.h"
50 #include "nsIEditorMailSupport.h"
51 #include "nsIEditorStyleSheets.h"
52 #include "nsITextServicesDocument.h"
54 #include "nsEditor.h"
55 #include "nsIDOMElement.h"
56 #include "nsIDOMEventListener.h"
57 #include "nsICSSLoaderObserver.h"
58 #include "nsITableLayout.h"
60 #include "nsEditRules.h"
62 #include "nsEditProperty.h"
63 #include "nsHTMLCSSUtils.h"
65 #include "nsHTMLObjectResizer.h"
66 #include "nsIHTMLAbsPosEditor.h"
67 #include "nsIHTMLInlineTableEditor.h"
68 #include "nsIHTMLObjectResizeListener.h"
70 #include "nsIDocumentObserver.h"
72 #include "nsPoint.h"
73 #include "nsTArray.h"
74 #include "nsAutoPtr.h"
76 class nsIDOMKeyEvent;
77 class nsITransferable;
78 class nsIDOMNSRange;
79 class nsIDocumentEncoder;
80 class nsIClipboard;
81 class TypeInState;
82 class nsIContentFilter;
83 class nsIURL;
84 class nsIRangeUtils;
85 class nsILinkHandler;
86 struct PropItem;
88 /**
89 * The HTML editor implementation.<br>
90 * Use to edit HTML document represented as a DOM tree.
92 class nsHTMLEditor : public nsPlaintextEditor,
93 public nsIHTMLEditor,
94 public nsIHTMLEditor_MOZILLA_2_0_BRANCH,
95 public nsIHTMLObjectResizer,
96 public nsIHTMLAbsPosEditor,
97 public nsITableEditor,
98 public nsIHTMLInlineTableEditor,
99 public nsIEditorStyleSheets,
100 public nsICSSLoaderObserver,
101 public nsStubMutationObserver
103 typedef enum {eNoOp, eReplaceParent=1, eInsertParent=2} BlockTransformationType;
105 public:
107 enum OperationID
109 kOpInsertBreak = 3000,
110 kOpMakeList = 3001,
111 kOpIndent = 3002,
112 kOpOutdent = 3003,
113 kOpAlign = 3004,
114 kOpMakeBasicBlock = 3005,
115 kOpRemoveList = 3006,
116 kOpMakeDefListItem = 3007,
117 kOpInsertElement = 3008,
118 kOpInsertQuotation = 3009,
119 kOpSetTextProperty = 3010,
120 kOpRemoveTextProperty = 3011,
121 kOpHTMLPaste = 3012,
122 kOpLoadHTML = 3013,
123 kOpResetTextProperties = 3014,
124 kOpSetAbsolutePosition = 3015,
125 kOpRemoveAbsolutePosition = 3016,
126 kOpDecreaseZIndex = 3017,
127 kOpIncreaseZIndex = 3018
130 enum ResizingRequestID
132 kX = 0,
133 kY = 1,
134 kWidth = 2,
135 kHeight = 3
138 // see nsIHTMLEditor for documentation
140 //Interfaces for addref and release and queryinterface
141 //NOTE macro used is for classes that inherit from
142 // another class. Only the base class should use NS_DECL_ISUPPORTS
143 NS_DECL_ISUPPORTS_INHERITED
146 nsHTMLEditor();
147 virtual ~nsHTMLEditor();
149 /* ------------ nsPlaintextEditor overrides -------------- */
150 NS_IMETHOD GetIsDocumentEditable(PRBool *aIsDocumentEditable);
151 NS_IMETHOD BeginningOfDocument();
152 virtual nsresult HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent);
153 virtual already_AddRefed<nsIContent> GetFocusedContent();
154 virtual PRBool IsActiveInDOMWindow();
155 virtual already_AddRefed<nsPIDOMEventTarget> GetPIDOMEventTarget();
156 virtual already_AddRefed<nsIContent> FindSelectionRoot(nsINode *aNode);
157 virtual PRBool IsAcceptableInputEvent(nsIDOMEvent* aEvent);
159 /* ------------ nsStubMutationObserver overrides --------- */
160 NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
161 NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
162 NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
164 /* ------------ nsIEditorIMESupport overrides ------------ */
165 NS_IMETHOD GetPreferredIMEState(PRUint32 *aState);
167 /* ------------ nsIHTMLEditor methods -------------- */
169 NS_DECL_NSIHTMLEDITOR
171 /* ------------ nsIHTMLEditor_MOZILLA_2_0_BRANCH methods -------------- */
173 NS_DECL_NSIHTMLEDITOR_MOZILLA_2_0_BRANCH
175 /* ------------ nsIHTMLObjectResizer methods -------------- */
176 /* -------- Implemented in nsHTMLObjectResizer.cpp -------- */
177 NS_DECL_NSIHTMLOBJECTRESIZER
179 /* ------------ nsIHTMLAbsPosEditor methods -------------- */
180 /* -------- Implemented in nsHTMLAbsPosition.cpp --------- */
181 NS_DECL_NSIHTMLABSPOSEDITOR
183 /* ------------ nsIHTMLInlineTableEditor methods -------------- */
184 /* ------- Implemented in nsHTMLInlineTableEditor.cpp --------- */
185 NS_DECL_NSIHTMLINLINETABLEEDITOR
187 /* ------------ nsIHTMLEditor methods -------------- */
188 NS_IMETHOD CopyLastEditableChildStyles(nsIDOMNode *aPreviousBlock, nsIDOMNode *aNewBlock,
189 nsIDOMNode **aOutBrNode);
191 NS_IMETHOD LoadHTML(const nsAString &aInputString);
193 nsresult GetCSSBackgroundColorState(PRBool *aMixed, nsAString &aOutColor,
194 PRBool aBlockLevel);
195 NS_IMETHOD GetHTMLBackgroundColorState(PRBool *aMixed, nsAString &outColor);
197 /* ------------ nsIEditorStyleSheets methods -------------- */
199 NS_IMETHOD AddStyleSheet(const nsAString & aURL);
200 NS_IMETHOD ReplaceStyleSheet(const nsAString& aURL);
201 NS_IMETHOD RemoveStyleSheet(const nsAString &aURL);
203 NS_IMETHOD AddOverrideStyleSheet(const nsAString & aURL);
204 NS_IMETHOD ReplaceOverrideStyleSheet(const nsAString& aURL);
205 NS_IMETHOD RemoveOverrideStyleSheet(const nsAString &aURL);
207 NS_IMETHOD EnableStyleSheet(const nsAString& aURL, PRBool aEnable);
209 /* ------------ nsIEditorMailSupport methods -------------- */
211 NS_DECL_NSIEDITORMAILSUPPORT
213 /* ------------ nsITableEditor methods -------------- */
215 NS_IMETHOD InsertTableCell(PRInt32 aNumber, PRBool aAfter);
216 NS_IMETHOD InsertTableColumn(PRInt32 aNumber, PRBool aAfter);
217 NS_IMETHOD InsertTableRow(PRInt32 aNumber, PRBool aAfter);
218 NS_IMETHOD DeleteTable();
219 NS_IMETHOD DeleteTableCell(PRInt32 aNumber);
220 NS_IMETHOD DeleteTableCellContents();
221 NS_IMETHOD DeleteTableColumn(PRInt32 aNumber);
222 NS_IMETHOD DeleteTableRow(PRInt32 aNumber);
223 NS_IMETHOD SelectTableCell();
224 NS_IMETHOD SelectBlockOfCells(nsIDOMElement *aStartCell, nsIDOMElement *aEndCell);
225 NS_IMETHOD SelectTableRow();
226 NS_IMETHOD SelectTableColumn();
227 NS_IMETHOD SelectTable();
228 NS_IMETHOD SelectAllTableCells();
229 NS_IMETHOD SwitchTableCellHeaderType(nsIDOMElement *aSourceCell, nsIDOMElement **aNewCell);
230 NS_IMETHOD JoinTableCells(PRBool aMergeNonContiguousContents);
231 NS_IMETHOD SplitTableCell();
232 NS_IMETHOD NormalizeTable(nsIDOMElement *aTable);
233 NS_IMETHOD GetCellIndexes(nsIDOMElement *aCell,
234 PRInt32* aRowIndex, PRInt32* aColIndex);
235 NS_IMETHOD GetTableSize(nsIDOMElement *aTable,
236 PRInt32* aRowCount, PRInt32* aColCount);
237 NS_IMETHOD GetCellAt(nsIDOMElement* aTable, PRInt32 aRowIndex, PRInt32 aColIndex, nsIDOMElement **aCell);
238 NS_IMETHOD GetCellDataAt(nsIDOMElement* aTable,
239 PRInt32 aRowIndex, PRInt32 aColIndex,
240 nsIDOMElement **aCell,
241 PRInt32* aStartRowIndex, PRInt32* aStartColIndex,
242 PRInt32* aRowSpan, PRInt32* aColSpan,
243 PRInt32* aActualRowSpan, PRInt32* aActualColSpan,
244 PRBool* aIsSelected);
245 NS_IMETHOD GetFirstRow(nsIDOMElement* aTableElement, nsIDOMNode** aRowNode);
246 NS_IMETHOD GetNextRow(nsIDOMNode* aCurrentRowNode, nsIDOMNode** aRowNode);
247 NS_IMETHOD GetLastCellInRow(nsIDOMNode* aRowNode, nsIDOMNode** aCellNode);
249 NS_IMETHOD SetSelectionAfterTableEdit(nsIDOMElement* aTable, PRInt32 aRow, PRInt32 aCol,
250 PRInt32 aDirection, PRBool aSelected);
251 NS_IMETHOD GetSelectedOrParentTableElement(nsAString& aTagName,
252 PRInt32 *aSelectedCount,
253 nsIDOMElement** aTableElement);
254 NS_IMETHOD GetSelectedCellsType(nsIDOMElement *aElement, PRUint32 *aSelectionType);
256 nsresult GetCellFromRange(nsIDOMRange *aRange, nsIDOMElement **aCell);
258 // Finds the first selected cell in first range of selection
259 // This is in the *order of selection*, not order in the table
260 // (i.e., each cell added to selection is added in another range
261 // in the selection's rangelist, independent of location in table)
262 // aRange is optional: returns the range around the cell
263 NS_IMETHOD GetFirstSelectedCell(nsIDOMRange **aRange, nsIDOMElement **aCell);
264 // Get next cell until no more are found. Always use GetFirstSelected cell first
265 // aRange is optional: returns the range around the cell
266 NS_IMETHOD GetNextSelectedCell(nsIDOMRange **aRange, nsIDOMElement **aCell);
268 // Upper-left-most selected cell in table
269 NS_IMETHOD GetFirstSelectedCellInTable(PRInt32 *aRowIndex, PRInt32 *aColIndex, nsIDOMElement **aCell);
271 /* miscellaneous */
272 // This sets background on the appropriate container element (table, cell,)
273 // or calls into nsTextEditor to set the page background
274 NS_IMETHOD SetCSSBackgroundColor(const nsAString& aColor);
275 NS_IMETHOD SetHTMLBackgroundColor(const nsAString& aColor);
277 /* ------------ Block methods moved from nsEditor -------------- */
278 static nsCOMPtr<nsIDOMNode> GetBlockNodeParent(nsIDOMNode *aNode);
279 /** Determines the bounding nodes for the block section containing aNode.
280 * The calculation is based on some nodes intrinsically being block elements
281 * acording to HTML. Style sheets are not considered in this calculation.
282 * <BR> tags separate block content sections. So the HTML markup:
283 * <PRE>
284 * <P>text1<BR>text2<B>text3</B></P>
285 * </PRE>
286 * contains two block content sections. The first has the text node "text1"
287 * for both endpoints. The second has "text2" as the left endpoint and
288 * "text3" as the right endpoint.
289 * Notice that offsets aren't required, only leaf nodes. Offsets are implicit.
291 * @param aNode the block content returned includes aNode
292 * @param aLeftNode [OUT] the left endpoint of the block content containing aNode
293 * @param aRightNode [OUT] the right endpoint of the block content containing aNode
296 static nsresult GetBlockSection(nsIDOMNode *aNode,
297 nsIDOMNode **aLeftNode,
298 nsIDOMNode **aRightNode);
300 /** Compute the set of block sections in a given range.
301 * A block section is the set of (leftNode, rightNode) pairs given
302 * by GetBlockSection. The set is computed by computing the
303 * block section for every leaf node in the range and throwing
304 * out duplicates.
306 * @param aRange The range to compute block sections for.
307 * @param aSections Allocated storage for the resulting set, stored as nsIDOMRanges.
309 static nsresult GetBlockSectionsForRange(nsIDOMRange *aRange,
310 nsCOMArray<nsIDOMRange>& aSections);
312 static nsCOMPtr<nsIDOMNode> NextNodeInBlock(nsIDOMNode *aNode, IterDirection aDir);
313 nsresult IsNextCharWhitespace(nsIDOMNode *aParentNode,
314 PRInt32 aOffset,
315 PRBool *outIsSpace,
316 PRBool *outIsNBSP,
317 nsCOMPtr<nsIDOMNode> *outNode = 0,
318 PRInt32 *outOffset = 0);
319 nsresult IsPrevCharWhitespace(nsIDOMNode *aParentNode,
320 PRInt32 aOffset,
321 PRBool *outIsSpace,
322 PRBool *outIsNBSP,
323 nsCOMPtr<nsIDOMNode> *outNode = 0,
324 PRInt32 *outOffset = 0);
326 /* ------------ Overrides of nsEditor interface methods -------------- */
328 nsresult EndUpdateViewBatch();
330 /** prepare the editor for use */
331 NS_IMETHOD Init(nsIDOMDocument *aDoc, nsIPresShell *aPresShell, nsIContent *aRoot, nsISelectionController *aSelCon, PRUint32 aFlags);
332 NS_IMETHOD PreDestroy(PRBool aDestroyingFrames);
334 /** Internal, static version */
335 static nsresult NodeIsBlockStatic(nsIDOMNode *aNode, PRBool *aIsBlock);
337 NS_IMETHOD SetFlags(PRUint32 aFlags);
339 NS_IMETHOD Paste(PRInt32 aSelectionType);
340 NS_IMETHOD CanPaste(PRInt32 aSelectionType, PRBool *aCanPaste);
342 NS_IMETHOD PasteTransferable(nsITransferable *aTransferable);
343 NS_IMETHOD CanPasteTransferable(nsITransferable *aTransferable, PRBool *aCanPaste);
345 NS_IMETHOD DebugUnitTests(PRInt32 *outNumTests, PRInt32 *outNumTestsFailed);
347 /** All editor operations which alter the doc should be prefaced
348 * with a call to StartOperation, naming the action and direction */
349 NS_IMETHOD StartOperation(PRInt32 opID, nsIEditor::EDirection aDirection);
351 /** All editor operations which alter the doc should be followed
352 * with a call to EndOperation */
353 NS_IMETHOD EndOperation();
355 /** returns PR_TRUE if aParentTag can contain a child of type aChildTag */
356 virtual PRBool TagCanContainTag(const nsAString& aParentTag, const nsAString& aChildTag);
358 /** returns PR_TRUE if aNode is a container */
359 virtual PRBool IsContainer(nsIDOMNode *aNode);
361 /** make the given selection span the entire document */
362 NS_IMETHOD SelectEntireDocument(nsISelection *aSelection);
364 NS_IMETHOD SetAttributeOrEquivalent(nsIDOMElement * aElement,
365 const nsAString & aAttribute,
366 const nsAString & aValue,
367 PRBool aSuppressTransaction);
368 NS_IMETHOD RemoveAttributeOrEquivalent(nsIDOMElement * aElement,
369 const nsAString & aAttribute,
370 PRBool aSuppressTransaction);
372 /** join together any afjacent editable text nodes in the range */
373 NS_IMETHOD CollapseAdjacentTextNodes(nsIDOMRange *aInRange);
375 virtual PRBool NodesSameType(nsIDOMNode *aNode1, nsIDOMNode *aNode2);
377 NS_IMETHODIMP DeleteNode(nsIDOMNode * aNode);
378 NS_IMETHODIMP DeleteText(nsIDOMCharacterData *aTextNode,
379 PRUint32 aOffset,
380 PRUint32 aLength);
381 NS_IMETHOD InsertTextImpl(const nsAString& aStringToInsert,
382 nsCOMPtr<nsIDOMNode> *aInOutNode,
383 PRInt32 *aInOutOffset,
384 nsIDOMDocument *aDoc);
385 NS_IMETHOD_(PRBool) IsModifiableNode(nsIDOMNode *aNode);
387 NS_IMETHOD SelectAll();
389 NS_IMETHOD GetRootElement(nsIDOMElement **aRootElement);
391 /* ------------ nsICSSLoaderObserver -------------- */
392 NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet*aSheet, PRBool aWasAlternate,
393 nsresult aStatus);
395 /* ------------ Utility Routines, not part of public API -------------- */
396 NS_IMETHOD TypedText(const nsAString& aString, PRInt32 aAction);
397 nsresult InsertNodeAtPoint( nsIDOMNode *aNode,
398 nsCOMPtr<nsIDOMNode> *ioParent,
399 PRInt32 *ioOffset,
400 PRBool aNoEmptyNodes);
401 nsCOMPtr<nsIDOMNode> FindUserSelectAllNode(nsIDOMNode *aNode);
404 /** returns the absolute position of the end points of aSelection
405 * in the document as a text stream.
407 nsresult GetTextSelectionOffsets(nsISelection *aSelection,
408 PRInt32 &aStartOffset,
409 PRInt32 &aEndOffset);
411 // Use this to assure that selection is set after attribute nodes when
412 // trying to collapse selection at begining of a block node
413 // e.g., when setting at beginning of a table cell
414 // This will stop at a table, however, since we don't want to
415 // "drill down" into nested tables.
416 // aSelection is optional -- if null, we get current seletion
417 nsresult CollapseSelectionToDeepestNonTableFirstChild(nsISelection *aSelection, nsIDOMNode *aNode);
419 virtual PRBool IsTextInDirtyFrameVisible(nsIDOMNode *aNode);
421 nsresult IsVisTextNode( nsIDOMNode *aNode,
422 PRBool *outIsEmptyNode,
423 PRBool aSafeToAskFrames);
424 nsresult IsEmptyNode(nsIDOMNode *aNode, PRBool *outIsEmptyBlock,
425 PRBool aMozBRDoesntCount = PR_FALSE,
426 PRBool aListOrCellNotEmpty = PR_FALSE,
427 PRBool aSafeToAskFrames = PR_FALSE);
428 nsresult IsEmptyNodeImpl(nsIDOMNode *aNode,
429 PRBool *outIsEmptyBlock,
430 PRBool aMozBRDoesntCount,
431 PRBool aListOrCellNotEmpty,
432 PRBool aSafeToAskFrames,
433 PRBool *aSeenBR);
435 // Returns TRUE if sheet was loaded, false if it wasn't
436 PRBool EnableExistingStyleSheet(const nsAString& aURL);
438 // Dealing with the internal style sheet lists:
439 NS_IMETHOD GetStyleSheetForURL(const nsAString &aURL,
440 nsCSSStyleSheet **_retval);
441 NS_IMETHOD GetURLForStyleSheet(nsCSSStyleSheet *aStyleSheet, nsAString &aURL);
443 // Add a url + known style sheet to the internal lists:
444 nsresult AddNewStyleSheetToList(const nsAString &aURL,
445 nsCSSStyleSheet *aStyleSheet);
447 nsresult RemoveStyleSheetFromList(const nsAString &aURL);
449 protected:
451 NS_IMETHOD InitRules();
453 // Create the event listeners for the editor to install
454 virtual nsresult CreateEventListeners();
456 virtual nsresult InstallEventListeners();
457 virtual void RemoveEventListeners();
459 PRBool ShouldReplaceRootElement();
460 void ResetRootElementAndEventTarget();
461 nsresult GetBodyElement(nsIDOMHTMLElement** aBody);
462 // Get the focused node of this editor.
463 // @return If the editor has focus, this returns the focused node.
464 // Otherwise, returns null.
465 already_AddRefed<nsINode> GetFocusedNode();
467 // Return TRUE if aElement is a table-related elemet and caret was set
468 PRBool SetCaretInTableCell(nsIDOMElement* aElement);
469 PRBool IsElementInBody(nsIDOMElement* aElement);
471 // key event helpers
472 NS_IMETHOD TabInTable(PRBool inIsShift, PRBool *outHandled);
473 NS_IMETHOD CreateBR(nsIDOMNode *aNode, PRInt32 aOffset,
474 nsCOMPtr<nsIDOMNode> *outBRNode, nsIEditor::EDirection aSelect = nsIEditor::eNone);
475 NS_IMETHOD CreateBRImpl(nsCOMPtr<nsIDOMNode> *aInOutParent,
476 PRInt32 *aInOutOffset,
477 nsCOMPtr<nsIDOMNode> *outBRNode,
478 nsIEditor::EDirection aSelect);
479 NS_IMETHOD InsertBR(nsCOMPtr<nsIDOMNode> *outBRNode);
481 // Table Editing (implemented in nsTableEditor.cpp)
483 // Table utilities
485 // Insert a new cell after or before supplied aCell.
486 // Optional: If aNewCell supplied, returns the newly-created cell (addref'd, of course)
487 // This doesn't change or use the current selection
488 NS_IMETHOD InsertCell(nsIDOMElement *aCell, PRInt32 aRowSpan, PRInt32 aColSpan,
489 PRBool aAfter, PRBool aIsHeader, nsIDOMElement **aNewCell);
491 // Helpers that don't touch the selection or do batch transactions
492 NS_IMETHOD DeleteRow(nsIDOMElement *aTable, PRInt32 aRowIndex);
493 NS_IMETHOD DeleteColumn(nsIDOMElement *aTable, PRInt32 aColIndex);
494 NS_IMETHOD DeleteCellContents(nsIDOMElement *aCell);
496 // Move all contents from aCellToMerge into aTargetCell (append at end)
497 NS_IMETHOD MergeCells(nsCOMPtr<nsIDOMElement> aTargetCell, nsCOMPtr<nsIDOMElement> aCellToMerge, PRBool aDeleteCellToMerge);
499 NS_IMETHOD DeleteTable2(nsIDOMElement *aTable, nsISelection *aSelection);
500 NS_IMETHOD SetColSpan(nsIDOMElement *aCell, PRInt32 aColSpan);
501 NS_IMETHOD SetRowSpan(nsIDOMElement *aCell, PRInt32 aRowSpan);
503 // Helper used to get nsITableLayout interface for methods implemented in nsTableFrame
504 NS_IMETHOD GetTableLayoutObject(nsIDOMElement* aTable, nsITableLayout **tableLayoutObject);
505 // Needed to do appropriate deleting when last cell or row is about to be deleted
506 // This doesn't count cells that don't start in the given row (are spanning from row above)
507 PRInt32 GetNumberOfCellsInRow(nsIDOMElement* aTable, PRInt32 rowIndex);
508 // Test if all cells in row or column at given index are selected
509 PRBool AllCellsInRowSelected(nsIDOMElement *aTable, PRInt32 aRowIndex, PRInt32 aNumberOfColumns);
510 PRBool AllCellsInColumnSelected(nsIDOMElement *aTable, PRInt32 aColIndex, PRInt32 aNumberOfRows);
512 PRBool IsEmptyCell(nsIDOMElement *aCell);
514 // Most insert methods need to get the same basic context data
515 // Any of the pointers may be null if you don't need that datum (for more efficiency)
516 // Input: *aCell is a known cell,
517 // if null, cell is obtained from the anchor node of the selection
518 // Returns NS_EDITOR_ELEMENT_NOT_FOUND if cell is not found even if aCell is null
519 NS_IMETHOD GetCellContext(nsISelection **aSelection,
520 nsIDOMElement **aTable,
521 nsIDOMElement **aCell,
522 nsIDOMNode **aCellParent, PRInt32 *aCellOffset,
523 PRInt32 *aRowIndex, PRInt32 *aColIndex);
525 NS_IMETHOD GetCellSpansAt(nsIDOMElement* aTable, PRInt32 aRowIndex, PRInt32 aColIndex,
526 PRInt32& aActualRowSpan, PRInt32& aActualColSpan);
528 NS_IMETHOD SplitCellIntoColumns(nsIDOMElement *aTable, PRInt32 aRowIndex, PRInt32 aColIndex,
529 PRInt32 aColSpanLeft, PRInt32 aColSpanRight, nsIDOMElement **aNewCell);
531 NS_IMETHOD SplitCellIntoRows(nsIDOMElement *aTable, PRInt32 aRowIndex, PRInt32 aColIndex,
532 PRInt32 aRowSpanAbove, PRInt32 aRowSpanBelow, nsIDOMElement **aNewCell);
534 nsresult CopyCellBackgroundColor(nsIDOMElement *destCell, nsIDOMElement *sourceCell);
536 // Reduce rowspan/colspan when cells span into nonexistent rows/columns
537 NS_IMETHOD FixBadRowSpan(nsIDOMElement *aTable, PRInt32 aRowIndex, PRInt32& aNewRowCount);
538 NS_IMETHOD FixBadColSpan(nsIDOMElement *aTable, PRInt32 aColIndex, PRInt32& aNewColCount);
540 // Fallback method: Call this after using ClearSelection() and you
541 // failed to set selection to some other content in the document
542 NS_IMETHOD SetSelectionAtDocumentStart(nsISelection *aSelection);
544 // End of Table Editing utilities
546 NS_IMETHOD IsRootTag(nsString &aTag, PRBool &aIsTag);
548 virtual PRBool IsBlockNode(nsIDOMNode *aNode);
550 static nsCOMPtr<nsIDOMNode> GetEnclosingTable(nsIDOMNode *aNode);
552 /** content-based query returns PR_TRUE if <aProperty aAttribute=aValue> effects aNode
553 * If <aProperty aAttribute=aValue> contains aNode,
554 * but <aProperty aAttribute=SomeOtherValue> also contains aNode and the second is
555 * more deeply nested than the first, then the first does not effect aNode.
557 * @param aNode The target of the query
558 * @param aProperty The property that we are querying for
559 * @param aAttribute The attribute of aProperty, example: color in <FONT color="blue">
560 * May be null.
561 * @param aValue The value of aAttribute, example: blue in <FONT color="blue">
562 * May be null. Ignored if aAttribute is null.
563 * @param aIsSet [OUT] PR_TRUE if <aProperty aAttribute=aValue> effects aNode.
564 * @param aStyleNode [OUT] set to the node representing <aProperty aAttribute=aValue>, if found.
565 * null if aIsSet is returned as PR_FALSE;
567 virtual void IsTextPropertySetByContent(nsIDOMNode *aNode,
568 nsIAtom *aProperty,
569 const nsAString *aAttribute,
570 const nsAString *aValue,
571 PRBool &aIsSet,
572 nsIDOMNode **aStyleNode,
573 nsAString *outValue = nsnull);
575 // Methods for handling plaintext quotations
576 NS_IMETHOD PasteAsPlaintextQuotation(PRInt32 aSelectionType);
578 /** Insert a string as quoted text,
579 * replacing the selected text (if any).
580 * @param aQuotedText The string to insert.
581 * @param aAddCites Whether to prepend extra ">" to each line
582 * (usually true, unless those characters
583 * have already been added.)
584 * @return aNodeInserted The node spanning the insertion, if applicable.
585 * If aAddCites is false, this will be null.
587 NS_IMETHOD InsertAsPlaintextQuotation(const nsAString & aQuotedText,
588 PRBool aAddCites,
589 nsIDOMNode **aNodeInserted);
591 // factored methods for handling insertion of data from transferables (drag&drop or clipboard)
592 NS_IMETHOD PrepareTransferable(nsITransferable **transferable);
593 NS_IMETHOD PrepareHTMLTransferable(nsITransferable **transferable, PRBool havePrivFlavor);
594 nsresult PutDragDataInTransferable(nsITransferable **aTransferable);
595 NS_IMETHOD InsertFromTransferable(nsITransferable *transferable,
596 nsIDOMDocument *aSourceDoc,
597 const nsAString & aContextStr,
598 const nsAString & aInfoStr,
599 nsIDOMNode *aDestinationNode,
600 PRInt32 aDestinationOffset,
601 PRBool aDoDeleteSelection);
602 PRBool HavePrivateHTMLFlavor( nsIClipboard *clipboard );
603 nsresult ParseCFHTML(nsCString & aCfhtml, PRUnichar **aStuffToPaste, PRUnichar **aCfcontext);
604 nsresult DoContentFilterCallback(const nsAString &aFlavor,
605 nsIDOMDocument *aSourceDoc,
606 PRBool aWillDeleteSelection,
607 nsIDOMNode **aFragmentAsNode,
608 nsIDOMNode **aFragStartNode,
609 PRInt32 *aFragStartOffset,
610 nsIDOMNode **aFragEndNode,
611 PRInt32 *aFragEndOffset,
612 nsIDOMNode **aTargetNode,
613 PRInt32 *aTargetOffset,
614 PRBool *aDoContinue);
615 nsresult RelativizeURIInFragmentList(const nsCOMArray<nsIDOMNode> &aNodeList,
616 const nsAString &aFlavor,
617 nsIDOMDocument *aSourceDoc,
618 nsIDOMNode *aTargetNode);
619 nsresult RelativizeURIForNode(nsIDOMNode *aNode, nsIURL *aDestURL);
620 nsresult GetAttributeToModifyOnNode(nsIDOMNode *aNode, nsAString &aAttrib);
622 PRBool IsInLink(nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *outLink = nsnull);
623 nsresult StripFormattingNodes(nsIDOMNode *aNode, PRBool aOnlyList = PR_FALSE);
624 nsresult CreateDOMFragmentFromPaste(const nsAString & aInputString,
625 const nsAString & aContextStr,
626 const nsAString & aInfoStr,
627 nsCOMPtr<nsIDOMNode> *outFragNode,
628 nsCOMPtr<nsIDOMNode> *outStartNode,
629 nsCOMPtr<nsIDOMNode> *outEndNode,
630 PRInt32 *outStartOffset,
631 PRInt32 *outEndOffset,
632 PRBool aTrustedInput);
633 nsresult ParseFragment(const nsAString & aStr, nsTArray<nsString> &aTagStack,
634 nsIDocument* aTargetDoc,
635 nsCOMPtr<nsIDOMNode> *outNode,
636 PRBool aTrustedInput);
637 nsresult CreateListOfNodesToPaste(nsIDOMNode *aFragmentAsNode,
638 nsCOMArray<nsIDOMNode>& outNodeList,
639 nsIDOMNode *aStartNode,
640 PRInt32 aStartOffset,
641 nsIDOMNode *aEndNode,
642 PRInt32 aEndOffset);
643 nsresult CreateTagStack(nsTArray<nsString> &aTagStack,
644 nsIDOMNode *aNode);
645 nsresult GetListAndTableParents( PRBool aEnd,
646 nsCOMArray<nsIDOMNode>& aListOfNodes,
647 nsCOMArray<nsIDOMNode>& outArray);
648 nsresult DiscoverPartialListsAndTables(nsCOMArray<nsIDOMNode>& aPasteNodes,
649 nsCOMArray<nsIDOMNode>& aListsAndTables,
650 PRInt32 *outHighWaterMark);
651 nsresult ScanForListAndTableStructure(PRBool aEnd,
652 nsCOMArray<nsIDOMNode>& aNodes,
653 nsIDOMNode *aListOrTable,
654 nsCOMPtr<nsIDOMNode> *outReplaceNode);
655 nsresult ReplaceOrphanedStructure( PRBool aEnd,
656 nsCOMArray<nsIDOMNode>& aNodeArray,
657 nsCOMArray<nsIDOMNode>& aListAndTableArray,
658 PRInt32 aHighWaterMark);
659 nsIDOMNode* GetArrayEndpoint(PRBool aEnd, nsCOMArray<nsIDOMNode>& aNodeArray);
661 /* small utility routine to test if a break node is visible to user */
662 PRBool IsVisBreak(nsIDOMNode *aNode);
664 /* utility routine to possibly adjust the insertion position when
665 inserting a block level element */
666 void NormalizeEOLInsertPosition(nsIDOMNode *firstNodeToInsert,
667 nsCOMPtr<nsIDOMNode> *insertParentNode,
668 PRInt32 *insertOffset);
670 /* small utility routine to test the eEditorReadonly bit */
671 PRBool IsModifiable();
673 /* helpers for block transformations */
674 nsresult MakeDefinitionItem(const nsAString & aItemType);
675 nsresult InsertBasicBlock(const nsAString & aBlockType);
677 /* increase/decrease the font size of selection */
678 nsresult RelativeFontChange( PRInt32 aSizeChange);
680 /* helper routines for font size changing */
681 nsresult RelativeFontChangeOnTextNode( PRInt32 aSizeChange,
682 nsIDOMCharacterData *aTextNode,
683 PRInt32 aStartOffset,
684 PRInt32 aEndOffset);
685 nsresult RelativeFontChangeOnNode( PRInt32 aSizeChange,
686 nsIDOMNode *aNode);
687 nsresult RelativeFontChangeHelper( PRInt32 aSizeChange,
688 nsIDOMNode *aNode);
690 /* helper routines for inline style */
691 nsresult SetInlinePropertyOnTextNode( nsIDOMCharacterData *aTextNode,
692 PRInt32 aStartOffset,
693 PRInt32 aEndOffset,
694 nsIAtom *aProperty,
695 const nsAString *aAttribute,
696 const nsAString *aValue);
697 nsresult SetInlinePropertyOnNode( nsIDOMNode *aNode,
698 nsIAtom *aProperty,
699 const nsAString *aAttribute,
700 const nsAString *aValue);
702 nsresult PromoteInlineRange(nsIDOMRange *inRange);
703 nsresult PromoteRangeIfStartsOrEndsInNamedAnchor(nsIDOMRange *inRange);
704 nsresult SplitStyleAboveRange(nsIDOMRange *aRange,
705 nsIAtom *aProperty,
706 const nsAString *aAttribute);
707 nsresult SplitStyleAbovePoint(nsCOMPtr<nsIDOMNode> *aNode,
708 PRInt32 *aOffset,
709 nsIAtom *aProperty,
710 const nsAString *aAttribute,
711 nsCOMPtr<nsIDOMNode> *outLeftNode = nsnull,
712 nsCOMPtr<nsIDOMNode> *outRightNode = nsnull);
713 nsresult ApplyDefaultProperties();
714 nsresult RemoveStyleInside(nsIDOMNode *aNode,
715 nsIAtom *aProperty,
716 const nsAString *aAttribute,
717 PRBool aChildrenOnly = PR_FALSE);
718 nsresult RemoveInlinePropertyImpl(nsIAtom *aProperty, const nsAString *aAttribute);
720 PRBool NodeIsProperty(nsIDOMNode *aNode);
721 PRBool HasAttr(nsIDOMNode *aNode, const nsAString *aAttribute);
722 PRBool HasAttrVal(nsIDOMNode *aNode, const nsAString *aAttribute, const nsAString *aValue);
723 PRBool IsAtFrontOfNode(nsIDOMNode *aNode, PRInt32 aOffset);
724 PRBool IsAtEndOfNode(nsIDOMNode *aNode, PRInt32 aOffset);
725 PRBool IsOnlyAttribute(nsIDOMNode *aElement, const nsAString *aAttribute);
727 nsresult RemoveBlockContainer(nsIDOMNode *inNode);
728 nsresult GetPriorHTMLSibling(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode);
729 nsresult GetPriorHTMLSibling(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode);
730 nsresult GetNextHTMLSibling(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode);
731 nsresult GetNextHTMLSibling(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode);
732 nsresult GetPriorHTMLNode(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode, PRBool bNoBlockCrossing = PR_FALSE);
733 nsresult GetPriorHTMLNode(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode, PRBool bNoBlockCrossing = PR_FALSE);
734 nsresult GetNextHTMLNode(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode, PRBool bNoBlockCrossing = PR_FALSE);
735 nsresult GetNextHTMLNode(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode, PRBool bNoBlockCrossing = PR_FALSE);
737 nsresult IsFirstEditableChild( nsIDOMNode *aNode, PRBool *aOutIsFirst);
738 nsresult IsLastEditableChild( nsIDOMNode *aNode, PRBool *aOutIsLast);
739 nsresult GetFirstEditableChild( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutFirstChild);
740 nsresult GetLastEditableChild( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutLastChild);
742 nsresult GetFirstEditableLeaf( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutFirstLeaf);
743 nsresult GetLastEditableLeaf( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutLastLeaf);
745 //XXX Kludge: Used to suppress spurious drag/drop events (bug 50703)
746 PRBool mIgnoreSpuriousDragEvent;
748 nsresult GetInlinePropertyBase(nsIAtom *aProperty,
749 const nsAString *aAttribute,
750 const nsAString *aValue,
751 PRBool *aFirst,
752 PRBool *aAny,
753 PRBool *aAll,
754 nsAString *outValue,
755 PRBool aCheckDefaults = PR_TRUE);
756 nsresult HasStyleOrIdOrClass(nsIDOMElement * aElement, PRBool *aHasStyleOrIdOrClass);
757 nsresult RemoveElementIfNoStyleOrIdOrClass(nsIDOMElement * aElement, nsIAtom * aTag);
759 // Whether the outer window of the DOM event target has focus or not.
760 PRBool OurWindowHasFocus();
762 // This function is used to insert a string of HTML input optionally with some
763 // context information into the editable field. The HTML input either comes
764 // from a transferable object created as part of a drop/paste operation, or from
765 // the InsertHTML method. We may want the HTML input to be sanitized (for example,
766 // if it's coming from a transferable object), in which case aTrustedInput should
767 // be set to false, otherwise, the caller should set it to true, which means that
768 // the HTML will be inserted in the DOM verbatim.
769 nsresult DoInsertHTMLWithContext(const nsAString& aInputString,
770 const nsAString& aContextStr,
771 const nsAString& aInfoStr,
772 const nsAString& aFlavor,
773 nsIDOMDocument* aSourceDoc,
774 nsIDOMNode* aDestNode,
775 PRInt32 aDestOffset,
776 PRBool aDeleteSelection,
777 PRBool aTrustedInput);
779 // Data members
780 protected:
782 nsCOMArray<nsIContentFilter> mContentFilters;
784 nsRefPtr<TypeInState> mTypeInState;
786 PRPackedBool mCRInParagraphCreatesParagraph;
788 PRPackedBool mCSSAware;
789 nsAutoPtr<nsHTMLCSSUtils> mHTMLCSSUtils;
791 // Used by GetFirstSelectedCell and GetNextSelectedCell
792 PRInt32 mSelectedCellIndex;
794 nsString mLastStyleSheetURL;
795 nsString mLastOverrideStyleSheetURL;
797 // Maintain a list of associated style sheets and their urls.
798 nsTArray<nsString> mStyleSheetURLs;
799 nsTArray<nsRefPtr<nsCSSStyleSheet> > mStyleSheets;
801 // an array for holding default style settings
802 nsTArray<PropItem*> mDefaultStyles;
804 // for real-time spelling
805 nsCOMPtr<nsITextServicesDocument> mTextServices;
807 // And a static range utils service
808 static nsIRangeUtils* sRangeHelper;
810 public:
811 // ... which means that we need to listen to shutdown
812 static void Shutdown();
814 protected:
816 /* ANONYMOUS UTILS */
817 void RemoveListenerAndDeleteRef(const nsAString& aEvent,
818 nsIDOMEventListener* aListener,
819 PRBool aUseCapture,
820 nsIDOMElement* aElement,
821 nsIContent* aParentContent,
822 nsIPresShell* aShell);
823 void DeleteRefToAnonymousNode(nsIDOMElement* aElement,
824 nsIContent * aParentContent,
825 nsIPresShell* aShell);
827 nsresult ShowResizersInner(nsIDOMElement *aResizedElement);
829 // Returns the offset of an element's frame to its absolute containing block.
830 nsresult GetElementOrigin(nsIDOMElement * aElement, PRInt32 & aX, PRInt32 & aY);
831 nsresult GetPositionAndDimensions(nsIDOMElement * aElement,
832 PRInt32 & aX, PRInt32 & aY,
833 PRInt32 & aW, PRInt32 & aH,
834 PRInt32 & aBorderLeft,
835 PRInt32 & aBorderTop,
836 PRInt32 & aMarginLeft,
837 PRInt32 & aMarginTop);
839 /* PACKED BOOLEANS FOR RESIZING, ABSOLUTE POSITIONING AND */
840 /* INLINE TABLE EDITING */
842 // resizing
843 PRPackedBool mIsObjectResizingEnabled;
844 PRPackedBool mIsResizing;
845 PRPackedBool mPreserveRatio;
846 PRPackedBool mResizedObjectIsAnImage;
848 // absolute positioning
849 PRPackedBool mIsAbsolutelyPositioningEnabled;
850 PRPackedBool mResizedObjectIsAbsolutelyPositioned;
852 PRPackedBool mGrabberClicked;
853 PRPackedBool mIsMoving;
855 PRPackedBool mSnapToGridEnabled;
857 // inline table editing
858 PRPackedBool mIsInlineTableEditingEnabled;
860 /* RESIZING */
862 nsCOMPtr<nsIDOMElement> mTopLeftHandle;
863 nsCOMPtr<nsIDOMElement> mTopHandle;
864 nsCOMPtr<nsIDOMElement> mTopRightHandle;
865 nsCOMPtr<nsIDOMElement> mLeftHandle;
866 nsCOMPtr<nsIDOMElement> mRightHandle;
867 nsCOMPtr<nsIDOMElement> mBottomLeftHandle;
868 nsCOMPtr<nsIDOMElement> mBottomHandle;
869 nsCOMPtr<nsIDOMElement> mBottomRightHandle;
871 nsCOMPtr<nsIDOMElement> mActivatedHandle;
873 nsCOMPtr<nsIDOMElement> mResizingShadow;
874 nsCOMPtr<nsIDOMElement> mResizingInfo;
876 nsCOMPtr<nsIDOMElement> mResizedObject;
878 nsCOMPtr<nsIDOMEventListener> mMouseMotionListenerP;
879 nsCOMPtr<nsISelectionListener> mSelectionListenerP;
880 nsCOMPtr<nsIDOMEventListener> mResizeEventListenerP;
882 nsCOMArray<nsIHTMLObjectResizeListener> objectResizeEventListeners;
884 PRInt32 mOriginalX;
885 PRInt32 mOriginalY;
887 PRInt32 mResizedObjectX;
888 PRInt32 mResizedObjectY;
889 PRInt32 mResizedObjectWidth;
890 PRInt32 mResizedObjectHeight;
892 PRInt32 mResizedObjectMarginLeft;
893 PRInt32 mResizedObjectMarginTop;
894 PRInt32 mResizedObjectBorderLeft;
895 PRInt32 mResizedObjectBorderTop;
897 PRInt32 mXIncrementFactor;
898 PRInt32 mYIncrementFactor;
899 PRInt32 mWidthIncrementFactor;
900 PRInt32 mHeightIncrementFactor;
902 PRInt8 mInfoXIncrement;
903 PRInt8 mInfoYIncrement;
905 nsresult SetAllResizersPosition();
907 nsresult CreateResizer(nsIDOMElement ** aReturn, PRInt16 aLocation, nsIDOMNode * aParentNode);
908 void SetAnonymousElementPosition(PRInt32 aX, PRInt32 aY, nsIDOMElement *aResizer);
910 nsresult CreateShadow(nsIDOMElement ** aReturn, nsIDOMNode * aParentNode,
911 nsIDOMElement * aOriginalObject);
912 nsresult SetShadowPosition(nsIDOMElement * aShadow,
913 nsIDOMElement * aOriginalObject,
914 PRInt32 aOriginalObjectX,
915 PRInt32 aOriginalObjectY);
917 nsresult CreateResizingInfo(nsIDOMElement ** aReturn, nsIDOMNode * aParentNode);
918 nsresult SetResizingInfoPosition(PRInt32 aX, PRInt32 aY,
919 PRInt32 aW, PRInt32 aH);
921 PRInt32 GetNewResizingIncrement(PRInt32 aX, PRInt32 aY, PRInt32 aID);
922 nsresult StartResizing(nsIDOMElement * aHandle);
923 PRInt32 GetNewResizingX(PRInt32 aX, PRInt32 aY);
924 PRInt32 GetNewResizingY(PRInt32 aX, PRInt32 aY);
925 PRInt32 GetNewResizingWidth(PRInt32 aX, PRInt32 aY);
926 PRInt32 GetNewResizingHeight(PRInt32 aX, PRInt32 aY);
927 void HideShadowAndInfo();
928 void SetFinalSize(PRInt32 aX, PRInt32 aY);
929 void DeleteRefToAnonymousNode(nsIDOMNode * aNode);
930 void SetResizeIncrements(PRInt32 aX, PRInt32 aY, PRInt32 aW, PRInt32 aH, PRBool aPreserveRatio);
932 /* ABSOLUTE POSITIONING */
934 PRInt32 mPositionedObjectX;
935 PRInt32 mPositionedObjectY;
936 PRInt32 mPositionedObjectWidth;
937 PRInt32 mPositionedObjectHeight;
939 PRInt32 mPositionedObjectMarginLeft;
940 PRInt32 mPositionedObjectMarginTop;
941 PRInt32 mPositionedObjectBorderLeft;
942 PRInt32 mPositionedObjectBorderTop;
944 nsCOMPtr<nsIDOMElement> mAbsolutelyPositionedObject;
945 nsCOMPtr<nsIDOMElement> mGrabber;
946 nsCOMPtr<nsIDOMElement> mPositioningShadow;
948 PRInt32 mGridSize;
950 nsresult CreateGrabber(nsIDOMNode * aParentNode, nsIDOMElement ** aReturn);
951 nsresult StartMoving(nsIDOMElement * aHandle);
952 nsresult SetFinalPosition(PRInt32 aX, PRInt32 aY);
953 void AddPositioningOffset(PRInt32 & aX, PRInt32 & aY);
954 void SnapToGrid(PRInt32 & newX, PRInt32 & newY);
955 nsresult GrabberClicked();
956 nsresult EndMoving();
957 nsresult CheckPositionedElementBGandFG(nsIDOMElement * aElement,
958 nsAString & aReturn);
960 /* INLINE TABLE EDITING */
962 nsCOMPtr<nsIDOMElement> mInlineEditedCell;
964 nsCOMPtr<nsIDOMElement> mAddColumnBeforeButton;
965 nsCOMPtr<nsIDOMElement> mRemoveColumnButton;
966 nsCOMPtr<nsIDOMElement> mAddColumnAfterButton;
968 nsCOMPtr<nsIDOMElement> mAddRowBeforeButton;
969 nsCOMPtr<nsIDOMElement> mRemoveRowButton;
970 nsCOMPtr<nsIDOMElement> mAddRowAfterButton;
972 void AddMouseClickListener(nsIDOMElement * aElement);
973 void RemoveMouseClickListener(nsIDOMElement * aElement);
975 nsCOMPtr<nsILinkHandler> mLinkHandler;
977 public:
979 // friends
980 friend class nsHTMLEditRules;
981 friend class nsTextEditRules;
982 friend class nsWSRunObject;
985 #endif //nsHTMLEditor_h__