1/*
2 * Copyright (C) 2006, 2007, 2008 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 * 1. Redistributions of source code must retain the above copyright
8 *    notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 *    notice, this list of conditions and the following disclaimer in the
11 *    documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#ifndef DO_NO_IMPORTS
27import "oaidl.idl";
28import "ocidl.idl";
29import "IWebNotification.idl";
30import "DOMCore.idl";
31import "DOMCSS.idl";
32import "DOMRange.idl";
33import "IWebUndoManager.idl";
34import "IWebView.idl";
35#endif
36
37interface IDOMCSSStyleDeclaration;
38interface IDOMNode;
39interface IDOMRange;
40interface IWebView;
41interface IWebNotification;
42interface IWebUndoManager;
43
44typedef enum _WebViewInsertAction {
45    WebViewInsertActionTyped,
46    WebViewInsertActionPasted,
47    WebViewInsertActionDropped,
48} WebViewInsertAction;
49
50[
51    object,
52    oleautomation,
53    uuid(B0F960E7-FB81-447f-A958-E02DA02ADBB7),
54    pointer_default(unique)
55]
56interface IEnumSpellingGuesses : IUnknown
57{
58    HRESULT Next(ULONG celt, [out] BSTR* guess, [out] ULONG* pceltFetched);
59    HRESULT Skip(ULONG celt);
60    HRESULT Reset(void);
61    HRESULT Clone([out, retval] IEnumSpellingGuesses** ppenum);
62};
63
64[
65    object,
66    oleautomation,
67    uuid(8B95C1B3-E1B3-4f97-80D6-2240417E3E0C),
68    pointer_default(unique)
69]
70interface IWebGrammarDetail : IUnknown
71{
72    HRESULT location([out, retval] int* value);
73    HRESULT length([out, retval] int* value);
74    HRESULT userDescription([out, retval] BSTR* value);
75    HRESULT guesses([out, retval] IEnumSpellingGuesses** guesses);
76}
77
78[
79    object,
80    oleautomation,
81    uuid(FABCC69A-5917-4242-A19A-42E8B62227A7),
82    pointer_default(unique)
83]
84interface IEnumWebGrammarDetails : IUnknown
85{
86    HRESULT Next(ULONG celt, [out] IWebGrammarDetail** detail, [out] ULONG* pceltFetched);
87    HRESULT Skip(ULONG celt);
88    HRESULT Reset(void);
89    HRESULT Clone([out, retval] IEnumSpellingGuesses** ppenum);
90};
91
92/*
93    @interface NSObject (WebViewEditingDelegate)
94*/
95[
96    object,
97    oleautomation,
98    uuid(2C75A1E3-EE9D-45c8-A385-19DE68AC5675),
99    pointer_default(unique)
100]
101interface IWebEditingDelegate : IUnknown
102{
103    /*
104        - (BOOL)webView:(WebView *)webView shouldBeginEditingInDOMRange:(DOMRange *)range;
105    */
106    HRESULT shouldBeginEditingInDOMRange([in] IWebView* webView, [in] IDOMRange* range, [out, retval] BOOL* result);
107
108    /*
109        - (BOOL)webView:(WebView *)webView shouldEndEditingInDOMRange:(DOMRange *)range;
110    */
111    HRESULT shouldEndEditingInDOMRange([in] IWebView* webView, [in] IDOMRange* range, [out, retval] BOOL* result);
112
113    /*
114        - (BOOL)webView:(WebView *)webView shouldInsertNode:(DOMNode *)node replacingDOMRange:(DOMRange *)range givenAction:(WebViewInsertAction)action;
115    */
116    HRESULT shouldInsertNode([in] IWebView* webView, [in] IDOMNode* node, [in] IDOMRange* range, [in] WebViewInsertAction action);
117
118    /*
119        - (BOOL)webView:(WebView *)webView shouldInsertText:(NSString *)text replacingDOMRange:(DOMRange *)range givenAction:(WebViewInsertAction)action;
120    */
121    HRESULT shouldInsertText([in] IWebView* webView, [in] BSTR text, [in] IDOMRange* range, [in] WebViewInsertAction action, [out, retval] BOOL* result);
122
123    /*
124        - (BOOL)webView:(WebView *)webView shouldDeleteDOMRange:(DOMRange *)range;
125    */
126    HRESULT shouldDeleteDOMRange([in] IWebView* webView, [in] IDOMRange* range, [out, retval] BOOL* result);
127
128    /*
129        - (BOOL)webView:(WebView *)webView shouldChangeSelectedDOMRange:(DOMRange *)currentRange toDOMRange:(DOMRange *)proposedRange affinity:(NSSelectionAffinity)selectionAffinity stillSelecting:(BOOL)flag;
130    */
131    HRESULT shouldChangeSelectedDOMRange([in] IWebView* webView, [in] IDOMRange* currentRange, [in] IDOMRange* proposedRange, [in] WebSelectionAffinity selectionAffinity, [in] BOOL stillSelecting, [out, retval] BOOL* result);
132    /*
133        - (BOOL)webView:(WebView *)webView shouldApplyStyle:(DOMCSSStyleDeclaration *)style toElementsInDOMRange:(DOMRange *)range;
134    */
135    HRESULT shouldApplyStyle([in] IWebView* webView, [in] IDOMCSSStyleDeclaration* style, [in] IDOMRange* range, [out, retval] BOOL* result);
136
137    /*
138        - (BOOL)webView:(WebView *)webView shouldChangeTypingStyle:(DOMCSSStyleDeclaration *)currentStyle toStyle:(DOMCSSStyleDeclaration *)proposedStyle;
139    */
140    HRESULT shouldChangeTypingStyle([in] IWebView* webView, [in] IDOMCSSStyleDeclaration* currentStyle, [in] IDOMCSSStyleDeclaration* proposedStyle, [out, retval] BOOL* result);
141
142    /*
143        - (BOOL)webView:(WebView *)webView doCommandBySelector:(SEL)selector;
144    */
145    HRESULT doPlatformCommand([in] IWebView* webView, [in] BSTR command, [out, retval] BOOL* result);
146
147    /*
148        - (void)webViewDidBeginEditing:(NSNotification *)notification;
149    */
150    HRESULT webViewDidBeginEditing([in] IWebNotification* notification);
151
152    /*
153        - (void)webViewDidChange:(NSNotification *)notification;
154    */
155    HRESULT webViewDidChange([in] IWebNotification* notification);
156
157    /*
158        - (void)webViewDidEndEditing:(NSNotification *)notification;
159    */
160    HRESULT webViewDidEndEditing([in] IWebNotification* notification);
161
162    /*
163        - (void)webViewDidChangeTypingStyle:(NSNotification *)notification;
164    */
165    HRESULT webViewDidChangeTypingStyle([in] IWebNotification* notification);
166
167    /*
168        - (void)webViewDidChangeSelection:(NSNotification *)notification;
169    */
170    HRESULT webViewDidChangeSelection([in] IWebNotification* notification);
171
172    /*
173        - (NSUndoManager *)undoManagerForWebView:(WebView *)webView;
174    */
175    HRESULT undoManagerForWebView([in] IWebView* webView, [out, retval] IWebUndoManager** undoManager);
176
177    HRESULT ignoreWordInSpellDocument([in] IWebView* view, [in] BSTR word);
178    HRESULT learnWord([in] BSTR word);
179    HRESULT checkSpellingOfString([in] IWebView* view, [in] LPCTSTR text, [in] int length, [out] int* misspellingLocation, [out] int* misspellingLength);
180    HRESULT checkGrammarOfString([in] IWebView* view, [in] LPCTSTR text, [in] int length, [out] IEnumWebGrammarDetails** grammarDetails, [out] int* badGrammarLocation, [out] int* badGrammarLength);
181    HRESULT updateSpellingUIWithGrammarString([in] BSTR string, [in] int location, [in] int length, [in] BSTR userDescription, [in] BSTR* guesses, [in] int guessesCount);
182    HRESULT updateSpellingUIWithMisspelledWord([in] BSTR word);
183    HRESULT showSpellingUI([in] BOOL show);
184    HRESULT spellingUIIsShowing([out, retval] BOOL* result);
185    HRESULT guessesForWord([in] BSTR word, [out, retval] IEnumSpellingGuesses** guesses);
186    HRESULT closeSpellDocument([in] IWebView* view);
187    HRESULT sharedSpellCheckerExists([out, retval] BOOL* exists);
188    HRESULT preflightChosenSpellServer();
189    HRESULT updateGrammar();
190}
191