wldap32: Fix winldap_private header compatibility with 64-bit.
[wine/wine64.git] / dlls / mshtml / htmliframe.c
blobf56bc16fda212dd55a0ffa26ad7a061e9864b6b0
1 /*
2 * Copyright 2008 Jacek Caban for CodeWeavers
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.
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.
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
19 #include <stdarg.h>
21 #define COBJMACROS
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "ole2.h"
28 #include "mshtml_private.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
34 typedef struct {
35 HTMLElement element;
36 const IHTMLFrameBase2Vtbl *lpIHTMLFrameBase2Vtbl;
38 LONG ref;
40 nsIDOMHTMLIFrameElement *nsiframe;
41 HTMLDocument *content_doc;
42 } HTMLIFrame;
44 #define HTMLFRAMEBASE2(x) ((IHTMLFrameBase2*) &(x)->lpIHTMLFrameBase2Vtbl)
46 #define HTMLFRAMEBASE2_THIS(iface) DEFINE_THIS(HTMLIFrame, IHTMLFrameBase2, iface)
48 static HRESULT WINAPI HTMLIFrameBase2_QueryInterface(IHTMLFrameBase2 *iface, REFIID riid, void **ppv)
50 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
52 return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->element.node), riid, ppv);
55 static ULONG WINAPI HTMLIFrameBase2_AddRef(IHTMLFrameBase2 *iface)
57 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
59 return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->element.node));
62 static ULONG WINAPI HTMLIFrameBase2_Release(IHTMLFrameBase2 *iface)
64 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
66 return IHTMLDOMNode_Release(HTMLDOMNODE(&This->element.node));
69 static HRESULT WINAPI HTMLIFrameBase2_GetTypeInfoCount(IHTMLFrameBase2 *iface, UINT *pctinfo)
71 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
72 FIXME("(%p)\n", This);
73 return E_NOTIMPL;
76 static HRESULT WINAPI HTMLIFrameBase2_GetTypeInfo(IHTMLFrameBase2 *iface, UINT iTInfo,
77 LCID lcid, ITypeInfo **ppTInfo)
79 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
80 FIXME("(%p)\n", This);
81 return E_NOTIMPL;
84 static HRESULT WINAPI HTMLIFrameBase2_GetIDsOfNames(IHTMLFrameBase2 *iface, REFIID riid,
85 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
87 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
88 FIXME("(%p)\n", This);
89 return E_NOTIMPL;
92 static HRESULT WINAPI HTMLIFrameBase2_Invoke(IHTMLFrameBase2 *iface, DISPID dispIdMember,
93 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
94 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
96 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
97 FIXME("(%p)\n", This);
98 return E_NOTIMPL;
101 static HRESULT WINAPI HTMLIFrameBase2_get_contentWindow(IHTMLFrameBase2 *iface, IHTMLWindow2 **p)
103 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
105 TRACE("(%p)->(%p)\n", This, p);
107 if(!This->content_doc) {
108 nsIDOMHTMLDocument *nshtmldoc;
109 nsIDOMDocument *nsdoc;
110 nsresult nsres;
111 HRESULT hres;
113 nsres = nsIDOMHTMLIFrameElement_GetContentDocument(This->nsiframe, &nsdoc);
114 if(NS_FAILED(nsres)) {
115 ERR("GetContentDocument failed: %08x\n", nsres);
116 return E_FAIL;
119 if(!nsdoc) {
120 FIXME("NULL contentDocument\n");
121 return E_FAIL;
124 nsres = nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMHTMLDocument, (void**)&nshtmldoc);
125 nsIDOMDocument_Release(nsdoc);
126 if(NS_FAILED(nsres)) {
127 ERR("Could not get nsIDOMHTMLDocument iface: %08x\n", nsres);
128 return E_FAIL;
131 hres = create_doc_from_nsdoc(nshtmldoc, &This->content_doc);
132 nsIDOMHTMLDocument_Release(nshtmldoc);
133 if(FAILED(hres))
134 return hres;
137 return IHTMLDocument2_get_parentWindow(HTMLDOC(This->content_doc), p);
140 static HRESULT WINAPI HTMLIFrameBase2_put_onload(IHTMLFrameBase2 *iface, VARIANT v)
142 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
143 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
144 return E_NOTIMPL;
147 static HRESULT WINAPI HTMLIFrameBase2_get_onload(IHTMLFrameBase2 *iface, VARIANT *p)
149 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
150 FIXME("(%p)->(%p)\n", This, p);
151 return E_NOTIMPL;
154 static HRESULT WINAPI HTMLIFrameBase2_put_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT v)
156 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
157 FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
158 return E_NOTIMPL;
161 static HRESULT WINAPI HTMLIFrameBase2_get_onreadystatechange(IHTMLFrameBase2 *iface, VARIANT *p)
163 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
164 FIXME("(%p)->(%p)\n", This, p);
165 return E_NOTIMPL;
168 static HRESULT WINAPI HTMLIFrameBase2_get_readyState(IHTMLFrameBase2 *iface, BSTR *p)
170 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
171 FIXME("(%p)->(%p)\n", This, p);
172 return E_NOTIMPL;
175 static HRESULT WINAPI HTMLIFrameBase2_put_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL v)
177 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
178 FIXME("(%p)->(%x)\n", This, v);
179 return E_NOTIMPL;
182 static HRESULT WINAPI HTMLIFrameBase2_get_allowTransparency(IHTMLFrameBase2 *iface, VARIANT_BOOL *p)
184 HTMLIFrame *This = HTMLFRAMEBASE2_THIS(iface);
185 FIXME("(%p)->(%p)\n", This, p);
186 return E_NOTIMPL;
189 #undef HTMLFRAMEBASE2_THIS
191 static const IHTMLFrameBase2Vtbl HTMLIFrameBase2Vtbl = {
192 HTMLIFrameBase2_QueryInterface,
193 HTMLIFrameBase2_AddRef,
194 HTMLIFrameBase2_Release,
195 HTMLIFrameBase2_GetTypeInfoCount,
196 HTMLIFrameBase2_GetTypeInfo,
197 HTMLIFrameBase2_GetIDsOfNames,
198 HTMLIFrameBase2_Invoke,
199 HTMLIFrameBase2_get_contentWindow,
200 HTMLIFrameBase2_put_onload,
201 HTMLIFrameBase2_get_onload,
202 HTMLIFrameBase2_put_onreadystatechange,
203 HTMLIFrameBase2_get_onreadystatechange,
204 HTMLIFrameBase2_get_readyState,
205 HTMLIFrameBase2_put_allowTransparency,
206 HTMLIFrameBase2_get_allowTransparency
209 #define HTMLIFRAME_NODE_THIS(iface) DEFINE_THIS2(HTMLIFrame, element.node, iface)
211 static HRESULT HTMLIFrame_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
213 HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface);
215 *ppv = NULL;
217 if(IsEqualGUID(&IID_IHTMLFrameBase2, riid)) {
218 TRACE("(%p)->(IID_IHTMLFrameBase2 %p)\n", This, ppv);
219 *ppv = HTMLFRAMEBASE2(This);
220 }else {
221 return HTMLElement_QI(&This->element.node, riid, ppv);
224 IUnknown_AddRef((IUnknown*)*ppv);
225 return S_OK;
228 static void HTMLIFrame_destructor(HTMLDOMNode *iface)
230 HTMLIFrame *This = HTMLIFRAME_NODE_THIS(iface);
232 if(This->content_doc)
233 IHTMLDocument2_Release(HTMLDOC(This->content_doc));
234 if(This->nsiframe)
235 nsIDOMHTMLIFrameElement_Release(This->nsiframe);
237 HTMLElement_destructor(&This->element.node);
240 #undef HTMLIFRAME_NODE_THIS
242 static const NodeImplVtbl HTMLIFrameImplVtbl = {
243 HTMLIFrame_QI,
244 HTMLIFrame_destructor
247 static const tid_t HTMLIFrame_iface_tids[] = {
248 IHTMLDOMNode_tid,
249 IHTMLDOMNode2_tid,
250 IHTMLElement_tid,
251 IHTMLElement2_tid,
252 IHTMLElement3_tid,
253 IHTMLFrameBase2_tid,
257 static dispex_static_data_t HTMLIFrame_dispex = {
258 NULL,
259 DispHTMLIFrame_tid,
260 NULL,
261 HTMLIFrame_iface_tids
264 HTMLElement *HTMLIFrame_Create(nsIDOMHTMLElement *nselem)
266 HTMLIFrame *ret;
267 nsresult nsres;
269 ret = heap_alloc_zero(sizeof(HTMLIFrame));
271 ret->lpIHTMLFrameBase2Vtbl = &HTMLIFrameBase2Vtbl;
272 ret->element.node.vtbl = &HTMLIFrameImplVtbl;
274 init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLFRAMEBASE2(ret), &HTMLIFrame_dispex);
275 HTMLElement_Init(&ret->element);
277 nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLIFrameElement, (void**)&ret->nsiframe);
278 if(NS_FAILED(nsres))
279 ERR("Could not get nsIDOMHTMLIFrameElement iface: %08x\n", nsres);
281 return &ret->element;