~ubuntu-wine/ubuntu/lucid/wine1.2/wine1.2+winepulse

« back to all changes in this revision

Viewing changes to dlls/mshtml/htmlframe.c

  • Committer: Bazaar Package Importer
  • Author(s): Scott Ritchie
  • Date: 2010-02-02 11:15:03 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20100202111503-w4ayji21ei1ginjr
Tags: 1.1.37-0ubuntu1
* New upstream release
  - A number of fixes in AVI file support.
  - Several MSXML improvements.
  - A few MSI fixes.
  - Various bug fixes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2010 Jacek Caban for CodeWeavers
 
3
 *
 
4
 * This library is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU Lesser General Public
 
6
 * License as published by the Free Software Foundation; either
 
7
 * version 2.1 of the License, or (at your option) any later version.
 
8
 *
 
9
 * This library is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
 * Lesser General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU Lesser General Public
 
15
 * License along with this library; if not, write to the Free Software
 
16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 
17
 */
 
18
 
 
19
#include <stdarg.h>
 
20
 
 
21
#define COBJMACROS
 
22
 
 
23
#include "windef.h"
 
24
#include "winbase.h"
 
25
#include "winuser.h"
 
26
#include "ole2.h"
 
27
 
 
28
#include "mshtml_private.h"
 
29
 
 
30
#include "wine/debug.h"
 
31
 
 
32
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
 
33
 
 
34
typedef struct {
 
35
    HTMLFrameBase framebase;
 
36
    const IHTMLFrameElement3Vtbl  *lpIHTMLFrameElement3Vtbl;
 
37
} HTMLFrameElement;
 
38
 
 
39
#define HTMLFRAMEELEM3(x)   ((IHTMLFrameElement3*)  &(x)->lpIHTMLFrameElement3Vtbl)
 
40
 
 
41
#define HTMLFRAME3_THIS(iface) DEFINE_THIS(HTMLFrameElement, IHTMLFrameElement3, iface)
 
42
 
 
43
static HRESULT WINAPI HTMLFrameElement3_QueryInterface(IHTMLFrameElement3 *iface,
 
44
        REFIID riid, void **ppv)
 
45
{
 
46
    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
 
47
 
 
48
    return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->framebase.element.node), riid, ppv);
 
49
}
 
50
 
 
51
static ULONG WINAPI HTMLFrameElement3_AddRef(IHTMLFrameElement3 *iface)
 
52
{
 
53
    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
 
54
 
 
55
    return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->framebase.element.node));
 
56
}
 
57
 
 
58
static ULONG WINAPI HTMLFrameElement3_Release(IHTMLFrameElement3 *iface)
 
59
{
 
60
    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
 
61
 
 
62
    return IHTMLDOMNode_Release(HTMLDOMNODE(&This->framebase.element.node));
 
63
}
 
64
 
 
65
static HRESULT WINAPI HTMLFrameElement3_GetTypeInfoCount(IHTMLFrameElement3 *iface, UINT *pctinfo)
 
66
{
 
67
    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
 
68
    return IDispatchEx_GetTypeInfoCount(DISPATCHEX(&This->framebase.element.node.dispex), pctinfo);
 
69
}
 
70
 
 
71
static HRESULT WINAPI HTMLFrameElement3_GetTypeInfo(IHTMLFrameElement3 *iface, UINT iTInfo,
 
72
        LCID lcid, ITypeInfo **ppTInfo)
 
73
{
 
74
    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
 
75
    return IDispatchEx_GetTypeInfo(DISPATCHEX(&This->framebase.element.node.dispex), iTInfo, lcid, ppTInfo);
 
76
}
 
