Bug 1039883 - release Tiled layer's gralloc when an application is background r=nical
[gecko.git] / editor / nsIEditorSpellCheck.idl
blobef1c7f54b37c4420246f7ebe890b66fdbea7be29
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;
10 interface nsIEditorSpellCheckCallback;
12 [scriptable, uuid(dd32ef3b-a7d8-43d1-9617-5f2dddbe29eb)]
13 interface nsIEditorSpellCheck : nsISupports
16 /**
17 * Call this on any change in installed dictionaries to ensure that the spell
18 * checker is not using a current dictionary which is no longer available.
19 * If the current dictionary is no longer available, then pick another one.
21 void checkCurrentDictionary();
23 /**
24 * Returns true if we can enable spellchecking. If there are no available
25 * dictionaries, this will return false.
27 boolean canSpellCheck();
29 /**
30 * Turns on the spell checker for the given editor. enableSelectionChecking
31 * set means that we only want to check the current selection in the editor,
32 * (this controls the behavior of GetNextMisspelledWord). For spellchecking
33 * clients with no modal UI (such as inline spellcheckers), this flag doesn't
34 * matter. Initialization is asynchronous and is not complete until the given
35 * callback is called.
37 void InitSpellChecker(in nsIEditor editor, in boolean enableSelectionChecking,
38 [optional] in nsIEditorSpellCheckCallback callback);
40 /**
41 * When interactively spell checking the document, this will return the
42 * value of the next word that is misspelled. This also computes the
43 * suggestions which you can get by calling GetSuggestedWord.
45 * @see nsISpellChecker::GetNextMisspelledWord
47 wstring GetNextMisspelledWord();
49 /**
50 * Used to get suggestions for the last word that was checked and found to
51 * be misspelled. The first call will give you the first (best) suggestion.
52 * Subsequent calls will iterate through all the suggestions, allowing you
53 * to build a list. When there are no more suggestions, an empty string
54 * (not a null pointer) will be returned.
56 * @see nsISpellChecker::GetSuggestedWord
58 wstring GetSuggestedWord();
60 /**
61 * Check a given word. In spite of the name, this function checks the word
62 * you give it, returning true if the word is misspelled. If the word is
63 * misspelled, it will compute the suggestions which you can get from
64 * GetSuggestedWord().
66 * @see nsISpellChecker::CheckCurrentWord
68 boolean CheckCurrentWord(in wstring suggestedWord);
70 /**
71 * Use when modally checking the document to replace a word.
73 * @see nsISpellChecker::CheckCurrentWord
75 void ReplaceWord(in wstring misspelledWord, in wstring replaceWord, in boolean allOccurrences);
77 /**
78 * @see nsISpellChecker::IgnoreAll
80 void IgnoreWordAllOccurrences(in wstring word);
82 /**
83 * Fills an internal list of words added to the personal dictionary. These
84 * words can be retrieved using GetPersonalDictionaryWord()
86 * @see nsISpellChecker::GetPersonalDictionary
87 * @see GetPersonalDictionaryWord
89 void GetPersonalDictionary();
91 /**
92 * Used after you call GetPersonalDictionary() to iterate through all the
93 * words added to the personal dictionary. Will return the empty string when
94 * there are no more words.
96 wstring GetPersonalDictionaryWord();
98 /**
99 * Adds a word to the current personal dictionary.
101 * @see nsISpellChecker::AddWordToDictionary
103 void AddWordToDictionary(in wstring word);
106 * Removes a word from the current personal dictionary.
108 * @see nsISpellChecker::RemoveWordFromPersonalDictionary
110 void RemoveWordFromDictionary(in wstring word);
113 * Retrieves a list of the currently available dictionaries. The strings will
114 * typically be language IDs, like "en-US".
116 * @see mozISpellCheckingEngine::GetDictionaryList
118 void GetDictionaryList([array, size_is(count)] out wstring dictionaryList, out uint32_t count);
121 * @see nsISpellChecker::GetCurrentDictionary
123 AString GetCurrentDictionary();
126 * @see nsISpellChecker::SetCurrentDictionary
128 void SetCurrentDictionary(in AString dictionary);
131 * Call this to free up the spell checking object. It will also save the
132 * current selected language as the default for future use.
134 * If you have called CanSpellCheck but not InitSpellChecker, you can still
135 * call this function to clear the cached spell check object, and no
136 * preference saving will happen.
138 void UninitSpellChecker();
141 * Used to filter the content (for example, to skip blockquotes in email from
142 * spellchecking. Call this before calling InitSpellChecker; calling it
143 * after initialization will have no effect.
145 * @see nsITextServicesDocument::setFilter
147 void setFilter(in nsITextServicesFilter filter);
150 * Like CheckCurrentWord, checks the word you give it, returning true if it's
151 * misspelled. This is faster than CheckCurrentWord because it does not
152 * compute any suggestions.
154 * Watch out: this does not clear any suggestions left over from previous
155 * calls to CheckCurrentWord, so there may be suggestions, but they will be
156 * invalid.
158 boolean CheckCurrentWordNoSuggest(in wstring suggestedWord);
161 * Update the dictionary in use to be sure it corresponds to what the editor
162 * needs. The update is asynchronous and is not complete until the given
163 * callback is called.
165 void UpdateCurrentDictionary([optional] in nsIEditorSpellCheckCallback callback);
169 [scriptable, function, uuid(5f0a4bab-8538-4074-89d3-2f0e866a1c0b)]
170 interface nsIEditorSpellCheckCallback : nsISupports
172 void editorSpellCheckDone();