editor/libeditor/base/DeleteTextTxn.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef DeleteTextTxn_h__
     7 #define DeleteTextTxn_h__
     9 #include "EditTxn.h"
    10 #include "nsCOMPtr.h"
    11 #include "nsCycleCollectionParticipant.h"
    12 #include "nsID.h"
    13 #include "nsIDOMCharacterData.h"
    14 #include "nsString.h"
    15 #include "nscore.h"
    17 class nsEditor;
    18 class nsRangeUpdater;
    20 /**
    21  * A transaction that removes text from a content node.
    22  */
    23 class DeleteTextTxn : public EditTxn
    24 {
    25 public:
    26   /** initialize the transaction.
    27     * @param aEditor  the provider of basic editing operations
    28     * @param aElement the content node to remove text from
    29     * @param aOffset  the location in aElement to begin the deletion
    30     * @param aNumCharsToDelete  the number of characters to delete.  Not the number of bytes!
    31     */
    32   NS_IMETHOD Init(nsEditor* aEditor,
    33                   nsIDOMCharacterData* aCharData,
    34                   uint32_t aOffset,
    35                   uint32_t aNumCharsToDelete,
    36                   nsRangeUpdater* aRangeUpdater);
    38   DeleteTextTxn();
    40   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DeleteTextTxn, EditTxn)
    41   NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
    43   NS_DECL_EDITTXN
    45   uint32_t GetOffset() { return mOffset; }
    47   uint32_t GetNumCharsToDelete() { return mNumCharsToDelete; }
    49 protected:
    51   /** the provider of basic editing operations */
    52   nsEditor* mEditor;
    54   /** the CharacterData node to operate upon */
    55   nsCOMPtr<nsIDOMCharacterData> mCharData;
    57   /** the offset into mCharData where the deletion is to take place */
    58   uint32_t mOffset;
    60   /** the number of characters to delete */
    61   uint32_t mNumCharsToDelete;
    63   /** the text that was deleted */
    64   nsString mDeletedText;
    66   /** range updater object */
    67   nsRangeUpdater* mRangeUpdater;
    68 };
    70 #endif

mercurial