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-06-29 20:31:22 +00:00
|
|
|
|
|
|
|
#ifndef IMETextTxn_h__
|
|
|
|
#define IMETextTxn_h__
|
|
|
|
|
2014-08-29 11:43:24 +00:00
|
|
|
#include "EditTxn.h" // base class
|
|
|
|
#include "nsAutoPtr.h" // mTextNode, mRanges
|
|
|
|
#include "nsCycleCollectionParticipant.h" // various macros
|
|
|
|
#include "nsString.h" // mStringToInsert
|
2012-07-13 06:33:42 +00:00
|
|
|
|
2014-08-29 11:43:24 +00:00
|
|
|
class nsEditor;
|
1999-06-29 20:31:22 +00:00
|
|
|
|
2014-08-29 11:43:24 +00:00
|
|
|
#define NS_IMETEXTTXN_IID \
|
|
|
|
{ 0xb391355d, 0x346c, 0x43d1, \
|
|
|
|
{ 0x85, 0xed, 0x9e, 0x65, 0xbe, 0xe7, 0x7e, 0x48 } }
|
1999-06-29 20:31:22 +00:00
|
|
|
|
2014-08-29 11:43:24 +00:00
|
|
|
namespace mozilla {
|
1999-06-29 20:31:22 +00:00
|
|
|
|
2014-08-29 11:43:24 +00:00
|
|
|
class TextRangeArray;
|
1999-06-29 20:31:22 +00:00
|
|
|
|
2014-08-29 11:43:24 +00:00
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
class Text;
|
1999-06-29 20:31:22 +00:00
|
|
|
|
|
|
|
/**
|
2014-08-29 11:43:24 +00:00
|
|
|
* A transaction that inserts text into a content node.
|
1999-06-29 20:31:22 +00:00
|
|
|
*/
|
|
|
|
class IMETextTxn : public EditTxn
|
|
|
|
{
|
|
|
|
public:
|
2014-08-29 11:43:24 +00:00
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IMETEXTTXN_IID)
|
1999-07-15 19:13:46 +00:00
|
|
|
|
2014-08-29 11:43:24 +00:00
|
|
|
/** @param aTextNode the text content node
|
|
|
|
* @param aOffset the location in aTextNode to do the insertion
|
2003-06-30 15:02:48 +00:00
|
|
|
* @param aReplaceLength the length of text to replace (0 == no replacement)
|
2014-03-04 13:48:26 +00:00
|
|
|
* @param aTextRangeArray clauses and/or caret information. This may be null.
|
2014-08-29 11:43:24 +00:00
|
|
|
* @param aString the new text to insert
|
|
|
|
* @param aEditor used to get and set the selection
|
1999-06-29 20:31:22 +00:00
|
|
|
*/
|
2014-08-29 11:43:24 +00:00
|
|
|
IMETextTxn(Text& aTextNode, uint32_t aOffset, uint32_t aReplaceLength,
|
|
|
|
TextRangeArray* aTextRangeArray, const nsAString& aString,
|
|
|
|
nsEditor& aEditor);
|
1999-06-29 20:31:22 +00:00
|
|
|
|
2009-05-09 04:59:25 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(IMETextTxn, EditTxn)
|
|
|
|
|
2014-08-29 11:43:24 +00:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
1999-06-29 20:31:22 +00:00
|
|
|
|
2014-08-29 11:43:24 +00:00
|
|
|
NS_DECL_EDITTXN
|
2000-07-11 19:51:36 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD Merge(nsITransaction* aTransaction, bool* aDidMerge) override;
|
1999-06-29 20:31:22 +00:00
|
|
|
|
2014-08-29 11:43:24 +00:00
|
|
|
void MarkFixed();
|
1999-06-29 20:31:22 +00:00
|
|
|
|
2014-08-29 11:43:24 +00:00
|
|
|
private:
|
|
|
|
~IMETextTxn();
|
1999-06-29 20:31:22 +00:00
|
|
|
|
2014-03-04 13:48:26 +00:00
|
|
|
nsresult SetSelectionForRanges();
|
1999-06-29 20:31:22 +00:00
|
|
|
|
2014-08-29 11:43:24 +00:00
|
|
|
/** The text element to operate upon */
|
|
|
|
nsRefPtr<Text> mTextNode;
|
|
|
|
|
|
|
|
/** The offsets into mTextNode where the insertion should be placed */
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t mOffset;
|
1999-06-29 20:31:22 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t mReplaceLength;
|
1999-06-29 20:31:22 +00:00
|
|
|
|
2014-08-29 11:43:24 +00:00
|
|
|
/** The range list **/
|
2014-03-04 13:48:26 +00:00
|
|
|
nsRefPtr<mozilla::TextRangeArray> mRanges;
|
1999-06-29 20:31:22 +00:00
|
|
|
|
2014-08-29 11:43:24 +00:00
|
|
|
/** The text to insert into mTextNode at mOffset */
|
|
|
|
nsString mStringToInsert;
|
|
|
|
|
|
|
|
/** The editor, which is used to get the selection controller */
|
|
|
|
nsEditor& mEditor;
|
1999-06-29 20:31:22 +00:00
|
|
|
|
2014-08-29 11:43:24 +00:00
|
|
|
bool mFixed;
|
1999-06-29 20:31:22 +00:00
|
|
|
};
|
|
|
|
|
2014-08-29 11:43:24 +00:00
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(IMETextTxn, NS_IMETEXTTXN_IID)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-06-29 20:31:22 +00:00
|
|
|
#endif
|