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) 2008 INdT - Instituto Nokia de Tecnologia
6 * Copyright (C) 2009-2010 ProFUSION embedded systems
7 * Copyright (C) 2009-2010 Samsung Electronics
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
20 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
21 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
28 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 #ifndef EditorClientEfl_h
34 #define EditorClientEfl_h
36 #include "EditorClient.h"
37 #include "TextCheckerClient.h"
39 #include <wtf/Deque.h>
40 #include <wtf/Forward.h>
42 typedef struct _Evas_Object Evas_Object;
47 class EditorClientEfl : public EditorClient, public TextCheckerClient {
50 WTF::Deque<WTF::RefPtr<WebCore::EditCommand> > undoStack;
51 WTF::Deque<WTF::RefPtr<WebCore::EditCommand> > redoStack;
54 EditorClientEfl(Evas_Object *view);
58 virtual void pageDestroyed();
60 virtual bool shouldDeleteRange(Range*);
61 virtual bool shouldShowDeleteInterface(HTMLElement*);
62 virtual bool smartInsertDeleteEnabled();
63 virtual bool isSelectTrailingWhitespaceEnabled();
64 virtual bool isContinuousSpellCheckingEnabled();
65 virtual void toggleContinuousSpellChecking();
66 virtual bool isGrammarCheckingEnabled();
67 virtual void toggleGrammarChecking();
68 virtual int spellCheckerDocumentTag();
70 virtual bool shouldBeginEditing(Range*);
71 virtual bool shouldEndEditing(Range*);
72 virtual bool shouldInsertNode(Node*, Range*, EditorInsertAction);
73 virtual bool shouldInsertText(const String&, Range*, EditorInsertAction);
74 virtual bool shouldChangeSelectedRange(Range* fromRange, Range* toRange, EAffinity, bool stillSelecting);
76 virtual bool shouldApplyStyle(CSSStyleDeclaration*, Range*);
78 virtual bool shouldMoveRangeAfterDelete(Range*, Range*);
80 virtual void didBeginEditing();
81 virtual void respondToChangedContents();
82 virtual void respondToChangedSelection();
83 virtual void didEndEditing();
84 virtual void didWriteSelectionToPasteboard();
85 virtual void didSetSelectionTypesForPasteboard();
87 virtual void registerCommandForUndo(WTF::PassRefPtr<EditCommand>);
88 virtual void registerCommandForRedo(WTF::PassRefPtr<EditCommand>);
89 virtual void clearUndoRedoOperations();
91 virtual bool canCopyCut(Frame*, bool defaultValue) const;
92 virtual bool canPaste(Frame*, bool defaultValue) const;
93 virtual bool canUndo() const;
94 virtual bool canRedo() const;
99 virtual const char* interpretKeyEvent(const KeyboardEvent*);
100 virtual bool handleEditingKeyboardEvent(KeyboardEvent*);
101 virtual void handleKeyboardEvent(KeyboardEvent*);
102 virtual void handleInputMethodKeydown(KeyboardEvent*);
104 virtual void textFieldDidBeginEditing(Element*);
105 virtual void textFieldDidEndEditing(Element*);
106 virtual void textDidChangeInTextField(Element*);
107 virtual bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*);
108 virtual void textWillBeDeletedInTextField(Element*);
109 virtual void textDidChangeInTextArea(Element*);
111 virtual void ignoreWordInSpellDocument(const String&);
112 virtual void learnWord(const String&);
113 virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength);
114 virtual String getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord);
115 virtual void checkGrammarOfString(const UChar*, int length, WTF::Vector<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength);
116 virtual void updateSpellingUIWithGrammarString(const String&, const GrammarDetail&);
117 virtual void updateSpellingUIWithMisspelledWord(const String&);
118 virtual void showSpellingUI(bool show);
119 virtual bool spellingUIIsShowing();
120 virtual void getGuessesForWord(const String& word, const String& context, WTF::Vector<String>& guesses);
121 virtual void willSetInputMethodState();
122 virtual void setInputMethodState(bool enabled);
123 virtual void requestCheckingOfString(WebCore::SpellChecker*, int, WebCore::TextCheckingTypeMask, const WTF::String&) { }
124 virtual TextCheckerClient* textChecker() { return this; }
131 #endif // EditorClientEfl_h