1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/extensions/spellcheck/idl/mozISpellCheckingEngine.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,107 @@ 1.4 +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "nsISupports.idl" 1.10 + 1.11 +interface nsIFile; 1.12 +interface mozIPersonalDictionary; 1.13 + 1.14 +[scriptable, uuid(8ba643a4-7ddc-4662-b976-7ec123843f10)] 1.15 + 1.16 +/** 1.17 + * This interface represents a SpellChecker. 1.18 + */ 1.19 + 1.20 +interface mozISpellCheckingEngine : nsISupports { 1.21 + /** 1.22 + * The name of the current dictionary. Is either a value from 1.23 + * getDictionaryList or the empty string if no dictionary is selected. 1.24 + * Setting this attribute to a value not in getDictionaryList will throw 1.25 + * NS_ERROR_FILE_NOT_FOUND. 1.26 + * 1.27 + * The spellcheck engine will send a notification with 1.28 + * "spellcheck-dictionary-update" as topic when this changes. 1.29 + * If the dictionary is changed to no dictionary (the empty string), an 1.30 + * observer is allowed to set another dictionary before it returns. 1.31 + */ 1.32 + attribute wstring dictionary; 1.33 + 1.34 + /** 1.35 + * The language this spellchecker is using when checking 1.36 + * 1.37 + * The spellcheck engine will send a notification with 1.38 + * "spellcheck-dictionary-update" as topic when this changes. 1.39 + */ 1.40 + readonly attribute wstring language; 1.41 + 1.42 + /** 1.43 + * Does the engine provide its own personal dictionary? 1.44 + */ 1.45 + readonly attribute boolean providesPersonalDictionary; 1.46 + 1.47 + /** 1.48 + * Does the engine provide its own word utils? 1.49 + */ 1.50 + readonly attribute boolean providesWordUtils; 1.51 + 1.52 + /** 1.53 + * The name of the engine 1.54 + */ 1.55 + readonly attribute wstring name; 1.56 + 1.57 + /** 1.58 + * a string indicating the copyright of the engine 1.59 + */ 1.60 + readonly attribute wstring copyright; 1.61 + 1.62 + /** 1.63 + * the personal dictionary 1.64 + */ 1.65 + attribute mozIPersonalDictionary personalDictionary; 1.66 + 1.67 + /** 1.68 + * Get the list of dictionaries 1.69 + */ 1.70 + void getDictionaryList([array, size_is(count)] out wstring dictionaries, out uint32_t count); 1.71 + 1.72 + /** 1.73 + * check a word 1.74 + * 1.75 + * The spellcheck engine will send a notification with 1.76 + * "spellcheck-dictionary-update" as topic when this changes. 1.77 + */ 1.78 + boolean check(in wstring word); 1.79 + 1.80 + /** 1.81 + * get a list of suggestions for a misspelled word 1.82 + * 1.83 + * The spellcheck engine will send a notification with 1.84 + * "spellcheck-dictionary-update" as topic when this changes. 1.85 + */ 1.86 + void suggest(in wstring word,[array, size_is(count)] out wstring suggestions, out uint32_t count); 1.87 + 1.88 + /** 1.89 + * Load dictionaries from the specified dir 1.90 + */ 1.91 + void loadDictionariesFromDir(in nsIFile dir); 1.92 + 1.93 + /** 1.94 + * Add dictionaries from a directory to the spell checker 1.95 + */ 1.96 + void addDirectory(in nsIFile dir); 1.97 + 1.98 + /** 1.99 + * Remove dictionaries from a directory from the spell checker 1.100 + */ 1.101 + void removeDirectory(in nsIFile dir); 1.102 +}; 1.103 + 1.104 +%{C++ 1.105 +#define DICTIONARY_SEARCH_DIRECTORY "DictD" 1.106 +#define DICTIONARY_SEARCH_DIRECTORY_LIST "DictDL" 1.107 + 1.108 +#define SPELLCHECK_DICTIONARY_UPDATE_NOTIFICATION \ 1.109 + "spellcheck-dictionary-update" 1.110 +%}