home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / macfe / Composer / CSpellChecker.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.9 KB  |  84 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. #pragma once
  20.  
  21. #include "spellchk.h"
  22. #include "ntypes.h"        // MWContext
  23.  
  24. class CEditView;
  25. class LEditField;
  26. class CTextTable;
  27. class CSimpleTextView;
  28.  
  29. // public definitions
  30. void do_spellcheck( MWContext *mwcontext, CEditView *editView, CSimpleTextView *textView );
  31. #define cmd_CheckSpelling                    'ChSp'
  32.  
  33.  
  34. // internal
  35. const int SpellCheckerResource = 5109;
  36. const int ChangeStringIndex = 1;
  37. const int DoneStringIndex = 2;
  38. const int NSDictionaryNameIndex = 3;
  39. const int UserDictionaryNameIndex = 4;
  40.  
  41.  
  42. // UI management class
  43. class CMacSpellChecker
  44. {
  45. public:
  46.     enum { class_ID = 'Spel', res_ID = 5299 };
  47.     enum { pane_NewWord = 'NewW', pane_SuggestionList = 'AltW',
  48.             msg_Change = 'Chng', msg_Change_All = 'CAll', 
  49.             msg_Ignore = 'Ignr', msg_Ignore_All = 'IAll',
  50.             msg_Add_Button = 'AddB', msg_Check = 'Chck',
  51.             msg_Stop = 'Stop', msg_NewLanguage = 'Lang',
  52.             msg_SelectionChanged = 'SelC', msg_EditDictionary = 'EdDc' };
  53.     
  54.                 CMacSpellChecker( MWContext *context,
  55.                                     CEditView *editView, CSimpleTextView *textView );
  56.     
  57.     char        *GetTextBuffer();
  58.     void        GetSelection( int32 &selStart, int32 &selEnd );
  59.     void        ReplaceHilitedText( char *newText, Boolean doAll );
  60.     void        IgnoreHilitedText( Boolean doAll );
  61.     void        SetNextMisspelledWord( char *textP, LEditField *typoField, CTextTable *t, LCommander *c );
  62.     Boolean        GetNextMisspelledWord( Boolean doFirstWord );
  63.     void        ClearReplacementWord( LEditField *newWord, CTextTable *table );
  64.     void        GetAlternativesForWord( LEditField *newWord, CTextTable *table, LCommander *c );
  65.     
  66.     Boolean        StartProcessing( Boolean startOver );
  67.     void        ShowDialog( char *textP );
  68.     
  69.     MWContext    *GetMWContext()    { return mMWContext; };
  70.     ISpellChecker *GetISpellChecker()    { return mISpellChecker; };
  71.     void        SetISpellChecker( ISpellChecker *i ) { mISpellChecker = i; };
  72.     
  73.     Boolean        isHTMLeditor()    { return mEditView != NULL; };
  74.     
  75. private:
  76.     ISpellChecker    *mISpellChecker;
  77.     MWContext        *mMWContext;    // only if mEditView; ignored if mTextView
  78.     Str255            mOrigMisspelledWord;
  79.     
  80.     // we should have one and only one of these-->evidence that this class is mis-designed
  81.     CEditView        *mEditView;
  82.     CSimpleTextView    *mTextView;
  83. };
  84.