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/. */
6 #include
"nsISupports.idl"
9 interface nsIEditorSpellCheckCallback
;
11 [scriptable
, uuid(a171c25f
-e4a8
-4d08
-adef
-b797e6377bdc
)]
12 interface nsIEditorSpellCheck
: nsISupports
16 * Returns true if we can enable spellchecking. If there are no available
17 * dictionaries, this will return false.
19 boolean canSpellCheck
();
22 * Turns on the spell checker for the given editor. enableSelectionChecking
23 * set means that we only want to check the current selection in the editor,
24 * (this controls the behavior of GetNextMisspelledWord). For spellchecking
25 * clients with no modal UI (such as inline spellcheckers), this flag doesn't
26 * matter. Initialization is asynchronous and is not complete until the given
29 void InitSpellChecker
(in nsIEditor editor
, in boolean enableSelectionChecking
,
30 [optional] in nsIEditorSpellCheckCallback
callback);
33 * When interactively spell checking the document, this will return the
34 * value of the next word that is misspelled. This also computes the
35 * suggestions which you can get by calling GetSuggestedWord.
37 * @see mozSpellChecker::GetNextMisspelledWord
40 AString GetNextMisspelledWord
();
43 * Used to get suggestions for the last word that was checked and found to
44 * be misspelled. The first call will give you the first (best) suggestion.
45 * Subsequent calls will iterate through all the suggestions, allowing you
46 * to build a list. When there are no more suggestions, an empty string
47 * (not a null pointer) will be returned.
49 * @see mozSpellChecker::GetSuggestedWord
51 AString GetSuggestedWord
();
54 * Check a given word. In spite of the name, this function checks the word
55 * you give it, returning true if the word is misspelled. If the word is
56 * misspelled, it will compute the suggestions which you can get from
59 * @see mozSpellChecker::CheckCurrentWord
61 boolean CheckCurrentWord
(in AString suggestedWord
);
64 * Use when modally checking the document to replace a word.
66 * @see mozSpellChecker::CheckCurrentWord
69 void ReplaceWord
(in AString misspelledWord
, in AString replaceWord
, in boolean allOccurrences
);
72 * @see mozSpellChecker::IgnoreAll
74 void IgnoreWordAllOccurrences
(in AString word
);
77 * Fills an internal list of words added to the personal dictionary. These
78 * words can be retrieved using GetPersonalDictionaryWord()
80 * @see mozSpellChecker::GetPersonalDictionary
81 * @see GetPersonalDictionaryWord
83 void GetPersonalDictionary
();
86 * Used after you call GetPersonalDictionary() to iterate through all the
87 * words added to the personal dictionary. Will return the empty string when
88 * there are no more words.
90 AString GetPersonalDictionaryWord
();
93 * Adds a word to the current personal dictionary.
95 * @see mozSpellChecker::AddWordToDictionary
97 void AddWordToDictionary
(in AString word
);
100 * Removes a word from the current personal dictionary.
102 * @see mozSpellChecker::RemoveWordFromPersonalDictionary
104 void RemoveWordFromDictionary
(in AString word
);
107 * Retrieves a list of the currently available dictionaries. The strings will
108 * typically be language IDs, like "en-US".
110 * @see mozISpellCheckingEngine::GetDictionaryList
112 Array
<ACString
> GetDictionaryList
();
115 * @see mozSpellChecker::GetCurrentDictionary
117 ACString GetCurrentDictionary
();
120 * @see mozSpellChecker::SetCurrentDictionary
122 void SetCurrentDictionary
(in ACString dictionary
);
125 * Call this to free up the spell checking object. It will also save the
126 * current selected language as the default for future use.
128 * If you have called CanSpellCheck but not InitSpellChecker, you can still
129 * call this function to clear the cached spell check object, and no
130 * preference saving will happen.
132 void UninitSpellChecker
();
134 const unsigned long FILTERTYPE_NORMAL
= 1;
135 const unsigned long FILTERTYPE_MAIL
= 2;
138 * Used to filter the content (for example, to skip blockquotes in email from
139 * spellchecking. Call this before calling InitSpellChecker; calling it
140 * after initialization will have no effect.
142 void setFilterType
(in unsigned long filterType
);
145 * Update the dictionary in use to be sure it corresponds to what the editor
146 * needs. The update is asynchronous and is not complete until the given
147 * callback is called.
149 void UpdateCurrentDictionary
([optional] in nsIEditorSpellCheckCallback
callback);
153 [scriptable
, function
, uuid(5f0a4bab
-8538-4074-89d3
-2f0e866a1c0b
)]
154 interface nsIEditorSpellCheckCallback
: nsISupports
156 void editorSpellCheckDone
();