wined3d: Fix CopyRects if pDestPointsArray is NULL.
[wine] / dlls / mshtml / view.c
1 /*
2  * Copyright 2005-2006 Jacek Caban for CodeWeavers
3  *
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.
8  *
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.
13  *
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
17  */
18
19 #include "config.h"
20
21 #include <stdarg.h>
22 #include <stdio.h>
23
24 #define COBJMACROS
25
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "wingdi.h"
30 #include "commctrl.h"
31 #include "ole2.h"
32 #include "resource.h"
33
34 #include "wine/debug.h"
35
36 #include "mshtml_private.h"
37
38 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
39
40 static const WCHAR wszInternetExplorer_Server[] =
41     {'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r','_','S','e','r','v','e','r',0};
42
43 static const WCHAR wszTooltipData[] = {'t','o','o','l','t','i','p','_','d','a','t','a',0};
44
45 static ATOM serverwnd_class = 0;
46
47 typedef struct {
48     HTMLDocument *doc;
49     WNDPROC proc;
50 } tooltip_data;
51
52 static void paint_disabled(HWND hwnd) {
53     HDC hdc;
54     PAINTSTRUCT ps;
55     HBRUSH brush;
56     RECT rect;
57     HFONT font;
58     WCHAR wszHTMLDisabled[100];
59
60     LoadStringW(hInst, IDS_HTMLDISABLED, wszHTMLDisabled, sizeof(wszHTMLDisabled)/sizeof(WCHAR));
61
62     font = CreateFontA(25,0,0,0,400,0,0,0,ANSI_CHARSET,0,0,DEFAULT_QUALITY,DEFAULT_PITCH,NULL);
63     brush = CreateSolidBrush(RGB(255,255,255));
64     GetClientRect(hwnd, &rect);
65
66     hdc = BeginPaint(hwnd, &ps);
67     SelectObject(hdc, font);
68     SelectObject(hdc, brush);
69     Rectangle(hdc, rect.left, rect.top, rect.right, rect.bottom);
70     DrawTextW(hdc, wszHTMLDisabled,-1, &rect, DT_CENTER | DT_SINGLELINE | DT_VCENTER);
71     EndPaint(hwnd, &ps);
72
73     DeleteObject(font);
74     DeleteObject(brush);
75 }
76
77 static void activate_gecko(HTMLDocument *This)
78 {
79     TRACE("(%p) %p\n", This, This->nscontainer->window);
80
81     SetParent(This->nscontainer->hwnd, This->hwnd);
82     ShowWindow(This->nscontainer->hwnd, SW_SHOW);
83
84     nsIBaseWindow_SetVisibility(This->nscontainer->window, TRUE);
85     nsIBaseWindow_SetEnabled(This->nscontainer->window, TRUE);
86     nsIWebBrowserFocus_Activate(This->nscontainer->focus);
87 }
88
89 static LRESULT WINAPI serverwnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
90 {
91     HTMLDocument *This;
92
93     static const WCHAR wszTHIS[] = {'T','H','I','S',0};
94
95     if(msg == WM_CREATE) {
96         This = *(HTMLDocument**)lParam;
97         SetPropW(hwnd, wszTHIS, This);
98     }else {
99         This = (HTMLDocument*)GetPropW(hwnd, wszTHIS);
100     }
101
102     switch(msg) {
103     case WM_CREATE:
104         This->hwnd = hwnd;
105         if(This->nscontainer)
106             activate_gecko(This);
107         break;
108     case WM_PAINT:
109         if(!This->nscontainer)
110             paint_disabled(hwnd);
111         break;
112     case WM_SIZE:
113         TRACE("(%p)->(WM_SIZE)\n", This);
114         if(This->nscontainer)
115             SetWindowPos(This->nscontainer->hwnd, NULL, 0, 0, LOWORD(lParam), HIWORD(lParam),
116                     SWP_NOZORDER | SWP_NOACTIVATE);
117     }
118         
119     return DefWindowProcW(hwnd, msg, wParam, lParam);
120 }
121
122 static void register_serverwnd_class(void)
123 {
124     static WNDCLASSEXW wndclass = {
125         sizeof(WNDCLASSEXW),
126         CS_DBLCLKS,
127         serverwnd_proc,
128         0, 0, NULL, NULL, NULL, NULL, NULL,
129         wszInternetExplorer_Server,
130         NULL,
131     };
132     wndclass.hInstance = hInst;
133     serverwnd_class = RegisterClassExW(&wndclass);
134 }
135
136 static HRESULT activate_window(HTMLDocument *This)
137 {
138     IOleInPlaceUIWindow *pIPWnd;
139     IOleInPlaceFrame *pIPFrame;
140     IOleCommandTarget *cmdtrg;
141     RECT posrect, cliprect;
142     OLEINPLACEFRAMEINFO frameinfo;
143     HWND parent_hwnd;
144     HRESULT hres;
145
146     if(!serverwnd_class)
147         register_serverwnd_class();
148
149     hres = IOleInPlaceSite_CanInPlaceActivate(This->ipsite);
150     if(hres != S_OK) {
151         WARN("CanInPlaceActivate returned: %08lx\n", hres);
152         return FAILED(hres) ? hres : E_FAIL;
153     }
154
155     hres = IOleInPlaceSite_GetWindowContext(This->ipsite, &pIPFrame, &pIPWnd, &posrect, &cliprect, &frameinfo);
156     if(FAILED(hres)) {
157         WARN("GetWindowContext failed: %08lx\n", hres);
158         return hres;
159     }
160
161     if(pIPWnd)
162         IOleInPlaceUIWindow_Release(pIPWnd);
163     TRACE("got window context: %p %p {%ld %ld %ld %ld} {%ld %ld %ld %ld} {%d %x %p %p %d}\n",
164             pIPFrame, pIPWnd, posrect.left, posrect.top, posrect.right, posrect.bottom,
165             cliprect.left, cliprect.top, cliprect.right, cliprect.bottom,
166             frameinfo.cb, frameinfo.fMDIApp, frameinfo.hwndFrame, frameinfo.haccel, frameinfo.cAccelEntries);
167
168     hres = IOleInPlaceSite_GetWindow(This->ipsite, &parent_hwnd);
169     if(FAILED(hres)) {
170         WARN("GetWindow failed: %08lx\n", hres);
171         return hres;
172     }
173
174     TRACE("got parent window %p\n", parent_hwnd);
175
176     if(This->hwnd) {
177         if(GetParent(This->hwnd) != parent_hwnd)
178             SetParent(This->hwnd, parent_hwnd);
179         SetWindowPos(This->hwnd, HWND_TOP,
180                 posrect.left, posrect.top, posrect.right-posrect.left, posrect.bottom-posrect.top,
181                 SWP_NOACTIVATE | SWP_SHOWWINDOW);
182     }else {
183         CreateWindowExW(0, wszInternetExplorer_Server, NULL,
184                 WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
185                 posrect.left, posrect.top, posrect.right-posrect.left, posrect.bottom-posrect.top,
186                 parent_hwnd, NULL, hInst, This);
187
188         TRACE("Created window %p\n", This->hwnd);
189
190         SetWindowPos(This->hwnd, NULL, 0, 0, 0, 0,
191                 SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_SHOWWINDOW);
192         RedrawWindow(This->hwnd, NULL, NULL, RDW_INVALIDATE | RDW_NOERASE | RDW_ALLCHILDREN);
193         SetFocus(This->hwnd);
194
195         /* NOTE:
196          * Windows implementation calls:
197          * RegisterWindowMessage("MSWHEEL_ROLLMSG");
198          * SetTimer(This->hwnd, TIMER_ID, 100, NULL);
199          */
200     }
201
202     This->in_place_active = TRUE;
203     hres = IOleInPlaceSite_OnInPlaceActivate(This->ipsite);
204     if(FAILED(hres)) {
205         WARN("OnInPlaceActivate failed: %08lx\n", hres);
206         This->in_place_active = FALSE;
207         return hres;
208     }
209
210     hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget, (void**)&cmdtrg);
211     if(SUCCEEDED(hres)) {
212         VARIANT var;
213
214         IOleInPlaceFrame_SetStatusText(pIPFrame, NULL);
215
216         V_VT(&var) = VT_I4;
217         V_I4(&var) = 0;
218         IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_SETPROGRESSMAX, 0, &var, NULL);
219         IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_SETPROGRESSPOS, 0, &var, NULL);
220
221         IOleCommandTarget_Release(cmdtrg);
222     }
223
224     if(This->frame)
225         IOleInPlaceFrame_Release(This->frame);
226     This->frame = pIPFrame;
227
228     This->window_active = TRUE;
229
230     return S_OK;
231 }
232
233 static LRESULT tooltips_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
234 {
235     tooltip_data *data = GetPropW(hwnd, wszTooltipData);
236
237     TRACE("%d %p\n", msg, data);
238
239     if(msg == TTM_WINDOWFROMPOINT) {
240         RECT rect;
241         POINT *pt = (POINT*)lParam;
242
243         TRACE("TTM_WINDOWFROMPOINT (%ld,%ld)\n", pt->x, pt->y);
244
245         GetWindowRect(data->doc->hwnd, &rect);
246
247         if(rect.left <= pt->x && pt->x <= rect.right
248            && rect.top <= pt->y && pt->y <= rect.bottom)
249             return (LPARAM)data->doc->hwnd;
250     }
251
252     return CallWindowProcW(data->proc, hwnd, msg, wParam, lParam);
253 }
254
255 static void create_tooltips_window(HTMLDocument *This)
256 {
257     tooltip_data *data = mshtml_alloc(sizeof(*data));
258
259     This->tooltips_hwnd = CreateWindowExW(0, TOOLTIPS_CLASSW, NULL, TTS_NOPREFIX | WS_POPUP,
260             CW_USEDEFAULT, CW_USEDEFAULT, 10, 10, This->hwnd, NULL, hInst, NULL);
261
262     data->doc = This;
263     data->proc = (WNDPROC)GetWindowLongPtrW(This->tooltips_hwnd, GWLP_WNDPROC);
264
265     SetPropW(This->tooltips_hwnd, wszTooltipData, data);
266
267     SetWindowLongPtrW(This->tooltips_hwnd, GWLP_WNDPROC, (LONG_PTR)tooltips_proc);
268
269     SetWindowPos(This->tooltips_hwnd, HWND_TOPMOST,0, 0, 0, 0,
270                  SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
271
272 }
273
274 void show_tooltip(HTMLDocument *This, DWORD x, DWORD y, LPCWSTR text)
275 {
276     TTTOOLINFOW toolinfo = {
277         sizeof(TTTOOLINFOW), 0, This->hwnd, 0xdeadbeef,
278         {x>2 ? x-2 : 0, y>0 ? y-2 : 0, x+2, y+2}, /* FIXME */
279         NULL, (LPWSTR)text, 0};
280     MSG msg = {This->hwnd, WM_MOUSEMOVE, 0, MAKELPARAM(x,y), 0, {x,y}};
281
282     TRACE("(%p)->(%ld %ld %s)\n", This, x, y, debugstr_w(text));
283
284     if(!This->tooltips_hwnd)
285         create_tooltips_window(This);
286
287     SendMessageW(This->tooltips_hwnd, TTM_ADDTOOLW, 0, (LPARAM)&toolinfo);
288     SendMessageW(This->tooltips_hwnd, TTM_ACTIVATE, TRUE, 0);
289     SendMessageW(This->tooltips_hwnd, TTM_RELAYEVENT, 0, (LPARAM)&msg);
290 }
291
292 void hide_tooltip(HTMLDocument *This)
293 {
294     TTTOOLINFOW toolinfo = {
295         sizeof(TTTOOLINFOW), 0, This->hwnd, 0xdeadbeef,
296         {0,0,0,0}, NULL, NULL, 0};
297
298     TRACE("(%p)\n", This);
299
300     SendMessageW(This->tooltips_hwnd, TTM_DELTOOLW, 0, (LPARAM)&toolinfo);
301     SendMessageW(This->tooltips_hwnd, TTM_ACTIVATE, FALSE, 0);
302 }
303
304 /**********************************************************
305  * IOleDocumentView implementation
306  */
307
308 #define DOCVIEW_THIS(iface) DEFINE_THIS(HTMLDocument, OleDocumentView, iface)
309
310 static HRESULT WINAPI OleDocumentView_QueryInterface(IOleDocumentView *iface, REFIID riid, void **ppvObject)
311 {
312     HTMLDocument *This = DOCVIEW_THIS(iface);
313     return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
314 }
315
316 static ULONG WINAPI OleDocumentView_AddRef(IOleDocumentView *iface)
317 {
318     HTMLDocument *This = DOCVIEW_THIS(iface);
319     return IHTMLDocument2_AddRef(HTMLDOC(This));
320 }
321
322 static ULONG WINAPI OleDocumentView_Release(IOleDocumentView *iface)
323 {
324     HTMLDocument *This = DOCVIEW_THIS(iface);
325     return IHTMLDocument2_Release(HTMLDOC(This));
326 }
327
328 static HRESULT WINAPI OleDocumentView_SetInPlaceSite(IOleDocumentView *iface, IOleInPlaceSite *pIPSite)
329 {
330     HTMLDocument *This = DOCVIEW_THIS(iface);
331     TRACE("(%p)->(%p)\n", This, pIPSite);
332
333     if(pIPSite)
334         IOleInPlaceSite_AddRef(pIPSite);
335
336     if(This->ipsite)
337         IOleInPlaceSite_Release(This->ipsite);
338
339     This->ipsite = pIPSite;
340     return S_OK;
341 }
342
343 static HRESULT WINAPI OleDocumentView_GetInPlaceSite(IOleDocumentView *iface, IOleInPlaceSite **ppIPSite)
344 {
345     HTMLDocument *This = DOCVIEW_THIS(iface);
346     TRACE("(%p)->(%p)\n", This, ppIPSite);
347
348     if(!ppIPSite)
349         return E_INVALIDARG;
350
351     if(This->ipsite)
352         IOleInPlaceSite_AddRef(This->ipsite);
353
354     *ppIPSite = This->ipsite;
355     return S_OK;
356 }
357
358 static HRESULT WINAPI OleDocumentView_GetDocument(IOleDocumentView *iface, IUnknown **ppunk)
359 {
360     HTMLDocument *This = DOCVIEW_THIS(iface);
361     TRACE("(%p)->(%p)\n", This, ppunk);
362
363     if(!ppunk)
364         return E_INVALIDARG;
365
366     IHTMLDocument2_AddRef(HTMLDOC(This));
367     *ppunk = (IUnknown*)HTMLDOC(This);
368     return S_OK;
369 }
370
371 static HRESULT WINAPI OleDocumentView_SetRect(IOleDocumentView *iface, LPRECT prcView)
372 {
373     HTMLDocument *This = DOCVIEW_THIS(iface);
374     RECT rect;
375
376     TRACE("(%p)->(%p)\n", This, prcView);
377
378     if(!prcView)
379         return E_INVALIDARG;
380
381     if(This->hwnd) {
382         GetClientRect(This->hwnd, &rect);
383         if(memcmp(prcView, &rect, sizeof(RECT))) {
384             InvalidateRect(This->hwnd,NULL,TRUE);
385             SetWindowPos(This->hwnd, NULL, prcView->left, prcView->top, prcView->right,
386                     prcView->bottom, SWP_NOZORDER | SWP_NOACTIVATE);
387         }
388     }
389     
390     return S_OK;
391 }
392
393 static HRESULT WINAPI OleDocumentView_GetRect(IOleDocumentView *iface, LPRECT prcView)
394 {
395     HTMLDocument *This = DOCVIEW_THIS(iface);
396
397     TRACE("(%p)->(%p)\n", This, prcView);
398
399     if(!prcView)
400         return E_INVALIDARG;
401
402     GetClientRect(This->hwnd, prcView);
403     return S_OK;
404 }
405
406 static HRESULT WINAPI OleDocumentView_SetRectComplex(IOleDocumentView *iface, LPRECT prcView,
407                         LPRECT prcHScroll, LPRECT prcVScroll, LPRECT prcSizeBox)
408 {
409     HTMLDocument *This = DOCVIEW_THIS(iface);
410     FIXME("(%p)->(%p %p %p %p)\n", This, prcView, prcHScroll, prcVScroll, prcSizeBox);
411     return E_NOTIMPL;
412 }
413
414 static HRESULT WINAPI OleDocumentView_Show(IOleDocumentView *iface, BOOL fShow)
415 {
416     HTMLDocument *This = DOCVIEW_THIS(iface);
417     HRESULT hres;
418
419     TRACE("(%p)->(%x)\n", This, fShow);
420
421     if(fShow) {
422         if(!This->ui_active) {
423             hres = activate_window(This);
424             if(FAILED(hres))
425                 return hres;
426         }
427         ShowWindow(This->hwnd, SW_SHOW);
428     }else {
429         ShowWindow(This->hwnd, SW_HIDE);
430     }
431
432     return S_OK;
433 }
434
435 static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL fUIActivate)
436 {
437     HTMLDocument *This = DOCVIEW_THIS(iface);
438     HRESULT hres;
439
440     TRACE("(%p)->(%x)\n", This, fUIActivate);
441
442     if(!This->ipsite) {
443         FIXME("This->ipsite = NULL\n");
444         return E_FAIL;
445     }
446
447     if(fUIActivate) {
448         if(This->ui_active)
449             return S_OK;
450
451         if(!This->window_active) {
452             hres = activate_window(This);
453             if(FAILED(hres))
454                 return hres;
455         }
456
457         hres = IOleInPlaceSite_OnUIActivate(This->ipsite);
458         if(SUCCEEDED(hres)) {
459             OLECHAR wszHTMLDocument[30];
460             LoadStringW(hInst, IDS_HTMLDOCUMENT, wszHTMLDocument,
461                     sizeof(wszHTMLDocument)/sizeof(WCHAR));
462             IOleInPlaceFrame_SetActiveObject(This->frame, ACTOBJ(This), wszHTMLDocument);
463         }else {
464             FIXME("OnUIActivate failed: %08lx\n", hres);
465             IOleInPlaceFrame_Release(This->frame);
466             This->frame = NULL;
467             This->ui_active = FALSE;
468             return hres;
469         }
470
471         hres = IDocHostUIHandler_ShowUI(This->hostui, 0, ACTOBJ(This), CMDTARGET(This),
472                 This->frame, NULL);
473         if(FAILED(hres))
474             IDocHostUIHandler_HideUI(This->hostui);
475
476         This->ui_active = TRUE;
477     }else {
478         This->window_active = FALSE;
479         if(This->ui_active) {
480             This->ui_active = FALSE;
481             if(This->frame)
482                 IOleInPlaceFrame_SetActiveObject(This->frame, NULL, NULL);
483             if(This->hostui)
484                 IDocHostUIHandler_HideUI(This->hostui);
485             if(This->ipsite)
486                 IOleInPlaceSite_OnUIDeactivate(This->ipsite, FALSE);
487         }
488     }
489     return S_OK;
490 }
491
492 static HRESULT WINAPI OleDocumentView_Open(IOleDocumentView *iface)
493 {
494     HTMLDocument *This = DOCVIEW_THIS(iface);
495     FIXME("(%p)\n", This);
496     return E_NOTIMPL;
497 }
498
499 static HRESULT WINAPI OleDocumentView_CloseView(IOleDocumentView *iface, DWORD dwReserved)
500 {
501     HTMLDocument *This = DOCVIEW_THIS(iface);
502     TRACE("(%p)->(%lx)\n", This, dwReserved);
503
504     if(dwReserved)
505         WARN("dwReserved = %ld\n", dwReserved);
506
507     /* NOTE:
508      * Windows implementation calls QueryInterface(IID_IOleCommandTarget),
509      * QueryInterface(IID_IOleControlSite) and KillTimer
510      */
511
512     IOleDocumentView_Show(iface, FALSE);
513
514     return S_OK;
515 }
516
517 static HRESULT WINAPI OleDocumentView_SaveViewState(IOleDocumentView *iface, LPSTREAM pstm)
518 {
519     HTMLDocument *This = DOCVIEW_THIS(iface);
520     FIXME("(%p)->(%p)\n", This, pstm);
521     return E_NOTIMPL;
522 }
523
524 static HRESULT WINAPI OleDocumentView_ApplyViewState(IOleDocumentView *iface, LPSTREAM pstm)
525 {
526     HTMLDocument *This = DOCVIEW_THIS(iface);
527     FIXME("(%p)->(%p)\n", This, pstm);
528     return E_NOTIMPL;
529 }
530
531 static HRESULT WINAPI OleDocumentView_Clone(IOleDocumentView *iface, IOleInPlaceSite *pIPSiteNew,
532                                         IOleDocumentView **ppViewNew)
533 {
534     HTMLDocument *This = DOCVIEW_THIS(iface);
535     FIXME("(%p)->(%p %p)\n", This, pIPSiteNew, ppViewNew);
536     return E_NOTIMPL;
537 }
538
539 #undef DOCVIEW_THIS
540
541 static const IOleDocumentViewVtbl OleDocumentViewVtbl = {
542     OleDocumentView_QueryInterface,
543     OleDocumentView_AddRef,
544     OleDocumentView_Release,
545     OleDocumentView_SetInPlaceSite,
546     OleDocumentView_GetInPlaceSite,
547     OleDocumentView_GetDocument,
548     OleDocumentView_SetRect,
549     OleDocumentView_GetRect,
550     OleDocumentView_SetRectComplex,
551     OleDocumentView_Show,
552     OleDocumentView_UIActivate,
553     OleDocumentView_Open,
554     OleDocumentView_CloseView,
555     OleDocumentView_SaveViewState,
556     OleDocumentView_ApplyViewState,
557     OleDocumentView_Clone
558 };
559
560 /**********************************************************
561  * IViewObject implementation
562  */
563
564 #define VIEWOBJ_THIS(iface) DEFINE_THIS(HTMLDocument, ViewObject2, iface)
565
566 static HRESULT WINAPI ViewObject_QueryInterface(IViewObject2 *iface, REFIID riid, void **ppvObject)
567 {
568     HTMLDocument *This = VIEWOBJ_THIS(iface);
569     return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
570 }
571
572 static ULONG WINAPI ViewObject_AddRef(IViewObject2 *iface)
573 {
574     HTMLDocument *This = VIEWOBJ_THIS(iface);
575     return IHTMLDocument2_AddRef(HTMLDOC(This));
576 }
577
578 static ULONG WINAPI ViewObject_Release(IViewObject2 *iface)
579 {
580     HTMLDocument *This = VIEWOBJ_THIS(iface);
581     return IHTMLDocument2_Release(HTMLDOC(This));
582 }
583
584 static HRESULT WINAPI ViewObject_Draw(IViewObject2 *iface, DWORD dwDrawAspect, LONG lindex, void *pvAspect,
585         DVTARGETDEVICE *ptd, HDC hdcTargetDev, HDC hdcDraw, LPCRECTL lprcBounds,
586         LPCRECTL lprcWBounds, BOOL (CALLBACK *pfnContinue)(ULONG_PTR dwContinue), ULONG_PTR dwContinue)
587 {
588     HTMLDocument *This = VIEWOBJ_THIS(iface);
589     FIXME("(%p)->(%ld %ld %p %p %p %p %p %p %p %ld)\n", This, dwDrawAspect, lindex, pvAspect,
590             ptd, hdcTargetDev, hdcDraw, lprcBounds, lprcWBounds, pfnContinue, dwContinue);
591     return E_NOTIMPL;
592 }
593
594 static HRESULT WINAPI ViewObject_GetColorSet(IViewObject2 *iface, DWORD dwDrawAspect, LONG lindex, void *pvAspect,
595         DVTARGETDEVICE *ptd, HDC hicTargetDev, LOGPALETTE **ppColorSet)
596 {
597     HTMLDocument *This = VIEWOBJ_THIS(iface);
598     FIXME("(%p)->(%ld %ld %p %p %p %p)\n", This, dwDrawAspect, lindex, pvAspect, ptd, hicTargetDev, ppColorSet);
599     return E_NOTIMPL;
600 }
601
602 static HRESULT WINAPI ViewObject_Freeze(IViewObject2 *iface, DWORD dwDrawAspect, LONG lindex,
603         void *pvAspect, DWORD *pdwFreeze)
604 {
605     HTMLDocument *This = VIEWOBJ_THIS(iface);
606     FIXME("(%p)->(%ld %ld %p %p)\n", This, dwDrawAspect, lindex, pvAspect, pdwFreeze);
607     return E_NOTIMPL;
608 }
609
610 static HRESULT WINAPI ViewObject_Unfreeze(IViewObject2 *iface, DWORD dwFreeze)
611 {
612     HTMLDocument *This = VIEWOBJ_THIS(iface);
613     FIXME("(%p)->(%ld)\n", This, dwFreeze);
614     return E_NOTIMPL;
615 }
616
617 static HRESULT WINAPI ViewObject_SetAdvise(IViewObject2 *iface, DWORD aspects, DWORD advf, IAdviseSink *pAdvSink)
618 {
619     HTMLDocument *This = VIEWOBJ_THIS(iface);
620     FIXME("(%p)->(%ld %ld %p)\n", This, aspects, advf, pAdvSink);
621     return E_NOTIMPL;
622 }
623
624 static HRESULT WINAPI ViewObject_GetAdvise(IViewObject2 *iface, DWORD *pAspects, DWORD *pAdvf, IAdviseSink **ppAdvSink)
625 {
626     HTMLDocument *This = VIEWOBJ_THIS(iface);
627     FIXME("(%p)->(%p %p %p)\n", This, pAspects, pAdvf, ppAdvSink);
628     return E_NOTIMPL;
629 }
630
631 static HRESULT WINAPI ViewObject_GetExtent(IViewObject2 *iface, DWORD dwDrawAspect, LONG lindex,
632                                 DVTARGETDEVICE* ptd, LPSIZEL lpsizel)
633 {
634     HTMLDocument *This = VIEWOBJ_THIS(iface);
635     FIXME("(%p)->(%ld %ld %p %p)\n", This, dwDrawAspect, lindex, ptd, lpsizel);
636     return E_NOTIMPL;
637 }
638
639 #undef VIEWOBJ_THIS
640
641 static const IViewObject2Vtbl ViewObjectVtbl = {
642     ViewObject_QueryInterface,
643     ViewObject_AddRef,
644     ViewObject_Release,
645     ViewObject_Draw,
646     ViewObject_GetColorSet,
647     ViewObject_Freeze,
648     ViewObject_Unfreeze,
649     ViewObject_SetAdvise,
650     ViewObject_GetAdvise,
651     ViewObject_GetExtent
652 };
653
654 void HTMLDocument_View_Init(HTMLDocument *This)
655 {
656     This->lpOleDocumentViewVtbl = &OleDocumentViewVtbl;
657     This->lpViewObject2Vtbl = &ViewObjectVtbl;
658
659     This->ipsite = NULL;
660     This->frame = NULL;
661     This->hwnd = NULL;
662     This->tooltips_hwnd = NULL;
663
664     This->in_place_active = FALSE;
665     This->ui_active = FALSE;
666     This->window_active = FALSE;
667 }