msvcrt: Follow Vista behaviour in wcscpy_s.
[wine.git] / dlls / mshtml / view.c
blob4c0d0c525e93ee7d2740cefde235defef5075099
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 hres = IOleClientSite_QueryInterface(This->client, &IID_IOleControlSite, (void**)&site);
172 if(FAILED(hres))
173 return;
175 IOleControlSite_OnFocus(site, This->focus);
176 IOleControlSite_Release(site);
179 static LRESULT WINAPI serverwnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
181 HTMLDocument *This;
183 static const WCHAR wszTHIS[] = {'T','H','I','S',0};
185 if(msg == WM_CREATE) {
186 This = *(HTMLDocument**)lParam;
187 SetPropW(hwnd, wszTHIS, This);
188 }else {
189 This = (HTMLDocument*)GetPropW(hwnd, wszTHIS);
192 switch(msg) {
193 case WM_CREATE:
194 This->hwnd = hwnd;
195 break;
196 case WM_PAINT:
197 paint_document(This);
198 break;
199 case WM_SIZE:
200 TRACE("(%p)->(WM_SIZE)\n", This);
201 if(This->nscontainer) {
202 INT ew=0, eh=0;
204 if(!(This->hostinfo.dwFlags & (DOCHOSTUIFLAG_NO3DOUTERBORDER|DOCHOSTUIFLAG_NO3DBORDER))) {
205 ew = GetSystemMetrics(SM_CXEDGE);
206 eh = GetSystemMetrics(SM_CYEDGE);
209 SetWindowPos(This->nscontainer->hwnd, NULL, ew, eh,
210 LOWORD(lParam) - 2*ew, HIWORD(lParam) - 2*eh,
211 SWP_NOZORDER | SWP_NOACTIVATE);
213 break;
214 case WM_TIMER:
215 return on_timer(This);
216 case WM_MOUSEACTIVATE:
217 return MA_ACTIVATE;
220 return DefWindowProcW(hwnd, msg, wParam, lParam);
223 static void register_serverwnd_class(void)
225 static WNDCLASSEXW wndclass = {
226 sizeof(WNDCLASSEXW),
227 CS_DBLCLKS,
228 serverwnd_proc,
229 0, 0, NULL, NULL, NULL, NULL, NULL,
230 wszInternetExplorer_Server,
231 NULL,
233 wndclass.hInstance = hInst;
234 serverwnd_class = RegisterClassExW(&wndclass);
237 static HRESULT activate_window(HTMLDocument *This)
239 IOleInPlaceFrame *pIPFrame;
240 IOleCommandTarget *cmdtrg;
241 IOleInPlaceSiteEx *ipsiteex;
242 RECT posrect, cliprect;
243 OLEINPLACEFRAMEINFO frameinfo;
244 HWND parent_hwnd;
245 HRESULT hres;
247 if(!serverwnd_class)
248 register_serverwnd_class();
250 hres = IOleInPlaceSite_CanInPlaceActivate(This->ipsite);
251 if(hres != S_OK) {
252 WARN("CanInPlaceActivate returned: %08x\n", hres);
253 return FAILED(hres) ? hres : E_FAIL;
256 hres = IOleInPlaceSite_GetWindowContext(This->ipsite, &pIPFrame, &This->ip_window,
257 &posrect, &cliprect, &frameinfo);
258 if(FAILED(hres)) {
259 WARN("GetWindowContext failed: %08x\n", hres);
260 return hres;
263 TRACE("got window context: %p %p {%d %d %d %d} {%d %d %d %d} {%d %x %p %p %d}\n",
264 pIPFrame, This->ip_window, posrect.left, posrect.top, posrect.right, posrect.bottom,
265 cliprect.left, cliprect.top, cliprect.right, cliprect.bottom,
266 frameinfo.cb, frameinfo.fMDIApp, frameinfo.hwndFrame, frameinfo.haccel, frameinfo.cAccelEntries);
268 hres = IOleInPlaceSite_GetWindow(This->ipsite, &parent_hwnd);
269 if(FAILED(hres)) {
270 WARN("GetWindow failed: %08x\n", hres);
271 return hres;
274 TRACE("got parent window %p\n", parent_hwnd);
276 if(This->hwnd) {
277 if(GetParent(This->hwnd) != parent_hwnd)
278 SetParent(This->hwnd, parent_hwnd);
279 SetWindowPos(This->hwnd, HWND_TOP,
280 posrect.left, posrect.top, posrect.right-posrect.left, posrect.bottom-posrect.top,
281 SWP_NOACTIVATE | SWP_SHOWWINDOW);
282 }else {
283 CreateWindowExW(0, wszInternetExplorer_Server, NULL,
284 WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
285 posrect.left, posrect.top, posrect.right-posrect.left, posrect.bottom-posrect.top,
286 parent_hwnd, NULL, hInst, This);
288 TRACE("Created window %p\n", This->hwnd);
290 SetWindowPos(This->hwnd, NULL, 0, 0, 0, 0,
291 SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_SHOWWINDOW);
292 RedrawWindow(This->hwnd, NULL, NULL, RDW_INVALIDATE | RDW_NOERASE | RDW_ALLCHILDREN);
294 /* NOTE:
295 * Windows implementation calls:
296 * RegisterWindowMessage("MSWHEEL_ROLLMSG");
298 SetTimer(This->hwnd, TIMER_ID, 100, NULL);
301 if(This->nscontainer)
302 activate_gecko(This->nscontainer);
304 This->in_place_active = TRUE;
305 hres = IOleInPlaceSite_QueryInterface(This->ipsite, &IID_IOleInPlaceSiteEx, (void**)&ipsiteex);
306 if(SUCCEEDED(hres)) {
307 BOOL redraw = FALSE;
309 hres = IOleInPlaceSiteEx_OnInPlaceActivateEx(ipsiteex, &redraw, 0);
310 IOleInPlaceSiteEx_Release(ipsiteex);
311 if(redraw)
312 FIXME("unsupported redraw\n");
313 }else{
314 hres = IOleInPlaceSite_OnInPlaceActivate(This->ipsite);
316 if(FAILED(hres)) {
317 WARN("OnInPlaceActivate failed: %08x\n", hres);
318 This->in_place_active = FALSE;
319 return hres;
322 hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget, (void**)&cmdtrg);
323 if(SUCCEEDED(hres)) {
324 VARIANT var;
326 IOleInPlaceFrame_SetStatusText(pIPFrame, NULL);
328 V_VT(&var) = VT_I4;
329 V_I4(&var) = 0;
330 IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_SETPROGRESSMAX,
331 OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
332 IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_SETPROGRESSPOS,
333 OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
335 IOleCommandTarget_Release(cmdtrg);
338 if(This->frame)
339 IOleInPlaceFrame_Release(This->frame);
340 This->frame = pIPFrame;
342 This->window_active = TRUE;
344 return S_OK;
347 static LRESULT WINAPI tooltips_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
349 tooltip_data *data = GetPropW(hwnd, wszTooltipData);
351 TRACE("%d %p\n", msg, data);
353 if(msg == TTM_WINDOWFROMPOINT) {
354 RECT rect;
355 POINT *pt = (POINT*)lParam;
357 TRACE("TTM_WINDOWFROMPOINT (%d,%d)\n", pt->x, pt->y);
359 GetWindowRect(data->doc->hwnd, &rect);
361 if(rect.left <= pt->x && pt->x <= rect.right
362 && rect.top <= pt->y && pt->y <= rect.bottom)
363 return (LPARAM)data->doc->hwnd;
366 return CallWindowProcW(data->proc, hwnd, msg, wParam, lParam);
369 static void create_tooltips_window(HTMLDocument *This)
371 tooltip_data *data = heap_alloc(sizeof(*data));
373 This->tooltips_hwnd = CreateWindowExW(0, TOOLTIPS_CLASSW, NULL, TTS_NOPREFIX | WS_POPUP,
374 CW_USEDEFAULT, CW_USEDEFAULT, 10, 10, This->hwnd, NULL, hInst, NULL);
376 data->doc = This;
377 data->proc = (WNDPROC)GetWindowLongPtrW(This->tooltips_hwnd, GWLP_WNDPROC);
379 SetPropW(This->tooltips_hwnd, wszTooltipData, data);
381 SetWindowLongPtrW(This->tooltips_hwnd, GWLP_WNDPROC, (LONG_PTR)tooltips_proc);
383 SetWindowPos(This->tooltips_hwnd, HWND_TOPMOST,0, 0, 0, 0,
384 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
388 void show_tooltip(HTMLDocument *This, DWORD x, DWORD y, LPCWSTR text)
390 TTTOOLINFOW toolinfo = {
391 sizeof(TTTOOLINFOW), 0, This->hwnd, 0xdeadbeef,
392 {x>2 ? x-2 : 0, y>0 ? y-2 : 0, x+2, y+2}, /* FIXME */
393 NULL, (LPWSTR)text, 0};
394 MSG msg = {This->hwnd, WM_MOUSEMOVE, 0, MAKELPARAM(x,y), 0, {x,y}};
396 TRACE("(%p)->(%d %d %s)\n", This, x, y, debugstr_w(text));
398 if(!This->tooltips_hwnd)
399 create_tooltips_window(This);
401 SendMessageW(This->tooltips_hwnd, TTM_ADDTOOLW, 0, (LPARAM)&toolinfo);
402 SendMessageW(This->tooltips_hwnd, TTM_ACTIVATE, TRUE, 0);
403 SendMessageW(This->tooltips_hwnd, TTM_RELAYEVENT, 0, (LPARAM)&msg);
406 void hide_tooltip(HTMLDocument *This)
408 TTTOOLINFOW toolinfo = {
409 sizeof(TTTOOLINFOW), 0, This->hwnd, 0xdeadbeef,
410 {0,0,0,0}, NULL, NULL, 0};
412 TRACE("(%p)\n", This);
414 SendMessageW(This->tooltips_hwnd, TTM_DELTOOLW, 0, (LPARAM)&toolinfo);
415 SendMessageW(This->tooltips_hwnd, TTM_ACTIVATE, FALSE, 0);
418 HRESULT call_set_active_object(IOleInPlaceUIWindow *window, IOleInPlaceActiveObject *act_obj)
420 static WCHAR html_documentW[30];
422 if(act_obj && !html_documentW[0]) {
423 LoadStringW(hInst, IDS_HTMLDOCUMENT, html_documentW,
424 sizeof(html_documentW)/sizeof(WCHAR));
427 return IOleInPlaceFrame_SetActiveObject(window, act_obj, act_obj ? html_documentW : NULL);
430 /**********************************************************
431 * IOleDocumentView implementation
434 #define DOCVIEW_THIS(iface) DEFINE_THIS(HTMLDocument, OleDocumentView, iface)
436 static HRESULT WINAPI OleDocumentView_QueryInterface(IOleDocumentView *iface, REFIID riid, void **ppvObject)
438 HTMLDocument *This = DOCVIEW_THIS(iface);
439 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
442 static ULONG WINAPI OleDocumentView_AddRef(IOleDocumentView *iface)
444 HTMLDocument *This = DOCVIEW_THIS(iface);
445 return IHTMLDocument2_AddRef(HTMLDOC(This));
448 static ULONG WINAPI OleDocumentView_Release(IOleDocumentView *iface)
450 HTMLDocument *This = DOCVIEW_THIS(iface);
451 return IHTMLDocument2_Release(HTMLDOC(This));
454 static HRESULT WINAPI OleDocumentView_SetInPlaceSite(IOleDocumentView *iface, IOleInPlaceSite *pIPSite)
456 HTMLDocument *This = DOCVIEW_THIS(iface);
457 TRACE("(%p)->(%p)\n", This, pIPSite);
459 if(pIPSite)
460 IOleInPlaceSite_AddRef(pIPSite);
462 if(This->ipsite)
463 IOleInPlaceSite_Release(This->ipsite);
465 This->ipsite = pIPSite;
466 return S_OK;
469 static HRESULT WINAPI OleDocumentView_GetInPlaceSite(IOleDocumentView *iface, IOleInPlaceSite **ppIPSite)
471 HTMLDocument *This = DOCVIEW_THIS(iface);
472 TRACE("(%p)->(%p)\n", This, ppIPSite);
474 if(!ppIPSite)
475 return E_INVALIDARG;
477 if(This->ipsite)
478 IOleInPlaceSite_AddRef(This->ipsite);
480 *ppIPSite = This->ipsite;
481 return S_OK;
484 static HRESULT WINAPI OleDocumentView_GetDocument(IOleDocumentView *iface, IUnknown **ppunk)
486 HTMLDocument *This = DOCVIEW_THIS(iface);
487 TRACE("(%p)->(%p)\n", This, ppunk);
489 if(!ppunk)
490 return E_INVALIDARG;
492 IHTMLDocument2_AddRef(HTMLDOC(This));
493 *ppunk = (IUnknown*)HTMLDOC(This);
494 return S_OK;
497 static HRESULT WINAPI OleDocumentView_SetRect(IOleDocumentView *iface, LPRECT prcView)
499 HTMLDocument *This = DOCVIEW_THIS(iface);
500 RECT rect;
502 TRACE("(%p)->(%p)\n", This, prcView);
504 if(!prcView)
505 return E_INVALIDARG;
507 if(This->hwnd) {
508 GetClientRect(This->hwnd, &rect);
509 if(memcmp(prcView, &rect, sizeof(RECT))) {
510 InvalidateRect(This->hwnd,NULL,TRUE);
511 SetWindowPos(This->hwnd, NULL, prcView->left, prcView->top, prcView->right,
512 prcView->bottom, SWP_NOZORDER | SWP_NOACTIVATE);
516 return S_OK;
519 static HRESULT WINAPI OleDocumentView_GetRect(IOleDocumentView *iface, LPRECT prcView)
521 HTMLDocument *This = DOCVIEW_THIS(iface);
523 TRACE("(%p)->(%p)\n", This, prcView);
525 if(!prcView)
526 return E_INVALIDARG;
528 GetClientRect(This->hwnd, prcView);
529 return S_OK;
532 static HRESULT WINAPI OleDocumentView_SetRectComplex(IOleDocumentView *iface, LPRECT prcView,
533 LPRECT prcHScroll, LPRECT prcVScroll, LPRECT prcSizeBox)
535 HTMLDocument *This = DOCVIEW_THIS(iface);
536 FIXME("(%p)->(%p %p %p %p)\n", This, prcView, prcHScroll, prcVScroll, prcSizeBox);
537 return E_NOTIMPL;
540 static HRESULT WINAPI OleDocumentView_Show(IOleDocumentView *iface, BOOL fShow)
542 HTMLDocument *This = DOCVIEW_THIS(iface);
543 HRESULT hres;
545 TRACE("(%p)->(%x)\n", This, fShow);
547 if(fShow) {
548 if(!This->ui_active) {
549 hres = activate_window(This);
550 if(FAILED(hres))
551 return hres;
553 update_doc(This, UPDATE_UI);
554 ShowWindow(This->hwnd, SW_SHOW);
555 }else {
556 ShowWindow(This->hwnd, SW_HIDE);
557 if(This->ip_window) {
558 IOleInPlaceUIWindow_Release(This->ip_window);
559 This->ip_window = NULL;
563 return S_OK;
566 static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL fUIActivate)
568 HTMLDocument *This = DOCVIEW_THIS(iface);
569 HRESULT hres;
571 TRACE("(%p)->(%x)\n", This, fUIActivate);
573 if(!This->ipsite) {
574 FIXME("This->ipsite = NULL\n");
575 return E_FAIL;
578 if(fUIActivate) {
579 RECT rcBorderWidths;
581 if(This->ui_active)
582 return S_OK;
584 if(!This->window_active) {
585 hres = activate_window(This);
586 if(FAILED(hres))
587 return hres;
590 This->focus = TRUE;
591 if(This->nscontainer)
592 nsIWebBrowserFocus_Activate(This->nscontainer->focus);
593 notif_focus(This);
595 update_doc(This, UPDATE_UI);
597 hres = IOleInPlaceSite_OnUIActivate(This->ipsite);
598 if(SUCCEEDED(hres)) {
599 call_set_active_object((IOleInPlaceUIWindow*)This->frame, ACTOBJ(This));
600 }else {
601 FIXME("OnUIActivate failed: %08x\n", hres);
602 IOleInPlaceFrame_Release(This->frame);
603 This->frame = NULL;
604 This->ui_active = FALSE;
605 return hres;
608 hres = IDocHostUIHandler_ShowUI(This->hostui,
609 This->usermode == EDITMODE ? DOCHOSTUITYPE_AUTHOR : DOCHOSTUITYPE_BROWSE,
610 ACTOBJ(This), CMDTARGET(This), This->frame, This->ip_window);
611 if(FAILED(hres))
612 IDocHostUIHandler_HideUI(This->hostui);
614 if(This->ip_window)
615 call_set_active_object(This->ip_window, ACTOBJ(This));
617 memset(&rcBorderWidths, 0, sizeof(rcBorderWidths));
618 IOleInPlaceFrame_SetBorderSpace(This->frame, &rcBorderWidths);
620 This->ui_active = TRUE;
621 }else {
622 if(This->ui_active) {
623 This->ui_active = FALSE;
624 if(This->ip_window)
625 call_set_active_object(This->ip_window, NULL);
626 if(This->frame)
627 call_set_active_object((IOleInPlaceUIWindow*)This->frame, NULL);
628 if(This->hostui)
629 IDocHostUIHandler_HideUI(This->hostui);
630 if(This->ipsite)
631 IOleInPlaceSite_OnUIDeactivate(This->ipsite, FALSE);
634 return S_OK;
637 static HRESULT WINAPI OleDocumentView_Open(IOleDocumentView *iface)
639 HTMLDocument *This = DOCVIEW_THIS(iface);
640 FIXME("(%p)\n", This);
641 return E_NOTIMPL;
644 static HRESULT WINAPI OleDocumentView_CloseView(IOleDocumentView *iface, DWORD dwReserved)
646 HTMLDocument *This = DOCVIEW_THIS(iface);
647 TRACE("(%p)->(%x)\n", This, dwReserved);
649 if(dwReserved)
650 WARN("dwReserved = %d\n", dwReserved);
652 /* NOTE:
653 * Windows implementation calls QueryInterface(IID_IOleCommandTarget),
654 * QueryInterface(IID_IOleControlSite) and KillTimer
657 IOleDocumentView_Show(iface, FALSE);
659 return S_OK;
662 static HRESULT WINAPI OleDocumentView_SaveViewState(IOleDocumentView *iface, LPSTREAM pstm)
664 HTMLDocument *This = DOCVIEW_THIS(iface);
665 FIXME("(%p)->(%p)\n", This, pstm);
666 return E_NOTIMPL;
669 static HRESULT WINAPI OleDocumentView_ApplyViewState(IOleDocumentView *iface, LPSTREAM pstm)
671 HTMLDocument *This = DOCVIEW_THIS(iface);
672 FIXME("(%p)->(%p)\n", This, pstm);
673 return E_NOTIMPL;
676 static HRESULT WINAPI OleDocumentView_Clone(IOleDocumentView *iface, IOleInPlaceSite *pIPSiteNew,
677 IOleDocumentView **ppViewNew)
679 HTMLDocument *This = DOCVIEW_THIS(iface);
680 FIXME("(%p)->(%p %p)\n", This, pIPSiteNew, ppViewNew);
681 return E_NOTIMPL;
684 #undef DOCVIEW_THIS
686 static const IOleDocumentViewVtbl OleDocumentViewVtbl = {
687 OleDocumentView_QueryInterface,
688 OleDocumentView_AddRef,
689 OleDocumentView_Release,
690 OleDocumentView_SetInPlaceSite,
691 OleDocumentView_GetInPlaceSite,
692 OleDocumentView_GetDocument,
693 OleDocumentView_SetRect,
694 OleDocumentView_GetRect,
695 OleDocumentView_SetRectComplex,
696 OleDocumentView_Show,
697 OleDocumentView_UIActivate,
698 OleDocumentView_Open,
699 OleDocumentView_CloseView,
700 OleDocumentView_SaveViewState,
701 OleDocumentView_ApplyViewState,
702 OleDocumentView_Clone
705 /**********************************************************
706 * IViewObject implementation
709 #define VIEWOBJ_THIS(iface) DEFINE_THIS(HTMLDocument, ViewObject2, iface)
711 static HRESULT WINAPI ViewObject_QueryInterface(IViewObject2 *iface, REFIID riid, void **ppvObject)
713 HTMLDocument *This = VIEWOBJ_THIS(iface);
714 return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
717 static ULONG WINAPI ViewObject_AddRef(IViewObject2 *iface)
719 HTMLDocument *This = VIEWOBJ_THIS(iface);
720 return IHTMLDocument2_AddRef(HTMLDOC(This));
723 static ULONG WINAPI ViewObject_Release(IViewObject2 *iface)
725 HTMLDocument *This = VIEWOBJ_THIS(iface);
726 return IHTMLDocument2_Release(HTMLDOC(This));
729 static HRESULT WINAPI ViewObject_Draw(IViewObject2 *iface, DWORD dwDrawAspect, LONG lindex, void *pvAspect,
730 DVTARGETDEVICE *ptd, HDC hdcTargetDev, HDC hdcDraw, LPCRECTL lprcBounds,
731 LPCRECTL lprcWBounds, BOOL (CALLBACK *pfnContinue)(ULONG_PTR dwContinue), ULONG_PTR dwContinue)
733 HTMLDocument *This = VIEWOBJ_THIS(iface);
734 FIXME("(%p)->(%d %d %p %p %p %p %p %p %p %ld)\n", This, dwDrawAspect, lindex, pvAspect,
735 ptd, hdcTargetDev, hdcDraw, lprcBounds, lprcWBounds, pfnContinue, dwContinue);
736 return E_NOTIMPL;
739 static HRESULT WINAPI ViewObject_GetColorSet(IViewObject2 *iface, DWORD dwDrawAspect, LONG lindex, void *pvAspect,
740 DVTARGETDEVICE *ptd, HDC hicTargetDev, LOGPALETTE **ppColorSet)
742 HTMLDocument *This = VIEWOBJ_THIS(iface);
743 FIXME("(%p)->(%d %d %p %p %p %p)\n", This, dwDrawAspect, lindex, pvAspect, ptd, hicTargetDev, ppColorSet);
744 return E_NOTIMPL;
747 static HRESULT WINAPI ViewObject_Freeze(IViewObject2 *iface, DWORD dwDrawAspect, LONG lindex,
748 void *pvAspect, DWORD *pdwFreeze)
750 HTMLDocument *This = VIEWOBJ_THIS(iface);
751 FIXME("(%p)->(%d %d %p %p)\n", This, dwDrawAspect, lindex, pvAspect, pdwFreeze);
752 return E_NOTIMPL;
755 static HRESULT WINAPI ViewObject_Unfreeze(IViewObject2 *iface, DWORD dwFreeze)
757 HTMLDocument *This = VIEWOBJ_THIS(iface);
758 FIXME("(%p)->(%d)\n", This, dwFreeze);
759 return E_NOTIMPL;
762 static HRESULT WINAPI ViewObject_SetAdvise(IViewObject2 *iface, DWORD aspects, DWORD advf, IAdviseSink *pAdvSink)
764 HTMLDocument *This = VIEWOBJ_THIS(iface);
765 FIXME("(%p)->(%d %d %p)\n", This, aspects, advf, pAdvSink);
766 return E_NOTIMPL;
769 static HRESULT WINAPI ViewObject_GetAdvise(IViewObject2 *iface, DWORD *pAspects, DWORD *pAdvf, IAdviseSink **ppAdvSink)
771 HTMLDocument *This = VIEWOBJ_THIS(iface);
772 FIXME("(%p)->(%p %p %p)\n", This, pAspects, pAdvf, ppAdvSink);
773 return E_NOTIMPL;
776 static HRESULT WINAPI ViewObject_GetExtent(IViewObject2 *iface, DWORD dwDrawAspect, LONG lindex,
777 DVTARGETDEVICE* ptd, LPSIZEL lpsizel)
779 HTMLDocument *This = VIEWOBJ_THIS(iface);
780 FIXME("(%p)->(%d %d %p %p)\n", This, dwDrawAspect, lindex, ptd, lpsizel);
781 return E_NOTIMPL;
784 #undef VIEWOBJ_THIS
786 static const IViewObject2Vtbl ViewObjectVtbl = {
787 ViewObject_QueryInterface,
788 ViewObject_AddRef,
789 ViewObject_Release,
790 ViewObject_Draw,
791 ViewObject_GetColorSet,
792 ViewObject_Freeze,
793 ViewObject_Unfreeze,
794 ViewObject_SetAdvise,
795 ViewObject_GetAdvise,
796 ViewObject_GetExtent
799 void HTMLDocument_View_Init(HTMLDocument *This)
801 This->lpOleDocumentViewVtbl = &OleDocumentViewVtbl;
802 This->lpViewObject2Vtbl = &ViewObjectVtbl;
804 This->ipsite = NULL;
805 This->frame = NULL;
806 This->ip_window = NULL;
807 This->hwnd = NULL;
808 This->tooltips_hwnd = NULL;
810 This->in_place_active = FALSE;
811 This->ui_active = FALSE;
812 This->window_active = FALSE;
813 This->focus = FALSE;
815 This->update = 0;