Line data Source code
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 StylesheetTransactions_h
7 : #define StylesheetTransactions_h
8 :
9 : #include "mozilla/EditorBase.h" // mEditor
10 : #include "mozilla/EditTransactionBase.h" // for EditTransactionBase, etc.
11 : #include "mozilla/StyleSheet.h" // for mozilla::StyleSheet
12 : #include "nsCycleCollectionParticipant.h"
13 : #include "nsID.h" // for REFNSIID
14 : #include "nscore.h" // for NS_IMETHOD
15 :
16 : namespace mozilla {
17 :
18 0 : class AddStyleSheetTransaction final : public EditTransactionBase
19 : {
20 : public:
21 : /**
22 : * @param aEditor The object providing core editing operations
23 : * @param aSheet The stylesheet to add
24 : */
25 : AddStyleSheetTransaction(EditorBase& aEditor, StyleSheet* aSheet);
26 :
27 0 : NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(AddStyleSheetTransaction,
28 : EditTransactionBase)
29 : NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
30 :
31 : NS_DECL_EDITTRANSACTIONBASE
32 :
33 : protected:
34 : // The editor that created this transaction.
35 : RefPtr<EditorBase> mEditorBase;
36 : // The style sheet to add.
37 : RefPtr<mozilla::StyleSheet> mSheet;
38 : };
39 :
40 :
41 0 : class RemoveStyleSheetTransaction final : public EditTransactionBase
42 : {
43 : public:
44 : /**
45 : * @param aEditor The object providing core editing operations.
46 : * @param aSheet The stylesheet to remove.
47 : */
48 : RemoveStyleSheetTransaction(EditorBase& aEditor, StyleSheet* aSheet);
49 :
50 0 : NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(RemoveStyleSheetTransaction,
51 : EditTransactionBase)
52 : NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
53 :
54 : NS_DECL_EDITTRANSACTIONBASE
55 :
56 : protected:
57 : // The editor that created this transaction.
58 : RefPtr<EditorBase> mEditorBase;
59 : // The style sheet to remove.
60 : RefPtr<StyleSheet> mSheet;
61 :
62 : };
63 :
64 : } // namespace mozilla
65 :
66 : #endif // #ifndef StylesheetTransactions_h
|