editor/libeditor/base/DeleteNodeTxn.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/editor/libeditor/base/DeleteNodeTxn.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,59 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef DeleteNodeTxn_h__
    1.10 +#define DeleteNodeTxn_h__
    1.11 +
    1.12 +#include "EditTxn.h"
    1.13 +#include "nsCOMPtr.h"
    1.14 +#include "nsCycleCollectionParticipant.h"
    1.15 +#include "nsIContent.h"
    1.16 +#include "nsINode.h"
    1.17 +#include "nsISupportsImpl.h"
    1.18 +#include "nscore.h"
    1.19 +
    1.20 +class nsEditor;
    1.21 +class nsRangeUpdater;
    1.22 +
    1.23 +/**
    1.24 + * A transaction that deletes a single element
    1.25 + */
    1.26 +class DeleteNodeTxn : public EditTxn
    1.27 +{
    1.28 +public:
    1.29 +  /** initialize the transaction.
    1.30 +    * @param aElement the node to delete
    1.31 +    */
    1.32 +  nsresult Init(nsEditor* aEditor, nsINode* aNode,
    1.33 +                nsRangeUpdater* aRangeUpdater);
    1.34 +
    1.35 +  DeleteNodeTxn();
    1.36 +
    1.37 +  NS_DECL_ISUPPORTS_INHERITED
    1.38 +  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DeleteNodeTxn, EditTxn)
    1.39 +
    1.40 +  NS_DECL_EDITTXN
    1.41 +
    1.42 +  NS_IMETHOD RedoTransaction();
    1.43 +
    1.44 +protected:
    1.45 +
    1.46 +  /** the element to delete */
    1.47 +  nsCOMPtr<nsINode> mNode;
    1.48 +
    1.49 +  /** parent of node to delete */
    1.50 +  nsCOMPtr<nsINode> mParent;
    1.51 +
    1.52 +  /** next sibling to remember for undo/redo purposes */
    1.53 +  nsCOMPtr<nsIContent> mRefNode;
    1.54 +
    1.55 +  /** the editor for this transaction */
    1.56 +  nsEditor* mEditor;
    1.57 +
    1.58 +  /** range updater object */
    1.59 +  nsRangeUpdater* mRangeUpdater;
    1.60 +};
    1.61 +
    1.62 +#endif

mercurial