Bumping manifests a=b2g-bump
[gecko.git] / editor / libeditor / DeleteRangeTxn.h
blobec2f9c9ca4d493262befccba5de1ccd2e8af5a32
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/. */
6 #ifndef DeleteRangeTxn_h__
7 #define DeleteRangeTxn_h__
9 #include "EditAggregateTxn.h"
10 #include "EditTxn.h"
11 #include "nsAutoPtr.h"
12 #include "nsCycleCollectionParticipant.h"
13 #include "nsID.h"
14 #include "nsIEditor.h"
15 #include "nsISupportsImpl.h"
16 #include "nsRange.h"
17 #include "nscore.h"
19 class nsEditor;
20 class nsINode;
21 class nsRangeUpdater;
23 /**
24 * A transaction that deletes an entire range in the content tree
26 class DeleteRangeTxn : public EditAggregateTxn
28 public:
29 /** initialize the transaction.
30 * @param aEditor the object providing basic editing operations
31 * @param aRange the range to delete
33 nsresult Init(nsEditor* aEditor,
34 nsRange* aRange,
35 nsRangeUpdater* aRangeUpdater);
37 DeleteRangeTxn();
39 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DeleteRangeTxn, EditAggregateTxn)
40 NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
42 NS_DECL_EDITTXN
44 NS_IMETHOD RedoTransaction();
46 virtual void LastRelease()
48 mRange = nullptr;
49 EditAggregateTxn::LastRelease();
51 protected:
53 nsresult CreateTxnsToDeleteBetween(nsINode* aNode,
54 int32_t aStartOffset,
55 int32_t aEndOffset);
57 nsresult CreateTxnsToDeleteNodesBetween();
59 nsresult CreateTxnsToDeleteContent(nsINode* aParent,
60 int32_t aOffset,
61 nsIEditor::EDirection aAction);
63 protected:
65 /** p1 in the range */
66 nsRefPtr<nsRange> mRange;
68 /** the editor for this transaction */
69 nsEditor* mEditor;
71 /** range updater object */
72 nsRangeUpdater* mRangeUpdater;
75 #endif