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 "mshtml_private.h"
21 #define TIMER_ID 0x1000
23 static const WCHAR wszInternetExplorer_Server
[] =
24 {'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r','_','S','e','r','v','e','r',0};
26 static const WCHAR wszTooltipData
[] = {'t','o','o','l','t','i','p','_','d','a','t','a',0};
28 static ATOM serverwnd_class
= 0;
35 static void paint_document(HTMLDocumentObj
*This
)
41 GetClientRect(This
->hwnd
, &rect
);
43 hdc
= BeginPaint(This
->hwnd
, &ps
);
45 if(!(This
->hostinfo
.dwFlags
& (DOCHOSTUIFLAG_NO3DOUTERBORDER
|DOCHOSTUIFLAG_NO3DBORDER
)))
46 DrawEdge(hdc
, &rect
, EDGE_SUNKEN
, BF_RECT
|BF_ADJUST
);
48 EndPaint(This
->hwnd
, &ps
);
51 static void activate_gecko(NSContainer
*This
)
53 TRACE("(%p) %p\n", This
, This
->window
);
55 SetParent(This
->hwnd
, This
->doc
->hwnd
);
56 ShowWindow(This
->hwnd
, SW_SHOW
);
58 nsIBaseWindow_SetVisibility(This
->window
, TRUE
);
59 nsIBaseWindow_SetEnabled(This
->window
, TRUE
);
62 void update_doc(HTMLDocument
*This
, DWORD flags
)
64 if(!This
->doc_obj
->update
&& This
->doc_obj
->hwnd
)
65 SetTimer(This
->doc_obj
->hwnd
, TIMER_ID
, 100, NULL
);
67 This
->doc_obj
->update
|= flags
;
70 void update_title(HTMLDocumentObj
*This
)
72 IOleCommandTarget
*olecmd
;
75 if(!(This
->update
& UPDATE_TITLE
))
78 This
->update
&= ~UPDATE_TITLE
;
83 hres
= IOleClientSite_QueryInterface(This
->client
, &IID_IOleCommandTarget
, (void**)&olecmd
);
88 V_VT(&title
) = VT_BSTR
;
89 V_BSTR(&title
) = SysAllocString(empty
);
90 IOleCommandTarget_Exec(olecmd
, NULL
, OLECMDID_SETTITLE
, OLECMDEXECOPT_DONTPROMPTUSER
,
92 SysFreeString(V_BSTR(&title
));
94 IOleCommandTarget_Release(olecmd
);
98 static LRESULT
on_timer(HTMLDocumentObj
*This
)
100 TRACE("(%p) %x\n", This
, This
->update
);
102 KillTimer(This
->hwnd
, TIMER_ID
);
107 if(This
->update
& UPDATE_UI
) {
109 IDocHostUIHandler_UpdateUI(This
->hostui
);
112 IOleCommandTarget
*cmdtrg
;
115 hres
= IOleClientSite_QueryInterface(This
->client
, &IID_IOleCommandTarget
,
117 if(SUCCEEDED(hres
)) {
118 IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_UPDATECOMMANDS
,
119 OLECMDEXECOPT_DONTPROMPTUSER
, NULL
, NULL
);
120 IOleCommandTarget_Release(cmdtrg
);
130 void notif_focus(HTMLDocumentObj
*This
)
132 IOleControlSite
*site
;
138 hres
= IOleClientSite_QueryInterface(This
->client
, &IID_IOleControlSite
, (void**)&site
);
142 IOleControlSite_OnFocus(site
, This
->focus
);
143 IOleControlSite_Release(site
);
146 static LRESULT WINAPI
serverwnd_proc(HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
148 HTMLDocumentObj
*This
;
150 static const WCHAR wszTHIS
[] = {'T','H','I','S',0};
152 if(msg
== WM_CREATE
) {
153 This
= *(HTMLDocumentObj
**)lParam
;
154 SetPropW(hwnd
, wszTHIS
, This
);
156 This
= GetPropW(hwnd
, wszTHIS
);
164 paint_document(This
);
167 TRACE("(%p)->(WM_SIZE)\n", This
);
168 if(This
->nscontainer
) {
171 if(!(This
->hostinfo
.dwFlags
& (DOCHOSTUIFLAG_NO3DOUTERBORDER
|DOCHOSTUIFLAG_NO3DBORDER
))) {
172 ew
= GetSystemMetrics(SM_CXEDGE
);
173 eh
= GetSystemMetrics(SM_CYEDGE
);
176 SetWindowPos(This
->nscontainer
->hwnd
, NULL
, ew
, eh
,
177 LOWORD(lParam
) - 2*ew
, HIWORD(lParam
) - 2*eh
,
178 SWP_NOZORDER
| SWP_NOACTIVATE
);
182 return on_timer(This
);
184 TRACE("(%p) WM_SETFOCUS\n", This
);
185 nsIWebBrowserFocus_Activate(This
->nscontainer
->focus
);
187 case WM_MOUSEACTIVATE
:
191 return DefWindowProcW(hwnd
, msg
, wParam
, lParam
);
194 static void register_serverwnd_class(void)
196 static WNDCLASSEXW wndclass
= {
200 0, 0, NULL
, NULL
, NULL
, NULL
, NULL
,
201 wszInternetExplorer_Server
,
204 wndclass
.hInstance
= hInst
;
205 serverwnd_class
= RegisterClassExW(&wndclass
);
208 static HRESULT
activate_window(HTMLDocumentObj
*This
)
210 IOleInPlaceFrame
*pIPFrame
;
211 IOleCommandTarget
*cmdtrg
;
212 IOleInPlaceSiteEx
*ipsiteex
;
213 RECT posrect
, cliprect
;
214 OLEINPLACEFRAMEINFO frameinfo
;
219 register_serverwnd_class();
221 hres
= IOleInPlaceSite_CanInPlaceActivate(This
->ipsite
);
223 WARN("CanInPlaceActivate returned: %08x\n", hres
);
224 return FAILED(hres
) ? hres
: E_FAIL
;
227 frameinfo
.cb
= sizeof(OLEINPLACEFRAMEINFO
);
228 hres
= IOleInPlaceSite_GetWindowContext(This
->ipsite
, &pIPFrame
, &This
->ip_window
,
229 &posrect
, &cliprect
, &frameinfo
);
231 WARN("GetWindowContext failed: %08x\n", hres
);
235 TRACE("got window context: %p %p {%d %d %d %d} {%d %d %d %d} {%d %x %p %p %d}\n",
236 pIPFrame
, This
->ip_window
, posrect
.left
, posrect
.top
, posrect
.right
, posrect
.bottom
,
237 cliprect
.left
, cliprect
.top
, cliprect
.right
, cliprect
.bottom
,
238 frameinfo
.cb
, frameinfo
.fMDIApp
, frameinfo
.hwndFrame
, frameinfo
.haccel
, frameinfo
.cAccelEntries
);
240 hres
= IOleInPlaceSite_GetWindow(This
->ipsite
, &parent_hwnd
);
242 WARN("GetWindow failed: %08x\n", hres
);
246 TRACE("got parent window %p\n", parent_hwnd
);
249 if(GetParent(This
->hwnd
) != parent_hwnd
)
250 SetParent(This
->hwnd
, parent_hwnd
);
251 SetWindowPos(This
->hwnd
, HWND_TOP
,
252 posrect
.left
, posrect
.top
, posrect
.right
-posrect
.left
, posrect
.bottom
-posrect
.top
,
253 SWP_NOACTIVATE
| SWP_SHOWWINDOW
);
255 CreateWindowExW(0, wszInternetExplorer_Server
, NULL
,
256 WS_CHILD
| WS_CLIPSIBLINGS
| WS_CLIPCHILDREN
,
257 posrect
.left
, posrect
.top
, posrect
.right
-posrect
.left
, posrect
.bottom
-posrect
.top
,
258 parent_hwnd
, NULL
, hInst
, This
);
260 TRACE("Created window %p\n", This
->hwnd
);
262 SetWindowPos(This
->hwnd
, NULL
, 0, 0, 0, 0,
263 SWP_NOSIZE
| SWP_NOMOVE
| SWP_NOZORDER
| SWP_NOREDRAW
| SWP_NOACTIVATE
| SWP_SHOWWINDOW
);
264 RedrawWindow(This
->hwnd
, NULL
, NULL
, RDW_INVALIDATE
| RDW_NOERASE
| RDW_ALLCHILDREN
);
267 * Windows implementation calls:
268 * RegisterWindowMessage("MSWHEEL_ROLLMSG");
270 SetTimer(This
->hwnd
, TIMER_ID
, 100, NULL
);
273 if(This
->nscontainer
)
274 activate_gecko(This
->nscontainer
);
276 This
->in_place_active
= TRUE
;
277 hres
= IOleInPlaceSite_QueryInterface(This
->ipsite
, &IID_IOleInPlaceSiteEx
, (void**)&ipsiteex
);
278 if(SUCCEEDED(hres
)) {
281 hres
= IOleInPlaceSiteEx_OnInPlaceActivateEx(ipsiteex
, &redraw
, 0);
282 IOleInPlaceSiteEx_Release(ipsiteex
);
284 FIXME("unsupported redraw\n");
286 hres
= IOleInPlaceSite_OnInPlaceActivate(This
->ipsite
);
289 WARN("OnInPlaceActivate failed: %08x\n", hres
);
290 This
->in_place_active
= FALSE
;
294 hres
= IOleClientSite_QueryInterface(This
->client
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
295 if(SUCCEEDED(hres
)) {
298 IOleInPlaceFrame_SetStatusText(pIPFrame
, NULL
);
302 IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_SETPROGRESSMAX
,
303 OLECMDEXECOPT_DONTPROMPTUSER
, &var
, NULL
);
304 IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_SETPROGRESSPOS
,
305 OLECMDEXECOPT_DONTPROMPTUSER
, &var
, NULL
);
307 IOleCommandTarget_Release(cmdtrg
);
311 IOleInPlaceFrame_Release(This
->frame
);
312 This
->frame
= pIPFrame
;
314 if(!This
->request_uiactivate
) {
315 hres
= IOleInPlaceSite_QueryInterface(This
->ipsite
, &IID_IOleInPlaceSiteEx
, (void**)&ipsiteex
);
316 if(SUCCEEDED(hres
)) {
317 IOleInPlaceSiteEx_RequestUIActivate(ipsiteex
);
318 IOleInPlaceSiteEx_Release(ipsiteex
);
322 This
->window_active
= TRUE
;
327 static LRESULT WINAPI
tooltips_proc(HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
329 tooltip_data
*data
= GetPropW(hwnd
, wszTooltipData
);
331 TRACE("%d %p\n", msg
, data
);
333 if(msg
== TTM_WINDOWFROMPOINT
) {
335 POINT
*pt
= (POINT
*)lParam
;
337 TRACE("TTM_WINDOWFROMPOINT (%d,%d)\n", pt
->x
, pt
->y
);
339 GetWindowRect(data
->doc
->hwnd
, &rect
);
341 if(rect
.left
<= pt
->x
&& pt
->x
<= rect
.right
342 && rect
.top
<= pt
->y
&& pt
->y
<= rect
.bottom
)
343 return (LPARAM
)data
->doc
->hwnd
;
346 return CallWindowProcW(data
->proc
, hwnd
, msg
, wParam
, lParam
);
349 static void create_tooltips_window(HTMLDocumentObj
*This
)
351 tooltip_data
*data
= heap_alloc(sizeof(*data
));
353 This
->tooltips_hwnd
= CreateWindowExW(0, TOOLTIPS_CLASSW
, NULL
, TTS_NOPREFIX
| WS_POPUP
,
354 CW_USEDEFAULT
, CW_USEDEFAULT
, 10, 10, This
->hwnd
, NULL
, hInst
, NULL
);
357 data
->proc
= (WNDPROC
)GetWindowLongPtrW(This
->tooltips_hwnd
, GWLP_WNDPROC
);
359 SetPropW(This
->tooltips_hwnd
, wszTooltipData
, data
);
361 SetWindowLongPtrW(This
->tooltips_hwnd
, GWLP_WNDPROC
, (LONG_PTR
)tooltips_proc
);
363 SetWindowPos(This
->tooltips_hwnd
, HWND_TOPMOST
,0, 0, 0, 0,
364 SWP_NOMOVE
| SWP_NOSIZE
| SWP_NOACTIVATE
);
368 void show_tooltip(HTMLDocumentObj
*This
, DWORD x
, DWORD y
, LPCWSTR text
)
370 TTTOOLINFOW toolinfo
= {
371 sizeof(TTTOOLINFOW
), 0, This
->hwnd
, 0xdeadbeef,
372 {x
>2 ? x
-2 : 0, y
>0 ? y
-2 : 0, x
+2, y
+2}, /* FIXME */
373 NULL
, (LPWSTR
)text
, 0};
374 MSG msg
= {This
->hwnd
, WM_MOUSEMOVE
, 0, MAKELPARAM(x
,y
), 0, {x
,y
}};
376 TRACE("(%p)->(%d %d %s)\n", This
, x
, y
, debugstr_w(text
));
378 if(!This
->tooltips_hwnd
)
379 create_tooltips_window(This
);
381 SendMessageW(This
->tooltips_hwnd
, TTM_ADDTOOLW
, 0, (LPARAM
)&toolinfo
);
382 SendMessageW(This
->tooltips_hwnd
, TTM_ACTIVATE
, TRUE
, 0);
383 SendMessageW(This
->tooltips_hwnd
, TTM_RELAYEVENT
, 0, (LPARAM
)&msg
);
386 void hide_tooltip(HTMLDocumentObj
*This
)
388 TTTOOLINFOW toolinfo
= {
389 sizeof(TTTOOLINFOW
), 0, This
->hwnd
, 0xdeadbeef,
390 {0,0,0,0}, NULL
, NULL
, 0};
392 TRACE("(%p)\n", This
);
394 SendMessageW(This
->tooltips_hwnd
, TTM_DELTOOLW
, 0, (LPARAM
)&toolinfo
);
395 SendMessageW(This
->tooltips_hwnd
, TTM_ACTIVATE
, FALSE
, 0);
398 HRESULT
call_set_active_object(IOleInPlaceUIWindow
*window
, IOleInPlaceActiveObject
*act_obj
)
400 static WCHAR html_documentW
[30];
402 if(act_obj
&& !html_documentW
[0]) {
403 LoadStringW(hInst
, IDS_HTMLDOCUMENT
, html_documentW
,
404 sizeof(html_documentW
)/sizeof(WCHAR
));
407 return IOleInPlaceUIWindow_SetActiveObject(window
, act_obj
, act_obj
? html_documentW
: NULL
);
410 /**********************************************************
411 * IOleDocumentView implementation
414 static inline HTMLDocument
*impl_from_IOleDocumentView(IOleDocumentView
*iface
)
416 return CONTAINING_RECORD(iface
, HTMLDocument
, IOleDocumentView_iface
);
419 static HRESULT WINAPI
OleDocumentView_QueryInterface(IOleDocumentView
*iface
, REFIID riid
, void **ppvObject
)
421 HTMLDocument
*This
= impl_from_IOleDocumentView(iface
);
422 return htmldoc_query_interface(This
, riid
, ppvObject
);
425 static ULONG WINAPI
OleDocumentView_AddRef(IOleDocumentView
*iface
)
427 HTMLDocument
*This
= impl_from_IOleDocumentView(iface
);
428 return htmldoc_addref(This
);
431 static ULONG WINAPI
OleDocumentView_Release(IOleDocumentView
*iface
)
433 HTMLDocument
*This
= impl_from_IOleDocumentView(iface
);
434 return htmldoc_release(This
);
437 static HRESULT WINAPI
OleDocumentView_SetInPlaceSite(IOleDocumentView
*iface
, IOleInPlaceSite
*pIPSite
)
439 HTMLDocument
*This
= impl_from_IOleDocumentView(iface
);
440 TRACE("(%p)->(%p)\n", This
, pIPSite
);
443 IOleInPlaceSite_AddRef(pIPSite
);
445 if(This
->doc_obj
->ipsite
)
446 IOleInPlaceSite_Release(This
->doc_obj
->ipsite
);
448 This
->doc_obj
->ipsite
= pIPSite
;
449 This
->doc_obj
->request_uiactivate
= TRUE
;
453 static HRESULT WINAPI
OleDocumentView_GetInPlaceSite(IOleDocumentView
*iface
, IOleInPlaceSite
**ppIPSite
)
455 HTMLDocument
*This
= impl_from_IOleDocumentView(iface
);
456 TRACE("(%p)->(%p)\n", This
, ppIPSite
);
461 if(This
->doc_obj
->ipsite
)
462 IOleInPlaceSite_AddRef(This
->doc_obj
->ipsite
);
464 *ppIPSite
= This
->doc_obj
->ipsite
;
468 static HRESULT WINAPI
OleDocumentView_GetDocument(IOleDocumentView
*iface
, IUnknown
**ppunk
)
470 HTMLDocument
*This
= impl_from_IOleDocumentView(iface
);
471 TRACE("(%p)->(%p)\n", This
, ppunk
);
476 htmldoc_addref(This
);
477 *ppunk
= (IUnknown
*)&This
->IHTMLDocument2_iface
;
481 static HRESULT WINAPI
OleDocumentView_SetRect(IOleDocumentView
*iface
, LPRECT prcView
)
483 HTMLDocument
*This
= impl_from_IOleDocumentView(iface
);
486 TRACE("(%p)->(%p)\n", This
, prcView
);
491 if(This
->doc_obj
->hwnd
) {
492 GetClientRect(This
->doc_obj
->hwnd
, &rect
);
493 if(memcmp(prcView
, &rect
, sizeof(RECT
))) {
494 InvalidateRect(This
->doc_obj
->hwnd
, NULL
, TRUE
);
495 SetWindowPos(This
->doc_obj
->hwnd
, NULL
, prcView
->left
, prcView
->top
, prcView
->right
,
496 prcView
->bottom
, SWP_NOZORDER
| SWP_NOACTIVATE
);
503 static HRESULT WINAPI
OleDocumentView_GetRect(IOleDocumentView
*iface
, LPRECT prcView
)
505 HTMLDocument
*This
= impl_from_IOleDocumentView(iface
);
507 TRACE("(%p)->(%p)\n", This
, prcView
);
512 GetClientRect(This
->doc_obj
->hwnd
, prcView
);
516 static HRESULT WINAPI
OleDocumentView_SetRectComplex(IOleDocumentView
*iface
, LPRECT prcView
,
517 LPRECT prcHScroll
, LPRECT prcVScroll
, LPRECT prcSizeBox
)
519 HTMLDocument
*This
= impl_from_IOleDocumentView(iface
);
520 FIXME("(%p)->(%p %p %p %p)\n", This
, prcView
, prcHScroll
, prcVScroll
, prcSizeBox
);
524 static HRESULT WINAPI
OleDocumentView_Show(IOleDocumentView
*iface
, BOOL fShow
)
526 HTMLDocument
*This
= impl_from_IOleDocumentView(iface
);
529 TRACE("(%p)->(%x)\n", This
, fShow
);
532 if(!This
->doc_obj
->ui_active
) {
533 hres
= activate_window(This
->doc_obj
);
537 update_doc(This
, UPDATE_UI
);
538 ShowWindow(This
->doc_obj
->hwnd
, SW_SHOW
);
540 ShowWindow(This
->doc_obj
->hwnd
, SW_HIDE
);
542 if(This
->doc_obj
->in_place_active
)
543 IOleInPlaceObjectWindowless_InPlaceDeactivate(&This
->IOleInPlaceObjectWindowless_iface
);
545 if(This
->doc_obj
->ip_window
) {
546 IOleInPlaceUIWindow_Release(This
->doc_obj
->ip_window
);
547 This
->doc_obj
->ip_window
= NULL
;
554 static HRESULT WINAPI
OleDocumentView_UIActivate(IOleDocumentView
*iface
, BOOL fUIActivate
)
556 HTMLDocument
*This
= impl_from_IOleDocumentView(iface
);
559 TRACE("(%p)->(%x)\n", This
, fUIActivate
);
561 if(!This
->doc_obj
->ipsite
) {
562 IOleClientSite
*cs
= This
->doc_obj
->client
;
563 IOleInPlaceSite
*ips
;
566 WARN("this->ipsite = NULL\n");
570 hres
= IOleClientSite_QueryInterface(cs
, &IID_IOleInPlaceSiteWindowless
, (void**)&ips
);
572 This
->doc_obj
->ipsite
= ips
;
574 hres
= IOleClientSite_QueryInterface(cs
, &IID_IOleInPlaceSiteEx
, (void**)&ips
);
576 This
->doc_obj
->ipsite
= ips
;
578 hres
= IOleClientSite_QueryInterface(cs
, &IID_IOleInPlaceSite
, (void**)&ips
);
580 This
->doc_obj
->ipsite
= ips
;
582 WARN("this->ipsite = NULL\n");
583 return E_NOINTERFACE
;
588 IOleInPlaceSite_AddRef(This
->doc_obj
->ipsite
);
589 This
->doc_obj
->request_uiactivate
= FALSE
;
590 HTMLDocument_LockContainer(This
->doc_obj
, TRUE
);
596 if(This
->doc_obj
->ui_active
)
599 if(!This
->doc_obj
->window_active
) {
600 hres
= activate_window(This
->doc_obj
);
605 This
->doc_obj
->focus
= TRUE
;
606 if(This
->doc_obj
->nscontainer
)
607 nsIWebBrowserFocus_Activate(This
->doc_obj
->nscontainer
->focus
);
608 notif_focus(This
->doc_obj
);
610 update_doc(This
, UPDATE_UI
);
612 hres
= IOleInPlaceSite_OnUIActivate(This
->doc_obj
->ipsite
);
613 if(SUCCEEDED(hres
)) {
614 call_set_active_object((IOleInPlaceUIWindow
*)This
->doc_obj
->frame
,
615 &This
->IOleInPlaceActiveObject_iface
);
617 FIXME("OnUIActivate failed: %08x\n", hres
);
618 IOleInPlaceFrame_Release(This
->doc_obj
->frame
);
619 This
->doc_obj
->frame
= NULL
;
620 This
->doc_obj
->ui_active
= FALSE
;
624 if(This
->doc_obj
->hostui
) {
625 hres
= IDocHostUIHandler_ShowUI(This
->doc_obj
->hostui
,
626 This
->doc_obj
->usermode
== EDITMODE
? DOCHOSTUITYPE_AUTHOR
: DOCHOSTUITYPE_BROWSE
,
627 &This
->IOleInPlaceActiveObject_iface
, &This
->IOleCommandTarget_iface
,
628 This
->doc_obj
->frame
, This
->doc_obj
->ip_window
);
630 IDocHostUIHandler_HideUI(This
->doc_obj
->hostui
);
633 if(This
->doc_obj
->ip_window
)
634 call_set_active_object(This
->doc_obj
->ip_window
, &This
->IOleInPlaceActiveObject_iface
);
636 memset(&rcBorderWidths
, 0, sizeof(rcBorderWidths
));
637 IOleInPlaceFrame_SetBorderSpace(This
->doc_obj
->frame
, &rcBorderWidths
);
639 This
->doc_obj
->ui_active
= TRUE
;
641 This
->doc_obj
->focus
= FALSE
;
642 nsIWebBrowserFocus_Deactivate(This
->doc_obj
->nscontainer
->focus
);
643 if(This
->doc_obj
->ui_active
) {
644 This
->doc_obj
->ui_active
= FALSE
;
645 if(This
->doc_obj
->ip_window
)
646 call_set_active_object(This
->doc_obj
->ip_window
, NULL
);
647 if(This
->doc_obj
->frame
)
648 call_set_active_object((IOleInPlaceUIWindow
*)This
->doc_obj
->frame
, NULL
);
649 if(This
->doc_obj
->hostui
)
650 IDocHostUIHandler_HideUI(This
->doc_obj
->hostui
);
651 if(This
->doc_obj
->ipsite
)
652 IOleInPlaceSite_OnUIDeactivate(This
->doc_obj
->ipsite
, FALSE
);
658 static HRESULT WINAPI
OleDocumentView_Open(IOleDocumentView
*iface
)
660 HTMLDocument
*This
= impl_from_IOleDocumentView(iface
);
661 FIXME("(%p)\n", This
);
665 static HRESULT WINAPI
OleDocumentView_CloseView(IOleDocumentView
*iface
, DWORD dwReserved
)
667 HTMLDocument
*This
= impl_from_IOleDocumentView(iface
);
668 TRACE("(%p)->(%x)\n", This
, dwReserved
);
671 WARN("dwReserved = %d\n", dwReserved
);
674 * Windows implementation calls QueryInterface(IID_IOleCommandTarget),
675 * QueryInterface(IID_IOleControlSite) and KillTimer
678 IOleDocumentView_Show(iface
, FALSE
);
683 static HRESULT WINAPI
OleDocumentView_SaveViewState(IOleDocumentView
*iface
, LPSTREAM pstm
)
685 HTMLDocument
*This
= impl_from_IOleDocumentView(iface
);
686 FIXME("(%p)->(%p)\n", This
, pstm
);
690 static HRESULT WINAPI
OleDocumentView_ApplyViewState(IOleDocumentView
*iface
, LPSTREAM pstm
)
692 HTMLDocument
*This
= impl_from_IOleDocumentView(iface
);
693 FIXME("(%p)->(%p)\n", This
, pstm
);
697 static HRESULT WINAPI
OleDocumentView_Clone(IOleDocumentView
*iface
, IOleInPlaceSite
*pIPSiteNew
,
698 IOleDocumentView
**ppViewNew
)
700 HTMLDocument
*This
= impl_from_IOleDocumentView(iface
);
701 FIXME("(%p)->(%p %p)\n", This
, pIPSiteNew
, ppViewNew
);
705 static const IOleDocumentViewVtbl OleDocumentViewVtbl
= {
706 OleDocumentView_QueryInterface
,
707 OleDocumentView_AddRef
,
708 OleDocumentView_Release
,
709 OleDocumentView_SetInPlaceSite
,
710 OleDocumentView_GetInPlaceSite
,
711 OleDocumentView_GetDocument
,
712 OleDocumentView_SetRect
,
713 OleDocumentView_GetRect
,
714 OleDocumentView_SetRectComplex
,
715 OleDocumentView_Show
,
716 OleDocumentView_UIActivate
,
717 OleDocumentView_Open
,
718 OleDocumentView_CloseView
,
719 OleDocumentView_SaveViewState
,
720 OleDocumentView_ApplyViewState
,
721 OleDocumentView_Clone
724 /**********************************************************
725 * IViewObject implementation
728 static inline HTMLDocument
*impl_from_IViewObjectEx(IViewObjectEx
*iface
)
730 return CONTAINING_RECORD(iface
, HTMLDocument
, IViewObjectEx_iface
);
733 static HRESULT WINAPI
ViewObject_QueryInterface(IViewObjectEx
*iface
, REFIID riid
, void **ppv
)
735 HTMLDocument
*This
= impl_from_IViewObjectEx(iface
);
736 return htmldoc_query_interface(This
, riid
, ppv
);
739 static ULONG WINAPI
ViewObject_AddRef(IViewObjectEx
*iface
)
741 HTMLDocument
*This
= impl_from_IViewObjectEx(iface
);
742 return htmldoc_addref(This
);
745 static ULONG WINAPI
ViewObject_Release(IViewObjectEx
*iface
)
747 HTMLDocument
*This
= impl_from_IViewObjectEx(iface
);
748 return htmldoc_release(This
);
751 static HRESULT WINAPI
ViewObject_Draw(IViewObjectEx
*iface
, DWORD dwDrawAspect
, LONG lindex
, void *pvAspect
,
752 DVTARGETDEVICE
*ptd
, HDC hdcTargetDev
, HDC hdcDraw
, LPCRECTL lprcBounds
,
753 LPCRECTL lprcWBounds
, BOOL (CALLBACK
*pfnContinue
)(ULONG_PTR dwContinue
), ULONG_PTR dwContinue
)
755 HTMLDocument
*This
= impl_from_IViewObjectEx(iface
);
756 FIXME("(%p)->(%d %d %p %p %p %p %p %p %p %ld)\n", This
, dwDrawAspect
, lindex
, pvAspect
,
757 ptd
, hdcTargetDev
, hdcDraw
, lprcBounds
, lprcWBounds
, pfnContinue
, dwContinue
);
761 static HRESULT WINAPI
ViewObject_GetColorSet(IViewObjectEx
*iface
, DWORD dwDrawAspect
, LONG lindex
, void *pvAspect
,
762 DVTARGETDEVICE
*ptd
, HDC hicTargetDev
, LOGPALETTE
**ppColorSet
)
764 HTMLDocument
*This
= impl_from_IViewObjectEx(iface
);
765 FIXME("(%p)->(%d %d %p %p %p %p)\n", This
, dwDrawAspect
, lindex
, pvAspect
, ptd
, hicTargetDev
, ppColorSet
);
769 static HRESULT WINAPI
ViewObject_Freeze(IViewObjectEx
*iface
, DWORD dwDrawAspect
, LONG lindex
,
770 void *pvAspect
, DWORD
*pdwFreeze
)
772 HTMLDocument
*This
= impl_from_IViewObjectEx(iface
);
773 FIXME("(%p)->(%d %d %p %p)\n", This
, dwDrawAspect
, lindex
, pvAspect
, pdwFreeze
);
777 static HRESULT WINAPI
ViewObject_Unfreeze(IViewObjectEx
*iface
, DWORD dwFreeze
)
779 HTMLDocument
*This
= impl_from_IViewObjectEx(iface
);
780 FIXME("(%p)->(%d)\n", This
, dwFreeze
);
784 static HRESULT WINAPI
ViewObject_SetAdvise(IViewObjectEx
*iface
, DWORD aspects
, DWORD advf
, IAdviseSink
*pAdvSink
)
786 HTMLDocument
*This
= impl_from_IViewObjectEx(iface
);
788 TRACE("(%p)->(%d %d %p)\n", This
, aspects
, advf
, pAdvSink
);
790 if(aspects
!= DVASPECT_CONTENT
|| advf
!= ADVF_PRIMEFIRST
)
791 FIXME("unsupported arguments\n");
793 if(This
->doc_obj
->view_sink
)
794 IAdviseSink_Release(This
->doc_obj
->view_sink
);
796 IAdviseSink_AddRef(pAdvSink
);
798 This
->doc_obj
->view_sink
= pAdvSink
;
802 static HRESULT WINAPI
ViewObject_GetAdvise(IViewObjectEx
*iface
, DWORD
*pAspects
, DWORD
*pAdvf
, IAdviseSink
**ppAdvSink
)
804 HTMLDocument
*This
= impl_from_IViewObjectEx(iface
);
805 FIXME("(%p)->(%p %p %p)\n", This
, pAspects
, pAdvf
, ppAdvSink
);
809 static HRESULT WINAPI
ViewObject_GetExtent(IViewObjectEx
*iface
, DWORD dwDrawAspect
, LONG lindex
,
810 DVTARGETDEVICE
* ptd
, LPSIZEL lpsizel
)
812 HTMLDocument
*This
= impl_from_IViewObjectEx(iface
);
813 FIXME("(%p)->(%d %d %p %p)\n", This
, dwDrawAspect
, lindex
, ptd
, lpsizel
);
817 static HRESULT WINAPI
ViewObject_GetRect(IViewObjectEx
*iface
, DWORD dwAspect
, LPRECTL pRect
)
819 HTMLDocument
*This
= impl_from_IViewObjectEx(iface
);
820 FIXME("(%p)->(%d %p)\n", This
, dwAspect
, pRect
);
824 static HRESULT WINAPI
ViewObject_GetViewStatus(IViewObjectEx
*iface
, DWORD
*pdwStatus
)
826 HTMLDocument
*This
= impl_from_IViewObjectEx(iface
);
827 FIXME("(%p)->(%p)\n", This
, pdwStatus
);
831 static HRESULT WINAPI
ViewObject_QueryHitPoint(IViewObjectEx
* iface
, DWORD dwAspect
,
832 LPCRECT pRectBounds
, POINT ptlLoc
, LONG lCloseHint
, DWORD
*pHitResult
)
834 HTMLDocument
*This
= impl_from_IViewObjectEx(iface
);
835 FIXME("(%p)->(%d %p (%d %d) %d %p)\n", This
, dwAspect
, pRectBounds
, ptlLoc
.x
,
836 ptlLoc
.y
, lCloseHint
, pHitResult
);
840 static HRESULT WINAPI
ViewObject_QueryHitRect(IViewObjectEx
*iface
, DWORD dwAspect
,
841 LPCRECT pRectBounds
, LPCRECT pRectLoc
, LONG lCloseHint
, DWORD
*pHitResult
)
843 HTMLDocument
*This
= impl_from_IViewObjectEx(iface
);
844 FIXME("(%p)->(%d %p %p %d %p)\n", This
, dwAspect
, pRectBounds
, pRectLoc
, lCloseHint
, pHitResult
);
848 static HRESULT WINAPI
ViewObject_GetNaturalExtent(IViewObjectEx
*iface
, DWORD dwAspect
, LONG lindex
,
849 DVTARGETDEVICE
*ptd
, HDC hicTargetDev
, DVEXTENTINFO
*pExtentInfo
, LPSIZEL pSizel
)
851 HTMLDocument
*This
= impl_from_IViewObjectEx(iface
);
852 FIXME("(%p)->(%d %d %p %p %p %p\n", This
, dwAspect
,lindex
, ptd
,
853 hicTargetDev
, pExtentInfo
, pSizel
);
857 static const IViewObjectExVtbl ViewObjectVtbl
= {
858 ViewObject_QueryInterface
,
862 ViewObject_GetColorSet
,
865 ViewObject_SetAdvise
,
866 ViewObject_GetAdvise
,
867 ViewObject_GetExtent
,
869 ViewObject_GetViewStatus
,
870 ViewObject_QueryHitPoint
,
871 ViewObject_QueryHitRect
,
872 ViewObject_GetNaturalExtent
875 void HTMLDocument_View_Init(HTMLDocument
*This
)
877 This
->IOleDocumentView_iface
.lpVtbl
= &OleDocumentViewVtbl
;
878 This
->IViewObjectEx_iface
.lpVtbl
= &ViewObjectVtbl
;
881 static inline HTMLDocumentObj
*impl_from_IWindowForBindingUI(IWindowForBindingUI
*iface
)
883 return CONTAINING_RECORD(iface
, HTMLDocumentObj
, IWindowForBindingUI_iface
);
886 static HRESULT WINAPI
WindowForBindingUI_QueryInterface(IWindowForBindingUI
*iface
, REFIID riid
, void **ppv
)
888 HTMLDocumentObj
*This
= impl_from_IWindowForBindingUI(iface
);
890 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
891 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
892 *ppv
= &This
->IWindowForBindingUI_iface
;
893 }else if(IsEqualGUID(&IID_IWindowForBindingUI
, riid
)) {
894 TRACE("(%p)->(IID_IWindowForBindingUI %p)\n", This
, ppv
);
895 *ppv
= &This
->IWindowForBindingUI_iface
;
897 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
899 return E_NOINTERFACE
;
902 IUnknown_AddRef((IUnknown
*)*ppv
);
906 static ULONG WINAPI
WindowForBindingUI_AddRef(IWindowForBindingUI
*iface
)
908 HTMLDocumentObj
*This
= impl_from_IWindowForBindingUI(iface
);
909 return htmldoc_addref(&This
->basedoc
);
912 static ULONG WINAPI
WindowForBindingUI_Release(IWindowForBindingUI
*iface
)
914 HTMLDocumentObj
*This
= impl_from_IWindowForBindingUI(iface
);
915 return htmldoc_release(&This
->basedoc
);
918 static HRESULT WINAPI
WindowForBindingUI_GetWindow(IWindowForBindingUI
*iface
, REFGUID rguidReason
, HWND
*phwnd
)
920 HTMLDocumentObj
*This
= impl_from_IWindowForBindingUI(iface
);
922 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(rguidReason
), phwnd
);
928 static const IWindowForBindingUIVtbl WindowForBindingUIVtbl
= {
929 WindowForBindingUI_QueryInterface
,
930 WindowForBindingUI_AddRef
,
931 WindowForBindingUI_Release
,
932 WindowForBindingUI_GetWindow
935 void init_binding_ui(HTMLDocumentObj
*doc
)
937 doc
->IWindowForBindingUI_iface
.lpVtbl
= &WindowForBindingUIVtbl
;