summaryrefslogtreecommitdiffstats
path: root/extensions/spellcheck/idl
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/spellcheck/idl')
-rw-r--r--extensions/spellcheck/idl/moz.build12
-rw-r--r--extensions/spellcheck/idl/mozIPersonalDictionary.idl55
-rw-r--r--extensions/spellcheck/idl/mozISpellCheckingEngine.idl84
3 files changed, 151 insertions, 0 deletions
diff --git a/extensions/spellcheck/idl/moz.build b/extensions/spellcheck/idl/moz.build
new file mode 100644
index 0000000000..caed8a2d58
--- /dev/null
+++ b/extensions/spellcheck/idl/moz.build
@@ -0,0 +1,12 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+XPIDL_SOURCES += [
+ "mozIPersonalDictionary.idl",
+ "mozISpellCheckingEngine.idl",
+]
+
+XPIDL_MODULE = "spellchecker"
diff --git a/extensions/spellcheck/idl/mozIPersonalDictionary.idl b/extensions/spellcheck/idl/mozIPersonalDictionary.idl
new file mode 100644
index 0000000000..61cdf4c48d
--- /dev/null
+++ b/extensions/spellcheck/idl/mozIPersonalDictionary.idl
@@ -0,0 +1,55 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface nsIStringEnumerator;
+
+/**
+ * This interface represents a Personal Dictionary.
+ */
+[scriptable, uuid(7EF52EAF-B7E1-462B-87E2-5D1DBACA9048)]
+interface mozIPersonalDictionary : nsISupports {
+
+ /**
+ * Load the dictionary
+ */
+ void load();
+
+ /**
+ * Save the dictionary
+ */
+ void save();
+
+ /**
+ * Get the (lexicographically sorted) list of words
+ */
+ readonly attribute nsIStringEnumerator wordList;
+
+ /**
+ * Check a unicode string
+ */
+ boolean check(in AString word);
+
+ /**
+ * Add a word to the personal dictionary
+ */
+ void addWord(in AString word);
+
+ /**
+ * Remove a word from the personal dictionary
+ */
+ void removeWord(in AString word);
+
+ /**
+ * Add a word to the ignore all list
+ */
+ void ignoreWord(in AString word);
+
+ /**
+ * Clear the ignore list
+ */
+ void endSession();
+};
diff --git a/extensions/spellcheck/idl/mozISpellCheckingEngine.idl b/extensions/spellcheck/idl/mozISpellCheckingEngine.idl
new file mode 100644
index 0000000000..f3e67280f6
--- /dev/null
+++ b/extensions/spellcheck/idl/mozISpellCheckingEngine.idl
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface nsIFile;
+interface nsIURI;
+interface mozIPersonalDictionary;
+
+/**
+ * This interface represents a SpellChecker.
+ */
+[scriptable, uuid(8ba643a4-7ddc-4662-b976-7ec123843f10)]
+interface mozISpellCheckingEngine : nsISupports {
+ /**
+ * The names of the dictionaries currently used. These are either values
+ * from getDictionaryList or the empty array if no dictionary is selected.
+ * Setting this attribute to contain a value not in getDictionaryList will
+ * throw NS_ERROR_FILE_NOT_FOUND.
+ *
+ * If the dictionaries are changed to no dictionary (the empty array), an
+ * observer is allowed to set another dictionary before it returns.
+ */
+ attribute Array<ACString> dictionaries;
+
+ /**
+ * the personal dictionary
+ */
+ attribute mozIPersonalDictionary personalDictionary;
+
+ /**
+ * Get the list of dictionaries
+ */
+ Array<ACString> getDictionaryList();
+
+ /**
+ * check a word
+ */
+ boolean check(in AString word);
+
+ /**
+ * get a list of suggestions for a misspelled word
+ */
+ Array<AString> suggest(in AString word);
+
+ /**
+ * Load dictionaries from the specified dir
+ */
+ void loadDictionariesFromDir(in nsIFile dir);
+
+ /**
+ * Add dictionaries from a directory to the spell checker
+ */
+ void addDirectory(in nsIFile dir);
+
+ /**
+ * Remove dictionaries from a directory from the spell checker
+ */
+ void removeDirectory(in nsIFile dir);
+
+ /**
+ * Add a dictionary with the given language code and source URI. The URI
+ * must point to an affix file, with the ".aff" extension. The word list
+ * file must be in the same directory, with the same base name, and the
+ * ".dic" extension.
+ */
+ void addDictionary(in AString lang, in nsIURI file);
+
+ /**
+ * Remove a dictionary with the given language code and path. If the path does
+ * not match that of the current entry with the given language code, it is not
+ * removed.
+ *
+ * @returns True if the dictionary was found and removed.
+ */
+ bool removeDictionary(in AString lang, in nsIURI file);
+};
+
+%{C++
+#define SPELLCHECK_DICTIONARY_REMOVE_NOTIFICATION \
+ "spellcheck-dictionary-remove"
+%}