• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
3  * Copyright (C) 2006 Zack Rusin <zack@kde.org>
4  * Copyright (C) 2006 Apple Computer, Inc.
5  * Copyright (C) 2010 Martin Robinson <mrobinson@webkit.org>
6  *
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  *
18  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
19  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
22  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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.
29  */
30 
31 #ifndef TextCheckerClientEnchant_h
32 #define TextCheckerClientEnchant_h
33 
34 #include "TextCheckerClient.h"
35 
36 typedef struct _GSList GSList;
37 typedef struct _WebKitWebView WebKitWebView;
38 typedef struct str_enchant_broker EnchantBroker;
39 
40 namespace WebKit {
41 
42 class TextCheckerClientEnchant : public WebCore::TextCheckerClient {
43     public:
44         TextCheckerClientEnchant(WebKitWebView*);
45         ~TextCheckerClientEnchant();
46         virtual void ignoreWordInSpellDocument(const WTF::String&);
47         virtual void learnWord(const WTF::String&);
48         virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength);
49         virtual WTF::String getAutoCorrectSuggestionForMisspelledWord(const WTF::String&);
50         virtual void checkGrammarOfString(const UChar*, int length, WTF::Vector<WebCore::GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength);
51         virtual void getGuessesForWord(const WTF::String& word, const WTF::String& context, WTF::Vector<WTF::String>& guesses);
requestCheckingOfString(WebCore::SpellChecker *,int,WebCore::TextCheckingTypeMask,const WTF::String &)52         virtual void requestCheckingOfString(WebCore::SpellChecker*, int, WebCore::TextCheckingTypeMask, const WTF::String&) {}
53 
54         void updateSpellCheckingLanguage(const char*);
55         static void freeSpellCheckingLanguage(gpointer, gpointer);
56     private:
57         WebKitWebView* m_webView;
58         GSList* m_enchantDicts;
59         static EnchantBroker* broker;
60     };
61 }
62 #endif
63 
64