initial import
[vuplus_webkit] / Source / WebKit / wince / WebCoreSupport / EditorClientWinCE.h
1 /*
2  * Copyright (C) 2010 Patrick Gansterer <paroga@paroga.com>
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 AND ITS CONTRIBUTORS "AS IS" AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
17  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  */
24
25 #ifndef EditorClientWinCE_h
26 #define EditorClientWinCE_h
27
28 #include "EditorClient.h"
29 #include "TextCheckerClient.h"
30
31 class WebView;
32
33 namespace WebKit {
34
35 class EditorClientWinCE : public WebCore::EditorClient, public WebCore::TextCheckerClient {
36 public:
37     EditorClientWinCE(WebView*);
38     ~EditorClientWinCE();
39
40     virtual void pageDestroyed();
41
42     virtual bool shouldDeleteRange(WebCore::Range*);
43     virtual bool shouldShowDeleteInterface(WebCore::HTMLElement*);
44     virtual bool smartInsertDeleteEnabled();
45     virtual bool isSelectTrailingWhitespaceEnabled();
46     virtual bool isContinuousSpellCheckingEnabled();
47     virtual void toggleContinuousSpellChecking();
48     virtual bool isGrammarCheckingEnabled();
49     virtual void toggleGrammarChecking();
50     virtual int spellCheckerDocumentTag();
51
52     virtual bool shouldBeginEditing(WebCore::Range*);
53     virtual bool shouldEndEditing(WebCore::Range*);
54     virtual bool shouldInsertNode(WebCore::Node*, WebCore::Range*, WebCore::EditorInsertAction);
55     virtual bool shouldInsertText(const WTF::String&, WebCore::Range*, WebCore::EditorInsertAction);
56     virtual bool shouldChangeSelectedRange(WebCore::Range*, WebCore::Range*, WebCore::EAffinity, bool);
57
58     virtual bool shouldApplyStyle(WebCore::CSSStyleDeclaration*, WebCore::Range*);
59     virtual bool shouldMoveRangeAfterDelete(WebCore::Range*, WebCore::Range*);
60
61     virtual void didBeginEditing();
62     virtual void respondToChangedContents();
63     virtual void respondToChangedSelection();
64     virtual void didEndEditing();
65     virtual void didWriteSelectionToPasteboard();
66     virtual void didSetSelectionTypesForPasteboard();
67
68     virtual void registerCommandForUndo(WTF::PassRefPtr<WebCore::EditCommand>);
69     virtual void registerCommandForRedo(WTF::PassRefPtr<WebCore::EditCommand>);
70     virtual void clearUndoRedoOperations();
71
72     virtual bool canCopyCut(WebCore::Frame*, bool defaultValue) const;
73     virtual bool canPaste(WebCore::Frame*, bool defaultValue) const;
74     virtual bool canUndo() const;
75     virtual bool canRedo() const;
76
77     virtual void undo();
78     virtual void redo();
79
80     virtual const char* interpretKeyEvent(const WebCore::KeyboardEvent*);
81     virtual bool handleEditingKeyboardEvent(WebCore::KeyboardEvent*);
82     virtual void handleKeyboardEvent(WebCore::KeyboardEvent*);
83     virtual void handleInputMethodKeydown(WebCore::KeyboardEvent*);
84
85     virtual void textFieldDidBeginEditing(WebCore::Element*);
86     virtual void textFieldDidEndEditing(WebCore::Element*);
87     virtual void textDidChangeInTextField(WebCore::Element*);
88     virtual bool doTextFieldCommandFromEvent(WebCore::Element*, WebCore::KeyboardEvent*);
89     virtual void textWillBeDeletedInTextField(WebCore::Element*);
90     virtual void textDidChangeInTextArea(WebCore::Element*);
91
92     virtual void ignoreWordInSpellDocument(const WTF::String&);
93     virtual void learnWord(const WTF::String&);
94     virtual void checkSpellingOfString(const UChar*, int, int*, int*);
95     virtual WTF::String getAutoCorrectSuggestionForMisspelledWord(const WTF::String&);
96     virtual void checkGrammarOfString(const UChar*, int, WTF::Vector<WebCore::GrammarDetail>&, int*, int*);
97     virtual void updateSpellingUIWithGrammarString(const WTF::String&, const WebCore::GrammarDetail&);
98     virtual void updateSpellingUIWithMisspelledWord(const WTF::String&);
99     virtual void showSpellingUI(bool);
100     virtual bool spellingUIIsShowing();
101     virtual void getGuessesForWord(const WTF::String& word, const WTF::String& context, WTF::Vector<WTF::String>& guesses);
102     virtual void willSetInputMethodState();
103     virtual void setInputMethodState(bool);
104     virtual void requestCheckingOfString(WebCore::SpellChecker*, int, WebCore::TextCheckingTypeMask, const WTF::String&) {}
105     virtual WebCore::TextCheckerClient* textChecker() { return this; }
106
107 private:
108     WebView* m_webView;
109 };
110
111 } // namespace WebKit
112
113 #endif // EditorClientWinCE_h