editor/idl/nsIEditorSpellCheck.idl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #include "nsISupports.idl"
michael@0 7
michael@0 8 interface nsIEditor;
michael@0 9 interface nsITextServicesFilter;
michael@0 10 interface nsIEditorSpellCheckCallback;
michael@0 11
michael@0 12 [scriptable, uuid(dd32ef3b-a7d8-43d1-9617-5f2dddbe29eb)]
michael@0 13 interface nsIEditorSpellCheck : nsISupports
michael@0 14 {
michael@0 15
michael@0 16 /**
michael@0 17 * Call this on any change in installed dictionaries to ensure that the spell
michael@0 18 * checker is not using a current dictionary which is no longer available.
michael@0 19 * If the current dictionary is no longer available, then pick another one.
michael@0 20 */
michael@0 21 void checkCurrentDictionary();
michael@0 22
michael@0 23 /**
michael@0 24 * Returns true if we can enable spellchecking. If there are no available
michael@0 25 * dictionaries, this will return false.
michael@0 26 */
michael@0 27 boolean canSpellCheck();
michael@0 28
michael@0 29 /**
michael@0 30 * Turns on the spell checker for the given editor. enableSelectionChecking
michael@0 31 * set means that we only want to check the current selection in the editor,
michael@0 32 * (this controls the behavior of GetNextMisspelledWord). For spellchecking
michael@0 33 * clients with no modal UI (such as inline spellcheckers), this flag doesn't
michael@0 34 * matter. Initialization is asynchronous and is not complete until the given
michael@0 35 * callback is called.
michael@0 36 */
michael@0 37 void InitSpellChecker(in nsIEditor editor, in boolean enableSelectionChecking,
michael@0 38 [optional] in nsIEditorSpellCheckCallback callback);
michael@0 39
michael@0 40 /**
michael@0 41 * When interactively spell checking the document, this will return the
michael@0 42 * value of the next word that is misspelled. This also computes the
michael@0 43 * suggestions which you can get by calling GetSuggestedWord.
michael@0 44 *
michael@0 45 * @see nsISpellChecker::GetNextMisspelledWord
michael@0 46 */
michael@0 47 wstring GetNextMisspelledWord();
michael@0 48
michael@0 49 /**
michael@0 50 * Used to get suggestions for the last word that was checked and found to
michael@0 51 * be misspelled. The first call will give you the first (best) suggestion.
michael@0 52 * Subsequent calls will iterate through all the suggestions, allowing you
michael@0 53 * to build a list. When there are no more suggestions, an empty string
michael@0 54 * (not a null pointer) will be returned.
michael@0 55 *
michael@0 56 * @see nsISpellChecker::GetSuggestedWord
michael@0 57 */
michael@0 58 wstring GetSuggestedWord();
michael@0 59
michael@0 60 /**
michael@0 61 * Check a given word. In spite of the name, this function checks the word
michael@0 62 * you give it, returning true if the word is misspelled. If the word is
michael@0 63 * misspelled, it will compute the suggestions which you can get from
michael@0 64 * GetSuggestedWord().
michael@0 65 *
michael@0 66 * @see nsISpellChecker::CheckCurrentWord
michael@0 67 */
michael@0 68 boolean CheckCurrentWord(in wstring suggestedWord);
michael@0 69
michael@0 70 /**
michael@0 71 * Use when modally checking the document to replace a word.
michael@0 72 *
michael@0 73 * @see nsISpellChecker::CheckCurrentWord
michael@0 74 */
michael@0 75 void ReplaceWord(in wstring misspelledWord, in wstring replaceWord, in boolean allOccurrences);
michael@0 76
michael@0 77 /**
michael@0 78 * @see nsISpellChecker::IgnoreAll
michael@0 79 */
michael@0 80 void IgnoreWordAllOccurrences(in wstring word);
michael@0 81
michael@0 82 /**
michael@0 83 * Fills an internal list of words added to the personal dictionary. These
michael@0 84 * words can be retrieved using GetPersonalDictionaryWord()
michael@0 85 *
michael@0 86 * @see nsISpellChecker::GetPersonalDictionary
michael@0 87 * @see GetPersonalDictionaryWord
michael@0 88 */
michael@0 89 void GetPersonalDictionary();
michael@0 90
michael@0 91 /**
michael@0 92 * Used after you call GetPersonalDictionary() to iterate through all the
michael@0 93 * words added to the personal dictionary. Will return the empty string when
michael@0 94 * there are no more words.
michael@0 95 */
michael@0 96 wstring GetPersonalDictionaryWord();
michael@0 97
michael@0 98 /**
michael@0 99 * Adds a word to the current personal dictionary.
michael@0 100 *
michael@0 101 * @see nsISpellChecker::AddWordToDictionary
michael@0 102 */
michael@0 103 void AddWordToDictionary(in wstring word);
michael@0 104
michael@0 105 /**
michael@0 106 * Removes a word from the current personal dictionary.
michael@0 107 *
michael@0 108 * @see nsISpellChecker::RemoveWordFromPersonalDictionary
michael@0 109 */
michael@0 110 void RemoveWordFromDictionary(in wstring word);
michael@0 111
michael@0 112 /**
michael@0 113 * Retrieves a list of the currently available dictionaries. The strings will
michael@0 114 * typically be language IDs, like "en-US".
michael@0 115 *
michael@0 116 * @see mozISpellCheckingEngine::GetDictionaryList
michael@0 117 */
michael@0 118 void GetDictionaryList([array, size_is(count)] out wstring dictionaryList, out uint32_t count);
michael@0 119
michael@0 120 /**
michael@0 121 * @see nsISpellChecker::GetCurrentDictionary
michael@0 122 */
michael@0 123 AString GetCurrentDictionary();
michael@0 124
michael@0 125 /**
michael@0 126 * @see nsISpellChecker::SetCurrentDictionary
michael@0 127 */
michael@0 128 void SetCurrentDictionary(in AString dictionary);
michael@0 129
michael@0 130 /**
michael@0 131 * Call this to free up the spell checking object. It will also save the
michael@0 132 * current selected language as the default for future use.
michael@0 133 *
michael@0 134 * If you have called CanSpellCheck but not InitSpellChecker, you can still
michael@0 135 * call this function to clear the cached spell check object, and no
michael@0 136 * preference saving will happen.
michael@0 137 */
michael@0 138 void UninitSpellChecker();
michael@0 139
michael@0 140 /**
michael@0 141 * Used to filter the content (for example, to skip blockquotes in email from
michael@0 142 * spellchecking. Call this before calling InitSpellChecker; calling it
michael@0 143 * after initialization will have no effect.
michael@0 144 *
michael@0 145 * @see nsITextServicesDocument::setFilter
michael@0 146 */
michael@0 147 void setFilter(in nsITextServicesFilter filter);
michael@0 148
michael@0 149 /**
michael@0 150 * Like CheckCurrentWord, checks the word you give it, returning true if it's
michael@0 151 * misspelled. This is faster than CheckCurrentWord because it does not
michael@0 152 * compute any suggestions.
michael@0 153 *
michael@0 154 * Watch out: this does not clear any suggestions left over from previous
michael@0 155 * calls to CheckCurrentWord, so there may be suggestions, but they will be
michael@0 156 * invalid.
michael@0 157 */
michael@0 158 boolean CheckCurrentWordNoSuggest(in wstring suggestedWord);
michael@0 159
michael@0 160 /**
michael@0 161 * Update the dictionary in use to be sure it corresponds to what the editor
michael@0 162 * needs. The update is asynchronous and is not complete until the given
michael@0 163 * callback is called.
michael@0 164 */
michael@0 165 void UpdateCurrentDictionary([optional] in nsIEditorSpellCheckCallback callback);
michael@0 166
michael@0 167 };
michael@0 168
michael@0 169 [scriptable, function, uuid(5f0a4bab-8538-4074-89d3-2f0e866a1c0b)]
michael@0 170 interface nsIEditorSpellCheckCallback : nsISupports
michael@0 171 {
michael@0 172 void editorSpellCheckDone();
michael@0 173 };

mercurial