|
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/. */ |
|
5 |
|
6 #ifndef nsEditorSpellCheck_h___ |
|
7 #define nsEditorSpellCheck_h___ |
|
8 |
|
9 |
|
10 #include "nsCOMPtr.h" // for nsCOMPtr |
|
11 #include "nsCycleCollectionParticipant.h" |
|
12 #include "nsIEditorSpellCheck.h" // for NS_DECL_NSIEDITORSPELLCHECK, etc |
|
13 #include "nsISupportsImpl.h" |
|
14 #include "nsString.h" // for nsString |
|
15 #include "nsTArray.h" // for nsTArray |
|
16 #include "nscore.h" // for nsresult |
|
17 |
|
18 class nsIEditor; |
|
19 class nsISpellChecker; |
|
20 class nsITextServicesFilter; |
|
21 |
|
22 #define NS_EDITORSPELLCHECK_CID \ |
|
23 { /* {75656ad9-bd13-4c5d-939a-ec6351eea0cc} */ \ |
|
24 0x75656ad9, 0xbd13, 0x4c5d, \ |
|
25 { 0x93, 0x9a, 0xec, 0x63, 0x51, 0xee, 0xa0, 0xcc }\ |
|
26 } |
|
27 |
|
28 class DictionaryFetcher; |
|
29 |
|
30 class nsEditorSpellCheck : public nsIEditorSpellCheck |
|
31 { |
|
32 friend class DictionaryFetcher; |
|
33 |
|
34 public: |
|
35 nsEditorSpellCheck(); |
|
36 virtual ~nsEditorSpellCheck(); |
|
37 |
|
38 NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
|
39 NS_DECL_CYCLE_COLLECTION_CLASS(nsEditorSpellCheck) |
|
40 |
|
41 /* Declare all methods in the nsIEditorSpellCheck interface */ |
|
42 NS_DECL_NSIEDITORSPELLCHECK |
|
43 |
|
44 protected: |
|
45 nsCOMPtr<nsISpellChecker> mSpellChecker; |
|
46 |
|
47 nsTArray<nsString> mSuggestedWordList; |
|
48 int32_t mSuggestedWordIndex; |
|
49 |
|
50 // these are the words in the current personal dictionary, |
|
51 // GetPersonalDictionary must be called to load them. |
|
52 nsTArray<nsString> mDictionaryList; |
|
53 int32_t mDictionaryIndex; |
|
54 |
|
55 nsresult DeleteSuggestedWordList(); |
|
56 |
|
57 nsCOMPtr<nsITextServicesFilter> mTxtSrvFilter; |
|
58 nsCOMPtr<nsIEditor> mEditor; |
|
59 |
|
60 nsString mPreferredLang; |
|
61 |
|
62 uint32_t mDictionaryFetcherGroup; |
|
63 |
|
64 bool mUpdateDictionaryRunning; |
|
65 |
|
66 nsresult DictionaryFetched(DictionaryFetcher* aFetchState); |
|
67 |
|
68 public: |
|
69 void BeginUpdateDictionary() { mUpdateDictionaryRunning = true ;} |
|
70 void EndUpdateDictionary() { mUpdateDictionaryRunning = false ;} |
|
71 }; |
|
72 |
|
73 #endif // nsEditorSpellCheck_h___ |
|
74 |
|
75 |