2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
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.
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.
29 import "IWebError.idl";
30 import "IWebDataSource.idl";
34 interface IWebDataSource;
37 @protocol WebDocumentView
38 @discussion Protocol implemented by the document view of WebFrameView
40 @protocol WebDocumentView <NSObject>
45 uuid(0A6397A7-90FE-49a0-B9C1-44693DD779F7),
46 pointer_default(unique)
48 interface IWebDocumentView : IUnknown
51 @method setDataSource:
52 @abstract Called when the corresponding data source has been created.
53 @param dataSource The corresponding data source.
54 - (void)setDataSource:(WebDataSource *)dataSource;
56 HRESULT setDataSource([in] IWebDataSource* dataSource);
59 @method dataSourceUpdated:
60 @abstract Called when the corresponding data source has received data.
61 @param dataSource The corresponding data source.
62 - (void)dataSourceUpdated:(WebDataSource *)dataSource;
64 HRESULT dataSourceUpdated([in] IWebDataSource* dataSource);
67 @method setNeedsLayout:
68 @discussion Called when WebKit has determined that the document view needs to layout.
69 This method should simply set a flag and call layout from drawRect if the flag is YES.
70 @param flag YES to cause a layout, no to not cause a layout.
71 - (void)setNeedsLayout:(BOOL)flag;
73 HRESULT setNeedsLayout([in] BOOL flag);
77 @discussion Called when the document view must immediately layout. For simple views,
78 setting the frame is a sufficient implementation of this method.
84 @method viewWillMoveToHostWindow:
85 @param hostWindow The host window for the document view.
86 @abstract Called before the host window is set on the parent web view.
87 - (void)viewWillMoveToHostWindow:(NSWindow *)hostWindow;
89 HRESULT viewWillMoveToHostWindow([in] OLE_HANDLE hwnd);
92 @method viewDidMoveToHostWindow
93 @abstract Called after the host window is set on the parent web view.
94 - (void)viewDidMoveToHostWindow;
96 HRESULT viewDidMoveToHostWindow();
100 @protocol WebDocumentSearching
101 @discussion Optional protocol for searching document view of WebFrameView.
103 @protocol WebDocumentSearching <NSObject>
108 uuid(0213643B-8DF9-4ba4-9534-61D92CB75007),
109 pointer_default(unique)
111 interface IWebDocumentSearching : IUnknown
114 @method searchFor:direction:caseSensitive:wrap:
115 @abstract Searches a document view for a string and highlights the string if it is found.
116 @param string The string to search for.
117 @param forward YES to search forward, NO to seach backwards.
118 @param caseFlag YES to for case-sensitive search, NO for case-insensitive search.
119 @param wrapFlag YES to wrap around, NO to avoid wrapping.
120 @result YES if found, NO if not found.
121 - (BOOL)searchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag;
123 HRESULT searchFor([in] BSTR str, [in] BOOL forwardDirection, [in] BOOL caseSensitive, [in] BOOL wrap, [out, retval] BOOL* result);
127 @protocol WebDocumentText
128 @discussion Optional protocol for supporting text operations.
130 @protocol WebDocumentText <NSObject>
135 uuid(B6282B92-6F31-4948-A3A0-89763C56BBBF),
136 pointer_default(unique)
138 interface IWebDocumentText : IUnknown
141 @method supportsTextEncoding
142 @result YES if the document view support text encoding, NO if it doesn't.
143 - (BOOL)supportsTextEncoding;
145 HRESULT supportsTextEncoding([out, retval] BOOL* result);
149 @result String that represents the entire document.
150 - (NSString *)string;
152 HRESULT string([out, retval] BSTR* result);
155 @method selectedString
156 @result String that represents the current selection.
157 - (NSString *)selectedString;
159 HRESULT selectedString([out, retval] BSTR* result);
163 @abstract Selects all the text in the document.
170 @abstract Causes a text selection to lose its selection.
173 HRESULT deselectAll();
177 @protocol WebDocumentRepresentation
178 @discussion Protocol implemented by the document representation of a data source.
180 @protocol WebDocumentRepresentation <NSObject>
185 uuid(3C9F6251-CFD8-447a-B429-6B6AE627436C),
186 pointer_default(unique)
188 interface IWebDocumentRepresentation : IUnknown
191 @method setDataSource:
192 @abstract Called soon after the document representation is created.
193 @param dataSource The data source that is set.
194 - (void)setDataSource:(WebDataSource *)dataSource;
196 HRESULT setDataSource([in] IWebDataSource* dataSource);
199 @method receivedData:withDataSource:
200 @abstract Called when the data source has received data.
201 @param data The data that the data source has received.
202 @param dataSource The data source that has received data.
203 - (void)receivedData:(NSData *)data withDataSource:(WebDataSource *)dataSource;
205 HRESULT receivedData([in] IStream* data, [in] IWebDataSource* dataSource);
208 @method receivedError:withDataSource:
209 @abstract Called when the data source has received an error.
210 @param error The error that the data source has received.
211 @param dataSource The data source that has received the error.
212 - (void)receivedError:(NSError *)error withDataSource:(WebDataSource *)dataSource;
214 HRESULT receivedError([in] IWebError* error, [in] IWebDataSource* dataSource);
217 @method finishedLoadingWithDataSource:
218 @abstract Called when the data source has finished loading.
219 @param dataSource The datasource that has finished loading.
220 - (void)finishedLoadingWithDataSource:(WebDataSource *)dataSource;
222 HRESULT finishedLoadingWithDataSource([in] IWebDataSource* dataSource);
225 @method canProvideDocumentSource
226 @result Returns true if the representation can provide document source.
227 - (BOOL)canProvideDocumentSource;
229 HRESULT canProvideDocumentSource([out, retval] BOOL* result);
232 @method documentSource
233 @result Returns the textual source representation of the document. For HTML documents
234 this is the original HTML source.
235 - (NSString *)documentSource;
237 HRESULT documentSource([out, retval] BSTR* source);
241 @result Return the title for the document.
244 HRESULT title([out, retval] BSTR* docTitle);