Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/Foundation.framework |
Availability | Available in Mac OS X v10.0 and later. |
Companion guide | |
Declared in | NSSpellServer.h |
The NSSpellServer
class gives you a way to make your application’s spell checker available as a spelling service available to any application.
A service provider is an application that declares its availability in a standard way, so that any other applications that wish to use it can do so. If you build a spelling checker that makes use of the NSSpellServer
class and list it as an available service, then users of any application that makes use of NSSpellChecker or includes a Services menu will see your spelling checker as one of the available dictionaries.
– isWordInUserDictionaries:caseSensitive:
– spellServer:didForgetWord:inLanguage:
delegate method
– spellServer:didLearnWord:inLanguage:
delegate method
– spellServer:findMisspelledWordInString:language:wordCount:countOnly:
delegate method
– spellServer:suggestCompletionsForPartialWordRange:inString:language:
delegate method
– spellServer:suggestGuessesForWord:inLanguage:
delegate method
– spellServer:checkGrammarInString:language:details:
delegate method
Returns the receiver’s delegate.
- (id)delegate
NSSpellServer.h
Indicates whether a given word is in the user’s list of learned words or the document’s list of words to ignore.
- (BOOL)isWordInUserDictionaries:(NSString *)word caseSensitive:(BOOL)caseSensitive
The word to compare with those in the user dictionaries.
Specifies whether the comparison is case sensitive.
A Boolean value indicating whether the word is in the user dictionaries. If YES
, the word is acceptable to the user.
NSSpellServer.h
Notifies the receiver of a language your spelling checker can check.
- (BOOL)registerLanguage:(NSString *)language byVendor:(NSString *)vendor
A string specifying the English name of a language on Apple’s list of languages.
A string that identifies the vendor (to distinguish your spelling checker from those that others may offer for the same language).
Returns YES
if the language is registered, NO
if for some reason it can’t be registered.
If your spelling checker supports more than one language, it should invoke this method once for each language. Registering a language-vendor combination causes it to appear in the Spelling panel’s pop-up menu of spelling checkers.
NSSpellServer.h
Causes the receiver to start listening for spell-checking requests.
- (void)run
This method starts a loop that never returns; you need to set the NSSpellServer
object’s delegate before sending this message.
NSSpellServer.h
Assigns the specified delegate to the receiver.
- (void)setDelegate:(id)anObject
The delegate assigned to the receiver.
Because the delegate is where the real work is done, this step is essential before telling the NSSpellServer
object to run.
NSSpellServer.h
Gives the delegate the opportunity to customize the grammatical analysis of a given string.
- (NSRange)spellServer:(NSSpellServer *)sender checkGrammarInString:(NSString *)string language:(NSString *)language details:(NSArray **)outDetails
Spell server satisfying a grammatical analysis request.
String to analyze.
Language use in string. When nil
, the language selected in the Spelling panel is used.
On output, dictionaries describing grammar-analysis details within the flagged grammatical unit. See the NSSpellServer
class for information about these dictionaries.
Location of the first flagged grammatical unit within string.
NSSpellServer.h
Notifies the delegate that the sender has removed the specified word from the user’s list of acceptable words in the specified language.
- (void)spellServer:(NSSpellServer *)sender didForgetWord:(NSString *)word inLanguage:(NSString *)language
The NSSpellServer
object that removed the word.
The word that was removed.
The language of the removed word.
If your delegate maintains a similar auxiliary word list, you may wish to edit the list accordingly.
NSSpellServer.h
Notifies the delegate that the sender has added the specified word to the user’s list of acceptable words in the specified language.
- (void)spellServer:(NSSpellServer *)sender didLearnWord:(NSString *)word inLanguage:(NSString *)language
The NSSpellServer
object that added the word.
The word that was added.
The language of the added word.
If your delegate maintains a similar auxiliary word list, you may wish to edit the list accordingly.
NSSpellServer.h
Asks the delegate to search for a misspelled word in a given string, using the specified language, and marking the first misspelled word found by returning its range within the string.
- (NSRange)spellServer:(NSSpellServer *)sender findMisspelledWordInString:(NSString *)stringToCheck language:(NSString *)language wordCount:(int32_t *)wordCount countOnly:(BOOL)countOnly
The NSSpellServer
object that sent this message.
The string to search for the misspelled word.
The language to use for the search.
On output, returns by reference the number of words from the beginning of the string object until the misspelled word (or the end of string).
If YES
, the method only counts the words in the string object and does not spell checking.
The range of the misspelled word within the given string.
Send isWordInUserDictionaries:caseSensitive:
to the spelling server to determine if the word exists in the user’s language dictionaries.
NSSpellServer.h
This delegate method returns an array of possible word completions from the spell checker, based on a partially completed string and a given range.
- (NSArray *)spellServer:(NSSpellServer *)sender suggestCompletionsForPartialWordRange:(NSRange)range inString:(NSString *)string language:(NSString *)language
The NSSpellServer
object that sent this message.
The range of the partially completed word.
The string containing the partial word range.
The language to use for the completion.
An array of NSString
objects indicating possible completions.
See completionsForPartialWordRange:inString:language:inSpellDocumentWithTag:
in NSSpellChecker
for more information.
NSSpellServer.h
Gives the delegate the opportunity to suggest guesses to the sender for the correct spelling of the given misspelled word in the specified language.
- (NSArray *)spellServer:(NSSpellServer *)sender suggestGuessesForWord:(NSString *)word inLanguage:(NSString *)language
The NSSpellServer
object that sent this message.
The misspelled word.
The language to use for the guesses.
An array of NSString
objects indicating possible correct spellings.
NSSpellServer.h
These constants are use as the keys in the outDetails dictionaries returned by spellServer:checkGrammarInString:language:details:
and NSSpellChecker
-checkGrammarOfString:startingAt:language:wrap:inSpellingDocumentWithTag:details:
.
FOUNDATION_EXPORT NSString *const NSGrammarRange; FOUNDATION_EXPORT NSString *const NSGrammarUserDescription; FOUNDATION_EXPORT NSString *const NSGrammarCorrections;
NSSpellServer.h
© 2007 Apple Inc. All Rights Reserved. (Last updated: 2007-04-27)