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-07 17:56:20 +00:00
|
|
|
|
|
|
|
#ifndef DeleteTextTxn_h__
|
|
|
|
#define DeleteTextTxn_h__
|
|
|
|
|
|
|
|
#include "EditTxn.h"
|
1999-02-22 15:53:31 +00:00
|
|
|
#include "nsIEditor.h"
|
1999-01-21 01:51:09 +00:00
|
|
|
#include "nsIDOMCharacterData.h"
|
|
|
|
#include "nsCOMPtr.h"
|
1999-01-07 17:56:20 +00:00
|
|
|
|
2002-11-10 15:11:08 +00:00
|
|
|
class nsRangeUpdater;
|
|
|
|
|
1999-01-07 17:56:20 +00:00
|
|
|
/**
|
1999-02-15 18:25:30 +00:00
|
|
|
* A transaction that removes text from a content node.
|
1999-01-07 17:56:20 +00:00
|
|
|
*/
|
|
|
|
class DeleteTextTxn : public EditTxn
|
|
|
|
{
|
|
|
|
public:
|
1999-02-15 18:25:30 +00:00
|
|
|
/** initialize the transaction.
|
1999-02-22 15:53:31 +00:00
|
|
|
* @param aEditor the provider of basic editing operations
|
1999-02-15 18:25:30 +00:00
|
|
|
* @param aElement the content node to remove text from
|
|
|
|
* @param aOffset the location in aElement to begin the deletion
|
|
|
|
* @param aNumCharsToDelete the number of characters to delete. Not the number of bytes!
|
|
|
|
*/
|
1999-03-02 05:30:53 +00:00
|
|
|
NS_IMETHOD Init(nsIEditor *aEditor,
|
|
|
|
nsIDOMCharacterData *aElement,
|
|
|
|
PRUint32 aOffset,
|
2002-11-10 15:11:08 +00:00
|
|
|
PRUint32 aNumCharsToDelete,
|
|
|
|
nsRangeUpdater *aRangeUpdater);
|
1999-01-07 17:56:20 +00:00
|
|
|
|
1999-01-21 01:51:09 +00:00
|
|
|
DeleteTextTxn();
|
|
|
|
|
2009-05-09 04:59:25 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DeleteTextTxn, EditTxn)
|
|
|
|
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
|
|
|
|
2007-01-11 14:38:02 +00:00
|
|
|
NS_DECL_EDITTXN
|
1999-09-21 22:31:27 +00:00
|
|
|
|
2006-10-05 13:20:30 +00:00
|
|
|
PRUint32 GetOffset() { return mOffset; }
|
|
|
|
|
|
|
|
PRUint32 GetNumCharsToDelete() { return mNumCharsToDelete; }
|
|
|
|
|
1999-01-07 17:56:20 +00:00
|
|
|
protected:
|
1999-02-22 15:53:31 +00:00
|
|
|
|
|
|
|
/** the provider of basic editing operations */
|
1999-05-28 00:13:02 +00:00
|
|
|
nsIEditor* mEditor;
|
1999-02-22 15:53:31 +00:00
|
|
|
|
1999-01-07 17:56:20 +00:00
|
|
|
/** the text element to operate upon */
|
1999-01-21 01:51:09 +00:00
|
|
|
nsCOMPtr<nsIDOMCharacterData> mElement;
|
1999-01-07 17:56:20 +00:00
|
|
|
|
|
|
|
/** the offset into mElement where the deletion is to take place */
|
|
|
|
PRUint32 mOffset;
|
|
|
|
|
|
|
|
/** the number of characters to delete */
|
|
|
|
PRUint32 mNumCharsToDelete;
|
|
|
|
|
|
|
|
/** the text that was deleted */
|
|
|
|
nsString mDeletedText;
|
|
|
|
|
2002-11-10 15:11:08 +00:00
|
|
|
/** range updater object */
|
|
|
|
nsRangeUpdater *mRangeUpdater;
|
1999-01-07 17:56:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|