2001-09-25 22:53:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00: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/. */
|
1999-01-07 22:36:23 +00:00
|
|
|
|
|
|
|
#ifndef CreateElementTxn_h__
|
|
|
|
#define CreateElementTxn_h__
|
|
|
|
|
|
|
|
#include "EditTxn.h"
|
1999-01-21 01:51:09 +00:00
|
|
|
#include "nsCOMPtr.h"
|
2012-07-13 06:33:42 +00:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "nsISupportsImpl.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nscore.h"
|
|
|
|
|
|
|
|
class nsEditor;
|
2013-01-09 23:05:08 +00:00
|
|
|
class nsINode;
|
1999-01-07 22:36:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A transaction that creates a new node in the content tree.
|
|
|
|
*/
|
|
|
|
class CreateElementTxn : public EditTxn
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum { eAppend=-1 };
|
|
|
|
|
1999-02-15 18:25:30 +00:00
|
|
|
/** Initialize the transaction.
|
1999-02-22 15:53:31 +00:00
|
|
|
* @param aEditor the provider of basic editing functionality
|
1999-02-15 18:25:30 +00:00
|
|
|
* @param aTag the tag (P, HR, TABLE, etc.) for the new element
|
|
|
|
* @param aParent the node into which the new element will be inserted
|
|
|
|
* @param aOffsetInParent the location in aParent to insert the new element
|
|
|
|
* if eAppend, the new element is appended as the last child
|
|
|
|
*/
|
2000-07-13 23:15:41 +00:00
|
|
|
NS_IMETHOD Init(nsEditor *aEditor,
|
2002-03-23 22:16:54 +00:00
|
|
|
const nsAString& aTag,
|
2013-01-09 23:05:08 +00:00
|
|
|
nsINode *aParent,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aOffsetInParent);
|
1999-01-21 01:51:09 +00:00
|
|
|
|
|
|
|
CreateElementTxn();
|
|
|
|
|
2011-02-19 22:18:37 +00:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2009-05-09 04:59:25 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(CreateElementTxn, EditTxn)
|
|
|
|
|
2007-01-11 14:38:02 +00:00
|
|
|
NS_DECL_EDITTXN
|
1999-01-07 22:36:23 +00:00
|
|
|
|
2007-01-11 14:38:02 +00:00
|
|
|
NS_IMETHOD RedoTransaction();
|
1999-01-07 22:36:23 +00:00
|
|
|
|
2013-01-09 23:05:08 +00:00
|
|
|
NS_IMETHOD GetNewNode(nsINode **aNewNode);
|
1999-02-24 17:24:37 +00:00
|
|
|
|
1999-01-07 22:36:23 +00:00
|
|
|
protected:
|
2013-01-09 23:05:08 +00:00
|
|
|
|
1999-01-07 22:36:23 +00:00
|
|
|
/** the document into which the new node will be inserted */
|
2000-07-13 23:15:41 +00:00
|
|
|
nsEditor* mEditor;
|
2013-01-09 23:05:08 +00:00
|
|
|
|
1999-01-07 22:36:23 +00:00
|
|
|
/** the tag (mapping to object type) for the new element */
|
|
|
|
nsString mTag;
|
|
|
|
|
|
|
|
/** the node into which the new node will be inserted */
|
2013-01-09 23:05:08 +00:00
|
|
|
nsCOMPtr<nsINode> mParent;
|
1999-01-07 22:36:23 +00:00
|
|
|
|
|
|
|
/** the index in mParent for the new node */
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t mOffsetInParent;
|
1999-01-07 22:36:23 +00:00
|
|
|
|
|
|
|
/** the new node to insert */
|
2013-01-09 23:05:08 +00:00
|
|
|
nsCOMPtr<nsINode> mNewNode;
|
1999-01-07 22:36:23 +00:00
|
|
|
|
|
|
|
/** the node we will insert mNewNode before. We compute this ourselves. */
|
2013-01-09 23:05:08 +00:00
|
|
|
nsCOMPtr<nsINode> mRefNode;
|
1999-01-07 22:36:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|