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 CreateElementTxn_h__
|
|
|
|
#define CreateElementTxn_h__
|
|
|
|
|
|
|
|
#include "EditTxn.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2012-07-12 23:33:42 -07:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "nsISupportsImpl.h"
|
|
|
|
|
|
|
|
class nsEditor;
|
2014-08-20 05:25:16 -07:00
|
|
|
class nsIAtom;
|
|
|
|
class nsIContent;
|
|
|
|
class nsINode;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A transaction that creates a new node in the content tree.
|
|
|
|
*/
|
2014-08-20 05:25:16 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
class Element;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
class CreateElementTxn : public EditTxn
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/** Initialize the transaction.
|
|
|
|
* @param aEditor the provider of basic editing functionality
|
|
|
|
* @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 05:25:16 -07:00
|
|
|
CreateElementTxn(nsEditor& aEditor,
|
|
|
|
nsIAtom& aTag,
|
|
|
|
nsINode& aParent,
|
|
|
|
int32_t aOffsetInParent);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
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(CreateElementTxn, EditTxn)
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_DECL_EDITTXN
|
|
|
|
|
2015-01-01 22:14:13 -08:00
|
|
|
NS_IMETHOD RedoTransaction() MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-08-20 05:25:16 -07:00
|
|
|
already_AddRefed<Element> GetNewNode();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
protected:
|
2014-07-08 14:23:18 -07:00
|
|
|
virtual ~CreateElementTxn();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/** the document into which the new node will be inserted */
|
|
|
|
nsEditor* mEditor;
|
2014-08-20 05:25:16 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/** the tag (mapping to object type) for the new element */
|
2014-08-20 05:25:16 -07:00
|
|
|
nsCOMPtr<nsIAtom> mTag;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** the node into which the new node will be inserted */
|
2014-08-20 05:25:16 -07:00
|
|
|
nsCOMPtr<nsINode> mParent;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** the index in mParent for the new node */
|
2014-08-20 05:25:16 -07:00
|
|
|
int32_t mOffsetInParent;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** the new node to insert */
|
2014-08-20 05:25:16 -07:00
|
|
|
nsCOMPtr<Element> mNewNode;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** the node we will insert mNewNode before. We compute this ourselves. */
|
2014-08-20 05:25:16 -07:00
|
|
|
nsCOMPtr<nsIContent> mRefNode;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
2014-08-20 05:25:16 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|