michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef DeleteTextTxn_h__ michael@0: #define DeleteTextTxn_h__ michael@0: michael@0: #include "EditTxn.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsCycleCollectionParticipant.h" michael@0: #include "nsID.h" michael@0: #include "nsIDOMCharacterData.h" michael@0: #include "nsString.h" michael@0: #include "nscore.h" michael@0: michael@0: class nsEditor; michael@0: class nsRangeUpdater; michael@0: michael@0: /** michael@0: * A transaction that removes text from a content node. michael@0: */ michael@0: class DeleteTextTxn : public EditTxn michael@0: { michael@0: public: michael@0: /** initialize the transaction. michael@0: * @param aEditor the provider of basic editing operations michael@0: * @param aElement the content node to remove text from michael@0: * @param aOffset the location in aElement to begin the deletion michael@0: * @param aNumCharsToDelete the number of characters to delete. Not the number of bytes! michael@0: */ michael@0: NS_IMETHOD Init(nsEditor* aEditor, michael@0: nsIDOMCharacterData* aCharData, michael@0: uint32_t aOffset, michael@0: uint32_t aNumCharsToDelete, michael@0: nsRangeUpdater* aRangeUpdater); michael@0: michael@0: DeleteTextTxn(); michael@0: michael@0: NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DeleteTextTxn, EditTxn) michael@0: NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr); michael@0: michael@0: NS_DECL_EDITTXN michael@0: michael@0: uint32_t GetOffset() { return mOffset; } michael@0: michael@0: uint32_t GetNumCharsToDelete() { return mNumCharsToDelete; } michael@0: michael@0: protected: michael@0: michael@0: /** the provider of basic editing operations */ michael@0: nsEditor* mEditor; michael@0: michael@0: /** the CharacterData node to operate upon */ michael@0: nsCOMPtr mCharData; michael@0: michael@0: /** the offset into mCharData where the deletion is to take place */ michael@0: uint32_t mOffset; michael@0: michael@0: /** the number of characters to delete */ michael@0: uint32_t mNumCharsToDelete; michael@0: michael@0: /** the text that was deleted */ michael@0: nsString mDeletedText; michael@0: michael@0: /** range updater object */ michael@0: nsRangeUpdater* mRangeUpdater; michael@0: }; michael@0: michael@0: #endif