editor/libeditor/base/InsertElementTxn.h

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:06f6cb7fa369
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 InsertElementTxn_h__
7 #define InsertElementTxn_h__
8
9 #include "EditTxn.h" // for EditTxn, NS_DECL_EDITTXN
10 #include "nsCOMPtr.h" // for nsCOMPtr
11 #include "nsCycleCollectionParticipant.h"
12 #include "nsIDOMNode.h" // for nsIDOMNode
13 #include "nsISupportsImpl.h" // for NS_DECL_ISUPPORTS_INHERITED
14 #include "nscore.h" // for NS_IMETHOD
15
16 class nsIEditor;
17
18 /**
19 * A transaction that inserts a single element
20 */
21 class InsertElementTxn : public EditTxn
22 {
23 public:
24 /** initialize the transaction.
25 * @param aNode the node to insert
26 * @param aParent the node to insert into
27 * @param aOffset the offset in aParent to insert aNode
28 */
29 NS_IMETHOD Init(nsIDOMNode *aNode,
30 nsIDOMNode *aParent,
31 int32_t aOffset,
32 nsIEditor *aEditor);
33
34 InsertElementTxn();
35
36 NS_DECL_ISUPPORTS_INHERITED
37 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(InsertElementTxn, EditTxn)
38
39 NS_DECL_EDITTXN
40
41 protected:
42
43 /** the element to insert */
44 nsCOMPtr<nsIDOMNode> mNode;
45
46 /** the node into which the new node will be inserted */
47 nsCOMPtr<nsIDOMNode> mParent;
48
49 /** the editor for this transaction */
50 nsIEditor* mEditor;
51
52 /** the index in mParent for the new node */
53 int32_t mOffset;
54 };
55
56 #endif

mercurial