|
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 nsEditRules_h__ |
|
7 #define nsEditRules_h__ |
|
8 |
|
9 #define NS_IEDITRULES_IID \ |
|
10 { 0x3836386d, 0x806a, 0x488d, \ |
|
11 { 0x8b, 0xab, 0xaf, 0x42, 0xbb, 0x4c, 0x90, 0x66 } } |
|
12 |
|
13 #include "nsEditor.h" |
|
14 |
|
15 class nsPlaintextEditor; |
|
16 class nsISelection; |
|
17 |
|
18 /*************************************************************************** |
|
19 * base for an object to encapsulate any additional info needed to be passed |
|
20 * to rules system by the editor |
|
21 */ |
|
22 class nsRulesInfo |
|
23 { |
|
24 public: |
|
25 |
|
26 nsRulesInfo(EditAction aAction) : action(aAction) {} |
|
27 virtual ~nsRulesInfo() {} |
|
28 |
|
29 EditAction action; |
|
30 }; |
|
31 |
|
32 /*************************************************************************** |
|
33 * Interface of editing rules. |
|
34 * |
|
35 */ |
|
36 class nsIEditRules : public nsISupports |
|
37 { |
|
38 public: |
|
39 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IEDITRULES_IID) |
|
40 |
|
41 //Interfaces for addref and release and queryinterface |
|
42 //NOTE: Use NS_DECL_ISUPPORTS_INHERITED in any class inherited from nsIEditRules |
|
43 |
|
44 NS_IMETHOD Init(nsPlaintextEditor *aEditor)=0; |
|
45 NS_IMETHOD SetInitialValue(const nsAString& aValue) = 0; |
|
46 NS_IMETHOD DetachEditor()=0; |
|
47 NS_IMETHOD BeforeEdit(EditAction action, |
|
48 nsIEditor::EDirection aDirection) = 0; |
|
49 NS_IMETHOD AfterEdit(EditAction action, |
|
50 nsIEditor::EDirection aDirection) = 0; |
|
51 NS_IMETHOD WillDoAction(mozilla::dom::Selection* aSelection, nsRulesInfo* aInfo, |
|
52 bool* aCancel, bool* aHandled) = 0; |
|
53 NS_IMETHOD DidDoAction(nsISelection *aSelection, nsRulesInfo *aInfo, nsresult aResult)=0; |
|
54 NS_IMETHOD DocumentIsEmpty(bool *aDocumentIsEmpty)=0; |
|
55 NS_IMETHOD DocumentModified()=0; |
|
56 }; |
|
57 |
|
58 NS_DEFINE_STATIC_IID_ACCESSOR(nsIEditRules, NS_IEDITRULES_IID) |
|
59 |
|
60 #endif //nsEditRules_h__ |
|
61 |