Home | History | Annotate | Download | only in WebCoreSupport
      1 /*
      2  * Copyright (C) 2006 Nikolas Zimmermann <zimmermann (at) kde.org>
      3  * Copyright (C) 2006 Zack Rusin <zack (at) 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
      8  *
      9  * All rights reserved.
     10  *
     11  * Redistribution and use in source and binary forms, with or without
     12  * modification, are permitted provided that the following conditions
     13  * are met:
     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.
     19  *
     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.
     31  */
     32 
     33 #ifndef EditorClientEfl_h
     34 #define EditorClientEfl_h
     35 
     36 #include "EditorClient.h"
     37 #include "TextCheckerClient.h"
     38 
     39 #include <wtf/Forward.h>
     40 
     41 typedef struct _Evas_Object Evas_Object;
     42 
     43 namespace WebCore {
     44 class Page;
     45 
     46 class EditorClientEfl : public EditorClient, public TextCheckerClient {
     47 public:
     48     EditorClientEfl(Evas_Object *view);
     49     ~EditorClientEfl();
     50 
     51     // from EditorClient
     52     virtual void pageDestroyed();
     53 
     54     virtual bool shouldDeleteRange(Range*);
     55     virtual bool shouldShowDeleteInterface(HTMLElement*);
     56     virtual bool smartInsertDeleteEnabled();
     57     virtual bool isSelectTrailingWhitespaceEnabled();
     58     virtual bool isContinuousSpellCheckingEnabled();
     59     virtual void toggleContinuousSpellChecking();
     60     virtual bool isGrammarCheckingEnabled();
     61     virtual void toggleGrammarChecking();
     62     virtual int spellCheckerDocumentTag();
     63 
     64     virtual bool shouldBeginEditing(Range*);
     65     virtual bool shouldEndEditing(Range*);
     66     virtual bool shouldInsertNode(Node*, Range*, EditorInsertAction);
     67     virtual bool shouldInsertText(const String&, Range*, EditorInsertAction);
     68     virtual bool shouldChangeSelectedRange(Range* fromRange, Range* toRange, EAffinity, bool stillSelecting);
     69 
     70     virtual bool shouldApplyStyle(CSSStyleDeclaration*, Range*);
     71 
     72     virtual bool shouldMoveRangeAfterDelete(Range*, Range*);
     73 
     74     virtual void didBeginEditing();
     75     virtual void respondToChangedContents();
     76     virtual void respondToChangedSelection();
     77     virtual void didEndEditing();
     78     virtual void didWriteSelectionToPasteboard();
     79     virtual void didSetSelectionTypesForPasteboard();
     80 
     81     virtual void registerCommandForUndo(WTF::PassRefPtr<EditCommand>);
     82     virtual void registerCommandForRedo(WTF::PassRefPtr<EditCommand>);
     83     virtual void clearUndoRedoOperations();
     84 
     85     virtual bool canCopyCut(bool defaultValue) const;
     86     virtual bool canPaste(bool defaultValue) const;
     87     virtual bool canUndo() const;
     88     virtual bool canRedo() const;
     89 
     90     virtual void undo();
     91     virtual void redo();
     92 
     93     virtual const char* interpretKeyEvent(const KeyboardEvent* event);
     94     virtual bool handleEditingKeyboardEvent(KeyboardEvent*);
     95     virtual void handleKeyboardEvent(KeyboardEvent*);
     96     virtual void handleInputMethodKeydown(KeyboardEvent*);
     97 
     98     virtual void textFieldDidBeginEditing(Element*);
     99     virtual void textFieldDidEndEditing(Element*);
    100     virtual void textDidChangeInTextField(Element*);
    101     virtual bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*);
    102     virtual void textWillBeDeletedInTextField(Element*);
    103     virtual void textDidChangeInTextArea(Element*);
    104 
    105     virtual void ignoreWordInSpellDocument(const String&);
    106     virtual void learnWord(const String&);
    107     virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength);
    108     virtual String getAutoCorrectSuggestionForMisspelledWord(const String& misspelledWord);
    109     virtual void checkGrammarOfString(const UChar*, int length, WTF::Vector<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength);
    110     virtual void updateSpellingUIWithGrammarString(const String&, const GrammarDetail&);
    111     virtual void updateSpellingUIWithMisspelledWord(const String&);
    112     virtual void showSpellingUI(bool show);
    113     virtual bool spellingUIIsShowing();
    114     virtual void getGuessesForWord(const String& word, const String& context, WTF::Vector<String>& guesses);
    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; }
    119 
    120 private:
    121     Evas_Object *m_view;
    122 };
    123 }
    124 
    125 #endif // EditorClientEfl_h
    126