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 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 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 "DOMCore.idl";
30import "IWebResource.idl";
31#endif
32
33interface IWebResource;
34
35/*!
36    @class WebArchive
37    @discussion WebArchive represents a main resource as well as all the subresources and subframes associated with the main resource.
38    The main resource can be an entire web page, a portion of a web page, or some other kind of data such as an image.
39    This class can be used for saving standalone web pages, representing portions of a web page on the pasteboard, or any other
40    application where one class is needed to represent rich web content.
41*/
42[
43    object,
44    oleautomation,
45    uuid(F07D5252-F66E-4a4d-B9DC-33BD11DCC138),
46    pointer_default(unique)
47]
48interface IWebArchive : IUnknown
49{
50    /*!
51        @method initWithMainResource:subresources:subframeArchives:
52        @abstract The initializer for WebArchive.
53        @param mainResource The main resource of the archive.
54        @param subresources The subresources of the archive (can be nil).
55        @param subframeArchives The archives representing the subframes of the archive (can be nil).
56        @result An initialized WebArchive.
57        - (id)initWithMainResource:(WebResource *)mainResource subresources:(NSArray *)subresources subframeArchives:(NSArray *)subframeArchives;
58    */
59    HRESULT initWithMainResource([in] IWebResource* mainResource, [in, size_is(cSubResources)] IWebResource** subResources, [in] int cSubResources, [in, size_is(cSubFrameArchives)] IWebArchive** subFrameArchives, [in] int cSubFrameArchives);
60
61    /*!
62        @method initWithData:
63        @abstract The initializer for creating a WebArchive from data.
64        @param data The data representing the archive. This can be obtained using WebArchive's data method.
65        @result An initialized WebArchive.
66        - (id)initWithData:(NSData *)data;
67    */
68    HRESULT initWithData([in] IStream* data);
69
70    /*!
71        @method initWithData:
72        @abstract The initializer for creating a WebArchive from data.
73        @param data The data representing the archive. This can be obtained using WebArchive's data method.
74        @result An initialized WebArchive.
75        - (id)initWithData:(NSData *)data;
76    */
77    HRESULT initWithNode([in] IDOMNode* node);
78
79    /*!
80        @method mainResource
81        @result The main resource of the archive.
82        - (WebResource *)mainResource;
83    */
84    HRESULT mainResource([out, retval] IWebResource** resource);
85
86    /*!
87        @method subresources
88        @result The subresource of the archive (can be nil).
89        - (NSArray *)subresources;
90    */
91    HRESULT subResources([out, retval] IEnumVARIANT** enumResources);
92
93    /*!
94        @method subframeArchives
95        @result The archives representing the subframes of the archive (can be nil).
96        - (NSArray *)subframeArchives;
97    */
98    HRESULT subframeArchives([out, retval] IEnumVARIANT** enumSubframes);
99
100    /*!
101        @method data
102        @result The data representation of the archive.
103        @discussion The data returned by this method can be used to save a web archive to a file or to place a web archive on the pasteboard
104        using WebArchivePboardType. To create a WebArchive using the returned data, call initWithData:.
105        - (NSData *)data;
106    */
107    HRESULT data([out, retval] IStream** stream);
108}
109