2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07: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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef DeleteRangeTxn_h__
|
|
|
|
#define DeleteRangeTxn_h__
|
|
|
|
|
|
|
|
#include "EditAggregateTxn.h"
|
2012-07-12 23:33:42 -07:00
|
|
|
#include "EditTxn.h"
|
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "nsID.h"
|
|
|
|
#include "nsIEditor.h"
|
|
|
|
#include "nsISupportsImpl.h"
|
2012-06-25 03:22:49 -07:00
|
|
|
#include "nsRange.h"
|
2012-07-12 23:33:42 -07:00
|
|
|
#include "nscore.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-07-12 23:33:42 -07:00
|
|
|
class nsEditor;
|
|
|
|
class nsINode;
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsRangeUpdater;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A transaction that deletes an entire range in the content tree
|
|
|
|
*/
|
|
|
|
class DeleteRangeTxn : public EditAggregateTxn
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** initialize the transaction.
|
|
|
|
* @param aEditor the object providing basic editing operations
|
|
|
|
* @param aRange the range to delete
|
|
|
|
*/
|
2012-06-25 03:22:49 -07:00
|
|
|
nsresult Init(nsEditor* aEditor,
|
|
|
|
nsRange* aRange,
|
|
|
|
nsRangeUpdater* aRangeUpdater);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
DeleteRangeTxn();
|
|
|
|
|
2009-05-08 21:59:25 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DeleteRangeTxn, EditAggregateTxn)
|
|
|
|
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECL_EDITTXN
|
|
|
|
|
|
|
|
NS_IMETHOD RedoTransaction();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2012-06-25 03:22:49 -07:00
|
|
|
nsresult CreateTxnsToDeleteBetween(nsINode* aNode,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aStartOffset,
|
|
|
|
int32_t aEndOffset);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-06-25 03:22:49 -07:00
|
|
|
nsresult CreateTxnsToDeleteNodesBetween();
|
|
|
|
|
|
|
|
nsresult CreateTxnsToDeleteContent(nsINode* aParent,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aOffset,
|
2012-06-25 03:22:49 -07:00
|
|
|
nsIEditor::EDirection aAction);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
protected:
|
2012-06-25 03:22:49 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/** p1 in the range */
|
2012-06-25 03:22:49 -07:00
|
|
|
nsRefPtr<nsRange> mRange;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** the editor for this transaction */
|
2012-06-08 02:58:29 -07:00
|
|
|
nsEditor* mEditor;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** range updater object */
|
2012-06-25 03:22:49 -07:00
|
|
|
nsRangeUpdater* mRangeUpdater;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|