| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef WebSpellCheckClient_h | 31 #ifndef WebSpellCheckClient_h |
| 32 #define WebSpellCheckClient_h | 32 #define WebSpellCheckClient_h |
| 33 | 33 |
| 34 #include "../platform/WebString.h" | 34 #include "../platform/WebString.h" |
| 35 #include "../platform/WebVector.h" | 35 #include "../platform/WebVector.h" |
| 36 #include "WebTextCheckingType.h" | |
| 37 | 36 |
| 38 namespace blink { | 37 namespace blink { |
| 39 | 38 |
| 40 class WebString; | 39 class WebString; |
| 41 class WebTextCheckingCompletion; | 40 class WebTextCheckingCompletion; |
| 42 struct WebTextCheckingResult; | 41 struct WebTextCheckingResult; |
| 43 | 42 |
| 44 class WebSpellCheckClient { | 43 class WebSpellCheckClient { |
| 45 public: | 44 public: |
| 46 // The client should perform spell-checking on the given text. If the | 45 // The client should perform spell-checking on the given text. If the |
| 47 // text contains a misspelled word, then upon return misspelledOffset | 46 // text contains a misspelled word, then upon return misspelledOffset |
| 48 // will point to the start of the misspelled word, and misspelledLength | 47 // will point to the start of the misspelled word, and misspelledLength |
| 49 // will indicates its length. Otherwise, if there was not a spelling | 48 // will indicates its length. Otherwise, if there was not a spelling |
| 50 // error, then upon return misspelledLength is 0. If optional_suggestions | 49 // error, then upon return misspelledLength is 0. If optional_suggestions |
| 51 // is given, then it will be filled with suggested words (not a cheap step). | 50 // is given, then it will be filled with suggested words (not a cheap step). |
| 52 virtual void spellCheck(const WebString& text, | 51 virtual void spellCheck(const WebString& text, |
| 53 int& misspelledOffset, | 52 int& misspelledOffset, |
| 54 int& misspelledLength, | 53 int& misspelledLength, |
| 55 WebVector<WebString>* optionalSuggestions) { } | 54 WebVector<WebString>* optionalSuggestions) { } |
| 56 | 55 |
| 57 // The client should perform spell-checking on the given text. This function
will | |
| 58 // enumerate all misspellings at once. | |
| 59 virtual void checkTextOfParagraph(const WebString&, | |
| 60 WebTextCheckingTypeMask mask, | |
| 61 WebVector<WebTextCheckingResult>* results)
{ } | |
| 62 | |
| 63 // Requests asynchronous spelling and grammar checking, whose result should
be | 56 // Requests asynchronous spelling and grammar checking, whose result should
be |
| 64 // returned by passed completion object. | 57 // returned by passed completion object. |
| 65 virtual void requestCheckingOfText(const WebString& textToCheck, | 58 virtual void requestCheckingOfText(const WebString& textToCheck, |
| 66 const WebVector<uint32_t>& markersInText, | 59 const WebVector<uint32_t>& markersInText, |
| 67 const WebVector<unsigned>& markerOffsets, | 60 const WebVector<unsigned>& markerOffsets, |
| 68 WebTextCheckingCompletion* completionCall
back) { } | 61 WebTextCheckingCompletion* completionCall
back) { } |
| 69 | 62 |
| 70 // Show or hide the spelling UI. | 63 // Show or hide the spelling UI. |
| 71 virtual void showSpellingUI(bool show) { } | 64 virtual void showSpellingUI(bool show) { } |
| 72 | 65 |
| 73 // Returns true if the spelling UI is showing. | 66 // Returns true if the spelling UI is showing. |
| 74 virtual bool isShowingSpellingUI() { return false; } | 67 virtual bool isShowingSpellingUI() { return false; } |
| 75 | 68 |
| 76 // Update the spelling UI with the given word. | 69 // Update the spelling UI with the given word. |
| 77 virtual void updateSpellingUIWithMisspelledWord(const WebString& word) { } | 70 virtual void updateSpellingUIWithMisspelledWord(const WebString& word) { } |
| 78 | 71 |
| 79 protected: | 72 protected: |
| 80 ~WebSpellCheckClient() { } | 73 ~WebSpellCheckClient() { } |
| 81 }; | 74 }; |
| 82 | 75 |
| 83 } // namespace blink | 76 } // namespace blink |
| 84 | 77 |
| 85 #endif | 78 #endif |
| OLD | NEW |