1 /******* BEGIN LICENSE BLOCK *******
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
14 * The Initial Developers of the Original Code are Kevin Hendricks (MySpell)
15 * and László Németh (Hunspell). Portions created by the Initial Developers
16 * are Copyright (C) 2002-2005 the Initial Developers. All Rights Reserved.
18 * Contributor(s): Kevin Hendricks (kevin.hendricks@sympatico.ca)
19 * David Einstein (deinst@world.std.com)
20 * Michiel van Leeuwen (mvl@exedo.nl)
21 * Caolan McNamara (cmc@openoffice.org)
22 * László Németh (nemethl@gyorsposta.hu)
45 * Alternatively, the contents of this file may be used under the terms of
46 * either the GNU General Public License Version 2 or later (the "GPL"), or
47 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
48 * in which case the provisions of the GPL or the LGPL are applicable instead
49 * of those above. If you wish to allow use of your version of this file only
50 * under the terms of either the GPL or the LGPL, and not to allow others to
51 * use your version of this file under the terms of the MPL, indicate your
52 * decision by deleting the provisions above and replace them with the notice
53 * and other provisions required by the GPL or the LGPL. If you do not delete
54 * the provisions above, a recipient may use your version of this file under
55 * the terms of any one of the MPL, the GPL or the LGPL.
57 ******* END LICENSE BLOCK *******/
59 #ifndef mozHunspell_h__
60 #define mozHunspell_h__
62 #include <hunspell.hxx>
63 #include "mozISpellCheckingEngine.h"
64 #include "mozIPersonalDictionary.h"
67 #include "nsIObserver.h"
68 #include "nsIUnicodeEncoder.h"
69 #include "nsIUnicodeDecoder.h"
70 #include "nsInterfaceHashtable.h"
71 #include "nsWeakReference.h"
73 #define MOZ_HUNSPELL_CONTRACTID "@mozilla.org/spellchecker/engine;1"
74 #define MOZ_HUNSPELL_CID \
75 /* 56c778e4-1bee-45f3-a689-886692a97fe7 */ \
76 { 0x56c778e4, 0x1bee, 0x45f3, \
77 { 0xa6, 0x89, 0x88, 0x66, 0x92, 0xa9, 0x7f, 0xe7 } }
79 class mozHunspell
: public mozISpellCheckingEngine
,
81 public nsSupportsWeakReference
85 NS_DECL_MOZISPELLCHECKINGENGINE
88 mozHunspell() : mHunspell(nsnull
) { }
89 virtual ~mozHunspell();
93 void LoadDictionaryList();
94 void LoadDictionariesFromDir(nsIFile
* aDir
);
96 // helper method for converting a word to the charset of the dictionary
97 nsresult
ConvertCharset(const PRUnichar
* aStr
, char ** aDst
);
101 nsCOMPtr
<mozIPersonalDictionary
> mPersonalDictionary
;
102 nsCOMPtr
<nsIUnicodeEncoder
> mEncoder
;
103 nsCOMPtr
<nsIUnicodeDecoder
> mDecoder
;
105 // Hashtable matches dictionary name to .aff file
106 nsInterfaceHashtable
<nsStringHashKey
, nsIFile
> mDictionaries
;
107 nsString mDictionary
;