| 1 | /* |
|---|
| 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 | * |
|---|
| 6 | * All rights reserved. |
|---|
| 7 | * |
|---|
| 8 | * Redistribution and use in source and binary forms, with or without |
|---|
| 9 | * modification, are permitted provided that the following conditions |
|---|
| 10 | * are met: |
|---|
| 11 | * 1. Redistributions of source code must retain the above copyright |
|---|
| 12 | * notice, this list of conditions and the following disclaimer. |
|---|
| 13 | * 2. Redistributions in binary form must reproduce the above copyright |
|---|
| 14 | * notice, this list of conditions and the following disclaimer in the |
|---|
| 15 | * documentation and/or other materials provided with the distribution. |
|---|
| 16 | * |
|---|
| 17 | * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
|---|
| 18 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
|---|
| 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
|---|
| 20 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
|---|
| 21 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
|---|
| 22 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
|---|
| 23 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
|---|
| 24 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
|---|
| 25 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|---|
| 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|---|
| 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|---|
| 28 | */ |
|---|
| 29 | |
|---|
| 30 | #ifndef EditorClientGtk_h |
|---|
| 31 | #define EditorClientGtk_h |
|---|
| 32 | |
|---|
| 33 | #include "EditorClient.h" |
|---|
| 34 | |
|---|
| 35 | #include <wtf/Forward.h> |
|---|
| 36 | |
|---|
| 37 | typedef struct _WebKitWebView WebKitWebView; |
|---|
| 38 | |
|---|
| 39 | namespace WebCore { |
|---|
| 40 | class Page; |
|---|
| 41 | } |
|---|
| 42 | |
|---|
| 43 | namespace WebKit { |
|---|
| 44 | |
|---|
| 45 | class EditorClient : public WebCore::EditorClient { |
|---|
| 46 | public: |
|---|
| 47 | EditorClient(WebKitWebView*); |
|---|
| 48 | ~EditorClient(); |
|---|
| 49 | |
|---|
| 50 | // from EditorClient |
|---|
| 51 | virtual void pageDestroyed(); |
|---|
| 52 | |
|---|
| 53 | virtual bool shouldDeleteRange(WebCore::Range*); |
|---|
| 54 | virtual bool shouldShowDeleteInterface(WebCore::HTMLElement*); |
|---|
| 55 | virtual bool smartInsertDeleteEnabled(); |
|---|
| 56 | virtual bool isContinuousSpellCheckingEnabled(); |
|---|
| 57 | virtual void toggleContinuousSpellChecking(); |
|---|
| 58 | virtual bool isGrammarCheckingEnabled(); |
|---|
| 59 | virtual void toggleGrammarChecking(); |
|---|
| 60 | virtual int spellCheckerDocumentTag(); |
|---|
| 61 | |
|---|
| 62 | virtual bool isEditable(); |
|---|
| 63 | |
|---|
| 64 | virtual bool shouldBeginEditing(WebCore::Range*); |
|---|
| 65 | virtual bool shouldEndEditing(WebCore::Range*); |
|---|
| 66 | virtual bool shouldInsertNode(WebCore::Node*, WebCore::Range*, WebCore::EditorInsertAction); |
|---|
| 67 | virtual bool shouldInsertText(const WebCore::String&, WebCore::Range*, WebCore::EditorInsertAction); |
|---|
| 68 | virtual bool shouldChangeSelectedRange(WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity, bool stillSelecting); |
|---|
| 69 | |
|---|
| 70 | virtual bool shouldApplyStyle(WebCore::CSSStyleDeclaration*, WebCore::Range*); |
|---|
| 71 | |
|---|
| 72 | virtual bool shouldMoveRangeAfterDelete(WebCore::Range*, WebCore::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<WebCore::EditCommand>); |
|---|
| 82 | virtual void registerCommandForRedo(WTF::PassRefPtr<WebCore::EditCommand>); |
|---|
| 83 | virtual void clearUndoRedoOperations(); |
|---|
| 84 | |
|---|
| 85 | virtual bool canUndo() const; |
|---|
| 86 | virtual bool canRedo() const; |
|---|
| 87 | |
|---|
| 88 | virtual void undo(); |
|---|
| 89 | virtual void redo(); |
|---|
| 90 | |
|---|
| 91 | virtual void handleKeyboardEvent(WebCore::KeyboardEvent*); |
|---|
| 92 | virtual void handleInputMethodKeydown(WebCore::KeyboardEvent*); |
|---|
| 93 | |
|---|
| 94 | virtual void textFieldDidBeginEditing(WebCore::Element*); |
|---|
| 95 | virtual void textFieldDidEndEditing(WebCore::Element*); |
|---|
| 96 | virtual void textDidChangeInTextField(WebCore::Element*); |
|---|
| 97 | virtual bool doTextFieldCommandFromEvent(WebCore::Element*, WebCore::KeyboardEvent*); |
|---|
| 98 | virtual void textWillBeDeletedInTextField(WebCore::Element*); |
|---|
| 99 | virtual void textDidChangeInTextArea(WebCore::Element*); |
|---|
| 100 | |
|---|
| 101 | virtual void ignoreWordInSpellDocument(const WebCore::String&); |
|---|
| 102 | virtual void learnWord(const WebCore::String&); |
|---|
| 103 | virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength); |
|---|
| 104 | virtual void checkGrammarOfString(const UChar*, int length, WTF::Vector<WebCore::GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength); |
|---|
| 105 | virtual void updateSpellingUIWithGrammarString(const WebCore::String&, const WebCore::GrammarDetail&); |
|---|
| 106 | virtual void updateSpellingUIWithMisspelledWord(const WebCore::String&); |
|---|
| 107 | virtual void showSpellingUI(bool show); |
|---|
| 108 | virtual bool spellingUIIsShowing(); |
|---|
| 109 | virtual void getGuessesForWord(const WebCore::String&, WTF::Vector<WebCore::String>& guesses); |
|---|
| 110 | virtual void setInputMethodState(bool enabled); |
|---|
| 111 | |
|---|
| 112 | WebKitWebView* m_webView; |
|---|
| 113 | }; |
|---|
| 114 | } |
|---|
| 115 | |
|---|
| 116 | #endif |
|---|
| 117 | |
|---|
| 118 | // vim: ts=4 sw=4 et |
|---|