2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef nsEditorSpellCheck_h___
|
|
|
|
#define nsEditorSpellCheck_h___
|
|
|
|
|
|
|
|
|
2012-07-12 23:33:42 -07:00
|
|
|
#include "nsCOMPtr.h" // for nsCOMPtr
|
2010-06-02 11:33:47 -07:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2012-07-12 23:33:42 -07:00
|
|
|
#include "nsIEditorSpellCheck.h" // for NS_DECL_NSIEDITORSPELLCHECK, etc
|
|
|
|
#include "nsISupportsImpl.h"
|
|
|
|
#include "nsString.h" // for nsString
|
|
|
|
#include "nsTArray.h" // for nsTArray
|
|
|
|
#include "nscore.h" // for nsresult
|
|
|
|
|
|
|
|
class nsIEditor;
|
|
|
|
class nsISpellChecker;
|
|
|
|
class nsITextServicesFilter;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#define NS_EDITORSPELLCHECK_CID \
|
|
|
|
{ /* {75656ad9-bd13-4c5d-939a-ec6351eea0cc} */ \
|
|
|
|
0x75656ad9, 0xbd13, 0x4c5d, \
|
|
|
|
{ 0x93, 0x9a, 0xec, 0x63, 0x51, 0xee, 0xa0, 0xcc }\
|
|
|
|
}
|
|
|
|
|
2013-06-05 17:07:54 -07:00
|
|
|
class DictionaryFetcher;
|
2011-08-23 12:03:33 -07:00
|
|
|
|
2014-08-05 10:33:55 -07:00
|
|
|
class nsEditorSpellCheck MOZ_FINAL : public nsIEditorSpellCheck
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2013-06-05 17:07:54 -07:00
|
|
|
friend class DictionaryFetcher;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
public:
|
|
|
|
nsEditorSpellCheck();
|
|
|
|
|
2010-06-02 11:33:47 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS(nsEditorSpellCheck)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* Declare all methods in the nsIEditorSpellCheck interface */
|
|
|
|
NS_DECL_NSIEDITORSPELLCHECK
|
|
|
|
|
|
|
|
protected:
|
2014-06-23 15:40:02 -07:00
|
|
|
virtual ~nsEditorSpellCheck();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCOMPtr<nsISpellChecker> mSpellChecker;
|
|
|
|
|
2009-01-18 12:14:14 -08:00
|
|
|
nsTArray<nsString> mSuggestedWordList;
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mSuggestedWordIndex;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// these are the words in the current personal dictionary,
|
|
|
|
// GetPersonalDictionary must be called to load them.
|
2009-01-18 12:14:14 -08:00
|
|
|
nsTArray<nsString> mDictionaryList;
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mDictionaryIndex;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsresult DeleteSuggestedWordList();
|
|
|
|
|
|
|
|
nsCOMPtr<nsITextServicesFilter> mTxtSrvFilter;
|
2011-08-23 12:03:33 -07:00
|
|
|
nsCOMPtr<nsIEditor> mEditor;
|
|
|
|
|
|
|
|
nsString mPreferredLang;
|
2011-08-15 10:54:03 -07:00
|
|
|
|
2013-06-05 17:07:54 -07:00
|
|
|
uint32_t mDictionaryFetcherGroup;
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mUpdateDictionaryRunning;
|
2011-08-15 10:54:03 -07:00
|
|
|
|
2013-06-05 17:07:54 -07:00
|
|
|
nsresult DictionaryFetched(DictionaryFetcher* aFetchState);
|
|
|
|
|
2011-08-15 10:54:03 -07:00
|
|
|
public:
|
2011-10-17 07:59:28 -07:00
|
|
|
void BeginUpdateDictionary() { mUpdateDictionaryRunning = true ;}
|
|
|
|
void EndUpdateDictionary() { mUpdateDictionaryRunning = false ;}
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsEditorSpellCheck_h___
|
|
|
|
|
|
|
|
|