Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef mozSpellChecker_h__
7 #define mozSpellChecker_h__
9 #include "nsCOMPtr.h"
10 #include "nsCOMArray.h"
11 #include "nsISpellChecker.h"
12 #include "nsString.h"
13 #include "nsITextServicesDocument.h"
14 #include "mozIPersonalDictionary.h"
15 #include "mozISpellCheckingEngine.h"
16 #include "nsClassHashtable.h"
17 #include "nsTArray.h"
18 #include "mozISpellI18NUtil.h"
19 #include "nsCycleCollectionParticipant.h"
21 class mozSpellChecker : public nsISpellChecker
22 {
23 public:
24 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
25 NS_DECL_CYCLE_COLLECTION_CLASS(mozSpellChecker)
27 mozSpellChecker();
28 virtual ~mozSpellChecker();
30 nsresult Init();
32 // nsISpellChecker
33 NS_IMETHOD SetDocument(nsITextServicesDocument *aDoc, bool aFromStartofDoc);
34 NS_IMETHOD NextMisspelledWord(nsAString &aWord, nsTArray<nsString> *aSuggestions);
35 NS_IMETHOD CheckWord(const nsAString &aWord, bool *aIsMisspelled, nsTArray<nsString> *aSuggestions);
36 NS_IMETHOD Replace(const nsAString &aOldWord, const nsAString &aNewWord, bool aAllOccurrences);
37 NS_IMETHOD IgnoreAll(const nsAString &aWord);
39 NS_IMETHOD AddWordToPersonalDictionary(const nsAString &aWord);
40 NS_IMETHOD RemoveWordFromPersonalDictionary(const nsAString &aWord);
41 NS_IMETHOD GetPersonalDictionary(nsTArray<nsString> *aWordList);
43 NS_IMETHOD GetDictionaryList(nsTArray<nsString> *aDictionaryList);
44 NS_IMETHOD GetCurrentDictionary(nsAString &aDictionary);
45 NS_IMETHOD SetCurrentDictionary(const nsAString &aDictionary);
46 NS_IMETHOD CheckCurrentDictionary();
48 protected:
49 nsCOMPtr<mozISpellI18NUtil> mConverter;
50 nsCOMPtr<nsITextServicesDocument> mTsDoc;
51 nsCOMPtr<mozIPersonalDictionary> mPersonalDictionary;
53 nsCOMPtr<mozISpellCheckingEngine> mSpellCheckingEngine;
54 bool mFromStart;
56 nsresult SetupDoc(int32_t *outBlockOffset);
58 nsresult GetCurrentBlockIndex(nsITextServicesDocument *aDoc, int32_t *outBlockIndex);
60 nsresult GetEngineList(nsCOMArray<mozISpellCheckingEngine> *aDictionaryList);
61 };
62 #endif // mozSpellChecker_h__