editor/libeditor/base/CreateElementTxn.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

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef CreateElementTxn_h__
michael@0 7 #define CreateElementTxn_h__
michael@0 8
michael@0 9 #include "EditTxn.h"
michael@0 10 #include "nsCOMPtr.h"
michael@0 11 #include "nsCycleCollectionParticipant.h"
michael@0 12 #include "nsIDOMNode.h"
michael@0 13 #include "nsISupportsImpl.h"
michael@0 14 #include "nsString.h"
michael@0 15 #include "nscore.h"
michael@0 16
michael@0 17 class nsEditor;
michael@0 18
michael@0 19 /**
michael@0 20 * A transaction that creates a new node in the content tree.
michael@0 21 */
michael@0 22 class CreateElementTxn : public EditTxn
michael@0 23 {
michael@0 24 public:
michael@0 25 enum { eAppend=-1 };
michael@0 26
michael@0 27 /** Initialize the transaction.
michael@0 28 * @param aEditor the provider of basic editing functionality
michael@0 29 * @param aTag the tag (P, HR, TABLE, etc.) for the new element
michael@0 30 * @param aParent the node into which the new element will be inserted
michael@0 31 * @param aOffsetInParent the location in aParent to insert the new element
michael@0 32 * if eAppend, the new element is appended as the last child
michael@0 33 */
michael@0 34 NS_IMETHOD Init(nsEditor *aEditor,
michael@0 35 const nsAString& aTag,
michael@0 36 nsIDOMNode *aParent,
michael@0 37 uint32_t aOffsetInParent);
michael@0 38
michael@0 39 CreateElementTxn();
michael@0 40
michael@0 41 NS_DECL_ISUPPORTS_INHERITED
michael@0 42 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(CreateElementTxn, EditTxn)
michael@0 43
michael@0 44 NS_DECL_EDITTXN
michael@0 45
michael@0 46 NS_IMETHOD RedoTransaction();
michael@0 47
michael@0 48 NS_IMETHOD GetNewNode(nsIDOMNode **aNewNode);
michael@0 49
michael@0 50 protected:
michael@0 51
michael@0 52 /** the document into which the new node will be inserted */
michael@0 53 nsEditor* mEditor;
michael@0 54
michael@0 55 /** the tag (mapping to object type) for the new element */
michael@0 56 nsString mTag;
michael@0 57
michael@0 58 /** the node into which the new node will be inserted */
michael@0 59 nsCOMPtr<nsIDOMNode> mParent;
michael@0 60
michael@0 61 /** the index in mParent for the new node */
michael@0 62 uint32_t mOffsetInParent;
michael@0 63
michael@0 64 /** the new node to insert */
michael@0 65 nsCOMPtr<nsIDOMNode> mNewNode;
michael@0 66
michael@0 67 /** the node we will insert mNewNode before. We compute this ourselves. */
michael@0 68 nsCOMPtr<nsIDOMNode> mRefNode;
michael@0 69 };
michael@0 70
michael@0 71 #endif

mercurial