EditAggregateTransaction.h (1610B)
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/. */ 5 6 #ifndef EditAggregateTransaction_h 7 #define EditAggregateTransaction_h 8 9 #include "EditTransactionBase.h" 10 11 #include "mozilla/OwningNonNull.h" 12 #include "mozilla/RefPtr.h" 13 14 #include "nsAtom.h" 15 #include "nsCOMPtr.h" 16 #include "nsCycleCollectionParticipant.h" 17 #include "nsTArray.h" 18 #include "nsISupportsImpl.h" 19 20 namespace mozilla { 21 22 /** 23 * base class for all document editing transactions that require aggregation. 24 * provides a list of child transactions. 25 */ 26 class EditAggregateTransaction : public EditTransactionBase { 27 public: 28 NS_DECL_ISUPPORTS_INHERITED 29 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(EditAggregateTransaction, 30 EditTransactionBase) 31 32 NS_DECL_EDITTRANSACTIONBASE 33 34 MOZ_CAN_RUN_SCRIPT NS_IMETHOD RedoTransaction() override; 35 NS_IMETHOD Merge(nsITransaction* aOtherTransaction, bool* aDidMerge) override; 36 37 /** 38 * Get the name assigned to this transaction. 39 */ 40 nsAtom* GetName() const; 41 42 const nsTArray<OwningNonNull<EditTransactionBase>>& ChildTransactions() 43 const { 44 return mChildren; 45 } 46 47 protected: 48 EditAggregateTransaction() = default; 49 virtual ~EditAggregateTransaction() = default; 50 51 nsTArray<OwningNonNull<EditTransactionBase>> mChildren; 52 RefPtr<nsAtom> mName; 53 }; 54 55 } // namespace mozilla 56 57 #endif // #ifndef EditAggregateTransaction_h