1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/extensions/spellcheck/src/mozSpellChecker.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,62 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef mozSpellChecker_h__ 1.10 +#define mozSpellChecker_h__ 1.11 + 1.12 +#include "nsCOMPtr.h" 1.13 +#include "nsCOMArray.h" 1.14 +#include "nsISpellChecker.h" 1.15 +#include "nsString.h" 1.16 +#include "nsITextServicesDocument.h" 1.17 +#include "mozIPersonalDictionary.h" 1.18 +#include "mozISpellCheckingEngine.h" 1.19 +#include "nsClassHashtable.h" 1.20 +#include "nsTArray.h" 1.21 +#include "mozISpellI18NUtil.h" 1.22 +#include "nsCycleCollectionParticipant.h" 1.23 + 1.24 +class mozSpellChecker : public nsISpellChecker 1.25 +{ 1.26 +public: 1.27 + NS_DECL_CYCLE_COLLECTING_ISUPPORTS 1.28 + NS_DECL_CYCLE_COLLECTION_CLASS(mozSpellChecker) 1.29 + 1.30 + mozSpellChecker(); 1.31 + virtual ~mozSpellChecker(); 1.32 + 1.33 + nsresult Init(); 1.34 + 1.35 + // nsISpellChecker 1.36 + NS_IMETHOD SetDocument(nsITextServicesDocument *aDoc, bool aFromStartofDoc); 1.37 + NS_IMETHOD NextMisspelledWord(nsAString &aWord, nsTArray<nsString> *aSuggestions); 1.38 + NS_IMETHOD CheckWord(const nsAString &aWord, bool *aIsMisspelled, nsTArray<nsString> *aSuggestions); 1.39 + NS_IMETHOD Replace(const nsAString &aOldWord, const nsAString &aNewWord, bool aAllOccurrences); 1.40 + NS_IMETHOD IgnoreAll(const nsAString &aWord); 1.41 + 1.42 + NS_IMETHOD AddWordToPersonalDictionary(const nsAString &aWord); 1.43 + NS_IMETHOD RemoveWordFromPersonalDictionary(const nsAString &aWord); 1.44 + NS_IMETHOD GetPersonalDictionary(nsTArray<nsString> *aWordList); 1.45 + 1.46 + NS_IMETHOD GetDictionaryList(nsTArray<nsString> *aDictionaryList); 1.47 + NS_IMETHOD GetCurrentDictionary(nsAString &aDictionary); 1.48 + NS_IMETHOD SetCurrentDictionary(const nsAString &aDictionary); 1.49 + NS_IMETHOD CheckCurrentDictionary(); 1.50 + 1.51 +protected: 1.52 + nsCOMPtr<mozISpellI18NUtil> mConverter; 1.53 + nsCOMPtr<nsITextServicesDocument> mTsDoc; 1.54 + nsCOMPtr<mozIPersonalDictionary> mPersonalDictionary; 1.55 + 1.56 + nsCOMPtr<mozISpellCheckingEngine> mSpellCheckingEngine; 1.57 + bool mFromStart; 1.58 + 1.59 + nsresult SetupDoc(int32_t *outBlockOffset); 1.60 + 1.61 + nsresult GetCurrentBlockIndex(nsITextServicesDocument *aDoc, int32_t *outBlockIndex); 1.62 + 1.63 + nsresult GetEngineList(nsCOMArray<mozISpellCheckingEngine> *aDictionaryList); 1.64 +}; 1.65 +#endif // mozSpellChecker_h__