mozISpellCheckingEngine 编辑

extensions/spellcheck/idl/mozISpellCheckingEngine.idlScriptable 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

AttributeTypeDescription
copyrightwstringA string indicating the copyright of the engine. Not currently used. Read only.
dictionarywstring

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.

languagewstring

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.

namewstringThe name of the engine. Not currently used. Read only.
personalDictionarymozIPersonalDictionaryThe personal dictionary.
providesPersonalDictionarybooleanDoes the engine provide its own  personalDictionary? Read only.
providesWordUtilsbooleanDoes the engine provide its own word utilities? Read only.

Methods

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.

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:54 次

字数:8609

最后编辑:8 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文