2002-10-11 23:46:57 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00: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/. */
|
2002-10-11 23:46:57 +00:00
|
|
|
|
|
|
|
#ifndef nsEditorSpellCheck_h___
|
|
|
|
#define nsEditorSpellCheck_h___
|
|
|
|
|
|
|
|
|
2012-07-13 06:33:42 +00:00
|
|
|
#include "nsCOMPtr.h" // for nsCOMPtr
|
2010-06-02 18:33:47 +00:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2012-07-13 06:33:42 +00: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;
|
2002-10-11 23:46:57 +00:00
|
|
|
|
|
|
|
#define NS_EDITORSPELLCHECK_CID \
|
|
|
|
{ /* {75656ad9-bd13-4c5d-939a-ec6351eea0cc} */ \
|
|
|
|
0x75656ad9, 0xbd13, 0x4c5d, \
|
|
|
|
{ 0x93, 0x9a, 0xec, 0x63, 0x51, 0xee, 0xa0, 0xcc }\
|
|
|
|
}
|
|
|
|
|
2013-06-06 00:07:54 +00:00
|
|
|
class DictionaryFetcher;
|
2011-08-23 19:03:33 +00:00
|
|
|
|
2015-09-07 07:06:00 +00:00
|
|
|
enum dictCompare {
|
|
|
|
DICT_NORMAL_COMPARE,
|
|
|
|
DICT_COMPARE_CASE_INSENSITIVE,
|
|
|
|
DICT_COMPARE_DASHMATCH
|
|
|
|
};
|
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
class nsEditorSpellCheck final : public nsIEditorSpellCheck
|
2002-10-11 23:46:57 +00:00
|
|
|
{
|
2013-06-06 00:07:54 +00:00
|
|
|
friend class DictionaryFetcher;
|
|
|
|
|
2002-10-11 23:46:57 +00:00
|
|
|
public:
|
|
|
|
nsEditorSpellCheck();
|
|
|
|
|
2010-06-02 18:33:47 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS(nsEditorSpellCheck)
|
2002-10-11 23:46:57 +00:00
|
|
|
|
|
|
|
/* Declare all methods in the nsIEditorSpellCheck interface */
|
|
|
|
NS_DECL_NSIEDITORSPELLCHECK
|
|
|
|
|
|
|
|
protected:
|
2014-06-23 22:40:02 +00:00
|
|
|
virtual ~nsEditorSpellCheck();
|
|
|
|
|
2002-10-11 23:46:57 +00:00
|
|
|
nsCOMPtr<nsISpellChecker> mSpellChecker;
|
|
|
|
|
2009-01-18 20:14:14 +00:00
|
|
|
nsTArray<nsString> mSuggestedWordList;
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mSuggestedWordIndex;
|
2002-10-11 23:46:57 +00:00
|
|
|
|
2005-12-05 18:07:33 +00:00
|
|
|
// these are the words in the current personal dictionary,
|
|
|
|
// GetPersonalDictionary must be called to load them.
|
2009-01-18 20:14:14 +00:00
|
|
|
nsTArray<nsString> mDictionaryList;
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mDictionaryIndex;
|
2002-10-11 23:46:57 +00:00
|
|
|
|
|
|
|
nsresult DeleteSuggestedWordList();
|
2002-12-10 15:03:04 +00:00
|
|
|
|
|
|
|
nsCOMPtr<nsITextServicesFilter> mTxtSrvFilter;
|
2011-08-23 19:03:33 +00:00
|
|
|
nsCOMPtr<nsIEditor> mEditor;
|
|
|
|
|
|
|
|
nsString mPreferredLang;
|
2011-08-15 17:54:03 +00:00
|
|
|
|
2013-06-06 00:07:54 +00:00
|
|
|
uint32_t mDictionaryFetcherGroup;
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mUpdateDictionaryRunning;
|
2011-08-15 17:54:03 +00:00
|
|
|
|
2015-09-21 22:28:00 +00:00
|
|
|
nsresult TryDictionary(const nsAString& aDictName, nsTArray<nsString>& aDictList,
|
2015-09-07 07:06:00 +00:00
|
|
|
enum dictCompare aCompareType);
|
|
|
|
|
2013-06-06 00:07:54 +00:00
|
|
|
nsresult DictionaryFetched(DictionaryFetcher* aFetchState);
|
|
|
|
|
2011-08-15 17:54:03 +00:00
|
|
|
public:
|
2011-10-17 14:59:28 +00:00
|
|
|
void BeginUpdateDictionary() { mUpdateDictionaryRunning = true ;}
|
|
|
|
void EndUpdateDictionary() { mUpdateDictionaryRunning = false ;}
|
2002-10-11 23:46:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // nsEditorSpellCheck_h___
|
|
|
|
|
|
|
|
|