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 const WCHAR wszInternetExplorer_Server
[] =
40 {'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r','_','S','e','r','v','e','r',0};
42 static const WCHAR wszTooltipData
[] = {'t','o','o','l','t','i','p','_','d','a','t','a',0};
44 static ATOM serverwnd_class
= 0;
51 static void paint_document(HTMLDocumentObj
*This
)
57 GetClientRect(This
->hwnd
, &rect
);
59 hdc
= BeginPaint(This
->hwnd
, &ps
);
61 if(!(This
->hostinfo
.dwFlags
& (DOCHOSTUIFLAG_NO3DOUTERBORDER
|DOCHOSTUIFLAG_NO3DBORDER
)))
62 DrawEdge(hdc
, &rect
, EDGE_SUNKEN
, BF_RECT
|BF_ADJUST
);
64 EndPaint(This
->hwnd
, &ps
);
67 static void activate_gecko(GeckoBrowser
*This
)
69 TRACE("(%p) %p\n", This
, This
->window
);
71 SetParent(This
->hwnd
, This
->doc
->hwnd
);
72 ShowWindow(This
->hwnd
, SW_SHOW
);
74 nsIBaseWindow_SetVisibility(This
->window
, TRUE
);
75 nsIBaseWindow_SetEnabled(This
->window
, TRUE
);
78 void update_doc(HTMLDocumentObj
*This
, DWORD flags
)
80 if(!This
->update
&& This
->hwnd
)
81 SetTimer(This
->hwnd
, TIMER_ID
, 100, NULL
);
83 This
->update
|= flags
;
86 void update_title(HTMLDocumentObj
*This
)
88 IOleCommandTarget
*olecmd
;
91 if(!(This
->update
& UPDATE_TITLE
))
94 This
->update
&= ~UPDATE_TITLE
;
99 hres
= IOleClientSite_QueryInterface(This
->client
, &IID_IOleCommandTarget
, (void**)&olecmd
);
100 if(SUCCEEDED(hres
)) {
101 static const WCHAR empty
[] = {0};
104 V_VT(&title
) = VT_BSTR
;
105 V_BSTR(&title
) = SysAllocString(empty
);
106 IOleCommandTarget_Exec(olecmd
, NULL
, OLECMDID_SETTITLE
, OLECMDEXECOPT_DONTPROMPTUSER
,
108 SysFreeString(V_BSTR(&title
));
110 IOleCommandTarget_Release(olecmd
);
114 static LRESULT
on_timer(HTMLDocumentObj
*This
)
116 TRACE("(%p) %x\n", This
, This
->update
);
118 KillTimer(This
->hwnd
, TIMER_ID
);
123 if(This
->update
& UPDATE_UI
) {
125 IDocHostUIHandler_UpdateUI(This
->hostui
);
128 IOleCommandTarget
*cmdtrg
;
131 hres
= IOleClientSite_QueryInterface(This
->client
, &IID_IOleCommandTarget
,
133 if(SUCCEEDED(hres
)) {
134 IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_UPDATECOMMANDS
,
135 OLECMDEXECOPT_DONTPROMPTUSER
, NULL
, NULL
);
136 IOleCommandTarget_Release(cmdtrg
);
146 void notif_focus(HTMLDocumentObj
*This
)
148 IOleControlSite
*site
;
154 hres
= IOleClientSite_QueryInterface(This
->client
, &IID_IOleControlSite
, (void**)&site
);
158 IOleControlSite_OnFocus(site
, This
->focus
);
159 IOleControlSite_Release(site
);
162 static LRESULT WINAPI
serverwnd_proc(HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
164 HTMLDocumentObj
*This
;
166 static const WCHAR wszTHIS
[] = {'T','H','I','S',0};
168 if(msg
== WM_CREATE
) {
169 This
= *(HTMLDocumentObj
**)lParam
;
170 SetPropW(hwnd
, wszTHIS
, This
);
172 This
= GetPropW(hwnd
, wszTHIS
);
180 paint_document(This
);
183 TRACE("(%p)->(WM_SIZE)\n", This
);
184 if(This
->nscontainer
) {
187 if(!(This
->hostinfo
.dwFlags
& (DOCHOSTUIFLAG_NO3DOUTERBORDER
|DOCHOSTUIFLAG_NO3DBORDER
))) {
188 ew
= GetSystemMetrics(SM_CXEDGE
);
189 eh
= GetSystemMetrics(SM_CYEDGE
);
192 SetWindowPos(This
->nscontainer
->hwnd
, NULL
, ew
, eh
,
193 LOWORD(lParam
) - 2*ew
, HIWORD(lParam
) - 2*eh
,
194 SWP_NOZORDER
| SWP_NOACTIVATE
);
198 return on_timer(This
);
200 TRACE("(%p) WM_SETFOCUS\n", This
);
201 nsIWebBrowserFocus_Activate(This
->nscontainer
->focus
);
203 case WM_MOUSEACTIVATE
:
207 return DefWindowProcW(hwnd
, msg
, wParam
, lParam
);
210 static void register_serverwnd_class(void)
212 static WNDCLASSEXW wndclass
= {
216 0, 0, NULL
, NULL
, NULL
, NULL
, NULL
,
217 wszInternetExplorer_Server
,
220 wndclass
.hInstance
= hInst
;
221 serverwnd_class
= RegisterClassExW(&wndclass
);
224 static HRESULT
activate_window(HTMLDocumentObj
*This
)
226 IOleInPlaceFrame
*pIPFrame
;
227 IOleCommandTarget
*cmdtrg
;
228 IOleInPlaceSiteEx
*ipsiteex
;
229 RECT posrect
, cliprect
;
230 OLEINPLACEFRAMEINFO frameinfo
;
235 register_serverwnd_class();
237 hres
= IOleInPlaceSite_CanInPlaceActivate(This
->ipsite
);
239 WARN("CanInPlaceActivate returned: %08x\n", hres
);
240 return FAILED(hres
) ? hres
: E_FAIL
;
243 frameinfo
.cb
= sizeof(OLEINPLACEFRAMEINFO
);
244 hres
= IOleInPlaceSite_GetWindowContext(This
->ipsite
, &pIPFrame
, &This
->ip_window
,
245 &posrect
, &cliprect
, &frameinfo
);
247 WARN("GetWindowContext failed: %08x\n", hres
);
251 TRACE("got window context: %p %p %s %s {%d %x %p %p %d}\n",
252 pIPFrame
, This
->ip_window
, wine_dbgstr_rect(&posrect
), wine_dbgstr_rect(&cliprect
),
253 frameinfo
.cb
, frameinfo
.fMDIApp
, frameinfo
.hwndFrame
, frameinfo
.haccel
, frameinfo
.cAccelEntries
);
255 hres
= IOleInPlaceSite_GetWindow(This
->ipsite
, &parent_hwnd
);
257 WARN("GetWindow failed: %08x\n", hres
);
261 TRACE("got parent window %p\n", parent_hwnd
);
264 if(GetParent(This
->hwnd
) != parent_hwnd
)
265 SetParent(This
->hwnd
, parent_hwnd
);
266 SetWindowPos(This
->hwnd
, HWND_TOP
,
267 posrect
.left
, posrect
.top
, posrect
.right
-posrect
.left
, posrect
.bottom
-posrect
.top
,
268 SWP_NOACTIVATE
| SWP_SHOWWINDOW
);
270 CreateWindowExW(0, wszInternetExplorer_Server
, NULL
,
271 WS_CHILD
| WS_CLIPSIBLINGS
| WS_CLIPCHILDREN
,
272 posrect
.left
, posrect
.top
, posrect
.right
-posrect
.left
, posrect
.bottom
-posrect
.top
,
273 parent_hwnd
, NULL
, hInst
, This
);
275 TRACE("Created window %p\n", This
->hwnd
);
277 SetWindowPos(This
->hwnd
, NULL
, 0, 0, 0, 0,
278 SWP_NOSIZE
| SWP_NOMOVE
| SWP_NOZORDER
| SWP_NOREDRAW
| SWP_NOACTIVATE
| SWP_SHOWWINDOW
);
279 RedrawWindow(This
->hwnd
, NULL
, NULL
, RDW_INVALIDATE
| RDW_NOERASE
| RDW_ALLCHILDREN
);
280 SetTimer(This
->hwnd
, TIMER_ID
, 100, NULL
);
283 if(This
->nscontainer
)
284 activate_gecko(This
->nscontainer
);
286 This
->in_place_active
= TRUE
;
287 hres
= IOleInPlaceSite_QueryInterface(This
->ipsite
, &IID_IOleInPlaceSiteEx
, (void**)&ipsiteex
);
288 if(SUCCEEDED(hres
)) {
291 hres
= IOleInPlaceSiteEx_OnInPlaceActivateEx(ipsiteex
, &redraw
, 0);
292 IOleInPlaceSiteEx_Release(ipsiteex
);
294 FIXME("unsupported redraw\n");
296 hres
= IOleInPlaceSite_OnInPlaceActivate(This
->ipsite
);
299 WARN("OnInPlaceActivate failed: %08x\n", hres
);
300 This
->in_place_active
= FALSE
;
304 hres
= IOleClientSite_QueryInterface(This
->client
, &IID_IOleCommandTarget
, (void**)&cmdtrg
);
305 if(SUCCEEDED(hres
)) {
308 IOleInPlaceFrame_SetStatusText(pIPFrame
, NULL
);
312 IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_SETPROGRESSMAX
,
313 OLECMDEXECOPT_DONTPROMPTUSER
, &var
, NULL
);
314 IOleCommandTarget_Exec(cmdtrg
, NULL
, OLECMDID_SETPROGRESSPOS
,
315 OLECMDEXECOPT_DONTPROMPTUSER
, &var
, NULL
);
317 IOleCommandTarget_Release(cmdtrg
);
321 IOleInPlaceFrame_Release(This
->frame
);
322 This
->frame
= pIPFrame
;
324 if(!This
->request_uiactivate
) {
325 hres
= IOleInPlaceSite_QueryInterface(This
->ipsite
, &IID_IOleInPlaceSiteEx
, (void**)&ipsiteex
);
326 if(SUCCEEDED(hres
)) {
327 IOleInPlaceSiteEx_RequestUIActivate(ipsiteex
);
328 IOleInPlaceSiteEx_Release(ipsiteex
);
332 This
->window_active
= TRUE
;
337 static LRESULT WINAPI
tooltips_proc(HWND hwnd
, UINT msg
, WPARAM wParam
, LPARAM lParam
)
339 tooltip_data
*data
= GetPropW(hwnd
, wszTooltipData
);
341 TRACE("%d %p\n", msg
, data
);
343 if(msg
== TTM_WINDOWFROMPOINT
) {
345 POINT
*pt
= (POINT
*)lParam
;
347 TRACE("TTM_WINDOWFROMPOINT (%d,%d)\n", pt
->x
, pt
->y
);
349 GetWindowRect(data
->doc
->hwnd
, &rect
);
351 if(rect
.left
<= pt
->x
&& pt
->x
<= rect
.right
352 && rect
.top
<= pt
->y
&& pt
->y
<= rect
.bottom
)
353 return (LPARAM
)data
->doc
->hwnd
;
356 return CallWindowProcW(data
->proc
, hwnd
, msg
, wParam
, lParam
);
359 static void create_tooltips_window(HTMLDocumentObj
*This
)
361 tooltip_data
*data
= heap_alloc(sizeof(*data
));
363 This
->tooltips_hwnd
= CreateWindowExW(0, TOOLTIPS_CLASSW
, NULL
, TTS_NOPREFIX
| WS_POPUP
,
364 CW_USEDEFAULT
, CW_USEDEFAULT
, 10, 10, This
->hwnd
, NULL
, hInst
, NULL
);
367 data
->proc
= (WNDPROC
)GetWindowLongPtrW(This
->tooltips_hwnd
, GWLP_WNDPROC
);
369 SetPropW(This
->tooltips_hwnd
, wszTooltipData
, data
);
371 SetWindowLongPtrW(This
->tooltips_hwnd
, GWLP_WNDPROC
, (LONG_PTR
)tooltips_proc
);
373 SetWindowPos(This
->tooltips_hwnd
, HWND_TOPMOST
,0, 0, 0, 0,
374 SWP_NOMOVE
| SWP_NOSIZE
| SWP_NOACTIVATE
);
378 void show_tooltip(HTMLDocumentObj
*This
, DWORD x
, DWORD y
, LPCWSTR text
)
380 TTTOOLINFOW toolinfo
= {
381 sizeof(TTTOOLINFOW
), 0, This
->hwnd
, 0xdeadbeef,
382 {x
>2 ? x
-2 : 0, y
>0 ? y
-2 : 0, x
+2, y
+2}, /* FIXME */
383 NULL
, (LPWSTR
)text
, 0};
384 MSG msg
= {This
->hwnd
, WM_MOUSEMOVE
, 0, MAKELPARAM(x
,y
), 0, {x
,y
}};
386 TRACE("(%p)->(%d %d %s)\n", This
, x
, y
, debugstr_w(text
));
388 if(!This
->tooltips_hwnd
)
389 create_tooltips_window(This
);
391 SendMessageW(This
->tooltips_hwnd
, TTM_ADDTOOLW
, 0, (LPARAM
)&toolinfo
);
392 SendMessageW(This
->tooltips_hwnd
, TTM_ACTIVATE
, TRUE
, 0);
393 SendMessageW(This
->tooltips_hwnd
, TTM_RELAYEVENT
, 0, (LPARAM
)&msg
);
396 void hide_tooltip(HTMLDocumentObj
*This
)
398 TTTOOLINFOW toolinfo
= {
399 sizeof(TTTOOLINFOW
), 0, This
->hwnd
, 0xdeadbeef,
400 {0,0,0,0}, NULL
, NULL
, 0};
402 TRACE("(%p)\n", This
);
404 SendMessageW(This
->tooltips_hwnd
, TTM_DELTOOLW
, 0, (LPARAM
)&toolinfo
);
405 SendMessageW(This
->tooltips_hwnd
, TTM_ACTIVATE
, FALSE
, 0);
408 HRESULT
call_set_active_object(IOleInPlaceUIWindow
*window
, IOleInPlaceActiveObject
*act_obj
)
410 static WCHAR html_documentW
[30];
412 if(act_obj
&& !html_documentW
[0])
413 LoadStringW(hInst
, IDS_HTMLDOCUMENT
, html_documentW
, ARRAY_SIZE(html_documentW
));
415 return IOleInPlaceUIWindow_SetActiveObject(window
, act_obj
, act_obj
? html_documentW
: NULL
);
418 /**********************************************************
419 * IOleDocumentView implementation
422 static inline HTMLDocumentObj
*impl_from_IOleDocumentView(IOleDocumentView
*iface
)
424 return CONTAINING_RECORD(iface
, HTMLDocumentObj
, IOleDocumentView_iface
);
427 static HRESULT WINAPI
OleDocumentView_QueryInterface(IOleDocumentView
*iface
, REFIID riid
, void **ppvObject
)
429 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
430 return htmldoc_query_interface(&This
->basedoc
, riid
, ppvObject
);
433 static ULONG WINAPI
OleDocumentView_AddRef(IOleDocumentView
*iface
)
435 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
436 return htmldoc_addref(&This
->basedoc
);
439 static ULONG WINAPI
OleDocumentView_Release(IOleDocumentView
*iface
)
441 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
442 return htmldoc_release(&This
->basedoc
);
445 static HRESULT WINAPI
OleDocumentView_SetInPlaceSite(IOleDocumentView
*iface
, IOleInPlaceSite
*pIPSite
)
447 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
448 TRACE("(%p)->(%p)\n", This
, pIPSite
);
451 IOleInPlaceSite_AddRef(pIPSite
);
454 IOleInPlaceSite_Release(This
->ipsite
);
456 This
->ipsite
= pIPSite
;
457 This
->request_uiactivate
= TRUE
;
461 static HRESULT WINAPI
OleDocumentView_GetInPlaceSite(IOleDocumentView
*iface
, IOleInPlaceSite
**ppIPSite
)
463 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
464 TRACE("(%p)->(%p)\n", This
, ppIPSite
);
470 IOleInPlaceSite_AddRef(This
->ipsite
);
472 *ppIPSite
= This
->ipsite
;
476 static HRESULT WINAPI
OleDocumentView_GetDocument(IOleDocumentView
*iface
, IUnknown
**ppunk
)
478 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
479 TRACE("(%p)->(%p)\n", This
, ppunk
);
484 *ppunk
= (IUnknown
*)&This
->basedoc
.IHTMLDocument2_iface
;
485 IUnknown_AddRef(*ppunk
);
489 static HRESULT WINAPI
OleDocumentView_SetRect(IOleDocumentView
*iface
, LPRECT prcView
)
491 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
494 TRACE("(%p)->(%p)\n", This
, prcView
);
500 GetClientRect(This
->hwnd
, &rect
);
501 if(!EqualRect(prcView
, &rect
)) {
502 InvalidateRect(This
->hwnd
, NULL
, TRUE
);
503 SetWindowPos(This
->hwnd
, NULL
, prcView
->left
, prcView
->top
, prcView
->right
- prcView
->left
,
504 prcView
->bottom
- prcView
->top
, SWP_NOZORDER
| SWP_NOACTIVATE
);
511 static HRESULT WINAPI
OleDocumentView_GetRect(IOleDocumentView
*iface
, LPRECT prcView
)
513 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
515 TRACE("(%p)->(%p)\n", This
, prcView
);
520 GetClientRect(This
->hwnd
, prcView
);
521 MapWindowPoints(This
->hwnd
, GetParent(This
->hwnd
), (POINT
*)prcView
, 2);
525 static HRESULT WINAPI
OleDocumentView_SetRectComplex(IOleDocumentView
*iface
, LPRECT prcView
,
526 LPRECT prcHScroll
, LPRECT prcVScroll
, LPRECT prcSizeBox
)
528 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
529 FIXME("(%p)->(%p %p %p %p)\n", This
, prcView
, prcHScroll
, prcVScroll
, prcSizeBox
);
533 static HRESULT WINAPI
OleDocumentView_Show(IOleDocumentView
*iface
, BOOL fShow
)
535 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
538 TRACE("(%p)->(%x)\n", This
, fShow
);
541 if(!This
->ui_active
) {
542 hres
= activate_window(This
);
546 update_doc(This
, UPDATE_UI
);
547 ShowWindow(This
->hwnd
, SW_SHOW
);
549 ShowWindow(This
->hwnd
, SW_HIDE
);
551 if(This
->in_place_active
)
552 IOleInPlaceObjectWindowless_InPlaceDeactivate(&This
->basedoc
.IOleInPlaceObjectWindowless_iface
);
554 if(This
->ip_window
) {
555 IOleInPlaceUIWindow_Release(This
->ip_window
);
556 This
->ip_window
= NULL
;
563 static HRESULT WINAPI
OleDocumentView_UIActivate(IOleDocumentView
*iface
, BOOL fUIActivate
)
565 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
568 TRACE("(%p)->(%x)\n", This
, fUIActivate
);
571 IOleClientSite
*cs
= This
->client
;
572 IOleInPlaceSite
*ips
;
575 WARN("this->ipsite = NULL\n");
579 hres
= IOleClientSite_QueryInterface(cs
, &IID_IOleInPlaceSiteWindowless
, (void**)&ips
);
583 hres
= IOleClientSite_QueryInterface(cs
, &IID_IOleInPlaceSiteEx
, (void**)&ips
);
587 hres
= IOleClientSite_QueryInterface(cs
, &IID_IOleInPlaceSite
, (void**)&ips
);
591 WARN("this->ipsite = NULL\n");
592 return E_NOINTERFACE
;
597 IOleInPlaceSite_AddRef(This
->ipsite
);
598 This
->request_uiactivate
= FALSE
;
599 HTMLDocument_LockContainer(This
, TRUE
);
608 if(!This
->window_active
) {
609 hres
= activate_window(This
);
615 if(This
->nscontainer
)
616 nsIWebBrowserFocus_Activate(This
->nscontainer
->focus
);
619 update_doc(This
, UPDATE_UI
);
621 hres
= IOleInPlaceSite_OnUIActivate(This
->ipsite
);
622 if(SUCCEEDED(hres
)) {
623 call_set_active_object((IOleInPlaceUIWindow
*)This
->frame
,
624 &This
->basedoc
.IOleInPlaceActiveObject_iface
);
626 FIXME("OnUIActivate failed: %08x\n", hres
);
627 IOleInPlaceFrame_Release(This
->frame
);
629 This
->ui_active
= FALSE
;
634 hres
= IDocHostUIHandler_ShowUI(This
->hostui
,
635 This
->nscontainer
->usermode
== EDITMODE
? DOCHOSTUITYPE_AUTHOR
: DOCHOSTUITYPE_BROWSE
,
636 &This
->basedoc
.IOleInPlaceActiveObject_iface
, &This
->basedoc
.IOleCommandTarget_iface
,
637 This
->frame
, This
->ip_window
);
639 IDocHostUIHandler_HideUI(This
->hostui
);
643 call_set_active_object(This
->ip_window
, &This
->basedoc
.IOleInPlaceActiveObject_iface
);
645 SetRectEmpty(&rcBorderWidths
);
646 IOleInPlaceFrame_SetBorderSpace(This
->frame
, &rcBorderWidths
);
648 This
->ui_active
= TRUE
;
651 nsIWebBrowserFocus_Deactivate(This
->nscontainer
->focus
);
652 if(This
->ui_active
) {
653 This
->ui_active
= FALSE
;
655 call_set_active_object(This
->ip_window
, NULL
);
657 call_set_active_object((IOleInPlaceUIWindow
*)This
->frame
, NULL
);
659 IDocHostUIHandler_HideUI(This
->hostui
);
661 IOleInPlaceSite_OnUIDeactivate(This
->ipsite
, FALSE
);
667 static HRESULT WINAPI
OleDocumentView_Open(IOleDocumentView
*iface
)
669 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
670 FIXME("(%p)\n", This
);
674 static HRESULT WINAPI
OleDocumentView_CloseView(IOleDocumentView
*iface
, DWORD dwReserved
)
676 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
677 TRACE("(%p)->(%x)\n", This
, dwReserved
);
680 WARN("dwReserved = %d\n", dwReserved
);
682 IOleDocumentView_Show(iface
, FALSE
);
686 static HRESULT WINAPI
OleDocumentView_SaveViewState(IOleDocumentView
*iface
, IStream
*pstm
)
688 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
689 FIXME("(%p)->(%p)\n", This
, pstm
);
693 static HRESULT WINAPI
OleDocumentView_ApplyViewState(IOleDocumentView
*iface
, IStream
*pstm
)
695 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
696 FIXME("(%p)->(%p)\n", This
, pstm
);
700 static HRESULT WINAPI
OleDocumentView_Clone(IOleDocumentView
*iface
, IOleInPlaceSite
*pIPSiteNew
,
701 IOleDocumentView
**ppViewNew
)
703 HTMLDocumentObj
*This
= impl_from_IOleDocumentView(iface
);
704 FIXME("(%p)->(%p %p)\n", This
, pIPSiteNew
, ppViewNew
);
708 static const IOleDocumentViewVtbl OleDocumentViewVtbl
= {
709 OleDocumentView_QueryInterface
,
710 OleDocumentView_AddRef
,
711 OleDocumentView_Release
,
712 OleDocumentView_SetInPlaceSite
,
713 OleDocumentView_GetInPlaceSite
,
714 OleDocumentView_GetDocument
,
715 OleDocumentView_SetRect
,
716 OleDocumentView_GetRect
,
717 OleDocumentView_SetRectComplex
,
718 OleDocumentView_Show
,
719 OleDocumentView_UIActivate
,
720 OleDocumentView_Open
,
721 OleDocumentView_CloseView
,
722 OleDocumentView_SaveViewState
,
723 OleDocumentView_ApplyViewState
,
724 OleDocumentView_Clone
727 /**********************************************************
728 * IViewObject implementation
731 static inline HTMLDocumentObj
*impl_from_IViewObjectEx(IViewObjectEx
*iface
)
733 return CONTAINING_RECORD(iface
, HTMLDocumentObj
, IViewObjectEx_iface
);
736 static HRESULT WINAPI
ViewObject_QueryInterface(IViewObjectEx
*iface
, REFIID riid
, void **ppv
)
738 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
739 return htmldoc_query_interface(&This
->basedoc
, riid
, ppv
);
742 static ULONG WINAPI
ViewObject_AddRef(IViewObjectEx
*iface
)
744 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
745 return htmldoc_addref(&This
->basedoc
);
748 static ULONG WINAPI
ViewObject_Release(IViewObjectEx
*iface
)
750 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
751 return htmldoc_release(&This
->basedoc
);
754 static HRESULT WINAPI
ViewObject_Draw(IViewObjectEx
*iface
, DWORD dwDrawAspect
, LONG lindex
, void *pvAspect
,
755 DVTARGETDEVICE
*ptd
, HDC hdcTargetDev
, HDC hdcDraw
, LPCRECTL lprcBounds
,
756 LPCRECTL lprcWBounds
, BOOL (CALLBACK
*pfnContinue
)(ULONG_PTR dwContinue
), ULONG_PTR dwContinue
)
758 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
759 FIXME("(%p)->(%d %d %p %p %p %p %p %p %p %ld)\n", This
, dwDrawAspect
, lindex
, pvAspect
,
760 ptd
, hdcTargetDev
, hdcDraw
, lprcBounds
, lprcWBounds
, pfnContinue
, dwContinue
);
764 static HRESULT WINAPI
ViewObject_GetColorSet(IViewObjectEx
*iface
, DWORD dwDrawAspect
, LONG lindex
, void *pvAspect
,
765 DVTARGETDEVICE
*ptd
, HDC hicTargetDev
, LOGPALETTE
**ppColorSet
)
767 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
768 FIXME("(%p)->(%d %d %p %p %p %p)\n", This
, dwDrawAspect
, lindex
, pvAspect
, ptd
, hicTargetDev
, ppColorSet
);
772 static HRESULT WINAPI
ViewObject_Freeze(IViewObjectEx
*iface
, DWORD dwDrawAspect
, LONG lindex
,
773 void *pvAspect
, DWORD
*pdwFreeze
)
775 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
776 FIXME("(%p)->(%d %d %p %p)\n", This
, dwDrawAspect
, lindex
, pvAspect
, pdwFreeze
);
780 static HRESULT WINAPI
ViewObject_Unfreeze(IViewObjectEx
*iface
, DWORD dwFreeze
)
782 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
783 FIXME("(%p)->(%d)\n", This
, dwFreeze
);
787 static HRESULT WINAPI
ViewObject_SetAdvise(IViewObjectEx
*iface
, DWORD aspects
, DWORD advf
, IAdviseSink
*pAdvSink
)
789 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
791 TRACE("(%p)->(%d %d %p)\n", This
, aspects
, advf
, pAdvSink
);
793 if(aspects
!= DVASPECT_CONTENT
|| advf
!= ADVF_PRIMEFIRST
)
794 FIXME("unsupported arguments\n");
797 IAdviseSink_Release(This
->view_sink
);
799 IAdviseSink_AddRef(pAdvSink
);
801 This
->view_sink
= pAdvSink
;
805 static HRESULT WINAPI
ViewObject_GetAdvise(IViewObjectEx
*iface
, DWORD
*pAspects
, DWORD
*pAdvf
, IAdviseSink
**ppAdvSink
)
807 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
808 FIXME("(%p)->(%p %p %p)\n", This
, pAspects
, pAdvf
, ppAdvSink
);
812 static HRESULT WINAPI
ViewObject_GetExtent(IViewObjectEx
*iface
, DWORD dwDrawAspect
, LONG lindex
,
813 DVTARGETDEVICE
* ptd
, LPSIZEL lpsizel
)
815 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
816 FIXME("(%p)->(%d %d %p %p)\n", This
, dwDrawAspect
, lindex
, ptd
, lpsizel
);
820 static HRESULT WINAPI
ViewObject_GetRect(IViewObjectEx
*iface
, DWORD dwAspect
, LPRECTL pRect
)
822 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
823 FIXME("(%p)->(%d %p)\n", This
, dwAspect
, pRect
);
827 static HRESULT WINAPI
ViewObject_GetViewStatus(IViewObjectEx
*iface
, DWORD
*pdwStatus
)
829 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
830 FIXME("(%p)->(%p)\n", This
, pdwStatus
);
834 static HRESULT WINAPI
ViewObject_QueryHitPoint(IViewObjectEx
* iface
, DWORD dwAspect
,
835 LPCRECT pRectBounds
, POINT ptlLoc
, LONG lCloseHint
, DWORD
*pHitResult
)
837 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
838 FIXME("(%p)->(%d %p (%d %d) %d %p)\n", This
, dwAspect
, pRectBounds
, ptlLoc
.x
,
839 ptlLoc
.y
, lCloseHint
, pHitResult
);
843 static HRESULT WINAPI
ViewObject_QueryHitRect(IViewObjectEx
*iface
, DWORD dwAspect
,
844 LPCRECT pRectBounds
, LPCRECT pRectLoc
, LONG lCloseHint
, DWORD
*pHitResult
)
846 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
847 FIXME("(%p)->(%d %p %p %d %p)\n", This
, dwAspect
, pRectBounds
, pRectLoc
, lCloseHint
, pHitResult
);
851 static HRESULT WINAPI
ViewObject_GetNaturalExtent(IViewObjectEx
*iface
, DWORD dwAspect
, LONG lindex
,
852 DVTARGETDEVICE
*ptd
, HDC hicTargetDev
, DVEXTENTINFO
*pExtentInfo
, LPSIZEL pSizel
)
854 HTMLDocumentObj
*This
= impl_from_IViewObjectEx(iface
);
855 FIXME("(%p)->(%d %d %p %p %p %p\n", This
, dwAspect
,lindex
, ptd
,
856 hicTargetDev
, pExtentInfo
, pSizel
);
860 static const IViewObjectExVtbl ViewObjectVtbl
= {
861 ViewObject_QueryInterface
,
865 ViewObject_GetColorSet
,
868 ViewObject_SetAdvise
,
869 ViewObject_GetAdvise
,
870 ViewObject_GetExtent
,
872 ViewObject_GetViewStatus
,
873 ViewObject_QueryHitPoint
,
874 ViewObject_QueryHitRect
,
875 ViewObject_GetNaturalExtent
878 static inline HTMLDocumentObj
*impl_from_IWindowForBindingUI(IWindowForBindingUI
*iface
)
880 return CONTAINING_RECORD(iface
, HTMLDocumentObj
, IWindowForBindingUI_iface
);
883 static HRESULT WINAPI
WindowForBindingUI_QueryInterface(IWindowForBindingUI
*iface
, REFIID riid
, void **ppv
)
885 HTMLDocumentObj
*This
= impl_from_IWindowForBindingUI(iface
);
887 if(IsEqualGUID(&IID_IUnknown
, riid
)) {
888 TRACE("(%p)->(IID_IUnknown %p)\n", This
, ppv
);
889 *ppv
= &This
->IWindowForBindingUI_iface
;
890 }else if(IsEqualGUID(&IID_IWindowForBindingUI
, riid
)) {
891 TRACE("(%p)->(IID_IWindowForBindingUI %p)\n", This
, ppv
);
892 *ppv
= &This
->IWindowForBindingUI_iface
;
894 WARN("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
896 return E_NOINTERFACE
;
899 IUnknown_AddRef((IUnknown
*)*ppv
);
903 static ULONG WINAPI
WindowForBindingUI_AddRef(IWindowForBindingUI
*iface
)
905 HTMLDocumentObj
*This
= impl_from_IWindowForBindingUI(iface
);
906 return htmldoc_addref(&This
->basedoc
);
909 static ULONG WINAPI
WindowForBindingUI_Release(IWindowForBindingUI
*iface
)
911 HTMLDocumentObj
*This
= impl_from_IWindowForBindingUI(iface
);
912 return htmldoc_release(&This
->basedoc
);
915 static HRESULT WINAPI
WindowForBindingUI_GetWindow(IWindowForBindingUI
*iface
, REFGUID rguidReason
, HWND
*phwnd
)
917 HTMLDocumentObj
*This
= impl_from_IWindowForBindingUI(iface
);
919 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(rguidReason
), phwnd
);
925 static const IWindowForBindingUIVtbl WindowForBindingUIVtbl
= {
926 WindowForBindingUI_QueryInterface
,
927 WindowForBindingUI_AddRef
,
928 WindowForBindingUI_Release
,
929 WindowForBindingUI_GetWindow
932 void HTMLDocument_View_Init(HTMLDocumentObj
*doc
)
934 doc
->IOleDocumentView_iface
.lpVtbl
= &OleDocumentViewVtbl
;
935 doc
->IViewObjectEx_iface
.lpVtbl
= &ViewObjectVtbl
;
936 doc
->IWindowForBindingUI_iface
.lpVtbl
= &WindowForBindingUIVtbl
;