1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef EditAggregateTransaction_h
7 #define EditAggregateTransaction_h
9 #include "mozilla/EditTransactionBase.h"
10 #include "mozilla/OwningNonNull.h"
12 #include "nsCycleCollectionParticipant.h"
14 #include "nsISupportsImpl.h"
21 * base class for all document editing transactions that require aggregation.
22 * provides a list of child transactions.
24 class EditAggregateTransaction
: public EditTransactionBase
{
26 EditAggregateTransaction() = default;
30 * Creates an edit aggregate transaction. This never returns nullptr.
32 static already_AddRefed
<EditAggregateTransaction
> Create() {
33 RefPtr
<EditAggregateTransaction
> transaction
=
34 new EditAggregateTransaction();
35 return transaction
.forget();
38 NS_DECL_ISUPPORTS_INHERITED
39 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(EditAggregateTransaction
,
42 NS_DECL_EDITTRANSACTIONBASE
44 MOZ_CAN_RUN_SCRIPT NS_IMETHOD
RedoTransaction() override
;
45 NS_IMETHOD
Merge(nsITransaction
* aOtherTransaction
, bool* aDidMerge
) override
;
48 * Append a transaction to this aggregate.
50 NS_IMETHOD
AppendChild(EditTransactionBase
* aTransaction
);
53 * Get the name assigned to this transaction.
55 NS_IMETHOD
GetName(nsAtom
** aName
);
57 const nsTArray
<OwningNonNull
<EditTransactionBase
>>& ChildTransactions()
63 virtual ~EditAggregateTransaction() = default;
65 nsTArray
<OwningNonNull
<EditTransactionBase
>> mChildren
;
69 } // namespace mozilla
71 #endif // #ifndef EditAggregateTransaction_h