Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/editor/spellchecker/EditorSpellCheck.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/* This Source Code Form is subject to the terms of the Mozilla Public
3
 * License, v. 2.0. If a copy of the MPL was not distributed with this
4
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
#ifndef mozilla_EditorSpellCheck_h
7
#define mozilla_EditorSpellCheck_h
8
9
10
#include "nsCOMPtr.h"                   // for nsCOMPtr
11
#include "nsCycleCollectionParticipant.h"
12
#include "nsIEditorSpellCheck.h"        // for NS_DECL_NSIEDITORSPELLCHECK, etc
13
#include "nsISupportsImpl.h"
14
#include "nsString.h"                   // for nsString
15
#include "nsTArray.h"                   // for nsTArray
16
#include "nscore.h"                     // for nsresult
17
18
class mozSpellChecker;
19
class nsIEditor;
20
class nsISpellChecker;
21
22
namespace mozilla {
23
24
class DictionaryFetcher;
25
class EditorBase;
26
27
enum dictCompare
28
{
29
  DICT_NORMAL_COMPARE,
30
  DICT_COMPARE_CASE_INSENSITIVE,
31
  DICT_COMPARE_DASHMATCH
32
};
33
34
class EditorSpellCheck final : public nsIEditorSpellCheck
35
{
36
  friend class DictionaryFetcher;
37
38
public:
39
  EditorSpellCheck();
40
41
  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
42
  NS_DECL_CYCLE_COLLECTION_CLASS(EditorSpellCheck)
43
44
  /* Declare all methods in the nsIEditorSpellCheck interface */
45
  NS_DECL_NSIEDITORSPELLCHECK
46
47
  mozSpellChecker* GetSpellChecker();
48
49
protected:
50
  virtual ~EditorSpellCheck();
51
52
  RefPtr<mozSpellChecker> mSpellChecker;
53
  RefPtr<EditorBase> mEditor;
54
55
  nsTArray<nsString> mSuggestedWordList;
56
57
  // these are the words in the current personal dictionary,
58
  // GetPersonalDictionary must be called to load them.
59
  nsTArray<nsString>  mDictionaryList;
60
61
  nsString mPreferredLang;
62
63
  uint32_t mTxtSrvFilterType;
64
  int32_t mSuggestedWordIndex;
65
  int32_t mDictionaryIndex;
66
  uint32_t mDictionaryFetcherGroup;
67
68
  bool mUpdateDictionaryRunning;
69
70
  nsresult DeleteSuggestedWordList();
71
72
  void BuildDictionaryList(const nsAString& aDictName,
73
                           const nsTArray<nsString>& aDictList,
74
                           enum dictCompare aCompareType,
75
                           nsTArray<nsString>& aTryList);
76
77
  nsresult DictionaryFetched(DictionaryFetcher* aFetchState);
78
79
  void SetFallbackDictionary(DictionaryFetcher* aFetcher);
80
81
82
public:
83
0
  void BeginUpdateDictionary() { mUpdateDictionaryRunning = true ;}
84
0
  void EndUpdateDictionary() { mUpdateDictionaryRunning = false ;}
85
};
86
87
} // namespace mozilla
88
89
#endif // mozilla_EditorSpellCheck_h