|
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #ifndef DeleteNodeTxn_h__ |
|
7 #define DeleteNodeTxn_h__ |
|
8 |
|
9 #include "EditTxn.h" |
|
10 #include "nsCOMPtr.h" |
|
11 #include "nsCycleCollectionParticipant.h" |
|
12 #include "nsIContent.h" |
|
13 #include "nsINode.h" |
|
14 #include "nsISupportsImpl.h" |
|
15 #include "nscore.h" |
|
16 |
|
17 class nsEditor; |
|
18 class nsRangeUpdater; |
|
19 |
|
20 /** |
|
21 * A transaction that deletes a single element |
|
22 */ |
|
23 class DeleteNodeTxn : public EditTxn |
|
24 { |
|
25 public: |
|
26 /** initialize the transaction. |
|
27 * @param aElement the node to delete |
|
28 */ |
|
29 nsresult Init(nsEditor* aEditor, nsINode* aNode, |
|
30 nsRangeUpdater* aRangeUpdater); |
|
31 |
|
32 DeleteNodeTxn(); |
|
33 |
|
34 NS_DECL_ISUPPORTS_INHERITED |
|
35 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DeleteNodeTxn, EditTxn) |
|
36 |
|
37 NS_DECL_EDITTXN |
|
38 |
|
39 NS_IMETHOD RedoTransaction(); |
|
40 |
|
41 protected: |
|
42 |
|
43 /** the element to delete */ |
|
44 nsCOMPtr<nsINode> mNode; |
|
45 |
|
46 /** parent of node to delete */ |
|
47 nsCOMPtr<nsINode> mParent; |
|
48 |
|
49 /** next sibling to remember for undo/redo purposes */ |
|
50 nsCOMPtr<nsIContent> mRefNode; |
|
51 |
|
52 /** the editor for this transaction */ |
|
53 nsEditor* mEditor; |
|
54 |
|
55 /** range updater object */ |
|
56 nsRangeUpdater* mRangeUpdater; |
|
57 }; |
|
58 |
|
59 #endif |