mozISpellCheckingEngine 编辑
extensions/spellcheck/idl/mozISpellCheckingEngine.idl
Scriptable 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.7This 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 |
boolean check(in wstring word); |
void getDictionaryList([array, size_is(count)] out wstring dictionaries, out PRUint32 count); |
void removeDirectory(in |
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 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 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
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论