2001-09-25 22:53:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00: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 18:02:45 +00:00
|
|
|
|
|
|
|
#ifndef DeleteRangeTxn_h__
|
|
|
|
#define DeleteRangeTxn_h__
|
|
|
|
|
1999-01-21 01:51:09 +00:00
|
|
|
#include "EditAggregateTxn.h"
|
1999-01-14 18:02:45 +00:00
|
|
|
#include "nsIDOMNode.h"
|
1999-03-09 20:04:59 +00:00
|
|
|
#include "nsIDOMRange.h"
|
1999-01-21 01:51:09 +00:00
|
|
|
#include "nsIEditor.h"
|
1999-01-14 18:02:45 +00:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
|
1999-08-09 01:37:50 +00:00
|
|
|
class nsIDOMRange;
|
|
|
|
class nsIEditor;
|
2002-11-10 15:11:08 +00:00
|
|
|
class nsRangeUpdater;
|
1999-08-09 01:37:50 +00:00
|
|
|
|
1999-01-14 18:02:45 +00:00
|
|
|
/**
|
|
|
|
* A transaction that deletes an entire range in the content tree
|
|
|
|
*/
|
1999-01-21 01:51:09 +00:00
|
|
|
class DeleteRangeTxn : public EditAggregateTxn
|
1999-01-14 18:02:45 +00:00
|
|
|
{
|
|
|
|
public:
|
1999-02-15 18:25:30 +00:00
|
|
|
/** initialize the transaction.
|
1999-02-17 19:42:29 +00:00
|
|
|
* @param aEditor the object providing basic editing operations
|
1999-02-15 18:25:30 +00:00
|
|
|
* @param aRange the range to delete
|
|
|
|
*/
|
2002-11-10 15:11:08 +00:00
|
|
|
NS_IMETHOD Init(nsIEditor *aEditor,
|
|
|
|
nsIDOMRange *aRange,
|
|
|
|
nsRangeUpdater *aRangeUpdater);
|
1999-01-21 01:51:09 +00:00
|
|
|
|
|
|
|
DeleteRangeTxn();
|
|
|
|
|
2009-05-09 04:59:25 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DeleteRangeTxn, EditAggregateTxn)
|
|
|
|
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
|
|
|
|
2007-01-11 14:38:02 +00:00
|
|
|
NS_DECL_EDITTXN
|
1999-01-14 18:02:45 +00:00
|
|
|
|
2007-01-11 14:38:02 +00:00
|
|
|
NS_IMETHOD RedoTransaction();
|
1999-09-21 22:31:27 +00:00
|
|
|
|
1999-01-21 01:51:09 +00:00
|
|
|
protected:
|
|
|
|
|
1999-03-02 05:30:53 +00:00
|
|
|
NS_IMETHOD CreateTxnsToDeleteBetween(nsIDOMNode *aStartParent,
|
1999-01-21 01:51:09 +00:00
|
|
|
PRUint32 aStartOffset,
|
|
|
|
PRUint32 aEndOffset);
|
|
|
|
|
1999-03-09 19:22:48 +00:00
|
|
|
NS_IMETHOD CreateTxnsToDeleteNodesBetween();
|
1999-01-21 01:51:09 +00:00
|
|
|
|
1999-03-02 05:30:53 +00:00
|
|
|
NS_IMETHOD CreateTxnsToDeleteContent(nsIDOMNode *aParent,
|
1999-01-21 01:51:09 +00:00
|
|
|
PRUint32 aOffset,
|
1999-12-07 08:30:19 +00:00
|
|
|
nsIEditor::EDirection aAction);
|
1999-01-21 01:51:09 +00:00
|
|
|
|
1999-01-14 18:02:45 +00:00
|
|
|
protected:
|
|
|
|
|
1999-03-09 19:22:48 +00:00
|
|
|
/** p1 in the range */
|
1999-05-28 00:13:02 +00:00
|
|
|
nsCOMPtr<nsIDOMRange> mRange; // is this really an owning ptr?
|
1999-03-09 19:22:48 +00:00
|
|
|
|
1999-01-14 18:02:45 +00:00
|
|
|
/** p1 in the range */
|
|
|
|
nsCOMPtr<nsIDOMNode> mStartParent;
|
|
|
|
|
|
|
|
/** p1 offset */
|
|
|
|
PRInt32 mStartOffset;
|
|
|
|
|
|
|
|
/** p2 in the range */
|
|
|
|
nsCOMPtr<nsIDOMNode> mEndParent;
|
|
|
|
|
1999-01-21 01:51:09 +00:00
|
|
|
/** the closest common parent of p1 and p2 */
|
|
|
|
nsCOMPtr<nsIDOMNode> mCommonParent;
|
|
|
|
|
1999-01-14 18:02:45 +00:00
|
|
|
/** p2 offset */
|
|
|
|
PRInt32 mEndOffset;
|
|
|
|
|
1999-02-17 19:42:29 +00:00
|
|
|
/** the editor for this transaction */
|
1999-05-28 00:13:02 +00:00
|
|
|
nsIEditor* mEditor;
|
1999-02-17 19:42:29 +00:00
|
|
|
|
2002-11-10 15:11:08 +00:00
|
|
|
/** range updater object */
|
|
|
|
nsRangeUpdater *mRangeUpdater;
|
1999-01-14 18:02:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|