mountmgr: Store the device name in the mount point structure.
[wine/multimedia.git] / dlls / mshtml / oleobj.c
blob0b1dd6bd31cb6d63ecaab2b79c8b36931f879840
1 /*
2 * Copyright 2005 Jacek Caban
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "config.h"
21 #include <stdarg.h>
22 #include <stdio.h>
24 #define COBJMACROS
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "ole2.h"
30 #include "shlguid.h"
31 #include "mshtmdid.h"
32 #include "idispids.h"
34 #include "wine/debug.h"
36 #include "mshtml_private.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
40 /**********************************************************
41 * IOleObject implementation
44 #define OLEOBJ_THIS(iface) DEFINE_THIS(HTMLDocument, OleObject, iface)
46 static HRESULT WINAPI OleObject_QueryInterface(IOleObject *iface, REFIID riid, void **ppvObject)
48 HTMLDocument *This = OLEOBJ_THIS(iface);
49 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
52 static ULONG WINAPI OleObject_AddRef(IOleObject *iface)
54 HTMLDocument *This = OLEOBJ_THIS(iface);
55 return IHTMLDocument2_AddRef(HTMLDOC(This));
58 static ULONG WINAPI OleObject_Release(IOleObject *iface)
60 HTMLDocument *This = OLEOBJ_THIS(iface);
61 return IHTMLDocument2_Release(HTMLDOC(This));
64 static void update_hostinfo(HTMLDocument *This, DOCHOSTUIINFO *hostinfo)
66 nsIScrollable *scrollable;
67 nsresult nsres;
69 if(!This->nscontainer)
70 return;
72 nsres = nsIWebBrowser_QueryInterface(This->nscontainer->webbrowser, &IID_nsIScrollable, (void**)&scrollable);
73 if(NS_SUCCEEDED(nsres)) {
74 nsres = nsIScrollable_SetDefaultScrollbarPreferences(scrollable, ScrollOrientation_Y,
75 (hostinfo->dwFlags & DOCHOSTUIFLAG_SCROLL_NO) ? Scrollbar_Never : Scrollbar_Always);
76 if(NS_FAILED(nsres))
77 ERR("Could not set default Y scrollbar prefs: %08x\n", nsres);
79 nsres = nsIScrollable_SetDefaultScrollbarPreferences(scrollable, ScrollOrientation_X,
80 hostinfo->dwFlags & DOCHOSTUIFLAG_SCROLL_NO ? Scrollbar_Never : Scrollbar_Auto);
81 if(NS_FAILED(nsres))
82 ERR("Could not set default X scrollbar prefs: %08x\n", nsres);
84 nsIScrollable_Release(scrollable);
85 }else {
86 ERR("Could not get nsIScrollable: %08x\n", nsres);
90 static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite *pClientSite)
92 HTMLDocument *This = OLEOBJ_THIS(iface);
93 IDocHostUIHandler *pDocHostUIHandler = NULL;
94 IOleCommandTarget *cmdtrg = NULL;
95 VARIANT silent;
96 HRESULT hres;
98 TRACE("(%p)->(%p)\n", This, pClientSite);
100 if(pClientSite == This->client)
101 return S_OK;
103 if(This->client) {
104 IOleClientSite_Release(This->client);
105 This->client = NULL;
106 This->usermode = UNKNOWN_USERMODE;
109 if(This->hostui) {
110 IDocHostUIHandler_Release(This->hostui);
111 This->hostui = NULL;
114 memset(&This->hostinfo, 0, sizeof(DOCHOSTUIINFO));
116 if(!pClientSite)
117 return S_OK;
119 hres = IOleObject_QueryInterface(pClientSite, &IID_IDocHostUIHandler, (void**)&pDocHostUIHandler);
120 if(SUCCEEDED(hres)) {
121 DOCHOSTUIINFO hostinfo;
122 LPOLESTR key_path = NULL, override_key_path = NULL;
123 IDocHostUIHandler2 *pDocHostUIHandler2;
125 memset(&hostinfo, 0, sizeof(DOCHOSTUIINFO));
126 hostinfo.cbSize = sizeof(DOCHOSTUIINFO);
127 hres = IDocHostUIHandler_GetHostInfo(pDocHostUIHandler, &hostinfo);
128 if(SUCCEEDED(hres)) {
129 TRACE("hostinfo = {%u %08x %08x %s %s}\n",
130 hostinfo.cbSize, hostinfo.dwFlags, hostinfo.dwDoubleClick,
131 debugstr_w(hostinfo.pchHostCss), debugstr_w(hostinfo.pchHostNS));
132 update_hostinfo(This, &hostinfo);
133 This->hostinfo = hostinfo;
136 if(!This->has_key_path) {
137 hres = IDocHostUIHandler_GetOptionKeyPath(pDocHostUIHandler, &key_path, 0);
138 if(hres == S_OK && key_path) {
139 if(key_path[0]) {
140 /* FIXME: use key_path */
141 TRACE("key_path = %s\n", debugstr_w(key_path));
143 CoTaskMemFree(key_path);
146 hres = IDocHostUIHandler_QueryInterface(pDocHostUIHandler, &IID_IDocHostUIHandler2,
147 (void**)&pDocHostUIHandler2);
148 if(SUCCEEDED(hres)) {
149 hres = IDocHostUIHandler2_GetOverrideKeyPath(pDocHostUIHandler2, &override_key_path, 0);
150 if(hres == S_OK && override_key_path && override_key_path[0]) {
151 if(override_key_path[0]) {
152 /*FIXME: use override_key_path */
153 TRACE("override_key_path = %s\n", debugstr_w(override_key_path));
155 CoTaskMemFree(override_key_path);
157 IDocHostUIHandler2_Release(pDocHostUIHandler2);
160 This->has_key_path = TRUE;
164 /* Native calls here GetWindow. What is it for?
165 * We don't have anything to do with it here (yet). */
166 if(pClientSite) {
167 IOleWindow *pOleWindow = NULL;
168 HWND hwnd;
170 hres = IOleClientSite_QueryInterface(pClientSite, &IID_IOleWindow, (void**)&pOleWindow);
171 if(SUCCEEDED(hres)) {
172 IOleWindow_GetWindow(pOleWindow, &hwnd);
173 IOleWindow_Release(pOleWindow);
177 hres = IOleClientSite_QueryInterface(pClientSite, &IID_IOleCommandTarget, (void**)&cmdtrg);
178 if(SUCCEEDED(hres)) {
179 VARIANT var;
180 OLECMD cmd = {OLECMDID_SETPROGRESSTEXT, 0};
182 IOleCommandTarget_QueryStatus(cmdtrg, NULL, 1, &cmd, NULL);
184 V_VT(&var) = VT_I4;
185 V_I4(&var) = 0;
186 IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_SETPROGRESSMAX,
187 OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
188 IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_SETPROGRESSPOS,
189 OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
191 IOleCommandTarget_Release(cmdtrg);
194 IOleClientSite_AddRef(pClientSite);
195 This->client = pClientSite;
196 This->hostui = pDocHostUIHandler;
198 if(This->usermode == UNKNOWN_USERMODE)
199 IOleControl_OnAmbientPropertyChange(CONTROL(This), DISPID_AMBIENT_USERMODE);
201 IOleControl_OnAmbientPropertyChange(CONTROL(This), DISPID_AMBIENT_OFFLINEIFNOTCONNECTED);
203 hres = get_client_disp_property(This->client, DISPID_AMBIENT_SILENT, &silent);
204 if(SUCCEEDED(hres)) {
205 if(V_VT(&silent) != VT_BOOL)
206 WARN("V_VT(silent) = %d\n", V_VT(&silent));
207 else if(V_BOOL(&silent))
208 FIXME("silent == true\n");
211 IOleControl_OnAmbientPropertyChange(CONTROL(This), DISPID_AMBIENT_USERAGENT);
212 IOleControl_OnAmbientPropertyChange(CONTROL(This), DISPID_AMBIENT_PALETTE);
214 return S_OK;
217 static HRESULT WINAPI OleObject_GetClientSite(IOleObject *iface, IOleClientSite **ppClientSite)
219 HTMLDocument *This = OLEOBJ_THIS(iface);
221 TRACE("(%p)->(%p)\n", This, ppClientSite);
223 if(!ppClientSite)
224 return E_INVALIDARG;
226 if(This->client)
227 IOleClientSite_AddRef(This->client);
228 *ppClientSite = This->client;
230 return S_OK;
233 static HRESULT WINAPI OleObject_SetHostNames(IOleObject *iface, LPCOLESTR szContainerApp, LPCOLESTR szContainerObj)
235 HTMLDocument *This = OLEOBJ_THIS(iface);
236 FIXME("(%p)->(%s %s)\n", This, debugstr_w(szContainerApp), debugstr_w(szContainerObj));
237 return E_NOTIMPL;
240 static HRESULT WINAPI OleObject_Close(IOleObject *iface, DWORD dwSaveOption)
242 HTMLDocument *This = OLEOBJ_THIS(iface);
244 TRACE("(%p)->(%08x)\n", This, dwSaveOption);
246 if(dwSaveOption == OLECLOSE_PROMPTSAVE)
247 FIXME("OLECLOSE_PROMPTSAVE not implemented\n");
249 if(This->in_place_active)
250 IOleInPlaceObjectWindowless_InPlaceDeactivate(INPLACEWIN(This));
252 HTMLDocument_LockContainer(This, FALSE);
254 return S_OK;
257 static HRESULT WINAPI OleObject_SetMoniker(IOleObject *iface, DWORD dwWhichMoniker, IMoniker *pmk)
259 HTMLDocument *This = OLEOBJ_THIS(iface);
260 FIXME("(%p %d %p)->()\n", This, dwWhichMoniker, pmk);
261 return E_NOTIMPL;
264 static HRESULT WINAPI OleObject_GetMoniker(IOleObject *iface, DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk)
266 HTMLDocument *This = OLEOBJ_THIS(iface);
267 FIXME("(%p)->(%d %d %p)\n", This, dwAssign, dwWhichMoniker, ppmk);
268 return E_NOTIMPL;
271 static HRESULT WINAPI OleObject_InitFromData(IOleObject *iface, IDataObject *pDataObject, BOOL fCreation,
272 DWORD dwReserved)
274 HTMLDocument *This = OLEOBJ_THIS(iface);
275 FIXME("(%p)->(%p %x %d)\n", This, pDataObject, fCreation, dwReserved);
276 return E_NOTIMPL;
279 static HRESULT WINAPI OleObject_GetClipboardData(IOleObject *iface, DWORD dwReserved, IDataObject **ppDataObject)
281 HTMLDocument *This = OLEOBJ_THIS(iface);
282 FIXME("(%p)->(%d %p)\n", This, dwReserved, ppDataObject);
283 return E_NOTIMPL;
286 static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSite,
287 LONG lindex, HWND hwndParent, LPCRECT lprcPosRect)
289 HTMLDocument *This = OLEOBJ_THIS(iface);
290 IOleDocumentSite *pDocSite;
291 HRESULT hres;
293 TRACE("(%p)->(%d %p %p %d %p %p)\n", This, iVerb, lpmsg, pActiveSite, lindex, hwndParent, lprcPosRect);
295 if(iVerb != OLEIVERB_SHOW && iVerb != OLEIVERB_UIACTIVATE && iVerb != OLEIVERB_INPLACEACTIVATE) {
296 FIXME("iVerb = %d not supported\n", iVerb);
297 return E_NOTIMPL;
300 if(!pActiveSite)
301 pActiveSite = This->client;
303 hres = IOleClientSite_QueryInterface(pActiveSite, &IID_IOleDocumentSite, (void**)&pDocSite);
304 if(SUCCEEDED(hres)) {
305 HTMLDocument_LockContainer(This, TRUE);
307 /* FIXME: Create new IOleDocumentView. See CreateView for more info. */
308 hres = IOleDocumentSite_ActivateMe(pDocSite, DOCVIEW(This));
309 IOleDocumentSite_Release(pDocSite);
310 }else {
311 hres = IOleDocumentView_UIActivate(DOCVIEW(This), TRUE);
312 if(SUCCEEDED(hres)) {
313 if(lprcPosRect) {
314 RECT rect; /* We need to pass rect as not const pointer */
315 rect = *lprcPosRect;
316 IOleDocumentView_SetRect(DOCVIEW(This), &rect);
318 IOleDocumentView_Show(DOCVIEW(This), TRUE);
322 return hres;
325 static HRESULT WINAPI OleObject_EnumVerbs(IOleObject *iface, IEnumOLEVERB **ppEnumOleVerb)
327 HTMLDocument *This = OLEOBJ_THIS(iface);
328 FIXME("(%p)->(%p)\n", This, ppEnumOleVerb);
329 return E_NOTIMPL;
332 static HRESULT WINAPI OleObject_Update(IOleObject *iface)
334 HTMLDocument *This = OLEOBJ_THIS(iface);
335 FIXME("(%p)\n", This);
336 return E_NOTIMPL;
339 static HRESULT WINAPI OleObject_IsUpToDate(IOleObject *iface)
341 HTMLDocument *This = OLEOBJ_THIS(iface);
342 FIXME("(%p)\n", This);
343 return E_NOTIMPL;
346 static HRESULT WINAPI OleObject_GetUserClassID(IOleObject *iface, CLSID *pClsid)
348 HTMLDocument *This = OLEOBJ_THIS(iface);
350 TRACE("(%p)->(%p)\n", This, pClsid);
352 if(!pClsid)
353 return E_INVALIDARG;
355 *pClsid = CLSID_HTMLDocument;
356 return S_OK;
359 static HRESULT WINAPI OleObject_GetUserType(IOleObject *iface, DWORD dwFormOfType, LPOLESTR *pszUserType)
361 HTMLDocument *This = OLEOBJ_THIS(iface);
362 FIXME("(%p)->(%d %p)\n", This, dwFormOfType, pszUserType);
363 return E_NOTIMPL;
366 static HRESULT WINAPI OleObject_SetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
368 HTMLDocument *This = OLEOBJ_THIS(iface);
369 FIXME("(%p)->(%d %p)\n", This, dwDrawAspect, psizel);
370 return E_NOTIMPL;
373 static HRESULT WINAPI OleObject_GetExtent(IOleObject *iface, DWORD dwDrawAspect, SIZEL *psizel)
375 HTMLDocument *This = OLEOBJ_THIS(iface);
376 FIXME("(%p)->(%d %p)\n", This, dwDrawAspect, psizel);
377 return E_NOTIMPL;
380 static HRESULT WINAPI OleObject_Advise(IOleObject *iface, IAdviseSink *pAdvSink, DWORD *pdwConnection)
382 HTMLDocument *This = OLEOBJ_THIS(iface);
383 FIXME("(%p)->(%p %p)\n", This, pAdvSink, pdwConnection);
384 return E_NOTIMPL;
387 static HRESULT WINAPI OleObject_Unadvise(IOleObject *iface, DWORD dwConnection)
389 HTMLDocument *This = OLEOBJ_THIS(iface);
390 FIXME("(%p)->(%d)\n", This, dwConnection);
391 return E_NOTIMPL;
394 static HRESULT WINAPI OleObject_EnumAdvise(IOleObject *iface, IEnumSTATDATA **ppenumAdvise)
396 HTMLDocument *This = OLEOBJ_THIS(iface);
397 FIXME("(%p)->(%p)\n", This, ppenumAdvise);
398 return E_NOTIMPL;
401 static HRESULT WINAPI OleObject_GetMiscStatus(IOleObject *iface, DWORD dwAspect, DWORD *pdwStatus)
403 HTMLDocument *This = OLEOBJ_THIS(iface);
404 FIXME("(%p)->(%d %p)\n", This, dwAspect, pdwStatus);
405 return E_NOTIMPL;
408 static HRESULT WINAPI OleObject_SetColorScheme(IOleObject *iface, LOGPALETTE *pLogpal)
410 HTMLDocument *This = OLEOBJ_THIS(iface);
411 FIXME("(%p)->(%p)\n", This, pLogpal);
412 return E_NOTIMPL;
415 #undef OLEPBJ_THIS
417 static const IOleObjectVtbl OleObjectVtbl = {
418 OleObject_QueryInterface,
419 OleObject_AddRef,
420 OleObject_Release,
421 OleObject_SetClientSite,
422 OleObject_GetClientSite,
423 OleObject_SetHostNames,
424 OleObject_Close,
425 OleObject_SetMoniker,
426 OleObject_GetMoniker,
427 OleObject_InitFromData,
428 OleObject_GetClipboardData,
429 OleObject_DoVerb,
430 OleObject_EnumVerbs,
431 OleObject_Update,
432 OleObject_IsUpToDate,
433 OleObject_GetUserClassID,
434 OleObject_GetUserType,
435 OleObject_SetExtent,
436 OleObject_GetExtent,
437 OleObject_Advise,
438 OleObject_Unadvise,
439 OleObject_EnumAdvise,
440 OleObject_GetMiscStatus,
441 OleObject_SetColorScheme
444 /**********************************************************
445 * IOleDocument implementation
448 #define OLEDOC_THIS(iface) DEFINE_THIS(HTMLDocument, OleDocument, iface)
450 static HRESULT WINAPI OleDocument_QueryInterface(IOleDocument *iface, REFIID riid, void **ppvObject)
452 HTMLDocument *This = OLEDOC_THIS(iface);
453 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
456 static ULONG WINAPI OleDocument_AddRef(IOleDocument *iface)
458 HTMLDocument *This = OLEDOC_THIS(iface);
459 return IHTMLDocument2_AddRef(HTMLDOC(This));
462 static ULONG WINAPI OleDocument_Release(IOleDocument *iface)
464 HTMLDocument *This = OLEDOC_THIS(iface);
465 return IHTMLDocument2_Release(HTMLDOC(This));
468 static HRESULT WINAPI OleDocument_CreateView(IOleDocument *iface, IOleInPlaceSite *pIPSite, IStream *pstm,
469 DWORD dwReserved, IOleDocumentView **ppView)
471 HTMLDocument *This = OLEDOC_THIS(iface);
472 HRESULT hres;
474 TRACE("(%p)->(%p %p %d %p)\n", This, pIPSite, pstm, dwReserved, ppView);
476 if(!ppView)
477 return E_INVALIDARG;
479 /* FIXME:
480 * Windows implementation creates new IOleDocumentView when function is called for the
481 * first time and returns E_FAIL when it is called for the second time, but it doesn't matter
482 * if the application uses returned interfaces, passed to ActivateMe or returned by
483 * QueryInterface, so there is no reason to create new interface. This needs more testing.
486 if(pIPSite) {
487 hres = IOleDocumentView_SetInPlaceSite(DOCVIEW(This), pIPSite);
488 if(FAILED(hres))
489 return hres;
492 if(pstm)
493 FIXME("pstm is not supported\n");
495 IOleDocumentView_AddRef(DOCVIEW(This));
496 *ppView = DOCVIEW(This);
497 return S_OK;
500 static HRESULT WINAPI OleDocument_GetDocMiscStatus(IOleDocument *iface, DWORD *pdwStatus)
502 HTMLDocument *This = OLEDOC_THIS(iface);
503 FIXME("(%p)->(%p)\n", This, pdwStatus);
504 return E_NOTIMPL;
507 static HRESULT WINAPI OleDocument_EnumViews(IOleDocument *iface, IEnumOleDocumentViews **ppEnum,
508 IOleDocumentView **ppView)
510 HTMLDocument *This = OLEDOC_THIS(iface);
511 FIXME("(%p)->(%p %p)\n", This, ppEnum, ppView);
512 return E_NOTIMPL;
515 #undef OLEDOC_THIS
517 static const IOleDocumentVtbl OleDocumentVtbl = {
518 OleDocument_QueryInterface,
519 OleDocument_AddRef,
520 OleDocument_Release,
521 OleDocument_CreateView,
522 OleDocument_GetDocMiscStatus,
523 OleDocument_EnumViews
526 /**********************************************************
527 * IOleControl implementation
530 #define CONTROL_THIS(iface) DEFINE_THIS(HTMLDocument, OleControl, iface)
532 static HRESULT WINAPI OleControl_QueryInterface(IOleControl *iface, REFIID riid, void **ppv)
534 HTMLDocument *This = CONTROL_THIS(iface);
535 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppv);
538 static ULONG WINAPI OleControl_AddRef(IOleControl *iface)
540 HTMLDocument *This = CONTROL_THIS(iface);
541 return IHTMLDocument2_AddRef(HTMLDOC(This));
544 static ULONG WINAPI OleControl_Release(IOleControl *iface)
546 HTMLDocument *This = CONTROL_THIS(iface);
547 return IHTMLDocument_Release(HTMLDOC(This));
550 static HRESULT WINAPI OleControl_GetControlInfo(IOleControl *iface, CONTROLINFO *pCI)
552 HTMLDocument *This = CONTROL_THIS(iface);
553 FIXME("(%p)->(%p)\n", This, pCI);
554 return E_NOTIMPL;
557 static HRESULT WINAPI OleControl_OnMnemonic(IOleControl *iface, MSG *pMsg)
559 HTMLDocument *This = CONTROL_THIS(iface);
560 FIXME("(%p)->(%p)\n", This, pMsg);
561 return E_NOTIMPL;
564 HRESULT get_client_disp_property(IOleClientSite *client, DISPID dispid, VARIANT *res)
566 IDispatch *disp = NULL;
567 DISPPARAMS dispparams = {NULL, 0};
568 UINT err;
569 HRESULT hres;
571 hres = IOleClientSite_QueryInterface(client, &IID_IDispatch, (void**)&disp);
572 if(FAILED(hres)) {
573 TRACE("Could not get IDispatch\n");
574 return hres;
577 VariantInit(res);
579 hres = IDispatch_Invoke(disp, dispid, &IID_NULL, LOCALE_SYSTEM_DEFAULT,
580 DISPATCH_PROPERTYGET, &dispparams, res, NULL, &err);
582 IDispatch_Release(disp);
584 return hres;
587 static HRESULT on_change_dlcontrol(HTMLDocument *This)
589 VARIANT res;
590 HRESULT hres;
592 hres = get_client_disp_property(This->client, DISPID_AMBIENT_DLCONTROL, &res);
593 if(SUCCEEDED(hres))
594 FIXME("unsupported dlcontrol %08x\n", V_I4(&res));
596 return S_OK;
599 static HRESULT WINAPI OleControl_OnAmbientPropertyChange(IOleControl *iface, DISPID dispID)
601 HTMLDocument *This = CONTROL_THIS(iface);
602 VARIANT res;
603 HRESULT hres;
605 if(!This->client) {
606 TRACE("This->client = NULL\n");
607 return S_OK;
610 switch(dispID) {
611 case DISPID_AMBIENT_USERMODE:
612 TRACE("(%p)->(DISPID_AMBIENT_USERMODE)\n", This);
613 hres = get_client_disp_property(This->client, DISPID_AMBIENT_USERMODE, &res);
614 if(FAILED(hres))
615 return S_OK;
617 if(V_VT(&res) == VT_BOOL) {
618 if(V_BOOL(&res)) {
619 This->usermode = BROWSEMODE;
620 }else {
621 FIXME("edit mode is not supported\n");
622 This->usermode = EDITMODE;
624 }else {
625 FIXME("V_VT(res)=%d\n", V_VT(&res));
627 return S_OK;
628 case DISPID_AMBIENT_DLCONTROL:
629 TRACE("(%p)->(DISPID_AMBIENT_DLCONTROL)\n", This);
630 return on_change_dlcontrol(This);
631 case DISPID_AMBIENT_OFFLINEIFNOTCONNECTED:
632 TRACE("(%p)->(DISPID_AMBIENT_OFFLINEIFNOTCONNECTED)\n", This);
633 on_change_dlcontrol(This);
634 hres = get_client_disp_property(This->client, DISPID_AMBIENT_OFFLINEIFNOTCONNECTED, &res);
635 if(FAILED(hres))
636 return S_OK;
638 if(V_VT(&res) == VT_BOOL) {
639 if(V_BOOL(&res)) {
640 FIXME("offline connection is not supported\n");
641 hres = E_FAIL;
643 }else {
644 FIXME("V_VT(res)=%d\n", V_VT(&res));
646 return S_OK;
647 case DISPID_AMBIENT_SILENT:
648 TRACE("(%p)->(DISPID_AMBIENT_SILENT)\n", This);
649 on_change_dlcontrol(This);
650 hres = get_client_disp_property(This->client, DISPID_AMBIENT_SILENT, &res);
651 if(FAILED(hres))
652 return S_OK;
654 if(V_VT(&res) == VT_BOOL) {
655 if(V_BOOL(&res)) {
656 FIXME("silent mode is not supported\n");
657 hres = E_FAIL;
659 }else {
660 FIXME("V_VT(res)=%d\n", V_VT(&res));
662 return S_OK;
663 case DISPID_AMBIENT_USERAGENT:
664 TRACE("(%p)->(DISPID_AMBIENT_USERAGENT)\n", This);
665 hres = get_client_disp_property(This->client, DISPID_AMBIENT_USERAGENT, &res);
666 if(FAILED(hres))
667 return S_OK;
669 FIXME("not supported AMBIENT_USERAGENT\n");
670 hres = E_FAIL;
671 return S_OK;
672 case DISPID_AMBIENT_PALETTE:
673 TRACE("(%p)->(DISPID_AMBIENT_PALETTE)\n", This);
674 hres = get_client_disp_property(This->client, DISPID_AMBIENT_PALETTE, &res);
675 if(FAILED(hres))
676 return S_OK;
678 FIXME("not supported AMBIENT_PALETTE\n");
679 hres = E_FAIL;
680 return S_OK;
683 FIXME("(%p) unsupported dispID=%d\n", This, dispID);
684 return E_FAIL;
687 static HRESULT WINAPI OleControl_FreezeEvents(IOleControl *iface, BOOL bFreeze)
689 HTMLDocument *This = CONTROL_THIS(iface);
690 FIXME("(%p)->(%x)\n", This, bFreeze);
691 return E_NOTIMPL;
694 #undef CONTROL_THIS
696 static const IOleControlVtbl OleControlVtbl = {
697 OleControl_QueryInterface,
698 OleControl_AddRef,
699 OleControl_Release,
700 OleControl_GetControlInfo,
701 OleControl_OnMnemonic,
702 OleControl_OnAmbientPropertyChange,
703 OleControl_FreezeEvents
706 /**********************************************************
707 * ICustomDoc implementation
710 #define CUSTOMDOC_THIS(iface) DEFINE_THIS(HTMLDocument, CustomDoc, iface)
712 static HRESULT WINAPI CustomDoc_QueryInterface(ICustomDoc *iface, REFIID riid, void **ppv)
714 HTMLDocument *This = CUSTOMDOC_THIS(iface);
715 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppv);
718 static ULONG WINAPI CustomDoc_AddRef(ICustomDoc *iface)
720 HTMLDocument *This = CUSTOMDOC_THIS(iface);
721 return IHTMLDocument2_AddRef(HTMLDOC(This));
724 static ULONG WINAPI CustomDoc_Release(ICustomDoc *iface)
726 HTMLDocument *This = CUSTOMDOC_THIS(iface);
727 return IHTMLDocument_Release(HTMLDOC(This));
730 static HRESULT WINAPI CustomDoc_SetUIHandler(ICustomDoc *iface, IDocHostUIHandler *pUIHandler)
732 HTMLDocument *This = CUSTOMDOC_THIS(iface);
733 FIXME("(%p)->(%p)\n", This, pUIHandler);
734 return E_NOTIMPL;
737 #undef CUSTOMDOC_THIS
739 static const ICustomDocVtbl CustomDocVtbl = {
740 CustomDoc_QueryInterface,
741 CustomDoc_AddRef,
742 CustomDoc_Release,
743 CustomDoc_SetUIHandler
746 void HTMLDocument_LockContainer(HTMLDocument *This, BOOL fLock)
748 IOleContainer *container;
749 HRESULT hres;
751 if(!This->client || This->container_locked == fLock)
752 return;
754 hres = IOleClientSite_GetContainer(This->client, &container);
755 if(SUCCEEDED(hres)) {
756 IOleContainer_LockContainer(container, fLock);
757 This->container_locked = fLock;
758 IOleContainer_Release(container);
762 void HTMLDocument_OleObj_Init(HTMLDocument *This)
764 This->lpOleObjectVtbl = &OleObjectVtbl;
765 This->lpOleDocumentVtbl = &OleDocumentVtbl;
766 This->lpOleControlVtbl = &OleControlVtbl;
767 This->lpCustomDocVtbl = &CustomDocVtbl;
769 This->usermode = UNKNOWN_USERMODE;
771 This->client = NULL;
772 This->hostui = NULL;
774 This->has_key_path = FALSE;
775 This->container_locked = FALSE;
777 memset(&This->hostinfo, 0, sizeof(DOCHOSTUIINFO));