Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

mozISpellCheckingEngine

This interface represents a spelling checker. Implement this interface to add support for a new spell checking engine.
Inherits from: nsISupports Last changed in Gecko 1.7

This interface represents a spell checking engine. The built in Hunspell engine has contract ID "@mozilla.org/spellchecker/engine;1". Extensions can use this interface to check spelling or provide its own spell checker to editors.

Method overview

void addDirectory(in nsIFile dir);
boolean check(in wstring word);
void getDictionaryList([array, size_is(count)] out wstring dictionaries, out PRUint32 count);
void removeDirectory(in nsIFile dir);
void suggest(in wstring word,[array, size_is(count)] out wstring suggestions, out PRUint32 count);

Attributes

Attribute Type Description
copyright wstring A string indicating the copyright of the engine. Not currently used. Read only.
dictionary wstring

The name of the current dictionary used by check() and suggest(). This will be either element from the array returned by getDictionaryList() or an empty string if no dictionary is selected.

Note: Setting this value to a value that doesn't match an existing dictionary throws a NS_ERROR_FILE_NOT_FOUND exception.

When this attribute's value is changed, a "spellcheck-dictionary-update" notification is sent. If the dictionary was set to "no dictionary" (that is, by specifying an empty string), the observer may select another dictionary before returning.

language wstring

The language this spell checker is using when checking. This is the language of dictionary. Read only.

When this changes, the spell checker sends a "spellcheck-dictionary-update" notification.

name wstring The name of the engine. Not currently used. Read only.
personalDictionary mozIPersonalDictionary The personal dictionary.
providesPersonalDictionary boolean Does the engine provide its own personalDictionary? Read only.
providesWordUtils boolean Does the engine provide its own word utilities? Read only.

Methods

Requires Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7)

addDirectory()

Adds all the dictionaries in the specified directory to the spell checker.

void addDirectory(
  nsIFile dir
);
Parameters
dir
An nsIFile object indicating the directory from which to add dictionaries.

check()

Checks a word to determine if it's spelled correctly.

When this changes, the spell checker sends a "spellcheck-dictionary-update" notification.

boolean check(
  in wstring word
);
Parameters
word
A word to check for correct spelling.
Return value

Returns true if word is spelled correctly according to the dictionary attribute, and returns false if word is misspelled.

getDictionaryList()

Gets the list of dictionaries.

void getDictionaryList(
  [array, size_is(count)] out wstring dictionaries,
  out PRUint32 count
);
Parameters
dictionaries
A list of dictionaries supported by this spell checker. The dictionary attribute can be set to one of these. Each dictionary name is typically but not always a locale code.
count
The length of dictionaries.

Requires Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7)

removeDirectory()

Removes all the dictionaries in the specified directory from the spell checker.

void removeDirectory(
  nsIFile dir
);
Parameters
dir
An nsIFile object indicating the directory whose spell checkers are to be removed from the spell checker.

suggest()

Gets a list of suggestions for a misspelled word.

When this changes, the spell checker sends a "spellcheck-dictionary-update" notification.

void suggest(
  in wstring word,
  [array, size_is(count)] out wstring suggestions,
  out PRUint32 count
);
Parameters
word
A word, which is misspelled according to check.
suggestions
A list of words suggested instead of word.
count
The length of suggestions.

Document Tags and Contributors

 Contributors to this page: Sheppy, Dikrib, trevorh
 Last updated by: Sheppy,