1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/editor/composer/src/nsEditorSpellCheck.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,75 @@ 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 nsEditorSpellCheck_h___ 1.10 +#define nsEditorSpellCheck_h___ 1.11 + 1.12 + 1.13 +#include "nsCOMPtr.h" // for nsCOMPtr 1.14 +#include "nsCycleCollectionParticipant.h" 1.15 +#include "nsIEditorSpellCheck.h" // for NS_DECL_NSIEDITORSPELLCHECK, etc 1.16 +#include "nsISupportsImpl.h" 1.17 +#include "nsString.h" // for nsString 1.18 +#include "nsTArray.h" // for nsTArray 1.19 +#include "nscore.h" // for nsresult 1.20 + 1.21 +class nsIEditor; 1.22 +class nsISpellChecker; 1.23 +class nsITextServicesFilter; 1.24 + 1.25 +#define NS_EDITORSPELLCHECK_CID \ 1.26 +{ /* {75656ad9-bd13-4c5d-939a-ec6351eea0cc} */ \ 1.27 + 0x75656ad9, 0xbd13, 0x4c5d, \ 1.28 + { 0x93, 0x9a, 0xec, 0x63, 0x51, 0xee, 0xa0, 0xcc }\ 1.29 +} 1.30 + 1.31 +class DictionaryFetcher; 1.32 + 1.33 +class nsEditorSpellCheck : public nsIEditorSpellCheck 1.34 +{ 1.35 + friend class DictionaryFetcher; 1.36 + 1.37 +public: 1.38 + nsEditorSpellCheck(); 1.39 + virtual ~nsEditorSpellCheck(); 1.40 + 1.41 + NS_DECL_CYCLE_COLLECTING_ISUPPORTS 1.42 + NS_DECL_CYCLE_COLLECTION_CLASS(nsEditorSpellCheck) 1.43 + 1.44 + /* Declare all methods in the nsIEditorSpellCheck interface */ 1.45 + NS_DECL_NSIEDITORSPELLCHECK 1.46 + 1.47 +protected: 1.48 + nsCOMPtr<nsISpellChecker> mSpellChecker; 1.49 + 1.50 + nsTArray<nsString> mSuggestedWordList; 1.51 + int32_t mSuggestedWordIndex; 1.52 + 1.53 + // these are the words in the current personal dictionary, 1.54 + // GetPersonalDictionary must be called to load them. 1.55 + nsTArray<nsString> mDictionaryList; 1.56 + int32_t mDictionaryIndex; 1.57 + 1.58 + nsresult DeleteSuggestedWordList(); 1.59 + 1.60 + nsCOMPtr<nsITextServicesFilter> mTxtSrvFilter; 1.61 + nsCOMPtr<nsIEditor> mEditor; 1.62 + 1.63 + nsString mPreferredLang; 1.64 + 1.65 + uint32_t mDictionaryFetcherGroup; 1.66 + 1.67 + bool mUpdateDictionaryRunning; 1.68 + 1.69 + nsresult DictionaryFetched(DictionaryFetcher* aFetchState); 1.70 + 1.71 +public: 1.72 + void BeginUpdateDictionary() { mUpdateDictionaryRunning = true ;} 1.73 + void EndUpdateDictionary() { mUpdateDictionaryRunning = false ;} 1.74 +}; 1.75 + 1.76 +#endif // nsEditorSpellCheck_h___ 1.77 + 1.78 +