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 | |
achristensen@apple.com | ade2d5f | 2017-05-09 02:22:45 +0000 | [diff] [blame] | 26 | #pragma once |
andersca@apple.com | 36f2f52 | 2010-12-21 00:35:16 +0000 | [diff] [blame] | 27 | |
g.czajkowski@samsung.com | 12f3202 | 2013-03-01 11:39:02 +0000 | [diff] [blame] | 28 | #include "TextCheckerCompletion.h" |
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 | |
jberlin@webkit.org | c008ff7 | 2011-04-11 18:00:07 +0000 | [diff] [blame] | 34 | class WebPageProxy; |
mrowe@apple.com | d82db12 | 2011-01-22 01:46:39 +0000 | [diff] [blame] | 35 | struct TextCheckerState; |
andersca@apple.com | 190ba93 | 2011-01-04 22:41:52 +0000 | [diff] [blame] | 36 | |
andersca@apple.com | 36f2f52 | 2010-12-21 00:35:16 +0000 | [diff] [blame] | 37 | class TextChecker { |
| 38 | public: |
andersca@apple.com | 190ba93 | 2011-01-04 22:41:52 +0000 | [diff] [blame] | 39 | static const TextCheckerState& state(); |
andersca@apple.com | 36f2f52 | 2010-12-21 00:35:16 +0000 | [diff] [blame] | 40 | static bool isContinuousSpellCheckingAllowed(); |
andersca@apple.com | 36f2f52 | 2010-12-21 00:35:16 +0000 | [diff] [blame] | 41 | |
andersca@apple.com | 190ba93 | 2011-01-04 22:41:52 +0000 | [diff] [blame] | 42 | static void setContinuousSpellCheckingEnabled(bool); |
andersca@apple.com | 36f2f52 | 2010-12-21 00:35:16 +0000 | [diff] [blame] | 43 | static void setGrammarCheckingEnabled(bool); |
jbedard@apple.com | d44979c | 2016-09-22 17:39:51 +0000 | [diff] [blame] | 44 | |
| 45 | static void setTestingMode(bool); |
| 46 | static bool isTestingMode(); |
andersca@apple.com | e95efb1 | 2011-01-04 19:49:18 +0000 | [diff] [blame] | 47 | |
mitz@apple.com | 1b97088 | 2014-02-15 17:06:17 +0000 | [diff] [blame] | 48 | #if PLATFORM(COCOA) |
andersca@apple.com | e95efb1 | 2011-01-04 19:49:18 +0000 | [diff] [blame] | 49 | static void setAutomaticSpellingCorrectionEnabled(bool); |
andersca@apple.com | 95dcf97 | 2011-01-05 18:28:29 +0000 | [diff] [blame] | 50 | static void setAutomaticQuoteSubstitutionEnabled(bool); |
| 51 | static void setAutomaticDashSubstitutionEnabled(bool); |
| 52 | static void setAutomaticLinkDetectionEnabled(bool); |
| 53 | static void setAutomaticTextReplacementEnabled(bool); |
andersca@apple.com | 2fa2dba | 2011-01-05 21:22:04 +0000 | [diff] [blame] | 54 | |
rniwa@webkit.org | 7c46afc | 2013-05-02 01:54:27 +0000 | [diff] [blame] | 55 | static void didChangeAutomaticTextReplacementEnabled(); |
| 56 | static void didChangeAutomaticSpellingCorrectionEnabled(); |
| 57 | static void didChangeAutomaticQuoteSubstitutionEnabled(); |
| 58 | static void didChangeAutomaticDashSubstitutionEnabled(); |
| 59 | |
andersca@apple.com | 2fa2dba | 2011-01-05 21:22:04 +0000 | [diff] [blame] | 60 | static bool isSmartInsertDeleteEnabled(); |
| 61 | static void setSmartInsertDeleteEnabled(bool); |
jberlin@webkit.org | 4c2c826 | 2011-04-09 01:31:30 +0000 | [diff] [blame] | 62 | |
| 63 | static bool substitutionsPanelIsShowing(); |
| 64 | static void toggleSubstitutionsPanelIsShowing(); |
andersca@apple.com | 190ba93 | 2011-01-04 22:41:52 +0000 | [diff] [blame] | 65 | #endif |
andersca@apple.com | 33241f7 | 2011-01-05 02:13:12 +0000 | [diff] [blame] | 66 | |
mrobinson@webkit.org | 3c04cae | 2015-05-07 18:24:31 +0000 | [diff] [blame] | 67 | #if PLATFORM(GTK) |
| 68 | static void setSpellCheckingLanguages(const Vector<String>&); |
| 69 | static Vector<String> loadedSpellCheckingLanguages(); |
| 70 | #endif |
| 71 | |
commit-queue@webkit.org | 3590294 | 2011-10-13 19:36:34 +0000 | [diff] [blame] | 72 | static void continuousSpellCheckingEnabledStateChanged(bool); |
| 73 | static void grammarCheckingEnabledStateChanged(bool); |
jberlin@webkit.org | c008ff7 | 2011-04-11 18:00:07 +0000 | [diff] [blame] | 74 | static int64_t uniqueSpellDocumentTag(WebPageProxy*); |
andersca@apple.com | 33241f7 | 2011-01-05 02:13:12 +0000 | [diff] [blame] | 75 | static void closeSpellDocumentWithTag(int64_t); |
jberlin@webkit.org | f0cc7d0 | 2011-04-07 18:01:19 +0000 | [diff] [blame] | 76 | #if USE(UNIFIED_TEXT_CHECKING) |
enrica@apple.com | 3a51f07 | 2016-06-17 23:31:42 +0000 | [diff] [blame] | 77 | static Vector<WebCore::TextCheckingResult> checkTextOfParagraph(int64_t spellDocumentTag, StringView text, int32_t insertionPoint, uint64_t checkingTypes, bool initialCapitalizationEnabled); |
jberlin@webkit.org | f0cc7d0 | 2011-04-07 18:01:19 +0000 | [diff] [blame] | 78 | #endif |
darin@apple.com | 11c8079 | 2014-03-16 06:22:02 +0000 | [diff] [blame] | 79 | static void checkSpellingOfString(int64_t spellDocumentTag, StringView text, int32_t& misspellingLocation, int32_t& misspellingLength); |
| 80 | static void checkGrammarOfString(int64_t spellDocumentTag, StringView text, Vector<WebCore::GrammarDetail>&, int32_t& badGrammarLocation, int32_t& badGrammarLength); |
jberlin@webkit.org | 53b5606 | 2011-04-09 00:18:01 +0000 | [diff] [blame] | 81 | static bool spellingUIIsShowing(); |
| 82 | static void toggleSpellingUIIsShowing(); |
jberlin@webkit.org | c008ff7 | 2011-04-11 18:00:07 +0000 | [diff] [blame] | 83 | static void updateSpellingUIWithMisspelledWord(int64_t spellDocumentTag, const String& misspelledWord); |
| 84 | static void updateSpellingUIWithGrammarString(int64_t spellDocumentTag, const String& badGrammarPhrase, const WebCore::GrammarDetail&); |
enrica@apple.com | 3a51f07 | 2016-06-17 23:31:42 +0000 | [diff] [blame] | 85 | static void getGuessesForWord(int64_t spellDocumentTag, const String& word, const String& context, int32_t insertionPoint, Vector<String>& guesses, bool initialCapitalizationEnabled); |
jberlin@webkit.org | 5daca92 | 2011-04-11 21:19:22 +0000 | [diff] [blame] | 86 | static void learnWord(int64_t spellDocumentTag, const String& word); |
andersca@apple.com | 047c400 | 2011-01-05 19:41:03 +0000 | [diff] [blame] | 87 | static void ignoreWord(int64_t spellDocumentTag, const String& word); |
achristensen@apple.com | ade2d5f | 2017-05-09 02:22:45 +0000 | [diff] [blame] | 88 | static void requestCheckingOfString(Ref<TextCheckerCompletion>&&, int32_t insertionPoint); |
andersca@apple.com | 36f2f52 | 2010-12-21 00:35:16 +0000 | [diff] [blame] | 89 | }; |
| 90 | |
| 91 | } // namespace WebKit |