push 65f191514f6da34cdfbbc73b8f5d66c351839600
[wine/hacks.git] / dlls / mshtml / view.c
blob72a4a4005f26d65c2a3370517127d26e158d75c2
1 /*
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
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 "commctrl.h"
30 #include "ole2.h"
31 #include "resource.h"
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;
48 typedef struct {
49 HTMLDocument *doc;
50 WNDPROC proc;
51 } tooltip_data;
53 static void paint_document(HTMLDocument *This)
55 PAINTSTRUCT ps;
56 RECT rect;
57 HDC hdc;
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];
68 HFONT font;
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);
80 DeleteObject(font);
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);
95 nsIWebBrowserFocus_Activate(This->focus);
98 void update_doc(HTMLDocument *This, DWORD flags)
100 if(!This->update && This->hwnd)
101 SetTimer(This->hwnd, TIMER_ID, 100, NULL);
103 This->update |= flags;
106 void update_title(HTMLDocument *This)
108 IOleCommandTarget *olecmd;
109 HRESULT hres;
111 if(!(This->update & UPDATE_TITLE))
112 return;
114 This->update &= ~UPDATE_TITLE;
116 if(!This->client)
117 return;
119 hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget, (void**)&olecmd);
120 if(SUCCEEDED(hres)) {
121 VARIANT title;
122 WCHAR empty[] = {0};
124 V_VT(&title) = VT_BSTR;
125 V_BSTR(&title) = SysAllocString(empty);
126 IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETTITLE, OLECMDEXECOPT_DONTPROMPTUSER,
127 &title, NULL);
128 SysFreeString(V_BSTR(&title));
130 IOleCommandTarget_Release(olecmd);
134 static LRESULT on_timer(HTMLDocument *This)
136 TRACE("(%p) %x\n", This, This->update);
138 KillTimer(This->hwnd, TIMER_ID);
140 if(!This->update)
141 return 0;
143 if(This->update & UPDATE_UI) {
144 if(This->hostui)
145 IDocHostUIHandler_UpdateUI(This->hostui);
147 if(This->client) {
148 IOleCommandTarget *cmdtrg;
149 HRESULT hres;
151 hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget,
152 (void**)&cmdtrg);
153 if(SUCCEEDED(hres)) {
154 IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_UPDATECOMMANDS,
155 OLECMDEXECOPT_DONTPROMPTUSER, NULL, NULL);
156 IOleCommandTarget_Release(cmdtrg);
161 update_title(This);
162 This->update = 0;
163 return 0;
166 void notif_focus(HTMLDocument *This)
168 IOleControlSite *site;
169 HRESULT hres;
171 if(!This->client)
172 return;
174 hres = IOleClientSite_QueryInterface(This->client, &IID_IOleControlSite, (void**)&site);
175 if(FAILED(hres))
176 return;
178 IOleControlSite_OnFocus(site, This->focus);
179 IOleControlSite_Release(site);
182 static LRESULT WINAPI serverwnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
184 HTMLDocument *This;
186 static const WCHAR wszTHIS[] = {'T','H','I','S',0};
188 if(msg == WM_CREATE) {
189 This = *(HTMLDocument**)lParam;
190 SetPropW(hwnd, wszTHIS, This);
191 }else {
192 This = GetPropW(hwnd, wszTHIS);
195 switch(msg) {
196 case WM_CREATE:
197 This->hwnd = hwnd;
198 break;
199 case WM_PAINT:
200 paint_document(This);
201 break;
202 case WM_SIZE:
203 TRACE("(%p)->(WM_SIZE)\n", This);
204 if(This->nscontainer) {
205 INT ew=0, eh=0;
207 if(!(This->hostinfo.dwFlags & (DOCHOSTUIFLAG_NO3DOUTERBORDER|DOCHOSTUIFLAG_NO3DBORDER))) {
208 ew = GetSystemMetrics(SM_CXEDGE);
209 eh = GetSystemMetrics(SM_CYEDGE);
212 SetWindowPos(This->nscontainer->hwnd, NULL, ew, eh,
213 LOWORD(lParam) - 2*ew, HIWORD(lParam) - 2*eh,
214 SWP_NOZORDER | SWP_NOACTIVATE);
216 break;
217 case WM_TIMER:
218 return on_timer(This);
219 case WM_MOUSEACTIVATE:
220 return MA_ACTIVATE;
223 return DefWindowProcW(hwnd, msg, wParam, lParam);
226 static void register_serverwnd_class(void)
228 static WNDCLASSEXW wndclass = {
229 sizeof(WNDCLASSEXW),
230 CS_DBLCLKS,
231 serverwnd_proc,
232 0, 0, NULL, NULL, NULL, NULL, NULL,
233 wszInternetExplorer_Server,
234 NULL,
236 wndclass.hInstance = hInst;
237 serverwnd_class = RegisterClassExW(&wndclass);
240 static HRESULT activate_window(HTMLDocument *This)
242 IOleInPlaceFrame *pIPFrame;
243 IOleCommandTarget *cmdtrg;
244 IOleInPlaceSiteEx *ipsiteex;
245 RECT posrect, cliprect;
246 OLEINPLACEFRAMEINFO frameinfo;
247 HWND parent_hwnd;
248 HRESULT hres;
250 if(!serverwnd_class)
251 register_serverwnd_class();
253 hres = IOleInPlaceSite_CanInPlaceActivate(This->ipsite);
254 if(hres != S_OK) {
255 WARN("CanInPlaceActivate returned: %08x\n", hres);
256 return FAILED(hres) ? hres : E_FAIL;
259 hres = IOleInPlaceSite_GetWindowContext(This->ipsite, &pIPFrame, &This->ip_window,
260 &posrect, &cliprect, &frameinfo);
261 if(FAILED(hres)) {
262 WARN("GetWindowContext failed: %08x\n", hres);
263 return hres;
266 TRACE("got window context: %p %p {%d %d %d %d} {%d %d %d %d} {%d %x %p %p %d}\n",
267 pIPFrame, This->ip_window, posrect.left, posrect.top, posrect.right, posrect.bottom,
268 cliprect.left, cliprect.top, cliprect.right, cliprect.bottom,
269 frameinfo.cb, frameinfo.fMDIApp, frameinfo.hwndFrame, frameinfo.haccel, frameinfo.cAccelEntries);
271 hres = IOleInPlaceSite_GetWindow(This->ipsite, &parent_hwnd);
272 if(FAILED(hres)) {
273 WARN("GetWindow failed: %08x\n", hres);
274 return hres;
277 TRACE("got parent window %p\n", parent_hwnd);
279 if(This->hwnd) {
280 if(GetParent(This->hwnd) != parent_hwnd)
281 SetParent(This->hwnd, parent_hwnd);
282 SetWindowPos(This->hwnd, HWND_TOP,
283 posrect.left, posrect.top, posrect.right-posrect.left, posrect.bottom-posrect.top,
284 SWP_NOACTIVATE | SWP_SHOWWINDOW);
285 }else {
286 CreateWindowExW(0, wszInternetExplorer_Server, NULL,
287 WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
288 posrect.left, posrect.top, posrect.right-posrect.left, posrect.bottom-posrect.top,
289 parent_hwnd, NULL, hInst, This);
291 TRACE("Created window %p\n", This->hwnd);
293 SetWindowPos(This->hwnd, NULL, 0, 0, 0, 0,
294 SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_SHOWWINDOW);
295 RedrawWindow(This->hwnd, NULL, NULL, RDW_INVALIDATE | RDW_NOERASE | RDW_ALLCHILDREN);
297 /* NOTE:
298 * Windows implementation calls:
299 * RegisterWindowMessage("MSWHEEL_ROLLMSG");
301 SetTimer(This->hwnd, TIMER_ID, 100, NULL);
304 if(This->nscontainer)
305 activate_gecko(This->nscontainer);
307 This->in_place_active = TRUE;
308 hres = IOleInPlaceSite_QueryInterface(This->ipsite, &IID_IOleInPlaceSiteEx, (void**)&ipsiteex);
309 if(SUCCEEDED(hres)) {
310 BOOL redraw = FALSE;
312 hres = IOleInPlaceSiteEx_OnInPlaceActivateEx(ipsiteex, &redraw, 0);
313 IOleInPlaceSiteEx_Release(ipsiteex);
314 if(redraw)
315 FIXME("unsupported redraw\n");
316 }else{
317 hres = IOleInPlaceSite_OnInPlaceActivate(This->ipsite);
319 if(FAILED(hres)) {
320 WARN("OnInPlaceActivate failed: %08x\n", hres);
321 This->in_place_active = FALSE;
322 return hres;
325 hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget, (void**)&cmdtrg);
326 if(SUCCEEDED(hres)) {
327 VARIANT var;
329 IOleInPlaceFrame_SetStatusText(pIPFrame, NULL);
331 V_VT(&var) = VT_I4;
332 V_I4(&var) = 0;
333 IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_SETPROGRESSMAX,
334 OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
335 IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_SETPROGRESSPOS,
336 OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
338 IOleCommandTarget_Release(cmdtrg);
341 if(This->frame)
342 IOleInPlaceFrame_Release(This->frame);
343 This->frame = pIPFrame;
345 This->window_active = TRUE;
347 return S_OK;
350 static LRESULT WINAPI tooltips_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
352 tooltip_data *data = GetPropW(hwnd, wszTooltipData);
354 TRACE("%d %p\n", msg, data);
356 if(msg == TTM_WINDOWFROMPOINT) {
357 RECT rect;
358 POINT *pt = (POINT*)lParam;
360 TRACE("TTM_WINDOWFROMPOINT (%d,%d)\n", pt->x, pt->y);
362 GetWindowRect(data->doc->hwnd, &rect);
364 if(rect.left <= pt->x && pt->x <= rect.right
365 && rect.top <= pt->y && pt->y <= rect.bottom)
366 return (LPARAM)data->doc->hwnd;
369 return CallWindowProcW(data->proc, hwnd, msg, wParam, lParam);
372 static void create_tooltips_window(HTMLDocument *This)
374 tooltip_data *data = heap_alloc(sizeof(*data));
376 This->tooltips_hwnd = CreateWindowExW(0, TOOLTIPS_CLASSW, NULL, TTS_NOPREFIX | WS_POPUP,
377 CW_USEDEFAULT, CW_USEDEFAULT, 10, 10, This->hwnd, NULL, hInst, NULL);
379 data->doc = This;
380 data->proc = (WNDPROC)GetWindowLongPtrW(This->tooltips_hwnd, GWLP_WNDPROC);
382 SetPropW(This->tooltips_hwnd, wszTooltipData, data);
384 SetWindowLongPtrW(This->tooltips_hwnd, GWLP_WNDPROC, (LONG_PTR)tooltips_proc);
386 SetWindowPos(This->tooltips_hwnd, HWND_TOPMOST,0, 0, 0, 0,
387 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
391 void show_tooltip(HTMLDocument *This, DWORD x, DWORD y, LPCWSTR text)
393 TTTOOLINFOW toolinfo = {
394 sizeof(TTTOOLINFOW), 0, This->hwnd, 0xdeadbeef,
395 {x>2 ? x-2 : 0, y>0 ? y-2 : 0, x+2, y+2}, /* FIXME */
396 NULL, (LPWSTR)text, 0};
397 MSG msg = {This->hwnd, WM_MOUSEMOVE, 0, MAKELPARAM(x,y), 0, {x,y}};
399 TRACE("(%p)->(%d %d %s)\n", This, x, y, debugstr_w(text));
401 if(!This->tooltips_hwnd)
402 create_tooltips_window(This);
404 SendMessageW(This->tooltips_hwnd, TTM_ADDTOOLW, 0, (LPARAM)&toolinfo);
405 SendMessageW(This->tooltips_hwnd, TTM_ACTIVATE, TRUE, 0);
406 SendMessageW(This->tooltips_hwnd, TTM_RELAYEVENT, 0, (LPARAM)&msg);
409 void hide_tooltip(HTMLDocument *This)
411 TTTOOLINFOW toolinfo = {
412 sizeof(TTTOOLINFOW), 0, This->hwnd, 0xdeadbeef,
413 {0,0,0,0}, NULL, NULL, 0};
415 TRACE("(%p)\n", This);
417 SendMessageW(This->tooltips_hwnd, TTM_DELTOOLW, 0, (LPARAM)&toolinfo);
418 SendMessageW(This->tooltips_hwnd, TTM_ACTIVATE, FALSE, 0);
421 HRESULT call_set_active_object(IOleInPlaceUIWindow *window, IOleInPlaceActiveObject *act_obj)
423 static WCHAR html_documentW[30];
425 if(act_obj && !html_documentW[0]) {
426 LoadStringW(hInst, IDS_HTMLDOCUMENT, html_documentW,
427 sizeof(html_documentW)/sizeof(WCHAR));
430 return IOleInPlaceFrame_SetActiveObject(window, act_obj, act_obj ? html_documentW : NULL);
433 /**********************************************************
434 * IOleDocumentView implementation
437 #define DOCVIEW_THIS(iface) DEFINE_THIS(HTMLDocument, OleDocumentView, iface)
439 static HRESULT WINAPI OleDocumentView_QueryInterface(IOleDocumentView *iface, REFIID riid, void **ppvObject)
441 HTMLDocument *This = DOCVIEW_THIS(iface);
442 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
445 static ULONG WINAPI OleDocumentView_AddRef(IOleDocumentView *iface)
447 HTMLDocument *This = DOCVIEW_THIS(iface);
448 return IHTMLDocument2_AddRef(HTMLDOC(This));
451 static ULONG WINAPI OleDocumentView_Release(IOleDocumentView *iface)
453 HTMLDocument *This = DOCVIEW_THIS(iface);
454 return IHTMLDocument2_Release(HTMLDOC(This));
457 static HRESULT WINAPI OleDocumentView_SetInPlaceSite(IOleDocumentView *iface, IOleInPlaceSite *pIPSite)
459 HTMLDocument *This = DOCVIEW_THIS(iface);
460 TRACE("(%p)->(%p)\n", This, pIPSite);
462 if(pIPSite)
463 IOleInPlaceSite_AddRef(pIPSite);
465 if(This->ipsite)
466 IOleInPlaceSite_Release(This->ipsite);
468 This->ipsite = pIPSite;
469 return S_OK;
472 static HRESULT WINAPI OleDocumentView_GetInPlaceSite(IOleDocumentView *iface, IOleInPlaceSite **ppIPSite)
474 HTMLDocument *This = DOCVIEW_THIS(iface);
475 TRACE("(%p)->(%p)\n", This, ppIPSite);
477 if(!ppIPSite)
478 return E_INVALIDARG;
480 if(This->ipsite)
481 IOleInPlaceSite_AddRef(This->ipsite);
483 *ppIPSite = This->ipsite;
484 return S_OK;
487 static HRESULT WINAPI OleDocumentView_GetDocument(IOleDocumentView *iface, IUnknown **ppunk)
489 HTMLDocument *This = DOCVIEW_THIS(iface);
490 TRACE("(%p)->(%p)\n", This, ppunk);
492 if(!ppunk)
493 return E_INVALIDARG;
495 IHTMLDocument2_AddRef(HTMLDOC(This));
496 *ppunk = (IUnknown*)HTMLDOC(This);
497 return S_OK;
500 static HRESULT WINAPI OleDocumentView_SetRect(IOleDocumentView *iface, LPRECT prcView)
502 HTMLDocument *This = DOCVIEW_THIS(iface);
503 RECT rect;
505 TRACE("(%p)->(%p)\n", This, prcView);
507 if(!prcView)
508 return E_INVALIDARG;
510 if(This->hwnd) {
511 GetClientRect(This->hwnd, &rect);
512 if(memcmp(prcView, &rect, sizeof(RECT))) {
513 InvalidateRect(This->hwnd,NULL,TRUE);
514 SetWindowPos(This->hwnd, NULL, prcView->left, prcView->top, prcView->right,
515 prcView->bottom, SWP_NOZORDER | SWP_NOACTIVATE);
519 return S_OK;
522 static HRESULT WINAPI OleDocumentView_GetRect(IOleDocumentView *iface, LPRECT prcView)
524 HTMLDocument *This = DOCVIEW_THIS(iface);
526 TRACE("(%p)->(%p)\n", This, prcView);
528 if(!prcView)
529 return E_INVALIDARG;
531 GetClientRect(This->hwnd, prcView);
532 return S_OK;
535 static HRESULT WINAPI OleDocumentView_SetRectComplex(IOleDocumentView *iface, LPRECT prcView,
536 LPRECT prcHScroll, LPRECT prcVScroll, LPRECT prcSizeBox)
538 HTMLDocument *This = DOCVIEW_THIS(iface);
539 FIXME("(%p)->(%p %p %p %p)\n", This, prcView, prcHScroll, prcVScroll, prcSizeBox);
540 return E_NOTIMPL;
543 static HRESULT WINAPI OleDocumentView_Show(IOleDocumentView *iface, BOOL fShow)
545 HTMLDocument *This = DOCVIEW_THIS(iface);
546 HRESULT hres;
548 TRACE("(%p)->(%x)\n", This, fShow);
550 if(fShow) {
551 if(!This->ui_active) {
552 hres = activate_window(This);
553 if(FAILED(hres))
554 return hres;
556 update_doc(This, UPDATE_UI);
557 ShowWindow(This->hwnd, SW_SHOW);
558 }else {
559 ShowWindow(This->hwnd, SW_HIDE);
560 if(This->ip_window) {
561 IOleInPlaceUIWindow_Release(This->ip_window);
562 This->ip_window = NULL;
566 return S_OK;
569 static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL fUIActivate)
571 HTMLDocument *This = DOCVIEW_THIS(iface);
572 HRESULT hres;
574 TRACE("(%p)->(%x)\n", This, fUIActivate);
576 if(!This->ipsite) {
577 FIXME("This->ipsite = NULL\n");
578 return E_FAIL;
581 if(fUIActivate) {
582 RECT rcBorderWidths;
584 if(This->ui_active)
585 return S_OK;
587 if(!This->window_active) {
588 hres = activate_window(This);
589 if(FAILED(hres))
590 return hres;
593 This->focus = TRUE;
594 if(This->nscontainer)
595 nsIWebBrowserFocus_Activate(This->nscontainer->focus);
596 notif_focus(This);
598 update_doc(This, UPDATE_UI);
600 hres = IOleInPlaceSite_OnUIActivate(This->ipsite);
601 if(SUCCEEDED(hres)) {
602 call_set_active_object((IOleInPlaceUIWindow*)This->frame, ACTOBJ(This));
603 }else {
604 FIXME("OnUIActivate failed: %08x\n", hres);
605 IOleInPlaceFrame_Release(This->frame);
606 This->frame = NULL;
607 This->ui_active = FALSE;
608 return hres;
611 if(This->hostui) {
612 hres = IDocHostUIHandler_ShowUI(This->hostui,
613 This->usermode == EDITMODE ? DOCHOSTUITYPE_AUTHOR : DOCHOSTUITYPE_BROWSE,
614 ACTOBJ(This), CMDTARGET(This), This->frame, This->ip_window);
615 if(FAILED(hres))
616 IDocHostUIHandler_HideUI(This->hostui);
619 if(This->ip_window)
620 call_set_active_object(This->ip_window, ACTOBJ(This));
622 memset(&rcBorderWidths, 0, sizeof(rcBorderWidths));
623 IOleInPlaceFrame_SetBorderSpace(This->frame, &rcBorderWidths);
625 This->ui_active = TRUE;
626 }else {
627 if(This->ui_active) {
628 This->ui_active = FALSE;
629 if(This->ip_window)
630 call_set_active_object(This->ip_window, NULL);
631 if(This->frame)
632 call_set_active_object((IOleInPlaceUIWindow*)This->frame, NULL);
633 if(This->hostui)
634 IDocHostUIHandler_HideUI(This->hostui);
635 if(This->ipsite)
636 IOleInPlaceSite_OnUIDeactivate(This->ipsite, FALSE);
639 return S_OK;
642 static HRESULT WINAPI OleDocumentView_Open(IOleDocumentView *iface)
644 HTMLDocument *This = DOCVIEW_THIS(iface);
645 FIXME("(%p)\n", This);
646 return E_NOTIMPL;
649 static HRESULT WINAPI OleDocumentView_CloseView(IOleDocumentView *iface, DWORD dwReserved)
651 HTMLDocument *This = DOCVIEW_THIS(iface);
652 TRACE("(%p)->(%x)\n", This, dwReserved);
654 if(dwReserved)
655 WARN("dwReserved = %d\n", dwReserved);
657 /* NOTE:
658 * Windows implementation calls QueryInterface(IID_IOleCommandTarget),
659 * QueryInterface(IID_IOleControlSite) and KillTimer
662 IOleDocumentView_Show(iface, FALSE);
664 return S_OK;
667 static HRESULT WINAPI OleDocumentView_SaveViewState(IOleDocumentView *iface, LPSTREAM pstm)
669 HTMLDocument *This = DOCVIEW_THIS(iface);
670 FIXME("(%p)->(%p)\n", This, pstm);
671 return E_NOTIMPL;
674 static HRESULT WINAPI OleDocumentView_ApplyViewState(IOleDocumentView *iface, LPSTREAM pstm)
676 HTMLDocument *This = DOCVIEW_THIS(iface);
677 FIXME("(%p)->(%p)\n", This, pstm);
678 return E_NOTIMPL;
681 static HRESULT WINAPI OleDocumentView_Clone(IOleDocumentView *iface, IOleInPlaceSite *pIPSiteNew,
682 IOleDocumentView **ppViewNew)
684 HTMLDocument *This = DOCVIEW_THIS(iface);
685 FIXME("(%p)->(%p %p)\n", This, pIPSiteNew, ppViewNew);
686 return E_NOTIMPL;
689 #undef DOCVIEW_THIS
691 static const IOleDocumentViewVtbl OleDocumentViewVtbl = {
692 OleDocumentView_QueryInterface,
693 OleDocumentView_AddRef,
694 OleDocumentView_Release,
695 OleDocumentView_SetInPlaceSite,
696 OleDocumentView_GetInPlaceSite,
697 OleDocumentView_GetDocument,
698 OleDocumentView_SetRect,
699 OleDocumentView_GetRect,
700 OleDocumentView_SetRectComplex,
701 OleDocumentView_Show,
702 OleDocumentView_UIActivate,
703 OleDocumentView_Open,
704 OleDocumentView_CloseView,
705 OleDocumentView_SaveViewState,
706 OleDocumentView_ApplyViewState,
707 OleDocumentView_Clone
710 /**********************************************************
711 * IViewObject implementation
714 #define VIEWOBJ_THIS(iface) DEFINE_THIS(HTMLDocument, ViewObject2, iface)
716 static HRESULT WINAPI ViewObject_QueryInterface(IViewObject2 *iface, REFIID riid, void **ppvObject)
718 HTMLDocument *This = VIEWOBJ_THIS(iface);
719 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
722 static ULONG WINAPI ViewObject_AddRef(IViewObject2 *iface)
724 HTMLDocument *This = VIEWOBJ_THIS(iface);
725 return IHTMLDocument2_AddRef(HTMLDOC(This));
728 static ULONG WINAPI ViewObject_Release(IViewObject2 *iface)
730 HTMLDocument *This = VIEWOBJ_THIS(iface);
731 return IHTMLDocument2_Release(HTMLDOC(This));
734 static HRESULT WINAPI ViewObject_Draw(IViewObject2 *iface, DWORD dwDrawAspect, LONG lindex, void *pvAspect,
735 DVTARGETDEVICE *ptd, HDC hdcTargetDev, HDC hdcDraw, LPCRECTL lprcBounds,
736 LPCRECTL lprcWBounds, BOOL (CALLBACK *pfnContinue)(ULONG_PTR dwContinue), ULONG_PTR dwContinue)
738 HTMLDocument *This = VIEWOBJ_THIS(iface);
739 FIXME("(%p)->(%d %d %p %p %p %p %p %p %p %ld)\n", This, dwDrawAspect, lindex, pvAspect,
740 ptd, hdcTargetDev, hdcDraw, lprcBounds, lprcWBounds, pfnContinue, dwContinue);
741 return E_NOTIMPL;
744 static HRESULT WINAPI ViewObject_GetColorSet(IViewObject2 *iface, DWORD dwDrawAspect, LONG lindex, void *pvAspect,
745 DVTARGETDEVICE *ptd, HDC hicTargetDev, LOGPALETTE **ppColorSet)
747 HTMLDocument *This = VIEWOBJ_THIS(iface);
748 FIXME("(%p)->(%d %d %p %p %p %p)\n", This, dwDrawAspect, lindex, pvAspect, ptd, hicTargetDev, ppColorSet);
749 return E_NOTIMPL;
752 static HRESULT WINAPI ViewObject_Freeze(IViewObject2 *iface, DWORD dwDrawAspect, LONG lindex,
753 void *pvAspect, DWORD *pdwFreeze)
755 HTMLDocument *This = VIEWOBJ_THIS(iface);
756 FIXME("(%p)->(%d %d %p %p)\n", This, dwDrawAspect, lindex, pvAspect, pdwFreeze);
757 return E_NOTIMPL;
760 static HRESULT WINAPI ViewObject_Unfreeze(IViewObject2 *iface, DWORD dwFreeze)
762 HTMLDocument *This = VIEWOBJ_THIS(iface);
763 FIXME("(%p)->(%d)\n", This, dwFreeze);
764 return E_NOTIMPL;
767 static HRESULT WINAPI ViewObject_SetAdvise(IViewObject2 *iface, DWORD aspects, DWORD advf, IAdviseSink *pAdvSink)
769 HTMLDocument *This = VIEWOBJ_THIS(iface);
770 FIXME("(%p)->(%d %d %p)\n", This, aspects, advf, pAdvSink);
771 return E_NOTIMPL;
774 static HRESULT WINAPI ViewObject_GetAdvise(IViewObject2 *iface, DWORD *pAspects, DWORD *pAdvf, IAdviseSink **ppAdvSink)
776 HTMLDocument *This = VIEWOBJ_THIS(iface);
777 FIXME("(%p)->(%p %p %p)\n", This, pAspects, pAdvf, ppAdvSink);
778 return E_NOTIMPL;
781 static HRESULT WINAPI ViewObject_GetExtent(IViewObject2 *iface, DWORD dwDrawAspect, LONG lindex,
782 DVTARGETDEVICE* ptd, LPSIZEL lpsizel)
784 HTMLDocument *This = VIEWOBJ_THIS(iface);
785 FIXME("(%p)->(%d %d %p %p)\n", This, dwDrawAspect, lindex, ptd, lpsizel);
786 return E_NOTIMPL;
789 #undef VIEWOBJ_THIS
791 static const IViewObject2Vtbl ViewObjectVtbl = {
792 ViewObject_QueryInterface,
793 ViewObject_AddRef,
794 ViewObject_Release,
795 ViewObject_Draw,
796 ViewObject_GetColorSet,
797 ViewObject_Freeze,
798 ViewObject_Unfreeze,
799 ViewObject_SetAdvise,
800 ViewObject_GetAdvise,
801 ViewObject_GetExtent
804 void HTMLDocument_View_Init(HTMLDocument *This)
806 This->lpOleDocumentViewVtbl = &OleDocumentViewVtbl;
807 This->lpViewObject2Vtbl = &ViewObjectVtbl;
809 This->ipsite = NULL;
810 This->frame = NULL;
811 This->ip_window = NULL;
812 This->hwnd = NULL;
813 This->tooltips_hwnd = NULL;
815 This->in_place_active = FALSE;
816 This->ui_active = FALSE;
817 This->window_active = FALSE;
818 This->focus = FALSE;
820 This->update = 0;