2 * Copyright 2005-2006 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
33 #include "wine/debug.h"
35 #include "mshtml_private.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
39 #define TIMER_ID 0x1000
41 static const WCHAR wszInternetExplorer_Server[] =
42 {'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r','_','S','e','r','v','e','r',0};
44 static const WCHAR wszTooltipData[] = {'t','o','o','l','t','i','p','_','d','a','t','a',0};
46 static ATOM serverwnd_class = 0;
53 static void paint_document(HTMLDocumentObj *This)
59 GetClientRect(This->hwnd, &rect);
61 hdc = BeginPaint(This->hwnd, &ps);
63 if(!(This->hostinfo.dwFlags & (DOCHOSTUIFLAG_NO3DOUTERBORDER|DOCHOSTUIFLAG_NO3DBORDER)))
64 DrawEdge(hdc, &rect, EDGE_SUNKEN, BF_RECT|BF_ADJUST);
66 if(!This->nscontainer) {
67 WCHAR wszHTMLDisabled[100];
70 LoadStringW(hInst, IDS_HTMLDISABLED, wszHTMLDisabled, sizeof(wszHTMLDisabled)/sizeof(WCHAR));
72 font = CreateFontA(25,0,0,0,400,0,0,0,ANSI_CHARSET,0,0,DEFAULT_QUALITY,DEFAULT_PITCH,NULL);
74 SelectObject(hdc, font);
75 SelectObject(hdc, GetSysColorBrush(COLOR_WINDOW));
77 Rectangle(hdc, rect.left, rect.top, rect.right, rect.bottom);
78 DrawTextW(hdc, wszHTMLDisabled,-1, &rect, DT_CENTER | DT_SINGLELINE | DT_VCENTER);
83 EndPaint(This->hwnd, &ps);
86 static void activate_gecko(NSContainer *This)
88 TRACE("(%p) %p\n", This, This->window);
90 SetParent(This->hwnd, This->doc->hwnd);
91 ShowWindow(This->hwnd, SW_SHOW);
93 nsIBaseWindow_SetVisibility(This->window, TRUE);
94 nsIBaseWindow_SetEnabled(This->window, TRUE);
97 void update_doc(HTMLDocument *This, DWORD flags)
99 if(!This->doc_obj->update && This->doc_obj->hwnd)
100 SetTimer(This->doc_obj->hwnd, TIMER_ID, 100, NULL);
102 This->doc_obj->update |= flags;
105 void update_title(HTMLDocumentObj *This)
107 IOleCommandTarget *olecmd;
110 if(!(This->update & UPDATE_TITLE))
113 This->update &= ~UPDATE_TITLE;
118 hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget, (void**)&olecmd);
119 if(SUCCEEDED(hres)) {
123 V_VT(&title) = VT_BSTR;
124 V_BSTR(&title) = SysAllocString(empty);
125 IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETTITLE, OLECMDEXECOPT_DONTPROMPTUSER,
127 SysFreeString(V_BSTR(&title));
129 IOleCommandTarget_Release(olecmd);
133 static LRESULT on_timer(HTMLDocumentObj *This)
135 TRACE("(%p) %x\n", This, This->update);
137 KillTimer(This->hwnd, TIMER_ID);
142 if(This->update & UPDATE_UI) {
144 IDocHostUIHandler_UpdateUI(This->hostui);
147 IOleCommandTarget *cmdtrg;
150 hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget,
152 if(SUCCEEDED(hres)) {
153 IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_UPDATECOMMANDS,
154 OLECMDEXECOPT_DONTPROMPTUSER, NULL, NULL);
155 IOleCommandTarget_Release(cmdtrg);
165 void notif_focus(HTMLDocumentObj *This)
167 IOleControlSite *site;
173 hres = IOleClientSite_QueryInterface(This->client, &IID_IOleControlSite, (void**)&site);
177 IOleControlSite_OnFocus(site, This->focus);
178 IOleControlSite_Release(site);
181 static LRESULT WINAPI serverwnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
183 HTMLDocumentObj *This;
185 static const WCHAR wszTHIS[] = {'T','H','I','S',0};
187 if(msg == WM_CREATE) {
188 This = *(HTMLDocumentObj**)lParam;
189 SetPropW(hwnd, wszTHIS, This);
191 This = GetPropW(hwnd, wszTHIS);
199 paint_document(This);
202 TRACE("(%p)->(WM_SIZE)\n", This);
203 if(This->nscontainer) {
206 if(!(This->hostinfo.dwFlags & (DOCHOSTUIFLAG_NO3DOUTERBORDER|DOCHOSTUIFLAG_NO3DBORDER))) {
207 ew = GetSystemMetrics(SM_CXEDGE);
208 eh = GetSystemMetrics(SM_CYEDGE);
211 SetWindowPos(This->nscontainer->hwnd, NULL, ew, eh,
212 LOWORD(lParam) - 2*ew, HIWORD(lParam) - 2*eh,
213 SWP_NOZORDER | SWP_NOACTIVATE);
217 return on_timer(This);
219 TRACE("(%p) WM_SETFOCUS\n", This);
220 nsIWebBrowserFocus_Activate(This->nscontainer->focus);
222 case WM_MOUSEACTIVATE:
226 return DefWindowProcW(hwnd, msg, wParam, lParam);
229 static void register_serverwnd_class(void)
231 static WNDCLASSEXW wndclass = {
235 0, 0, NULL, NULL, NULL, NULL, NULL,
236 wszInternetExplorer_Server,
239 wndclass.hInstance = hInst;
240 serverwnd_class = RegisterClassExW(&wndclass);
243 static HRESULT activate_window(HTMLDocumentObj *This)
245 IOleInPlaceFrame *pIPFrame;
246 IOleCommandTarget *cmdtrg;
247 IOleInPlaceSiteEx *ipsiteex;
248 RECT posrect, cliprect;
249 OLEINPLACEFRAMEINFO frameinfo;
254 register_serverwnd_class();
256 hres = IOleInPlaceSite_CanInPlaceActivate(This->ipsite);
258 WARN("CanInPlaceActivate returned: %08x\n", hres);
259 return FAILED(hres) ? hres : E_FAIL;
262 hres = IOleInPlaceSite_GetWindowContext(This->ipsite, &pIPFrame, &This->ip_window,
263 &posrect, &cliprect, &frameinfo);
265 WARN("GetWindowContext failed: %08x\n", hres);
269 TRACE("got window context: %p %p {%d %d %d %d} {%d %d %d %d} {%d %x %p %p %d}\n",
270 pIPFrame, This->ip_window, posrect.left, posrect.top, posrect.right, posrect.bottom,
271 cliprect.left, cliprect.top, cliprect.right, cliprect.bottom,
272 frameinfo.cb, frameinfo.fMDIApp, frameinfo.hwndFrame, frameinfo.haccel, frameinfo.cAccelEntries);
274 hres = IOleInPlaceSite_GetWindow(This->ipsite, &parent_hwnd);
276 WARN("GetWindow failed: %08x\n", hres);
280 TRACE("got parent window %p\n", parent_hwnd);
283 if(GetParent(This->hwnd) != parent_hwnd)
284 SetParent(This->hwnd, parent_hwnd);
285 SetWindowPos(This->hwnd, HWND_TOP,
286 posrect.left, posrect.top, posrect.right-posrect.left, posrect.bottom-posrect.top,
287 SWP_NOACTIVATE | SWP_SHOWWINDOW);
289 CreateWindowExW(0, wszInternetExplorer_Server, NULL,
290 WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
291 posrect.left, posrect.top, posrect.right-posrect.left, posrect.bottom-posrect.top,
292 parent_hwnd, NULL, hInst, This);
294 TRACE("Created window %p\n", This->hwnd);
296 SetWindowPos(This->hwnd, NULL, 0, 0, 0, 0,
297 SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_SHOWWINDOW);
298 RedrawWindow(This->hwnd, NULL, NULL, RDW_INVALIDATE | RDW_NOERASE | RDW_ALLCHILDREN);
301 * Windows implementation calls:
302 * RegisterWindowMessage("MSWHEEL_ROLLMSG");
304 SetTimer(This->hwnd, TIMER_ID, 100, NULL);
307 if(This->nscontainer)
308 activate_gecko(This->nscontainer);
310 This->in_place_active = TRUE;
311 hres = IOleInPlaceSite_QueryInterface(This->ipsite, &IID_IOleInPlaceSiteEx, (void**)&ipsiteex);
312 if(SUCCEEDED(hres)) {
315 hres = IOleInPlaceSiteEx_OnInPlaceActivateEx(ipsiteex, &redraw, 0);
316 IOleInPlaceSiteEx_Release(ipsiteex);
318 FIXME("unsupported redraw\n");
320 hres = IOleInPlaceSite_OnInPlaceActivate(This->ipsite);
323 WARN("OnInPlaceActivate failed: %08x\n", hres);
324 This->in_place_active = FALSE;
328 hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget, (void**)&cmdtrg);
329 if(SUCCEEDED(hres)) {
332 IOleInPlaceFrame_SetStatusText(pIPFrame, NULL);
336 IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_SETPROGRESSMAX,
337 OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
338 IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_SETPROGRESSPOS,
339 OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
341 IOleCommandTarget_Release(cmdtrg);
345 IOleInPlaceFrame_Release(This->frame);
346 This->frame = pIPFrame;
348 if(!This->request_uiactivate) {
349 hres = IOleInPlaceSite_QueryInterface(This->ipsite, &IID_IOleInPlaceSiteEx, (void**)&ipsiteex);
350 if(SUCCEEDED(hres)) {
351 IOleInPlaceSiteEx_RequestUIActivate(ipsiteex);
352 IOleInPlaceSiteEx_Release(ipsiteex);
356 This->window_active = TRUE;
361 static LRESULT WINAPI tooltips_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
363 tooltip_data *data = GetPropW(hwnd, wszTooltipData);
365 TRACE("%d %p\n", msg, data);
367 if(msg == TTM_WINDOWFROMPOINT) {
369 POINT *pt = (POINT*)lParam;
371 TRACE("TTM_WINDOWFROMPOINT (%d,%d)\n", pt->x, pt->y);
373 GetWindowRect(data->doc->hwnd, &rect);
375 if(rect.left <= pt->x && pt->x <= rect.right
376 && rect.top <= pt->y && pt->y <= rect.bottom)
377 return (LPARAM)data->doc->hwnd;
380 return CallWindowProcW(data->proc, hwnd, msg, wParam, lParam);
383 static void create_tooltips_window(HTMLDocumentObj *This)
385 tooltip_data *data = heap_alloc(sizeof(*data));
387 This->tooltips_hwnd = CreateWindowExW(0, TOOLTIPS_CLASSW, NULL, TTS_NOPREFIX | WS_POPUP,
388 CW_USEDEFAULT, CW_USEDEFAULT, 10, 10, This->hwnd, NULL, hInst, NULL);
391 data->proc = (WNDPROC)GetWindowLongPtrW(This->tooltips_hwnd, GWLP_WNDPROC);
393 SetPropW(This->tooltips_hwnd, wszTooltipData, data);
395 SetWindowLongPtrW(This->tooltips_hwnd, GWLP_WNDPROC, (LONG_PTR)tooltips_proc);
397 SetWindowPos(This->tooltips_hwnd, HWND_TOPMOST,0, 0, 0, 0,
398 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
402 void show_tooltip(HTMLDocumentObj *This, DWORD x, DWORD y, LPCWSTR text)
404 TTTOOLINFOW toolinfo = {
405 sizeof(TTTOOLINFOW), 0, This->hwnd, 0xdeadbeef,
406 {x>2 ? x-2 : 0, y>0 ? y-2 : 0, x+2, y+2}, /* FIXME */
407 NULL, (LPWSTR)text, 0};
408 MSG msg = {This->hwnd, WM_MOUSEMOVE, 0, MAKELPARAM(x,y), 0, {x,y}};
410 TRACE("(%p)->(%d %d %s)\n", This, x, y, debugstr_w(text));
412 if(!This->tooltips_hwnd)
413 create_tooltips_window(This);
415 SendMessageW(This->tooltips_hwnd, TTM_ADDTOOLW, 0, (LPARAM)&toolinfo);
416 SendMessageW(This->tooltips_hwnd, TTM_ACTIVATE, TRUE, 0);
417 SendMessageW(This->tooltips_hwnd, TTM_RELAYEVENT, 0, (LPARAM)&msg);
420 void hide_tooltip(HTMLDocumentObj *This)
422 TTTOOLINFOW toolinfo = {
423 sizeof(TTTOOLINFOW), 0, This->hwnd, 0xdeadbeef,
424 {0,0,0,0}, NULL, NULL, 0};
426 TRACE("(%p)\n", This);
428 SendMessageW(This->tooltips_hwnd, TTM_DELTOOLW, 0, (LPARAM)&toolinfo);
429 SendMessageW(This->tooltips_hwnd, TTM_ACTIVATE, FALSE, 0);
432 HRESULT call_set_active_object(IOleInPlaceUIWindow *window, IOleInPlaceActiveObject *act_obj)
434 static WCHAR html_documentW[30];
436 if(act_obj && !html_documentW[0]) {
437 LoadStringW(hInst, IDS_HTMLDOCUMENT, html_documentW,
438 sizeof(html_documentW)/sizeof(WCHAR));
441 return IOleInPlaceFrame_SetActiveObject(window, act_obj, act_obj ? html_documentW : NULL);
444 /**********************************************************
445 * IOleDocumentView implementation
448 #define DOCVIEW_THIS(iface) DEFINE_THIS(HTMLDocument, OleDocumentView, iface)
450 static HRESULT WINAPI OleDocumentView_QueryInterface(IOleDocumentView *iface, REFIID riid, void **ppvObject)
452 HTMLDocument *This = DOCVIEW_THIS(iface);
453 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
456 static ULONG WINAPI OleDocumentView_AddRef(IOleDocumentView *iface)
458 HTMLDocument *This = DOCVIEW_THIS(iface);
459 return IHTMLDocument2_AddRef(HTMLDOC(This));
462 static ULONG WINAPI OleDocumentView_Release(IOleDocumentView *iface)
464 HTMLDocument *This = DOCVIEW_THIS(iface);
465 return IHTMLDocument2_Release(HTMLDOC(This));
468 static HRESULT WINAPI OleDocumentView_SetInPlaceSite(IOleDocumentView *iface, IOleInPlaceSite *pIPSite)
470 HTMLDocument *This = DOCVIEW_THIS(iface);
471 TRACE("(%p)->(%p)\n", This, pIPSite);
474 IOleInPlaceSite_AddRef(pIPSite);
476 if(This->doc_obj->ipsite)
477 IOleInPlaceSite_Release(This->doc_obj->ipsite);
479 This->doc_obj->ipsite = pIPSite;
480 This->doc_obj->request_uiactivate = TRUE;
484 static HRESULT WINAPI OleDocumentView_GetInPlaceSite(IOleDocumentView *iface, IOleInPlaceSite **ppIPSite)
486 HTMLDocument *This = DOCVIEW_THIS(iface);
487 TRACE("(%p)->(%p)\n", This, ppIPSite);
492 if(This->doc_obj->ipsite)
493 IOleInPlaceSite_AddRef(This->doc_obj->ipsite);
495 *ppIPSite = This->doc_obj->ipsite;
499 static HRESULT WINAPI OleDocumentView_GetDocument(IOleDocumentView *iface, IUnknown **ppunk)
501 HTMLDocument *This = DOCVIEW_THIS(iface);
502 TRACE("(%p)->(%p)\n", This, ppunk);
507 IHTMLDocument2_AddRef(HTMLDOC(This));
508 *ppunk = (IUnknown*)HTMLDOC(This);
512 static HRESULT WINAPI OleDocumentView_SetRect(IOleDocumentView *iface, LPRECT prcView)
514 HTMLDocument *This = DOCVIEW_THIS(iface);
517 TRACE("(%p)->(%p)\n", This, prcView);
522 if(This->doc_obj->hwnd) {
523 GetClientRect(This->doc_obj->hwnd, &rect);
524 if(memcmp(prcView, &rect, sizeof(RECT))) {
525 InvalidateRect(This->doc_obj->hwnd, NULL, TRUE);
526 SetWindowPos(This->doc_obj->hwnd, NULL, prcView->left, prcView->top, prcView->right,
527 prcView->bottom, SWP_NOZORDER | SWP_NOACTIVATE);
534 static HRESULT WINAPI OleDocumentView_GetRect(IOleDocumentView *iface, LPRECT prcView)
536 HTMLDocument *This = DOCVIEW_THIS(iface);
538 TRACE("(%p)->(%p)\n", This, prcView);
543 GetClientRect(This->doc_obj->hwnd, prcView);
547 static HRESULT WINAPI OleDocumentView_SetRectComplex(IOleDocumentView *iface, LPRECT prcView,
548 LPRECT prcHScroll, LPRECT prcVScroll, LPRECT prcSizeBox)
550 HTMLDocument *This = DOCVIEW_THIS(iface);
551 FIXME("(%p)->(%p %p %p %p)\n", This, prcView, prcHScroll, prcVScroll, prcSizeBox);
555 static HRESULT WINAPI OleDocumentView_Show(IOleDocumentView *iface, BOOL fShow)
557 HTMLDocument *This = DOCVIEW_THIS(iface);
560 TRACE("(%p)->(%x)\n", This, fShow);
563 if(!This->doc_obj->ui_active) {
564 hres = activate_window(This->doc_obj);
568 update_doc(This, UPDATE_UI);
569 ShowWindow(This->doc_obj->hwnd, SW_SHOW);
571 ShowWindow(This->doc_obj->hwnd, SW_HIDE);
573 if(This->doc_obj->in_place_active)
574 IOleInPlaceObjectWindowless_InPlaceDeactivate(INPLACEWIN(This));
576 if(This->doc_obj->ip_window) {
577 IOleInPlaceUIWindow_Release(This->doc_obj->ip_window);
578 This->doc_obj->ip_window = NULL;
585 static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL fUIActivate)
587 HTMLDocument *This = DOCVIEW_THIS(iface);
590 TRACE("(%p)->(%x)\n", This, fUIActivate);
592 if(!This->doc_obj->ipsite) {
593 IOleClientSite *cs = This->doc_obj->client;
594 IOleInPlaceSite *ips;
597 WARN("this->ipsite = NULL\n");
601 hres = IOleClientSite_QueryInterface(cs, &IID_IOleInPlaceSiteWindowless, (void**)&ips);
603 This->doc_obj->ipsite = ips;
605 hres = IOleClientSite_QueryInterface(cs, &IID_IOleInPlaceSiteEx, (void**)&ips);
607 This->doc_obj->ipsite = ips;
609 hres = IOleClientSite_QueryInterface(cs, &IID_IOleInPlaceSite, (void**)&ips);
611 This->doc_obj->ipsite = ips;
613 WARN("this->ipsite = NULL\n");
614 return E_NOINTERFACE;
619 IOleClientSite_AddRef(This->doc_obj->ipsite);
620 This->doc_obj->request_uiactivate = FALSE;
621 HTMLDocument_LockContainer(This->doc_obj, TRUE);
627 if(This->doc_obj->ui_active)
630 if(!This->doc_obj->window_active) {
631 hres = activate_window(This->doc_obj);
636 This->doc_obj->focus = TRUE;
637 if(This->doc_obj->nscontainer)
638 nsIWebBrowserFocus_Activate(This->doc_obj->nscontainer->focus);
639 notif_focus(This->doc_obj);
641 update_doc(This, UPDATE_UI);
643 hres = IOleInPlaceSite_OnUIActivate(This->doc_obj->ipsite);
644 if(SUCCEEDED(hres)) {
645 call_set_active_object((IOleInPlaceUIWindow*)This->doc_obj->frame, ACTOBJ(This));
647 FIXME("OnUIActivate failed: %08x\n", hres);
648 IOleInPlaceFrame_Release(This->doc_obj->frame);
649 This->doc_obj->frame = NULL;
650 This->doc_obj->ui_active = FALSE;
654 if(This->doc_obj->hostui) {
655 hres = IDocHostUIHandler_ShowUI(This->doc_obj->hostui,
656 This->doc_obj->usermode == EDITMODE ? DOCHOSTUITYPE_AUTHOR : DOCHOSTUITYPE_BROWSE,
657 ACTOBJ(This), CMDTARGET(This), This->doc_obj->frame, This->doc_obj->ip_window);
659 IDocHostUIHandler_HideUI(This->doc_obj->hostui);
662 if(This->doc_obj->ip_window)
663 call_set_active_object(This->doc_obj->ip_window, ACTOBJ(This));
665 memset(&rcBorderWidths, 0, sizeof(rcBorderWidths));
666 IOleInPlaceFrame_SetBorderSpace(This->doc_obj->frame, &rcBorderWidths);
668 This->doc_obj->ui_active = TRUE;
670 This->doc_obj->focus = FALSE;
671 nsIWebBrowserFocus_Deactivate(This->doc_obj->nscontainer->focus);
672 if(This->doc_obj->ui_active) {
673 This->doc_obj->ui_active = FALSE;
674 if(This->doc_obj->ip_window)
675 call_set_active_object(This->doc_obj->ip_window, NULL);
676 if(This->doc_obj->frame)
677 call_set_active_object((IOleInPlaceUIWindow*)This->doc_obj->frame, NULL);
678 if(This->doc_obj->hostui)
679 IDocHostUIHandler_HideUI(This->doc_obj->hostui);
680 if(This->doc_obj->ipsite)
681 IOleInPlaceSite_OnUIDeactivate(This->doc_obj->ipsite, FALSE);
687 static HRESULT WINAPI OleDocumentView_Open(IOleDocumentView *iface)
689 HTMLDocument *This = DOCVIEW_THIS(iface);
690 FIXME("(%p)\n", This);
694 static HRESULT WINAPI OleDocumentView_CloseView(IOleDocumentView *iface, DWORD dwReserved)
696 HTMLDocument *This = DOCVIEW_THIS(iface);
697 TRACE("(%p)->(%x)\n", This, dwReserved);
700 WARN("dwReserved = %d\n", dwReserved);
703 * Windows implementation calls QueryInterface(IID_IOleCommandTarget),
704 * QueryInterface(IID_IOleControlSite) and KillTimer
707 IOleDocumentView_Show(iface, FALSE);
712 static HRESULT WINAPI OleDocumentView_SaveViewState(IOleDocumentView *iface, LPSTREAM pstm)
714 HTMLDocument *This = DOCVIEW_THIS(iface);
715 FIXME("(%p)->(%p)\n", This, pstm);
719 static HRESULT WINAPI OleDocumentView_ApplyViewState(IOleDocumentView *iface, LPSTREAM pstm)
721 HTMLDocument *This = DOCVIEW_THIS(iface);
722 FIXME("(%p)->(%p)\n", This, pstm);
726 static HRESULT WINAPI OleDocumentView_Clone(IOleDocumentView *iface, IOleInPlaceSite *pIPSiteNew,
727 IOleDocumentView **ppViewNew)
729 HTMLDocument *This = DOCVIEW_THIS(iface);
730 FIXME("(%p)->(%p %p)\n", This, pIPSiteNew, ppViewNew);
736 static const IOleDocumentViewVtbl OleDocumentViewVtbl = {
737 OleDocumentView_QueryInterface,
738 OleDocumentView_AddRef,
739 OleDocumentView_Release,
740 OleDocumentView_SetInPlaceSite,
741 OleDocumentView_GetInPlaceSite,
742 OleDocumentView_GetDocument,
743 OleDocumentView_SetRect,
744 OleDocumentView_GetRect,
745 OleDocumentView_SetRectComplex,
746 OleDocumentView_Show,
747 OleDocumentView_UIActivate,
748 OleDocumentView_Open,
749 OleDocumentView_CloseView,
750 OleDocumentView_SaveViewState,
751 OleDocumentView_ApplyViewState,
752 OleDocumentView_Clone
755 /**********************************************************
756 * IViewObject implementation
759 #define VIEWOBJ_THIS(iface) DEFINE_THIS(HTMLDocument, ViewObjectEx, iface)
761 static HRESULT WINAPI ViewObject_QueryInterface(IViewObjectEx *iface, REFIID riid, void **ppvObject)
763 HTMLDocument *This = VIEWOBJ_THIS(iface);
764 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
767 static ULONG WINAPI ViewObject_AddRef(IViewObjectEx *iface)
769 HTMLDocument *This = VIEWOBJ_THIS(iface);
770 return IHTMLDocument2_AddRef(HTMLDOC(This));
773 static ULONG WINAPI ViewObject_Release(IViewObjectEx *iface)
775 HTMLDocument *This = VIEWOBJ_THIS(iface);
776 return IHTMLDocument2_Release(HTMLDOC(This));
779 static HRESULT WINAPI ViewObject_Draw(IViewObjectEx *iface, DWORD dwDrawAspect, LONG lindex, void *pvAspect,
780 DVTARGETDEVICE *ptd, HDC hdcTargetDev, HDC hdcDraw, LPCRECTL lprcBounds,
781 LPCRECTL lprcWBounds, BOOL (CALLBACK *pfnContinue)(ULONG_PTR dwContinue), ULONG_PTR dwContinue)
783 HTMLDocument *This = VIEWOBJ_THIS(iface);
784 FIXME("(%p)->(%d %d %p %p %p %p %p %p %p %ld)\n", This, dwDrawAspect, lindex, pvAspect,
785 ptd, hdcTargetDev, hdcDraw, lprcBounds, lprcWBounds, pfnContinue, dwContinue);
789 static HRESULT WINAPI ViewObject_GetColorSet(IViewObjectEx *iface, DWORD dwDrawAspect, LONG lindex, void *pvAspect,
790 DVTARGETDEVICE *ptd, HDC hicTargetDev, LOGPALETTE **ppColorSet)
792 HTMLDocument *This = VIEWOBJ_THIS(iface);
793 FIXME("(%p)->(%d %d %p %p %p %p)\n", This, dwDrawAspect, lindex, pvAspect, ptd, hicTargetDev, ppColorSet);
797 static HRESULT WINAPI ViewObject_Freeze(IViewObjectEx *iface, DWORD dwDrawAspect, LONG lindex,
798 void *pvAspect, DWORD *pdwFreeze)
800 HTMLDocument *This = VIEWOBJ_THIS(iface);
801 FIXME("(%p)->(%d %d %p %p)\n", This, dwDrawAspect, lindex, pvAspect, pdwFreeze);
805 static HRESULT WINAPI ViewObject_Unfreeze(IViewObjectEx *iface, DWORD dwFreeze)
807 HTMLDocument *This = VIEWOBJ_THIS(iface);
808 FIXME("(%p)->(%d)\n", This, dwFreeze);
812 static HRESULT WINAPI ViewObject_SetAdvise(IViewObjectEx *iface, DWORD aspects, DWORD advf, IAdviseSink *pAdvSink)
814 HTMLDocument *This = VIEWOBJ_THIS(iface);
816 TRACE("(%p)->(%d %d %p)\n", This, aspects, advf, pAdvSink);
818 if(aspects != DVASPECT_CONTENT || advf != ADVF_PRIMEFIRST)
819 FIXME("unsupported arguments\n");
821 if(This->doc_obj->view_sink)
822 IAdviseSink_Release(This->doc_obj->view_sink);
824 IAdviseSink_AddRef(pAdvSink);
826 This->doc_obj->view_sink = pAdvSink;
830 static HRESULT WINAPI ViewObject_GetAdvise(IViewObjectEx *iface, DWORD *pAspects, DWORD *pAdvf, IAdviseSink **ppAdvSink)
832 HTMLDocument *This = VIEWOBJ_THIS(iface);
833 FIXME("(%p)->(%p %p %p)\n", This, pAspects, pAdvf, ppAdvSink);
837 static HRESULT WINAPI ViewObject_GetExtent(IViewObjectEx *iface, DWORD dwDrawAspect, LONG lindex,
838 DVTARGETDEVICE* ptd, LPSIZEL lpsizel)
840 HTMLDocument *This = VIEWOBJ_THIS(iface);
841 FIXME("(%p)->(%d %d %p %p)\n", This, dwDrawAspect, lindex, ptd, lpsizel);
845 static HRESULT WINAPI ViewObject_GetRect(IViewObjectEx *iface, DWORD dwAspect, LPRECTL pRect)
847 HTMLDocument *This = VIEWOBJ_THIS(iface);
848 FIXME("(%p)->(%d %p)\n", This, dwAspect, pRect);
852 static HRESULT WINAPI ViewObject_GetViewStatus(IViewObjectEx *iface, DWORD *pdwStatus)
854 HTMLDocument *This = VIEWOBJ_THIS(iface);
855 FIXME("(%p)->(%p)\n", This, pdwStatus);
859 static HRESULT WINAPI ViewObject_QueryHitPoint(IViewObjectEx* iface, DWORD dwAspect,
860 LPCRECT pRectBounds, POINT ptlLoc, LONG lCloseHint, DWORD *pHitResult)
862 HTMLDocument *This = VIEWOBJ_THIS(iface);
863 FIXME("(%p)->(%d %p (%d %d) %d %p)\n", This, dwAspect, pRectBounds, ptlLoc.x,
864 ptlLoc.y, lCloseHint, pHitResult);
868 static HRESULT WINAPI ViewObject_QueryHitRect(IViewObjectEx *iface, DWORD dwAspect,
869 LPCRECT pRectBounds, LPCRECT pRectLoc, LONG lCloseHint, DWORD *pHitResult)
871 HTMLDocument *This = VIEWOBJ_THIS(iface);
872 FIXME("(%p)->(%d %p %p %d %p)\n", This, dwAspect, pRectBounds, pRectLoc, lCloseHint, pHitResult);
876 static HRESULT WINAPI ViewObject_GetNaturalExtent(IViewObjectEx *iface, DWORD dwAspect, LONG lindex,
877 DVTARGETDEVICE *ptd, HDC hicTargetDev, DVEXTENTINFO *pExtentInfo, LPSIZEL pSizel)
879 HTMLDocument *This = VIEWOBJ_THIS(iface);
880 FIXME("(%p)->(%d %d %p %p %p %p\n", This, dwAspect,lindex, ptd,
881 hicTargetDev, pExtentInfo, pSizel);
887 static const IViewObjectExVtbl ViewObjectVtbl = {
888 ViewObject_QueryInterface,
892 ViewObject_GetColorSet,
895 ViewObject_SetAdvise,
896 ViewObject_GetAdvise,
897 ViewObject_GetExtent,
899 ViewObject_GetViewStatus,
900 ViewObject_QueryHitPoint,
901 ViewObject_QueryHitRect,
902 ViewObject_GetNaturalExtent
905 void HTMLDocument_View_Init(HTMLDocument *This)
907 This->lpOleDocumentViewVtbl = &OleDocumentViewVtbl;
908 This->lpViewObjectExVtbl = &ViewObjectVtbl;