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
|
|
|
|
#include "prtypes.h" // for PRInt32
|
|
|
|
|
|
|
|
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 }\
|
|
|
|
}
|
|
|
|
|
2011-08-23 12:03:33 -07:00
|
|
|
class LastDictionary;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsEditorSpellCheck : public nsIEditorSpellCheck
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsEditorSpellCheck();
|
|
|
|
virtual ~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
|
|
|
|
|
2011-08-23 12:03:33 -07:00
|
|
|
static LastDictionary* gDictionaryStore;
|
|
|
|
|
|
|
|
static void ShutDown();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
nsCOMPtr<nsISpellChecker> mSpellChecker;
|
|
|
|
|
2009-01-18 12:14:14 -08:00
|
|
|
nsTArray<nsString> mSuggestedWordList;
|
2007-03-22 10:30:00 -07:00
|
|
|
PRInt32 mSuggestedWordIndex;
|
|
|
|
|
|
|
|
// 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;
|
2007-03-22 10:30:00 -07:00
|
|
|
PRInt32 mDictionaryIndex;
|
|
|
|
|
|
|
|
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
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mUpdateDictionaryRunning;
|
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___
|
|
|
|
|
|
|
|
|