12daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch/*
22daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * Copyright (C) 2011 Apple Inc. All rights reserved.
32daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch *
42daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * Redistribution and use in source and binary forms, with or without
52daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * modification, are permitted provided that the following conditions
62daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * are met:
72daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * 1. Redistributions of source code must retain the above copyright
82daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch *    notice, this list of conditions and the following disclaimer.
92daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * 2. Redistributions in binary form must reproduce the above copyright
102daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch *    notice, this list of conditions and the following disclaimer in the
112daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch *    documentation and/or other materials provided with the distribution.
122daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch *
132daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
142daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
152daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
162daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
172daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
182daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
192daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
202daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
212daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
222daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
232daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch * THE POSSIBILITY OF SUCH DAMAGE.
242daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch */
252daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch
262daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#ifndef WebTextCheckerClient_h
272daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#define WebTextCheckerClient_h
282daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch
292daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#include "APIClient.h"
302daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#include "WKTextChecker.h"
312daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#include <WebCore/TextCheckerClient.h>
322daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#include <wtf/Forward.h>
332daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#include <wtf/Vector.h>
342daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch
352daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochnamespace WebKit {
362daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch
372daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochclass WebPageProxy;
382daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch
392daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochclass WebTextCheckerClient : public APIClient<WKTextCheckerClient> {
402daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdochpublic:
412daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    bool continuousSpellCheckingAllowed();
422daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    bool continuousSpellCheckingEnabled();
432daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    void setContinuousSpellCheckingEnabled(bool);
442daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    bool grammarCheckingEnabled();
452daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    void setGrammarCheckingEnabled(bool);
462daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    uint64_t uniqueSpellDocumentTag(WebPageProxy*);
472daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    void closeSpellDocumentWithTag(uint64_t);
482daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    void checkSpellingOfString(uint64_t tag, const String& text, int32_t& misspellingLocation, int32_t& misspellingLength);
492daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    void checkGrammarOfString(uint64_t tag, const String& text, Vector<WebCore::GrammarDetail>&, int32_t& badGrammarLocation, int32_t& badGrammarLength);
502daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    bool spellingUIIsShowing();
512daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    void toggleSpellingUIIsShowing();
522daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    void updateSpellingUIWithMisspelledWord(uint64_t tag, const String& misspelledWord);
532daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    void updateSpellingUIWithGrammarString(uint64_t tag, const String& badGrammarPhrase, const WebCore::GrammarDetail&);
542daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    void guessesForWord(uint64_t tag, const String& word, Vector<String>& guesses);
552daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    void learnWord(uint64_t tag, const String& word);
562daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch    void ignoreWord(uint64_t tag, const String& word);
572daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch};
582daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch
592daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch} // namespace WebKit
602daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch
612daae5fd11344eaa88a0d92b0f6d65f8d2255c00Ben Murdoch#endif // WebTextCheckerClient_h
62