andersca@apple.com | 36f2f52 | 2010-12-21 00:35:16 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 Apple Inc. All rights reserved. |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * 1. Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * 2. Redistributions in binary form must reproduce the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer in the |
| 11 | * documentation and/or other materials provided with the distribution. |
| 12 | * |
| 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' |
| 14 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
| 15 | * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS |
| 17 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 18 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 19 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 20 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 21 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 22 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| 23 | * THE POSSIBILITY OF SUCH DAMAGE. |
| 24 | */ |
| 25 | |
| 26 | #ifndef TextChecker_h |
| 27 | #define TextChecker_h |
| 28 | |
andersca@apple.com | 33241f7 | 2011-01-05 02:13:12 +0000 | [diff] [blame] | 29 | #include <WebCore/EditorClient.h> |
morrita@google.com | 7692b42 | 2011-02-15 08:28:20 +0000 | [diff] [blame^] | 30 | #include <WebCore/TextCheckerClient.h> |
andersca@apple.com | 33241f7 | 2011-01-05 02:13:12 +0000 | [diff] [blame] | 31 | |
andersca@apple.com | 36f2f52 | 2010-12-21 00:35:16 +0000 | [diff] [blame] | 32 | namespace WebKit { |
| 33 | |
mrowe@apple.com | d82db12 | 2011-01-22 01:46:39 +0000 | [diff] [blame] | 34 | struct TextCheckerState; |
andersca@apple.com | 190ba93 | 2011-01-04 22:41:52 +0000 | [diff] [blame] | 35 | |
andersca@apple.com | 36f2f52 | 2010-12-21 00:35:16 +0000 | [diff] [blame] | 36 | class TextChecker { |
| 37 | public: |
andersca@apple.com | 190ba93 | 2011-01-04 22:41:52 +0000 | [diff] [blame] | 38 | static const TextCheckerState& state(); |
andersca@apple.com | 36f2f52 | 2010-12-21 00:35:16 +0000 | [diff] [blame] | 39 | static bool isContinuousSpellCheckingAllowed(); |
andersca@apple.com | 36f2f52 | 2010-12-21 00:35:16 +0000 | [diff] [blame] | 40 | |
andersca@apple.com | 190ba93 | 2011-01-04 22:41:52 +0000 | [diff] [blame] | 41 | static void setContinuousSpellCheckingEnabled(bool); |
andersca@apple.com | 36f2f52 | 2010-12-21 00:35:16 +0000 | [diff] [blame] | 42 | static void setGrammarCheckingEnabled(bool); |
andersca@apple.com | e95efb1 | 2011-01-04 19:49:18 +0000 | [diff] [blame] | 43 | |
andersca@apple.com | 190ba93 | 2011-01-04 22:41:52 +0000 | [diff] [blame] | 44 | #if PLATFORM(MAC) |
andersca@apple.com | e95efb1 | 2011-01-04 19:49:18 +0000 | [diff] [blame] | 45 | static void setAutomaticSpellingCorrectionEnabled(bool); |
andersca@apple.com | 95dcf97 | 2011-01-05 18:28:29 +0000 | [diff] [blame] | 46 | static void setAutomaticQuoteSubstitutionEnabled(bool); |
| 47 | static void setAutomaticDashSubstitutionEnabled(bool); |
| 48 | static void setAutomaticLinkDetectionEnabled(bool); |
| 49 | static void setAutomaticTextReplacementEnabled(bool); |
andersca@apple.com | 2fa2dba | 2011-01-05 21:22:04 +0000 | [diff] [blame] | 50 | |
| 51 | static bool isSmartInsertDeleteEnabled(); |
| 52 | static void setSmartInsertDeleteEnabled(bool); |
andersca@apple.com | 190ba93 | 2011-01-04 22:41:52 +0000 | [diff] [blame] | 53 | #endif |
andersca@apple.com | 33241f7 | 2011-01-05 02:13:12 +0000 | [diff] [blame] | 54 | |
| 55 | static int64_t uniqueSpellDocumentTag(); |
| 56 | static void closeSpellDocumentWithTag(int64_t); |
| 57 | |
| 58 | static Vector<WebCore::TextCheckingResult> checkTextOfParagraph(int64_t spellDocumentTag, const UChar* text, int length, uint64_t checkingTypes); |
| 59 | static void updateSpellingUIWithMisspelledWord(const String& misspelledWord); |
| 60 | static void getGuessesForWord(int64_t spellDocumentTag, const String& word, const String& context, Vector<String>& guesses); |
andersca@apple.com | 047c400 | 2011-01-05 19:41:03 +0000 | [diff] [blame] | 61 | static void learnWord(const String& word); |
| 62 | static void ignoreWord(int64_t spellDocumentTag, const String& word); |
andersca@apple.com | 36f2f52 | 2010-12-21 00:35:16 +0000 | [diff] [blame] | 63 | }; |
| 64 | |
| 65 | } // namespace WebKit |
| 66 | |
| 67 | #endif // TextChecker_h |