IWebDocument.idl 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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. #ifndef DO_NO_IMPORTS
  26. import "oaidl.idl";
  27. import "ocidl.idl";
  28. import "IWebError.idl";
  29. import "IWebDataSource.idl";
  30. #endif
  31. interface IWebError;
  32. interface IWebDataSource;
  33. /*!
  34. @protocol WebDocumentView
  35. @discussion Protocol implemented by the document view of WebFrameView
  36. @protocol WebDocumentView <NSObject>
  37. */
  38. [
  39. object,
  40. oleautomation,
  41. uuid(0A6397A7-90FE-49a0-B9C1-44693DD779F7),
  42. pointer_default(unique)
  43. ]
  44. interface IWebDocumentView : IUnknown
  45. {
  46. /*!
  47. @method setDataSource:
  48. @abstract Called when the corresponding data source has been created.
  49. @param dataSource The corresponding data source.
  50. - (void)setDataSource:(WebDataSource *)dataSource;
  51. */
  52. HRESULT setDataSource([in] IWebDataSource* dataSource);
  53. /*!
  54. @method dataSourceUpdated:
  55. @abstract Called when the corresponding data source has received data.
  56. @param dataSource The corresponding data source.
  57. - (void)dataSourceUpdated:(WebDataSource *)dataSource;
  58. */
  59. HRESULT dataSourceUpdated([in] IWebDataSource* dataSource);
  60. /*!
  61. @method setNeedsLayout:
  62. @discussion Called when WebKit has determined that the document view needs to layout.
  63. This method should simply set a flag and call layout from drawRect if the flag is YES.
  64. @param flag YES to cause a layout, no to not cause a layout.
  65. - (void)setNeedsLayout:(BOOL)flag;
  66. */
  67. HRESULT setNeedsLayout([in] BOOL flag);
  68. /*!
  69. @method layout
  70. @discussion Called when the document view must immediately layout. For simple views,
  71. setting the frame is a sufficient implementation of this method.
  72. - (void)layout;
  73. */
  74. HRESULT layout();
  75. /*!
  76. @method viewWillMoveToHostWindow:
  77. @param hostWindow The host window for the document view.
  78. @abstract Called before the host window is set on the parent web view.
  79. - (void)viewWillMoveToHostWindow:(NSWindow *)hostWindow;
  80. */
  81. HRESULT viewWillMoveToHostWindow([in] OLE_HANDLE hwnd);
  82. /*!
  83. @method viewDidMoveToHostWindow
  84. @abstract Called after the host window is set on the parent web view.
  85. - (void)viewDidMoveToHostWindow;
  86. */
  87. HRESULT viewDidMoveToHostWindow();
  88. }
  89. /*!
  90. @protocol WebDocumentSearching
  91. @discussion Optional protocol for searching document view of WebFrameView.
  92. @protocol WebDocumentSearching <NSObject>
  93. */
  94. [
  95. object,
  96. oleautomation,
  97. uuid(0213643B-8DF9-4ba4-9534-61D92CB75007),
  98. pointer_default(unique)
  99. ]
  100. interface IWebDocumentSearching : IUnknown
  101. {
  102. /*!
  103. @method searchFor:direction:caseSensitive:wrap:
  104. @abstract Searches a document view for a string and highlights the string if it is found.
  105. @param string The string to search for.
  106. @param forward YES to search forward, NO to seach backwards.
  107. @param caseFlag YES to for case-sensitive search, NO for case-insensitive search.
  108. @param wrapFlag YES to wrap around, NO to avoid wrapping.
  109. @result YES if found, NO if not found.
  110. - (BOOL)searchFor:(NSString *)string direction:(BOOL)forward caseSensitive:(BOOL)caseFlag wrap:(BOOL)wrapFlag;
  111. */
  112. HRESULT searchFor([in] BSTR str, [in] BOOL forwardDirection, [in] BOOL caseSensitive, [in] BOOL wrap, [out, retval] BOOL* result);
  113. }
  114. /*!
  115. @protocol WebDocumentText
  116. @discussion Optional protocol for supporting text operations.
  117. @protocol WebDocumentText <NSObject>
  118. */
  119. [
  120. object,
  121. oleautomation,
  122. uuid(B6282B92-6F31-4948-A3A0-89763C56BBBF),
  123. pointer_default(unique)
  124. ]
  125. interface IWebDocumentText : IUnknown
  126. {
  127. /*!
  128. @method supportsTextEncoding
  129. @result YES if the document view support text encoding, NO if it doesn't.
  130. - (BOOL)supportsTextEncoding;
  131. */
  132. HRESULT supportsTextEncoding([out, retval] BOOL* result);
  133. /*!
  134. @method string
  135. @result String that represents the entire document.
  136. - (NSString *)string;
  137. */
  138. HRESULT string([out, retval] BSTR* result);
  139. /*!
  140. @method selectedString
  141. @result String that represents the current selection.
  142. - (NSString *)selectedString;
  143. */
  144. HRESULT selectedString([out, retval] BSTR* result);
  145. /*!
  146. @method selectAll
  147. @abstract Selects all the text in the document.
  148. - (void)selectAll;
  149. */
  150. HRESULT selectAll();
  151. /*!
  152. @method deselectText
  153. @abstract Causes a text selection to lose its selection.
  154. - (void)deselectAll;
  155. */
  156. HRESULT deselectAll();
  157. }
  158. /*!
  159. @protocol WebDocumentRepresentation
  160. @discussion Protocol implemented by the document representation of a data source.
  161. @protocol WebDocumentRepresentation <NSObject>
  162. */
  163. [
  164. object,
  165. oleautomation,
  166. uuid(3C9F6251-CFD8-447a-B429-6B6AE627436C),
  167. pointer_default(unique)
  168. ]
  169. interface IWebDocumentRepresentation : IUnknown
  170. {
  171. /*!
  172. @method setDataSource:
  173. @abstract Called soon after the document representation is created.
  174. @param dataSource The data source that is set.
  175. - (void)setDataSource:(WebDataSource *)dataSource;
  176. */
  177. HRESULT setDataSource([in] IWebDataSource* dataSource);
  178. /*!
  179. @method receivedData:withDataSource:
  180. @abstract Called when the data source has received data.
  181. @param data The data that the data source has received.
  182. @param dataSource The data source that has received data.
  183. - (void)receivedData:(NSData *)data withDataSource:(WebDataSource *)dataSource;
  184. */
  185. HRESULT receivedData([in] IStream* data, [in] IWebDataSource* dataSource);
  186. /*!
  187. @method receivedError:withDataSource:
  188. @abstract Called when the data source has received an error.
  189. @param error The error that the data source has received.
  190. @param dataSource The data source that has received the error.
  191. - (void)receivedError:(NSError *)error withDataSource:(WebDataSource *)dataSource;
  192. */
  193. HRESULT receivedError([in] IWebError* error, [in] IWebDataSource* dataSource);
  194. /*!
  195. @method finishedLoadingWithDataSource:
  196. @abstract Called when the data source has finished loading.
  197. @param dataSource The datasource that has finished loading.
  198. - (void)finishedLoadingWithDataSource:(WebDataSource *)dataSource;
  199. */
  200. HRESULT finishedLoadingWithDataSource([in] IWebDataSource* dataSource);
  201. /*!
  202. @method canProvideDocumentSource
  203. @result Returns true if the representation can provide document source.
  204. - (BOOL)canProvideDocumentSource;
  205. */
  206. HRESULT canProvideDocumentSource([out, retval] BOOL* result);
  207. /*!
  208. @method documentSource
  209. @result Returns the textual source representation of the document. For HTML documents
  210. this is the original HTML source.
  211. - (NSString *)documentSource;
  212. */
  213. HRESULT documentSource([out, retval] BSTR* source);
  214. /*!
  215. @method title
  216. @result Return the title for the document.
  217. - (NSString *)title;
  218. */
  219. HRESULT title([out, retval] BSTR* docTitle);
  220. }