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
|
|
|
|
2014-08-20 05:25:17 -07:00
|
|
|
#ifndef InsertNodeTxn_h__
|
|
|
|
#define InsertNodeTxn_h__
|
2007-03-22 10:30:00 -07:00
|
|
|
|
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-08-20 05:25:17 -07:00
|
|
|
#include "nsIContent.h" // for nsIContent
|
2012-07-12 23:33:42 -07:00
|
|
|
#include "nsISupportsImpl.h" // for NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2014-08-20 05:25:17 -07:00
|
|
|
class nsEditor;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A transaction that inserts a single element
|
|
|
|
*/
|
2014-08-20 05:25:17 -07:00
|
|
|
class InsertNodeTxn : public EditTxn
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
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-08-20 05:25:17 -07:00
|
|
|
InsertNodeTxn(nsIContent& aNode, nsINode& aParent, int32_t aOffset,
|
|
|
|
nsEditor& aEditor);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-02-19 14:18:37 -08:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2014-08-20 05:25:17 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(InsertNodeTxn, EditTxn)
|
2009-05-08 21:59:25 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECL_EDITTXN
|
|
|
|
|
|
|
|
protected:
|
2014-08-20 05:25:17 -07:00
|
|
|
virtual ~InsertNodeTxn();
|
2014-07-08 14:23:18 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/** the element to insert */
|
2014-08-20 05:25:17 -07:00
|
|
|
nsCOMPtr<nsIContent> mNode;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** the node into which the new node will be inserted */
|
2014-08-20 05:25:17 -07:00
|
|
|
nsCOMPtr<nsINode> mParent;
|
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;
|
2014-08-20 05:25:17 -07:00
|
|
|
|
|
|
|
/** the editor for this transaction */
|
|
|
|
nsEditor& mEditor;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
2014-08-20 05:25:17 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|