/extensions/spellcheck/src/mozSpellChecker.h

http://github.com/zpao/v8monkey · C Header · 96 lines · 45 code · 13 blank · 38 comment · 0 complexity · 05f3436b34f928c465d7e56cdb04bb1a MD5 · raw file

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3. * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4. *
  5. * The contents of this file are subject to the Mozilla Public License Version
  6. * 1.1 (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. * http://www.mozilla.org/MPL/
  9. *
  10. * Software distributed under the License is distributed on an "AS IS" basis,
  11. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12. * for the specific language governing rights and limitations under the
  13. * License.
  14. *
  15. * The Original Code is Mozilla Spellchecker Component.
  16. *
  17. * The Initial Developer of the Original Code is
  18. * David Einstein.
  19. * Portions created by the Initial Developer are Copyright (C) 2001
  20. * the Initial Developer. All Rights Reserved.
  21. *
  22. * Contributor(s): David Einstein Deinst@world.std.com
  23. * Jesper Kristensen <mail@jesperkristensen.dk>
  24. *
  25. * Alternatively, the contents of this file may be used under the terms of
  26. * either the GNU General Public License Version 2 or later (the "GPL"), or
  27. * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  28. * in which case the provisions of the GPL or the LGPL are applicable instead
  29. * of those above. If you wish to allow use of your version of this file only
  30. * under the terms of either the GPL or the LGPL, and not to allow others to
  31. * use your version of this file under the terms of the MPL, indicate your
  32. * decision by deleting the provisions above and replace them with the notice
  33. * and other provisions required by the GPL or the LGPL. If you do not delete
  34. * the provisions above, a recipient may use your version of this file under
  35. * the terms of any one of the MPL, the GPL or the LGPL.
  36. *
  37. * ***** END LICENSE BLOCK ***** */
  38. #ifndef mozSpellChecker_h__
  39. #define mozSpellChecker_h__
  40. #include "nsCOMPtr.h"
  41. #include "nsCOMArray.h"
  42. #include "nsISpellChecker.h"
  43. #include "nsString.h"
  44. #include "nsITextServicesDocument.h"
  45. #include "mozIPersonalDictionary.h"
  46. #include "mozISpellCheckingEngine.h"
  47. #include "nsClassHashtable.h"
  48. #include "nsVoidArray.h"
  49. #include "nsTArray.h"
  50. #include "mozISpellI18NUtil.h"
  51. #include "nsCycleCollectionParticipant.h"
  52. class mozSpellChecker : public nsISpellChecker
  53. {
  54. public:
  55. NS_DECL_CYCLE_COLLECTING_ISUPPORTS
  56. NS_DECL_CYCLE_COLLECTION_CLASS(mozSpellChecker)
  57. mozSpellChecker();
  58. virtual ~mozSpellChecker();
  59. nsresult Init();
  60. // nsISpellChecker
  61. NS_IMETHOD SetDocument(nsITextServicesDocument *aDoc, bool aFromStartofDoc);
  62. NS_IMETHOD NextMisspelledWord(nsAString &aWord, nsTArray<nsString> *aSuggestions);
  63. NS_IMETHOD CheckWord(const nsAString &aWord, bool *aIsMisspelled, nsTArray<nsString> *aSuggestions);
  64. NS_IMETHOD Replace(const nsAString &aOldWord, const nsAString &aNewWord, bool aAllOccurrences);
  65. NS_IMETHOD IgnoreAll(const nsAString &aWord);
  66. NS_IMETHOD AddWordToPersonalDictionary(const nsAString &aWord);
  67. NS_IMETHOD RemoveWordFromPersonalDictionary(const nsAString &aWord);
  68. NS_IMETHOD GetPersonalDictionary(nsTArray<nsString> *aWordList);
  69. NS_IMETHOD GetDictionaryList(nsTArray<nsString> *aDictionaryList);
  70. NS_IMETHOD GetCurrentDictionary(nsAString &aDictionary);
  71. NS_IMETHOD SetCurrentDictionary(const nsAString &aDictionary);
  72. NS_IMETHOD CheckCurrentDictionary();
  73. protected:
  74. nsCOMPtr<mozISpellI18NUtil> mConverter;
  75. nsCOMPtr<nsITextServicesDocument> mTsDoc;
  76. nsCOMPtr<mozIPersonalDictionary> mPersonalDictionary;
  77. nsCOMPtr<mozISpellCheckingEngine> mSpellCheckingEngine;
  78. bool mFromStart;
  79. nsresult SetupDoc(PRInt32 *outBlockOffset);
  80. nsresult GetCurrentBlockIndex(nsITextServicesDocument *aDoc, PRInt32 *outBlockIndex);
  81. nsresult GetEngineList(nsCOMArray<mozISpellCheckingEngine> *aDictionaryList);
  82. };
  83. #endif // mozSpellChecker_h__