OSDN Git Service

Upgrade to evernote-1.17.
[neighbornote/NeighborNote.git] / src / com / swabunga / spell / event / SpellCheckEvent.java
1 /*\r
2 Jazzy - a Java library for Spell Checking\r
3 Copyright (C) 2001 Mindaugas Idzelis\r
4 Full text of license can be found in LICENSE.txt\r
5 \r
6 This library is free software; you can redistribute it and/or\r
7 modify it under the terms of the GNU Lesser General Public\r
8 License as published by the Free Software Foundation; either\r
9 version 2.1 of the License, or (at your option) any later version.\r
10 \r
11 This library is distributed in the hope that it will be useful,\r
12 but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\r
14 Lesser General Public License for more details.\r
15 \r
16 You should have received a copy of the GNU Lesser General Public\r
17 License along with this library; if not, write to the Free Software\r
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\r
19 */\r
20 package com.swabunga.spell.event;\r
21 \r
22 import java.util.List;\r
23 \r
24 /**\r
25  * This event is fired off by the SpellChecker and is passed to the\r
26  * registered SpellCheckListeners\r
27  * <p/>\r
28  * As far as I know, we will only require one implementation of the SpellCheckEvent\r
29  * (BasicSpellCheckEvent) but I have defined this interface just in case. The\r
30  * BasicSpellCheckEvent implementation is currently package private.\r
31  *\r
32  * @author Jason Height (jheight@chariot.net.au)\r
33  */\r
34 public interface SpellCheckEvent {\r
35   /** Field indicating that the incorrect word should be ignored*/\r
36   public static final short IGNORE = 0;\r
37   /** Field indicating that the incorrect word should be ignored forever*/\r
38   public static final short IGNOREALL = 1;\r
39   /** Field indicating that the incorrect word should be replaced*/\r
40   public static final short REPLACE = 2;\r
41   /** Field indicating that the incorrect word should be replaced always*/\r
42   public static final short REPLACEALL = 3;\r
43   /** Field indicating that the incorrect word should be added to the dictionary*/\r
44   public static final short ADDTODICT = 4;\r
45   /** Field indicating that the spell checking should be terminated*/\r
46   public static final short CANCEL = 5;\r
47   /** Initial case for the action */\r
48   public static final short INITIAL = -1;\r
49 \r
50   /** Returns the list of suggested Word objects\r
51    * @return A list of words phonetically close to the misspelt word\r
52    */\r
53   @SuppressWarnings("unchecked")\r
54 public List getSuggestions();\r
55 \r
56   /** Returns the currently misspelt word\r
57    * @return The text misspelt\r
58    */\r
59   public String getInvalidWord();\r
60 \r
61   /** Returns the context in which the misspelt word is used\r
62    * @return The text containing the context\r
63    */\r
64   public String getWordContext();\r
65 \r
66   /** Returns the start position of the misspelt word in the context\r
67    * @return The position of the word\r
68    */\r
69   public int getWordContextPosition();\r
70 \r
71   /** Returns the action type the user has to handle\r
72    * @return The type of action the event is carrying\r
73    */\r
74   public short getAction();\r
75 \r
76   /** Returns the text to replace\r
77    * @return the text of the word to replace\r
78    */\r
79   public String getReplaceWord();\r
80 \r
81   /** Set the action to replace the currently misspelt word with the new word\r
82    *  @param newWord The word to replace the currently misspelt word\r
83    *  @param replaceAll If set to true, the SpellChecker will replace all\r
84    *  further occurrences of the misspelt word without firing a SpellCheckEvent.\r
85    */\r
86   public void replaceWord(String newWord, boolean replaceAll);\r
87 \r
88   /** Set the action it ignore the currently misspelt word.\r
89    *  @param ignoreAll If set to true, the SpellChecker will replace all\r
90    *  further occurrences of the misspelt word without firing a SpellCheckEvent.\r
91    */\r
92   public void ignoreWord(boolean ignoreAll);\r
93 \r
94   /** Set the action to add a new word into the dictionary. This will also replace the\r
95    *  currently misspelt word.\r
96    *@param newWord The new word to add\r
97    */\r
98   public void addToDictionary(String newWord);\r
99 \r
100   /** Set the action to terminate processing of the spell checker.\r
101    */\r
102   public void cancel();\r
103 }