Next Page > Hide TOC

Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

NSSpellServer

Inherits from
Package
com.apple.cocoa.foundation
Companion guide

Overview

The NSSpellServer class gives you a way to make your particular spelling checker a service that’s available to any application. A service 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.

Tasks

Constructors

Registering Your Service

Assigning a Delegate

Running the Service

Checking User Dictionaries

Checking spelling

Constructors

NSSpellServer

Creates an empty NSSpellServer.

public NSSpellServer()

Instance Methods

delegate

Returns the receiver’s delegate.

public Object delegate()

See Also

isWordInUserDictionaries

Indicates whether word is in the user’s list of learned words or the document’s list of words to ignore.

public boolean isWordInUserDictionaries(String word, boolean flag)

Discussion

If true, the word is acceptable to the user. flag indicates whether the comparison is to be case-sensitive.

registerLanguage

Notifies the receiver of a language your spelling checker can check.

public boolean registerLanguage(String language, String vendor)

Discussion

language is the English name of a language on Apple’s list of languages. vendor identifies the vendor (to distinguish your spelling checker from those that others may offer for the same language). 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 list of spelling checkers.

Returns true if the language is registered, false if for some reason it can’t be registered.

run

Causes the receiver to start listening for spell-checking requests.

public void run()

Discussion

This method starts a loop that never returns; you need to set the NSSpellServer’s delegate before sending this message.

See Also

setDelegate

Assigns a delegate, anObject, to the receiver.

public void setDelegate(Object anObject)

Discussion

Because the delegate is where the real work is done, this step is essential before telling the NSSpellServer to run.

See Also

Delegate Methods

spellServerDidForgetWord

Notifies the delegate that sender has removed word from the user’s list of acceptable words in the language, language.

public abstract void spellServerDidForgetWord(NSSpellServer sender, String word, String language)

Discussion

If your delegate maintains a similar auxiliary word list, you may wish to edit the list accordingly.

spellServerDidLearnWord

Notifies the delegate that sender has added word to the user’s list of acceptable words in the language, language.

public abstract void spellServerDidLearnWord(NSSpellServer sender, String word, String language)

Discussion

If your delegate maintains a similar auxiliary word list, you may wish to edit the list accordingly.

spellServerSuggestCompletionsForPartialWordRange

This delegate method returns an array of possible word completions from the spell checker, based off a partially completed string string and a given range range.

public abstract NSArray spellServerSuggestCompletionsForPartialWordRange(NSSpellServer sender, NSRange range, String string, String language)

Discussion

See completionsForPartialWordRange in NSSpellChecker for more information.

Availability

spellServerSuggestGuessesForWord

Gives the delegate the opportunity to suggest guesses to sender for the correct spelling of the misspelled word, word in the language, language.

public abstract NSArray spellServerSuggestGuessesForWord(NSSpellServer sender, String word, String language)

Discussion

Returns the guesses as an array of Strings.



Next Page > Hide TOC


© 1997, 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-07-24)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.