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-01-21 01:51:09 +00:00
|
|
|
#include "nsCOMPtr.h"
|
2012-07-13 06:33:42 +00:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2014-08-20 12:25:16 +00:00
|
|
|
#include "nsGenericDOMDataNode.h"
|
2012-07-13 06:33:42 +00:00
|
|
|
#include "nsID.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nscore.h"
|
1999-01-07 17:56:20 +00:00
|
|
|
|
2012-06-08 09:58:29 +00:00
|
|
|
class nsEditor;
|
2002-11-10 15:11:08 +00:00
|
|
|
class nsRangeUpdater;
|
|
|
|
|
2014-08-20 12:25:16 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
1999-01-07 17:56:20 +00:00
|
|
|
/**
|
2012-06-08 09:58:29 +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!
|
|
|
|
*/
|
2014-08-20 12:25:16 +00:00
|
|
|
DeleteTextTxn(nsEditor& aEditor,
|
|
|
|
nsGenericDOMDataNode& aCharData,
|
|
|
|
uint32_t aOffset,
|
|
|
|
uint32_t aNumCharsToDelete,
|
|
|
|
nsRangeUpdater* aRangeUpdater);
|
1999-01-07 17:56:20 +00:00
|
|
|
|
2014-08-20 12:25:16 +00:00
|
|
|
nsresult Init();
|
1999-01-21 01:51:09 +00:00
|
|
|
|
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
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t GetOffset() { return mOffset; }
|
2006-10-05 13:20:30 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t GetNumCharsToDelete() { return mNumCharsToDelete; }
|
2006-10-05 13:20:30 +00:00
|
|
|
|
1999-01-07 17:56:20 +00:00
|
|
|
protected:
|
1999-02-22 15:53:31 +00:00
|
|
|
|
|
|
|
/** the provider of basic editing operations */
|
2014-08-20 12:25:16 +00:00
|
|
|
nsEditor& mEditor;
|
1999-02-22 15:53:31 +00:00
|
|
|
|
2012-06-08 09:58:29 +00:00
|
|
|
/** the CharacterData node to operate upon */
|
2014-08-20 12:25:16 +00:00
|
|
|
nsRefPtr<nsGenericDOMDataNode> mCharData;
|
2012-06-08 09:58:29 +00:00
|
|
|
|
|
|
|
/** the offset into mCharData where the deletion is to take place */
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t mOffset;
|
1999-01-07 17:56:20 +00:00
|
|
|
|
|
|
|
/** the number of characters to delete */
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t mNumCharsToDelete;
|
1999-01-07 17:56:20 +00:00
|
|
|
|
|
|
|
/** the text that was deleted */
|
|
|
|
nsString mDeletedText;
|
|
|
|
|
2002-11-10 15:11:08 +00:00
|
|
|
/** range updater object */
|
2012-06-08 09:58:29 +00:00
|
|
|
nsRangeUpdater* mRangeUpdater;
|
1999-01-07 17:56:20 +00:00
|
|
|
};
|
|
|
|
|
2014-08-20 12:25:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-01-07 17:56:20 +00:00
|
|
|
#endif
|