77
 
 
78
static HRESULT WINAPI HTMLFrameElement3_GetIDsOfNames(IHTMLFrameElement3 *iface, REFIID riid,
 
79
        LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 
80
{
 
81
    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
 
82
    return IDispatchEx_GetIDsOfNames(DISPATCHEX(&This->framebase.element.node.dispex), riid, rgszNames, cNames, lcid, rgDispId);
 
83
}
 
84
 
 
85
static HRESULT WINAPI HTMLFrameElement3_Invoke(IHTMLFrameElement3 *iface, DISPID dispIdMember,
 
86
        REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
 
87
        VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 
88
{
 
89
    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
 
90
    return IDispatchEx_Invoke(DISPATCHEX(&This->framebase.element.node.dispex), dispIdMember, riid,
 
91
            lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
 
92
}
 
93
 
 
94
static HRESULT WINAPI HTMLFrameElement3_get_contentDocument(IHTMLFrameElement3 *iface, IDispatch **p)
 
95
{
 
96
    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
 
97
    IHTMLDocument2 *doc;
 
98
    HRESULT hres;
 
99
 
 
100
    TRACE("(%p)->(%p)\n", This, p);
 
101
 
 
102
    if(!This->framebase.content_window) {
 
103
        FIXME("NULL window\n");
 
104
        return E_FAIL;
 
105
    }
 
106
 
 
107
    hres = IHTMLWindow2_get_document(HTMLWINDOW2(This->framebase.content_window), &doc);
 
108
    if(FAILED(hres))
 
109
        return hres;
 
110
 
 
111
    *p = doc ? (IDispatch*)doc : NULL;
 
112
    return S_OK;
 
113
}
 
114
 
 
115
static HRESULT WINAPI HTMLFrameElement3_put_src(IHTMLFrameElement3 *iface, BSTR v)
 
116
{
 
117
    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
 
118
    FIXME("(%p)->(%s)\n", This, debugstr_w(v));
 
119
    return E_NOTIMPL;
 
120
}
 
121
 
 
122
static HRESULT WINAPI HTMLFrameElement3_get_src(IHTMLFrameElement3 *iface, BSTR *p)
 
123
{
 
124
    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
 
125
    FIXME("(%p)->(%p)\n", This, p);
 
126
    return E_NOTIMPL;
 
127
}
 
128
 
 
129
static HRESULT WINAPI HTMLFrameElement3_put_longDesc(IHTMLFrameElement3 *iface, BSTR v)
 
130
{
 
131
    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
 
132
    FIXME("(%p)->(%s)\n", This, debugstr_w(v));
 
133
    return E_NOTIMPL;
 
134
}
 
135
 
 
136
static HRESULT WINAPI HTMLFrameElement3_get_longDesc(IHTMLFrameElement3 *iface, BSTR *p)
 
137
{
 
138
    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
 
139
    FIXME("(%p)->(%p)\n", This, p);
 
140
    return E_NOTIMPL;
 
141
}
 
142
 
 
143
static HRESULT WINAPI HTMLFrameElement3_put_frameBorder(IHTMLFrameElement3 *iface, BSTR v)
 
144
{
 
145
    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
 
146
    FIXME("(%p)->(%s)\n", This, debugstr_w(v));
 
147
    return E_NOTIMPL;
 
148
}
 
149
 
 
150
static HRESULT WINAPI HTMLFrameElement3_get_frameBorder(IHTMLFrameElement3 *iface, BSTR *p)
 
151
{
 
152
    HTMLFrameElement *This = HTMLFRAME3_THIS(iface);
 
153
    FIXME("(%p)->(%p)\n", This, p);
 
154
    return E_NOTIMPL;
 
155
}
 
156
 
 
157
#undef HTMLFRAME3_THIS
 
158
 
 
159
static const IHTMLFrameElement3Vtbl HTMLFrameElement3Vtbl = {
 
160
    HTMLFrameElement3_QueryInterface,
 
161
    HTMLFrameElement3_AddRef,
 
162
    HTMLFrameElement3_Release,
 
163
    HTMLFrameElement3_GetTypeInfoCount,
 
164
    HTMLFrameElement3_GetTypeInfo,
 
165
    HTMLFrameElement3_GetIDsOfNames,
 
166
    HTMLFrameElement3_Invoke,
 
167
    HTMLFrameElement3_get_contentDocument,
 
168
    HTMLFrameElement3_put_src,
 
169
    HTMLFrameElement3_get_src,
 
170
    HTMLFrameElement3_put_longDesc,
 
171
    HTMLFrameElement3_get_longDesc,
 
172
    HTMLFrameElement3_put_frameBorder,
 
173
    HTMLFrameElement3_get_frameBorder
 
174
};
 
175
 
 
176
#define HTMLFRAME_NODE_THIS(iface) DEFINE_THIS2(HTMLFrameElement, framebase.element.node, iface)
 
177
 
 
178
static HRESULT HTMLFrameElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
 
179
{
 
180
    HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
 
181
 
 
182
    if(IsEqualGUID(&IID_IHTMLFrameElement3, riid)) {
 
183
        TRACE("(%p)->(IID_IHTMLFrameElement3 %p)\n", This, ppv);
 
184
        *ppv = HTMLFRAMEELEM3(This);
 
185
    }else {
 
186
        return HTMLFrameBase_QI(&This->framebase, riid, ppv);
 
187
    }
 
188
 
 
189
    IUnknown_AddRef((IUnknown*)*ppv);
 
190
    return S_OK;
 
191
}
 
192
 
 
193
static void HTMLFrameElement_destructor(HTMLDOMNode *iface)
 
194
{
 
195
    HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
 
196
 
 
197
    HTMLFrameBase_destructor(&This->framebase);
 
198
}
 
199
 
 
200
static HRESULT HTMLFrameElement_get_document(HTMLDOMNode *iface, IDispatch **p)
 
201
{
 
202
    HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
 
203
 
 
204
    if(!This->framebase.content_window || !This->framebase.content_window->doc) {
 
205
        *p = NULL;
 
206
        return S_OK;
 
207
    }
 
208
 
 
209
    *p = (IDispatch*)HTMLDOC(&This->framebase.content_window->doc->basedoc);
 
210
    IDispatch_AddRef(*p);
 
211
    return S_OK;
 
212
}
 
213
 
 
214
static HRESULT HTMLFrameElement_get_dispid(HTMLDOMNode *iface, BSTR name,
 
215
        DWORD grfdex, DISPID *pid)
 
216
{
 
217
    HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
 
218
 
 
219
    if(!This->framebase.content_window)
 
220
        return DISP_E_UNKNOWNNAME;
 
221
 
 
222
    return search_window_props(This->framebase.content_window, name, grfdex, pid);
 
223
}
 
224
 
 
225
static HRESULT HTMLFrameElement_invoke(HTMLDOMNode *iface, DISPID id, LCID lcid,
 
226
        WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller)
 
227
{
 
228
    HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
 
229
 
 
230
    if(!This->framebase.content_window) {
 
231
        ERR("no content window to invoke on\n");
 
232
        return E_FAIL;
 
233
    }
 
234
 
 
235
    return IDispatchEx_InvokeEx(DISPATCHEX(This->framebase.content_window), id, lcid, flags, params, res, ei, caller);
 
236
}
 
237
 
 
238
static HRESULT HTMLFrameElement_bind_to_tree(HTMLDOMNode *iface)
 
239
{
 
240
    HTMLFrameElement *This = HTMLFRAME_NODE_THIS(iface);
 
241
    nsIDOMDocument *nsdoc;
 
242
    nsresult nsres;
 
243
    HRESULT hres;
 
244
 
 
245
    nsres = nsIDOMHTMLFrameElement_GetContentDocument(This->framebase.nsframe, &nsdoc);
 
246
    if(NS_FAILED(nsres) || !nsdoc) {
 
247
        ERR("GetContentDocument failed: %08x\n", nsres);
 
248
        return E_FAIL;
 
249
    }
 
250
 
 
251
    hres = set_frame_doc(&This->framebase, nsdoc);
 
252
    nsIDOMDocument_Release(nsdoc);
 
253
    return hres;
 
254
}
 
255
 
 
256
#undef HTMLFRAME_NODE_THIS
 
257
 
 
258
static const NodeImplVtbl HTMLFrameElementImplVtbl = {
 
259
    HTMLFrameElement_QI,
 
260
    HTMLFrameElement_destructor,
 
261
    NULL,
 
262
    NULL,
 
263
    NULL,
 
264
    NULL,
 
265
    HTMLFrameElement_get_document,
 
266
    NULL,
 
267
    HTMLFrameElement_get_dispid,
 
268
    HTMLFrameElement_invoke,
 
269
    HTMLFrameElement_bind_to_tree
 
270
};
 
271
 
 
272
static const tid_t HTMLFrameElement_iface_tids[] = {
 
273
    IHTMLDOMNode_tid,
 
274
    IHTMLDOMNode2_tid,
 
275
    IHTMLElement_tid,
 
276
    IHTMLElement2_tid,
 
277
    IHTMLElement3_tid,
 
278
    IHTMLFrameBase_tid,
 
279
    IHTMLFrameBase2_tid,
 
280
    IHTMLFrameElement3_tid,
 
281
    0
 
282
};
 
283
 
 
284
static dispex_static_data_t HTMLFrameElement_dispex = {
 
285
    NULL,
 
286
    DispHTMLFrameElement_tid,
 
287
    NULL,
 
288
    HTMLFrameElement_iface_tids
 
289
};
 
290
 
 
291
HTMLElement *HTMLFrameElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nselem)
 
292
{
 
293
    HTMLFrameElement *ret;
 
294
 
 
295
    ret = heap_alloc_zero(sizeof(HTMLFrameElement));
 
296
 
 
297
    ret->framebase.element.node.vtbl = &HTMLFrameElementImplVtbl;
 
298
    ret->lpIHTMLFrameElement3Vtbl = &HTMLFrameElement3Vtbl;
 
299
 
 
300
    HTMLFrameBase_Init(&ret->framebase, doc, nselem, &HTMLFrameElement_dispex);
 
301
 
 
302
    return &ret->framebase.element;
 
303
}