mozISpellCheckingEngine.idl (2436B)
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 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 #include "nsISupports.idl" 7 8 interface nsIFile; 9 interface nsIURI; 10 interface mozIPersonalDictionary; 11 12 /** 13 * This interface represents a SpellChecker. 14 */ 15 [scriptable, uuid(8ba643a4-7ddc-4662-b976-7ec123843f10)] 16 interface mozISpellCheckingEngine : nsISupports { 17 /** 18 * The names of the dictionaries currently used. These are either values 19 * from getDictionaryList or the empty array if no dictionary is selected. 20 * Setting this attribute to contain a value not in getDictionaryList will 21 * throw NS_ERROR_FILE_NOT_FOUND. 22 * 23 * If the dictionaries are changed to no dictionary (the empty array), an 24 * observer is allowed to set another dictionary before it returns. 25 */ 26 attribute Array<ACString> dictionaries; 27 28 /** 29 * the personal dictionary 30 */ 31 attribute mozIPersonalDictionary personalDictionary; 32 33 /** 34 * Get the list of dictionaries 35 */ 36 Array<ACString> getDictionaryList(); 37 38 /** 39 * check a word 40 */ 41 boolean check(in AString word); 42 43 /** 44 * get a list of suggestions for a misspelled word 45 */ 46 Array<AString> suggest(in AString word); 47 48 /** 49 * Load dictionaries from the specified dir 50 */ 51 void loadDictionariesFromDir(in nsIFile dir); 52 53 /** 54 * Add dictionaries from a directory to the spell checker 55 */ 56 void addDirectory(in nsIFile dir); 57 58 /** 59 * Remove dictionaries from a directory from the spell checker 60 */ 61 void removeDirectory(in nsIFile dir); 62 63 /** 64 * Add a dictionary with the given language code and source URI. The URI 65 * must point to an affix file, with the ".aff" extension. The word list 66 * file must be in the same directory, with the same base name, and the 67 * ".dic" extension. 68 */ 69 void addDictionary(in AString lang, in nsIURI file); 70 71 /** 72 * Remove a dictionary with the given language code and path. If the path does 73 * not match that of the current entry with the given language code, it is not 74 * removed. 75 * 76 * @returns True if the dictionary was found and removed. 77 */ 78 boolean removeDictionary(in AString lang, in nsIURI file); 79 }; 80 81 %{C++ 82 #define SPELLCHECK_DICTIONARY_REMOVE_NOTIFICATION \ 83 "spellcheck-dictionary-remove" 84 %}