michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozSpellChecker_h__ michael@0: #define mozSpellChecker_h__ michael@0: michael@0: #include "nsCOMPtr.h" michael@0: #include "nsCOMArray.h" michael@0: #include "nsISpellChecker.h" michael@0: #include "nsString.h" michael@0: #include "nsITextServicesDocument.h" michael@0: #include "mozIPersonalDictionary.h" michael@0: #include "mozISpellCheckingEngine.h" michael@0: #include "nsClassHashtable.h" michael@0: #include "nsTArray.h" michael@0: #include "mozISpellI18NUtil.h" michael@0: #include "nsCycleCollectionParticipant.h" michael@0: michael@0: class mozSpellChecker : public nsISpellChecker michael@0: { michael@0: public: michael@0: NS_DECL_CYCLE_COLLECTING_ISUPPORTS michael@0: NS_DECL_CYCLE_COLLECTION_CLASS(mozSpellChecker) michael@0: michael@0: mozSpellChecker(); michael@0: virtual ~mozSpellChecker(); michael@0: michael@0: nsresult Init(); michael@0: michael@0: // nsISpellChecker michael@0: NS_IMETHOD SetDocument(nsITextServicesDocument *aDoc, bool aFromStartofDoc); michael@0: NS_IMETHOD NextMisspelledWord(nsAString &aWord, nsTArray *aSuggestions); michael@0: NS_IMETHOD CheckWord(const nsAString &aWord, bool *aIsMisspelled, nsTArray *aSuggestions); michael@0: NS_IMETHOD Replace(const nsAString &aOldWord, const nsAString &aNewWord, bool aAllOccurrences); michael@0: NS_IMETHOD IgnoreAll(const nsAString &aWord); michael@0: michael@0: NS_IMETHOD AddWordToPersonalDictionary(const nsAString &aWord); michael@0: NS_IMETHOD RemoveWordFromPersonalDictionary(const nsAString &aWord); michael@0: NS_IMETHOD GetPersonalDictionary(nsTArray *aWordList); michael@0: michael@0: NS_IMETHOD GetDictionaryList(nsTArray *aDictionaryList); michael@0: NS_IMETHOD GetCurrentDictionary(nsAString &aDictionary); michael@0: NS_IMETHOD SetCurrentDictionary(const nsAString &aDictionary); michael@0: NS_IMETHOD CheckCurrentDictionary(); michael@0: michael@0: protected: michael@0: nsCOMPtr mConverter; michael@0: nsCOMPtr mTsDoc; michael@0: nsCOMPtr mPersonalDictionary; michael@0: michael@0: nsCOMPtr mSpellCheckingEngine; michael@0: bool mFromStart; michael@0: michael@0: nsresult SetupDoc(int32_t *outBlockOffset); michael@0: michael@0: nsresult GetCurrentBlockIndex(nsITextServicesDocument *aDoc, int32_t *outBlockIndex); michael@0: michael@0: nsresult GetEngineList(nsCOMArray *aDictionaryList); michael@0: }; michael@0: #endif // mozSpellChecker_h__