ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

htmldoc3.c
Go to the documentation of this file.
00001 /*
00002  * Copyright 2005 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 "ole2.h"
00030 
00031 #include "wine/debug.h"
00032 
00033 #include "mshtml_private.h"
00034 #include "htmlevent.h"
00035 
00036 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
00037 
00038 #define HTMLDOC3_THIS(iface) DEFINE_THIS(HTMLDocument, HTMLDocument3, iface)
00039 
00040 static HRESULT WINAPI HTMLDocument3_QueryInterface(IHTMLDocument3 *iface,
00041                                                   REFIID riid, void **ppv)
00042 {
00043     HTMLDocument *This = HTMLDOC3_THIS(iface);
00044     return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppv);
00045 }
00046 
00047 static ULONG WINAPI HTMLDocument3_AddRef(IHTMLDocument3 *iface)
00048 {
00049     HTMLDocument *This = HTMLDOC3_THIS(iface);
00050     return IHTMLDocument2_AddRef(HTMLDOC(This));
00051 }
00052 
00053 static ULONG WINAPI HTMLDocument3_Release(IHTMLDocument3 *iface)
00054 {
00055     HTMLDocument *This = HTMLDOC3_THIS(iface);
00056     return IHTMLDocument2_Release(HTMLDOC(This));
00057 }
00058 
00059 static HRESULT WINAPI HTMLDocument3_GetTypeInfoCount(IHTMLDocument3 *iface, UINT *pctinfo)
00060 {
00061     HTMLDocument *This = HTMLDOC3_THIS(iface);
00062     return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This), pctinfo);
00063 }
00064 
00065 static HRESULT WINAPI HTMLDocument3_GetTypeInfo(IHTMLDocument3 *iface, UINT iTInfo,
00066                                                 LCID lcid, ITypeInfo **ppTInfo)
00067 {
00068     HTMLDocument *This = HTMLDOC3_THIS(iface);
00069     return IDispatchEx_GetTypeInfo(DISPATCHEX(This), iTInfo, lcid, ppTInfo);
00070 }
00071 
00072 static HRESULT WINAPI HTMLDocument3_GetIDsOfNames(IHTMLDocument3 *iface, REFIID riid,
00073                                                 LPOLESTR *rgszNames, UINT cNames,
00074                                                 LCID lcid, DISPID *rgDispId)
00075 {
00076     HTMLDocument *This = HTMLDOC3_THIS(iface);
00077     return IDispatchEx_GetIDsOfNames(DISPATCHEX(This), riid, rgszNames, cNames, lcid, rgDispId);
00078 }
00079 
00080 static HRESULT WINAPI HTMLDocument3_Invoke(IHTMLDocument3 *iface, DISPID dispIdMember,
00081                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
00082                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
00083 {
00084     HTMLDocument *This = HTMLDOC3_THIS(iface);
00085     return IDispatchEx_Invoke(DISPATCHEX(This), dispIdMember, riid, lcid, wFlags, pDispParams,
00086             pVarResult, pExcepInfo, puArgErr);
00087 }
00088 
00089 static HRESULT WINAPI HTMLDocument3_releaseCapture(IHTMLDocument3 *iface)
00090 {
00091     HTMLDocument *This = HTMLDOC3_THIS(iface);
00092     FIXME("(%p)\n", This);
00093     return E_NOTIMPL;
00094 }
00095 
00096 static HRESULT WINAPI HTMLDocument3_recalc(IHTMLDocument3 *iface, VARIANT_BOOL fForce)
00097 {
00098     HTMLDocument *This = HTMLDOC3_THIS(iface);
00099     FIXME("(%p)->(%x)\n", This, fForce);
00100     return E_NOTIMPL;
00101 }
00102 
00103 static HRESULT WINAPI HTMLDocument3_createTextNode(IHTMLDocument3 *iface, BSTR text,
00104                                                    IHTMLDOMNode **newTextNode)
00105 {
00106     HTMLDocument *This = HTMLDOC3_THIS(iface);
00107     nsIDOMText *nstext;
00108     HTMLDOMNode *node;
00109     nsAString text_str;
00110     nsresult nsres;
00111 
00112     TRACE("(%p)->(%s %p)\n", This, debugstr_w(text), newTextNode);
00113 
00114     if(!This->doc_node->nsdoc) {
00115         WARN("NULL nsdoc\n");
00116         return E_UNEXPECTED;
00117     }
00118 
00119     nsAString_InitDepend(&text_str, text);
00120     nsres = nsIDOMHTMLDocument_CreateTextNode(This->doc_node->nsdoc, &text_str, &nstext);
00121     nsAString_Finish(&text_str);
00122     if(NS_FAILED(nsres)) {
00123         ERR("CreateTextNode failed: %08x\n", nsres);
00124         return E_FAIL;
00125     }
00126 
00127     node = HTMLDOMTextNode_Create(This->doc_node, (nsIDOMNode*)nstext);
00128     nsIDOMElement_Release(nstext);
00129 
00130     *newTextNode = HTMLDOMNODE(node);
00131     IHTMLDOMNode_AddRef(HTMLDOMNODE(node));
00132     return S_OK;
00133 }
00134 
00135 static HRESULT WINAPI HTMLDocument3_get_documentElement(IHTMLDocument3 *iface, IHTMLElement **p)
00136 {
00137     HTMLDocument *This = HTMLDOC3_THIS(iface);
00138     nsIDOMElement *nselem = NULL;
00139     HTMLDOMNode *node;
00140     nsresult nsres;
00141 
00142     TRACE("(%p)->(%p)\n", This, p);
00143 
00144     if(This->window->readystate == READYSTATE_UNINITIALIZED) {
00145         *p = NULL;
00146         return S_OK;
00147     }
00148 
00149     if(!This->doc_node->nsdoc) {
00150         WARN("NULL nsdoc\n");
00151         return E_UNEXPECTED;
00152     }
00153 
00154     nsres = nsIDOMHTMLDocument_GetDocumentElement(This->doc_node->nsdoc, &nselem);
00155     if(NS_FAILED(nsres)) {
00156         ERR("GetDocumentElement failed: %08x\n", nsres);
00157         return E_FAIL;
00158     }
00159 
00160     if(nselem) {
00161         node = get_node(This->doc_node, (nsIDOMNode *)nselem, TRUE);
00162         nsIDOMElement_Release(nselem);
00163         IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node), &IID_IHTMLElement, (void**)p);
00164     }else {
00165         *p = NULL;
00166     }
00167 
00168     return S_OK;
00169 }
00170 
00171 static HRESULT WINAPI HTMLDocument3_uniqueID(IHTMLDocument3 *iface, BSTR *p)
00172 {
00173     HTMLDocument *This = HTMLDOC3_THIS(iface);
00174     FIXME("(%p)->(%p)\n", This, p);
00175     return E_NOTIMPL;
00176 }
00177 
00178 static HRESULT WINAPI HTMLDocument3_attachEvent(IHTMLDocument3 *iface, BSTR event,
00179                                                 IDispatch* pDisp, VARIANT_BOOL *pfResult)
00180 {
00181     HTMLDocument *This = HTMLDOC3_THIS(iface);
00182 
00183     TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult);
00184 
00185     return attach_event(&This->doc_node->node.event_target, This->doc_node->node.nsnode, This, event, pDisp, pfResult);
00186 }
00187 
00188 static HRESULT WINAPI HTMLDocument3_detachEvent(IHTMLDocument3 *iface, BSTR event,
00189                                                 IDispatch *pDisp)
00190 {
00191     HTMLDocument *This = HTMLDOC3_THIS(iface);
00192 
00193     TRACE("(%p)->(%s %p)\n", This, debugstr_w(event), pDisp);
00194 
00195     return detach_event(This->doc_node->node.event_target, This, event, pDisp);
00196 }
00197 
00198 static HRESULT WINAPI HTMLDocument3_put_onrowsdelete(IHTMLDocument3 *iface, VARIANT v)
00199 {
00200     HTMLDocument *This = HTMLDOC3_THIS(iface);
00201     FIXME("(%p)->()\n", This);
00202     return E_NOTIMPL;
00203 }
00204 
00205 static HRESULT WINAPI HTMLDocument3_get_onrowsdelete(IHTMLDocument3 *iface, VARIANT *p)
00206 {
00207     HTMLDocument *This = HTMLDOC3_THIS(iface);
00208     FIXME("(%p)->(%p)\n", This, p);
00209     return E_NOTIMPL;
00210 }
00211 
00212 static HRESULT WINAPI HTMLDocument3_put_onrowsinserted(IHTMLDocument3 *iface, VARIANT v)
00213 {
00214     HTMLDocument *This = HTMLDOC3_THIS(iface);
00215     FIXME("(%p)->()\n", This);
00216     return E_NOTIMPL;
00217 }
00218 
00219 static HRESULT WINAPI HTMLDocument3_get_onrowsinserted(IHTMLDocument3 *iface, VARIANT *p)
00220 {
00221     HTMLDocument *This = HTMLDOC3_THIS(iface);
00222     FIXME("(%p)->(%p)\n", This, p);
00223     return E_NOTIMPL;
00224 }
00225 
00226 static HRESULT WINAPI HTMLDocument3_put_oncellchange(IHTMLDocument3 *iface, VARIANT v)
00227 {
00228     HTMLDocument *This = HTMLDOC3_THIS(iface);
00229     FIXME("(%p)->()\n", This);
00230     return E_NOTIMPL;
00231 }
00232 
00233 static HRESULT WINAPI HTMLDocument3_get_oncellchange(IHTMLDocument3 *iface, VARIANT *p)
00234 {
00235     HTMLDocument *This = HTMLDOC3_THIS(iface);
00236     FIXME("(%p)->(%p)\n", This, p);
00237     return E_NOTIMPL;
00238 }
00239 
00240 static HRESULT WINAPI HTMLDocument3_put_ondatasetchanged(IHTMLDocument3 *iface, VARIANT v)
00241 {
00242     HTMLDocument *This = HTMLDOC3_THIS(iface);
00243     FIXME("(%p)->()\n", This);
00244     return E_NOTIMPL;
00245 }
00246 
00247 static HRESULT WINAPI HTMLDocument3_get_ondatasetchanged(IHTMLDocument3 *iface, VARIANT *p)
00248 {
00249     HTMLDocument *This = HTMLDOC3_THIS(iface);
00250     FIXME("(%p)->(%p)\n", This, p);
00251     return E_NOTIMPL;
00252 }
00253 
00254 static HRESULT WINAPI HTMLDocument3_put_ondataavailable(IHTMLDocument3 *iface, VARIANT v)
00255 {
00256     HTMLDocument *This = HTMLDOC3_THIS(iface);
00257     FIXME("(%p)->()\n", This);
00258     return E_NOTIMPL;
00259 }
00260 
00261 static HRESULT WINAPI HTMLDocument3_get_ondataavailable(IHTMLDocument3 *iface, VARIANT *p)
00262 {
00263     HTMLDocument *This = HTMLDOC3_THIS(iface);
00264     FIXME("(%p)->(%p)\n", This, p);
00265     return E_NOTIMPL;
00266 }
00267 
00268 static HRESULT WINAPI HTMLDocument3_put_ondatasetcomplete(IHTMLDocument3 *iface, VARIANT v)
00269 {
00270     HTMLDocument *This = HTMLDOC3_THIS(iface);
00271     FIXME("(%p)->()\n", This);
00272     return E_NOTIMPL;
00273 }
00274 
00275 static HRESULT WINAPI HTMLDocument3_get_ondatasetcomplete(IHTMLDocument3 *iface, VARIANT *p)
00276 {
00277     HTMLDocument *This = HTMLDOC3_THIS(iface);
00278     FIXME("(%p)->(%p)\n", This, p);
00279     return E_NOTIMPL;
00280 }
00281 
00282 static HRESULT WINAPI HTMLDocument3_put_onpropertychange(IHTMLDocument3 *iface, VARIANT v)
00283 {
00284     HTMLDocument *This = HTMLDOC3_THIS(iface);
00285     FIXME("(%p)->()\n", This);
00286     return E_NOTIMPL;
00287 }
00288 
00289 static HRESULT WINAPI HTMLDocument3_get_onpropertychange(IHTMLDocument3 *iface, VARIANT *p)
00290 {
00291     HTMLDocument *This = HTMLDOC3_THIS(iface);
00292     FIXME("(%p)->(%p)\n", This, p);
00293     return E_NOTIMPL;
00294 }
00295 
00296 static HRESULT WINAPI HTMLDocument3_put_dir(IHTMLDocument3 *iface, BSTR v)
00297 {
00298     HTMLDocument *This = HTMLDOC3_THIS(iface);
00299     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
00300     return E_NOTIMPL;
00301 }
00302 
00303 static HRESULT WINAPI HTMLDocument3_get_dir(IHTMLDocument3 *iface, BSTR *p)
00304 {
00305     HTMLDocument *This = HTMLDOC3_THIS(iface);
00306     FIXME("(%p)->(%p)\n", This, p);
00307     return E_NOTIMPL;
00308 }
00309 
00310 static HRESULT WINAPI HTMLDocument3_put_oncontextmenu(IHTMLDocument3 *iface, VARIANT v)
00311 {
00312     HTMLDocument *This = HTMLDOC3_THIS(iface);
00313 
00314     TRACE("(%p)->()\n", This);
00315 
00316     return set_doc_event(This, EVENTID_CONTEXTMENU, &v);
00317 }
00318 
00319 static HRESULT WINAPI HTMLDocument3_get_oncontextmenu(IHTMLDocument3 *iface, VARIANT *p)
00320 {
00321     HTMLDocument *This = HTMLDOC3_THIS(iface);
00322 
00323     TRACE("(%p)->(%p)\n", This, p);
00324 
00325     return get_doc_event(This, EVENTID_CONTEXTMENU, p);
00326 }
00327 
00328 static HRESULT WINAPI HTMLDocument3_put_onstop(IHTMLDocument3 *iface, VARIANT v)
00329 {
00330     HTMLDocument *This = HTMLDOC3_THIS(iface);
00331     FIXME("(%p)->()\n", This);
00332     return E_NOTIMPL;
00333 }
00334 
00335 static HRESULT WINAPI HTMLDocument3_get_onstop(IHTMLDocument3 *iface, VARIANT *p)
00336 {
00337     HTMLDocument *This = HTMLDOC3_THIS(iface);
00338     FIXME("(%p)->(%p)\n", This, p);
00339     return E_NOTIMPL;
00340 }
00341 
00342 static HRESULT WINAPI HTMLDocument3_createDocumentFragment(IHTMLDocument3 *iface,
00343                                                            IHTMLDocument2 **ppNewDoc)
00344 {
00345     HTMLDocument *This = HTMLDOC3_THIS(iface);
00346     FIXME("(%p)->(%p)\n", This, ppNewDoc);
00347     return E_NOTIMPL;
00348 }
00349 
00350 static HRESULT WINAPI HTMLDocument3_get_parentDocument(IHTMLDocument3 *iface,
00351                                                        IHTMLDocument2 **p)
00352 {
00353     HTMLDocument *This = HTMLDOC3_THIS(iface);
00354     FIXME("(%p)->(%p)\n", This, p);
00355     return E_NOTIMPL;
00356 }
00357 
00358 static HRESULT WINAPI HTMLDocument3_put_enableDownload(IHTMLDocument3 *iface,
00359                                                        VARIANT_BOOL v)
00360 {
00361     HTMLDocument *This = HTMLDOC3_THIS(iface);
00362     FIXME("(%p)->(%x)\n", This, v);
00363     return E_NOTIMPL;
00364 }
00365 
00366 static HRESULT WINAPI HTMLDocument3_get_enableDownload(IHTMLDocument3 *iface,
00367                                                        VARIANT_BOOL *p)
00368 {
00369     HTMLDocument *This = HTMLDOC3_THIS(iface);
00370     FIXME("(%p)->(%p)\n", This, p);
00371     return E_NOTIMPL;
00372 }
00373 
00374 static HRESULT WINAPI HTMLDocument3_put_baseUrl(IHTMLDocument3 *iface, BSTR v)
00375 {
00376     HTMLDocument *This = HTMLDOC3_THIS(iface);
00377     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
00378     return E_NOTIMPL;
00379 }
00380 
00381 static HRESULT WINAPI HTMLDocument3_get_baseUrl(IHTMLDocument3 *iface, BSTR *p)
00382 {
00383     HTMLDocument *This = HTMLDOC3_THIS(iface);
00384     FIXME("(%p)->(%p)\n", This, p);
00385     return E_NOTIMPL;
00386 }
00387 
00388 static HRESULT WINAPI HTMLDocument3_get_childNodes(IHTMLDocument3 *iface, IDispatch **p)
00389 {
00390     HTMLDocument *This = HTMLDOC3_THIS(iface);
00391     FIXME("(%p)->(%p)\n", This, p);
00392     return E_NOTIMPL;
00393 }
00394 
00395 static HRESULT WINAPI HTMLDocument3_put_inheritStyleSheets(IHTMLDocument3 *iface,
00396                                                            VARIANT_BOOL v)
00397 {
00398     HTMLDocument *This = HTMLDOC3_THIS(iface);
00399     FIXME("(%p)->()\n", This);
00400     return E_NOTIMPL;
00401 }
00402 
00403 static HRESULT WINAPI HTMLDocument3_get_inheritStyleSheets(IHTMLDocument3 *iface,
00404                                                            VARIANT_BOOL *p)
00405 {
00406     HTMLDocument *This = HTMLDOC3_THIS(iface);
00407     FIXME("(%p)->(%p)\n", This, p);
00408     return E_NOTIMPL;
00409 }
00410 
00411 static HRESULT WINAPI HTMLDocument3_put_onbeforeeditfocus(IHTMLDocument3 *iface, VARIANT v)
00412 {
00413     HTMLDocument *This = HTMLDOC3_THIS(iface);
00414     FIXME("(%p)->()\n", This);
00415     return E_NOTIMPL;
00416 }
00417 
00418 static HRESULT WINAPI HTMLDocument3_get_onbeforeeditfocus(IHTMLDocument3 *iface, VARIANT *p)
00419 {
00420     HTMLDocument *This = HTMLDOC3_THIS(iface);
00421     FIXME("(%p)->(%p)\n", This, p);
00422     return E_NOTIMPL;
00423 }
00424 
00425 static HRESULT WINAPI HTMLDocument3_getElementsByName(IHTMLDocument3 *iface, BSTR v,
00426                                                       IHTMLElementCollection **ppelColl)
00427 {
00428     HTMLDocument *This = HTMLDOC3_THIS(iface);
00429     FIXME("(%p)->(%s %p)\n", This, debugstr_w(v), ppelColl);
00430     return E_NOTIMPL;
00431 }
00432 
00433 
00434 static HRESULT WINAPI HTMLDocument3_getElementById(IHTMLDocument3 *iface, BSTR v,
00435                                                    IHTMLElement **pel)
00436 {
00437     HTMLDocument *This = HTMLDOC3_THIS(iface);
00438     nsIDOMElement *nselem;
00439     HTMLDOMNode *node;
00440     nsIDOMNode *nsnode, *nsnode_by_id, *nsnode_by_name;
00441     nsIDOMNodeList *nsnode_list;
00442     nsAString id_str;
00443     nsresult nsres;
00444 
00445     TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pel);
00446 
00447     if(!This->doc_node->nsdoc) {
00448         WARN("NULL nsdoc\n");
00449         return E_UNEXPECTED;
00450     }
00451 
00452     nsAString_InitDepend(&id_str, v);
00453     /* get element by id attribute */
00454     nsres = nsIDOMHTMLDocument_GetElementById(This->doc_node->nsdoc, &id_str, &nselem);
00455     if(FAILED(nsres)) {
00456         ERR("GetElementById failed: %08x\n", nsres);
00457         nsAString_Finish(&id_str);
00458         return E_FAIL;
00459     }
00460     nsnode_by_id = (nsIDOMNode*)nselem;
00461 
00462     /* get first element by name attribute */
00463     nsres = nsIDOMHTMLDocument_GetElementsByName(This->doc_node->nsdoc, &id_str, &nsnode_list);
00464     nsAString_Finish(&id_str);
00465     if(FAILED(nsres)) {
00466         ERR("getElementsByName failed: %08x\n", nsres);
00467         if(nsnode_by_id)
00468             nsIDOMNode_Release(nsnode_by_id);
00469         return E_FAIL;
00470     }
00471     nsIDOMNodeList_Item(nsnode_list, 0, &nsnode_by_name);
00472     nsIDOMNodeList_Release(nsnode_list);
00473 
00474 
00475     if(nsnode_by_name && nsnode_by_id) {
00476         nsIDOM3Node *node3;
00477         PRUint16 pos;
00478 
00479         nsres = nsIDOMNode_QueryInterface(nsnode_by_name, &IID_nsIDOM3Node, (void**)&node3);
00480         if(NS_FAILED(nsres)) {
00481             FIXME("failed to get nsIDOM3Node interface: 0x%08x\n", nsres);
00482             nsIDOMNode_Release(nsnode_by_name);
00483             nsIDOMNode_Release(nsnode_by_id);
00484             return E_FAIL;
00485         }
00486 
00487         nsres = nsIDOM3Node_CompareDocumentPosition(node3, nsnode_by_id, &pos);
00488         nsIDOM3Node_Release(node3);
00489         if(NS_FAILED(nsres)) {
00490             FIXME("nsIDOM3Node_CompareDocumentPosition failed: 0x%08x\n", nsres);
00491             nsIDOMNode_Release(nsnode_by_name);
00492             nsIDOMNode_Release(nsnode_by_id);
00493             return E_FAIL;
00494         }
00495 
00496         TRACE("CompareDocumentPosition gave: 0x%x\n", pos);
00497         if(pos & PRECEDING || pos & CONTAINS) {
00498             nsnode = nsnode_by_id;
00499             nsIDOMNode_Release(nsnode_by_name);
00500         }else {
00501             nsnode = nsnode_by_name;
00502             nsIDOMNode_Release(nsnode_by_id);
00503         }
00504     }else
00505         nsnode = nsnode_by_name ? nsnode_by_name : nsnode_by_id;
00506 
00507     if(nsnode) {
00508         node = get_node(This->doc_node, nsnode, TRUE);
00509         nsIDOMNode_Release(nsnode);
00510 
00511         IHTMLDOMNode_QueryInterface(HTMLDOMNODE(node), &IID_IHTMLElement, (void**)pel);
00512     }else {
00513         *pel = NULL;
00514     }
00515 
00516     return S_OK;
00517 }
00518 
00519 
00520 static HRESULT WINAPI HTMLDocument3_getElementsByTagName(IHTMLDocument3 *iface, BSTR v,
00521                                                          IHTMLElementCollection **pelColl)
00522 {
00523     HTMLDocument *This = HTMLDOC3_THIS(iface);
00524     nsIDOMNodeList *nslist;
00525     nsAString id_str, ns_str;
00526     nsresult nsres;
00527     static const WCHAR str[] = {'*',0};
00528 
00529     TRACE("(%p)->(%s %p)\n", This, debugstr_w(v), pelColl);
00530 
00531     if(!This->doc_node->nsdoc) {
00532         WARN("NULL nsdoc\n");
00533         return E_UNEXPECTED;
00534     }
00535 
00536     nsAString_InitDepend(&id_str, v);
00537     nsAString_InitDepend(&ns_str, str);
00538     nsres = nsIDOMHTMLDocument_GetElementsByTagNameNS(This->doc_node->nsdoc, &ns_str, &id_str, &nslist);
00539     nsAString_Finish(&id_str);
00540     nsAString_Finish(&ns_str);
00541     if(FAILED(nsres)) {
00542         ERR("GetElementByName failed: %08x\n", nsres);
00543         return E_FAIL;
00544     }
00545 
00546     *pelColl = (IHTMLElementCollection*)create_collection_from_nodelist(This->doc_node, (IUnknown*)HTMLDOC3(This), nslist);
00547     nsIDOMNodeList_Release(nslist);
00548 
00549     return S_OK;
00550 }
00551 
00552 #undef HTMLDOC3_THIS
00553 
00554 static const IHTMLDocument3Vtbl HTMLDocument3Vtbl = {
00555     HTMLDocument3_QueryInterface,
00556     HTMLDocument3_AddRef,
00557     HTMLDocument3_Release,
00558     HTMLDocument3_GetTypeInfoCount,
00559     HTMLDocument3_GetTypeInfo,
00560     HTMLDocument3_GetIDsOfNames,
00561     HTMLDocument3_Invoke,
00562     HTMLDocument3_releaseCapture,
00563     HTMLDocument3_recalc,
00564     HTMLDocument3_createTextNode,
00565     HTMLDocument3_get_documentElement,
00566     HTMLDocument3_uniqueID,
00567     HTMLDocument3_attachEvent,
00568     HTMLDocument3_detachEvent,
00569     HTMLDocument3_put_onrowsdelete,
00570     HTMLDocument3_get_onrowsdelete,
00571     HTMLDocument3_put_onrowsinserted,
00572     HTMLDocument3_get_onrowsinserted,
00573     HTMLDocument3_put_oncellchange,
00574     HTMLDocument3_get_oncellchange,
00575     HTMLDocument3_put_ondatasetchanged,
00576     HTMLDocument3_get_ondatasetchanged,
00577     HTMLDocument3_put_ondataavailable,
00578     HTMLDocument3_get_ondataavailable,
00579     HTMLDocument3_put_ondatasetcomplete,
00580     HTMLDocument3_get_ondatasetcomplete,
00581     HTMLDocument3_put_onpropertychange,
00582     HTMLDocument3_get_onpropertychange,
00583     HTMLDocument3_put_dir,
00584     HTMLDocument3_get_dir,
00585     HTMLDocument3_put_oncontextmenu,
00586     HTMLDocument3_get_oncontextmenu,
00587     HTMLDocument3_put_onstop,
00588     HTMLDocument3_get_onstop,
00589     HTMLDocument3_createDocumentFragment,
00590     HTMLDocument3_get_parentDocument,
00591     HTMLDocument3_put_enableDownload,
00592     HTMLDocument3_get_enableDownload,
00593     HTMLDocument3_put_baseUrl,
00594     HTMLDocument3_get_baseUrl,
00595     HTMLDocument3_get_childNodes,
00596     HTMLDocument3_put_inheritStyleSheets,
00597     HTMLDocument3_get_inheritStyleSheets,
00598     HTMLDocument3_put_onbeforeeditfocus,
00599     HTMLDocument3_get_onbeforeeditfocus,
00600     HTMLDocument3_getElementsByName,
00601     HTMLDocument3_getElementById,
00602     HTMLDocument3_getElementsByTagName
00603 };
00604 
00605 #define HTMLDOC4_THIS(iface) DEFINE_THIS(HTMLDocument, HTMLDocument4, iface)
00606 
00607 static HRESULT WINAPI HTMLDocument4_QueryInterface(IHTMLDocument4 *iface,
00608                                                    REFIID riid, void **ppv)
00609 {
00610     HTMLDocument *This = HTMLDOC4_THIS(iface);
00611     return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppv);
00612 }
00613 
00614 static ULONG WINAPI HTMLDocument4_AddRef(IHTMLDocument4 *iface)
00615 {
00616     HTMLDocument *This = HTMLDOC4_THIS(iface);
00617     return IHTMLDocument2_AddRef(HTMLDOC(This));
00618 }
00619 
00620 static ULONG WINAPI HTMLDocument4_Release(IHTMLDocument4 *iface)
00621 {
00622     HTMLDocument *This = HTMLDOC4_THIS(iface);
00623     return IHTMLDocument2_Release(HTMLDOC(This));
00624 }
00625 
00626 static HRESULT WINAPI HTMLDocument4_GetTypeInfoCount(IHTMLDocument4 *iface, UINT *pctinfo)
00627 {
00628     HTMLDocument *This = HTMLDOC4_THIS(iface);
00629     return IDispatchEx_GetTypeInfoCount(DISPATCHEX(This), pctinfo);
00630 }
00631 
00632 static HRESULT WINAPI HTMLDocument4_GetTypeInfo(IHTMLDocument4 *iface, UINT iTInfo,
00633                                                 LCID lcid, ITypeInfo **ppTInfo)
00634 {
00635     HTMLDocument *This = HTMLDOC4_THIS(iface);
00636     return IDispatchEx_GetTypeInfo(DISPATCHEX(This), iTInfo, lcid, ppTInfo);
00637 }
00638 
00639 static HRESULT WINAPI HTMLDocument4_GetIDsOfNames(IHTMLDocument4 *iface, REFIID riid,
00640                                                 LPOLESTR *rgszNames, UINT cNames,
00641                                                 LCID lcid, DISPID *rgDispId)
00642 {
00643     HTMLDocument *This = HTMLDOC4_THIS(iface);
00644     return IDispatchEx_GetIDsOfNames(DISPATCHEX(This), riid, rgszNames, cNames, lcid, rgDispId);
00645 }
00646 
00647 static HRESULT WINAPI HTMLDocument4_Invoke(IHTMLDocument4 *iface, DISPID dispIdMember,
00648                             REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
00649                             VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
00650 {
00651     HTMLDocument *This = HTMLDOC4_THIS(iface);
00652     return IDispatchEx_Invoke(DISPATCHEX(This), dispIdMember, riid, lcid, wFlags, pDispParams,
00653             pVarResult, pExcepInfo, puArgErr);
00654 }
00655 
00656 static HRESULT WINAPI HTMLDocument4_focus(IHTMLDocument4 *iface)
00657 {
00658     HTMLDocument *This = HTMLDOC4_THIS(iface);
00659     nsIDOMNSHTMLElement *nselem;
00660     nsIDOMHTMLElement *nsbody;
00661     nsresult nsres;
00662 
00663     TRACE("(%p)->()\n", This);
00664 
00665     nsres = nsIDOMHTMLDocument_GetBody(This->doc_node->nsdoc, &nsbody);
00666     if(NS_FAILED(nsres) || !nsbody) {
00667         ERR("GetBody failed: %08x\n", nsres);
00668         return E_FAIL;
00669     }
00670 
00671     nsres = nsIDOMHTMLElement_QueryInterface(nsbody, &IID_nsIDOMNSHTMLElement, (void**)&nselem);
00672     nsIDOMHTMLElement_Release(nsbody);
00673     if(NS_FAILED(nsres)) {
00674         ERR("Could not get nsIDOMNSHTMLElement: %08x\n", nsres);
00675         return E_FAIL;
00676     }
00677 
00678     nsres = nsIDOMNSHTMLElement_Focus(nselem);
00679     nsIDOMNSHTMLElement_Release(nselem);
00680     if(NS_FAILED(nsres)) {
00681         ERR("Focus failed: %08x\n", nsres);
00682         return E_FAIL;
00683     }
00684 
00685     return S_OK;
00686 }
00687 
00688 static HRESULT WINAPI HTMLDocument4_hasFocus(IHTMLDocument4 *iface, VARIANT_BOOL *pfFocus)
00689 {
00690     HTMLDocument *This = HTMLDOC4_THIS(iface);
00691     FIXME("(%p)->(%p)\n", This, pfFocus);
00692     return E_NOTIMPL;
00693 }
00694 
00695 static HRESULT WINAPI HTMLDocument4_put_onselectionchange(IHTMLDocument4 *iface, VARIANT v)
00696 {
00697     HTMLDocument *This = HTMLDOC4_THIS(iface);
00698     FIXME("(%p)->(v)\n", This);
00699     return E_NOTIMPL;
00700 }
00701 
00702 static HRESULT WINAPI HTMLDocument4_get_onselectionchange(IHTMLDocument4 *iface, VARIANT *p)
00703 {
00704     HTMLDocument *This = HTMLDOC4_THIS(iface);
00705     FIXME("(%p)->(%p)\n", This, p);
00706     return E_NOTIMPL;
00707 }
00708 
00709 static HRESULT WINAPI HTMLDocument4_get_namespace(IHTMLDocument4 *iface, IDispatch **p)
00710 {
00711     HTMLDocument *This = HTMLDOC4_THIS(iface);
00712     FIXME("(%p)->(%p)\n", This, p);
00713     return E_NOTIMPL;
00714 }
00715 
00716 static HRESULT WINAPI HTMLDocument4_createDocumentFromUrl(IHTMLDocument4 *iface, BSTR bstrUrl,
00717         BSTR bstrOptions, IHTMLDocument2 **newDoc)
00718 {
00719     HTMLDocument *This = HTMLDOC4_THIS(iface);
00720     FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(bstrUrl), debugstr_w(bstrOptions), newDoc);
00721     return E_NOTIMPL;
00722 }
00723 
00724 static HRESULT WINAPI HTMLDocument4_put_media(IHTMLDocument4 *iface, BSTR v)
00725 {
00726     HTMLDocument *This = HTMLDOC4_THIS(iface);
00727     FIXME("(%p)->(%s)\n", This, debugstr_w(v));
00728     return E_NOTIMPL;
00729 }
00730 
00731 static HRESULT WINAPI HTMLDocument4_get_media(IHTMLDocument4 *iface, BSTR *p)
00732 {
00733     HTMLDocument *This = HTMLDOC4_THIS(iface);
00734     FIXME("(%p)->(%p)\n", This, p);
00735     return E_NOTIMPL;
00736 }
00737 
00738 static HRESULT WINAPI HTMLDocument4_createEventObject(IHTMLDocument4 *iface,
00739         VARIANT *pvarEventObject, IHTMLEventObj **ppEventObj)
00740 {
00741     HTMLDocument *This = HTMLDOC4_THIS(iface);
00742     FIXME("(%p)->(%p %p)\n", This, pvarEventObject, ppEventObj);
00743     return E_NOTIMPL;
00744 }
00745 
00746 static HRESULT WINAPI HTMLDocument4_fireEvent(IHTMLDocument4 *iface, BSTR bstrEventName,
00747         VARIANT *pvarEventObject, VARIANT_BOOL *pfCanceled)
00748 {
00749     HTMLDocument *This = HTMLDOC4_THIS(iface);
00750     FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(bstrEventName), pvarEventObject, pfCanceled);
00751     return E_NOTIMPL;
00752 }
00753 
00754 static HRESULT WINAPI HTMLDocument4_createRenderStyle(IHTMLDocument4 *iface, BSTR v,
00755         IHTMLRenderStyle **ppIHTMLRenderStyle)
00756 {
00757     HTMLDocument *This = HTMLDOC4_THIS(iface);
00758     FIXME("(%p)->(%s %p)\n", This, debugstr_w(v), ppIHTMLRenderStyle);
00759     return E_NOTIMPL;
00760 }
00761 
00762 static HRESULT WINAPI HTMLDocument4_put_oncontrolselect(IHTMLDocument4 *iface, VARIANT v)
00763 {
00764     HTMLDocument *This = HTMLDOC4_THIS(iface);
00765     FIXME("(%p)->(v)\n", This);
00766     return E_NOTIMPL;
00767 }
00768 
00769 static HRESULT WINAPI HTMLDocument4_get_oncontrolselect(IHTMLDocument4 *iface, VARIANT *p)
00770 {
00771     HTMLDocument *This = HTMLDOC4_THIS(iface);
00772     FIXME("(%p)->(%p)\n", This, p);
00773     return E_NOTIMPL;
00774 }
00775 
00776 static HRESULT WINAPI HTMLDocument4_get_URLEncoded(IHTMLDocument4 *iface, BSTR *p)
00777 {
00778     HTMLDocument *This = HTMLDOC4_THIS(iface);
00779     FIXME("(%p)->(%p)\n", This, p);
00780     return E_NOTIMPL;
00781 }
00782 
00783 #undef HTMLDOC4_THIS
00784 
00785 static const IHTMLDocument4Vtbl HTMLDocument4Vtbl = {
00786     HTMLDocument4_QueryInterface,
00787     HTMLDocument4_AddRef,
00788     HTMLDocument4_Release,
00789     HTMLDocument4_GetTypeInfoCount,
00790     HTMLDocument4_GetTypeInfo,
00791     HTMLDocument4_GetIDsOfNames,
00792     HTMLDocument4_Invoke,
00793     HTMLDocument4_focus,
00794     HTMLDocument4_hasFocus,
00795     HTMLDocument4_put_onselectionchange,
00796     HTMLDocument4_get_onselectionchange,
00797     HTMLDocument4_get_namespace,
00798     HTMLDocument4_createDocumentFromUrl,
00799     HTMLDocument4_put_media,
00800     HTMLDocument4_get_media,
00801     HTMLDocument4_createEventObject,
00802     HTMLDocument4_fireEvent,
00803     HTMLDocument4_createRenderStyle,
00804     HTMLDocument4_put_oncontrolselect,
00805     HTMLDocument4_get_oncontrolselect,
00806     HTMLDocument4_get_URLEncoded
00807 };
00808 
00809 void HTMLDocument_HTMLDocument3_Init(HTMLDocument *This)
00810 {
00811     This->lpHTMLDocument3Vtbl = &HTMLDocument3Vtbl;
00812     This->lpHTMLDocument4Vtbl = &HTMLDocument4Vtbl;
00813 }

Generated on Sat May 26 2012 04:23:28 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.