• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "IWebError.idl";
30import "IWebDataSource.idl";
31#endif
32
33interface IWebError;
34interface IWebDataSource;
35
36/*!
37    @protocol WebDocumentView
38    @discussion Protocol implemented by the document view of WebFrameView
39
40    @protocol WebDocumentView <NSObject>
41*/
42[
43    object,
44    oleautomation,
45    uuid(0A6397A7-90FE-49a0-B9C1-44693DD779F7),
46    pointer_default(unique)
47]
48interface IWebDocumentView : IUnknown
49{
50    /*!
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;
55    */
56    HRESULT setDataSource([in] IWebDataSource* dataSource);
57
58    /*!
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;
63    */
64    HRESULT dataSourceUpdated([in] IWebDataSource* dataSource);
65
66    /*!
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;
72    */
73    HRESULT setNeedsLayout([in] BOOL flag);
74
75    /*!
76        @method layout
77        @discussion Called when the document view must immediately layout. For simple views,
78        setting the frame is a sufficient implementation of this method.
79        - (void)layout;
80    */
81    HRESULT layout();
82
83    /*!
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;
88    */
89    HRESULT viewWillMoveToHostWindow([in] OLE_HANDLE hwnd);
90
91    /*!
92        @method viewDidMoveToHostWindow
93        @abstract Called after the host window is set on the parent web view.
94        - (void)viewDidMoveToHostWindow;
95    */
96    HRESULT viewDidMoveToHostWindow();
97}
98
99/*!
100    @protocol WebDocumentSearching
101    @discussion Optional protocol for searching document view of WebFrameView.
102
103    @protocol WebDocumentSearching <NSObject>
104*/
105[
106    object,
107    oleautomation,
108    uuid(0213643B-8DF9-4ba4-9534-61D92CB75007),
109    pointer_default(unique)
110]
111interface IWebDocumentSearching : IUnknown
112{
113    /*!
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;
122    */
123    HRESULT searchFor([in] BSTR str, [in] BOOL forwardDirection, [in] BOOL caseSensitive, [in] BOOL wrap, [out, retval] BOOL* result);
124}
125
126/*!
127    @protocol WebDocumentText
128    @discussion Optional protocol for supporting text operations.
129
130    @protocol WebDocumentText <NSObject>
131*/
132[
133    object,
134    oleautomation,
135    uuid(B6282B92-6F31-4948-A3A0-89763C56BBBF),
136    pointer_default(unique)
137]
138interface IWebDocumentText : IUnknown
139{
140    /*!
141        @method supportsTextEncoding
142        @result YES if the document view support text encoding, NO if it doesn't.
143        - (BOOL)supportsTextEncoding;
144    */
145    HRESULT supportsTextEncoding([out, retval] BOOL* result);
146
147    /*!
148        @method string
149        @result String that represents the entire document.
150        - (NSString *)string;
151    */
152    HRESULT string([out, retval] BSTR* result);
153
154    /*!
155        @method selectedString
156        @result String that represents the current selection.
157        - (NSString *)selectedString;
158    */
159    HRESULT selectedString([out, retval] BSTR* result);
160
161    /*!
162        @method selectAll
163        @abstract Selects all the text in the document.
164        - (void)selectAll;
165    */
166    HRESULT selectAll();
167
168    /*!
169        @method deselectText
170        @abstract Causes a text selection to lose its selection.
171        - (void)deselectAll;
172    */
173    HRESULT deselectAll();
174}
175
176/*!
177    @protocol WebDocumentRepresentation
178    @discussion Protocol implemented by the document representation of a data source.
179
180    @protocol WebDocumentRepresentation <NSObject>
181*/
182[
183    object,
184    oleautomation,
185    uuid(3C9F6251-CFD8-447a-B429-6B6AE627436C),
186    pointer_default(unique)
187]
188interface IWebDocumentRepresentation : IUnknown
189{
190    /*!
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;
195    */
196    HRESULT setDataSource([in] IWebDataSource* dataSource);
197
198    /*!
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;
204    */
205    HRESULT receivedData([in] IStream* data, [in] IWebDataSource* dataSource);
206
207    /*!
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;
213    */
214    HRESULT receivedError([in] IWebError* error, [in] IWebDataSource* dataSource);
215
216    /*!
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;
221    */
222    HRESULT finishedLoadingWithDataSource([in] IWebDataSource* dataSource);
223
224    /*!
225        @method canProvideDocumentSource
226        @result Returns true if the representation can provide document source.
227        - (BOOL)canProvideDocumentSource;
228    */
229    HRESULT canProvideDocumentSource([out, retval] BOOL* result);
230
231    /*!
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;
236    */
237    HRESULT documentSource([out, retval] BSTR* source);
238
239    /*!
240        @method title
241        @result Return the title for the document.
242        - (NSString *)title;
243    */
244    HRESULT title([out, retval] BSTR* docTitle);
245}
246