LCOV - code coverage report
Current view: top level - editor/libeditor - InsertTextTransaction.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 1 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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/. */
       5             : 
       6             : #ifndef InsertTextTransaction_h
       7             : #define InsertTextTransaction_h
       8             : 
       9             : #include "mozilla/EditTransactionBase.h"  // base class
      10             : #include "nsCycleCollectionParticipant.h" // various macros
      11             : #include "nsID.h"                       // NS_DECLARE_STATIC_IID_ACCESSOR
      12             : #include "nsISupportsImpl.h"            // NS_DECL_ISUPPORTS_INHERITED
      13             : #include "nsString.h"                   // nsString members
      14             : #include "nscore.h"                     // NS_IMETHOD, nsAString
      15             : 
      16             : class nsITransaction;
      17             : 
      18             : #define NS_INSERTTEXTTXN_IID \
      19             : { 0x8c9ad77f, 0x22a7, 0x4d01, \
      20             :   { 0xb1, 0x59, 0x8a, 0x0f, 0xdb, 0x1d, 0x08, 0xe9 } }
      21             : 
      22             : namespace mozilla {
      23             : 
      24             : class EditorBase;
      25             : class RangeUpdater;
      26             : 
      27             : namespace dom {
      28             : class Text;
      29             : } // namespace dom
      30             : 
      31             : /**
      32             :  * A transaction that inserts text into a content node.
      33             :  */
      34             : class InsertTextTransaction final : public EditTransactionBase
      35             : {
      36             : public:
      37             :   NS_DECLARE_STATIC_IID_ACCESSOR(NS_INSERTTEXTTXN_IID)
      38             : 
      39             :   /**
      40             :    * @param aElement        The text content node.
      41             :    * @param aOffset         The location in aElement to do the insertion.
      42             :    * @param aString         The new text to insert.
      43             :    * @param aPresShell      Used to get and set the selection.
      44             :    * @param aRangeUpdater   The range updater
      45             :    */
      46             :   InsertTextTransaction(dom::Text& aTextNode, uint32_t aOffset,
      47             :                         const nsAString& aString, EditorBase& aEditorBase,
      48             :                         RangeUpdater* aRangeUpdater);
      49             : 
      50             :   NS_DECL_ISUPPORTS_INHERITED
      51           0 :   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(InsertTextTransaction,
      52             :                                            EditTransactionBase)
      53             : 
      54             :   NS_DECL_EDITTRANSACTIONBASE
      55             : 
      56             :   NS_IMETHOD Merge(nsITransaction* aTransaction, bool* aDidMerge) override;
      57             : 
      58             :   /**
      59             :    * Return the string data associated with this transaction.
      60             :    */
      61             :   void GetData(nsString& aResult);
      62             : 
      63             : private:
      64             :   virtual ~InsertTextTransaction();
      65             : 
      66             :   // Return true if aOtherTransaction immediately follows this transaction.
      67             :   bool IsSequentialInsert(InsertTextTransaction& aOtherTrasaction);
      68             : 
      69             :   // The Text node to operate upon.
      70             :   RefPtr<dom::Text> mTextNode;
      71             : 
      72             :   // The offset into mTextNode where the insertion is to take place.
      73             :   uint32_t mOffset;
      74             : 
      75             :   // The text to insert into mTextNode at mOffset.
      76             :   nsString mStringToInsert;
      77             : 
      78             :   // The editor, which we'll need to get the selection.
      79             :   RefPtr<EditorBase> mEditorBase;
      80             : 
      81             :   RangeUpdater* mRangeUpdater;
      82             : };
      83             : 
      84             : NS_DEFINE_STATIC_IID_ACCESSOR(InsertTextTransaction, NS_INSERTTEXTTXN_IID)
      85             : 
      86             : } // namespace mozilla
      87             : 
      88             : #endif // #ifndef InsertTextTransaction_h

Generated by: LCOV version 1.13