2001-09-26 02:53:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04: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-08 01:36:23 +03:00
|
|
|
|
|
|
|
#ifndef CreateElementTxn_h__
|
|
|
|
#define CreateElementTxn_h__
|
|
|
|
|
|
|
|
#include "EditTxn.h"
|
1999-01-21 04:51:09 +03:00
|
|
|
#include "nsCOMPtr.h"
|
2012-07-13 10:33:42 +04:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "nsISupportsImpl.h"
|
|
|
|
|
|
|
|
class nsEditor;
|
2014-08-20 16:25:16 +04:00
|
|
|
class nsIAtom;
|
|
|
|
class nsIContent;
|
|
|
|
class nsINode;
|
1999-01-08 01:36:23 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A transaction that creates a new node in the content tree.
|
|
|
|
*/
|
2014-08-20 16:25:16 +04:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
class Element;
|
|
|
|
|
1999-01-08 01:36:23 +03:00
|
|
|
class CreateElementTxn : public EditTxn
|
|
|
|
{
|
|
|
|
public:
|
1999-02-15 21:25:30 +03:00
|
|
|
/** Initialize the transaction.
|
1999-02-22 18:53:31 +03:00
|
|
|
* @param aEditor the provider of basic editing functionality
|
1999-02-15 21:25:30 +03: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 16:25:16 +04:00
|
|
|
CreateElementTxn(nsEditor& aEditor,
|
|
|
|
nsIAtom& aTag,
|
|
|
|
nsINode& aParent,
|
|
|
|
int32_t aOffsetInParent);
|
1999-01-21 04:51:09 +03:00
|
|
|
|
2011-02-20 01:18:37 +03:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2009-05-09 08:59:25 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(CreateElementTxn, EditTxn)
|
|
|
|
|
2007-01-11 17:38:02 +03:00
|
|
|
NS_DECL_EDITTXN
|
1999-01-08 01:36:23 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD RedoTransaction() override;
|
1999-01-08 01:36:23 +03:00
|
|
|
|
2014-08-20 16:25:16 +04:00
|
|
|
already_AddRefed<Element> GetNewNode();
|
1999-02-24 20:24:37 +03:00
|
|
|
|
1999-01-08 01:36:23 +03:00
|
|
|
protected:
|
2014-07-09 01:23:18 +04:00
|
|
|
virtual ~CreateElementTxn();
|
|
|
|
|
1999-01-08 01:36:23 +03:00
|
|
|
/** the document into which the new node will be inserted */
|
2000-07-14 03:15:41 +04:00
|
|
|
nsEditor* mEditor;
|
2014-08-20 16:25:16 +04:00
|
|
|
|
1999-01-08 01:36:23 +03:00
|
|
|
/** the tag (mapping to object type) for the new element */
|
2014-08-20 16:25:16 +04:00
|
|
|
nsCOMPtr<nsIAtom> mTag;
|
1999-01-08 01:36:23 +03:00
|
|
|
|
|
|
|
/** the node into which the new node will be inserted */
|
2014-08-20 16:25:16 +04:00
|
|
|
nsCOMPtr<nsINode> mParent;
|
1999-01-08 01:36:23 +03:00
|
|
|
|
|
|
|
/** the index in mParent for the new node */
|
2014-08-20 16:25:16 +04:00
|
|
|
int32_t mOffsetInParent;
|
1999-01-08 01:36:23 +03:00
|
|
|
|
|
|
|
/** the new node to insert */
|
2014-08-20 16:25:16 +04:00
|
|
|
nsCOMPtr<Element> mNewNode;
|
1999-01-08 01:36:23 +03:00
|
|
|
|
|
|
|
/** the node we will insert mNewNode before. We compute this ourselves. */
|
2014-08-20 16:25:16 +04:00
|
|
|
nsCOMPtr<nsIContent> mRefNode;
|
1999-01-08 01:36:23 +03:00
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2014-08-20 16:25:16 +04:00
|
|
|
|
1999-01-08 01:36:23 +03:00
|
|
|
#endif
|