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
26cpp_quote("/* identifiers for commands that can be called by the webview's frame */")
27cpp_quote("enum WebViewCmd { Cut = 100, Copy, Paste, ForwardDelete, SelectAll, Undo, Redo };")
28
29cpp_quote("#define WebViewProgressStartedNotification TEXT(\"WebProgressStartedNotification\")")
30cpp_quote("#define WebViewProgressEstimateChangedNotification TEXT(\"WebProgressEstimateChangedNotification\")")
31cpp_quote("#define WebViewProgressFinishedNotification TEXT(\"WebProgressFinishedNotification\")")
32cpp_quote("#define WebViewDidChangeSelectionNotification TEXT(\"WebViewDidChangeSelectionNotification\")")
33
34#ifndef DO_NO_IMPORTS
35import "oaidl.idl";
36import "ocidl.idl";
37import "IWebUIDelegate.idl";
38import "IWebURLResponse.idl";
39import "IWebResourceLoadDelegate.idl";
40import "IWebDownload.idl";
41import "IWebFrameLoadDelegate.idl";
42import "IWebPolicyDelegate.idl";
43import "IWebBackForwardList.idl";
44import "IWebHistoryItem.idl";
45import "IWebPreferences.idl";
46import "DOMCSS.idl";
47import "IWebUndoManager.idl";
48import "IWebEditingDelegate.idl";
49import "DOMRange.idl";
50#endif
51
52interface IDOMCSSStyleDeclaration;
53interface IDOMDocument;
54interface IDOMElement;
55interface IDOMNode;
56interface IDOMRange;
57
58interface IWebArchive;
59interface IWebBackForwardList;
60interface IWebDataSource;
61interface IWebFrame;
62interface IWebFrameView;
63interface IWebHistoryItem;
64interface IWebPreferences;
65interface IWebScriptObject;
66
67interface IWebUIDelegate;
68interface IWebResourceLoadDelegate;
69interface IWebDownloadDelegate;
70interface IWebEditingDelegate;
71interface IWebFrameLoadDelegate;
72interface IWebPolicyDelegate;
73interface IWebDocumentView;
74interface IWebDocumentRepresentation;
75interface IWebUndoManager;
76
77/* These are the keys for the WebElementPropertyBag */
78const LPCOLESTR WebElementDOMNodeKey = L"WebElementDOMNodeKey";
79const LPCOLESTR WebElementFrameKey = L"WebElementFrameKey";
80const LPCOLESTR WebElementImageAltStringKey = L"WebElementImageAltStringKey";
81const LPCOLESTR WebElementImageKey = L"WebElementImageKey";
82const LPCOLESTR WebElementImageRectKey = L"WebElementImageRectKey";
83const LPCOLESTR WebElementImageURLKey = L"WebElementImageURLKey";
84const LPCOLESTR WebElementIsSelectedKey = L"WebElementIsSelectedKey";
85const LPCOLESTR WebElementMediaURLKey = L"WebElementMediaURLKey";
86const LPCOLESTR WebElementSpellingToolTipKey = L"WebElementSpellingToolTipKey";
87const LPCOLESTR WebElementTitleKey = L"WebElementTitleKey";
88const LPCOLESTR WebElementLinkURLKey = L"WebElementLinkURLKey";
89const LPCOLESTR WebElementLinkTargetFrameKey = L"WebElementLinkTargetFrameKey";
90const LPCOLESTR WebElementLinkTitleKey = L"WebElementLinkTitleKey";
91const LPCOLESTR WebElementLinkLabelKey = L"WebElementLinkLabelKey";
92const LPCOLESTR WebElementIsContentEditableKey = L"WebElementIsContentEditableKey";
93
94/*!
95    @class IEnumTextMatches
96*/
97[
98    object,
99    oleautomation,
100    uuid(C0CDE63A-5ED1-453f-B937-93B1A61AD3B3),
101    pointer_default(unique)
102]
103interface IEnumTextMatches : IUnknown
104{
105    HRESULT Next(ULONG celt, RECT* rect, ULONG* pceltFetched);
106    HRESULT Skip(ULONG celt);
107    HRESULT Reset(void);
108    HRESULT Clone(IEnumTextMatches** ppenum);
109};
110
111/*!
112    @class WebView
113    WebView manages the interaction between WebFrameViews and WebDataSources.  Modification
114    of the policies and behavior of the WebKit is largely managed by WebViews and their
115    delegates.
116
117    <p>
118    Typical usage:
119    </p>
120    <pre>
121    WebView *webView;
122    WebFrame *mainFrame;
123
124    webView  = [[WebView alloc] initWithFrame: NSMakeRect (0,0,640,480)];
125    mainFrame = [webView mainFrame];
126    [mainFrame loadRequest:request];
127    </pre>
128
129    WebViews have the following delegates:  WebUIDelegate, WebResourceLoadDelegate,
130    WebFrameLoadDelegate, and WebPolicyDelegate.
131
132    WebKit depends on the WebView's WebUIDelegate for all window
133    related management, including opening new windows and controlling the user interface
134    elements in those windows.
135
136    WebResourceLoadDelegate is used to monitor the progress of resources as they are
137    loaded.  This delegate may be used to present users with a progress monitor.
138
139    The WebFrameLoadDelegate receives messages when the URL in a WebFrame is
140    changed.
141
142    WebView's WebPolicyDelegate can make determinations about how
143    content should be handled, based on the resource's URL and MIME type.
144
145    @interface WebView : NSView
146*/
147[
148    object,
149    oleautomation,
150    hidden,
151    uuid(174BBEFD-058E-49c7-91DF-6F110AA4AC28),
152    pointer_default(unique)
153]
154interface IWebView : IUnknown
155{
156    /*!
157        @method canShowMIMEType:
158        @abstract Checks if the WebKit can show content of a certain MIME type.
159        @param MIMEType The MIME type to check.
160        @result YES if the WebKit can show content with MIMEtype.
161        + (BOOL)canShowMIMEType:(NSString *)MIMEType;
162    */
163    HRESULT canShowMIMEType([in] BSTR mimeType, [out, retval] BOOL* canShow);
164
165    /*!
166        @method canShowMIMETypeAsHTML:
167        @abstract Checks if the the MIME type is a type that the WebKit will interpret as HTML.
168        @param MIMEType The MIME type to check.
169        @result YES if the MIMEtype in an HTML type.
170        + (BOOL)canShowMIMETypeAsHTML:(NSString *)MIMEType;
171    */
172    HRESULT canShowMIMETypeAsHTML([in] BSTR mimeType, [out, retval] BOOL* canShow);
173
174    /*!
175        @method MIMETypesShownAsHTML
176        @result Returns an array of NSStrings that describe the MIME types
177        WebKit will attempt to render as HTML.
178        + (NSArray *)MIMETypesShownAsHTML;
179    */
180    HRESULT MIMETypesShownAsHTML([out, retval] IEnumVARIANT** enumVariant);
181
182    /*!
183        @method setMIMETypesShownAsHTML:
184        @discussion Sets the array of NSString MIME types that WebKit will
185        attempt to render as HTML.  Typically you will retrieve the built-in
186        array using MIMETypesShownAsHTML and add additional MIME types to that
187        array.
188        + (void)setMIMETypesShownAsHTML:(NSArray *)MIMETypes;
189    */
190    HRESULT setMIMETypesShownAsHTML([in, size_is(cMimeTypes)] BSTR* mimeTypes, [in] int cMimeTypes);
191
192    /*!
193        @method URLFromPasteboard:
194        @abstract Returns a URL from a pasteboard
195        @param pasteboard The pasteboard with a URL
196        @result A URL if the pasteboard has one. Nil if it does not.
197        @discussion This method differs than NSURL's URLFromPasteboard method in that it tries multiple pasteboard types
198        including NSURLPboardType to find a URL on the pasteboard.
199        + (NSURL *)URLFromPasteboard:(NSPasteboard *)pasteboard;
200    */
201    HRESULT URLFromPasteboard([in] IDataObject* pasteboard, [out, retval] BSTR* url);
202
203    /*!
204        @method URLTitleFromPasteboard:
205        @abstract Returns a URL title from a pasteboard
206        @param pasteboard The pasteboard with a URL title
207        @result A URL title if the pasteboard has one. Nil if it does not.
208        @discussion This method returns a title that refers a URL on the pasteboard. An example of this is the link label
209        which is the text inside the anchor tag.
210        + (NSString *)URLTitleFromPasteboard:(NSPasteboard *)pasteboard;
211    */
212    HRESULT URLTitleFromPasteboard([in] IDataObject* pasteboard, [out, retval] BSTR* urlTitle);
213
214    /*!
215        @method initWithFrame:frameName:groupName:
216        @abstract The designated initializer for WebView.
217        @discussion Initialize a WebView with the supplied parameters. This method will
218        create a main WebFrame with the view. Passing a top level frame name is useful if you
219        handle a targetted frame navigation that would normally open a window in some other
220        way that still ends up creating a new WebView.
221        @param frame The frame used to create the view.
222        @param frameName The name to use for the top level frame. May be nil.
223        @param groupName The name of the webView set to which this webView will be added.  May be nil.
224        @result Returns an initialized WebView.
225        - (id)initWithFrame:(NSRect)frame frameName:(NSString *)frameName groupName:(NSString *)groupName;
226    */
227    HRESULT initWithFrame([in] RECT frame, [in] BSTR frameName, [in] BSTR groupName);
228
229    /*!
230        @method setUIDelegate:
231        @abstract Set the WebView's WebUIDelegate.
232        @param delegate The WebUIDelegate to set as the delegate.
233        - (void)setUIDelegate:(id)delegate;
234    */
235    HRESULT setUIDelegate([in] IWebUIDelegate* d);
236
237    /*!
238        @method UIDelegate
239        @abstract Return the WebView's WebUIDelegate.
240        @result The WebView's WebUIDelegate.
241        - (id)UIDelegate;
242    */
243    HRESULT uiDelegate([retval, out] IWebUIDelegate** d);
244
245    /*!
246        @method setResourceLoadDelegate:
247        @abstract Set the WebView's WebResourceLoadDelegate load delegate.
248        @param delegate The WebResourceLoadDelegate to set as the load delegate.
249        - (void)setResourceLoadDelegate:(id)delegate;
250    */
251    HRESULT setResourceLoadDelegate([in] IWebResourceLoadDelegate* d);
252
253    /*!
254        @method resourceLoadDelegate
255        @result Return the WebView's WebResourceLoadDelegate.
256        - (id)resourceLoadDelegate;
257    */
258    HRESULT resourceLoadDelegate([retval, out] IWebResourceLoadDelegate** d);
259
260    /*!
261        @method setDownloadDelegate:
262        @abstract Set the WebView's WebDownloadDelegate.
263        @discussion The download delegate is retained by WebDownload when any downloads are in progress.
264        @param delegate The WebDownloadDelegate to set as the download delegate.
265        - (void)setDownloadDelegate:(id)delegate;
266    */
267    HRESULT setDownloadDelegate([in] IWebDownloadDelegate* d);
268
269    /*!
270        @method downloadDelegate
271        @abstract Return the WebView's WebDownloadDelegate.
272        @result The WebView's WebDownloadDelegate.
273        - (id)downloadDelegate;
274    */
275    HRESULT downloadDelegate([retval, out] IWebDownloadDelegate** d);
276
277    /*!
278        @method setFrameLoadDelegate:
279        @abstract Set the WebView's WebFrameLoadDelegate delegate.
280        @param delegate The WebFrameLoadDelegate to set as the delegate.
281        - (void)setFrameLoadDelegate:(id)delegate;
282    */
283    HRESULT setFrameLoadDelegate([in] IWebFrameLoadDelegate* d);
284
285    /*!
286        @method frameLoadDelegate
287        @abstract Return the WebView's WebFrameLoadDelegate delegate.
288        @result The WebView's WebFrameLoadDelegate delegate.
289        - (id)frameLoadDelegate;
290    */
291    HRESULT frameLoadDelegate([retval, out] IWebFrameLoadDelegate** d);
292
293    /*!
294        @method setPolicyDelegate:
295        @abstract Set the WebView's WebPolicyDelegate delegate.
296        @param delegate The WebPolicyDelegate to set as the delegate.
297        - (void)setPolicyDelegate:(id)delegate;
298    */
299    HRESULT setPolicyDelegate([in] IWebPolicyDelegate* d);
300
301    /*!
302        @method policyDelegate
303        @abstract Return the WebView's WebPolicyDelegate.
304        @result The WebView's WebPolicyDelegate.
305        - (id)policyDelegate;
306    */
307    HRESULT policyDelegate([retval, out] IWebPolicyDelegate** d);
308
309    /*!
310        @method mainFrame
311        @abstract Return the top level frame.
312        @discussion Note that even document that are not framesets will have a
313        mainFrame.
314        @result The main frame.
315        - (WebFrame *)mainFrame;
316    */
317    HRESULT mainFrame([retval, out] IWebFrame** frame);
318
319    /*!
320        @method focusedFrame
321    @abstract Return the frame that has the current focus.
322    */
323    HRESULT focusedFrame([retval, out] IWebFrame** frame);
324
325    /*!
326        @method backForwardList
327        @result The backforward list for this webView.
328        - (WebBackForwardList *)backForwardList;
329    */
330    HRESULT backForwardList([retval, out] IWebBackForwardList** list);
331
332    /*!
333        @method setMaintainsBackForwardList:
334        @abstract Enable or disable the use of a backforward list for this webView.
335        @param flag Turns use of the back forward list on or off
336        - (void)setMaintainsBackForwardList:(BOOL)flag;
337    */
338    HRESULT setMaintainsBackForwardList([in] BOOL flag);
339
340    /*!
341        @method goBack
342        @abstract Go back to the previous URL in the backforward list.
343        @result YES if able to go back in the backforward list, NO otherwise.
344        - (BOOL)goBack;
345    */
346    HRESULT goBack([out, retval] BOOL* succeeded);
347
348    /*!
349        @method goForward
350        @abstract Go forward to the next URL in the backforward list.
351        @result YES if able to go forward in the backforward list, NO otherwise.
352        - (BOOL)goForward;
353    */
354    HRESULT goForward([out, retval] BOOL* succeeded);
355
356    /*!
357        @method goToBackForwardItem:
358        @abstract Go back or forward to an item in the backforward list.
359        @result YES if able to go to the item, NO otherwise.
360        - (BOOL)goToBackForwardItem:(WebHistoryItem *)item;
361    */
362    HRESULT goToBackForwardItem([in] IWebHistoryItem* item, [out, retval] BOOL* succeeded);
363
364    /*!
365        @method setTextSizeMultiplier:
366        @abstract Change the size of the text rendering in views managed by this webView.
367        @param multiplier A fractional percentage value, 1.0 is 100%.
368        - (void)setTextSizeMultiplier:(float)multiplier;
369    */
370    HRESULT setTextSizeMultiplier([in] float multiplier);
371
372    /*!
373        @method textSizeMultiplier
374        @result The text size multipler.
375        - (float)textSizeMultiplier;
376    */
377    HRESULT textSizeMultiplier([out, retval] float* multiplier);
378
379    /*!
380        @method setApplicationNameForUserAgent:
381        @abstract Set the application name.
382        @discussion This name will be used in user-agent strings
383        that are chosen for best results in rendering web pages.
384        @param applicationName The application name
385        - (void)setApplicationNameForUserAgent:(NSString *)applicationName;
386    */
387    HRESULT setApplicationNameForUserAgent([in] BSTR applicationName);
388
389    /*!
390        @method applicationNameForUserAgent
391        @result The name of the application as used in the user-agent string.
392        - (NSString *)applicationNameForUserAgent;
393    */
394    HRESULT applicationNameForUserAgent([out, retval] BSTR* applicationName);
395
396    /*!
397        @method setCustomUserAgent:
398        @abstract Set the user agent.
399        @discussion Setting this means that the webView should use this user-agent string
400        instead of constructing a user-agent string for each URL. Setting it to nil
401        causes the webView to construct the user-agent string for each URL
402        for best results rendering web pages.
403        @param userAgentString The user agent description
404        - (void)setCustomUserAgent:(NSString *)userAgentString;
405    */
406    HRESULT setCustomUserAgent([in] BSTR userAgentString);
407
408    /*!
409        @method customUserAgent
410        @result The custom user-agent string or nil if no custom user-agent string has been set.
411        - (NSString *)customUserAgent;
412    */
413    HRESULT customUserAgent([out, retval] BSTR* userAgentString);
414
415    /*!
416        @method userAgentForURL:
417        @abstract Get the appropriate user-agent string for a particular URL.
418        @param URL The URL.
419        @result The user-agent string for the supplied URL.
420        - (NSString *)userAgentForURL:(NSURL *)URL;
421    */
422    HRESULT userAgentForURL([in] BSTR url, [out, retval] BSTR* userAgent);
423
424    /*!
425        @method supportsTextEncoding
426        @abstract Find out if the current web page supports text encodings.
427        @result YES if the document view of the current web page can
428        support different text encodings.
429        - (BOOL)supportsTextEncoding;
430    */
431    HRESULT supportsTextEncoding([out, retval] BOOL* supports);
432
433    /*!
434        @method setCustomTextEncodingName:
435        @discussion Make the page display with a different text encoding; stops any load in progress.
436        The text encoding passed in overrides the normal text encoding smarts including
437        what's specified in a web page's header or HTTP response.
438        The text encoding automatically goes back to the default when the top level frame
439        changes to a new location.
440        Setting the text encoding name to nil makes the webView use default encoding rules.
441        @param encoding The text encoding name to use to display a page or nil.
442        - (void)setCustomTextEncodingName:(NSString *)encodingName;
443    */
444    HRESULT setCustomTextEncodingName([in] BSTR encodingName);
445
446    /*!
447        @method customTextEncodingName
448        @result The custom text encoding name or nil if no custom text encoding name has been set.
449        - (NSString *)customTextEncodingName;
450    */
451    HRESULT customTextEncodingName([out, retval] BSTR* encodingName);
452
453    /*!
454        @method setMediaStyle:
455        @discussion Set the media style for the WebView.  The mediaStyle will override the normal value
456        of the CSS media property.  Setting the value to nil will restore the normal value.
457        @param mediaStyle The value to use for the CSS media property.
458        - (void)setMediaStyle:(NSString *)mediaStyle;
459    */
460    HRESULT setMediaStyle([in] BSTR media);
461
462    /*!
463        @method mediaStyle
464        @result mediaStyle The value to use for the CSS media property, as set by setMediaStyle:.  It
465        will be nil unless set by that method.
466        - (NSString *)mediaStyle;
467    */
468    HRESULT mediaStyle([out, retval] BSTR* media);
469
470    /*!
471        @method stringByEvaluatingJavaScriptFromString:
472        @param script The text of the JavaScript.
473        @result The result of the script, converted to a string, or nil for failure.
474        - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script;
475    */
476    HRESULT stringByEvaluatingJavaScriptFromString([in] BSTR script, [out, retval] BSTR* result);
477
478    /*!
479        @method windowScriptObject
480        @discussion windowScriptObject return a WebScriptObject that represents the
481        window object from the script environment.
482        @result Returns the window object from the script environment.
483        - (WebScriptObject *)windowScriptObject;
484    */
485    HRESULT windowScriptObject([out, retval] IWebScriptObject** webScriptObject);
486
487    /*!
488        @method setPreferences:
489        @param preferences The preferences to use for the webView.
490        @abstract Override the standard setting for the webView.
491        - (void)setPreferences: (WebPreferences *)prefs;
492    */
493    HRESULT setPreferences([in] IWebPreferences* prefs);
494
495    /*!
496        @method preferences
497        @result Returns the preferences used by this webView.
498        @discussion This method will return [WebPreferences standardPreferences] if no
499        other instance of WebPreferences has been set.
500        - (WebPreferences *)preferences;
501    */
502    HRESULT preferences([out, retval] IWebPreferences** prefs);
503
504    /*!
505        @method setPreferencesIdentifier:
506        @param anIdentifier The string to use a prefix for storing values for this WebView in the user
507        defaults database.
508        @discussion If the WebPreferences for this WebView are stored in the user defaults database, the
509        string set in this method will be used a key prefix.
510        - (void)setPreferencesIdentifier:(NSString *)anIdentifier;
511    */
512    HRESULT setPreferencesIdentifier([in] BSTR anIdentifier);
513
514    /*!
515        @method preferencesIdentifier
516        @result Returns the WebPreferences key prefix.
517        - (NSString *)preferencesIdentifier;
518    */
519    HRESULT preferencesIdentifier([out, retval] BSTR* anIdentifier);
520
521    /*!
522        @method setHostWindow:
523        @param hostWindow The host window for the web view.
524        @discussion Parts of WebKit (such as plug-ins and JavaScript) depend on a window to function
525        properly. Set a host window so these parts continue to function even when the web view is
526        not in an actual window.
527        - (void)setHostWindow:(NSWindow *)hostWindow;
528    */
529    HRESULT setHostWindow([in] OLE_HANDLE window);
530
531    /*!
532        @method hostWindow
533        @result The host window for the web view.
534        - (NSWindow *)hostWindow;
535    */
536    HRESULT hostWindow([out, retval] OLE_HANDLE* window);
537
538    /*!
539        @method searchFor:direction:caseSensitive:
540        @abstract Searches a document view for a string and highlights the string if it is found.
541        Starts the search from the current selection.  Will search across all frames.
542        @param string The string to search for.
543        @param forward YES to search forward, NO to seach backwards.
544        @param caseFlag YES to for case-sensitive search, NO for case-insensitive search.
545        @result YES if found, NO if not found.
546        - (BOOL)searchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag;
547    */
548    HRESULT searchFor([in] BSTR str, [in] BOOL forward, [in] BOOL caseFlag, [in] BOOL wrapFlag, [out, retval] BOOL* found);
549
550    /*!
551        @method registerViewClass:representationClass:forMIMEType:
552        @discussion Register classes that implement WebDocumentView and WebDocumentRepresentation respectively.
553        A document class may register for a primary MIME type by excluding
554        a subtype, i.e. "video/" will match the document class with
555        all video types.  More specific matching takes precedence
556        over general matching.
557        @param viewClass The WebDocumentView class to use to render data for a given MIME type.
558        @param representationClass The WebDocumentRepresentation class to use to represent data of the given MIME type.
559        @param MIMEType The MIME type to represent with an object of the given class.
560        + (void)registerViewClass:(Class)viewClass representationClass:(Class)representationClass forMIMEType:(NSString *)MIMEType;
561    */
562    HRESULT registerViewClass([in] IWebDocumentView* view, [in] IWebDocumentRepresentation* representation, [in] BSTR forMIMEType);
563
564    /*!
565        @method setGroupName:
566        @param groupName The name of the group for this WebView.
567        @discussion JavaScript may access named frames within the same group.
568        - (void)setGroupName:(NSString *)groupName;
569    */
570    HRESULT setGroupName([in] BSTR groupName);
571
572    /*!
573        @method groupName
574        @discussion The group name for this WebView.
575        - (NSString *)groupName;
576    */
577    HRESULT groupName([out, retval] BSTR* groupName);
578
579    /*!
580        @method estimatedProgress
581        @discussion An estimate of the percent complete for a document load.  This
582        value will range from 0 to 1.0 and, once a load completes, will remain at 1.0
583        until a new load starts, at which point it will be reset to 0.  The value is an
584        estimate based on the total number of bytes expected to be received
585        for a document, including all it's possible subresources.  For more accurate progress
586        indication it is recommended that you implement a WebFrameLoadDelegate and a
587        WebResourceLoadDelegate.
588        - (double)estimatedProgress;
589    */
590    HRESULT estimatedProgress([out, retval] double* estimatedProgress);
591
592    /*!
593        @method isLoading
594        @discussion Returns YES if there are any pending loads.
595        - (BOOL)isLoading;
596    */
597    HRESULT isLoading([out, retval] BOOL* isLoading);
598
599    /*!
600        @method elementAtPoint:
601        @param point A point in the coordinates of the WebView
602        @result An element dictionary describing the point
603        - (NSDictionary *)elementAtPoint:(NSPoint)point;
604    */
605    HRESULT elementAtPoint([in] LPPOINT point, [out, retval] IPropertyBag** elementDictionary);
606
607    /*!
608        @method pasteboardTypesForSelection
609        @abstract Returns the pasteboard types that WebView can use for the current selection
610        - (NSArray *)pasteboardTypesForSelection;
611    */
612    HRESULT pasteboardTypesForSelection([out, retval] IEnumVARIANT** enumVariant);
613
614    /*!
615        @method writeSelectionWithPasteboardTypes:toPasteboard:
616        @abstract Writes the current selection to the pasteboard
617        @param types The types that WebView will write to the pasteboard
618        @param pasteboard The pasteboard to write to
619        - (void)writeSelectionWithPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard;
620    */
621    HRESULT writeSelectionWithPasteboardTypes([in, size_is(cTypes)] BSTR* types, [in] int cTypes, [in] IDataObject* pasteboard);
622
623    /*!
624        @method pasteboardTypesForElement:
625        @abstract Returns the pasteboard types that WebView can use for an element
626        @param element The element
627        - (NSArray *)pasteboardTypesForElement:(NSDictionary *)element;
628    */
629    HRESULT pasteboardTypesForElement([in] IPropertyBag* elementDictionary, [out, retval] IEnumVARIANT** enumVariant);
630
631    /*!
632        @method writeElement:withPasteboardTypes:toPasteboard:
633        @abstract Writes an element to the pasteboard
634        @param element The element to write to the pasteboard
635        @param types The types that WebView will write to the pasteboard
636        @param pasteboard The pasteboard to write to
637        - (void)writeElement:(NSDictionary *)element withPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard;
638    */
639    HRESULT writeElement([in] IPropertyBag* elementDictionary, [in, size_is(cWithPasteboardTypes)] BSTR* withPasteboardTypes, [in] int cWithPasteboardTypes, [in] IDataObject* pasteboard);
640
641    /*!
642        @method selectedText
643        @abstract Returns the selection as a string
644    */
645    HRESULT selectedText([out, retval] BSTR* text);
646
647    /*!
648        @method centerSelectionInVisibleArea
649        @abstract Centers the selected text in the WebView
650        - (void)centerSelectionInVisibleArea:(id)sender;
651    */
652    HRESULT centerSelectionInVisibleArea([in] IUnknown* sender);
653
654    /*!
655        @method moveDragCaretToPoint:
656        @param point A point in the coordinates of the WebView
657        @discussion This method moves the caret that shows where something being dragged will be dropped. It may cause the WebView to scroll
658        to make the new position of the drag caret visible.
659        - (void)moveDragCaretToPoint:(NSPoint)point;
660    */
661    HRESULT moveDragCaretToPoint([in] LPPOINT point);
662
663    /*!
664        @method removeDragCaret
665        @abstract Removes the drag caret from the WebView
666        - (void)removeDragCaret;
667    */
668    HRESULT removeDragCaret();
669
670    /*!
671        @method setDrawsBackground:
672        @param drawsBackround YES to cause the receiver to draw a default white background, NO otherwise.
673        @abstract Sets whether the receiver draws a default white background when the loaded page has no background specified.
674        - (void)setDrawsBackground:(BOOL)drawsBackround;
675    */
676    HRESULT setDrawsBackground([in] BOOL drawsBackground);
677
678    /*!
679        @method drawsBackground
680        @result Returns YES if the receiver draws a default white background, NO otherwise.
681        - (BOOL)drawsBackground;
682    */
683    HRESULT drawsBackground([out, retval] BOOL* drawsBackground);
684
685    /*!
686        @method setMainFrameURL:
687        @param URLString The URL to load in the mainFrame.
688        - (void)setMainFrameURL:(NSString *)URLString;
689    */
690    HRESULT setMainFrameURL([in] BSTR urlString);
691
692    /*!
693        @method mainFrameURL
694        @result Returns the main frame's current URL.
695        - (NSString *)mainFrameURL;
696    */
697    HRESULT mainFrameURL([out, retval] BSTR* urlString);
698
699    /*!
700        @method mainFrameDocument
701        @result Returns the main frame's DOMDocument.
702        - (DOMDocument *)mainFrameDocument;
703    */
704    HRESULT mainFrameDocument([out, retval] IDOMDocument** document);
705
706    /*!
707        @method mainFrameTitle
708        @result Returns the main frame's title if any, otherwise an empty string.
709        - (NSString *)mainFrameTitle;
710    */
711    HRESULT mainFrameTitle([out, retval] BSTR* title);
712
713    /*!
714        @method mainFrameIcon
715        @discussion The methods returns the site icon for the current page loaded in the mainFrame.
716        @result Returns the main frame's icon if any, otherwise nil.
717        - (NSImage *)mainFrameIcon;
718    */
719    HRESULT mainFrameIcon([out, retval] OLE_HANDLE* hBitmap);
720
721    /*!
722        @method registerURLSchemeAsLocal
723        @discussion Adds the scheme to the list of schemes to be treated as local.
724        @param scheme The scheme to register.
725        + (void)registerURLSchemeAsLocal:(NSString *)scheme;
726    */
727    HRESULT registerURLSchemeAsLocal([in] BSTR scheme);
728
729    /*!
730        @method close
731        @abstract Closes the receiver, unloading its web page and canceling any pending loads.
732        Once the receiver has closed, it will no longer respond to requests or fire delegate methods.
733        (However, the -close method itself may fire delegate methods.)
734        @discussion A garbage collected application is required to call close when the receiver is no longer needed.
735        The close method will be called automatically when the window or hostWindow closes and shouldCloseWithWindow returns YES.
736        A non-garbage collected application can still call close, providing a convenient way to prevent receiver
737        from doing any more loading and firing any future delegate methods.
738    */
739    HRESULT close();
740}
741
742/*
743    @interface WebView (WebIBActions) <NSUserInterfaceValidations>
744*/
745[
746    object,
747    oleautomation,
748    uuid(8F0E3A30-B924-44f8-990A-1AE61ED6C632),
749    pointer_default(unique)
750]
751interface IWebIBActions : IUnknown
752{
753    /*
754        - (IBAction)takeStringURLFrom:(id)sender;
755    */
756    HRESULT takeStringURLFrom([in] IUnknown* sender);
757
758    /*
759        - (IBAction)stopLoading:(id)sender;
760    */
761    HRESULT stopLoading([in] IUnknown* sender);
762
763    /*
764        - (IBAction)reload:(id)sender;
765    */
766    HRESULT reload([in] IUnknown* sender);
767
768    /*
769        - (BOOL)canGoBack;
770    */
771    HRESULT canGoBack([in] IUnknown* sender, [out, retval] BOOL* result);
772
773    /*
774        - (IBAction)goBack:(id)sender;
775    */
776    HRESULT goBack([in] IUnknown* sender);
777
778    /*
779        - (BOOL)canGoForward;
780    */
781    HRESULT canGoForward([in] IUnknown* sender, [out, retval] BOOL* result);
782
783    /*
784        - (IBAction)goForward:(id)sender;
785    */
786    HRESULT goForward([in] IUnknown* sender);
787
788    /*
789        - (BOOL)canMakeTextLarger;
790    */
791    HRESULT canMakeTextLarger([in] IUnknown* sender, [out, retval] BOOL* result);
792
793    /*
794        - (IBAction)makeTextLarger:(id)sender;
795    */
796    HRESULT makeTextLarger([in] IUnknown* sender);
797
798    /*
799        - (BOOL)canMakeTextSmaller;
800    */
801    HRESULT canMakeTextSmaller([in] IUnknown* sender, [out, retval] BOOL* result);
802
803    /*
804        - (IBAction)makeTextSmaller:(id)sender;
805    */
806    HRESULT makeTextSmaller([in] IUnknown* sender);
807
808    /*
809        - (BOOL)canMakeTextStandardSize;
810    */
811    HRESULT canMakeTextStandardSize([in] IUnknown* sender, [out, retval] BOOL* result);
812
813    /*
814        - (IBAction)makeTextStandardSize:(id)sender;
815    */
816    HRESULT makeTextStandardSize([in] IUnknown* sender);
817
818    /*
819        - (IBAction)toggleContinuousSpellChecking:(id)sender;
820    */
821    HRESULT toggleContinuousSpellChecking([in] IUnknown* sender);
822
823    /*
824        - (IBAction)toggleSmartInsertDelete:(id)sender;
825    */
826    HRESULT toggleSmartInsertDelete([in] IUnknown* sender);
827
828    /*
829        - (void)toggleGrammarChecking:(id)sender
830    */
831    HRESULT toggleGrammarChecking([in] IUnknown* sender);
832
833       /*!
834        @method setPageSizeMultiplier:
835        @abstract Set a zoom factor for all views managed by this webView.
836        @param multiplier A fractional percentage value, 1.0 is 100%.
837        - (void)setPageSizeMultiplier:(float)multiplier;
838    */
839    HRESULT setPageSizeMultiplier([in] float multiplier);
840
841    /*!
842        @method pageSizeMultiplier
843        @result The page size multipler.
844        - (float)pageSizeMultiplier;
845    */
846    HRESULT pageSizeMultiplier([out, retval] float* multiplier);
847
848    /*
849        - (BOOL)canZoomPageIn;
850    */
851    HRESULT canZoomPageIn([in] IUnknown* sender, [out, retval] BOOL* result);
852
853    /*
854        - (IBAction)zoomPageIn:(id)sender;
855    */
856    HRESULT zoomPageIn([in] IUnknown* sender);
857
858    /*
859        - (BOOL)canZoomPageOut;
860    */
861    HRESULT canZoomPageOut([in] IUnknown* sender, [out, retval] BOOL* result);
862
863    /*
864        - (IBAction)zoomPageOut:(id)sender;
865    */
866    HRESULT zoomPageOut([in] IUnknown* sender);
867
868    /*
869        - (BOOL)canResetPageZoom;
870    */
871    HRESULT canResetPageZoom([in] IUnknown* sender, [out, retval] BOOL* result);
872
873    /*
874        - (IBAction)resetPageZoom:(id)sender;
875    */
876    HRESULT resetPageZoom([in] IUnknown* sender);
877
878    /*
879        - (IBAction)reloadFromOrigin:(id)sender;
880    */
881    HRESULT reloadFromOrigin([in] IUnknown* sender);
882}
883
884/*
885    @interface WebView (WebViewCSS)
886*/
887[
888    object,
889    oleautomation,
890    uuid(ADF68A8C-336F-405c-A053-3D11A9D5B092),
891    pointer_default(unique)
892]
893interface IWebViewCSS : IUnknown
894{
895    /*
896        - (DOMCSSStyleDeclaration *)computedStyleForElement:(DOMElement *)element pseudoElement:(NSString *)pseudoElement;
897    */
898    HRESULT computedStyleForElement([in] IDOMElement* element, [in] BSTR pseudoElement, [out, retval] IDOMCSSStyleDeclaration** style);
899}
900
901/*
902    @interface WebView (WebViewEditing)
903*/
904[
905    object,
906    oleautomation,
907    uuid(07BDAC9A-19A1-4086-864D-BAD9E0F00D5C),
908    pointer_default(unique)
909]
910interface IWebViewEditing : IUnknown
911{
912    /*
913        - (DOMRange *)editableDOMRangeForPoint:(NSPoint)point;
914    */
915    HRESULT editableDOMRangeForPoint([in] LPPOINT point, [out, retval] IDOMRange** range);
916
917    /*
918        - (void)setSelectedDOMRange:(DOMRange *)range affinity:(NSSelectionAffinity)selectionAffinity;
919    */
920    HRESULT setSelectedDOMRange([in] IDOMRange* range, [in] WebSelectionAffinity affinity);
921
922    /*
923        - (DOMRange *)selectedDOMRange;
924    */
925    HRESULT selectedDOMRange([out, retval] IDOMRange** range);
926
927    /*
928        - (NSSelectionAffinity)selectionAffinity;
929    */
930    HRESULT selectionAffinity([out, retval] [out, retval] WebSelectionAffinity* affinity);
931
932    /*
933        - (void)setEditable:(BOOL)flag;
934    */
935    HRESULT setEditable([in] BOOL flag);
936
937    /*
938        - (BOOL)isEditable;
939    */
940    HRESULT isEditable([out, retval] BOOL* isEditable);
941
942    /*
943        - (void)setTypingStyle:(DOMCSSStyleDeclaration *)style;
944    */
945    HRESULT setTypingStyle([in] IDOMCSSStyleDeclaration* style);
946
947    /*
948        - (DOMCSSStyleDeclaration *)typingStyle;
949    */
950    HRESULT typingStyle([out, retval] IDOMCSSStyleDeclaration** style);
951
952    /*
953        - (void)setSmartInsertDeleteEnabled:(BOOL)flag;
954    */
955    HRESULT setSmartInsertDeleteEnabled([in] BOOL flag);
956
957    /*
958        - (BOOL)smartInsertDeleteEnabled;
959    */
960    HRESULT smartInsertDeleteEnabled([out, retval] BOOL* enabled);
961
962    /*
963        - (void)setContinuousSpellCheckingEnabled:(BOOL)flag;
964    */
965    HRESULT setContinuousSpellCheckingEnabled([in] BOOL flag);
966
967    /*
968        - (BOOL)isContinuousSpellCheckingEnabled;
969    */
970    HRESULT isContinuousSpellCheckingEnabled([out, retval] BOOL* enabled);
971
972    /*
973        - (WebNSInt)spellCheckerDocumentTag;
974    */
975    HRESULT spellCheckerDocumentTag([out, retval] int* tag);
976
977    /*
978        - (NSUndoManager *)undoManager;
979    */
980    HRESULT undoManager([out, retval] IWebUndoManager** manager);
981
982    /*
983        - (void)setEditingDelegate:(id)delegate;
984    */
985    HRESULT setEditingDelegate([in] IWebEditingDelegate* d);
986
987    /*
988        - (id)editingDelegate;
989    */
990    HRESULT editingDelegate([out, retval] IWebEditingDelegate** d);
991
992    /*
993        - (DOMCSSStyleDeclaration *)styleDeclarationWithText:(NSString *)text;
994    */
995    HRESULT styleDeclarationWithText([in] BSTR text, [out, retval] IDOMCSSStyleDeclaration** style);
996
997    /*
998        - (BOOL)hasSelectedRange;
999    */
1000    HRESULT hasSelectedRange([out, retval] BOOL* hasSelectedRange);
1001
1002    /*
1003        - (BOOL)cutEnabled;
1004    */
1005    HRESULT cutEnabled([out, retval] BOOL* enabled);
1006
1007    /*
1008        - (BOOL)copyEnabled;
1009    */
1010    HRESULT copyEnabled([out, retval] BOOL* enabled);
1011
1012    /*
1013        - (BOOL)pasteEnabled;
1014    */
1015    HRESULT pasteEnabled([out, retval] BOOL* enabled);
1016
1017    /*
1018        - (BOOL)deleteEnabled;
1019    */
1020    HRESULT deleteEnabled([out, retval] BOOL* enabled);
1021
1022    /*
1023        - (BOOL)editingEnabled;
1024    */
1025    HRESULT editingEnabled([out, retval] BOOL* enabled);
1026
1027    /*
1028        - (BOOL)isGrammarCheckingEnabled
1029    */
1030    HRESULT isGrammarCheckingEnabled([out, retval] BOOL* enabled);
1031
1032    /*
1033        - (void)setGrammarCheckingEnabled:(BOOL)flag
1034    */
1035    HRESULT setGrammarCheckingEnabled(BOOL enabled);
1036
1037    /*
1038        - (void)setSelectTrailingWhitespaceEnabled:(BOOL)flag;
1039    */
1040    HRESULT setSelectTrailingWhitespaceEnabled([in] BOOL flag);
1041
1042    /*
1043        - (BOOL)selectTrailingWhitespaceEnabled;
1044    */
1045    HRESULT isSelectTrailingWhitespaceEnabled([out, retval] BOOL* enabled);
1046}
1047
1048/*
1049    @interface WebView (WebViewUndoableEditing)
1050*/
1051[
1052    object,
1053    oleautomation,
1054    uuid(639E7121-13C8-4a12-BC18-6E1F3D68F3C3),
1055    pointer_default(unique)
1056]
1057interface IWebViewUndoableEditing : IUnknown
1058{
1059    /*
1060        - (void)replaceSelectionWithNode:(DOMNode *)node;
1061    */
1062    HRESULT replaceSelectionWithNode([in] IDOMNode* node);
1063
1064    /*
1065        - (void)replaceSelectionWithText:(NSString *)text;
1066    */
1067    HRESULT replaceSelectionWithText([in] BSTR text);
1068
1069    /*
1070        - (void)replaceSelectionWithMarkupString:(NSString *)markupString;
1071    */
1072    HRESULT replaceSelectionWithMarkupString([in] BSTR markupString);
1073
1074    /*
1075        - (void)replaceSelectionWithArchive:(WebArchive *)archive;
1076    */
1077    HRESULT replaceSelectionWithArchive([in] IWebArchive* archive);
1078
1079    /*
1080        - (void)deleteSelection;
1081    */
1082    HRESULT deleteSelection();
1083
1084    /*
1085        - (void)clearSelection;
1086    */
1087    HRESULT clearSelection();
1088
1089    /*
1090        - (void)applyStyle:(DOMCSSStyleDeclaration *)style;
1091    */
1092    HRESULT applyStyle([in] IDOMCSSStyleDeclaration* style);
1093}
1094
1095/*
1096    @interface WebView (WebViewEditingActions)
1097*/
1098[
1099    object,
1100    oleautomation,
1101    uuid(7E066C42-8E81-4778-888D-D6CC93E27D4C),
1102    pointer_default(unique)
1103]
1104interface IWebViewEditingActions : IUnknown
1105{
1106    /*
1107        - (void)copy:(id)sender;
1108    */
1109    HRESULT copy([in] IUnknown* sender);
1110
1111    /*
1112        - (void)cut:(id)sender;
1113    */
1114    HRESULT cut([in] IUnknown* sender);
1115
1116    /*
1117        - (void)paste:(id)sender;
1118    */
1119    HRESULT paste([in] IUnknown* sender);
1120
1121    /*
1122        - (void)copyURL:(id)sender;
1123    */
1124    HRESULT copyURL([in] BSTR url);
1125
1126    /*
1127        - (void)copyFont:(id)sender;
1128    */
1129    HRESULT copyFont([in] IUnknown* sender);
1130
1131    /*
1132        - (void)pasteFont:(id)sender;
1133    */
1134    HRESULT pasteFont([in] IUnknown* sender);
1135
1136    /*
1137        - (void)delete:(id)sender;
1138    */
1139    HRESULT delete_([in] IUnknown* sender);
1140
1141    /*
1142        - (void)pasteAsPlainText:(id)sender;
1143    */
1144    HRESULT pasteAsPlainText([in] IUnknown* sender);
1145
1146    /*
1147        - (void)pasteAsRichText:(id)sender;
1148    */
1149    HRESULT pasteAsRichText([in] IUnknown* sender);
1150
1151
1152    /*
1153        - (void)changeFont:(id)sender;
1154    */
1155    HRESULT changeFont([in] IUnknown* sender);
1156
1157    /*
1158        - (void)changeAttributes:(id)sender;
1159    */
1160    HRESULT changeAttributes([in] IUnknown* sender);
1161
1162    /*
1163        - (void)changeDocumentBackgroundColor:(id)sender;
1164    */
1165    HRESULT changeDocumentBackgroundColor([in] IUnknown* sender);
1166
1167    /*
1168        - (void)changeColor:(id)sender;
1169    */
1170    HRESULT changeColor([in] IUnknown* sender);
1171
1172
1173    /*
1174        - (void)alignCenter:(id)sender;
1175    */
1176    HRESULT alignCenter([in] IUnknown* sender);
1177
1178    /*
1179        - (void)alignJustified:(id)sender;
1180    */
1181    HRESULT alignJustified([in] IUnknown* sender);
1182
1183    /*
1184        - (void)alignLeft:(id)sender;
1185    */
1186    HRESULT alignLeft([in] IUnknown* sender);
1187
1188    /*
1189        - (void)alignRight:(id)sender;
1190    */
1191    HRESULT alignRight([in] IUnknown* sender);
1192
1193
1194    /*
1195        - (void)checkSpelling:(id)sender;
1196    */
1197    HRESULT checkSpelling([in] IUnknown* sender);
1198
1199    /*
1200        - (void)showGuessPanel:(id)sender;
1201    */
1202    HRESULT showGuessPanel([in] IUnknown* sender);
1203
1204    /*
1205        - (void)performFindPanelAction:(id)sender;
1206    */
1207    HRESULT performFindPanelAction([in] IUnknown* sender);
1208
1209
1210    /*
1211        - (void)startSpeaking:(id)sender;
1212    */
1213    HRESULT startSpeaking([in] IUnknown* sender);
1214
1215    /*
1216        - (void)stopSpeaking:(id)sender;
1217    */
1218    HRESULT stopSpeaking([in] IUnknown* sender);
1219}
1220
1221
1222
1223