Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenhtmldoc.c
Go to the documentation of this file.
00001 /* 00002 * Copyright 2005-2009 Jacek Caban for CodeWeavers 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this library; if not, write to the Free Software 00016 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00017 */ 00018 00019 #include "config.h" 00020 00021 #include <stdarg.h> 00022 #include <stdio.h> 00023 00024 #define COBJMACROS 00025 00026 #include "windef.h" 00027 #include "winbase.h" 00028 #include "winuser.h" 00029 #include "wininet.h" 00030 #include "ole2.h" 00031 #include "perhist.h" 00032 #include "mshtmdid.h" 00033 00034 #include "wine/debug.h" 00035 00036 #include "mshtml_private.h" 00037 #include "htmlevent.h" 00038 00039 WINE_DEFAULT_DEBUG_CHANNEL(mshtml); 00040 00041 #define HTMLDOC_THIS(iface) DEFINE_THIS(HTMLDocument, HTMLDocument2, iface) 00042 00043 static HRESULT WINAPI HTMLDocument_QueryInterface(IHTMLDocument2 *iface, REFIID riid, void **ppv) 00044 { 00045 HTMLDocument *This = HTMLDOC_THIS(iface); 00046 00047 return htmldoc_query_interface(This, riid, ppv); 00048 } 00049 00050 static ULONG WINAPI HTMLDocument_AddRef(IHTMLDocument2 *iface) 00051 { 00052 HTMLDocument *This = HTMLDOC_THIS(iface); 00053 00054 return htmldoc_addref(This); 00055 } 00056 00057 static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface) 00058 { 00059 HTMLDocument *This = HTMLDOC_THIS(iface); 00060 00061 return htmldoc_release(This); 00062 } 00063 00064 static HRESULT WINAPI HTMLDocument_GetTypeInfoCount(IHTMLDocument2 *iface, UINT *pctinfo) 00065 { 00066 HTMLDocument *This = HTMLDOC_THIS(iface); 00067 00068 return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This), pctinfo); 00069 } 00070 00071 static HRESULT WINAPI HTMLDocument_GetTypeInfo(IHTMLDocument2 *iface, UINT iTInfo, 00072 LCID lcid, ITypeInfo **ppTInfo) 00073 { 00074 HTMLDocument *This = HTMLDOC_THIS(iface); 00075 00076 return IDispatchEx_GetTypeInfo(DISPATCHEX(This), iTInfo, lcid, ppTInfo); 00077 } 00078 00079 static HRESULT WINAPI HTMLDocument_GetIDsOfNames(IHTMLDocument2 *iface, REFIID riid, 00080 LPOLESTR *rgszNames, UINT cNames, 00081 LCID lcid, DISPID *rgDispId) 00082 { 00083 HTMLDocument *This = HTMLDOC_THIS(iface); 00084 00085 return IDispatchEx_GetIDsOfNames(DISPATCHEX(This), riid, rgszNames, cNames, lcid, rgDispId); 00086 } 00087 00088 static HRESULT WINAPI HTMLDocument_Invoke(IHTMLDocument2 *iface, DISPID dispIdMember, 00089 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, 00090 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) 00091 { 00092 HTMLDocument *This = HTMLDOC_THIS(iface); 00093 00094 return IDispatchEx_Invoke(DISPATCHEX(This), dispIdMember, riid, lcid, wFlags, pDispParams, 00095 pVarResult, pExcepInfo, puArgErr); 00096 } 00097 00098 static HRESULT WINAPI HTMLDocument_get_Script(IHTMLDocument2 *iface, IDispatch **p) 00099 { 00100 HTMLDocument *This = HTMLDOC_THIS(iface); 00101 00102 TRACE("(%p)->(%p)\n", This, p); 00103 00104 *p = (IDispatch*)HTMLWINDOW2(This->window); 00105 IDispatch_AddRef(*p); 00106 return S_OK; 00107 } 00108 00109 static HRESULT WINAPI HTMLDocument_get_all(IHTMLDocument2 *iface, IHTMLElementCollection **p) 00110 { 00111 HTMLDocument *This = HTMLDOC_THIS(iface); 00112 nsIDOMElement *nselem = NULL; 00113 nsresult nsres; 00114 00115 TRACE("(%p)->(%p)\n", This, p); 00116 00117 if(!This->doc_node->nsdoc) { 00118 WARN("NULL nsdoc\n"); 00119 return E_UNEXPECTED; 00120 } 00121 00122 nsres = nsIDOMHTMLDocument_GetDocumentElement(This->doc_node->nsdoc, &nselem); 00123 if(NS_FAILED(nsres)) { 00124 ERR("GetDocumentElement failed: %08x\n", nsres); 00125 return E_FAIL; 00126 } 00127 00128 if(nselem) { 00129 *p = create_all_collection(get_node(This->doc_node, (nsIDOMNode*)nselem, TRUE), TRUE); 00130 nsIDOMElement_Release(nselem); 00131 }else { 00132 *p = NULL; 00133 } 00134 00135 return S_OK; 00136 } 00137 00138 static HRESULT WINAPI HTMLDocument_get_body(IHTMLDocument2 *iface, IHTMLElement **p) 00139 { 00140 HTMLDocument *This = HTMLDOC_THIS(iface); 00141 nsIDOMHTMLElement *nsbody = NULL; 00142 HTMLDOMNode *node; 00143 nsresult nsres; 00144 00145 TRACE("(%p)->(%p)\n", This, p); 00146 00147 if(!This->doc_node->nsdoc) { 00148 WARN("NULL nsdoc\n"); 00149 return E_UNEXPECTED; 00150 } 00151 00152 nsres = nsIDOMHTMLDocument_GetBody(This->doc_node->nsdoc, &nsbody); 00153 if(NS_FAILED(nsres)) { 00154 TRACE("Could not get body: %08x\n", nsres); 00155 return E_UNEXPECTED; 00156 } 00157 00158 if(nsbody) { 00159 node = get_node(This->doc_node, (nsIDOMNode*)nsbody, TRUE); 00160 nsIDOMHTMLElement_Release(nsbody); 00161 00162 IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node), &IID_IHTMLElement, (void**)p); 00163 }else { 00164 *p = NULL; 00165 } 00166 00167 TRACE("*p = %p\n", *p); 00168 return S_OK; 00169 } 00170 00171 static HRESULT WINAPI HTMLDocument_get_activeElement(IHTMLDocument2 *iface, IHTMLElement **p) 00172 { 00173 HTMLDocument *This = HTMLDOC_THIS(iface); 00174 FIXME("(%p)->(%p)\n", This, p); 00175 return E_NOTIMPL; 00176 } 00177 00178 static HRESULT WINAPI HTMLDocument_get_images(IHTMLDocument2 *iface, IHTMLElementCollection **p) 00179 { 00180 HTMLDocument *This = HTMLDOC_THIS(iface); 00181 nsIDOMHTMLCollection *nscoll = NULL; 00182 nsresult nsres; 00183 00184 TRACE("(%p)->(%p)\n", This, p); 00185 00186 if(!p) 00187 return E_INVALIDARG; 00188 00189 *p = NULL; 00190 00191 if(!This->doc_node->nsdoc) { 00192 WARN("NULL nsdoc\n"); 00193 return E_UNEXPECTED; 00194 } 00195 00196 nsres = nsIDOMHTMLDocument_GetImages(This->doc_node->nsdoc, &nscoll); 00197 if(NS_FAILED(nsres)) { 00198 ERR("GetImages failed: %08x\n", nsres); 00199 return E_FAIL; 00200 } 00201 00202 if(nscoll) { 00203 *p = create_collection_from_htmlcol(This->doc_node, (IUnknown*)HTMLDOC(This), nscoll); 00204 nsIDOMElement_Release(nscoll); 00205 } 00206 00207 return S_OK; 00208 } 00209 00210 static HRESULT WINAPI HTMLDocument_get_applets(IHTMLDocument2 *iface, IHTMLElementCollection **p) 00211 { 00212 HTMLDocument *This = HTMLDOC_THIS(iface); 00213 nsIDOMHTMLCollection *nscoll = NULL; 00214 nsresult nsres; 00215 00216 TRACE("(%p)->(%p)\n", This, p); 00217 00218 if(!p) 00219 return E_INVALIDARG; 00220 00221 *p = NULL; 00222 00223 if(!This->doc_node->nsdoc) { 00224 WARN("NULL nsdoc\n"); 00225 return E_UNEXPECTED; 00226 } 00227 00228 nsres = nsIDOMHTMLDocument_GetApplets(This->doc_node->nsdoc, &nscoll); 00229 if(NS_FAILED(nsres)) { 00230 ERR("GetApplets failed: %08x\n", nsres); 00231 return E_FAIL; 00232 } 00233 00234 if(nscoll) { 00235 *p = create_collection_from_htmlcol(This->doc_node, (IUnknown*)HTMLDOC(This), nscoll); 00236 nsIDOMElement_Release(nscoll); 00237 } 00238 00239 return S_OK; 00240 } 00241 00242 static HRESULT WINAPI HTMLDocument_get_links(IHTMLDocument2 *iface, IHTMLElementCollection **p) 00243 { 00244 HTMLDocument *This = HTMLDOC_THIS(iface); 00245 nsIDOMHTMLCollection *nscoll = NULL; 00246 nsresult nsres; 00247 00248 TRACE("(%p)->(%p)\n", This, p); 00249 00250 if(!p) 00251 return E_INVALIDARG; 00252 00253 *p = NULL; 00254 00255 if(!This->doc_node->nsdoc) { 00256 WARN("NULL nsdoc\n"); 00257 return E_UNEXPECTED; 00258 } 00259 00260 nsres = nsIDOMHTMLDocument_GetLinks(This->doc_node->nsdoc, &nscoll); 00261 if(NS_FAILED(nsres)) { 00262 ERR("GetLinks failed: %08x\n", nsres); 00263 return E_FAIL; 00264 } 00265 00266 if(nscoll) { 00267 *p = create_collection_from_htmlcol(This->doc_node, (IUnknown*)HTMLDOC(This), nscoll); 00268 nsIDOMElement_Release(nscoll); 00269 } 00270 00271 return S_OK; 00272 } 00273 00274 static HRESULT WINAPI HTMLDocument_get_forms(IHTMLDocument2 *iface, IHTMLElementCollection **p) 00275 { 00276 HTMLDocument *This = HTMLDOC_THIS(iface); 00277 nsIDOMHTMLCollection *nscoll = NULL; 00278 nsresult nsres; 00279 00280 TRACE("(%p)->(%p)\n", This, p); 00281 00282 if(!p) 00283 return E_INVALIDARG; 00284 00285 *p = NULL; 00286 00287 if(!This->doc_node->nsdoc) { 00288 WARN("NULL nsdoc\n"); 00289 return E_UNEXPECTED; 00290 } 00291 00292 nsres = nsIDOMHTMLDocument_GetForms(This->doc_node->nsdoc, &nscoll); 00293 if(NS_FAILED(nsres)) { 00294 ERR("GetForms failed: %08x\n", nsres); 00295 return E_FAIL; 00296 } 00297 00298 if(nscoll) { 00299 *p = create_collection_from_htmlcol(This->doc_node, (IUnknown*)HTMLDOC(This), nscoll); 00300 nsIDOMElement_Release(nscoll); 00301 } 00302 00303 return S_OK; 00304 } 00305 00306 static HRESULT WINAPI HTMLDocument_get_anchors(IHTMLDocument2 *iface, IHTMLElementCollection **p) 00307 { 00308 HTMLDocument *This = HTMLDOC_THIS(iface); 00309 nsIDOMHTMLCollection *nscoll = NULL; 00310 nsresult nsres; 00311 00312 TRACE("(%p)->(%p)\n", This, p); 00313 00314 if(!p) 00315 return E_INVALIDARG; 00316 00317 *p = NULL; 00318 00319 if(!This->doc_node->nsdoc) { 00320 WARN("NULL nsdoc\n"); 00321 return E_UNEXPECTED; 00322 } 00323 00324 nsres = nsIDOMHTMLDocument_GetAnchors(This->doc_node->nsdoc, &nscoll); 00325 if(NS_FAILED(nsres)) { 00326 ERR("GetAnchors failed: %08x\n", nsres); 00327 return E_FAIL; 00328 } 00329 00330 if(nscoll) { 00331 *p = create_collection_from_htmlcol(This->doc_node, (IUnknown*)HTMLDOC(This), nscoll); 00332 nsIDOMElement_Release(nscoll); 00333 } 00334 00335 return S_OK; 00336 } 00337 00338 static HRESULT WINAPI HTMLDocument_put_title(IHTMLDocument2 *iface, BSTR v) 00339 { 00340 HTMLDocument *This = HTMLDOC_THIS(iface); 00341 nsAString nsstr; 00342 nsresult nsres; 00343 00344 TRACE("(%p)->(%s)\n", This, debugstr_w(v)); 00345 00346 if(!This->doc_node->nsdoc) { 00347 WARN("NULL nsdoc\n"); 00348 return E_UNEXPECTED; 00349 } 00350 00351 nsAString_InitDepend(&nsstr, v); 00352 nsres = nsIDOMHTMLDocument_SetTitle(This->doc_node->nsdoc, &nsstr); 00353 nsAString_Finish(&nsstr); 00354 if(NS_FAILED(nsres)) 00355 ERR("SetTitle failed: %08x\n", nsres); 00356 00357 return S_OK; 00358 } 00359 00360 static HRESULT WINAPI HTMLDocument_get_title(IHTMLDocument2 *iface, BSTR *p) 00361 { 00362 HTMLDocument *This = HTMLDOC_THIS(iface); 00363 const PRUnichar *ret; 00364 nsAString nsstr; 00365 nsresult nsres; 00366 00367 TRACE("(%p)->(%p)\n", This, p); 00368 00369 if(!This->doc_node->nsdoc) { 00370 WARN("NULL nsdoc\n"); 00371 return E_UNEXPECTED; 00372 } 00373 00374 00375 nsAString_Init(&nsstr, NULL); 00376 nsres = nsIDOMHTMLDocument_GetTitle(This->doc_node->nsdoc, &nsstr); 00377 if (NS_SUCCEEDED(nsres)) { 00378 nsAString_GetData(&nsstr, &ret); 00379 *p = SysAllocString(ret); 00380 } 00381 nsAString_Finish(&nsstr); 00382 00383 if(NS_FAILED(nsres)) { 00384 ERR("GetTitle failed: %08x\n", nsres); 00385 return E_FAIL; 00386 } 00387 00388 return S_OK; 00389 } 00390 00391 static HRESULT WINAPI HTMLDocument_get_scripts(IHTMLDocument2 *iface, IHTMLElementCollection **p) 00392 { 00393 HTMLDocument *This = HTMLDOC_THIS(iface); 00394 FIXME("(%p)->(%p)\n", This, p); 00395 return E_NOTIMPL; 00396 } 00397 00398 static HRESULT WINAPI HTMLDocument_put_designMode(IHTMLDocument2 *iface, BSTR v) 00399 { 00400 HTMLDocument *This = HTMLDOC_THIS(iface); 00401 FIXME("(%p)->(%s)\n", This, debugstr_w(v)); 00402 return E_NOTIMPL; 00403 } 00404 00405 static HRESULT WINAPI HTMLDocument_get_designMode(IHTMLDocument2 *iface, BSTR *p) 00406 { 00407 HTMLDocument *This = HTMLDOC_THIS(iface); 00408 static WCHAR szOff[] = {'O','f','f',0}; 00409 FIXME("(%p)->(%p) always returning Off\n", This, p); 00410 00411 if(!p) 00412 return E_INVALIDARG; 00413 00414 *p = SysAllocString(szOff); 00415 00416 return S_OK; 00417 } 00418 00419 static HRESULT WINAPI HTMLDocument_get_selection(IHTMLDocument2 *iface, IHTMLSelectionObject **p) 00420 { 00421 HTMLDocument *This = HTMLDOC_THIS(iface); 00422 nsISelection *nsselection; 00423 nsresult nsres; 00424 00425 TRACE("(%p)->(%p)\n", This, p); 00426 00427 nsres = nsIDOMWindow_GetSelection(This->window->nswindow, &nsselection); 00428 if(NS_FAILED(nsres)) { 00429 ERR("GetSelection failed: %08x\n", nsres); 00430 return E_FAIL; 00431 } 00432 00433 return HTMLSelectionObject_Create(This->doc_node, nsselection, p); 00434 } 00435 00436 static HRESULT WINAPI HTMLDocument_get_readyState(IHTMLDocument2 *iface, BSTR *p) 00437 { 00438 HTMLDocument *This = HTMLDOC_THIS(iface); 00439 00440 static const WCHAR wszUninitialized[] = {'u','n','i','n','i','t','i','a','l','i','z','e','d',0}; 00441 static const WCHAR wszLoading[] = {'l','o','a','d','i','n','g',0}; 00442 static const WCHAR wszLoaded[] = {'l','o','a','d','e','d',0}; 00443 static const WCHAR wszInteractive[] = {'i','n','t','e','r','a','c','t','i','v','e',0}; 00444 static const WCHAR wszComplete[] = {'c','o','m','p','l','e','t','e',0}; 00445 00446 static const LPCWSTR readystate_str[] = { 00447 wszUninitialized, 00448 wszLoading, 00449 wszLoaded, 00450 wszInteractive, 00451 wszComplete 00452 }; 00453 00454 TRACE("(%p)->(%p)\n", iface, p); 00455 00456 if(!p) 00457 return E_POINTER; 00458 00459 *p = SysAllocString(readystate_str[This->window->readystate]); 00460 return S_OK; 00461 } 00462 00463 static HRESULT WINAPI HTMLDocument_get_frames(IHTMLDocument2 *iface, IHTMLFramesCollection2 **p) 00464 { 00465 HTMLDocument *This = HTMLDOC_THIS(iface); 00466 FIXME("(%p)->(%p)\n", This, p); 00467 return E_NOTIMPL; 00468 } 00469 00470 static HRESULT WINAPI HTMLDocument_get_embeds(IHTMLDocument2 *iface, IHTMLElementCollection **p) 00471 { 00472 HTMLDocument *This = HTMLDOC_THIS(iface); 00473 FIXME("(%p)->(%p)\n", This, p); 00474 return E_NOTIMPL; 00475 } 00476 00477 static HRESULT WINAPI HTMLDocument_get_plugins(IHTMLDocument2 *iface, IHTMLElementCollection **p) 00478 { 00479 HTMLDocument *This = HTMLDOC_THIS(iface); 00480 FIXME("(%p)->(%p)\n", This, p); 00481 return E_NOTIMPL; 00482 } 00483 00484 static HRESULT WINAPI HTMLDocument_put_alinkColor(IHTMLDocument2 *iface, VARIANT v) 00485 { 00486 HTMLDocument *This = HTMLDOC_THIS(iface); 00487 FIXME("(%p)\n", This); 00488 return E_NOTIMPL; 00489 } 00490 00491 static HRESULT WINAPI HTMLDocument_get_alinkColor(IHTMLDocument2 *iface, VARIANT *p) 00492 { 00493 HTMLDocument *This = HTMLDOC_THIS(iface); 00494 FIXME("(%p)->(%p)\n", This, p); 00495 return E_NOTIMPL; 00496 } 00497 00498 static HRESULT WINAPI HTMLDocument_put_bgColor(IHTMLDocument2 *iface, VARIANT v) 00499 { 00500 HTMLDocument *This = HTMLDOC_THIS(iface); 00501 FIXME("(%p)\n", This); 00502 return E_NOTIMPL; 00503 } 00504 00505 static HRESULT WINAPI HTMLDocument_get_bgColor(IHTMLDocument2 *iface, VARIANT *p) 00506 { 00507 HTMLDocument *This = HTMLDOC_THIS(iface); 00508 FIXME("(%p)->(%p)\n", This, p); 00509 return E_NOTIMPL; 00510 } 00511 00512 static HRESULT WINAPI HTMLDocument_put_fgColor(IHTMLDocument2 *iface, VARIANT v) 00513 { 00514 HTMLDocument *This = HTMLDOC_THIS(iface); 00515 FIXME("(%p)\n", This); 00516 return E_NOTIMPL; 00517 } 00518 00519 static HRESULT WINAPI HTMLDocument_get_fgColor(IHTMLDocument2 *iface, VARIANT *p) 00520 { 00521 HTMLDocument *This = HTMLDOC_THIS(iface); 00522 FIXME("(%p)->(%p)\n", This, p); 00523 return E_NOTIMPL; 00524 } 00525 00526 static HRESULT WINAPI HTMLDocument_put_linkColor(IHTMLDocument2 *iface, VARIANT v) 00527 { 00528 HTMLDocument *This = HTMLDOC_THIS(iface); 00529 FIXME("(%p)->()\n", This); 00530 return E_NOTIMPL; 00531 } 00532 00533 static HRESULT WINAPI HTMLDocument_get_linkColor(IHTMLDocument2 *iface, VARIANT *p) 00534 { 00535 HTMLDocument *This = HTMLDOC_THIS(iface); 00536 FIXME("(%p)->(%p)\n", This, p); 00537 return E_NOTIMPL; 00538 } 00539 00540 static HRESULT WINAPI HTMLDocument_put_vlinkColor(IHTMLDocument2 *iface, VARIANT v) 00541 { 00542 HTMLDocument *This = HTMLDOC_THIS(iface); 00543 FIXME("(%p)\n", This); 00544 return E_NOTIMPL; 00545 } 00546 00547 static HRESULT WINAPI HTMLDocument_get_vlinkColor(IHTMLDocument2 *iface, VARIANT *p) 00548 { 00549 HTMLDocument *This = HTMLDOC_THIS(iface); 00550 FIXME("(%p)->(%p)\n", This, p); 00551 return E_NOTIMPL; 00552 } 00553 00554 static HRESULT WINAPI HTMLDocument_get_referrer(IHTMLDocument2 *iface, BSTR *p) 00555 { 00556 HTMLDocument *This = HTMLDOC_THIS(iface); 00557 00558 FIXME("(%p)->(%p)\n", This, p); 00559 00560 *p = NULL; 00561 return S_OK; 00562 } 00563 00564 static HRESULT WINAPI HTMLDocument_get_location(IHTMLDocument2 *iface, IHTMLLocation **p) 00565 { 00566 HTMLDocument *This = HTMLDOC_THIS(iface); 00567 00568 TRACE("(%p)->(%p)\n", This, p); 00569 00570 return IHTMLWindow2_get_location(HTMLWINDOW2(This->window), p); 00571 } 00572 00573 static HRESULT WINAPI HTMLDocument_get_lastModified(IHTMLDocument2 *iface, BSTR *p) 00574 { 00575 HTMLDocument *This = HTMLDOC_THIS(iface); 00576 FIXME("(%p)->(%p)\n", This, p); 00577 return E_NOTIMPL; 00578 } 00579 00580 static HRESULT WINAPI HTMLDocument_put_URL(IHTMLDocument2 *iface, BSTR v) 00581 { 00582 HTMLDocument *This = HTMLDOC_THIS(iface); 00583 FIXME("(%p)->(%s)\n", This, debugstr_w(v)); 00584 return E_NOTIMPL; 00585 } 00586 00587 static HRESULT WINAPI HTMLDocument_get_URL(IHTMLDocument2 *iface, BSTR *p) 00588 { 00589 HTMLDocument *This = HTMLDOC_THIS(iface); 00590 00591 static const WCHAR about_blank_url[] = 00592 {'a','b','o','u','t',':','b','l','a','n','k',0}; 00593 00594 TRACE("(%p)->(%p)\n", iface, p); 00595 00596 *p = SysAllocString(This->window->url ? This->window->url : about_blank_url); 00597 return *p ? S_OK : E_OUTOFMEMORY; 00598 } 00599 00600 static HRESULT WINAPI HTMLDocument_put_domain(IHTMLDocument2 *iface, BSTR v) 00601 { 00602 HTMLDocument *This = HTMLDOC_THIS(iface); 00603 FIXME("(%p)->(%s)\n", This, debugstr_w(v)); 00604 return E_NOTIMPL; 00605 } 00606 00607 static HRESULT WINAPI HTMLDocument_get_domain(IHTMLDocument2 *iface, BSTR *p) 00608 { 00609 HTMLDocument *This = HTMLDOC_THIS(iface); 00610 FIXME("(%p)->(%p)\n", This, p); 00611 return E_NOTIMPL; 00612 } 00613 00614 static HRESULT WINAPI HTMLDocument_put_cookie(IHTMLDocument2 *iface, BSTR v) 00615 { 00616 HTMLDocument *This = HTMLDOC_THIS(iface); 00617 BOOL bret; 00618 00619 TRACE("(%p)->(%s)\n", This, debugstr_w(v)); 00620 00621 bret = InternetSetCookieExW(This->window->url, NULL, v, 0, 0); 00622 if(!bret) { 00623 FIXME("InternetSetCookieExW failed: %u\n", GetLastError()); 00624 return HRESULT_FROM_WIN32(GetLastError()); 00625 } 00626 00627 return S_OK; 00628 } 00629 00630 static HRESULT WINAPI HTMLDocument_get_cookie(IHTMLDocument2 *iface, BSTR *p) 00631 { 00632 HTMLDocument *This = HTMLDOC_THIS(iface); 00633 DWORD size; 00634 BOOL bret; 00635 00636 TRACE("(%p)->(%p)\n", This, p); 00637 00638 size = 0; 00639 bret = InternetGetCookieExW(This->window->url, NULL, NULL, &size, 0, NULL); 00640 if(!bret) { 00641 switch(GetLastError()) { 00642 case ERROR_INSUFFICIENT_BUFFER: 00643 break; 00644 case ERROR_NO_MORE_ITEMS: 00645 *p = NULL; 00646 return S_OK; 00647 default: 00648 FIXME("InternetGetCookieExW failed: %u\n", GetLastError()); 00649 return HRESULT_FROM_WIN32(GetLastError()); 00650 } 00651 } 00652 00653 if(!size) { 00654 *p = NULL; 00655 return S_OK; 00656 } 00657 00658 *p = SysAllocStringLen(NULL, size-1); 00659 if(!*p) 00660 return E_OUTOFMEMORY; 00661 00662 bret = InternetGetCookieExW(This->window->url, NULL, *p, &size, 0, NULL); 00663 if(!bret) { 00664 ERR("InternetGetCookieExW failed: %u\n", GetLastError()); 00665 return E_FAIL; 00666 } 00667 00668 return S_OK; 00669 } 00670 00671 static HRESULT WINAPI HTMLDocument_put_expando(IHTMLDocument2 *iface, VARIANT_BOOL v) 00672 { 00673 HTMLDocument *This = HTMLDOC_THIS(iface); 00674 FIXME("(%p)->(%x)\n", This, v); 00675 return E_NOTIMPL; 00676 } 00677 00678 static HRESULT WINAPI HTMLDocument_get_expando(IHTMLDocument2 *iface, VARIANT_BOOL *p) 00679 { 00680 HTMLDocument *This = HTMLDOC_THIS(iface); 00681 FIXME("(%p)->(%p)\n", This, p); 00682 return E_NOTIMPL; 00683 } 00684 00685 static HRESULT WINAPI HTMLDocument_put_charset(IHTMLDocument2 *iface, BSTR v) 00686 { 00687 HTMLDocument *This = HTMLDOC_THIS(iface); 00688 FIXME("(%p)->(%s)\n", This, debugstr_w(v)); 00689 return E_NOTIMPL; 00690 } 00691 00692 static HRESULT WINAPI HTMLDocument_get_charset(IHTMLDocument2 *iface, BSTR *p) 00693 { 00694 HTMLDocument *This = HTMLDOC_THIS(iface); 00695 FIXME("(%p)->(%p)\n", This, p); 00696 return E_NOTIMPL; 00697 } 00698 00699 static HRESULT WINAPI HTMLDocument_put_defaultCharset(IHTMLDocument2 *iface, BSTR v) 00700 { 00701 HTMLDocument *This = HTMLDOC_THIS(iface); 00702 FIXME("(%p)->(%s)\n", This, debugstr_w(v)); 00703 return E_NOTIMPL; 00704 } 00705 00706 static HRESULT WINAPI HTMLDocument_get_defaultCharset(IHTMLDocument2 *iface, BSTR *p) 00707 { 00708 HTMLDocument *This = HTMLDOC_THIS(iface); 00709 FIXME("(%p)->(%p)\n", This, p); 00710 return E_NOTIMPL; 00711 } 00712 00713 static HRESULT WINAPI HTMLDocument_get_mimeType(IHTMLDocument2 *iface, BSTR *p) 00714 { 00715 HTMLDocument *This = HTMLDOC_THIS(iface); 00716 FIXME("(%p)->(%p)\n", This, p); 00717 return E_NOTIMPL; 00718 } 00719 00720 static HRESULT WINAPI HTMLDocument_get_fileSize(IHTMLDocument2 *iface, BSTR *p) 00721 { 00722 HTMLDocument *This = HTMLDOC_THIS(iface); 00723 FIXME("(%p)->(%p)\n", This, p); 00724 return E_NOTIMPL; 00725 } 00726 00727 static HRESULT WINAPI HTMLDocument_get_fileCreatedDate(IHTMLDocument2 *iface, BSTR *p) 00728 { 00729 HTMLDocument *This = HTMLDOC_THIS(iface); 00730 FIXME("(%p)->(%p)\n", This, p); 00731 return E_NOTIMPL; 00732 } 00733 00734 static HRESULT WINAPI HTMLDocument_get_fileModifiedDate(IHTMLDocument2 *iface, BSTR *p) 00735 { 00736 HTMLDocument *This = HTMLDOC_THIS(iface); 00737 FIXME("(%p)->(%p)\n", This, p); 00738 return E_NOTIMPL; 00739 } 00740 00741 static HRESULT WINAPI HTMLDocument_get_fileUpdatedDate(IHTMLDocument2 *iface, BSTR *p) 00742 { 00743 HTMLDocument *This = HTMLDOC_THIS(iface); 00744 FIXME("(%p)->(%p)\n", This, p); 00745 return E_NOTIMPL; 00746 } 00747 00748 static HRESULT WINAPI HTMLDocument_get_security(IHTMLDocument2 *iface, BSTR *p) 00749 { 00750 HTMLDocument *This = HTMLDOC_THIS(iface); 00751 FIXME("(%p)->(%p)\n", This, p); 00752 return E_NOTIMPL; 00753 } 00754 00755 static HRESULT WINAPI HTMLDocument_get_protocol(IHTMLDocument2 *iface, BSTR *p) 00756 { 00757 HTMLDocument *This = HTMLDOC_THIS(iface); 00758 FIXME("(%p)->(%p)\n", This, p); 00759 return E_NOTIMPL; 00760 } 00761 00762 static HRESULT WINAPI HTMLDocument_get_nameProp(IHTMLDocument2 *iface, BSTR *p) 00763 { 00764 HTMLDocument *This = HTMLDOC_THIS(iface); 00765 FIXME("(%p)->(%p)\n", This, p); 00766 return E_NOTIMPL; 00767 } 00768 00769 static HRESULT document_write(HTMLDocument *This, SAFEARRAY *psarray, BOOL ln) 00770 { 00771 nsAString nsstr; 00772 VARIANT *var; 00773 ULONG i, argc; 00774 nsresult nsres; 00775 HRESULT hres; 00776 00777 if(!This->doc_node->nsdoc) { 00778 WARN("NULL nsdoc\n"); 00779 return E_UNEXPECTED; 00780 } 00781 00782 if (!psarray) 00783 return S_OK; 00784 00785 if(psarray->cDims != 1) { 00786 FIXME("cDims=%d\n", psarray->cDims); 00787 return E_INVALIDARG; 00788 } 00789 00790 hres = SafeArrayAccessData(psarray, (void**)&var); 00791 if(FAILED(hres)) { 00792 WARN("SafeArrayAccessData failed: %08x\n", hres); 00793 return hres; 00794 } 00795 00796 nsAString_Init(&nsstr, NULL); 00797 00798 argc = psarray->rgsabound[0].cElements; 00799 for(i=0; i < argc; i++) { 00800 if(V_VT(var+i) == VT_BSTR) { 00801 nsAString_SetData(&nsstr, V_BSTR(var+i)); 00802 if(!ln || i != argc-1) 00803 nsres = nsIDOMHTMLDocument_Write(This->doc_node->nsdoc, &nsstr); 00804 else 00805 nsres = nsIDOMHTMLDocument_Writeln(This->doc_node->nsdoc, &nsstr); 00806 if(NS_FAILED(nsres)) 00807 ERR("Write failed: %08x\n", nsres); 00808 }else { 00809 FIXME("vt=%d\n", V_VT(var+i)); 00810 } 00811 } 00812 00813 nsAString_Finish(&nsstr); 00814 SafeArrayUnaccessData(psarray); 00815 00816 return S_OK; 00817 } 00818 00819 static HRESULT WINAPI HTMLDocument_write(IHTMLDocument2 *iface, SAFEARRAY *psarray) 00820 { 00821 HTMLDocument *This = HTMLDOC_THIS(iface); 00822 00823 TRACE("(%p)->(%p)\n", iface, psarray); 00824 00825 return document_write(This, psarray, FALSE); 00826 } 00827 00828 static HRESULT WINAPI HTMLDocument_writeln(IHTMLDocument2 *iface, SAFEARRAY *psarray) 00829 { 00830 HTMLDocument *This = HTMLDOC_THIS(iface); 00831 00832 TRACE("(%p)->(%p)\n", This, psarray); 00833 00834 return document_write(This, psarray, TRUE); 00835 } 00836 00837 static HRESULT WINAPI HTMLDocument_open(IHTMLDocument2 *iface, BSTR url, VARIANT name, 00838 VARIANT features, VARIANT replace, IDispatch **pomWindowResult) 00839 { 00840 HTMLDocument *This = HTMLDOC_THIS(iface); 00841 nsresult nsres; 00842 00843 static const WCHAR text_htmlW[] = {'t','e','x','t','/','h','t','m','l',0}; 00844 00845 TRACE("(%p)->(%s %s %s %s %p)\n", This, debugstr_w(url), debugstr_variant(&name), 00846 debugstr_variant(&features), debugstr_variant(&replace), pomWindowResult); 00847 00848 if(!This->doc_node->nsdoc) { 00849 ERR("!nsdoc\n"); 00850 return E_NOTIMPL; 00851 } 00852 00853 if(!url || strcmpW(url, text_htmlW) || V_VT(&name) != VT_ERROR 00854 || V_VT(&features) != VT_ERROR || V_VT(&replace) != VT_ERROR) 00855 FIXME("unsupported args\n"); 00856 00857 nsres = nsIDOMHTMLDocument_Open(This->doc_node->nsdoc); 00858 if(NS_FAILED(nsres)) { 00859 ERR("Open failed: %08x\n", nsres); 00860 return E_FAIL; 00861 } 00862 00863 *pomWindowResult = (IDispatch*)HTMLWINDOW2(This->window); 00864 IHTMLWindow2_AddRef(HTMLWINDOW2(This->window)); 00865 return S_OK; 00866 } 00867 00868 static HRESULT WINAPI HTMLDocument_close(IHTMLDocument2 *iface) 00869 { 00870 HTMLDocument *This = HTMLDOC_THIS(iface); 00871 nsresult nsres; 00872 00873 TRACE("(%p)\n", This); 00874 00875 if(!This->doc_node->nsdoc) { 00876 ERR("!nsdoc\n"); 00877 return E_NOTIMPL; 00878 } 00879 00880 nsres = nsIDOMHTMLDocument_Close(This->doc_node->nsdoc); 00881 if(NS_FAILED(nsres)) { 00882 ERR("Close failed: %08x\n", nsres); 00883 return E_FAIL; 00884 } 00885 00886 return S_OK; 00887 } 00888 00889 static HRESULT WINAPI HTMLDocument_clear(IHTMLDocument2 *iface) 00890 { 00891 HTMLDocument *This = HTMLDOC_THIS(iface); 00892 nsIDOMNSHTMLDocument *nsdoc; 00893 nsresult nsres; 00894 00895 TRACE("(%p)\n", This); 00896 00897 nsres = nsIDOMHTMLDocument_QueryInterface(This->doc_node->nsdoc, &IID_nsIDOMNSHTMLDocument, (void**)&nsdoc); 00898 if(NS_FAILED(nsres)) { 00899 ERR("Could not get nsIDOMNSHTMLDocument iface: %08x\n", nsres); 00900 return E_FAIL; 00901 } 00902 00903 nsres = nsIDOMNSHTMLDocument_Clear(nsdoc); 00904 nsIDOMNSHTMLDocument_Release(nsdoc); 00905 if(NS_FAILED(nsres)) { 00906 ERR("Clear failed: %08x\n", nsres); 00907 return E_FAIL; 00908 } 00909 00910 return S_OK; 00911 } 00912 00913 static HRESULT WINAPI HTMLDocument_queryCommandSupported(IHTMLDocument2 *iface, BSTR cmdID, 00914 VARIANT_BOOL *pfRet) 00915 { 00916 HTMLDocument *This = HTMLDOC_THIS(iface); 00917 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet); 00918 return E_NOTIMPL; 00919 } 00920 00921 static HRESULT WINAPI HTMLDocument_queryCommandEnabled(IHTMLDocument2 *iface, BSTR cmdID, 00922 VARIANT_BOOL *pfRet) 00923 { 00924 HTMLDocument *This = HTMLDOC_THIS(iface); 00925 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet); 00926 return E_NOTIMPL; 00927 } 00928 00929 static HRESULT WINAPI HTMLDocument_queryCommandState(IHTMLDocument2 *iface, BSTR cmdID, 00930 VARIANT_BOOL *pfRet) 00931 { 00932 HTMLDocument *This = HTMLDOC_THIS(iface); 00933 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet); 00934 return E_NOTIMPL; 00935 } 00936 00937 static HRESULT WINAPI HTMLDocument_queryCommandIndeterm(IHTMLDocument2 *iface, BSTR cmdID, 00938 VARIANT_BOOL *pfRet) 00939 { 00940 HTMLDocument *This = HTMLDOC_THIS(iface); 00941 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet); 00942 return E_NOTIMPL; 00943 } 00944 00945 static HRESULT WINAPI HTMLDocument_queryCommandText(IHTMLDocument2 *iface, BSTR cmdID, 00946 BSTR *pfRet) 00947 { 00948 HTMLDocument *This = HTMLDOC_THIS(iface); 00949 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet); 00950 return E_NOTIMPL; 00951 } 00952 00953 static HRESULT WINAPI HTMLDocument_queryCommandValue(IHTMLDocument2 *iface, BSTR cmdID, 00954 VARIANT *pfRet) 00955 { 00956 HTMLDocument *This = HTMLDOC_THIS(iface); 00957 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet); 00958 return E_NOTIMPL; 00959 } 00960 00961 static HRESULT WINAPI HTMLDocument_execCommand(IHTMLDocument2 *iface, BSTR cmdID, 00962 VARIANT_BOOL showUI, VARIANT value, VARIANT_BOOL *pfRet) 00963 { 00964 HTMLDocument *This = HTMLDOC_THIS(iface); 00965 FIXME("(%p)->(%s %x %p)\n", This, debugstr_w(cmdID), showUI, pfRet); 00966 return E_NOTIMPL; 00967 } 00968 00969 static HRESULT WINAPI HTMLDocument_execCommandShowHelp(IHTMLDocument2 *iface, BSTR cmdID, 00970 VARIANT_BOOL *pfRet) 00971 { 00972 HTMLDocument *This = HTMLDOC_THIS(iface); 00973 FIXME("(%p)->(%s %p)\n", This, debugstr_w(cmdID), pfRet); 00974 return E_NOTIMPL; 00975 } 00976 00977 static HRESULT WINAPI HTMLDocument_createElement(IHTMLDocument2 *iface, BSTR eTag, 00978 IHTMLElement **newElem) 00979 { 00980 HTMLDocument *This = HTMLDOC_THIS(iface); 00981 nsIDOMHTMLElement *nselem; 00982 HTMLElement *elem; 00983 HRESULT hres; 00984 00985 TRACE("(%p)->(%s %p)\n", This, debugstr_w(eTag), newElem); 00986 00987 hres = create_nselem(This->doc_node, eTag, &nselem); 00988 if(FAILED(hres)) 00989 return hres; 00990 00991 elem = HTMLElement_Create(This->doc_node, (nsIDOMNode*)nselem, TRUE); 00992 nsIDOMHTMLElement_Release(nselem); 00993 00994 *newElem = HTMLELEM(elem); 00995 IHTMLElement_AddRef(HTMLELEM(elem)); 00996 return S_OK; 00997 } 00998 00999 static HRESULT WINAPI HTMLDocument_put_onhelp(IHTMLDocument2 *iface, VARIANT v) 01000 { 01001 HTMLDocument *This = HTMLDOC_THIS(iface); 01002 FIXME("(%p)\n", This); 01003 return E_NOTIMPL; 01004 } 01005 01006 static HRESULT WINAPI HTMLDocument_get_onhelp(IHTMLDocument2 *iface, VARIANT *p) 01007 { 01008 HTMLDocument *This = HTMLDOC_THIS(iface); 01009 FIXME("(%p)->(%p)\n", This, p); 01010 return E_NOTIMPL; 01011 } 01012 01013 static HRESULT WINAPI HTMLDocument_put_onclick(IHTMLDocument2 *iface, VARIANT v) 01014 { 01015 HTMLDocument *This = HTMLDOC_THIS(iface); 01016 01017 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); 01018 01019 return set_doc_event(This, EVENTID_CLICK, &v); 01020 } 01021 01022 static HRESULT WINAPI HTMLDocument_get_onclick(IHTMLDocument2 *iface, VARIANT *p) 01023 { 01024 HTMLDocument *This = HTMLDOC_THIS(iface); 01025 01026 TRACE("(%p)->(%p)\n", This, p); 01027 01028 return get_doc_event(This, EVENTID_CLICK, p); 01029 } 01030 01031 static HRESULT WINAPI HTMLDocument_put_ondblclick(IHTMLDocument2 *iface, VARIANT v) 01032 { 01033 HTMLDocument *This = HTMLDOC_THIS(iface); 01034 FIXME("(%p)\n", This); 01035 return E_NOTIMPL; 01036 } 01037 01038 static HRESULT WINAPI HTMLDocument_get_ondblclick(IHTMLDocument2 *iface, VARIANT *p) 01039 { 01040 HTMLDocument *This = HTMLDOC_THIS(iface); 01041 FIXME("(%p)->(%p)\n", This, p); 01042 return E_NOTIMPL; 01043 } 01044 01045 static HRESULT WINAPI HTMLDocument_put_onkeyup(IHTMLDocument2 *iface, VARIANT v) 01046 { 01047 HTMLDocument *This = HTMLDOC_THIS(iface); 01048 01049 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); 01050 01051 return set_doc_event(This, EVENTID_KEYUP, &v); 01052 } 01053 01054 static HRESULT WINAPI HTMLDocument_get_onkeyup(IHTMLDocument2 *iface, VARIANT *p) 01055 { 01056 HTMLDocument *This = HTMLDOC_THIS(iface); 01057 01058 TRACE("(%p)->(%p)\n", This, p); 01059 01060 return get_doc_event(This, EVENTID_KEYUP, p); 01061 } 01062 01063 static HRESULT WINAPI HTMLDocument_put_onkeydown(IHTMLDocument2 *iface, VARIANT v) 01064 { 01065 HTMLDocument *This = HTMLDOC_THIS(iface); 01066 01067 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); 01068 01069 return set_doc_event(This, EVENTID_KEYDOWN, &v); 01070 } 01071 01072 static HRESULT WINAPI HTMLDocument_get_onkeydown(IHTMLDocument2 *iface, VARIANT *p) 01073 { 01074 HTMLDocument *This = HTMLDOC_THIS(iface); 01075 01076 TRACE("(%p)->(%p)\n", This, p); 01077 01078 return get_doc_event(This, EVENTID_KEYDOWN, p); 01079 } 01080 01081 static HRESULT WINAPI HTMLDocument_put_onkeypress(IHTMLDocument2 *iface, VARIANT v) 01082 { 01083 HTMLDocument *This = HTMLDOC_THIS(iface); 01084 FIXME("(%p)\n", This); 01085 return E_NOTIMPL; 01086 } 01087 01088 static HRESULT WINAPI HTMLDocument_get_onkeypress(IHTMLDocument2 *iface, VARIANT *p) 01089 { 01090 HTMLDocument *This = HTMLDOC_THIS(iface); 01091 FIXME("(%p)->(%p)\n", This, p); 01092 return E_NOTIMPL; 01093 } 01094 01095 static HRESULT WINAPI HTMLDocument_put_onmouseup(IHTMLDocument2 *iface, VARIANT v) 01096 { 01097 HTMLDocument *This = HTMLDOC_THIS(iface); 01098 01099 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); 01100 01101 return set_doc_event(This, EVENTID_MOUSEUP, &v); 01102 } 01103 01104 static HRESULT WINAPI HTMLDocument_get_onmouseup(IHTMLDocument2 *iface, VARIANT *p) 01105 { 01106 HTMLDocument *This = HTMLDOC_THIS(iface); 01107 01108 TRACE("(%p)->(%p)\n", This, p); 01109 01110 return get_doc_event(This, EVENTID_MOUSEUP, p); 01111 } 01112 01113 static HRESULT WINAPI HTMLDocument_put_onmousedown(IHTMLDocument2 *iface, VARIANT v) 01114 { 01115 HTMLDocument *This = HTMLDOC_THIS(iface); 01116 01117 TRACE("(%p)->()\n", This); 01118 01119 return set_doc_event(This, EVENTID_MOUSEDOWN, &v); 01120 } 01121 01122 static HRESULT WINAPI HTMLDocument_get_onmousedown(IHTMLDocument2 *iface, VARIANT *p) 01123 { 01124 HTMLDocument *This = HTMLDOC_THIS(iface); 01125 01126 TRACE("(%p)->(%p)\n", This, p); 01127 01128 return get_doc_event(This, EVENTID_MOUSEDOWN, p); 01129 } 01130 01131 static HRESULT WINAPI HTMLDocument_put_onmousemove(IHTMLDocument2 *iface, VARIANT v) 01132 { 01133 HTMLDocument *This = HTMLDOC_THIS(iface); 01134 FIXME("(%p)\n", This); 01135 return E_NOTIMPL; 01136 } 01137 01138 static HRESULT WINAPI HTMLDocument_get_onmousemove(IHTMLDocument2 *iface, VARIANT *p) 01139 { 01140 HTMLDocument *This = HTMLDOC_THIS(iface); 01141 FIXME("(%p)->(%p)\n", This, p); 01142 return E_NOTIMPL; 01143 } 01144 01145 static HRESULT WINAPI HTMLDocument_put_onmouseout(IHTMLDocument2 *iface, VARIANT v) 01146 { 01147 HTMLDocument *This = HTMLDOC_THIS(iface); 01148 01149 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); 01150 01151 return set_doc_event(This, EVENTID_MOUSEOUT, &v); 01152 } 01153 01154 static HRESULT WINAPI HTMLDocument_get_onmouseout(IHTMLDocument2 *iface, VARIANT *p) 01155 { 01156 HTMLDocument *This = HTMLDOC_THIS(iface); 01157 01158 TRACE("(%p)->(%p)\n", This, p); 01159 01160 return get_doc_event(This, EVENTID_MOUSEOUT, p); 01161 } 01162 01163 static HRESULT WINAPI HTMLDocument_put_onmouseover(IHTMLDocument2 *iface, VARIANT v) 01164 { 01165 HTMLDocument *This = HTMLDOC_THIS(iface); 01166 01167 TRACE("(%p)\n", This); 01168 01169 return set_doc_event(This, EVENTID_MOUSEOVER, &v); 01170 } 01171 01172 static HRESULT WINAPI HTMLDocument_get_onmouseover(IHTMLDocument2 *iface, VARIANT *p) 01173 { 01174 HTMLDocument *This = HTMLDOC_THIS(iface); 01175 01176 TRACE("(%p)->(%p)\n", This, p); 01177 01178 return get_doc_event(This, EVENTID_MOUSEOVER, p); 01179 } 01180 01181 static HRESULT WINAPI HTMLDocument_put_onreadystatechange(IHTMLDocument2 *iface, VARIANT v) 01182 { 01183 HTMLDocument *This = HTMLDOC_THIS(iface); 01184 01185 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); 01186 01187 return set_doc_event(This, EVENTID_READYSTATECHANGE, &v); 01188 } 01189 01190 static HRESULT WINAPI HTMLDocument_get_onreadystatechange(IHTMLDocument2 *iface, VARIANT *p) 01191 { 01192 HTMLDocument *This = HTMLDOC_THIS(iface); 01193 01194 TRACE("(%p)->(%p)\n", This, p); 01195 01196 return get_doc_event(This, EVENTID_READYSTATECHANGE, p); 01197 } 01198 01199 static HRESULT WINAPI HTMLDocument_put_onafterupdate(IHTMLDocument2 *iface, VARIANT v) 01200 { 01201 HTMLDocument *This = HTMLDOC_THIS(iface); 01202 FIXME("(%p)\n", This); 01203 return E_NOTIMPL; 01204 } 01205 01206 static HRESULT WINAPI HTMLDocument_get_onafterupdate(IHTMLDocument2 *iface, VARIANT *p) 01207 { 01208 HTMLDocument *This = HTMLDOC_THIS(iface); 01209 FIXME("(%p)->(%p)\n", This, p); 01210 return E_NOTIMPL; 01211 } 01212 01213 static HRESULT WINAPI HTMLDocument_put_onrowexit(IHTMLDocument2 *iface, VARIANT v) 01214 { 01215 HTMLDocument *This = HTMLDOC_THIS(iface); 01216 FIXME("(%p)\n", This); 01217 return E_NOTIMPL; 01218 } 01219 01220 static HRESULT WINAPI HTMLDocument_get_onrowexit(IHTMLDocument2 *iface, VARIANT *p) 01221 { 01222 HTMLDocument *This = HTMLDOC_THIS(iface); 01223 FIXME("(%p)->(%p)\n", This, p); 01224 return E_NOTIMPL; 01225 } 01226 01227 static HRESULT WINAPI HTMLDocument_put_onrowenter(IHTMLDocument2 *iface, VARIANT v) 01228 { 01229 HTMLDocument *This = HTMLDOC_THIS(iface); 01230 FIXME("(%p)\n", This); 01231 return E_NOTIMPL; 01232 } 01233 01234 static HRESULT WINAPI HTMLDocument_get_onrowenter(IHTMLDocument2 *iface, VARIANT *p) 01235 { 01236 HTMLDocument *This = HTMLDOC_THIS(iface); 01237 FIXME("(%p)->(%p)\n", This, p); 01238 return E_NOTIMPL; 01239 } 01240 01241 static HRESULT WINAPI HTMLDocument_put_ondragstart(IHTMLDocument2 *iface, VARIANT v) 01242 { 01243 HTMLDocument *This = HTMLDOC_THIS(iface); 01244 01245 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); 01246 01247 return set_doc_event(This, EVENTID_DRAGSTART, &v); 01248 } 01249 01250 static HRESULT WINAPI HTMLDocument_get_ondragstart(IHTMLDocument2 *iface, VARIANT *p) 01251 { 01252 HTMLDocument *This = HTMLDOC_THIS(iface); 01253 01254 TRACE("(%p)->(%p)\n", This, p); 01255 01256 return get_doc_event(This, EVENTID_DRAGSTART, p); 01257 } 01258 01259 static HRESULT WINAPI HTMLDocument_put_onselectstart(IHTMLDocument2 *iface, VARIANT v) 01260 { 01261 HTMLDocument *This = HTMLDOC_THIS(iface); 01262 01263 TRACE("(%p)->(%s)\n", This, debugstr_variant(&v)); 01264 01265 return set_doc_event(This, EVENTID_SELECTSTART, &v); 01266 } 01267 01268 static HRESULT WINAPI HTMLDocument_get_onselectstart(IHTMLDocument2 *iface, VARIANT *p) 01269 { 01270 HTMLDocument *This = HTMLDOC_THIS(iface); 01271 01272 TRACE("(%p)->(%p)\n", This, p); 01273 01274 return get_doc_event(This, EVENTID_SELECTSTART, p); 01275 } 01276 01277 static HRESULT WINAPI HTMLDocument_elementFromPoint(IHTMLDocument2 *iface, LONG x, LONG y, 01278 IHTMLElement **elementHit) 01279 { 01280 HTMLDocument *This = HTMLDOC_THIS(iface); 01281 FIXME("(%p)->(%d %d %p)\n", This, x, y, elementHit); 01282 return E_NOTIMPL; 01283 } 01284 01285 static HRESULT WINAPI HTMLDocument_get_parentWindow(IHTMLDocument2 *iface, IHTMLWindow2 **p) 01286 { 01287 HTMLDocument *This = HTMLDOC_THIS(iface); 01288 01289 TRACE("(%p)->(%p)\n", This, p); 01290 01291 *p = HTMLWINDOW2(This->window); 01292 IHTMLWindow2_AddRef(*p); 01293 return S_OK; 01294 } 01295 01296 static HRESULT WINAPI HTMLDocument_get_styleSheets(IHTMLDocument2 *iface, 01297 IHTMLStyleSheetsCollection **p) 01298 { 01299 HTMLDocument *This = HTMLDOC_THIS(iface); 01300 nsIDOMStyleSheetList *nsstylelist; 01301 nsIDOMDocumentStyle *nsdocstyle; 01302 nsresult nsres; 01303 01304 TRACE("(%p)->(%p)\n", This, p); 01305 01306 *p = NULL; 01307 01308 if(!This->doc_node->nsdoc) { 01309 WARN("NULL nsdoc\n"); 01310 return E_UNEXPECTED; 01311 } 01312 01313 nsIDOMHTMLDocument_QueryInterface(This->doc_node->nsdoc, &IID_nsIDOMDocumentStyle, (void**)&nsdocstyle); 01314 nsres = nsIDOMDocumentStyle_GetStyleSheets(nsdocstyle, &nsstylelist); 01315 nsIDOMDocumentStyle_Release(nsdocstyle); 01316 if(NS_FAILED(nsres)) { 01317 ERR("GetStyleSheets failed: %08x\n", nsres); 01318 return E_FAIL; 01319 } 01320 01321 *p = HTMLStyleSheetsCollection_Create(nsstylelist); 01322 nsIDOMDocumentStyle_Release(nsstylelist); 01323 01324 return S_OK; 01325 } 01326 01327 static HRESULT WINAPI HTMLDocument_put_onbeforeupdate(IHTMLDocument2 *iface, VARIANT v) 01328 { 01329 HTMLDocument *This = HTMLDOC_THIS(iface); 01330 FIXME("(%p)\n", This); 01331 return E_NOTIMPL; 01332 } 01333 01334 static HRESULT WINAPI HTMLDocument_get_onbeforeupdate(IHTMLDocument2 *iface, VARIANT *p) 01335 { 01336 HTMLDocument *This = HTMLDOC_THIS(iface); 01337 FIXME("(%p)->(%p)\n", This, p); 01338 return E_NOTIMPL; 01339 } 01340 01341 static HRESULT WINAPI HTMLDocument_put_onerrorupdate(IHTMLDocument2 *iface, VARIANT v) 01342 { 01343 HTMLDocument *This = HTMLDOC_THIS(iface); 01344 FIXME("(%p)\n", This); 01345 return E_NOTIMPL; 01346 } 01347 01348 static HRESULT WINAPI HTMLDocument_get_onerrorupdate(IHTMLDocument2 *iface, VARIANT *p) 01349 { 01350 HTMLDocument *This = HTMLDOC_THIS(iface); 01351 FIXME("(%p)->(%p)\n", This, p); 01352 return E_NOTIMPL; 01353 } 01354 01355 static HRESULT WINAPI HTMLDocument_toString(IHTMLDocument2 *iface, BSTR *String) 01356 { 01357 HTMLDocument *This = HTMLDOC_THIS(iface); 01358 FIXME("(%p)->(%p)\n", This, String); 01359 return E_NOTIMPL; 01360 } 01361 01362 static HRESULT WINAPI HTMLDocument_createStyleSheet(IHTMLDocument2 *iface, BSTR bstrHref, 01363 LONG lIndex, IHTMLStyleSheet **ppnewStyleSheet) 01364 { 01365 HTMLDocument *This = HTMLDOC_THIS(iface); 01366 01367 FIXME("(%p)->(%s %d %p) semi-stub\n", This, debugstr_w(bstrHref), lIndex, ppnewStyleSheet); 01368 01369 *ppnewStyleSheet = HTMLStyleSheet_Create(NULL); 01370 return S_OK; 01371 } 01372 01373 static const IHTMLDocument2Vtbl HTMLDocumentVtbl = { 01374 HTMLDocument_QueryInterface, 01375 HTMLDocument_AddRef, 01376 HTMLDocument_Release, 01377 HTMLDocument_GetTypeInfoCount, 01378 HTMLDocument_GetTypeInfo, 01379 HTMLDocument_GetIDsOfNames, 01380 HTMLDocument_Invoke, 01381 HTMLDocument_get_Script, 01382 HTMLDocument_get_all, 01383 HTMLDocument_get_body, 01384 HTMLDocument_get_activeElement, 01385 HTMLDocument_get_images, 01386 HTMLDocument_get_applets, 01387 HTMLDocument_get_links, 01388 HTMLDocument_get_forms, 01389 HTMLDocument_get_anchors, 01390 HTMLDocument_put_title, 01391 HTMLDocument_get_title, 01392 HTMLDocument_get_scripts, 01393 HTMLDocument_put_designMode, 01394 HTMLDocument_get_designMode, 01395 HTMLDocument_get_selection, 01396 HTMLDocument_get_readyState, 01397 HTMLDocument_get_frames, 01398 HTMLDocument_get_embeds, 01399 HTMLDocument_get_plugins, 01400 HTMLDocument_put_alinkColor, 01401 HTMLDocument_get_alinkColor, 01402 HTMLDocument_put_bgColor, 01403 HTMLDocument_get_bgColor, 01404 HTMLDocument_put_fgColor, 01405 HTMLDocument_get_fgColor, 01406 HTMLDocument_put_linkColor, 01407 HTMLDocument_get_linkColor, 01408 HTMLDocument_put_vlinkColor, 01409 HTMLDocument_get_vlinkColor, 01410 HTMLDocument_get_referrer, 01411 HTMLDocument_get_location, 01412 HTMLDocument_get_lastModified, 01413 HTMLDocument_put_URL, 01414 HTMLDocument_get_URL, 01415 HTMLDocument_put_domain, 01416 HTMLDocument_get_domain, 01417 HTMLDocument_put_cookie, 01418 HTMLDocument_get_cookie, 01419 HTMLDocument_put_expando, 01420 HTMLDocument_get_expando, 01421 HTMLDocument_put_charset, 01422 HTMLDocument_get_charset, 01423 HTMLDocument_put_defaultCharset, 01424 HTMLDocument_get_defaultCharset, 01425 HTMLDocument_get_mimeType, 01426 HTMLDocument_get_fileSize, 01427 HTMLDocument_get_fileCreatedDate, 01428 HTMLDocument_get_fileModifiedDate, 01429 HTMLDocument_get_fileUpdatedDate, 01430 HTMLDocument_get_security, 01431 HTMLDocument_get_protocol, 01432 HTMLDocument_get_nameProp, 01433 HTMLDocument_write, 01434 HTMLDocument_writeln, 01435 HTMLDocument_open, 01436 HTMLDocument_close, 01437 HTMLDocument_clear, 01438 HTMLDocument_queryCommandSupported, 01439 HTMLDocument_queryCommandEnabled, 01440 HTMLDocument_queryCommandState, 01441 HTMLDocument_queryCommandIndeterm, 01442 HTMLDocument_queryCommandText, 01443 HTMLDocument_queryCommandValue, 01444 HTMLDocument_execCommand, 01445 HTMLDocument_execCommandShowHelp, 01446 HTMLDocument_createElement, 01447 HTMLDocument_put_onhelp, 01448 HTMLDocument_get_onhelp, 01449 HTMLDocument_put_onclick, 01450 HTMLDocument_get_onclick, 01451 HTMLDocument_put_ondblclick, 01452 HTMLDocument_get_ondblclick, 01453 HTMLDocument_put_onkeyup, 01454 HTMLDocument_get_onkeyup, 01455 HTMLDocument_put_onkeydown, 01456 HTMLDocument_get_onkeydown, 01457 HTMLDocument_put_onkeypress, 01458 HTMLDocument_get_onkeypress, 01459 HTMLDocument_put_onmouseup, 01460 HTMLDocument_get_onmouseup, 01461 HTMLDocument_put_onmousedown, 01462 HTMLDocument_get_onmousedown, 01463 HTMLDocument_put_onmousemove, 01464 HTMLDocument_get_onmousemove, 01465 HTMLDocument_put_onmouseout, 01466 HTMLDocument_get_onmouseout, 01467 HTMLDocument_put_onmouseover, 01468 HTMLDocument_get_onmouseover, 01469 HTMLDocument_put_onreadystatechange, 01470 HTMLDocument_get_onreadystatechange, 01471 HTMLDocument_put_onafterupdate, 01472 HTMLDocument_get_onafterupdate, 01473 HTMLDocument_put_onrowexit, 01474 HTMLDocument_get_onrowexit, 01475 HTMLDocument_put_onrowenter, 01476 HTMLDocument_get_onrowenter, 01477 HTMLDocument_put_ondragstart, 01478 HTMLDocument_get_ondragstart, 01479 HTMLDocument_put_onselectstart, 01480 HTMLDocument_get_onselectstart, 01481 HTMLDocument_elementFromPoint, 01482 HTMLDocument_get_parentWindow, 01483 HTMLDocument_get_styleSheets, 01484 HTMLDocument_put_onbeforeupdate, 01485 HTMLDocument_get_onbeforeupdate, 01486 HTMLDocument_put_onerrorupdate, 01487 HTMLDocument_get_onerrorupdate, 01488 HTMLDocument_toString, 01489 HTMLDocument_createStyleSheet 01490 }; 01491 01492 static void HTMLDocument_on_advise(IUnknown *iface, cp_static_data_t *cp) 01493 { 01494 HTMLDocument *This = HTMLDOC_THIS(iface); 01495 01496 if(This->window) 01497 update_cp_events(This->window, &This->doc_node->node.event_target, cp, This->doc_node->node.nsnode); 01498 } 01499 01500 #undef HTMLDOC_THIS 01501 01502 #define SUPPINFO_THIS(iface) DEFINE_THIS(HTMLDocument, SupportErrorInfo, iface) 01503 01504 static HRESULT WINAPI SupportErrorInfo_QueryInterface(ISupportErrorInfo *iface, REFIID riid, void **ppv) 01505 { 01506 HTMLDocument *This = SUPPINFO_THIS(iface); 01507 return IHTMLDocument_QueryInterface(HTMLDOC(This), riid, ppv); 01508 } 01509 01510 static ULONG WINAPI SupportErrorInfo_AddRef(ISupportErrorInfo *iface) 01511 { 01512 HTMLDocument *This = SUPPINFO_THIS(iface); 01513 return IHTMLDocument_AddRef(HTMLDOC(This)); 01514 } 01515 01516 static ULONG WINAPI SupportErrorInfo_Release(ISupportErrorInfo *iface) 01517 { 01518 HTMLDocument *This = SUPPINFO_THIS(iface); 01519 return IHTMLDocument_Release(HTMLDOC(This)); 01520 } 01521 01522 static HRESULT WINAPI SupportErrorInfo_InterfaceSupportsErrorInfo(ISupportErrorInfo *iface, REFIID riid) 01523 { 01524 FIXME("(%p)->(%s)\n", iface, debugstr_guid(riid)); 01525 return S_FALSE; 01526 } 01527 01528 static const ISupportErrorInfoVtbl SupportErrorInfoVtbl = { 01529 SupportErrorInfo_QueryInterface, 01530 SupportErrorInfo_AddRef, 01531 SupportErrorInfo_Release, 01532 SupportErrorInfo_InterfaceSupportsErrorInfo 01533 }; 01534 01535 #define DISPEX_THIS(iface) DEFINE_THIS(HTMLDocument, IDispatchEx, iface) 01536 01537 static HRESULT WINAPI DocDispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv) 01538 { 01539 HTMLDocument *This = DISPEX_THIS(iface); 01540 01541 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppv); 01542 } 01543 01544 static ULONG WINAPI DocDispatchEx_AddRef(IDispatchEx *iface) 01545 { 01546 HTMLDocument *This = DISPEX_THIS(iface); 01547 01548 return IHTMLDocument2_AddRef(HTMLDOC(This)); 01549 } 01550 01551 static ULONG WINAPI DocDispatchEx_Release(IDispatchEx *iface) 01552 { 01553 HTMLDocument *This = DISPEX_THIS(iface); 01554 01555 return IHTMLDocument2_Release(HTMLDOC(This)); 01556 } 01557 01558 static HRESULT WINAPI DocDispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo) 01559 { 01560 HTMLDocument *This = DISPEX_THIS(iface); 01561 01562 return IDispatchEx_GetTypeInfoCount(This->dispex, pctinfo); 01563 } 01564 01565 static HRESULT WINAPI DocDispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, 01566 LCID lcid, ITypeInfo **ppTInfo) 01567 { 01568 HTMLDocument *This = DISPEX_THIS(iface); 01569 01570 return IDispatchEx_GetTypeInfo(This->dispex, iTInfo, lcid, ppTInfo); 01571 } 01572 01573 static HRESULT WINAPI DocDispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid, 01574 LPOLESTR *rgszNames, UINT cNames, 01575 LCID lcid, DISPID *rgDispId) 01576 { 01577 HTMLDocument *This = DISPEX_THIS(iface); 01578 01579 return IDispatchEx_GetIDsOfNames(This->dispex, riid, rgszNames, cNames, lcid, rgDispId); 01580 } 01581 01582 static HRESULT WINAPI DocDispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember, 01583 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, 01584 VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) 01585 { 01586 HTMLDocument *This = DISPEX_THIS(iface); 01587 01588 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), 01589 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); 01590 01591 switch(dispIdMember) { 01592 case DISPID_READYSTATE: 01593 TRACE("DISPID_READYSTATE\n"); 01594 01595 if(!(wFlags & DISPATCH_PROPERTYGET)) 01596 return E_INVALIDARG; 01597 01598 V_VT(pVarResult) = VT_I4; 01599 V_I4(pVarResult) = This->window->readystate; 01600 return S_OK; 01601 } 01602 01603 return IDispatchEx_Invoke(This->dispex, dispIdMember, riid, lcid, wFlags, pDispParams, 01604 pVarResult, pExcepInfo, puArgErr); 01605 } 01606 01607 static HRESULT WINAPI DocDispatchEx_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid) 01608 { 01609 HTMLDocument *This = DISPEX_THIS(iface); 01610 01611 return IDispatchEx_GetDispID(This->dispex, bstrName, grfdex, pid); 01612 } 01613 01614 static HRESULT WINAPI DocDispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, 01615 VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) 01616 { 01617 HTMLDocument *This = DISPEX_THIS(iface); 01618 01619 if(This->window && id == DISPID_IHTMLDOCUMENT2_LOCATION && (wFlags & DISPATCH_PROPERTYPUT)) 01620 return IDispatchEx_InvokeEx(DISPATCHEX(This->window), DISPID_IHTMLWINDOW2_LOCATION, lcid, wFlags, 01621 pdp, pvarRes, pei, pspCaller); 01622 01623 01624 return IDispatchEx_InvokeEx(This->dispex, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); 01625 } 01626 01627 static HRESULT WINAPI DocDispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex) 01628 { 01629 HTMLDocument *This = DISPEX_THIS(iface); 01630 01631 return IDispatchEx_DeleteMemberByName(This->dispex, bstrName, grfdex); 01632 } 01633 01634 static HRESULT WINAPI DocDispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id) 01635 { 01636 HTMLDocument *This = DISPEX_THIS(iface); 01637 01638 return IDispatchEx_DeleteMemberByDispID(This->dispex, id); 01639 } 01640 01641 static HRESULT WINAPI DocDispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex) 01642 { 01643 HTMLDocument *This = DISPEX_THIS(iface); 01644 01645 return IDispatchEx_GetMemberProperties(This->dispex, id, grfdexFetch, pgrfdex); 01646 } 01647 01648 static HRESULT WINAPI DocDispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName) 01649 { 01650 HTMLDocument *This = DISPEX_THIS(iface); 01651 01652 return IDispatchEx_GetMemberName(This->dispex, id, pbstrName); 01653 } 01654 01655 static HRESULT WINAPI DocDispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid) 01656 { 01657 HTMLDocument *This = DISPEX_THIS(iface); 01658 01659 return IDispatchEx_GetNextDispID(This->dispex, grfdex, id, pid); 01660 } 01661 01662 static HRESULT WINAPI DocDispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk) 01663 { 01664 HTMLDocument *This = DISPEX_THIS(iface); 01665 01666 return IDispatchEx_GetNameSpaceParent(This->dispex, ppunk); 01667 } 01668 01669 #undef DISPEX_THIS 01670 01671 static const IDispatchExVtbl DocDispatchExVtbl = { 01672 DocDispatchEx_QueryInterface, 01673 DocDispatchEx_AddRef, 01674 DocDispatchEx_Release, 01675 DocDispatchEx_GetTypeInfoCount, 01676 DocDispatchEx_GetTypeInfo, 01677 DocDispatchEx_GetIDsOfNames, 01678 DocDispatchEx_Invoke, 01679 DocDispatchEx_GetDispID, 01680 DocDispatchEx_InvokeEx, 01681 DocDispatchEx_DeleteMemberByName, 01682 DocDispatchEx_DeleteMemberByDispID, 01683 DocDispatchEx_GetMemberProperties, 01684 DocDispatchEx_GetMemberName, 01685 DocDispatchEx_GetNextDispID, 01686 DocDispatchEx_GetNameSpaceParent 01687 }; 01688 01689 static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv) 01690 { 01691 *ppv = NULL; 01692 01693 if(IsEqualGUID(&IID_IUnknown, riid)) { 01694 TRACE("(%p)->(IID_IUnknown, %p)\n", This, ppv); 01695 *ppv = HTMLDOC(This); 01696 }else if(IsEqualGUID(&IID_IDispatch, riid)) { 01697 TRACE("(%p)->(IID_IDispatch, %p)\n", This, ppv); 01698 *ppv = DISPATCHEX(This); 01699 }else if(IsEqualGUID(&IID_IDispatchEx, riid)) { 01700 TRACE("(%p)->(IID_IDispatchEx, %p)\n", This, ppv); 01701 *ppv = DISPATCHEX(This); 01702 }else if(IsEqualGUID(&IID_IHTMLDocument, riid)) { 01703 TRACE("(%p)->(IID_IHTMLDocument, %p)\n", This, ppv); 01704 *ppv = HTMLDOC(This); 01705 }else if(IsEqualGUID(&IID_IHTMLDocument2, riid)) { 01706 TRACE("(%p)->(IID_IHTMLDocument2, %p)\n", This, ppv); 01707 *ppv = HTMLDOC(This); 01708 }else if(IsEqualGUID(&IID_IHTMLDocument3, riid)) { 01709 TRACE("(%p)->(IID_IHTMLDocument3, %p)\n", This, ppv); 01710 *ppv = HTMLDOC3(This); 01711 }else if(IsEqualGUID(&IID_IHTMLDocument4, riid)) { 01712 TRACE("(%p)->(IID_IHTMLDocument4, %p)\n", This, ppv); 01713 *ppv = HTMLDOC4(This); 01714 }else if(IsEqualGUID(&IID_IHTMLDocument5, riid)) { 01715 TRACE("(%p)->(IID_IHTMLDocument5, %p)\n", This, ppv); 01716 *ppv = HTMLDOC5(This); 01717 }else if(IsEqualGUID(&IID_IHTMLDocument6, riid)) { 01718 TRACE("(%p)->(IID_IHTMLDocument6, %p)\n", This, ppv); 01719 *ppv = HTMLDOC6(This); 01720 }else if(IsEqualGUID(&IID_IPersist, riid)) { 01721 TRACE("(%p)->(IID_IPersist, %p)\n", This, ppv); 01722 *ppv = PERSIST(This); 01723 }else if(IsEqualGUID(&IID_IPersistMoniker, riid)) { 01724 TRACE("(%p)->(IID_IPersistMoniker, %p)\n", This, ppv); 01725 *ppv = PERSISTMON(This); 01726 }else if(IsEqualGUID(&IID_IPersistFile, riid)) { 01727 TRACE("(%p)->(IID_IPersistFile, %p)\n", This, ppv); 01728 *ppv = PERSISTFILE(This); 01729 }else if(IsEqualGUID(&IID_IMonikerProp, riid)) { 01730 TRACE("(%p)->(IID_IMonikerProp, %p)\n", This, ppv); 01731 *ppv = MONPROP(This); 01732 }else if(IsEqualGUID(&IID_IOleObject, riid)) { 01733 TRACE("(%p)->(IID_IOleObject, %p)\n", This, ppv); 01734 *ppv = OLEOBJ(This); 01735 }else if(IsEqualGUID(&IID_IOleDocument, riid)) { 01736 TRACE("(%p)->(IID_IOleDocument, %p)\n", This, ppv); 01737 *ppv = OLEDOC(This); 01738 }else if(IsEqualGUID(&IID_IOleDocumentView, riid)) { 01739 TRACE("(%p)->(IID_IOleDocumentView, %p)\n", This, ppv); 01740 *ppv = DOCVIEW(This); 01741 }else if(IsEqualGUID(&IID_IOleInPlaceActiveObject, riid)) { 01742 TRACE("(%p)->(IID_IOleInPlaceActiveObject, %p)\n", This, ppv); 01743 *ppv = ACTOBJ(This); 01744 }else if(IsEqualGUID(&IID_IViewObject, riid)) { 01745 TRACE("(%p)->(IID_IViewObject, %p)\n", This, ppv); 01746 *ppv = VIEWOBJ(This); 01747 }else if(IsEqualGUID(&IID_IViewObject2, riid)) { 01748 TRACE("(%p)->(IID_IViewObject2, %p)\n", This, ppv); 01749 *ppv = VIEWOBJ2(This); 01750 }else if(IsEqualGUID(&IID_IViewObjectEx, riid)) { 01751 TRACE("(%p)->(IID_IViewObjectEx, %p)\n", This, ppv); 01752 *ppv = VIEWOBJEX(This); 01753 }else if(IsEqualGUID(&IID_IOleWindow, riid)) { 01754 TRACE("(%p)->(IID_IOleWindow, %p)\n", This, ppv); 01755 *ppv = OLEWIN(This); 01756 }else if(IsEqualGUID(&IID_IOleInPlaceObject, riid)) { 01757 TRACE("(%p)->(IID_IOleInPlaceObject, %p)\n", This, ppv); 01758 *ppv = INPLACEOBJ(This); 01759 }else if(IsEqualGUID(&IID_IOleInPlaceObjectWindowless, riid)) { 01760 TRACE("(%p)->(IID_IOleInPlaceObjectWindowless, %p)\n", This, ppv); 01761 *ppv = INPLACEWIN(This); 01762 }else if(IsEqualGUID(&IID_IServiceProvider, riid)) { 01763 TRACE("(%p)->(IID_IServiceProvider, %p)\n", This, ppv); 01764 *ppv = SERVPROV(This); 01765 }else if(IsEqualGUID(&IID_IOleCommandTarget, riid)) { 01766 TRACE("(%p)->(IID_IOleCommandTarget, %p)\n", This, ppv); 01767 *ppv = CMDTARGET(This); 01768 }else if(IsEqualGUID(&IID_IOleControl, riid)) { 01769 TRACE("(%p)->(IID_IOleControl, %p)\n", This, ppv); 01770 *ppv = CONTROL(This); 01771 }else if(IsEqualGUID(&IID_IHlinkTarget, riid)) { 01772 TRACE("(%p)->(IID_IHlinkTarget, %p)\n", This, ppv); 01773 *ppv = HLNKTARGET(This); 01774 }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) { 01775 TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv); 01776 *ppv = CONPTCONT(&This->cp_container); 01777 }else if(IsEqualGUID(&IID_IPersistStreamInit, riid)) { 01778 TRACE("(%p)->(IID_IPersistStreamInit %p)\n", This, ppv); 01779 *ppv = PERSTRINIT(This); 01780 }else if(IsEqualGUID(&DIID_DispHTMLDocument, riid)) { 01781 TRACE("(%p)->(DIID_DispHTMLDocument %p)\n", This, ppv); 01782 *ppv = HTMLDOC(This); 01783 }else if(IsEqualGUID(&IID_ISupportErrorInfo, riid)) { 01784 TRACE("(%p)->(IID_ISupportErrorInfo %p)\n", This, ppv); 01785 *ppv = SUPPERRINFO(This); 01786 }else if(IsEqualGUID(&IID_IPersistHistory, riid)) { 01787 TRACE("(%p)->(IID_IPersistHistory %p)\n", This, ppv); 01788 *ppv = PERSISTHIST(This); 01789 }else if(IsEqualGUID(&CLSID_CMarkup, riid)) { 01790 FIXME("(%p)->(CLSID_CMarkup %p)\n", This, ppv); 01791 *ppv = NULL; 01792 }else if(IsEqualGUID(&IID_IRunnableObject, riid)) { 01793 TRACE("(%p)->(IID_IRunnableObject %p) returning NULL\n", This, ppv); 01794 *ppv = NULL; 01795 }else if(IsEqualGUID(&IID_IPersistPropertyBag, riid)) { 01796 TRACE("(%p)->(IID_IPersistPropertyBag %p) returning NULL\n", This, ppv); 01797 *ppv = NULL; 01798 }else if(IsEqualGUID(&IID_IMarshal, riid)) { 01799 TRACE("(%p)->(IID_IMarshal %p) returning NULL\n", This, ppv); 01800 *ppv = NULL; 01801 }else if(IsEqualGUID(&IID_IExternalConnection, riid)) { 01802 TRACE("(%p)->(IID_IExternalConnection %p) returning NULL\n", This, ppv); 01803 *ppv = NULL; 01804 }else if(IsEqualGUID(&IID_IStdMarshalInfo, riid)) { 01805 TRACE("(%p)->(IID_IStdMarshalInfo %p) returning NULL\n", This, ppv); 01806 *ppv = NULL; 01807 }else if(IsEqualGUID(&IID_IObjectWithSite, riid)) { 01808 TRACE("(%p)->(IID_IObjectWithSite %p)\n", This, ppv); 01809 *ppv = OBJSITE(This); 01810 }else { 01811 return FALSE; 01812 } 01813 01814 if(*ppv) 01815 IUnknown_AddRef((IUnknown*)*ppv); 01816 return TRUE; 01817 } 01818 01819 static cp_static_data_t HTMLDocumentEvents_data = { HTMLDocumentEvents_tid, HTMLDocument_on_advise }; 01820 01821 static void init_doc(HTMLDocument *doc, IUnknown *unk_impl, IDispatchEx *dispex) 01822 { 01823 doc->lpHTMLDocument2Vtbl = &HTMLDocumentVtbl; 01824 doc->lpIDispatchExVtbl = &DocDispatchExVtbl; 01825 doc->lpSupportErrorInfoVtbl = &SupportErrorInfoVtbl; 01826 01827 doc->unk_impl = unk_impl; 01828 doc->dispex = dispex; 01829 doc->task_magic = get_task_target_magic(); 01830 01831 HTMLDocument_HTMLDocument3_Init(doc); 01832 HTMLDocument_HTMLDocument5_Init(doc); 01833 HTMLDocument_Persist_Init(doc); 01834 HTMLDocument_OleCmd_Init(doc); 01835 HTMLDocument_OleObj_Init(doc); 01836 HTMLDocument_View_Init(doc); 01837 HTMLDocument_Window_Init(doc); 01838 HTMLDocument_Service_Init(doc); 01839 HTMLDocument_Hlink_Init(doc); 01840 01841 ConnectionPointContainer_Init(&doc->cp_container, (IUnknown*)HTMLDOC(doc)); 01842 ConnectionPoint_Init(&doc->cp_dispatch, &doc->cp_container, &IID_IDispatch, NULL); 01843 ConnectionPoint_Init(&doc->cp_propnotif, &doc->cp_container, &IID_IPropertyNotifySink, NULL); 01844 ConnectionPoint_Init(&doc->cp_htmldocevents, &doc->cp_container, &DIID_HTMLDocumentEvents, &HTMLDocumentEvents_data); 01845 ConnectionPoint_Init(&doc->cp_htmldocevents2, &doc->cp_container, &DIID_HTMLDocumentEvents2, NULL); 01846 } 01847 01848 static void destroy_htmldoc(HTMLDocument *This) 01849 { 01850 remove_target_tasks(This->task_magic); 01851 01852 ConnectionPointContainer_Destroy(&This->cp_container); 01853 } 01854 01855 #define HTMLDOCNODE_NODE_THIS(iface) DEFINE_THIS2(HTMLDocumentNode, node, iface) 01856 01857 static HRESULT HTMLDocumentNode_QI(HTMLDOMNode *iface, REFIID riid, void **ppv) 01858 { 01859 HTMLDocumentNode *This = HTMLDOCNODE_NODE_THIS(iface); 01860 01861 if(htmldoc_qi(&This->basedoc, riid, ppv)) 01862 return *ppv ? S_OK : E_NOINTERFACE; 01863 01864 if(IsEqualGUID(&IID_IInternetHostSecurityManager, riid)) { 01865 TRACE("(%p)->(IID_IInternetHostSecurityManager %p)\n", This, ppv); 01866 *ppv = HOSTSECMGR(This); 01867 }else { 01868 return HTMLDOMNode_QI(&This->node, riid, ppv); 01869 } 01870 01871 IUnknown_AddRef((IUnknown*)*ppv); 01872 return S_OK; 01873 } 01874 01875 static void HTMLDocumentNode_destructor(HTMLDOMNode *iface) 01876 { 01877 HTMLDocumentNode *This = HTMLDOCNODE_NODE_THIS(iface); 01878 01879 if(This->body_event_target) 01880 release_event_target(This->body_event_target); 01881 if(This->nsevent_listener) 01882 release_nsevents(This); 01883 if(This->catmgr) 01884 ICatInformation_Release(This->catmgr); 01885 if(This->secmgr) 01886 IInternetSecurityManager_Release(This->secmgr); 01887 01888 detach_selection(This); 01889 detach_ranges(This); 01890 release_nodes(This); 01891 01892 if(This->nsdoc) { 01893 release_mutation(This); 01894 nsIDOMHTMLDocument_Release(This->nsdoc); 01895 } 01896 01897 heap_free(This->event_vector); 01898 destroy_htmldoc(&This->basedoc); 01899 } 01900 01901 #undef HTMLDOCNODE_NODE_THIS 01902 01903 static const NodeImplVtbl HTMLDocumentNodeImplVtbl = { 01904 HTMLDocumentNode_QI, 01905 HTMLDocumentNode_destructor 01906 }; 01907 01908 static const tid_t HTMLDocumentNode_iface_tids[] = { 01909 IHTMLDOMNode_tid, 01910 IHTMLDOMNode2_tid, 01911 IHTMLDocument2_tid, 01912 IHTMLDocument3_tid, 01913 IHTMLDocument4_tid, 01914 IHTMLDocument5_tid, 01915 0 01916 }; 01917 01918 static dispex_static_data_t HTMLDocumentNode_dispex = { 01919 NULL, 01920 DispHTMLDocument_tid, 01921 NULL, 01922 HTMLDocumentNode_iface_tids 01923 }; 01924 01925 HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_obj, HTMLWindow *window, HTMLDocumentNode **ret) 01926 { 01927 HTMLDocumentNode *doc; 01928 HRESULT hres; 01929 01930 doc = heap_alloc_zero(sizeof(HTMLDocumentNode)); 01931 if(!doc) 01932 return E_OUTOFMEMORY; 01933 01934 doc->basedoc.doc_node = doc; 01935 doc->basedoc.doc_obj = doc_obj; 01936 01937 init_dispex(&doc->node.dispex, (IUnknown*)HTMLDOMNODE(&doc->node), &HTMLDocumentNode_dispex); 01938 init_doc(&doc->basedoc, (IUnknown*)HTMLDOMNODE(&doc->node), DISPATCHEX(&doc->node.dispex)); 01939 HTMLDocumentNode_SecMgr_Init(doc); 01940 doc->ref = 1; 01941 01942 doc->basedoc.window = window; 01943 if(window == doc_obj->basedoc.window) 01944 doc->basedoc.cp_container.forward_container = &doc_obj->basedoc.cp_container; 01945 01946 nsIDOMHTMLDocument_AddRef(nsdoc); 01947 doc->nsdoc = nsdoc; 01948 init_mutation(doc); 01949 init_nsevents(doc); 01950 01951 list_init(&doc->bindings); 01952 list_init(&doc->selection_list); 01953 list_init(&doc->range_list); 01954 01955 HTMLDOMNode_Init(doc, &doc->node, (nsIDOMNode*)nsdoc); 01956 doc->node.vtbl = &HTMLDocumentNodeImplVtbl; 01957 doc->node.cp_container = &doc->basedoc.cp_container; 01958 01959 hres = CoInternetCreateSecurityManager(NULL, &doc->secmgr, 0); 01960 if(FAILED(hres)) { 01961 htmldoc_release(&doc->basedoc); 01962 return hres; 01963 } 01964 01965 *ret = doc; 01966 return S_OK; 01967 } 01968 01969 /********************************************************** 01970 * ICustomDoc implementation 01971 */ 01972 01973 #define CUSTOMDOC_THIS(iface) DEFINE_THIS(HTMLDocumentObj, CustomDoc, iface) 01974 01975 static HRESULT WINAPI CustomDoc_QueryInterface(ICustomDoc *iface, REFIID riid, void **ppv) 01976 { 01977 HTMLDocumentObj *This = CUSTOMDOC_THIS(iface); 01978 01979 if(htmldoc_qi(&This->basedoc, riid, ppv)) 01980 return *ppv ? S_OK : E_NOINTERFACE; 01981 01982 if(IsEqualGUID(&IID_ICustomDoc, riid)) { 01983 TRACE("(%p)->(IID_ICustomDoc %p)\n", This, ppv); 01984 *ppv = CUSTOMDOC(This); 01985 }else if(dispex_query_interface(&This->dispex, riid, ppv)) { 01986 return *ppv ? S_OK : E_NOINTERFACE; 01987 }else { 01988 FIXME("Unimplemented interface %s\n", debugstr_guid(riid)); 01989 *ppv = NULL; 01990 return E_NOINTERFACE; 01991 } 01992 01993 IUnknown_AddRef((IUnknown*)*ppv); 01994 return S_OK; 01995 } 01996 01997 static ULONG WINAPI CustomDoc_AddRef(ICustomDoc *iface) 01998 { 01999 HTMLDocumentObj *This = CUSTOMDOC_THIS(iface); 02000 ULONG ref = InterlockedIncrement(&This->ref); 02001 02002 TRACE("(%p) ref = %u\n", This, ref); 02003 02004 return ref; 02005 } 02006 02007 static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface) 02008 { 02009 HTMLDocumentObj *This = CUSTOMDOC_THIS(iface); 02010 ULONG ref = InterlockedDecrement(&This->ref); 02011 02012 TRACE("(%p) ref = %u\n", This, ref); 02013 02014 if(!ref) { 02015 if(This->basedoc.doc_node) { 02016 This->basedoc.doc_node->basedoc.doc_obj = NULL; 02017 IHTMLDocument2_Release(HTMLDOC(&This->basedoc.doc_node->basedoc)); 02018 } 02019 if(This->basedoc.window) { 02020 This->basedoc.window->doc_obj = NULL; 02021 IHTMLWindow2_Release(HTMLWINDOW2(This->basedoc.window)); 02022 } 02023 if(This->basedoc.advise_holder) 02024 IOleAdviseHolder_Release(This->basedoc.advise_holder); 02025 02026 if(This->view_sink) 02027 IAdviseSink_Release(This->view_sink); 02028 if(This->client) 02029 IOleObject_SetClientSite(OLEOBJ(&This->basedoc), NULL); 02030 if(This->in_place_active) 02031 IOleInPlaceObjectWindowless_InPlaceDeactivate(INPLACEWIN(&This->basedoc)); 02032 if(This->ipsite) 02033 IOleDocumentView_SetInPlaceSite(DOCVIEW(&This->basedoc), NULL); 02034 if(This->undomgr) 02035 IOleUndoManager_Release(This->undomgr); 02036 if(This->tooltips_hwnd) 02037 DestroyWindow(This->tooltips_hwnd); 02038 02039 if(This->hwnd) 02040 DestroyWindow(This->hwnd); 02041 heap_free(This->mime); 02042 02043 destroy_htmldoc(&This->basedoc); 02044 release_dispex(&This->dispex); 02045 02046 if(This->nscontainer) 02047 NSContainer_Release(This->nscontainer); 02048 heap_free(This); 02049 } 02050 02051 return ref; 02052 } 02053 02054 static HRESULT WINAPI CustomDoc_SetUIHandler(ICustomDoc *iface, IDocHostUIHandler *pUIHandler) 02055 { 02056 HTMLDocumentObj *This = CUSTOMDOC_THIS(iface); 02057 FIXME("(%p)->(%p)\n", This, pUIHandler); 02058 return E_NOTIMPL; 02059 } 02060 02061 #undef CUSTOMDOC_THIS 02062 02063 static const ICustomDocVtbl CustomDocVtbl = { 02064 CustomDoc_QueryInterface, 02065 CustomDoc_AddRef, 02066 CustomDoc_Release, 02067 CustomDoc_SetUIHandler 02068 }; 02069 02070 static const tid_t HTMLDocumentObj_iface_tids[] = { 02071 IHTMLDocument2_tid, 02072 IHTMLDocument3_tid, 02073 IHTMLDocument4_tid, 02074 IHTMLDocument5_tid, 02075 0 02076 }; 02077 static dispex_static_data_t HTMLDocumentObj_dispex = { 02078 NULL, 02079 DispHTMLDocument_tid, 02080 NULL, 02081 HTMLDocumentObj_iface_tids 02082 }; 02083 02084 HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject) 02085 { 02086 HTMLDocumentObj *doc; 02087 nsIDOMWindow *nswindow = NULL; 02088 nsresult nsres; 02089 HRESULT hres; 02090 02091 TRACE("(%p %s %p)\n", pUnkOuter, debugstr_guid(riid), ppvObject); 02092 02093 doc = heap_alloc_zero(sizeof(HTMLDocumentObj)); 02094 if(!doc) 02095 return E_OUTOFMEMORY; 02096 02097 init_dispex(&doc->dispex, (IUnknown*)CUSTOMDOC(doc), &HTMLDocumentObj_dispex); 02098 init_doc(&doc->basedoc, (IUnknown*)CUSTOMDOC(doc), DISPATCHEX(&doc->dispex)); 02099 02100 doc->lpCustomDocVtbl = &CustomDocVtbl; 02101 doc->ref = 1; 02102 doc->basedoc.doc_obj = doc; 02103 02104 doc->usermode = UNKNOWN_USERMODE; 02105 02106 doc->nscontainer = NSContainer_Create(doc, NULL); 02107 if(!doc->nscontainer) { 02108 ERR("Failed to init Gecko, returning CLASS_E_CLASSNOTAVAILABLE\n"); 02109 htmldoc_release(&doc->basedoc); 02110 return CLASS_E_CLASSNOTAVAILABLE; 02111 } 02112 02113 hres = htmldoc_query_interface(&doc->basedoc, riid, ppvObject); 02114 htmldoc_release(&doc->basedoc); 02115 if(FAILED(hres)) 02116 return hres; 02117 02118 02119 nsres = nsIWebBrowser_GetContentDOMWindow(doc->nscontainer->webbrowser, &nswindow); 02120 if(NS_FAILED(nsres)) 02121 ERR("GetContentDOMWindow failed: %08x\n", nsres); 02122 02123 hres = HTMLWindow_Create(doc, nswindow, NULL /* FIXME */, &doc->basedoc.window); 02124 if(nswindow) 02125 nsIDOMWindow_Release(nswindow); 02126 if(FAILED(hres)) { 02127 IHTMLDocument_Release(HTMLDOC(&doc->basedoc)); 02128 return hres; 02129 } 02130 02131 if(!doc->basedoc.doc_node && doc->basedoc.window->doc) { 02132 doc->basedoc.doc_node = doc->basedoc.window->doc; 02133 htmldoc_addref(&doc->basedoc.doc_node->basedoc); 02134 } 02135 02136 get_thread_hwnd(); 02137 02138 return S_OK; 02139 } Generated on Sat May 26 2012 04:23:28 for ReactOS by
1.7.6.1
|