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"
|
|
|
|
|
|
|
|
class nsEditor;
|
2014-08-20 12:25:16 +00:00
|
|
|
class nsIAtom;
|
|
|
|
class nsIContent;
|
|
|
|
class nsINode;
|
1999-01-07 22:36:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A transaction that creates a new node in the content tree.
|
|
|
|
*/
|
2014-08-20 12:25:16 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
class Element;
|
|
|
|
|
1999-01-07 22:36:23 +00:00
|
|
|
class CreateElementTxn : public EditTxn
|
|
|
|
{
|
|
|
|
public:
|
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
|
|
|
|
*/
|
2014-08-20 12:25:16 +00:00
|
|
|
CreateElementTxn(nsEditor& aEditor,
|
|
|
|
nsIAtom& aTag,
|
|
|
|
nsINode& aParent,
|
|
|
|
int32_t aOffsetInParent);
|
1999-01-21 01:51:09 +00:00
|
|
|
|
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
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
NS_IMETHOD RedoTransaction() override;
|
1999-01-07 22:36:23 +00:00
|
|
|
|
2014-08-20 12:25:16 +00:00
|
|
|
already_AddRefed<Element> GetNewNode();
|
1999-02-24 17:24:37 +00:00
|
|
|
|
1999-01-07 22:36:23 +00:00
|
|
|
protected:
|
2014-07-08 21:23:18 +00:00
|
|
|
virtual ~CreateElementTxn();
|
|
|
|
|
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;
|
2014-08-20 12:25:16 +00:00
|
|
|
|
1999-01-07 22:36:23 +00:00
|
|
|
/** the tag (mapping to object type) for the new element */
|
2014-08-20 12:25:16 +00:00
|
|
|
nsCOMPtr<nsIAtom> mTag;
|
1999-01-07 22:36:23 +00:00
|
|
|
|
|
|
|
/** the node into which the new node will be inserted */
|
2014-08-20 12:25:16 +00:00
|
|
|
nsCOMPtr<nsINode> mParent;
|
1999-01-07 22:36:23 +00:00
|
|
|
|
|
|
|
/** the index in mParent for the new node */
|
2014-08-20 12:25:16 +00:00
|
|
|
int32_t mOffsetInParent;
|
1999-01-07 22:36:23 +00:00
|
|
|
|
|
|
|
/** the new node to insert */
|
2014-08-20 12:25:16 +00:00
|
|
|
nsCOMPtr<Element> mNewNode;
|
1999-01-07 22:36:23 +00:00
|
|
|
|
|
|
|
/** the node we will insert mNewNode before. We compute this ourselves. */
|
2014-08-20 12:25:16 +00:00
|
|
|
nsCOMPtr<nsIContent> mRefNode;
|
1999-01-07 22:36:23 +00:00
|
|
|
};
|
|
|
|
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2014-08-20 12:25:16 +00:00
|
|
|
|
1999-01-07 22:36:23 +00:00
|
|
|
#endif
|