2001-09-26 02:53:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
1999-01-14 21:02:45 +03:00
|
|
|
|
|
|
|
#ifndef DeleteRangeTxn_h__
|
|
|
|
#define DeleteRangeTxn_h__
|
|
|
|
|
1999-01-21 04:51:09 +03:00
|
|
|
#include "EditAggregateTxn.h"
|
2012-07-13 10:33:42 +04:00
|
|
|
#include "EditTxn.h"
|
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "nsID.h"
|
|
|
|
#include "nsIEditor.h"
|
|
|
|
#include "nsISupportsImpl.h"
|
2012-06-25 14:22:49 +04:00
|
|
|
#include "nsRange.h"
|
2012-07-13 10:33:42 +04:00
|
|
|
#include "nscore.h"
|
1999-01-14 21:02:45 +03:00
|
|
|
|
2012-07-13 10:33:42 +04:00
|
|
|
class nsEditor;
|
|
|
|
class nsINode;
|
2002-11-10 18:11:08 +03:00
|
|
|
class nsRangeUpdater;
|
1999-08-09 05:37:50 +04:00
|
|
|
|
1999-01-14 21:02:45 +03:00
|
|
|
/**
|
|
|
|
* A transaction that deletes an entire range in the content tree
|
|
|
|
*/
|
1999-01-21 04:51:09 +03:00
|
|
|
class DeleteRangeTxn : public EditAggregateTxn
|
1999-01-14 21:02:45 +03:00
|
|
|
{
|
|
|
|
public:
|
1999-02-15 21:25:30 +03:00
|
|
|
/** initialize the transaction.
|
1999-02-17 22:42:29 +03:00
|
|
|
* @param aEditor the object providing basic editing operations
|
1999-02-15 21:25:30 +03:00
|
|
|
* @param aRange the range to delete
|
|
|
|
*/
|
2012-06-25 14:22:49 +04:00
|
|
|
nsresult Init(nsEditor* aEditor,
|
|
|
|
nsRange* aRange,
|
|
|
|
nsRangeUpdater* aRangeUpdater);
|
1999-01-21 04:51:09 +03:00
|
|
|
|
|
|
|
DeleteRangeTxn();
|
|
|
|
|
2009-05-09 08:59:25 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DeleteRangeTxn, EditAggregateTxn)
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
|
2009-05-09 08:59:25 +04:00
|
|
|
|
2007-01-11 17:38:02 +03:00
|
|
|
NS_DECL_EDITTXN
|
1999-01-14 21:02:45 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD RedoTransaction() override;
|
1999-09-22 02:31:27 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void LastRelease() override
|
2013-07-09 21:30:58 +04:00
|
|
|
{
|
|
|
|
mRange = nullptr;
|
|
|
|
EditAggregateTxn::LastRelease();
|
|
|
|
}
|
1999-01-21 04:51:09 +03:00
|
|
|
protected:
|
|
|
|
|
2012-06-25 14:22:49 +04:00
|
|
|
nsresult CreateTxnsToDeleteBetween(nsINode* aNode,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aStartOffset,
|
|
|
|
int32_t aEndOffset);
|
1999-01-21 04:51:09 +03:00
|
|
|
|
2012-06-25 14:22:49 +04:00
|
|
|
nsresult CreateTxnsToDeleteNodesBetween();
|
|
|
|
|
|
|
|
nsresult CreateTxnsToDeleteContent(nsINode* aParent,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aOffset,
|
2012-06-25 14:22:49 +04:00
|
|
|
nsIEditor::EDirection aAction);
|
1999-01-21 04:51:09 +03:00
|
|
|
|
1999-01-14 21:02:45 +03:00
|
|
|
protected:
|
2012-06-25 14:22:49 +04:00
|
|
|
|
1999-03-09 22:22:48 +03:00
|
|
|
/** p1 in the range */
|
2012-06-25 14:22:49 +04:00
|
|
|
nsRefPtr<nsRange> mRange;
|
1999-03-09 22:22:48 +03:00
|
|
|
|
1999-02-17 22:42:29 +03:00
|
|
|
/** the editor for this transaction */
|
2012-06-08 13:58:29 +04:00
|
|
|
nsEditor* mEditor;
|
1999-02-17 22:42:29 +03:00
|
|
|
|
2002-11-10 18:11:08 +03:00
|
|
|
/** range updater object */
|
2012-06-25 14:22:49 +04:00
|
|
|
nsRangeUpdater* mRangeUpdater;
|
1999-01-14 21:02:45 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|