2 * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 #ifndef EditorClientWx_h
29 #define EditorClientWx_h
31 #include "EditorClient.h"
33 #include "TextCheckerClient.h"
40 class EditorClientWx : public EditorClient, public TextCheckerClient {
41 friend class ::wxWebView;
42 friend class ::wxWebFrame;
45 virtual ~EditorClientWx();
47 virtual void pageDestroyed();
49 virtual bool shouldDeleteRange(Range*);
50 virtual bool shouldShowDeleteInterface(HTMLElement*);
51 virtual bool smartInsertDeleteEnabled();
52 virtual bool isSelectTrailingWhitespaceEnabled();
53 virtual bool isContinuousSpellCheckingEnabled();
54 virtual void toggleContinuousSpellChecking();
55 virtual bool isGrammarCheckingEnabled();
56 virtual void toggleGrammarChecking();
57 virtual int spellCheckerDocumentTag();
59 virtual bool selectWordBeforeMenuEvent();
61 virtual bool shouldBeginEditing(Range*);
62 virtual bool shouldEndEditing(Range*);
63 virtual bool shouldInsertNode(Node*, Range*,
65 virtual bool shouldInsertText(const String&, Range*,
67 virtual bool shouldApplyStyle(CSSStyleDeclaration*,
69 virtual bool shouldMoveRangeAfterDelete(Range*, Range*);
70 virtual bool shouldChangeSelectedRange(Range* fromRange, Range* toRange,
71 EAffinity, bool stillSelecting);
73 virtual void didBeginEditing();
74 virtual void respondToChangedContents();
75 virtual void respondToChangedSelection();
76 virtual void didEndEditing();
77 virtual void didWriteSelectionToPasteboard();
78 virtual void didSetSelectionTypesForPasteboard();
80 virtual void registerCommandForUndo(PassRefPtr<EditCommand>);
81 virtual void registerCommandForRedo(PassRefPtr<EditCommand>);
82 virtual void clearUndoRedoOperations();
84 virtual bool canCopyCut(Frame*, bool defaultValue) const;
85 virtual bool canPaste(Frame*, bool defaultValue) const;
86 virtual bool canUndo() const;
87 virtual bool canRedo() const;
92 virtual const char* interpretKeyEvent(const KeyboardEvent*);
93 virtual bool handleEditingKeyboardEvent(KeyboardEvent*);
94 virtual void handleKeyboardEvent(KeyboardEvent*);
95 virtual void handleInputMethodKeydown(KeyboardEvent*);
97 virtual void textFieldDidBeginEditing(Element*);
98 virtual void textFieldDidEndEditing(Element*);
99 virtual void textDidChangeInTextField(Element*);
100 virtual bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*);
101 virtual void textWillBeDeletedInTextField(Element*);
102 virtual void textDidChangeInTextArea(Element*);
104 virtual void ignoreWordInSpellDocument(const String&);
105 virtual void learnWord(const String&);
106 virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength);
107 virtual void checkGrammarOfString(const UChar*, int length, Vector<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength);
108 virtual void updateSpellingUIWithGrammarString(const String&, const GrammarDetail& detail);
109 virtual void updateSpellingUIWithMisspelledWord(const String&);
110 virtual void showSpellingUI(bool show);
111 virtual bool spellingUIIsShowing();
112 virtual void getGuessesForWord(const String& word, const String& context, Vector<String>& guesses);
113 virtual String getAutoCorrectSuggestionForMisspelledWord(const WTF::String&);
115 virtual void willSetInputMethodState();
116 virtual void setInputMethodState(bool enabled);
117 virtual void requestCheckingOfString(WebCore::SpellChecker*, int, WebCore::TextCheckingTypeMask, const WTF::String&) {}
118 virtual TextCheckerClient* textChecker() { return this; }
126 #endif // EditorClientWx_h