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
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;
53 static void paint_document(HTMLDocumentObj
*This
)
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 EndPaint(This
->hwnd
, &ps
);
69 static void activate_gecko(NSContainer
*This
)
71 TRACE("(%p) %p\n", This
, This
->window
);
73 SetParent(This
->hwnd
, This
->doc
->hwnd
);
74 ShowWindow(This
->hwnd
, SW_SHOW
);
76 nsIBaseWindow_SetVisibility(This
->window
, TRUE
);
77 nsIBaseWindow_SetEnabled(This
->window
, TRUE
);
80 void update_doc(HTMLDocumentObj
*This
, DWORD flags
)
82 if(!This
->update
&& This
->hwnd
)
83 SetTimer(This
->hwnd
, TIMER_ID
, 100, NULL
);
85 This
->update
|= flags
;
88 void update_title(HTMLDocumentObj
*This
)
90 IOleCommandTarget
*olecmd
;
93 if(!(This
->update
& UPDATE_TITLE
))
96 This
->update
&= ~UPDATE_TITLE
;
101 hres
= IOleClientSite_QueryInterface(This
->client
, &IID_IOleCommandTarget
, (void**)&olecmd
);
102 if(SUCCEEDED(hres
)) {
106 V_VT(&title
) = VT_BSTR
;
107 V_BSTR(&title
) = SysAllocString(empty
);
108 IOleCommandTarget_Exec(olecmd
, NULL
, OLECMDID_SETTITLE
, OLECMDEXECOPT_DONTPROMPTUSER
,
110 SysFreeString(V_BSTR(&title
));
112 IOleCommandTarget_Release(olecmd
);
116 static LRESULT
on_timer(HTMLDocumentObj
*This
)
118 TRACE("(%p) %x\n", This
, This
->update
);
120 KillTimer(This
->hwnd
, TIMER_ID
);
125 if(This
->update
& UPDATE_UI
) {
127 IDocHostUIHandler_UpdateUI(This
->hostui
);
130 IOleCommandTarget
*cmdtrg
;
133 hres
= IOleClientSite_QueryInterface(This
->client
, &IID_IOleCommandTarget
,
135 if(SUCCEEDED(hres
)) {
136 IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_UPDATECOMMANDS
,
137 OLECMDEXECOPT_DONTPROMPTUSER
, NULL
, NULL
);
138 IOleCommandTarget_Release(cmdtrg
);
148 void notif_focus(HTMLDocumentObj
*This
)
150 IOleControlSite
*site
;
156 hres
= IOleClientSite_QueryInterface(This
->client
, &IID_IOleControlSite
, (void**)&site
);
160 IOleControlSite_OnFocus(site
, This
->focus
);
161 IOleControlSite_Release(site
);
164 static LRESULT WINAPI
serverwnd_proc(HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
166 HTMLDocumentObj
*This
;
168 static const WCHAR wszTHIS
[] = {'T','H','I','S',0};
170 if(msg
== WM_CREATE
) {
171 This
= *(HTMLDocumentObj
**)lParam
;
172 SetPropW(hwnd
, wszTHIS
, This
);
174 This
= GetPropW(hwnd
, wszTHIS
);
182 paint_document(This
);
185 TRACE("(%p)->(WM_SIZE)\n", This
);
186 if(This
->nscontainer
) {
189 if(!(This
->hostinfo
.dwFlags
& (DOCHOSTUIFLAG_NO3DOUTERBORDER
|DOCHOSTUIFLAG_NO3DBORDER
))) {
190 ew
= GetSystemMetrics(SM_CXEDGE
);
191 eh
= GetSystemMetrics(SM_CYEDGE
);
194 SetWindowPos(This
->nscontainer
->hwnd
, NULL
, ew
, eh
,
195 LOWORD(lParam
) - 2*ew
, HIWORD(lParam
) - 2*eh
,
196 SWP_NOZORDER
| SWP_NOACTIVATE
);
200 return on_timer(This
);
202 TRACE("(%p) WM_SETFOCUS\n", This
);
203 nsIWebBrowserFocus_Activate(This
->nscontainer
->focus
);
205 case WM_MOUSEACTIVATE
:
209 return DefWindowProcW(hwnd
, msg
, wParam
, lParam
);
212 static void register_serverwnd_class(void)
214 static WNDCLASSEXW wndclass
= {
218 0, 0, NULL
, NULL
, NULL
, NULL
, NULL
,
219 wszInternetExplorer_Server
,
222 wndclass
.hInstance
= hInst
;
223 serverwnd_class
= RegisterClassExW(&wndclass
);
226 static HRESULT
activate_window(HTMLDocumentObj
*This
)
228 IOleInPlaceFrame
*pIPFrame
;
229 IOleCommandTarget
*cmdtrg
;
230 IOleInPlaceSiteEx
*ipsiteex
;
231 RECT posrect
, cliprect
;
232 OLEINPLACEFRAMEINFO frameinfo
;
237 register_serverwnd_class();
239 hres
= IOleInPlaceSite_CanInPlaceActivate(This
->ipsite
);
241 WARN("CanInPlaceActivate returned: %08x\n", hres
);
242 return FAILED(hres
) ? hres
: E_FAIL
;
245 frameinfo
.cb
= sizeof(OLEINPLACEFRAMEINFO
);
246 hres
= IOleInPlaceSite_GetWindowContext(This
->ipsite
, &pIPFrame
, &This
->ip_window
,
247 &posrect
, &cliprect
, &frameinfo
);
249 WARN("GetWindowContext failed: %08x\n", hres
);
253 TRACE("got window context: %p %p %s %s {%d %x %p %p %d}\n",
254 pIPFrame
, This
->ip_window
, wine_dbgstr_rect(&posrect
), wine_dbgstr_rect(&cliprect
),
255 frameinfo
.cb
, frameinfo
.fMDIApp
, frameinfo
.hwndFrame
, frameinfo
.haccel
, frameinfo
.cAccelEntries
);
257 hres
= IOleInPlaceSite_GetWindow(This
->ipsite
, &parent_hwnd
);
259 WARN("GetWindow failed: %08x\n", hres
);
263 TRACE("got parent window %p\n", parent_hwnd
);
266 if(GetParent(This
->hwnd
) != parent_hwnd
)
267 SetParent(This
->hwnd
, parent_hwnd
);
268 SetWindowPos(This
->hwnd
, HWND_TOP
,
269 posrect
.left
, posrect
.top
, posrect
.right
-posrect
.left
, posrect
.bottom
-posrect
.top
,
270 SWP_NOACTIVATE
| SWP_SHOWWINDOW
);
272 CreateWindowExW(0, wszInternetExplorer_Server
, NULL
,
273 WS_CHILD
| WS_CLIPSIBLINGS
| WS_CLIPCHILDREN
,
274 posrect
.left
, posrect
.top
, posrect
.right
-posrect
.left
, posrect
.bottom
-posrect
.top
,
275 parent_hwnd
, NULL
, hInst
, This
);
277 TRACE("Created window %p\n", This
->hwnd
);
279 SetWindowPos(This
->hwnd
, NULL
, 0, 0, 0, 0,
280 SWP_NOSIZE
| SWP_NOMOVE
| SWP_NOZORDER
| SWP_NOREDRAW
| SWP_NOACTIVATE
| SWP_SHOWWINDOW
);
281 RedrawWindow(This
->hwnd
, NULL
, NULL
, RDW_INVALIDATE
| RDW_NOERASE
| RDW_ALLCHILDREN
);
282 SetTimer(This
->hwnd
, TIMER_ID
, 100, NULL
);
285 if(This
->nscontainer
)
286 activate_gecko(This
->nscontainer
);
288 This
->in_place_active
= TRUE
;
289 hres
= IOleInPlaceSite_QueryInterface(This
->ipsite
, &IID_IOleInPlaceSiteEx
, (void**)&ipsiteex
);
290 if(SUCCEEDED(hres
)) {
293 hres
= IOleInPlaceSiteEx_OnInPlaceActivateEx(ipsiteex
, &redraw
, 0);
294 IOleInPlaceSiteEx_Release(ipsiteex
);
296 FIXME("unsupported redraw\n");
298 hres
= IOleInPlaceSite_OnInPlaceActivate(This
->ipsite
);
301 WARN("OnInPlaceActivate failed: %08x\n", hres
);
302 This
->in_place_active
= FALSE
;
306 hres
= IOleClientSite_QueryInterface(This
->client
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
307 if(SUCCEEDED(hres
)) {
310 IOleInPlaceFrame_SetStatusText(pIPFrame
, NULL
);
314 IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_SETPROGRESSMAX
,
315 OLECMDEXECOPT_DONTPROMPTUSER
, &var
, NULL
);
316 IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_SETPROGRESSPOS
,
317 OLECMDEXECOPT_DONTPROMPTUSER
, &var
, NULL
);
319 IOleCommandTarget_Release(cmdtrg
);
323 IOleInPlaceFrame_Release(This
->frame
);
324 This
->frame
= pIPFrame
;
326 if(!This
->request_uiactivate
) {
327 hres
= IOleInPlaceSite_QueryInterface(This
->ipsite
, &IID_IOleInPlaceSiteEx
, (void**)&ipsiteex
);
328 if(SUCCEEDED(hres
)) {
329 IOleInPlaceSiteEx_RequestUIActivate(ipsiteex
);
330 IOleInPlaceSiteEx_Release(ipsiteex
);
334 This
->window_active
= TRUE
;
339 static LRESULT WINAPI
tooltips_proc(HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
341 tooltip_data
*data
= GetPropW(hwnd
, wszTooltipData
);
343 TRACE("%d %p\n", msg
, data
);
345 if(msg
== TTM_WINDOWFROMPOINT
) {
347 POINT
*pt
= (POINT
*)lParam
;
349 TRACE("TTM_WINDOWFROMPOINT (%d,%d)\n", pt
->x
, pt
->y
);
351 GetWindowRect(data
->doc
->hwnd
, &rect
);
353 if(rect
.left
<= pt
->x
&& pt
->x
<= rect
.right
354 && rect
.top
<= pt
->y
&& pt
->y
<= rect
.bottom
)
355 return (LPARAM
)data
->doc
->hwnd
;
358 return CallWindowProcW(data
->proc
, hwnd
, msg
, wParam
, lParam
);
361 static void create_tooltips_window(HTMLDocumentObj
*This
)
363 tooltip_data
*data
= heap_alloc(sizeof(*data
));
365 This
->tooltips_hwnd
= CreateWindowExW(0, TOOLTIPS_CLASSW
, NULL
, TTS_NOPREFIX
| WS_POPUP
,
366 CW_USEDEFAULT
, CW_USEDEFAULT
, 10, 10, This
->hwnd
, NULL
, hInst
, NULL
);
369 data
->proc
= (WNDPROC
)GetWindowLongPtrW(This
->tooltips_hwnd
, GWLP_WNDPROC
);
371 SetPropW(This
->tooltips_hwnd
, wszTooltipData
, data
);
373 SetWindowLongPtrW(This
->tooltips_hwnd
, GWLP_WNDPROC
, (LONG_PTR
)tooltips_proc
);
375 SetWindowPos(This
->tooltips_hwnd
, HWND_TOPMOST
,0, 0, 0, 0,
376 SWP_NOMOVE
| SWP_NOSIZE
| SWP_NOACTIVATE
);
380 void show_tooltip(HTMLDocumentObj
*This
, DWORD x
, DWORD y
, LPCWSTR text
)
382 TTTOOLINFOW toolinfo
= {
383 sizeof(TTTOOLINFOW
), 0, This
->hwnd
, 0xdeadbeef,
384 {x
>2 ? x
-2 : 0, y
>0 ? y
-2 : 0, x
+2, y
+2}, /* FIXME */
385 NULL
, (LPWSTR
)text
, 0};
386 MSG msg
= {This
->hwnd
, WM_MOUSEMOVE
, 0, MAKELPARAM(x
,y
), 0, {x
,y
}};
388 TRACE("(%p)->(%d %d %s)\n", This
, x
, y
, debugstr_w(text
));
390 if(!This
->tooltips_hwnd
)
391 create_tooltips_window(This
);
393 SendMessageW(This
->tooltips_hwnd
, TTM_ADDTOOLW
, 0, (LPARAM
)&toolinfo
);
394 SendMessageW(This
->tooltips_hwnd
, TTM_ACTIVATE
, TRUE
, 0);
395 SendMessageW(This
->tooltips_hwnd
, TTM_RELAYEVENT
, 0, (LPARAM
)&msg
);
398 void hide_tooltip(HTMLDocumentObj
*This
)
400 TTTOOLINFOW toolinfo
= {
401 sizeof(TTTOOLINFOW
), 0, This
->hwnd
, 0xdeadbeef,
402 {0,0,0,0}, NULL
, NULL
, 0};
404 TRACE("(%p)\n", This
);
406 SendMessageW(This
->tooltips_hwnd
, TTM_DELTOOLW
, 0, (LPARAM
)&toolinfo
);
407 SendMessageW(This
->tooltips_hwnd
, TTM_ACTIVATE
, FALSE
, 0);
410 HRESULT
call_set_active_object(IOleInPlaceUIWindow
*window
, IOleInPlaceActiveObject
*act_obj
)
412 static WCHAR html_documentW
[30];
414 if(act_obj
&& !html_documentW
[0])
415 LoadStringW(hInst
, IDS_HTMLDOCUMENT
, html_documentW
, ARRAY_SIZE(html_documentW
));
417 return IOleInPlaceUIWindow_SetActiveObject(window
, act_obj
, act_obj
? html_documentW
: NULL
);
420 /**********************************************************
421 * IOleDocumentView implementation
424 static inline HTMLDocumentObj
*impl_from_IOleDocumentView(IOleDocumentView
*iface
)
426 return CONTAINING_RECORD(iface
, HTMLDocumentObj
, IOleDocumentView_iface
);
429 static HRESULT WINAPI
OleDocumentView_QueryInterface(IOleDocumentView
*iface
, REFIID riid
, void **ppvObject
)
431 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
432 return htmldoc_query_interface(&This
->basedoc
, riid
, ppvObject
);
435 static ULONG WINAPI
OleDocumentView_AddRef(IOleDocumentView
*iface
)
437 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
438 return htmldoc_addref(&This
->basedoc
);
441 static ULONG WINAPI
OleDocumentView_Release(IOleDocumentView
*iface
)
443 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
444 return htmldoc_release(&This
->basedoc
);
447 static HRESULT WINAPI
OleDocumentView_SetInPlaceSite(IOleDocumentView
*iface
, IOleInPlaceSite
*pIPSite
)
449 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
450 TRACE("(%p)->(%p)\n", This
, pIPSite
);
453 IOleInPlaceSite_AddRef(pIPSite
);
456 IOleInPlaceSite_Release(This
->ipsite
);
458 This
->ipsite
= pIPSite
;
459 This
->request_uiactivate
= TRUE
;
463 static HRESULT WINAPI
OleDocumentView_GetInPlaceSite(IOleDocumentView
*iface
, IOleInPlaceSite
**ppIPSite
)
465 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
466 TRACE("(%p)->(%p)\n", This
, ppIPSite
);
472 IOleInPlaceSite_AddRef(This
->ipsite
);
474 *ppIPSite
= This
->ipsite
;
478 static HRESULT WINAPI
OleDocumentView_GetDocument(IOleDocumentView
*iface
, IUnknown
**ppunk
)
480 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
481 TRACE("(%p)->(%p)\n", This
, ppunk
);
486 *ppunk
= (IUnknown
*)&This
->basedoc
.IHTMLDocument2_iface
;
487 IUnknown_AddRef(*ppunk
);
491 static HRESULT WINAPI
OleDocumentView_SetRect(IOleDocumentView
*iface
, LPRECT prcView
)
493 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
496 TRACE("(%p)->(%p)\n", This
, prcView
);
502 GetClientRect(This
->hwnd
, &rect
);
503 if(!EqualRect(prcView
, &rect
)) {
504 InvalidateRect(This
->hwnd
, NULL
, TRUE
);
505 SetWindowPos(This
->hwnd
, NULL
, prcView
->left
, prcView
->top
, prcView
->right
,
506 prcView
->bottom
, SWP_NOZORDER
| SWP_NOACTIVATE
);
513 static HRESULT WINAPI
OleDocumentView_GetRect(IOleDocumentView
*iface
, LPRECT prcView
)
515 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
517 TRACE("(%p)->(%p)\n", This
, prcView
);
522 GetClientRect(This
->hwnd
, prcView
);
526 static HRESULT WINAPI
OleDocumentView_SetRectComplex(IOleDocumentView
*iface
, LPRECT prcView
,
527 LPRECT prcHScroll
, LPRECT prcVScroll
, LPRECT prcSizeBox
)
529 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
530 FIXME("(%p)->(%p %p %p %p)\n", This
, prcView
, prcHScroll
, prcVScroll
, prcSizeBox
);
534 static HRESULT WINAPI
OleDocumentView_Show(IOleDocumentView
*iface
, BOOL fShow
)
536 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
539 TRACE("(%p)->(%x)\n", This
, fShow
);
542 if(!This
->ui_active
) {
543 hres
= activate_window(This
);
547 update_doc(This
, UPDATE_UI
);
548 ShowWindow(This
->hwnd
, SW_SHOW
);
550 ShowWindow(This
->hwnd
, SW_HIDE
);
552 if(This
->in_place_active
)
553 IOleInPlaceObjectWindowless_InPlaceDeactivate(&This
->basedoc
.IOleInPlaceObjectWindowless_iface
);
555 if(This
->ip_window
) {
556 IOleInPlaceUIWindow_Release(This
->ip_window
);
557 This
->ip_window
= NULL
;
564 static HRESULT WINAPI
OleDocumentView_UIActivate(IOleDocumentView
*iface
, BOOL fUIActivate
)
566 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
569 TRACE("(%p)->(%x)\n", This
, fUIActivate
);
572 IOleClientSite
*cs
= This
->client
;
573 IOleInPlaceSite
*ips
;
576 WARN("this->ipsite = NULL\n");
580 hres
= IOleClientSite_QueryInterface(cs
, &IID_IOleInPlaceSiteWindowless
, (void**)&ips
);
584 hres
= IOleClientSite_QueryInterface(cs
, &IID_IOleInPlaceSiteEx
, (void**)&ips
);
588 hres
= IOleClientSite_QueryInterface(cs
, &IID_IOleInPlaceSite
, (void**)&ips
);
592 WARN("this->ipsite = NULL\n");
593 return E_NOINTERFACE
;
598 IOleInPlaceSite_AddRef(This
->ipsite
);
599 This
->request_uiactivate
= FALSE
;
600 HTMLDocument_LockContainer(This
, TRUE
);
609 if(!This
->window_active
) {
610 hres
= activate_window(This
);
616 if(This
->nscontainer
)
617 nsIWebBrowserFocus_Activate(This
->nscontainer
->focus
);
620 update_doc(This
, UPDATE_UI
);
622 hres
= IOleInPlaceSite_OnUIActivate(This
->ipsite
);
623 if(SUCCEEDED(hres
)) {
624 call_set_active_object((IOleInPlaceUIWindow
*)This
->frame
,
625 &This
->basedoc
.IOleInPlaceActiveObject_iface
);
627 FIXME("OnUIActivate failed: %08x\n", hres
);
628 IOleInPlaceFrame_Release(This
->frame
);
630 This
->ui_active
= FALSE
;
635 hres
= IDocHostUIHandler_ShowUI(This
->hostui
,
636 This
->usermode
== EDITMODE
? DOCHOSTUITYPE_AUTHOR
: DOCHOSTUITYPE_BROWSE
,
637 &This
->basedoc
.IOleInPlaceActiveObject_iface
, &This
->basedoc
.IOleCommandTarget_iface
,
638 This
->frame
, This
->ip_window
);
640 IDocHostUIHandler_HideUI(This
->hostui
);
644 call_set_active_object(This
->ip_window
, &This
->basedoc
.IOleInPlaceActiveObject_iface
);
646 SetRectEmpty(&rcBorderWidths
);
647 IOleInPlaceFrame_SetBorderSpace(This
->frame
, &rcBorderWidths
);
649 This
->ui_active
= TRUE
;
652 nsIWebBrowserFocus_Deactivate(This
->nscontainer
->focus
);
653 if(This
->ui_active
) {
654 This
->ui_active
= FALSE
;
656 call_set_active_object(This
->ip_window
, NULL
);
658 call_set_active_object((IOleInPlaceUIWindow
*)This
->frame
, NULL
);
660 IDocHostUIHandler_HideUI(This
->hostui
);
662 IOleInPlaceSite_OnUIDeactivate(This
->ipsite
, FALSE
);
668 static HRESULT WINAPI
OleDocumentView_Open(IOleDocumentView
*iface
)
670 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
671 FIXME("(%p)\n", This
);
675 static HRESULT WINAPI
OleDocumentView_CloseView(IOleDocumentView
*iface
, DWORD dwReserved
)
677 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
678 TRACE("(%p)->(%x)\n", This
, dwReserved
);
681 WARN("dwReserved = %d\n", dwReserved
);
683 IOleDocumentView_Show(iface
, FALSE
);
687 static HRESULT WINAPI
OleDocumentView_SaveViewState(IOleDocumentView
*iface
, IStream
*pstm
)
689 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
690 FIXME("(%p)->(%p)\n", This
, pstm
);
694 static HRESULT WINAPI
OleDocumentView_ApplyViewState(IOleDocumentView
*iface
, IStream
*pstm
)
696 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
697 FIXME("(%p)->(%p)\n", This
, pstm
);
701 static HRESULT WINAPI
OleDocumentView_Clone(IOleDocumentView
*iface
, IOleInPlaceSite
*pIPSiteNew
,
702 IOleDocumentView
**ppViewNew
)
704 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
705 FIXME("(%p)->(%p %p)\n", This
, pIPSiteNew
, ppViewNew
);
709 static const IOleDocumentViewVtbl OleDocumentViewVtbl
= {
710 OleDocumentView_QueryInterface
,
711 OleDocumentView_AddRef
,
712 OleDocumentView_Release
,
713 OleDocumentView_SetInPlaceSite
,
714 OleDocumentView_GetInPlaceSite
,
715 OleDocumentView_GetDocument
,
716 OleDocumentView_SetRect
,
717 OleDocumentView_GetRect
,
718 OleDocumentView_SetRectComplex
,
719 OleDocumentView_Show
,
720 OleDocumentView_UIActivate
,
721 OleDocumentView_Open
,
722 OleDocumentView_CloseView
,
723 OleDocumentView_SaveViewState
,
724 OleDocumentView_ApplyViewState
,
725 OleDocumentView_Clone
728 /**********************************************************
729 * IViewObject implementation
732 static inline HTMLDocumentObj
*impl_from_IViewObjectEx(IViewObjectEx
*iface
)
734 return CONTAINING_RECORD(iface
, HTMLDocumentObj
, IViewObjectEx_iface
);
737 static HRESULT WINAPI
ViewObject_QueryInterface(IViewObjectEx
*iface
, REFIID riid
, void **ppv
)
739 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
740 return htmldoc_query_interface(&This
->basedoc
, riid
, ppv
);
743 static ULONG WINAPI
ViewObject_AddRef(IViewObjectEx
*iface
)
745 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
746 return htmldoc_addref(&This
->basedoc
);
749 static ULONG WINAPI
ViewObject_Release(IViewObjectEx
*iface
)
751 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
752 return htmldoc_release(&This
->basedoc
);
755 static HRESULT WINAPI
ViewObject_Draw(IViewObjectEx
*iface
, DWORD dwDrawAspect
, LONG lindex
, void *pvAspect
,
756 DVTARGETDEVICE
*ptd
, HDC hdcTargetDev
, HDC hdcDraw
, LPCRECTL lprcBounds
,
757 LPCRECTL lprcWBounds
, BOOL (CALLBACK
*pfnContinue
)(ULONG_PTR dwContinue
), ULONG_PTR dwContinue
)
759 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
760 FIXME("(%p)->(%d %d %p %p %p %p %p %p %p %ld)\n", This
, dwDrawAspect
, lindex
, pvAspect
,
761 ptd
, hdcTargetDev
, hdcDraw
, lprcBounds
, lprcWBounds
, pfnContinue
, dwContinue
);
765 static HRESULT WINAPI
ViewObject_GetColorSet(IViewObjectEx
*iface
, DWORD dwDrawAspect
, LONG lindex
, void *pvAspect
,
766 DVTARGETDEVICE
*ptd
, HDC hicTargetDev
, LOGPALETTE
**ppColorSet
)
768 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
769 FIXME("(%p)->(%d %d %p %p %p %p)\n", This
, dwDrawAspect
, lindex
, pvAspect
, ptd
, hicTargetDev
, ppColorSet
);
773 static HRESULT WINAPI
ViewObject_Freeze(IViewObjectEx
*iface
, DWORD dwDrawAspect
, LONG lindex
,
774 void *pvAspect
, DWORD
*pdwFreeze
)
776 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
777 FIXME("(%p)->(%d %d %p %p)\n", This
, dwDrawAspect
, lindex
, pvAspect
, pdwFreeze
);
781 static HRESULT WINAPI
ViewObject_Unfreeze(IViewObjectEx
*iface
, DWORD dwFreeze
)
783 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
784 FIXME("(%p)->(%d)\n", This
, dwFreeze
);
788 static HRESULT WINAPI
ViewObject_SetAdvise(IViewObjectEx
*iface
, DWORD aspects
, DWORD advf
, IAdviseSink
*pAdvSink
)
790 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
792 TRACE("(%p)->(%d %d %p)\n", This
, aspects
, advf
, pAdvSink
);
794 if(aspects
!= DVASPECT_CONTENT
|| advf
!= ADVF_PRIMEFIRST
)
795 FIXME("unsupported arguments\n");
798 IAdviseSink_Release(This
->view_sink
);
800 IAdviseSink_AddRef(pAdvSink
);
802 This
->view_sink
= pAdvSink
;
806 static HRESULT WINAPI
ViewObject_GetAdvise(IViewObjectEx
*iface
, DWORD
*pAspects
, DWORD
*pAdvf
, IAdviseSink
**ppAdvSink
)
808 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
809 FIXME("(%p)->(%p %p %p)\n", This
, pAspects
, pAdvf
, ppAdvSink
);
813 static HRESULT WINAPI
ViewObject_GetExtent(IViewObjectEx
*iface
, DWORD dwDrawAspect
, LONG lindex
,
814 DVTARGETDEVICE
* ptd
, LPSIZEL lpsizel
)
816 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
817 FIXME("(%p)->(%d %d %p %p)\n", This
, dwDrawAspect
, lindex
, ptd
, lpsizel
);
821 static HRESULT WINAPI
ViewObject_GetRect(IViewObjectEx
*iface
, DWORD dwAspect
, LPRECTL pRect
)
823 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
824 FIXME("(%p)->(%d %p)\n", This
, dwAspect
, pRect
);
828 static HRESULT WINAPI
ViewObject_GetViewStatus(IViewObjectEx
*iface
, DWORD
*pdwStatus
)
830 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
831 FIXME("(%p)->(%p)\n", This
, pdwStatus
);
835 static HRESULT WINAPI
ViewObject_QueryHitPoint(IViewObjectEx
* iface
, DWORD dwAspect
,
836 LPCRECT pRectBounds
, POINT ptlLoc
, LONG lCloseHint
, DWORD
*pHitResult
)
838 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
839 FIXME("(%p)->(%d %p (%d %d) %d %p)\n", This
, dwAspect
, pRectBounds
, ptlLoc
.x
,
840 ptlLoc
.y
, lCloseHint
, pHitResult
);
844 static HRESULT WINAPI
ViewObject_QueryHitRect(IViewObjectEx
*iface
, DWORD dwAspect
,
845 LPCRECT pRectBounds
, LPCRECT pRectLoc
, LONG lCloseHint
, DWORD
*pHitResult
)
847 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
848 FIXME("(%p)->(%d %p %p %d %p)\n", This
, dwAspect
, pRectBounds
, pRectLoc
, lCloseHint
, pHitResult
);
852 static HRESULT WINAPI
ViewObject_GetNaturalExtent(IViewObjectEx
*iface
, DWORD dwAspect
, LONG lindex
,
853 DVTARGETDEVICE
*ptd
, HDC hicTargetDev
, DVEXTENTINFO
*pExtentInfo
, LPSIZEL pSizel
)
855 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
856 FIXME("(%p)->(%d %d %p %p %p %p\n", This
, dwAspect
,lindex
, ptd
,
857 hicTargetDev
, pExtentInfo
, pSizel
);
861 static const IViewObjectExVtbl ViewObjectVtbl
= {
862 ViewObject_QueryInterface
,
866 ViewObject_GetColorSet
,
869 ViewObject_SetAdvise
,
870 ViewObject_GetAdvise
,
871 ViewObject_GetExtent
,
873 ViewObject_GetViewStatus
,
874 ViewObject_QueryHitPoint
,
875 ViewObject_QueryHitRect
,
876 ViewObject_GetNaturalExtent
879 static inline HTMLDocumentObj
*impl_from_IWindowForBindingUI(IWindowForBindingUI
*iface
)
881 return CONTAINING_RECORD(iface
, HTMLDocumentObj
, IWindowForBindingUI_iface
);
884 static HRESULT WINAPI
WindowForBindingUI_QueryInterface(IWindowForBindingUI
*iface
, REFIID riid
, void **ppv
)
886 HTMLDocumentObj
*This
= impl_from_IWindowForBindingUI(iface
);
888 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
889 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
890 *ppv
= &This
->IWindowForBindingUI_iface
;
891 }else if(IsEqualGUID(&IID_IWindowForBindingUI
, riid
)) {
892 TRACE("(%p)->(IID_IWindowForBindingUI %p)\n", This
, ppv
);
893 *ppv
= &This
->IWindowForBindingUI_iface
;
895 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
897 return E_NOINTERFACE
;
900 IUnknown_AddRef((IUnknown
*)*ppv
);
904 static ULONG WINAPI
WindowForBindingUI_AddRef(IWindowForBindingUI
*iface
)
906 HTMLDocumentObj
*This
= impl_from_IWindowForBindingUI(iface
);
907 return htmldoc_addref(&This
->basedoc
);
910 static ULONG WINAPI
WindowForBindingUI_Release(IWindowForBindingUI
*iface
)
912 HTMLDocumentObj
*This
= impl_from_IWindowForBindingUI(iface
);
913 return htmldoc_release(&This
->basedoc
);
916 static HRESULT WINAPI
WindowForBindingUI_GetWindow(IWindowForBindingUI
*iface
, REFGUID rguidReason
, HWND
*phwnd
)
918 HTMLDocumentObj
*This
= impl_from_IWindowForBindingUI(iface
);
920 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(rguidReason
), phwnd
);
926 static const IWindowForBindingUIVtbl WindowForBindingUIVtbl
= {
927 WindowForBindingUI_QueryInterface
,
928 WindowForBindingUI_AddRef
,
929 WindowForBindingUI_Release
,
930 WindowForBindingUI_GetWindow
933 void HTMLDocument_View_Init(HTMLDocumentObj
*doc
)
935 doc
->IOleDocumentView_iface
.lpVtbl
= &OleDocumentViewVtbl
;
936 doc
->IViewObjectEx_iface
.lpVtbl
= &ViewObjectVtbl
;
937 doc
->IWindowForBindingUI_iface
.lpVtbl
= &WindowForBindingUIVtbl
;