PageRenderTime 32ms CodeModel.GetById 12ms app.highlight 13ms RepoModel.GetById 2ms app.codeStats 0ms

/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
39#ifndef mozSpellChecker_h__
40#define mozSpellChecker_h__
41
42#include "nsCOMPtr.h"
43#include "nsCOMArray.h"
44#include "nsISpellChecker.h"
45#include "nsString.h"
46#include "nsITextServicesDocument.h"
47#include "mozIPersonalDictionary.h"
48#include "mozISpellCheckingEngine.h"
49#include "nsClassHashtable.h"
50#include "nsVoidArray.h"
51#include "nsTArray.h"
52#include "mozISpellI18NUtil.h"
53#include "nsCycleCollectionParticipant.h"
54
55class mozSpellChecker : public nsISpellChecker
56{
57public:
58  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
59  NS_DECL_CYCLE_COLLECTION_CLASS(mozSpellChecker)
60
61  mozSpellChecker();
62  virtual ~mozSpellChecker();
63
64  nsresult Init();
65
66  // nsISpellChecker
67  NS_IMETHOD SetDocument(nsITextServicesDocument *aDoc, bool aFromStartofDoc);
68  NS_IMETHOD NextMisspelledWord(nsAString &aWord, nsTArray<nsString> *aSuggestions);
69  NS_IMETHOD CheckWord(const nsAString &aWord, bool *aIsMisspelled, nsTArray<nsString> *aSuggestions);
70  NS_IMETHOD Replace(const nsAString &aOldWord, const nsAString &aNewWord, bool aAllOccurrences);
71  NS_IMETHOD IgnoreAll(const nsAString &aWord);
72
73  NS_IMETHOD AddWordToPersonalDictionary(const nsAString &aWord);
74  NS_IMETHOD RemoveWordFromPersonalDictionary(const nsAString &aWord);
75  NS_IMETHOD GetPersonalDictionary(nsTArray<nsString> *aWordList);
76
77  NS_IMETHOD GetDictionaryList(nsTArray<nsString> *aDictionaryList);
78  NS_IMETHOD GetCurrentDictionary(nsAString &aDictionary);
79  NS_IMETHOD SetCurrentDictionary(const nsAString &aDictionary);
80  NS_IMETHOD CheckCurrentDictionary();
81
82protected:
83  nsCOMPtr<mozISpellI18NUtil> mConverter;
84  nsCOMPtr<nsITextServicesDocument> mTsDoc;
85  nsCOMPtr<mozIPersonalDictionary> mPersonalDictionary;
86
87  nsCOMPtr<mozISpellCheckingEngine>  mSpellCheckingEngine;
88  bool mFromStart;
89
90  nsresult SetupDoc(PRInt32 *outBlockOffset);
91
92  nsresult GetCurrentBlockIndex(nsITextServicesDocument *aDoc, PRInt32 *outBlockIndex);
93
94  nsresult GetEngineList(nsCOMArray<mozISpellCheckingEngine> *aDictionaryList);
95};
96#endif // mozSpellChecker_h__