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) %x\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: %08x\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: %08x\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: %08x\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: %08x\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 (%d,%d)\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)->(%d %d %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
->basedoc
.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
->basedoc
.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
,
616 &This
->basedoc
.IOleInPlaceActiveObject_iface
);
618 FIXME("OnUIActivate failed: %08x\n", hres
);
619 IOleInPlaceFrame_Release(This
->frame
);
621 This
->ui_active
= FALSE
;
626 hres
= IDocHostUIHandler_ShowUI(This
->hostui
,
627 This
->nscontainer
->usermode
== EDITMODE
? DOCHOSTUITYPE_AUTHOR
: DOCHOSTUITYPE_BROWSE
,
628 &This
->basedoc
.IOleInPlaceActiveObject_iface
, &This
->basedoc
.IOleCommandTarget_iface
,
629 This
->frame
, This
->ip_window
);
631 IDocHostUIHandler_HideUI(This
->hostui
);
635 call_set_active_object(This
->ip_window
, &This
->basedoc
.IOleInPlaceActiveObject_iface
);
637 SetRectEmpty(&rcBorderWidths
);
638 IOleInPlaceFrame_SetBorderSpace(This
->frame
, &rcBorderWidths
);
640 This
->ui_active
= TRUE
;
643 nsIWebBrowserFocus_Deactivate(This
->nscontainer
->focus
);
644 if(This
->ui_active
) {
645 This
->ui_active
= FALSE
;
647 call_set_active_object(This
->ip_window
, NULL
);
649 call_set_active_object((IOleInPlaceUIWindow
*)This
->frame
, NULL
);
651 IDocHostUIHandler_HideUI(This
->hostui
);
653 IOleInPlaceSite_OnUIDeactivate(This
->ipsite
, FALSE
);
659 static HRESULT WINAPI
OleDocumentView_Open(IOleDocumentView
*iface
)
661 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
662 FIXME("(%p)\n", This
);
666 static HRESULT WINAPI
OleDocumentView_CloseView(IOleDocumentView
*iface
, DWORD dwReserved
)
668 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
669 TRACE("(%p)->(%x)\n", This
, dwReserved
);
672 WARN("dwReserved = %d\n", dwReserved
);
674 IOleDocumentView_Show(iface
, FALSE
);
678 static HRESULT WINAPI
OleDocumentView_SaveViewState(IOleDocumentView
*iface
, IStream
*pstm
)
680 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
681 FIXME("(%p)->(%p)\n", This
, pstm
);
685 static HRESULT WINAPI
OleDocumentView_ApplyViewState(IOleDocumentView
*iface
, IStream
*pstm
)
687 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
688 FIXME("(%p)->(%p)\n", This
, pstm
);
692 static HRESULT WINAPI
OleDocumentView_Clone(IOleDocumentView
*iface
, IOleInPlaceSite
*pIPSiteNew
,
693 IOleDocumentView
**ppViewNew
)
695 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
696 FIXME("(%p)->(%p %p)\n", This
, pIPSiteNew
, ppViewNew
);
700 static const IOleDocumentViewVtbl OleDocumentViewVtbl
= {
701 OleDocumentView_QueryInterface
,
702 OleDocumentView_AddRef
,
703 OleDocumentView_Release
,
704 OleDocumentView_SetInPlaceSite
,
705 OleDocumentView_GetInPlaceSite
,
706 OleDocumentView_GetDocument
,
707 OleDocumentView_SetRect
,
708 OleDocumentView_GetRect
,
709 OleDocumentView_SetRectComplex
,
710 OleDocumentView_Show
,
711 OleDocumentView_UIActivate
,
712 OleDocumentView_Open
,
713 OleDocumentView_CloseView
,
714 OleDocumentView_SaveViewState
,
715 OleDocumentView_ApplyViewState
,
716 OleDocumentView_Clone
719 /**********************************************************
720 * IViewObject implementation
723 static inline HTMLDocumentObj
*impl_from_IViewObjectEx(IViewObjectEx
*iface
)
725 return CONTAINING_RECORD(iface
, HTMLDocumentObj
, IViewObjectEx_iface
);
728 static HRESULT WINAPI
ViewObject_QueryInterface(IViewObjectEx
*iface
, REFIID riid
, void **ppv
)
730 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
731 return htmldoc_query_interface(&This
->basedoc
, riid
, ppv
);
734 static ULONG WINAPI
ViewObject_AddRef(IViewObjectEx
*iface
)
736 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
737 return htmldoc_addref(&This
->basedoc
);
740 static ULONG WINAPI
ViewObject_Release(IViewObjectEx
*iface
)
742 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
743 return htmldoc_release(&This
->basedoc
);
746 static HRESULT WINAPI
ViewObject_Draw(IViewObjectEx
*iface
, DWORD dwDrawAspect
, LONG lindex
, void *pvAspect
,
747 DVTARGETDEVICE
*ptd
, HDC hdcTargetDev
, HDC hdcDraw
, LPCRECTL lprcBounds
,
748 LPCRECTL lprcWBounds
, BOOL (CALLBACK
*pfnContinue
)(ULONG_PTR dwContinue
), ULONG_PTR dwContinue
)
750 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
751 FIXME("(%p)->(%d %d %p %p %p %p %p %p %p %ld)\n", This
, dwDrawAspect
, lindex
, pvAspect
,
752 ptd
, hdcTargetDev
, hdcDraw
, lprcBounds
, lprcWBounds
, pfnContinue
, dwContinue
);
756 static HRESULT WINAPI
ViewObject_GetColorSet(IViewObjectEx
*iface
, DWORD dwDrawAspect
, LONG lindex
, void *pvAspect
,
757 DVTARGETDEVICE
*ptd
, HDC hicTargetDev
, LOGPALETTE
**ppColorSet
)
759 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
760 FIXME("(%p)->(%d %d %p %p %p %p)\n", This
, dwDrawAspect
, lindex
, pvAspect
, ptd
, hicTargetDev
, ppColorSet
);
764 static HRESULT WINAPI
ViewObject_Freeze(IViewObjectEx
*iface
, DWORD dwDrawAspect
, LONG lindex
,
765 void *pvAspect
, DWORD
*pdwFreeze
)
767 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
768 FIXME("(%p)->(%d %d %p %p)\n", This
, dwDrawAspect
, lindex
, pvAspect
, pdwFreeze
);
772 static HRESULT WINAPI
ViewObject_Unfreeze(IViewObjectEx
*iface
, DWORD dwFreeze
)
774 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
775 FIXME("(%p)->(%d)\n", This
, dwFreeze
);
779 static HRESULT WINAPI
ViewObject_SetAdvise(IViewObjectEx
*iface
, DWORD aspects
, DWORD advf
, IAdviseSink
*pAdvSink
)
781 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
783 TRACE("(%p)->(%d %d %p)\n", This
, aspects
, advf
, pAdvSink
);
785 if(aspects
!= DVASPECT_CONTENT
|| advf
!= ADVF_PRIMEFIRST
)
786 FIXME("unsupported arguments\n");
789 IAdviseSink_Release(This
->view_sink
);
791 IAdviseSink_AddRef(pAdvSink
);
793 This
->view_sink
= pAdvSink
;
797 static HRESULT WINAPI
ViewObject_GetAdvise(IViewObjectEx
*iface
, DWORD
*pAspects
, DWORD
*pAdvf
, IAdviseSink
**ppAdvSink
)
799 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
800 FIXME("(%p)->(%p %p %p)\n", This
, pAspects
, pAdvf
, ppAdvSink
);
804 static HRESULT WINAPI
ViewObject_GetExtent(IViewObjectEx
*iface
, DWORD dwDrawAspect
, LONG lindex
,
805 DVTARGETDEVICE
* ptd
, LPSIZEL lpsizel
)
807 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
808 FIXME("(%p)->(%d %d %p %p)\n", This
, dwDrawAspect
, lindex
, ptd
, lpsizel
);
812 static HRESULT WINAPI
ViewObject_GetRect(IViewObjectEx
*iface
, DWORD dwAspect
, LPRECTL pRect
)
814 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
815 FIXME("(%p)->(%d %p)\n", This
, dwAspect
, pRect
);
819 static HRESULT WINAPI
ViewObject_GetViewStatus(IViewObjectEx
*iface
, DWORD
*pdwStatus
)
821 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
822 FIXME("(%p)->(%p)\n", This
, pdwStatus
);
826 static HRESULT WINAPI
ViewObject_QueryHitPoint(IViewObjectEx
* iface
, DWORD dwAspect
,
827 LPCRECT pRectBounds
, POINT ptlLoc
, LONG lCloseHint
, DWORD
*pHitResult
)
829 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
830 FIXME("(%p)->(%d %p (%d %d) %d %p)\n", This
, dwAspect
, pRectBounds
, ptlLoc
.x
,
831 ptlLoc
.y
, lCloseHint
, pHitResult
);
835 static HRESULT WINAPI
ViewObject_QueryHitRect(IViewObjectEx
*iface
, DWORD dwAspect
,
836 LPCRECT pRectBounds
, LPCRECT pRectLoc
, LONG lCloseHint
, DWORD
*pHitResult
)
838 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
839 FIXME("(%p)->(%d %p %p %d %p)\n", This
, dwAspect
, pRectBounds
, pRectLoc
, lCloseHint
, pHitResult
);
843 static HRESULT WINAPI
ViewObject_GetNaturalExtent(IViewObjectEx
*iface
, DWORD dwAspect
, LONG lindex
,
844 DVTARGETDEVICE
*ptd
, HDC hicTargetDev
, DVEXTENTINFO
*pExtentInfo
, LPSIZEL pSizel
)
846 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
847 FIXME("(%p)->(%d %d %p %p %p %p\n", This
, dwAspect
,lindex
, ptd
,
848 hicTargetDev
, pExtentInfo
, pSizel
);
852 static const IViewObjectExVtbl ViewObjectVtbl
= {
853 ViewObject_QueryInterface
,
857 ViewObject_GetColorSet
,
860 ViewObject_SetAdvise
,
861 ViewObject_GetAdvise
,
862 ViewObject_GetExtent
,
864 ViewObject_GetViewStatus
,
865 ViewObject_QueryHitPoint
,
866 ViewObject_QueryHitRect
,
867 ViewObject_GetNaturalExtent
870 static inline HTMLDocumentObj
*impl_from_IWindowForBindingUI(IWindowForBindingUI
*iface
)
872 return CONTAINING_RECORD(iface
, HTMLDocumentObj
, IWindowForBindingUI_iface
);
875 static HRESULT WINAPI
WindowForBindingUI_QueryInterface(IWindowForBindingUI
*iface
, REFIID riid
, void **ppv
)
877 HTMLDocumentObj
*This
= impl_from_IWindowForBindingUI(iface
);
879 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
880 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
881 *ppv
= &This
->IWindowForBindingUI_iface
;
882 }else if(IsEqualGUID(&IID_IWindowForBindingUI
, riid
)) {
883 TRACE("(%p)->(IID_IWindowForBindingUI %p)\n", This
, ppv
);
884 *ppv
= &This
->IWindowForBindingUI_iface
;
886 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
888 return E_NOINTERFACE
;
891 IUnknown_AddRef((IUnknown
*)*ppv
);
895 static ULONG WINAPI
WindowForBindingUI_AddRef(IWindowForBindingUI
*iface
)
897 HTMLDocumentObj
*This
= impl_from_IWindowForBindingUI(iface
);
898 return htmldoc_addref(&This
->basedoc
);
901 static ULONG WINAPI
WindowForBindingUI_Release(IWindowForBindingUI
*iface
)
903 HTMLDocumentObj
*This
= impl_from_IWindowForBindingUI(iface
);
904 return htmldoc_release(&This
->basedoc
);
907 static HRESULT WINAPI
WindowForBindingUI_GetWindow(IWindowForBindingUI
*iface
, REFGUID rguidReason
, HWND
*phwnd
)
909 HTMLDocumentObj
*This
= impl_from_IWindowForBindingUI(iface
);
911 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(rguidReason
), phwnd
);
917 static const IWindowForBindingUIVtbl WindowForBindingUIVtbl
= {
918 WindowForBindingUI_QueryInterface
,
919 WindowForBindingUI_AddRef
,
920 WindowForBindingUI_Release
,
921 WindowForBindingUI_GetWindow
924 void HTMLDocument_View_Init(HTMLDocumentObj
*doc
)
926 doc
->IOleDocumentView_iface
.lpVtbl
= &OleDocumentViewVtbl
;
927 doc
->IViewObjectEx_iface
.lpVtbl
= &ViewObjectVtbl
;
928 doc
->IWindowForBindingUI_iface
.lpVtbl
= &WindowForBindingUIVtbl
;