author Wes Kocher <wkocher@mozilla.com>
Tue, 24 Jun 2014 18:32:55 -0700
changeset 211405 71f6b8a9b2e8cb698a495eb29d7611cb030073a9
parent 211397 editor/libeditor/InsertTextTxn.h@5e9777d3805262d3179babc853832594c63a966b
child 211437 645ad2c2411421798c8e815bcd74aa8092aa066f
permissions -rw-r--r--
Backed out 6 changesets (bug 1028559, bug 1028565) for android mochitest bustage on a CLOSED TREE Backed out changeset fdd74c065e5d (bug 1028565) Backed out changeset 5e9777d38052 (bug 1028565) Backed out changeset 3510bcdba3fc (bug 1028565) Backed out changeset 62ad3254903e (bug 1028565) Backed out changeset e7557f70acfe (bug 1028565) Backed out changeset 5b1b527abe47 (bug 1028559)

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */

#ifndef InsertTextTxn_h__
#define InsertTextTxn_h__

#include "EditTxn.h"                    // for EditTxn, NS_DECL_EDITTXN
#include "nsCOMPtr.h"                   // for nsCOMPtr
#include "nsCycleCollectionParticipant.h"
#include "nsID.h"                       // for nsIID
#include "nsIDOMCharacterData.h"        // for nsIDOMCharacterData
#include "nsISupportsImpl.h"            // for NS_DECL_ISUPPORTS_INHERITED
#include "nsString.h"                   // for nsString
#include "nscore.h"                     // for NS_IMETHOD, nsAString

class nsIEditor;
class nsITransaction;

{/* 93276f00-ab2c-11d2-8f4b-006008159b0c*/ \
0x93276f00, 0xab2c, 0x11d2, \
{0x8f, 0xb4, 0x0, 0x60, 0x8, 0x15, 0x9b, 0xc} }

  * A transaction that inserts text into a content node. 
class InsertTextTxn : public EditTxn

  static const nsIID& GetCID() { static const nsIID iid = INSERT_TEXT_TXN_CID; return iid; }

  /** initialize the transaction
    * @param aElement the text content node
    * @param aOffset  the location in aElement to do the insertion
    * @param aString  the new text to insert
    * @param aPresShell used to get and set the selection
  NS_IMETHOD Init(nsIDOMCharacterData *aElement,
                  uint32_t aOffset,
                  const nsAString& aString,
                  nsIEditor *aEditor);



  NS_IMETHOD Merge(nsITransaction *aTransaction, bool *aDidMerge);

  /** return the string data associated with this transaction */
  NS_IMETHOD GetData(nsString& aResult);


  /** return true if aOtherTxn immediately follows this txn */
  virtual bool IsSequentialInsert(InsertTextTxn *aOtherTxn);
  /** the text element to operate upon */
  nsCOMPtr<nsIDOMCharacterData> mElement;
  /** the offset into mElement where the insertion is to take place */
  uint32_t mOffset;

  /** the text to insert into mElement at mOffset */
  nsString mStringToInsert;

  /** the editor, which we'll need to get the selection */
  nsIEditor *mEditor;