Bug 867089 - Validate the playbackRate before using it. r=ehsan
[gecko.git] / editor / idl / nsIEditorSpellCheck.idl
blob9ebc5025b3923beffd63fecb1b414a6c1028ccc6
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"
8 interface nsIEditor;
9 interface nsITextServicesFilter;
11 [scriptable, uuid(334946c3-0e93-4aac-b662-e1b56f95d68b)]
12 interface nsIEditorSpellCheck : nsISupports
15 /**
16 * Call this on any change in installed dictionaries to ensure that the spell
17 * checker is not using a current dictionary which is no longer available.
18 * If the current dictionary is no longer available, then pick another one.
20 void checkCurrentDictionary();
22 /**
23 * Returns true if we can enable spellchecking. If there are no available
24 * dictionaries, this will return false.
26 boolean canSpellCheck();
28 /**
29 * Turns on the spell checker for the given editor. enableSelectionChecking
30 * set means that we only want to check the current selection in the editor,
31 * (this controls the behavior of GetNextMisspelledWord). For spellchecking
32 * clients with no modal UI (such as inline spellcheckers), this flag doesn't
33 * matter
35 void InitSpellChecker(in nsIEditor editor, in boolean enableSelectionChecking);
37 /**
38 * When interactively spell checking the document, this will return the
39 * value of the next word that is misspelled. This also computes the
40 * suggestions which you can get by calling GetSuggestedWord.
42 * @see nsISpellChecker::GetNextMisspelledWord
44 wstring GetNextMisspelledWord();
46 /**
47 * Used to get suggestions for the last word that was checked and found to
48 * be misspelled. The first call will give you the first (best) suggestion.
49 * Subsequent calls will iterate through all the suggestions, allowing you
50 * to build a list. When there are no more suggestions, an empty string
51 * (not a null pointer) will be returned.
53 * @see nsISpellChecker::GetSuggestedWord
55 wstring GetSuggestedWord();
57 /**
58 * Check a given word. In spite of the name, this function checks the word
59 * you give it, returning true if the word is misspelled. If the word is
60 * misspelled, it will compute the suggestions which you can get from
61 * GetSuggestedWord().
63 * @see nsISpellChecker::CheckCurrentWord
65 boolean CheckCurrentWord(in wstring suggestedWord);
67 /**
68 * Use when modally checking the document to replace a word.
70 * @see nsISpellChecker::CheckCurrentWord
72 void ReplaceWord(in wstring misspelledWord, in wstring replaceWord, in boolean allOccurrences);
74 /**
75 * @see nsISpellChecker::IgnoreAll
77 void IgnoreWordAllOccurrences(in wstring word);
79 /**
80 * Fills an internal list of words added to the personal dictionary. These
81 * words can be retrieved using GetPersonalDictionaryWord()
83 * @see nsISpellChecker::GetPersonalDictionary
84 * @see GetPersonalDictionaryWord
86 void GetPersonalDictionary();
88 /**
89 * Used after you call GetPersonalDictionary() to iterate through all the
90 * words added to the personal dictionary. Will return the empty string when
91 * there are no more words.
93 wstring GetPersonalDictionaryWord();
95 /**
96 * Adds a word to the current personal dictionary.
98 * @see nsISpellChecker::AddWordToDictionary
100 void AddWordToDictionary(in wstring word);
103 * Removes a word from the current personal dictionary.
105 * @see nsISpellChecker::RemoveWordFromPersonalDictionary
107 void RemoveWordFromDictionary(in wstring word);
110 * Retrieves a list of the currently available dictionaries. The strings will
111 * typically be language IDs, like "en-US".
113 * @see mozISpellCheckingEngine::GetDictionaryList
115 void GetDictionaryList([array, size_is(count)] out wstring dictionaryList, out uint32_t count);
118 * @see nsISpellChecker::GetCurrentDictionary
120 AString GetCurrentDictionary();
123 * @see nsISpellChecker::SetCurrentDictionary
125 void SetCurrentDictionary(in AString dictionary);
128 * Call this to free up the spell checking object. It will also save the
129 * current selected language as the default for future use.
131 * If you have called CanSpellCheck but not InitSpellChecker, you can still
132 * call this function to clear the cached spell check object, and no
133 * preference saving will happen.
135 void UninitSpellChecker();
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 * @see nsITextServicesDocument::setFilter
144 void setFilter(in nsITextServicesFilter filter);
147 * Like CheckCurrentWord, checks the word you give it, returning true if it's
148 * misspelled. This is faster than CheckCurrentWord because it does not
149 * compute any suggestions.
151 * Watch out: this does not clear any suggestions left over from previous
152 * calls to CheckCurrentWord, so there may be suggestions, but they will be
153 * invalid.
155 boolean CheckCurrentWordNoSuggest(in wstring suggestedWord);
158 * Update the dictionary in use to be sure it corresponds to what the editor
159 * needs.
161 void UpdateCurrentDictionary();