|
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 mozPersonalDictionary_h__ |
|
7 #define mozPersonalDictionary_h__ |
|
8 |
|
9 #include "nsCOMPtr.h" |
|
10 #include "nsString.h" |
|
11 #include "mozIPersonalDictionary.h" |
|
12 #include "nsIUnicodeEncoder.h" |
|
13 #include "nsIObserver.h" |
|
14 #include "nsWeakReference.h" |
|
15 #include "nsTHashtable.h" |
|
16 #include "nsCRT.h" |
|
17 #include "nsCycleCollectionParticipant.h" |
|
18 #include "nsHashKeys.h" |
|
19 |
|
20 #define MOZ_PERSONALDICTIONARY_CONTRACTID "@mozilla.org/spellchecker/personaldictionary;1" |
|
21 #define MOZ_PERSONALDICTIONARY_CID \ |
|
22 { /* 7EF52EAF-B7E1-462B-87E2-5D1DBACA9048 */ \ |
|
23 0X7EF52EAF, 0XB7E1, 0X462B, \ |
|
24 { 0X87, 0XE2, 0X5D, 0X1D, 0XBA, 0XCA, 0X90, 0X48 } } |
|
25 |
|
26 class mozPersonalDictionary : public mozIPersonalDictionary, |
|
27 public nsIObserver, |
|
28 public nsSupportsWeakReference |
|
29 { |
|
30 public: |
|
31 NS_DECL_CYCLE_COLLECTING_ISUPPORTS |
|
32 NS_DECL_MOZIPERSONALDICTIONARY |
|
33 NS_DECL_NSIOBSERVER |
|
34 NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(mozPersonalDictionary, mozIPersonalDictionary) |
|
35 |
|
36 mozPersonalDictionary(); |
|
37 virtual ~mozPersonalDictionary(); |
|
38 |
|
39 nsresult Init(); |
|
40 |
|
41 protected: |
|
42 bool mDirty; /* has the dictionary been modified */ |
|
43 nsTHashtable<nsUnicharPtrHashKey> mDictionaryTable; |
|
44 nsTHashtable<nsUnicharPtrHashKey> mIgnoreTable; |
|
45 nsCOMPtr<nsIUnicodeEncoder> mEncoder; /*Encoder to use to compare with spellchecker word */ |
|
46 }; |
|
47 |
|
48 #endif |