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"
|
|
|
|
#include "nsISupportsImpl.h" // for NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
#include "nscore.h" // for NS_IMETHOD
|
|
|
|
|
2013-01-09 15:05:08 -08:00
|
|
|
class nsEditor;
|
|
|
|
class nsINode;
|
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
|
|
|
|
*/
|
2013-01-09 15:05:08 -08:00
|
|
|
NS_IMETHOD Init(nsINode *aNode,
|
|
|
|
nsINode *aParent,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aOffset,
|
2013-01-09 15:05:08 -08:00
|
|
|
nsEditor *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:
|
2013-01-09 15:05:08 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/** the element to insert */
|
2013-01-09 15:05:08 -08:00
|
|
|
nsCOMPtr<nsINode> mNode;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** the node into which the new node will be inserted */
|
2013-01-09 15:05:08 -08:00
|
|
|
nsCOMPtr<nsINode> mParent;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** the editor for this transaction */
|
2013-01-09 15:05:08 -08:00
|
|
|
nsEditor* 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
|