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 "EditTransactionBase.h"
11 #include "mozilla/OwningNonNull.h"
13 #include "nsCycleCollectionParticipant.h"
15 #include "nsISupportsImpl.h"
22 * base class for all document editing transactions that require aggregation.
23 * provides a list of child transactions.
25 class EditAggregateTransaction
: public EditTransactionBase
{
27 EditAggregateTransaction() = default;
31 * Creates an edit aggregate transaction. This never returns nullptr.
33 static already_AddRefed
<EditAggregateTransaction
> Create() {
34 RefPtr
<EditAggregateTransaction
> transaction
=
35 new EditAggregateTransaction();
36 return transaction
.forget();
39 NS_DECL_ISUPPORTS_INHERITED
40 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(EditAggregateTransaction
,
43 NS_DECL_EDITTRANSACTIONBASE
45 MOZ_CAN_RUN_SCRIPT NS_IMETHOD
RedoTransaction() override
;
46 NS_IMETHOD
Merge(nsITransaction
* aOtherTransaction
, bool* aDidMerge
) override
;
49 * Append a transaction to this aggregate.
51 NS_IMETHOD
AppendChild(EditTransactionBase
* aTransaction
);
54 * Get the name assigned to this transaction.
56 NS_IMETHOD
GetName(nsAtom
** aName
);
58 const nsTArray
<OwningNonNull
<EditTransactionBase
>>& ChildTransactions()
64 virtual ~EditAggregateTransaction() = default;
66 nsTArray
<OwningNonNull
<EditTransactionBase
>> mChildren
;
70 } // namespace mozilla
72 #endif // #ifndef EditAggregateTransaction_h