1/*
2 * Copyright (C) 2006, 2007 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 WebHTMLRepresentation_H
27#define WebHTMLRepresentation_H
28
29#include "WebKit.h"
30
31class WebFrame;
32
33class WebHTMLRepresentation : public IWebHTMLRepresentation, IWebDocumentRepresentation
34{
35public:
36    static WebHTMLRepresentation* createInstance(WebFrame* frame);
37protected:
38    WebHTMLRepresentation();
39    ~WebHTMLRepresentation();
40public:
41
42    // IUnknown
43    virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
44    virtual ULONG STDMETHODCALLTYPE AddRef();
45    virtual ULONG STDMETHODCALLTYPE Release();
46
47    // IWebHTMLRepresentation
48    virtual HRESULT STDMETHODCALLTYPE supportedMIMETypes(
49        /* [out][in] */ BSTR* types,
50        /* [out][in] */ int* cTypes);
51
52    virtual HRESULT STDMETHODCALLTYPE supportedNonImageMIMETypes(
53        /* [out][in] */ BSTR* types,
54        /* [out][in] */ int* cTypes);
55
56    virtual HRESULT STDMETHODCALLTYPE supportedImageMIMETypes(
57        /* [out][in] */ BSTR* types,
58        /* [out][in] */ int* cTypes);
59
60    virtual HRESULT STDMETHODCALLTYPE attributedStringFromDOMNodes(
61        /* [in] */ IDOMNode* startNode,
62        /* [in] */ int startOffset,
63        /* [in] */ IDOMNode* endNode,
64        /* [in] */ int endOffset,
65        /* [retval][out] */ IDataObject** attributedString);
66
67    virtual HRESULT STDMETHODCALLTYPE elementWithName(
68        /* [in] */ BSTR name,
69        /* [in] */ IDOMElement* form,
70        /* [retval][out] */ IDOMElement** element);
71
72    virtual HRESULT STDMETHODCALLTYPE elementDoesAutoComplete(
73        /* [in] */ IDOMElement* element,
74        /* [retval][out] */ BOOL* result);
75
76    virtual HRESULT STDMETHODCALLTYPE elementIsPassword(
77        /* [in] */ IDOMElement* element,
78        /* [retval][out] */ BOOL* result);
79
80    virtual HRESULT STDMETHODCALLTYPE formForElement(
81        /* [in] */ IDOMElement* element,
82        /* [retval][out] */ IDOMElement** form);
83
84    virtual HRESULT STDMETHODCALLTYPE currentForm(
85        /* [retval][out] */ IDOMElement** form);
86
87    virtual HRESULT STDMETHODCALLTYPE controlsInForm(
88        /* [in] */ IDOMElement* form,
89        /* [out][in] */ IDOMElement** controls,
90        /* [out][in] */ int* cControls);
91
92    /* Deprecated. Use the variant that includes resultDistance and resultIsInCellAbove instead. */
93    virtual HRESULT STDMETHODCALLTYPE deprecatedSearchForLabels(
94        /* [size_is][in] */ BSTR *labels,
95        /* [in] */ int cLabels,
96        /* [in] */ IDOMElement *beforeElement,
97        /* [retval][out] */ BSTR *result);
98
99    virtual HRESULT STDMETHODCALLTYPE matchLabels(
100        /* [size_is][in] */ BSTR *labels,
101        /* [in] */ int cLabels,
102        /* [in] */ IDOMElement *againstElement,
103        /* [retval][out] */ BSTR *result);
104
105    virtual HRESULT STDMETHODCALLTYPE searchForLabels(BSTR* labels, unsigned cLabels, IDOMElement* beforeElement, unsigned* resultDistance, BOOL* resultIsInCellAbove, BSTR* result);
106
107    // IWebDocumentRepresentation
108    virtual HRESULT STDMETHODCALLTYPE setDataSource(
109        /* [in] */ IWebDataSource* dataSource);
110
111    virtual HRESULT STDMETHODCALLTYPE receivedData(
112        /* [in] */ IStream* data,
113        /* [in] */ IWebDataSource* dataSource);
114
115    virtual HRESULT STDMETHODCALLTYPE receivedError(
116        /* [in] */ IWebError* error,
117        /* [in] */ IWebDataSource* dataSource);
118
119    virtual HRESULT STDMETHODCALLTYPE finishedLoadingWithDataSource(
120        /* [in] */ IWebDataSource* dataSource);
121
122    virtual HRESULT STDMETHODCALLTYPE canProvideDocumentSource(
123        /* [retval][out] */ BOOL* result);
124
125    virtual HRESULT STDMETHODCALLTYPE documentSource(
126        /* [retval][out] */ BSTR* source);
127
128    virtual HRESULT STDMETHODCALLTYPE title(
129        /* [retval][out] */ BSTR* docTitle);
130
131protected:
132    ULONG m_refCount;
133    WebFrame* m_frame;
134};
135
136#endif
137