Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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 nsEditorSpellCheck_h___
7 #define nsEditorSpellCheck_h___
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
18 class nsIEditor;
19 class nsISpellChecker;
20 class nsITextServicesFilter;
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 }
28 class DictionaryFetcher;
30 class nsEditorSpellCheck : public nsIEditorSpellCheck
31 {
32 friend class DictionaryFetcher;
34 public:
35 nsEditorSpellCheck();
36 virtual ~nsEditorSpellCheck();
38 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
39 NS_DECL_CYCLE_COLLECTION_CLASS(nsEditorSpellCheck)
41 /* Declare all methods in the nsIEditorSpellCheck interface */
42 NS_DECL_NSIEDITORSPELLCHECK
44 protected:
45 nsCOMPtr<nsISpellChecker> mSpellChecker;
47 nsTArray<nsString> mSuggestedWordList;
48 int32_t mSuggestedWordIndex;
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;
55 nsresult DeleteSuggestedWordList();
57 nsCOMPtr<nsITextServicesFilter> mTxtSrvFilter;
58 nsCOMPtr<nsIEditor> mEditor;
60 nsString mPreferredLang;
62 uint32_t mDictionaryFetcherGroup;
64 bool mUpdateDictionaryRunning;
66 nsresult DictionaryFetched(DictionaryFetcher* aFetchState);
68 public:
69 void BeginUpdateDictionary() { mUpdateDictionaryRunning = true ;}
70 void EndUpdateDictionary() { mUpdateDictionaryRunning = false ;}
71 };
73 #endif // nsEditorSpellCheck_h___