editor/idl/nsIEditorSpellCheck.idl
Not scriptablensIEditor
instances.
nsISupports
Last changed in Gecko 9.0 (Firefox 9.0 / Thunderbird 9.0 / SeaMonkey 2.6)Implemented by: @mozilla.org/editor/editorspellchecker;1
. To create an instance, use:
var editorSpellCheck = Components.classes["@mozilla.org/editor/editorspellchecker;1
"]
.createInstance(Components.interfaces.nsIEditorSpellCheck);
void AddWordToDictionary(in wstring word); |
boolean canSpellCheck(); |
void checkCurrentDictionary(); |
boolean CheckCurrentWord(in wstring suggestedWord); |
boolean CheckCurrentWordNoSuggest(in wstring suggestedWord); |
AString GetCurrentDictionary(); |
void GetDictionaryList([array, size_is(count)] out wstring dictionaryList, out PRUint32 count); |
wstring GetNextMisspelledWord(); |
void GetPersonalDictionary(); |
wstring GetPersonalDictionaryWord(); |
wstring GetSuggestedWord(); |
void IgnoreWordAllOccurrences(in wstring word); |
void InitSpellChecker(in nsIEditor editor, in boolean enableSelectionChecking); |
void RemoveWordFromDictionary(in wstring word); |
void ReplaceWord(in wstring misspelledWord, in wstring replaceWord, in boolean allOccurrences); |
void saveDefaultDictionary(); Obsolete since Gecko 9.0 |
void SetCurrentDictionary(in AString dictionary); |
void setFilter(in nsITextServicesFilter filter); |
void UninitSpellChecker(); |
void UpdateCurrentDictionary(); |
Adds the specified word to the current personal dictionary.
void AddWordToDictionary( in wstring word );
word
Determines whether or not spell checking can be enabled.
boolean canSpellCheck();
None.
Returns true
if spell checking can be enabled. If there are no available dictionaries, the return value isĀ false
.
Call this after any change in installed dictionaries to ensure that the spell checker is not using a current dictionary which is no longer available. If the current dictionary is no longer available, pick another dictionary.
void checkCurrentDictionary();
None.
Checks a given word. In spite of the name, this function checks the word you give it, returning true
if the word is misspelled. If the word is misspelled, it will compute the suggestions which you can get from GetSuggestedWord()
.
boolean CheckCurrentWord( in wstring suggestedWord );
suggestedWord
true
if the specified word is misspelled; otherwise false
.
Like CheckCurrentWord()
, checks the word you give it, returning true
if it is misspelled. This is faster than CheckCurrentWord()
because it does not compute any suggestions.
CheckCurrentWord()
, so there may be suggestions, but they will be invalid.boolean CheckCurrentWordNoSuggest( in wstring suggestedWord );
suggestedWord
true
if the word is misspelled; otherwise false
.
Returns the name of the dictionary currently in use.
AString GetCurrentDictionary();
None.
The name of the dictionary currently in use. Typically, this is an ISO language code, such as "en-US".
Retrieves a list of the currently available dictionaries. The strings will typically be language IDs, such as "en-US".
void GetDictionaryList( [array, size_is(count)] out wstring dictionaryList, out PRUint32 count );
dictionaryList
count
dictionaryList
array.When interactively spell checking the document, this will return the value of the next word that is misspelled. This also computes the suggestions which you can get by calling GetSuggestedWord()
.
wstring GetNextMisspelledWord();
None.
The next misspelled word in the document.
Fills an internal list of words added to the personal dictionary. These words can be retrieved using GetPersonalDictionaryWord()
void GetPersonalDictionary();
None.
Used after you call GetPersonalDictionary()
to iterate through all the words added to the personal dictionary. Returns an empty string when there are no more words.
wstring GetPersonalDictionaryWord();
None.
The next word in the personal dictionary.
Used to get suggestions for the last word that was checked and was misspelled. The first call returns the first (best) suggestion. Subsequent calls iterate through all suggestions, allowing you to build a list. When there are no more suggestions, an empty string (not a null
pointer) is returned.
wstring GetSuggestedWord();
None.
The next best suggestion for the last word that was checked and was misspelled, or an empty string if there are no remaining suggestions.
Tells the spell checker to ignore all occurrences of the specified word when spell checking the document.
void IgnoreWordAllOccurrences( in wstring word );
word
Turns on the spell checker for the given editor.
void InitSpellChecker( in nsIEditor editor, in boolean enableSelectionChecking );
editor
nsIEditor
on which to enable spell checking.enableSelectionChecking
GetNextMisspelledWord()
). For spell checking clients with no modal UI (such as inline spell checkers), this flag is not relevant.Removes a word from the current personal dictionary.
void RemoveWordFromDictionary( in wstring word );
word
Call this function to modally replace one (or all) occurrences of a word with another word.
void ReplaceWord( in wstring misspelledWord, in wstring replaceWord, in boolean allOccurrences );
misspelledWord
replaceWord
misspelledWord
.allOccurrences
true
, all occurrences of misspelledWord
are replaced with replaceWord
. If false
, only the first occurrence is replaced. Obsolete since Gecko 9.0 (Firefox 9.0 / Thunderbird 9.0 / SeaMonkey 2.6)
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
Saves the currently selected dictionary as the default. The function UninitSpellChecker()
will also do this, but that function may not be called in some situations. This function allows the caller to force the default immediately.
void saveDefaultDictionary();
None.
Selects the main dictionary to use.
void SetCurrentDictionary( in AString dictionary );
dictionary
Used to filter the content (for example, to skip blockquotes in email from spell checking). Call this before calling InitSpellChecker()
; calling it after initialization will have no effect.
void setFilter( in nsITextServicesFilter filter );
filter
nsITextServicesFilter
describing the filter to apply. This filter lets you avoid spell checking specific parts of the document.Call this to release the spell checking object. It will also save the current selected language as the default for future use.
If you have called CanSpellCheck()
but not InitSpellChecker()
, you can still call this function to clear the cached spell check object, and no preferences are saved.
void UninitSpellChecker();
None.
Updates the dictionary in use to be sure it corresponds to what the editor needs.
void UpdateCurrentDictionary();
None.
Prior to Gecko 9.0 (Firefox 9.0 / Thunderbird 9.0 / SeaMonkey 2.6), this method took one parameter, a reference to the nsIEditor
for which to update the spell checker. Now that spell checker settings are per-site, this method takes no parameters.