|
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
|
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 #include "nsISupports.idl" |
|
7 |
|
8 interface nsIFile; |
|
9 interface mozIPersonalDictionary; |
|
10 |
|
11 [scriptable, uuid(8ba643a4-7ddc-4662-b976-7ec123843f10)] |
|
12 |
|
13 /** |
|
14 * This interface represents a SpellChecker. |
|
15 */ |
|
16 |
|
17 interface mozISpellCheckingEngine : nsISupports { |
|
18 /** |
|
19 * The name of the current dictionary. Is either a value from |
|
20 * getDictionaryList or the empty string if no dictionary is selected. |
|
21 * Setting this attribute to a value not in getDictionaryList will throw |
|
22 * NS_ERROR_FILE_NOT_FOUND. |
|
23 * |
|
24 * The spellcheck engine will send a notification with |
|
25 * "spellcheck-dictionary-update" as topic when this changes. |
|
26 * If the dictionary is changed to no dictionary (the empty string), an |
|
27 * observer is allowed to set another dictionary before it returns. |
|
28 */ |
|
29 attribute wstring dictionary; |
|
30 |
|
31 /** |
|
32 * The language this spellchecker is using when checking |
|
33 * |
|
34 * The spellcheck engine will send a notification with |
|
35 * "spellcheck-dictionary-update" as topic when this changes. |
|
36 */ |
|
37 readonly attribute wstring language; |
|
38 |
|
39 /** |
|
40 * Does the engine provide its own personal dictionary? |
|
41 */ |
|
42 readonly attribute boolean providesPersonalDictionary; |
|
43 |
|
44 /** |
|
45 * Does the engine provide its own word utils? |
|
46 */ |
|
47 readonly attribute boolean providesWordUtils; |
|
48 |
|
49 /** |
|
50 * The name of the engine |
|
51 */ |
|
52 readonly attribute wstring name; |
|
53 |
|
54 /** |
|
55 * a string indicating the copyright of the engine |
|
56 */ |
|
57 readonly attribute wstring copyright; |
|
58 |
|
59 /** |
|
60 * the personal dictionary |
|
61 */ |
|
62 attribute mozIPersonalDictionary personalDictionary; |
|
63 |
|
64 /** |
|
65 * Get the list of dictionaries |
|
66 */ |
|
67 void getDictionaryList([array, size_is(count)] out wstring dictionaries, out uint32_t count); |
|
68 |
|
69 /** |
|
70 * check a word |
|
71 * |
|
72 * The spellcheck engine will send a notification with |
|
73 * "spellcheck-dictionary-update" as topic when this changes. |
|
74 */ |
|
75 boolean check(in wstring word); |
|
76 |
|
77 /** |
|
78 * get a list of suggestions for a misspelled word |
|
79 * |
|
80 * The spellcheck engine will send a notification with |
|
81 * "spellcheck-dictionary-update" as topic when this changes. |
|
82 */ |
|
83 void suggest(in wstring word,[array, size_is(count)] out wstring suggestions, out uint32_t count); |
|
84 |
|
85 /** |
|
86 * Load dictionaries from the specified dir |
|
87 */ |
|
88 void loadDictionariesFromDir(in nsIFile dir); |
|
89 |
|
90 /** |
|
91 * Add dictionaries from a directory to the spell checker |
|
92 */ |
|
93 void addDirectory(in nsIFile dir); |
|
94 |
|
95 /** |
|
96 * Remove dictionaries from a directory from the spell checker |
|
97 */ |
|
98 void removeDirectory(in nsIFile dir); |
|
99 }; |
|
100 |
|
101 %{C++ |
|
102 #define DICTIONARY_SEARCH_DIRECTORY "DictD" |
|
103 #define DICTIONARY_SEARCH_DIRECTORY_LIST "DictDL" |
|
104 |
|
105 #define SPELLCHECK_DICTIONARY_UPDATE_NOTIFICATION \ |
|
106 "spellcheck-dictionary-update" |
|
107 %} |