Up

# NSSpellServer

### Authors

Gregory John Casamento (`borgheron@yahoo.com`)
Scott Christley (`scottc@net-community.com`)

> Class to allow a spell checker to be available to other apps.

Copyright: (C) 2001, 1996 Free Software Foundation, Inc.

### Contents -

1. Software documentation for the NSSpellServer class
2. Software documentation for the NSObject(NSSpellServerDelegate) informal protocol

# Software documentation for the NSSpellServer class

## NSSpellServer : NSObject

> Declared in:
>   AppKit/NSSpellServer.h

Availability: OpenStep
Description forthcoming.
Method summary

- -delegate
- -isWordInUserDictionaries:caseSensitive:
- -registerLanguage:byVendor:
- -run
- -setDelegate:

### delegate

- (id) delegate;
Availability: OpenStep
Return the spell server delegate.

### isWordInUserDictionaries: caseSensitive:

- (BOOL) isWordInUserDictionaries: (NSString*)word caseSensitive: (BOOL)flag;
Availability: OpenStep
Checks to see if the word is in the user's dictionary. The user dictionary is a set of words learned by the spell service for that particular user.

### registerLanguage: byVendor:

- (BOOL) registerLanguage: (NSString*)language byVendor: (NSString*)vendor;
Availability: OpenStep
This method vends the spell server to the Distributed Objects system so that it can be connected to by clients.

### run

- (void) run;
Availability: OpenStep
Initiate the run loop of this service. Once the spell server object is vended, this method is called so that the server can start responding to the messages sent by the client. These messages are passed on to the NSSpellServer instance's delegate.

### setDelegate:

- (void) setDelegate: (id)anObject;
Availability: OpenStep
This method is used to set the delegate of the spellserver. When a spelling service is run the spell server is vended out to DO. The spelling service must instantiate an instance of this class and set itself to be the delegate. This allows the service to respond to messages sent by the client.

# Software documentation for the NSObject(NSSpellServerDelegate) informal protocol

## NSObject(NSSpellServerDelegate)

> Declared in:
>   AppKit/NSSpellServer.h

Availability: OpenStep
This is an informal protocol since the NSSpellChecker will need to use a proxy object to call these methods. These methods need to be implemented by the spell service so that the NSSpellServer instance call call them when necessary.
Method summary

- -spellServer:didForgetWord:inLanguage:
- -spellServer:didLearnWord:inLanguage:
- -spellServer:findMisspelledWordInString:language:wordCount:countOnly:
- -spellServer:suggestGuessesForWord:inLanguage:

### spellServer: didForgetWord: inLanguage:

- (void) spellServer: (NSSpellServer*)sender didForgetWord: (NSString*)word inLanguage: (NSString*)language;
Availability: OpenStep
Forgets the given word in the user's dictionary for the given language.

### spellServer: didLearnWord: inLanguage:

- (void) spellServer: (NSSpellServer*)sender didLearnWord: (NSString*)word inLanguage: (NSString*)language;
Availability: OpenStep
Records the new word in the user's dictionary for the given language.

### spellServer: findMisspelledWordInString: language: wordCount: countOnly:

- (NSRange) spellServer: (NSSpellServer*)sender findMisspelledWordInString: (NSString*)stringToCheck language: (NSString*)language wordCount: (int*)wordCount countOnly: (BOOL)countOnly;
Availability: OpenStep

This method is called when the user begins spell checking the document. The parameters are: `sender` the spell server instance which invoked this method, `stringToCheck` this is the string which the spell service is going to attempt to find misspelled words in, `language` the language to check in, `wordCount` the number of words checked, and `countOnly` a flag which dictates if them method checks the spelling or just counts the words in the given string.

Returns a range for any word it finds that is misspelled.

### spellServer: suggestGuessesForWord: inLanguage:

- (NSArray*) spellServer: (NSSpellServer*)sender suggestGuessesForWord: (NSString*)word inLanguage: (NSString*)language;
Availability: OpenStep
Attempts to guess the correct spelling of `word`.

Up