1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
23 * Brett Wilson <brettw@gmail.com>
25 * Alternatively, the contents of this file may be used under the terms of
26 * either of the GNU General Public License Version 2 or later (the "GPL"),
27 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
37 * ***** END LICENSE BLOCK ***** */
39 #include
"nsISupports.idl"
42 interface nsITextServicesFilter
;
44 [scriptable
, uuid(90c93610
-c116
-44ab
-9793-62dccb9f43ce
)]
45 interface nsIEditorSpellCheck
: nsISupports
49 * Returns true if we can enable spellchecking. If there are no available
50 * dictionaries, this will return false.
52 boolean canSpellCheck
();
55 * Turns on the spell checker for the given editor. enableSelectionChecking
56 * set means that we only want to check the current selection in the editor,
57 * (this controls the behavior of GetNextMisspelledWord). For spellchecking
58 * clients with no modal UI (such as inline spellcheckers), this flag doesn't
61 void InitSpellChecker
(in nsIEditor editor
, in boolean enableSelectionChecking
);
64 * When interactively spell checking the document, this will return the
65 * value of the next word that is misspelled. This also computes the
66 * suggestions which you can get by calling GetSuggestedWord.
68 * @see nsISpellChecker::GetNextMisspelledWord
70 wstring GetNextMisspelledWord
();
73 * Used to get suggestions for the last word that was checked and found to
74 * be misspelled. The first call will give you the first (best) suggestion.
75 * Subsequent calls will iterate through all the suggestions, allowing you
76 * to build a list. When there are no more suggestions, an empty string
77 * (not a null pointer) will be returned.
79 * @see nsISpellChecker::GetSuggestedWord
81 wstring GetSuggestedWord
();
84 * Check a given word. In spite of the name, this function checks the word
85 * you give it, returning true if the word is misspelled. If the word is
86 * misspelled, it will compute the suggestions which you can get from
89 * @see nsISpellChecker::CheckCurrentWord
91 boolean CheckCurrentWord
(in wstring suggestedWord
);
94 * Use when modally checking the document to replace a word.
96 * @see nsISpellChecker::CheckCurrentWord
98 void ReplaceWord
(in wstring misspelledWord
, in wstring replaceWord
, in boolean allOccurrences
);
101 * @see nsISpellChecker::IgnoreAll
103 void IgnoreWordAllOccurrences
(in wstring word
);
106 * Fills an internal list of words added to the personal dictionary. These
107 * words can be retrieved using GetPersonalDictionaryWord()
109 * @see nsISpellChecker::GetPersonalDictionary
110 * @see GetPersonalDictionaryWord
112 void GetPersonalDictionary
();
115 * Used after you call GetPersonalDictionary() to iterate through all the
116 * words added to the personal dictionary. Will return the empty string when
117 * there are no more words.
119 wstring GetPersonalDictionaryWord
();
122 * Adds a word to the current personal dictionary.
124 * @see nsISpellChecker::AddWordToDictionary
126 void AddWordToDictionary
(in wstring word
);
129 * Removes a word from the current personal dictionary.
131 * @see nsISpellChecker::RemoveWordFromPersonalDictionary
133 void RemoveWordFromDictionary
(in wstring word
);
136 * Retrieves a list of the currently available dictionaries. The strings will
137 * typically be language IDs, like "en-US".
139 * @see mozISpellCheckingEngine::GetDictionaryList
141 void GetDictionaryList
([array
, size_is(count
)] out wstring dictionaryList
, out PRUint32 count
);
144 * @see nsISpellChecker::GetCurrentDictionary
146 wstring GetCurrentDictionary
();
149 * @see nsISpellChecker::SetCurrentDictionary
151 void SetCurrentDictionary
(in wstring dictionary
);
154 * Call to save the currently selected dictionary as the default. The
155 * function UninitSpellChecker will also do this, but that function may not
156 * be called in some situations. This function allows the caller to force the
159 void saveDefaultDictionary
();
162 * Call this to free up the spell checking object. It will also save the
163 * current selected language as the default for future use.
165 * If you have called CanSpellCheck but not InitSpellChecker, you can still
166 * call this function to clear the cached spell check object, and no
167 * preference saving will happen.
169 void UninitSpellChecker
();
172 * Used to filter the content (for example, to skip blockquotes in email from
173 * spellchecking. Call this before calling InitSpellChecker; calling it
174 * after initialization will have no effect.
176 * @see nsITextServicesDocument::setFilter
178 void setFilter
(in nsITextServicesFilter filter
);
181 * Like CheckCurrentWord, checks the word you give it, returning true if it's
182 * misspelled. This is faster than CheckCurrentWord because it does not
183 * compute any suggestions.
185 * Watch out: this does not clear any suggestions left over from previous
186 * calls to CheckCurrentWord, so there may be suggestions, but they will be
189 boolean CheckCurrentWordNoSuggest
(in wstring suggestedWord
);