|
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 nsStylesheetTxns_h__ |
|
7 #define nsStylesheetTxns_h__ |
|
8 |
|
9 #include "EditTxn.h" // for EditTxn, NS_DECL_EDITTXN |
|
10 #include "nsAutoPtr.h" // for nsRefPtr |
|
11 #include "nsCSSStyleSheet.h" // for nsCSSStyleSheet |
|
12 #include "nsCycleCollectionParticipant.h" |
|
13 #include "nsID.h" // for REFNSIID |
|
14 #include "nsISupportsImpl.h" // for nsCSSStyleSheet::Release |
|
15 #include "nscore.h" // for NS_IMETHOD |
|
16 |
|
17 class nsIEditor; |
|
18 |
|
19 class AddStyleSheetTxn : public EditTxn |
|
20 { |
|
21 public: |
|
22 /** Initialize the transaction. |
|
23 * @param aEditor the object providing core editing operations |
|
24 * @param aSheet the stylesheet to add |
|
25 */ |
|
26 NS_IMETHOD Init(nsIEditor *aEditor, |
|
27 nsCSSStyleSheet *aSheet); |
|
28 |
|
29 AddStyleSheetTxn(); |
|
30 |
|
31 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(AddStyleSheetTxn, EditTxn) |
|
32 NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr); |
|
33 |
|
34 NS_DECL_EDITTXN |
|
35 |
|
36 protected: |
|
37 |
|
38 nsIEditor* mEditor; // the editor that created this transaction |
|
39 nsRefPtr<nsCSSStyleSheet> mSheet; // the style sheet to add |
|
40 |
|
41 }; |
|
42 |
|
43 |
|
44 class RemoveStyleSheetTxn : public EditTxn |
|
45 { |
|
46 public: |
|
47 /** Initialize the transaction. |
|
48 * @param aEditor the object providing core editing operations |
|
49 * @param aSheet the stylesheet to remove |
|
50 */ |
|
51 NS_IMETHOD Init(nsIEditor *aEditor, |
|
52 nsCSSStyleSheet *aSheet); |
|
53 |
|
54 RemoveStyleSheetTxn(); |
|
55 |
|
56 NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(RemoveStyleSheetTxn, EditTxn) |
|
57 NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr); |
|
58 |
|
59 NS_DECL_EDITTXN |
|
60 |
|
61 protected: |
|
62 |
|
63 nsIEditor* mEditor; // the editor that created this transaction |
|
64 nsRefPtr<nsCSSStyleSheet> mSheet; // the style sheet to remove |
|
65 |
|
66 }; |
|
67 |
|
68 |
|
69 #endif /* nsStylesheetTxns_h__ */ |