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-14 21:02:45 +03:00
|
|
|
|
2016-07-07 09:08:33 +03:00
|
|
|
#ifndef DeleteNodeTransaction_h
|
|
|
|
#define DeleteNodeTransaction_h
|
1999-01-14 21:02:45 +03:00
|
|
|
|
2016-07-08 08:03:31 +03:00
|
|
|
#include "mozilla/EditTransactionBase.h"
|
1999-01-14 21:02:45 +03:00
|
|
|
#include "nsCOMPtr.h"
|
2012-07-13 10:33:42 +04:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "nsIContent.h"
|
|
|
|
#include "nsINode.h"
|
|
|
|
#include "nsISupportsImpl.h"
|
|
|
|
#include "nscore.h"
|
1999-01-14 21:02:45 +03:00
|
|
|
|
2016-07-07 09:08:33 +03:00
|
|
|
namespace mozilla {
|
|
|
|
|
2016-07-08 07:10:13 +03:00
|
|
|
class EditorBase;
|
2016-06-24 09:01:40 +03:00
|
|
|
class RangeUpdater;
|
|
|
|
|
1999-01-14 21:02:45 +03:00
|
|
|
/**
|
|
|
|
* A transaction that deletes a single element
|
|
|
|
*/
|
2016-07-08 03:48:34 +03:00
|
|
|
class DeleteNodeTransaction final : public EditTransactionBase
|
1999-01-14 21:02:45 +03:00
|
|
|
{
|
|
|
|
public:
|
2017-03-10 07:23:40 +03:00
|
|
|
DeleteNodeTransaction(EditorBase& aEditorBase, nsINode& aNodeToDelete,
|
|
|
|
RangeUpdater* aRangeUpdater);
|
|
|
|
|
2016-07-07 09:08:33 +03:00
|
|
|
/**
|
2017-03-10 07:23:40 +03:00
|
|
|
* CanDoIt() returns true if there are enough members and can modify the
|
|
|
|
* parent. Otherwise, false.
|
2016-07-07 09:08:33 +03:00
|
|
|
*/
|
2017-03-10 07:23:40 +03:00
|
|
|
bool CanDoIt() const;
|
1999-01-21 04:51:09 +03:00
|
|
|
|
2011-02-20 01:18:37 +03:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2016-07-08 03:48:34 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DeleteNodeTransaction,
|
|
|
|
EditTransactionBase)
|
2009-05-09 08:59:25 +04:00
|
|
|
|
2016-07-08 03:48:34 +03:00
|
|
|
NS_DECL_EDITTRANSACTIONBASE
|
1999-01-14 21:02:45 +03:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD RedoTransaction() override;
|
1999-09-22 02:31:27 +04:00
|
|
|
|
1999-01-14 21:02:45 +03:00
|
|
|
protected:
|
2016-07-07 09:08:33 +03:00
|
|
|
virtual ~DeleteNodeTransaction();
|
2012-06-19 17:23:36 +04:00
|
|
|
|
2017-03-10 07:23:40 +03:00
|
|
|
// The editor for this transaction.
|
2017-03-21 13:00:36 +03:00
|
|
|
RefPtr<EditorBase> mEditorBase;
|
2017-03-10 07:23:40 +03:00
|
|
|
|
2016-07-07 09:08:33 +03:00
|
|
|
// The element to delete.
|
2017-03-10 07:23:40 +03:00
|
|
|
nsCOMPtr<nsINode> mNodeToDelete;
|
1999-01-14 21:02:45 +03:00
|
|
|
|
2016-07-07 09:08:33 +03:00
|
|
|
// Parent of node to delete.
|
2017-03-10 07:23:40 +03:00
|
|
|
nsCOMPtr<nsINode> mParentNode;
|
1999-01-14 21:02:45 +03:00
|
|
|
|
2016-07-07 09:08:33 +03:00
|
|
|
// Next sibling to remember for undo/redo purposes.
|
2012-06-19 17:23:36 +04:00
|
|
|
nsCOMPtr<nsIContent> mRefNode;
|
1999-01-14 21:02:45 +03:00
|
|
|
|
2016-07-07 09:08:33 +03:00
|
|
|
// Range updater object.
|
2016-06-24 09:01:40 +03:00
|
|
|
RangeUpdater* mRangeUpdater;
|
1999-01-14 21:02:45 +03:00
|
|
|
};
|
|
|
|
|
2016-07-07 09:08:33 +03:00
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // #ifndef DeleteNodeTransaction_h
|