editor/libeditor/base/DeleteTextTxn.h

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:2f4f72e10ab2
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 DeleteTextTxn_h__
7 #define DeleteTextTxn_h__
8
9 #include "EditTxn.h"
10 #include "nsCOMPtr.h"
11 #include "nsCycleCollectionParticipant.h"
12 #include "nsID.h"
13 #include "nsIDOMCharacterData.h"
14 #include "nsString.h"
15 #include "nscore.h"
16
17 class nsEditor;
18 class nsRangeUpdater;
19
20 /**
21 * A transaction that removes text from a content node.
22 */
23 class DeleteTextTxn : public EditTxn
24 {
25 public:
26 /** initialize the transaction.
27 * @param aEditor the provider of basic editing operations
28 * @param aElement the content node to remove text from
29 * @param aOffset the location in aElement to begin the deletion
30 * @param aNumCharsToDelete the number of characters to delete. Not the number of bytes!
31 */
32 NS_IMETHOD Init(nsEditor* aEditor,
33 nsIDOMCharacterData* aCharData,
34 uint32_t aOffset,
35 uint32_t aNumCharsToDelete,
36 nsRangeUpdater* aRangeUpdater);
37
38 DeleteTextTxn();
39
40 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DeleteTextTxn, EditTxn)
41 NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
42
43 NS_DECL_EDITTXN
44
45 uint32_t GetOffset() { return mOffset; }
46
47 uint32_t GetNumCharsToDelete() { return mNumCharsToDelete; }
48
49 protected:
50
51 /** the provider of basic editing operations */
52 nsEditor* mEditor;
53
54 /** the CharacterData node to operate upon */
55 nsCOMPtr<nsIDOMCharacterData> mCharData;
56
57 /** the offset into mCharData where the deletion is to take place */
58 uint32_t mOffset;
59
60 /** the number of characters to delete */
61 uint32_t mNumCharsToDelete;
62
63 /** the text that was deleted */
64 nsString mDeletedText;
65
66 /** range updater object */
67 nsRangeUpdater* mRangeUpdater;
68 };
69
70 #endif

mercurial