2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07: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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef InsertElementTxn_h__
|
|
|
|
#define InsertElementTxn_h__
|
|
|
|
|
2012-07-12 23:33:42 -07:00
|
|
|
#include "EditTxn.h" // for EditTxn, NS_DECL_EDITTXN
|
|
|
|
#include "nsCOMPtr.h" // for nsCOMPtr
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2014-06-04 20:51:34 -07:00
|
|
|
#include "nsIDOMNode.h" // for nsIDOMNode
|
2012-07-12 23:33:42 -07:00
|
|
|
#include "nsISupportsImpl.h" // for NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
#include "nscore.h" // for NS_IMETHOD
|
|
|
|
|
2014-06-04 20:51:34 -07:00
|
|
|
class nsIEditor;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A transaction that inserts a single element
|
|
|
|
*/
|
|
|
|
class InsertElementTxn : public EditTxn
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** initialize the transaction.
|
|
|
|
* @param aNode the node to insert
|
|
|
|
* @param aParent the node to insert into
|
|
|
|
* @param aOffset the offset in aParent to insert aNode
|
|
|
|
*/
|
2014-06-04 20:51:34 -07:00
|
|
|
NS_IMETHOD Init(nsIDOMNode *aNode,
|
|
|
|
nsIDOMNode *aParent,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aOffset,
|
2014-06-04 20:51:34 -07:00
|
|
|
nsIEditor *aEditor);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
InsertElementTxn();
|
|
|
|
|
2011-02-19 14:18:37 -08:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2009-05-08 21:59:25 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(InsertElementTxn, EditTxn)
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECL_EDITTXN
|
|
|
|
|
|
|
|
protected:
|
2014-06-04 20:51:34 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/** the element to insert */
|
2014-06-04 20:51:34 -07:00
|
|
|
nsCOMPtr<nsIDOMNode> mNode;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** the node into which the new node will be inserted */
|
2014-06-04 20:51:34 -07:00
|
|
|
nsCOMPtr<nsIDOMNode> mParent;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** the editor for this transaction */
|
2014-06-04 20:51:34 -07:00
|
|
|
nsIEditor* mEditor;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** the index in mParent for the new node */
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mOffset;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|