home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2 / Openstep-4.2-Intel-Developer.iso / NextLibrary / Frameworks / AppKit.framework / Versions / B / Headers / NSSpellServer.h < prev    next >
Text File  |  1996-10-17  |  3KB  |  74 lines

  1. /*
  2.         NSSpellServer.h
  3.     Application Kit
  4.     Copyright (c) 1990-1996, NeXT Software, Inc.
  5.     All rights reserved.
  6. */
  7.  
  8. #import <Foundation/Foundation.h>
  9. #import <AppKit/NSSpellProtocol.h>
  10.  
  11. /*
  12. The server just handles all the checking in and IAC and delegates the real work to its delegate.  A single server can handle more than one language.  Services is used to rendezvous applications with servers.  The format of a services descriptor for a spell-checker:
  13.  
  14. Spell Checker: NeXT
  15. Language: French
  16. Language: English
  17. Executable: franglais.daemon
  18. */
  19.  
  20.  
  21. @interface NSSpellServer : NSObject {
  22.  
  23.   @private
  24.     // All instance variables are private and subject to future change.  Do not access them.
  25.     id _delegate;
  26.     int _caseSensitive;
  27.     NSConnection *_spellServerConnection;
  28.     NSMutableDictionary *_dictionaries;
  29.     NSArray *_learnedDictionaries;
  30.     
  31.     struct __ssFlags {
  32.         unsigned int delegateLearnsWords:1;
  33.         unsigned int delegateForgetsWords:1;
  34.         unsigned int busy:1;
  35.         unsigned int _reserved:29;
  36.     } _ssFlags;
  37.     
  38.     void *_compatibilityServer;
  39.  
  40.     void *_reservedSpellServer1;
  41. }
  42.  
  43. - (void)setDelegate:(id)anObject;
  44. - (id)delegate;
  45.  
  46. /* Used to check in */
  47. - (BOOL)registerLanguage:(NSString *)language byVendor:(NSString *)vendor;
  48.  
  49. /* Way to query user's private dictionary(ies). */
  50. - (BOOL)isWordInUserDictionaries:(NSString *)word caseSensitive:(BOOL)flag;
  51.  
  52. /* Waits for spell-check request to come in. */
  53. - (void)run;
  54.  
  55. @end
  56.  
  57. /*
  58. This is the protocol the object in the server that does the real work must respond to.  The first method checks spelling and the second suggests proper corrections.  The third and fourth allow the delegate to be notified when new words are learned or forgotten.  Only the first method is required.
  59.  
  60. The argument wordCount is an out parameter.  It should return the number of words found in the document from startPosition until the misspelled word was found (or the end of the stream)  If your spell server can't count words (though it is hard to imagine why that might be), return -1 in wordCount.  countOnly of Yes means forget about checking the spelling of words, just count them until you get to the end of the stream.
  61. */
  62.  
  63. @interface NSObject(NSSpellServerDelegate)
  64.  
  65. - (NSRange)spellServer:(NSSpellServer *)sender findMisspelledWordInString:(NSString *)stringToCheck language:(NSString *)language wordCount:(int *)wordCount countOnly:(BOOL)countOnly;
  66.  
  67. - (NSArray *)spellServer:(NSSpellServer *)sender suggestGuessesForWord:(NSString *)word inLanguage:(NSString *)language;
  68.  
  69. - (void)spellServer:(NSSpellServer *)sender didLearnWord:(NSString *)word inLanguage:(NSString *)language;
  70.  
  71. - (void)spellServer:(NSSpellServer *)sender didForgetWord:(NSString *)word inLanguage:(NSString *)language;
  72.  
  73. @end
  74.