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
31 #include "wine/debug.h"
33 #include "mshtml_private.h"
35 WINE_DEFAULT_DEBUG_CHANNEL(mshtml
);
37 #define TIMER_ID 0x1000
39 static ATOM serverwnd_class
= 0;
46 static void paint_document(HTMLDocumentObj
*This
)
52 GetClientRect(This
->hwnd
, &rect
);
54 hdc
= BeginPaint(This
->hwnd
, &ps
);
56 if(!(This
->hostinfo
.dwFlags
& (DOCHOSTUIFLAG_NO3DOUTERBORDER
|DOCHOSTUIFLAG_NO3DBORDER
)))
57 DrawEdge(hdc
, &rect
, EDGE_SUNKEN
, BF_RECT
|BF_ADJUST
);
59 EndPaint(This
->hwnd
, &ps
);
62 static void activate_gecko(GeckoBrowser
*This
)
64 TRACE("(%p) %p\n", This
, This
->window
);
66 SetParent(This
->hwnd
, This
->doc
->hwnd
);
67 ShowWindow(This
->hwnd
, SW_SHOW
);
69 nsIBaseWindow_SetVisibility(This
->window
, TRUE
);
70 nsIBaseWindow_SetEnabled(This
->window
, TRUE
);
73 void update_doc(HTMLDocumentObj
*This
, DWORD flags
)
75 if(!This
->update
&& This
->hwnd
)
76 SetTimer(This
->hwnd
, TIMER_ID
, 100, NULL
);
78 This
->update
|= flags
;
81 void update_title(HTMLDocumentObj
*This
)
83 IOleCommandTarget
*olecmd
;
86 if(!(This
->update
& UPDATE_TITLE
))
89 This
->update
&= ~UPDATE_TITLE
;
94 hres
= IOleClientSite_QueryInterface(This
->client
, &IID_IOleCommandTarget
, (void**)&olecmd
);
98 V_VT(&title
) = VT_BSTR
;
99 V_BSTR(&title
) = SysAllocString(L
"");
100 IOleCommandTarget_Exec(olecmd
, NULL
, OLECMDID_SETTITLE
, OLECMDEXECOPT_DONTPROMPTUSER
,
102 SysFreeString(V_BSTR(&title
));
104 IOleCommandTarget_Release(olecmd
);
108 static LRESULT
on_timer(HTMLDocumentObj
*This
)
110 TRACE("(%p) %lx\n", This
, This
->update
);
112 KillTimer(This
->hwnd
, TIMER_ID
);
117 if(This
->update
& UPDATE_UI
) {
119 IDocHostUIHandler_UpdateUI(This
->hostui
);
122 IOleCommandTarget
*cmdtrg
;
125 hres
= IOleClientSite_QueryInterface(This
->client
, &IID_IOleCommandTarget
,
127 if(SUCCEEDED(hres
)) {
128 IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_UPDATECOMMANDS
,
129 OLECMDEXECOPT_DONTPROMPTUSER
, NULL
, NULL
);
130 IOleCommandTarget_Release(cmdtrg
);
140 void notif_focus(HTMLDocumentObj
*This
)
142 IOleControlSite
*site
;
148 hres
= IOleClientSite_QueryInterface(This
->client
, &IID_IOleControlSite
, (void**)&site
);
152 IOleControlSite_OnFocus(site
, This
->focus
);
153 IOleControlSite_Release(site
);
156 static LRESULT WINAPI
serverwnd_proc(HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
158 HTMLDocumentObj
*This
;
160 if(msg
== WM_CREATE
) {
161 This
= *(HTMLDocumentObj
**)lParam
;
162 SetPropW(hwnd
, L
"THIS", This
);
164 This
= GetPropW(hwnd
, L
"THIS");
172 paint_document(This
);
175 TRACE("(%p)->(WM_SIZE)\n", This
);
176 if(This
->nscontainer
) {
179 if(!(This
->hostinfo
.dwFlags
& (DOCHOSTUIFLAG_NO3DOUTERBORDER
|DOCHOSTUIFLAG_NO3DBORDER
))) {
180 ew
= GetSystemMetrics(SM_CXEDGE
);
181 eh
= GetSystemMetrics(SM_CYEDGE
);
184 SetWindowPos(This
->nscontainer
->hwnd
, NULL
, ew
, eh
,
185 LOWORD(lParam
) - 2*ew
, HIWORD(lParam
) - 2*eh
,
186 SWP_NOZORDER
| SWP_NOACTIVATE
);
190 return on_timer(This
);
192 TRACE("(%p) WM_SETFOCUS\n", This
);
193 nsIWebBrowserFocus_Activate(This
->nscontainer
->focus
);
195 case WM_MOUSEACTIVATE
:
199 return DefWindowProcW(hwnd
, msg
, wParam
, lParam
);
202 static void register_serverwnd_class(void)
204 static WNDCLASSEXW wndclass
= {
208 0, 0, NULL
, NULL
, NULL
, NULL
, NULL
,
209 L
"Internet Explorer_Server",
212 wndclass
.hInstance
= hInst
;
213 serverwnd_class
= RegisterClassExW(&wndclass
);
216 static HRESULT
activate_window(HTMLDocumentObj
*This
)
218 IOleInPlaceFrame
*pIPFrame
;
219 IOleCommandTarget
*cmdtrg
;
220 IOleInPlaceSiteEx
*ipsiteex
;
221 RECT posrect
, cliprect
;
222 OLEINPLACEFRAMEINFO frameinfo
;
227 register_serverwnd_class();
229 hres
= IOleInPlaceSite_CanInPlaceActivate(This
->ipsite
);
231 WARN("CanInPlaceActivate returned: %08lx\n", hres
);
232 return FAILED(hres
) ? hres
: E_FAIL
;
235 frameinfo
.cb
= sizeof(OLEINPLACEFRAMEINFO
);
236 hres
= IOleInPlaceSite_GetWindowContext(This
->ipsite
, &pIPFrame
, &This
->ip_window
,
237 &posrect
, &cliprect
, &frameinfo
);
239 WARN("GetWindowContext failed: %08lx\n", hres
);
243 TRACE("got window context: %p %p %s %s {%d %x %p %p %d}\n",
244 pIPFrame
, This
->ip_window
, wine_dbgstr_rect(&posrect
), wine_dbgstr_rect(&cliprect
),
245 frameinfo
.cb
, frameinfo
.fMDIApp
, frameinfo
.hwndFrame
, frameinfo
.haccel
, frameinfo
.cAccelEntries
);
247 hres
= IOleInPlaceSite_GetWindow(This
->ipsite
, &parent_hwnd
);
249 WARN("GetWindow failed: %08lx\n", hres
);
253 TRACE("got parent window %p\n", parent_hwnd
);
256 if(GetParent(This
->hwnd
) != parent_hwnd
)
257 SetParent(This
->hwnd
, parent_hwnd
);
258 SetWindowPos(This
->hwnd
, HWND_TOP
,
259 posrect
.left
, posrect
.top
, posrect
.right
-posrect
.left
, posrect
.bottom
-posrect
.top
,
260 SWP_NOACTIVATE
| SWP_SHOWWINDOW
);
262 CreateWindowExW(0, L
"Internet Explorer_Server", NULL
,
263 WS_CHILD
| WS_CLIPSIBLINGS
| WS_CLIPCHILDREN
,
264 posrect
.left
, posrect
.top
, posrect
.right
-posrect
.left
, posrect
.bottom
-posrect
.top
,
265 parent_hwnd
, NULL
, hInst
, This
);
267 TRACE("Created window %p\n", This
->hwnd
);
269 SetWindowPos(This
->hwnd
, NULL
, 0, 0, 0, 0,
270 SWP_NOSIZE
| SWP_NOMOVE
| SWP_NOZORDER
| SWP_NOREDRAW
| SWP_NOACTIVATE
| SWP_SHOWWINDOW
);
271 RedrawWindow(This
->hwnd
, NULL
, NULL
, RDW_INVALIDATE
| RDW_NOERASE
| RDW_ALLCHILDREN
);
272 SetTimer(This
->hwnd
, TIMER_ID
, 100, NULL
);
275 if(This
->nscontainer
)
276 activate_gecko(This
->nscontainer
);
278 This
->in_place_active
= TRUE
;
279 hres
= IOleInPlaceSite_QueryInterface(This
->ipsite
, &IID_IOleInPlaceSiteEx
, (void**)&ipsiteex
);
280 if(SUCCEEDED(hres
)) {
283 hres
= IOleInPlaceSiteEx_OnInPlaceActivateEx(ipsiteex
, &redraw
, 0);
284 IOleInPlaceSiteEx_Release(ipsiteex
);
286 FIXME("unsupported redraw\n");
288 hres
= IOleInPlaceSite_OnInPlaceActivate(This
->ipsite
);
291 WARN("OnInPlaceActivate failed: %08lx\n", hres
);
292 This
->in_place_active
= FALSE
;
296 hres
= IOleClientSite_QueryInterface(This
->client
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
297 if(SUCCEEDED(hres
)) {
300 IOleInPlaceFrame_SetStatusText(pIPFrame
, NULL
);
304 IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_SETPROGRESSMAX
,
305 OLECMDEXECOPT_DONTPROMPTUSER
, &var
, NULL
);
306 IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_SETPROGRESSPOS
,
307 OLECMDEXECOPT_DONTPROMPTUSER
, &var
, NULL
);
309 IOleCommandTarget_Release(cmdtrg
);
313 IOleInPlaceFrame_Release(This
->frame
);
314 This
->frame
= pIPFrame
;
316 if(!This
->request_uiactivate
) {
317 hres
= IOleInPlaceSite_QueryInterface(This
->ipsite
, &IID_IOleInPlaceSiteEx
, (void**)&ipsiteex
);
318 if(SUCCEEDED(hres
)) {
319 IOleInPlaceSiteEx_RequestUIActivate(ipsiteex
);
320 IOleInPlaceSiteEx_Release(ipsiteex
);
324 This
->window_active
= TRUE
;
329 static LRESULT WINAPI
tooltips_proc(HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
331 tooltip_data
*data
= GetPropW(hwnd
, L
"tooltip_data");
333 TRACE("%d %p\n", msg
, data
);
335 if(msg
== TTM_WINDOWFROMPOINT
) {
337 POINT
*pt
= (POINT
*)lParam
;
339 TRACE("TTM_WINDOWFROMPOINT (%ld,%ld)\n", pt
->x
, pt
->y
);
341 GetWindowRect(data
->doc
->hwnd
, &rect
);
343 if(rect
.left
<= pt
->x
&& pt
->x
<= rect
.right
344 && rect
.top
<= pt
->y
&& pt
->y
<= rect
.bottom
)
345 return (LPARAM
)data
->doc
->hwnd
;
348 return CallWindowProcW(data
->proc
, hwnd
, msg
, wParam
, lParam
);
351 static void create_tooltips_window(HTMLDocumentObj
*This
)
353 tooltip_data
*data
= heap_alloc(sizeof(*data
));
355 This
->tooltips_hwnd
= CreateWindowExW(0, TOOLTIPS_CLASSW
, NULL
, TTS_NOPREFIX
| WS_POPUP
,
356 CW_USEDEFAULT
, CW_USEDEFAULT
, 10, 10, This
->hwnd
, NULL
, hInst
, NULL
);
359 data
->proc
= (WNDPROC
)GetWindowLongPtrW(This
->tooltips_hwnd
, GWLP_WNDPROC
);
361 SetPropW(This
->tooltips_hwnd
, L
"tooltip_data", data
);
363 SetWindowLongPtrW(This
->tooltips_hwnd
, GWLP_WNDPROC
, (LONG_PTR
)tooltips_proc
);
365 SetWindowPos(This
->tooltips_hwnd
, HWND_TOPMOST
,0, 0, 0, 0,
366 SWP_NOMOVE
| SWP_NOSIZE
| SWP_NOACTIVATE
);
370 void show_tooltip(HTMLDocumentObj
*This
, DWORD x
, DWORD y
, LPCWSTR text
)
372 TTTOOLINFOW toolinfo
= {
373 sizeof(TTTOOLINFOW
), 0, This
->hwnd
, 0xdeadbeef,
374 {x
>2 ? x
-2 : 0, y
>0 ? y
-2 : 0, x
+2, y
+2}, /* FIXME */
375 NULL
, (LPWSTR
)text
, 0};
376 MSG msg
= {This
->hwnd
, WM_MOUSEMOVE
, 0, MAKELPARAM(x
,y
), 0, {x
,y
}};
378 TRACE("(%p)->(%ld %ld %s)\n", This
, x
, y
, debugstr_w(text
));
380 if(!This
->tooltips_hwnd
)
381 create_tooltips_window(This
);
383 SendMessageW(This
->tooltips_hwnd
, TTM_ADDTOOLW
, 0, (LPARAM
)&toolinfo
);
384 SendMessageW(This
->tooltips_hwnd
, TTM_ACTIVATE
, TRUE
, 0);
385 SendMessageW(This
->tooltips_hwnd
, TTM_RELAYEVENT
, 0, (LPARAM
)&msg
);
388 void hide_tooltip(HTMLDocumentObj
*This
)
390 TTTOOLINFOW toolinfo
= {
391 sizeof(TTTOOLINFOW
), 0, This
->hwnd
, 0xdeadbeef,
392 {0,0,0,0}, NULL
, NULL
, 0};
394 TRACE("(%p)\n", This
);
396 SendMessageW(This
->tooltips_hwnd
, TTM_DELTOOLW
, 0, (LPARAM
)&toolinfo
);
397 SendMessageW(This
->tooltips_hwnd
, TTM_ACTIVATE
, FALSE
, 0);
400 HRESULT
call_set_active_object(IOleInPlaceUIWindow
*window
, IOleInPlaceActiveObject
*act_obj
)
402 static WCHAR html_documentW
[30];
404 if(act_obj
&& !html_documentW
[0])
405 LoadStringW(hInst
, IDS_HTMLDOCUMENT
, html_documentW
, ARRAY_SIZE(html_documentW
));
407 return IOleInPlaceUIWindow_SetActiveObject(window
, act_obj
, act_obj
? html_documentW
: NULL
);
410 /**********************************************************
411 * IOleDocumentView implementation
414 static inline HTMLDocumentObj
*impl_from_IOleDocumentView(IOleDocumentView
*iface
)
416 return CONTAINING_RECORD(iface
, HTMLDocumentObj
, IOleDocumentView_iface
);
419 static HRESULT WINAPI
OleDocumentView_QueryInterface(IOleDocumentView
*iface
, REFIID riid
, void **ppvObject
)
421 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
422 return htmldoc_query_interface(&This
->basedoc
, riid
, ppvObject
);
425 static ULONG WINAPI
OleDocumentView_AddRef(IOleDocumentView
*iface
)
427 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
428 return htmldoc_addref(&This
->basedoc
);
431 static ULONG WINAPI
OleDocumentView_Release(IOleDocumentView
*iface
)
433 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
434 return htmldoc_release(&This
->basedoc
);
437 static HRESULT WINAPI
OleDocumentView_SetInPlaceSite(IOleDocumentView
*iface
, IOleInPlaceSite
*pIPSite
)
439 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
440 TRACE("(%p)->(%p)\n", This
, pIPSite
);
443 IOleInPlaceSite_AddRef(pIPSite
);
446 IOleInPlaceSite_Release(This
->ipsite
);
448 This
->ipsite
= pIPSite
;
449 This
->request_uiactivate
= TRUE
;
453 static HRESULT WINAPI
OleDocumentView_GetInPlaceSite(IOleDocumentView
*iface
, IOleInPlaceSite
**ppIPSite
)
455 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
456 TRACE("(%p)->(%p)\n", This
, ppIPSite
);
462 IOleInPlaceSite_AddRef(This
->ipsite
);
464 *ppIPSite
= This
->ipsite
;
468 static HRESULT WINAPI
OleDocumentView_GetDocument(IOleDocumentView
*iface
, IUnknown
**ppunk
)
470 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
471 TRACE("(%p)->(%p)\n", This
, ppunk
);
476 *ppunk
= (IUnknown
*)&This
->IHTMLDocument2_iface
;
477 IUnknown_AddRef(*ppunk
);
481 static HRESULT WINAPI
OleDocumentView_SetRect(IOleDocumentView
*iface
, LPRECT prcView
)
483 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
486 TRACE("(%p)->(%p)\n", This
, prcView
);
492 GetClientRect(This
->hwnd
, &rect
);
493 if(!EqualRect(prcView
, &rect
)) {
494 InvalidateRect(This
->hwnd
, NULL
, TRUE
);
495 SetWindowPos(This
->hwnd
, NULL
, prcView
->left
, prcView
->top
, prcView
->right
- prcView
->left
,
496 prcView
->bottom
- prcView
->top
, SWP_NOZORDER
| SWP_NOACTIVATE
);
503 static HRESULT WINAPI
OleDocumentView_GetRect(IOleDocumentView
*iface
, LPRECT prcView
)
505 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
507 TRACE("(%p)->(%p)\n", This
, prcView
);
512 GetClientRect(This
->hwnd
, prcView
);
513 MapWindowPoints(This
->hwnd
, GetParent(This
->hwnd
), (POINT
*)prcView
, 2);
517 static HRESULT WINAPI
OleDocumentView_SetRectComplex(IOleDocumentView
*iface
, LPRECT prcView
,
518 LPRECT prcHScroll
, LPRECT prcVScroll
, LPRECT prcSizeBox
)
520 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
521 FIXME("(%p)->(%p %p %p %p)\n", This
, prcView
, prcHScroll
, prcVScroll
, prcSizeBox
);
525 static HRESULT WINAPI
OleDocumentView_Show(IOleDocumentView
*iface
, BOOL fShow
)
527 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
530 TRACE("(%p)->(%x)\n", This
, fShow
);
533 if(!This
->ui_active
) {
534 hres
= activate_window(This
);
538 update_doc(This
, UPDATE_UI
);
539 ShowWindow(This
->hwnd
, SW_SHOW
);
541 ShowWindow(This
->hwnd
, SW_HIDE
);
543 if(This
->in_place_active
)
544 IOleInPlaceObjectWindowless_InPlaceDeactivate(&This
->IOleInPlaceObjectWindowless_iface
);
546 if(This
->ip_window
) {
547 IOleInPlaceUIWindow_Release(This
->ip_window
);
548 This
->ip_window
= NULL
;
555 static HRESULT WINAPI
OleDocumentView_UIActivate(IOleDocumentView
*iface
, BOOL fUIActivate
)
557 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
560 TRACE("(%p)->(%x)\n", This
, fUIActivate
);
563 IOleClientSite
*cs
= This
->client
;
564 IOleInPlaceSite
*ips
;
567 WARN("this->ipsite = NULL\n");
571 hres
= IOleClientSite_QueryInterface(cs
, &IID_IOleInPlaceSiteWindowless
, (void**)&ips
);
575 hres
= IOleClientSite_QueryInterface(cs
, &IID_IOleInPlaceSiteEx
, (void**)&ips
);
579 hres
= IOleClientSite_QueryInterface(cs
, &IID_IOleInPlaceSite
, (void**)&ips
);
583 WARN("this->ipsite = NULL\n");
584 return E_NOINTERFACE
;
589 IOleInPlaceSite_AddRef(This
->ipsite
);
590 This
->request_uiactivate
= FALSE
;
591 HTMLDocument_LockContainer(This
, TRUE
);
600 if(!This
->window_active
) {
601 hres
= activate_window(This
);
607 if(This
->nscontainer
)
608 nsIWebBrowserFocus_Activate(This
->nscontainer
->focus
);
611 update_doc(This
, UPDATE_UI
);
613 hres
= IOleInPlaceSite_OnUIActivate(This
->ipsite
);
614 if(SUCCEEDED(hres
)) {
615 call_set_active_object((IOleInPlaceUIWindow
*)This
->frame
, &This
->IOleInPlaceActiveObject_iface
);
617 FIXME("OnUIActivate failed: %08lx\n", hres
);
618 IOleInPlaceFrame_Release(This
->frame
);
620 This
->ui_active
= FALSE
;
625 hres
= IDocHostUIHandler_ShowUI(This
->hostui
,
626 This
->nscontainer
->usermode
== EDITMODE
? DOCHOSTUITYPE_AUTHOR
: DOCHOSTUITYPE_BROWSE
,
627 &This
->IOleInPlaceActiveObject_iface
, &This
->IOleCommandTarget_iface
,
628 This
->frame
, This
->ip_window
);
630 IDocHostUIHandler_HideUI(This
->hostui
);
634 call_set_active_object(This
->ip_window
, &This
->IOleInPlaceActiveObject_iface
);
636 SetRectEmpty(&rcBorderWidths
);
637 IOleInPlaceFrame_SetBorderSpace(This
->frame
, &rcBorderWidths
);
639 This
->ui_active
= TRUE
;
642 nsIWebBrowserFocus_Deactivate(This
->nscontainer
->focus
);
643 if(This
->ui_active
) {
644 This
->ui_active
= FALSE
;
646 call_set_active_object(This
->ip_window
, NULL
);
648 call_set_active_object((IOleInPlaceUIWindow
*)This
->frame
, NULL
);
650 IDocHostUIHandler_HideUI(This
->hostui
);
652 IOleInPlaceSite_OnUIDeactivate(This
->ipsite
, FALSE
);
658 static HRESULT WINAPI
OleDocumentView_Open(IOleDocumentView
*iface
)
660 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
661 FIXME("(%p)\n", This
);
665 static HRESULT WINAPI
OleDocumentView_CloseView(IOleDocumentView
*iface
, DWORD dwReserved
)
667 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
668 TRACE("(%p)->(%lx)\n", This
, dwReserved
);
671 WARN("dwReserved = %ld\n", dwReserved
);
673 IOleDocumentView_Show(iface
, FALSE
);
677 static HRESULT WINAPI
OleDocumentView_SaveViewState(IOleDocumentView
*iface
, IStream
*pstm
)
679 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
680 FIXME("(%p)->(%p)\n", This
, pstm
);
684 static HRESULT WINAPI
OleDocumentView_ApplyViewState(IOleDocumentView
*iface
, IStream
*pstm
)
686 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
687 FIXME("(%p)->(%p)\n", This
, pstm
);
691 static HRESULT WINAPI
OleDocumentView_Clone(IOleDocumentView
*iface
, IOleInPlaceSite
*pIPSiteNew
,
692 IOleDocumentView
**ppViewNew
)
694 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
695 FIXME("(%p)->(%p %p)\n", This
, pIPSiteNew
, ppViewNew
);
699 static const IOleDocumentViewVtbl OleDocumentViewVtbl
= {
700 OleDocumentView_QueryInterface
,
701 OleDocumentView_AddRef
,
702 OleDocumentView_Release
,
703 OleDocumentView_SetInPlaceSite
,
704 OleDocumentView_GetInPlaceSite
,
705 OleDocumentView_GetDocument
,
706 OleDocumentView_SetRect
,
707 OleDocumentView_GetRect
,
708 OleDocumentView_SetRectComplex
,
709 OleDocumentView_Show
,
710 OleDocumentView_UIActivate
,
711 OleDocumentView_Open
,
712 OleDocumentView_CloseView
,
713 OleDocumentView_SaveViewState
,
714 OleDocumentView_ApplyViewState
,
715 OleDocumentView_Clone
718 /**********************************************************
719 * IViewObject implementation
722 static inline HTMLDocumentObj
*impl_from_IViewObjectEx(IViewObjectEx
*iface
)
724 return CONTAINING_RECORD(iface
, HTMLDocumentObj
, IViewObjectEx_iface
);
727 static HRESULT WINAPI
ViewObject_QueryInterface(IViewObjectEx
*iface
, REFIID riid
, void **ppv
)
729 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
730 return htmldoc_query_interface(&This
->basedoc
, riid
, ppv
);
733 static ULONG WINAPI
ViewObject_AddRef(IViewObjectEx
*iface
)
735 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
736 return htmldoc_addref(&This
->basedoc
);
739 static ULONG WINAPI
ViewObject_Release(IViewObjectEx
*iface
)
741 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
742 return htmldoc_release(&This
->basedoc
);
745 static HRESULT WINAPI
ViewObject_Draw(IViewObjectEx
*iface
, DWORD dwDrawAspect
, LONG lindex
, void *pvAspect
,
746 DVTARGETDEVICE
*ptd
, HDC hdcTargetDev
, HDC hdcDraw
, LPCRECTL lprcBounds
,
747 LPCRECTL lprcWBounds
, BOOL (CALLBACK
*pfnContinue
)(ULONG_PTR dwContinue
), ULONG_PTR dwContinue
)
749 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
750 FIXME("(%p)->(%ld %ld %p %p %p %p %p %p %p %Id)\n", This
, dwDrawAspect
, lindex
, pvAspect
,
751 ptd
, hdcTargetDev
, hdcDraw
, lprcBounds
, lprcWBounds
, pfnContinue
, dwContinue
);
755 static HRESULT WINAPI
ViewObject_GetColorSet(IViewObjectEx
*iface
, DWORD dwDrawAspect
, LONG lindex
, void *pvAspect
,
756 DVTARGETDEVICE
*ptd
, HDC hicTargetDev
, LOGPALETTE
**ppColorSet
)
758 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
759 FIXME("(%p)->(%ld %ld %p %p %p %p)\n", This
, dwDrawAspect
, lindex
, pvAspect
, ptd
, hicTargetDev
, ppColorSet
);
763 static HRESULT WINAPI
ViewObject_Freeze(IViewObjectEx
*iface
, DWORD dwDrawAspect
, LONG lindex
,
764 void *pvAspect
, DWORD
*pdwFreeze
)
766 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
767 FIXME("(%p)->(%ld %ld %p %p)\n", This
, dwDrawAspect
, lindex
, pvAspect
, pdwFreeze
);
771 static HRESULT WINAPI
ViewObject_Unfreeze(IViewObjectEx
*iface
, DWORD dwFreeze
)
773 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
774 FIXME("(%p)->(%ld)\n", This
, dwFreeze
);
778 static HRESULT WINAPI
ViewObject_SetAdvise(IViewObjectEx
*iface
, DWORD aspects
, DWORD advf
, IAdviseSink
*pAdvSink
)
780 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
782 TRACE("(%p)->(%ld %ld %p)\n", This
, aspects
, advf
, pAdvSink
);
784 if(aspects
!= DVASPECT_CONTENT
|| advf
!= ADVF_PRIMEFIRST
)
785 FIXME("unsupported arguments\n");
788 IAdviseSink_Release(This
->view_sink
);
790 IAdviseSink_AddRef(pAdvSink
);
792 This
->view_sink
= pAdvSink
;
796 static HRESULT WINAPI
ViewObject_GetAdvise(IViewObjectEx
*iface
, DWORD
*pAspects
, DWORD
*pAdvf
, IAdviseSink
**ppAdvSink
)
798 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
799 FIXME("(%p)->(%p %p %p)\n", This
, pAspects
, pAdvf
, ppAdvSink
);
803 static HRESULT WINAPI
ViewObject_GetExtent(IViewObjectEx
*iface
, DWORD dwDrawAspect
, LONG lindex
,
804 DVTARGETDEVICE
* ptd
, LPSIZEL lpsizel
)
806 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
807 FIXME("(%p)->(%ld %ld %p %p)\n", This
, dwDrawAspect
, lindex
, ptd
, lpsizel
);
811 static HRESULT WINAPI
ViewObject_GetRect(IViewObjectEx
*iface
, DWORD dwAspect
, LPRECTL pRect
)
813 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
814 FIXME("(%p)->(%ld %p)\n", This
, dwAspect
, pRect
);
818 static HRESULT WINAPI
ViewObject_GetViewStatus(IViewObjectEx
*iface
, DWORD
*pdwStatus
)
820 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
821 FIXME("(%p)->(%p)\n", This
, pdwStatus
);
825 static HRESULT WINAPI
ViewObject_QueryHitPoint(IViewObjectEx
* iface
, DWORD dwAspect
,
826 LPCRECT pRectBounds
, POINT ptlLoc
, LONG lCloseHint
, DWORD
*pHitResult
)
828 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
829 FIXME("(%p)->(%ld %p (%ld %ld) %ld %p)\n", This
, dwAspect
, pRectBounds
, ptlLoc
.x
,
830 ptlLoc
.y
, lCloseHint
, pHitResult
);
834 static HRESULT WINAPI
ViewObject_QueryHitRect(IViewObjectEx
*iface
, DWORD dwAspect
,
835 LPCRECT pRectBounds
, LPCRECT pRectLoc
, LONG lCloseHint
, DWORD
*pHitResult
)
837 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
838 FIXME("(%p)->(%ld %p %p %ld %p)\n", This
, dwAspect
, pRectBounds
, pRectLoc
, lCloseHint
, pHitResult
);
842 static HRESULT WINAPI
ViewObject_GetNaturalExtent(IViewObjectEx
*iface
, DWORD dwAspect
, LONG lindex
,
843 DVTARGETDEVICE
*ptd
, HDC hicTargetDev
, DVEXTENTINFO
*pExtentInfo
, LPSIZEL pSizel
)
845 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
846 FIXME("(%p)->(%ld %ld %p %p %p %p\n", This
, dwAspect
,lindex
, ptd
,
847 hicTargetDev
, pExtentInfo
, pSizel
);
851 static const IViewObjectExVtbl ViewObjectVtbl
= {
852 ViewObject_QueryInterface
,
856 ViewObject_GetColorSet
,
859 ViewObject_SetAdvise
,
860 ViewObject_GetAdvise
,
861 ViewObject_GetExtent
,
863 ViewObject_GetViewStatus
,
864 ViewObject_QueryHitPoint
,
865 ViewObject_QueryHitRect
,
866 ViewObject_GetNaturalExtent
869 static inline HTMLDocumentObj
*impl_from_IWindowForBindingUI(IWindowForBindingUI
*iface
)
871 return CONTAINING_RECORD(iface
, HTMLDocumentObj
, IWindowForBindingUI_iface
);
874 static HRESULT WINAPI
WindowForBindingUI_QueryInterface(IWindowForBindingUI
*iface
, REFIID riid
, void **ppv
)
876 HTMLDocumentObj
*This
= impl_from_IWindowForBindingUI(iface
);
878 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
879 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
880 *ppv
= &This
->IWindowForBindingUI_iface
;
881 }else if(IsEqualGUID(&IID_IWindowForBindingUI
, riid
)) {
882 TRACE("(%p)->(IID_IWindowForBindingUI %p)\n", This
, ppv
);
883 *ppv
= &This
->IWindowForBindingUI_iface
;
885 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
887 return E_NOINTERFACE
;
890 IUnknown_AddRef((IUnknown
*)*ppv
);
894 static ULONG WINAPI
WindowForBindingUI_AddRef(IWindowForBindingUI
*iface
)
896 HTMLDocumentObj
*This
= impl_from_IWindowForBindingUI(iface
);
897 return htmldoc_addref(&This
->basedoc
);
900 static ULONG WINAPI
WindowForBindingUI_Release(IWindowForBindingUI
*iface
)
902 HTMLDocumentObj
*This
= impl_from_IWindowForBindingUI(iface
);
903 return htmldoc_release(&This
->basedoc
);
906 static HRESULT WINAPI
WindowForBindingUI_GetWindow(IWindowForBindingUI
*iface
, REFGUID rguidReason
, HWND
*phwnd
)
908 HTMLDocumentObj
*This
= impl_from_IWindowForBindingUI(iface
);
910 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(rguidReason
), phwnd
);
916 static const IWindowForBindingUIVtbl WindowForBindingUIVtbl
= {
917 WindowForBindingUI_QueryInterface
,
918 WindowForBindingUI_AddRef
,
919 WindowForBindingUI_Release
,
920 WindowForBindingUI_GetWindow
923 void HTMLDocument_View_Init(HTMLDocumentObj
*doc
)
925 doc
->IOleDocumentView_iface
.lpVtbl
= &OleDocumentViewVtbl
;
926 doc
->IViewObjectEx_iface
.lpVtbl
= &ViewObjectVtbl
;
927 doc
->IWindowForBindingUI_iface
.lpVtbl
= &WindowForBindingUIVtbl
;