• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2007 Apple Inc.  All rights reserved.
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  *
8  * 1.  Redistributions of source code must retain the above copyright
9  *     notice, this list of conditions and the following disclaimer.
10  * 2.  Redistributions in binary form must reproduce the above copyright
11  *     notice, this list of conditions and the following disclaimer in the
12  *     documentation and/or other materials provided with the distribution.
13  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
14  *     its contributors may be used to endorse or promote products derived
15  *     from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef EditingDelegate_h
30 #define EditingDelegate_h
31 
32 #include <WebKit/WebKit.h>
33 
34 class __declspec(uuid("265DCD4B-79C3-44a2-84BC-511C3EDABD6F")) EditingDelegate : public IWebEditingDelegate {
35 public:
36     EditingDelegate();
37 
setAcceptsEditing(bool b)38     void setAcceptsEditing(bool b) { m_acceptsEditing = b; }
39 
40     // IUnknown
41     virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
42     virtual ULONG STDMETHODCALLTYPE AddRef(void);
43     virtual ULONG STDMETHODCALLTYPE Release(void);
44 
45     // IWebEditingDelegate
46     virtual HRESULT STDMETHODCALLTYPE shouldBeginEditingInDOMRange(
47         /* [in] */ IWebView *webView,
48         /* [in] */ IDOMRange *range,
49         /* [retval][out] */ BOOL *result);
50 
51     virtual HRESULT STDMETHODCALLTYPE shouldEndEditingInDOMRange(
52         /* [in] */ IWebView *webView,
53         /* [in] */ IDOMRange *range,
54         /* [retval][out] */ BOOL *result);
55 
56     virtual HRESULT STDMETHODCALLTYPE shouldInsertNode(
57         /* [in] */ IWebView *webView,
58         /* [in] */ IDOMNode *node,
59         /* [in] */ IDOMRange *range,
60         /* [in] */ WebViewInsertAction action);
61 
62     virtual HRESULT STDMETHODCALLTYPE shouldInsertText(
63         /* [in] */ IWebView *webView,
64         /* [in] */ BSTR text,
65         /* [in] */ IDOMRange *range,
66         /* [in] */ WebViewInsertAction action,
67         /* [retval][out] */ BOOL *result);
68 
69     virtual HRESULT STDMETHODCALLTYPE shouldDeleteDOMRange(
70         /* [in] */ IWebView *webView,
71         /* [in] */ IDOMRange *range,
72         /* [retval][out] */ BOOL *result);
73 
74     virtual HRESULT STDMETHODCALLTYPE shouldChangeSelectedDOMRange(
75         /* [in] */ IWebView *webView,
76         /* [in] */ IDOMRange *currentRange,
77         /* [in] */ IDOMRange *proposedRange,
78         /* [in] */ WebSelectionAffinity selectionAffinity,
79         /* [in] */ BOOL stillSelecting,
80         /* [retval][out] */ BOOL *result);
81 
82     virtual HRESULT STDMETHODCALLTYPE shouldApplyStyle(
83         /* [in] */ IWebView *webView,
84         /* [in] */ IDOMCSSStyleDeclaration *style,
85         /* [in] */ IDOMRange *range,
86         /* [retval][out] */ BOOL *result);
87 
88     virtual HRESULT STDMETHODCALLTYPE shouldChangeTypingStyle(
89         /* [in] */ IWebView *webView,
90         /* [in] */ IDOMCSSStyleDeclaration *currentStyle,
91         /* [in] */ IDOMCSSStyleDeclaration *proposedStyle,
92         /* [retval][out] */ BOOL *result);
93 
94     virtual HRESULT STDMETHODCALLTYPE doPlatformCommand(
95         /* [in] */ IWebView *webView,
96         /* [in] */ BSTR command,
97         /* [retval][out] */ BOOL *result);
98 
99     virtual HRESULT STDMETHODCALLTYPE webViewDidBeginEditing(
100         /* [in] */ IWebNotification *notification);
101 
102     virtual HRESULT STDMETHODCALLTYPE webViewDidChange(
103         /* [in] */ IWebNotification *notification);
104 
105     virtual HRESULT STDMETHODCALLTYPE webViewDidEndEditing(
106         /* [in] */ IWebNotification *notification);
107 
108     virtual HRESULT STDMETHODCALLTYPE webViewDidChangeTypingStyle(
109         /* [in] */ IWebNotification *notification);
110 
111     virtual HRESULT STDMETHODCALLTYPE webViewDidChangeSelection(
112         /* [in] */ IWebNotification *notification);
113 
undoManagerForWebView(IWebView * webView,IWebUndoManager ** undoManager)114     virtual HRESULT STDMETHODCALLTYPE undoManagerForWebView(
115         /* [in] */ IWebView *webView,
116         /* [retval][out] */ IWebUndoManager **undoManager) { return E_NOTIMPL; }
117 
ignoreWordInSpellDocument(IWebView * view,BSTR word)118         virtual HRESULT STDMETHODCALLTYPE ignoreWordInSpellDocument(
119             /* [in] */ IWebView *view,
120             /* [in] */ BSTR word) { return E_NOTIMPL; }
121 
learnWord(BSTR word)122         virtual HRESULT STDMETHODCALLTYPE learnWord(
123             /* [in] */ BSTR word) { return E_NOTIMPL; }
124 
checkSpellingOfString(IWebView * view,LPCTSTR text,int length,int * misspellingLocation,int * misspellingLength)125         virtual HRESULT STDMETHODCALLTYPE checkSpellingOfString(
126             /* [in] */ IWebView *view,
127             /* [in] */ LPCTSTR text,
128             /* [in] */ int length,
129             /* [out] */ int *misspellingLocation,
130             /* [out] */ int *misspellingLength) { return E_NOTIMPL; }
131 
checkGrammarOfString(IWebView * view,LPCTSTR text,int length,IEnumWebGrammarDetails ** grammarDetails,int * badGrammarLocation,int * badGrammarLength)132         virtual HRESULT STDMETHODCALLTYPE checkGrammarOfString(
133             /* [in] */ IWebView *view,
134             /* [in] */ LPCTSTR text,
135             /* [in] */ int length,
136             /* [out] */ IEnumWebGrammarDetails **grammarDetails,
137             /* [out] */ int *badGrammarLocation,
138             /* [out] */ int *badGrammarLength) { return E_NOTIMPL; }
139 
updateSpellingUIWithGrammarString(BSTR string,int location,int length,BSTR userDescription,BSTR * guesses,int guessesCount)140         virtual HRESULT STDMETHODCALLTYPE updateSpellingUIWithGrammarString(
141             /* [in] */ BSTR string,
142             /* [in] */ int location,
143             /* [in] */ int length,
144             /* [in] */ BSTR userDescription,
145             /* [in] */ BSTR *guesses,
146             /* [in] */ int guessesCount) { return E_NOTIMPL; }
147 
updateSpellingUIWithMisspelledWord(BSTR word)148         virtual HRESULT STDMETHODCALLTYPE updateSpellingUIWithMisspelledWord(
149             /* [in] */ BSTR word) { return E_NOTIMPL; }
150 
showSpellingUI(BOOL show)151         virtual HRESULT STDMETHODCALLTYPE showSpellingUI(
152             /* [in] */ BOOL show) { return E_NOTIMPL; }
153 
spellingUIIsShowing(BOOL * result)154         virtual HRESULT STDMETHODCALLTYPE spellingUIIsShowing(
155             /* [retval][out] */ BOOL *result) { return E_NOTIMPL; }
156 
guessesForWord(BSTR word,IEnumSpellingGuesses ** guesses)157         virtual HRESULT STDMETHODCALLTYPE guessesForWord(
158             /* [in] */ BSTR word,
159             /* [retval][out] */ IEnumSpellingGuesses **guesses) { return E_NOTIMPL; }
160 
closeSpellDocument(IWebView * view)161         virtual HRESULT STDMETHODCALLTYPE closeSpellDocument(
162             /* [in] */ IWebView *view) { return E_NOTIMPL; }
163 
sharedSpellCheckerExists(BOOL * exists)164         virtual HRESULT STDMETHODCALLTYPE sharedSpellCheckerExists(
165             /* [retval][out] */ BOOL *exists) { return E_NOTIMPL; }
166 
preflightChosenSpellServer(void)167         virtual HRESULT STDMETHODCALLTYPE preflightChosenSpellServer( void) { return E_NOTIMPL; }
168 
updateGrammar(void)169         virtual HRESULT STDMETHODCALLTYPE updateGrammar( void) { return E_NOTIMPL; }
170 
171 private:
172     bool m_acceptsEditing;
173     ULONG m_refCount;
174 };
175 
176 #endif // !defined(EditingDelegate_h)
177