2005-04-13 16:41:19 +02:00
|
|
|
/*
|
2006-03-27 21:02:28 +02:00
|
|
|
* Copyright 2005-2006 Jacek Caban for CodeWeavers
|
2005-04-13 16:41:19 +02:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-04-13 16:41:19 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
2006-03-27 21:02:28 +02:00
|
|
|
#include "commctrl.h"
|
2005-04-13 16:41:19 +02:00
|
|
|
#include "ole2.h"
|
2005-08-29 12:15:17 +02:00
|
|
|
#include "resource.h"
|
2005-04-13 16:41:19 +02:00
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
#include "mshtml_private.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
|
|
|
|
2007-06-10 11:38:51 +02:00
|
|
|
#define TIMER_ID 0x1000
|
|
|
|
|
2005-04-14 13:30:50 +02:00
|
|
|
static ATOM serverwnd_class = 0;
|
|
|
|
|
2006-03-27 21:02:28 +02:00
|
|
|
typedef struct {
|
2009-09-16 22:10:47 +02:00
|
|
|
HTMLDocumentObj *doc;
|
2006-03-27 21:02:28 +02:00
|
|
|
WNDPROC proc;
|
|
|
|
} tooltip_data;
|
|
|
|
|
2009-09-16 22:09:17 +02:00
|
|
|
static void paint_document(HTMLDocumentObj *This)
|
2006-11-12 17:09:38 +01:00
|
|
|
{
|
2005-04-14 13:30:50 +02:00
|
|
|
PAINTSTRUCT ps;
|
|
|
|
RECT rect;
|
2006-11-12 17:09:38 +01:00
|
|
|
HDC hdc;
|
|
|
|
|
2009-09-16 22:10:47 +02:00
|
|
|
GetClientRect(This->hwnd, &rect);
|
2006-11-12 17:09:38 +01:00
|
|
|
|
2009-09-16 22:10:47 +02:00
|
|
|
hdc = BeginPaint(This->hwnd, &ps);
|
2006-11-12 17:09:38 +01:00
|
|
|
|
2009-09-16 22:11:05 +02:00
|
|
|
if(!(This->hostinfo.dwFlags & (DOCHOSTUIFLAG_NO3DOUTERBORDER|DOCHOSTUIFLAG_NO3DBORDER)))
|
2006-11-12 17:09:38 +01:00
|
|
|
DrawEdge(hdc, &rect, EDGE_SUNKEN, BF_RECT|BF_ADJUST);
|
2005-08-29 12:15:17 +02:00
|
|
|
|
2009-09-16 22:10:47 +02:00
|
|
|
EndPaint(This->hwnd, &ps);
|
2005-04-14 13:30:50 +02:00
|
|
|
}
|
|
|
|
|
2019-03-11 14:22:24 +01:00
|
|
|
static void activate_gecko(GeckoBrowser *This)
|
2005-08-01 12:59:45 +02:00
|
|
|
{
|
2007-06-22 23:32:22 +02:00
|
|
|
TRACE("(%p) %p\n", This, This->window);
|
2005-08-01 12:59:45 +02:00
|
|
|
|
2009-09-16 22:10:47 +02:00
|
|
|
SetParent(This->hwnd, This->doc->hwnd);
|
2007-06-22 23:32:22 +02:00
|
|
|
ShowWindow(This->hwnd, SW_SHOW);
|
2005-08-01 12:59:45 +02:00
|
|
|
|
2007-06-22 23:32:22 +02:00
|
|
|
nsIBaseWindow_SetVisibility(This->window, TRUE);
|
|
|
|
nsIBaseWindow_SetEnabled(This->window, TRUE);
|
2005-08-01 12:59:45 +02:00
|
|
|
}
|
|
|
|
|
2017-11-22 16:15:48 +01:00
|
|
|
void update_doc(HTMLDocumentObj *This, DWORD flags)
|
2007-06-10 11:38:51 +02:00
|
|
|
{
|
2017-11-22 16:15:48 +01:00
|
|
|
if(!This->update && This->hwnd)
|
|
|
|
SetTimer(This->hwnd, TIMER_ID, 100, NULL);
|
2007-06-10 11:38:51 +02:00
|
|
|
|
2017-11-22 16:15:48 +01:00
|
|
|
This->update |= flags;
|
2007-06-10 11:38:51 +02:00
|
|
|
}
|
|
|
|
|
2009-09-16 22:10:03 +02:00
|
|
|
void update_title(HTMLDocumentObj *This)
|
2007-06-10 11:39:39 +02:00
|
|
|
{
|
|
|
|
IOleCommandTarget *olecmd;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2009-09-16 22:13:13 +02:00
|
|
|
if(!(This->update & UPDATE_TITLE))
|
2007-06-10 11:39:39 +02:00
|
|
|
return;
|
|
|
|
|
2009-09-16 22:13:13 +02:00
|
|
|
This->update &= ~UPDATE_TITLE;
|
2007-06-10 11:39:39 +02:00
|
|
|
|
|
|
|
if(!This->client)
|
|
|
|
return;
|
|
|
|
|
|
|
|
hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget, (void**)&olecmd);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
VARIANT title;
|
|
|
|
|
|
|
|
V_VT(&title) = VT_BSTR;
|
2020-11-24 23:29:19 +01:00
|
|
|
V_BSTR(&title) = SysAllocString(L"");
|
2007-06-10 11:39:39 +02:00
|
|
|
IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETTITLE, OLECMDEXECOPT_DONTPROMPTUSER,
|
|
|
|
&title, NULL);
|
|
|
|
SysFreeString(V_BSTR(&title));
|
|
|
|
|
|
|
|
IOleCommandTarget_Release(olecmd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-09-16 22:10:03 +02:00
|
|
|
static LRESULT on_timer(HTMLDocumentObj *This)
|
2007-06-10 11:38:51 +02:00
|
|
|
{
|
2022-02-15 07:29:41 +01:00
|
|
|
TRACE("(%p) %lx\n", This, This->update);
|
2007-06-10 11:38:51 +02:00
|
|
|
|
2009-09-16 22:10:47 +02:00
|
|
|
KillTimer(This->hwnd, TIMER_ID);
|
2007-06-10 11:38:51 +02:00
|
|
|
|
2009-09-16 22:13:13 +02:00
|
|
|
if(!This->update)
|
2007-06-10 11:38:51 +02:00
|
|
|
return 0;
|
|
|
|
|
2009-09-16 22:13:13 +02:00
|
|
|
if(This->update & UPDATE_UI) {
|
2007-06-10 11:38:51 +02:00
|
|
|
if(This->hostui)
|
|
|
|
IDocHostUIHandler_UpdateUI(This->hostui);
|
|
|
|
|
|
|
|
if(This->client) {
|
|
|
|
IOleCommandTarget *cmdtrg;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget,
|
|
|
|
(void**)&cmdtrg);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_UPDATECOMMANDS,
|
|
|
|
OLECMDEXECOPT_DONTPROMPTUSER, NULL, NULL);
|
|
|
|
IOleCommandTarget_Release(cmdtrg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-06-10 11:39:39 +02:00
|
|
|
update_title(This);
|
2009-09-16 22:13:13 +02:00
|
|
|
This->update = 0;
|
2007-06-10 11:38:51 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-09-16 22:10:03 +02:00
|
|
|
void notif_focus(HTMLDocumentObj *This)
|
2007-06-22 23:33:00 +02:00
|
|
|
{
|
|
|
|
IOleControlSite *site;
|
|
|
|
HRESULT hres;
|
|
|
|
|
2008-10-10 22:47:54 +02:00
|
|
|
if(!This->client)
|
|
|
|
return;
|
|
|
|
|
2007-06-22 23:33:00 +02:00
|
|
|
hres = IOleClientSite_QueryInterface(This->client, &IID_IOleControlSite, (void**)&site);
|
|
|
|
if(FAILED(hres))
|
|
|
|
return;
|
|
|
|
|
2009-09-16 22:11:26 +02:00
|
|
|
IOleControlSite_OnFocus(site, This->focus);
|
2007-06-22 23:33:00 +02:00
|
|
|
IOleControlSite_Release(site);
|
|
|
|
}
|
|
|
|
|
2005-04-14 13:30:50 +02:00
|
|
|
static LRESULT WINAPI serverwnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
2009-09-16 22:10:47 +02:00
|
|
|
HTMLDocumentObj *This;
|
2005-08-01 12:59:45 +02:00
|
|
|
|
|
|
|
if(msg == WM_CREATE) {
|
2009-09-16 22:10:47 +02:00
|
|
|
This = *(HTMLDocumentObj**)lParam;
|
2020-11-24 23:29:19 +01:00
|
|
|
SetPropW(hwnd, L"THIS", This);
|
2005-08-01 12:59:45 +02:00
|
|
|
}else {
|
2020-11-24 23:29:19 +01:00
|
|
|
This = GetPropW(hwnd, L"THIS");
|
2005-08-01 12:59:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
switch(msg) {
|
|
|
|
case WM_CREATE:
|
|
|
|
This->hwnd = hwnd;
|
|
|
|
break;
|
|
|
|
case WM_PAINT:
|
2009-09-16 22:10:47 +02:00
|
|
|
paint_document(This);
|
2005-08-01 12:59:45 +02:00
|
|
|
break;
|
|
|
|
case WM_SIZE:
|
|
|
|
TRACE("(%p)->(WM_SIZE)\n", This);
|
2009-09-16 22:10:47 +02:00
|
|
|
if(This->nscontainer) {
|
2006-11-12 17:09:38 +01:00
|
|
|
INT ew=0, eh=0;
|
|
|
|
|
2009-09-16 22:11:05 +02:00
|
|
|
if(!(This->hostinfo.dwFlags & (DOCHOSTUIFLAG_NO3DOUTERBORDER|DOCHOSTUIFLAG_NO3DBORDER))) {
|
2006-11-12 17:09:38 +01:00
|
|
|
ew = GetSystemMetrics(SM_CXEDGE);
|
|
|
|
eh = GetSystemMetrics(SM_CYEDGE);
|
|
|
|
}
|
|
|
|
|
2009-09-16 22:10:47 +02:00
|
|
|
SetWindowPos(This->nscontainer->hwnd, NULL, ew, eh,
|
2006-11-12 17:09:38 +01:00
|
|
|
LOWORD(lParam) - 2*ew, HIWORD(lParam) - 2*eh,
|
|
|
|
SWP_NOZORDER | SWP_NOACTIVATE);
|
|
|
|
}
|
2007-06-10 11:38:51 +02:00
|
|
|
break;
|
|
|
|
case WM_TIMER:
|
2009-09-16 22:10:47 +02:00
|
|
|
return on_timer(This);
|
2010-04-13 20:01:21 +02:00
|
|
|
case WM_SETFOCUS:
|
|
|
|
TRACE("(%p) WM_SETFOCUS\n", This);
|
|
|
|
nsIWebBrowserFocus_Activate(This->nscontainer->focus);
|
|
|
|
break;
|
2007-07-25 00:06:42 +02:00
|
|
|
case WM_MOUSEACTIVATE:
|
|
|
|
return MA_ACTIVATE;
|
2005-08-01 12:59:45 +02:00
|
|
|
}
|
2005-04-14 13:30:50 +02:00
|
|
|
|
|
|
|
return DefWindowProcW(hwnd, msg, wParam, lParam);
|
|
|
|
}
|
|
|
|
|
2005-06-16 17:52:44 +02:00
|
|
|
static void register_serverwnd_class(void)
|
2005-04-14 13:30:50 +02:00
|
|
|
{
|
|
|
|
static WNDCLASSEXW wndclass = {
|
|
|
|
sizeof(WNDCLASSEXW),
|
|
|
|
CS_DBLCLKS,
|
|
|
|
serverwnd_proc,
|
|
|
|
0, 0, NULL, NULL, NULL, NULL, NULL,
|
2020-11-24 23:29:19 +01:00
|
|
|
L"Internet Explorer_Server",
|
2005-04-14 13:30:50 +02:00
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
wndclass.hInstance = hInst;
|
|
|
|
serverwnd_class = RegisterClassExW(&wndclass);
|
|
|
|
}
|
|
|
|
|
2009-09-16 22:10:03 +02:00
|
|
|
static HRESULT activate_window(HTMLDocumentObj *This)
|
2005-08-15 11:41:30 +02:00
|
|
|
{
|
|
|
|
IOleInPlaceFrame *pIPFrame;
|
2005-08-18 12:50:05 +02:00
|
|
|
IOleCommandTarget *cmdtrg;
|
2007-06-14 21:10:07 +02:00
|
|
|
IOleInPlaceSiteEx *ipsiteex;
|
2005-08-15 11:41:30 +02:00
|
|
|
RECT posrect, cliprect;
|
|
|
|
OLEINPLACEFRAMEINFO frameinfo;
|
|
|
|
HWND parent_hwnd;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
if(!serverwnd_class)
|
|
|
|
register_serverwnd_class();
|
|
|
|
|
|
|
|
hres = IOleInPlaceSite_CanInPlaceActivate(This->ipsite);
|
|
|
|
if(hres != S_OK) {
|
2022-02-15 07:29:41 +01:00
|
|
|
WARN("CanInPlaceActivate returned: %08lx\n", hres);
|
2005-08-15 11:41:30 +02:00
|
|
|
return FAILED(hres) ? hres : E_FAIL;
|
|
|
|
}
|
|
|
|
|
2011-03-16 15:14:19 +01:00
|
|
|
frameinfo.cb = sizeof(OLEINPLACEFRAMEINFO);
|
2007-07-25 00:06:42 +02:00
|
|
|
hres = IOleInPlaceSite_GetWindowContext(This->ipsite, &pIPFrame, &This->ip_window,
|
2007-06-22 23:32:22 +02:00
|
|
|
&posrect, &cliprect, &frameinfo);
|
2005-08-15 11:41:30 +02:00
|
|
|
if(FAILED(hres)) {
|
2022-02-15 07:29:41 +01:00
|
|
|
WARN("GetWindowContext failed: %08lx\n", hres);
|
2005-08-15 11:41:30 +02:00
|
|
|
return hres;
|
|
|
|
}
|
2006-03-27 21:02:28 +02:00
|
|
|
|
2016-04-20 10:37:03 +02:00
|
|
|
TRACE("got window context: %p %p %s %s {%d %x %p %p %d}\n",
|
|
|
|
pIPFrame, This->ip_window, wine_dbgstr_rect(&posrect), wine_dbgstr_rect(&cliprect),
|
2005-08-15 11:41:30 +02:00
|
|
|
frameinfo.cb, frameinfo.fMDIApp, frameinfo.hwndFrame, frameinfo.haccel, frameinfo.cAccelEntries);
|
|
|
|
|
|
|
|
hres = IOleInPlaceSite_GetWindow(This->ipsite, &parent_hwnd);
|
|
|
|
if(FAILED(hres)) {
|
2022-02-15 07:29:41 +01:00
|
|
|
WARN("GetWindow failed: %08lx\n", hres);
|
2005-08-15 11:41:30 +02:00
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("got parent window %p\n", parent_hwnd);
|
|
|
|
|
2009-09-16 22:10:47 +02:00
|
|
|
if(This->hwnd) {
|
|
|
|
if(GetParent(This->hwnd) != parent_hwnd)
|
|
|
|
SetParent(This->hwnd, parent_hwnd);
|
|
|
|
SetWindowPos(This->hwnd, HWND_TOP,
|
2005-08-15 11:41:30 +02:00
|
|
|
posrect.left, posrect.top, posrect.right-posrect.left, posrect.bottom-posrect.top,
|
|
|
|
SWP_NOACTIVATE | SWP_SHOWWINDOW);
|
|
|
|
}else {
|
2020-11-24 23:29:19 +01:00
|
|
|
CreateWindowExW(0, L"Internet Explorer_Server", NULL,
|
2005-08-15 11:41:30 +02:00
|
|
|
WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
|
|
|
|
posrect.left, posrect.top, posrect.right-posrect.left, posrect.bottom-posrect.top,
|
|
|
|
parent_hwnd, NULL, hInst, This);
|
|
|
|
|
2009-09-16 22:10:47 +02:00
|
|
|
TRACE("Created window %p\n", This->hwnd);
|
2005-08-15 11:41:30 +02:00
|
|
|
|
2009-09-16 22:10:47 +02:00
|
|
|
SetWindowPos(This->hwnd, NULL, 0, 0, 0, 0,
|
2005-08-15 11:41:30 +02:00
|
|
|
SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOREDRAW | SWP_NOACTIVATE | SWP_SHOWWINDOW);
|
2009-09-16 22:10:47 +02:00
|
|
|
RedrawWindow(This->hwnd, NULL, NULL, RDW_INVALIDATE | RDW_NOERASE | RDW_ALLCHILDREN);
|
|
|
|
SetTimer(This->hwnd, TIMER_ID, 100, NULL);
|
2005-08-15 11:41:30 +02:00
|
|
|
}
|
|
|
|
|
2009-09-16 22:10:03 +02:00
|
|
|
if(This->nscontainer)
|
|
|
|
activate_gecko(This->nscontainer);
|
2007-06-22 23:32:22 +02:00
|
|
|
|
2009-09-16 22:11:26 +02:00
|
|
|
This->in_place_active = TRUE;
|
2007-06-14 21:10:07 +02:00
|
|
|
hres = IOleInPlaceSite_QueryInterface(This->ipsite, &IID_IOleInPlaceSiteEx, (void**)&ipsiteex);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
BOOL redraw = FALSE;
|
|
|
|
|
|
|
|
hres = IOleInPlaceSiteEx_OnInPlaceActivateEx(ipsiteex, &redraw, 0);
|
|
|
|
IOleInPlaceSiteEx_Release(ipsiteex);
|
|
|
|
if(redraw)
|
|
|
|
FIXME("unsupported redraw\n");
|
|
|
|
}else{
|
|
|
|
hres = IOleInPlaceSite_OnInPlaceActivate(This->ipsite);
|
|
|
|
}
|
2005-08-15 11:41:30 +02:00
|
|
|
if(FAILED(hres)) {
|
2022-02-15 07:29:41 +01:00
|
|
|
WARN("OnInPlaceActivate failed: %08lx\n", hres);
|
2009-09-16 22:11:26 +02:00
|
|
|
This->in_place_active = FALSE;
|
2005-08-15 11:41:30 +02:00
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
|
2005-08-18 12:50:05 +02:00
|
|
|
hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget, (void**)&cmdtrg);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
VARIANT var;
|
|
|
|
|
|
|
|
IOleInPlaceFrame_SetStatusText(pIPFrame, NULL);
|
|
|
|
|
|
|
|
V_VT(&var) = VT_I4;
|
|
|
|
V_I4(&var) = 0;
|
2006-08-18 14:53:25 +02:00
|
|
|
IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_SETPROGRESSMAX,
|
|
|
|
OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
|
|
|
|
IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_SETPROGRESSPOS,
|
|
|
|
OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
|
2005-08-18 12:50:05 +02:00
|
|
|
|
|
|
|
IOleCommandTarget_Release(cmdtrg);
|
|
|
|
}
|
|
|
|
|
2005-08-15 11:41:30 +02:00
|
|
|
if(This->frame)
|
|
|
|
IOleInPlaceFrame_Release(This->frame);
|
|
|
|
This->frame = pIPFrame;
|
|
|
|
|
2009-12-07 14:54:33 +01:00
|
|
|
if(!This->request_uiactivate) {
|
|
|
|
hres = IOleInPlaceSite_QueryInterface(This->ipsite, &IID_IOleInPlaceSiteEx, (void**)&ipsiteex);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
IOleInPlaceSiteEx_RequestUIActivate(ipsiteex);
|
|
|
|
IOleInPlaceSiteEx_Release(ipsiteex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-09-16 22:11:26 +02:00
|
|
|
This->window_active = TRUE;
|
2005-08-15 11:41:30 +02:00
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
2007-05-24 19:16:02 +02:00
|
|
|
static LRESULT WINAPI tooltips_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
2006-03-27 21:02:28 +02:00
|
|
|
{
|
2020-11-24 23:29:19 +01:00
|
|
|
tooltip_data *data = GetPropW(hwnd, L"tooltip_data");
|
2006-03-27 21:02:28 +02:00
|
|
|
|
|
|
|
TRACE("%d %p\n", msg, data);
|
|
|
|
|
|
|
|
if(msg == TTM_WINDOWFROMPOINT) {
|
|
|
|
RECT rect;
|
|
|
|
POINT *pt = (POINT*)lParam;
|
|
|
|
|
2022-02-15 07:29:41 +01:00
|
|
|
TRACE("TTM_WINDOWFROMPOINT (%ld,%ld)\n", pt->x, pt->y);
|
2006-03-27 21:02:28 +02:00
|
|
|
|
|
|
|
GetWindowRect(data->doc->hwnd, &rect);
|
|
|
|
|
|
|
|
if(rect.left <= pt->x && pt->x <= rect.right
|
|
|
|
&& rect.top <= pt->y && pt->y <= rect.bottom)
|
|
|
|
return (LPARAM)data->doc->hwnd;
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallWindowProcW(data->proc, hwnd, msg, wParam, lParam);
|
|
|
|
}
|
|
|
|
|
2009-09-16 22:10:47 +02:00
|
|
|
static void create_tooltips_window(HTMLDocumentObj *This)
|
2006-03-27 21:02:28 +02:00
|
|
|
{
|
2007-12-05 21:52:31 +01:00
|
|
|
tooltip_data *data = heap_alloc(sizeof(*data));
|
2006-03-27 21:02:28 +02:00
|
|
|
|
|
|
|
This->tooltips_hwnd = CreateWindowExW(0, TOOLTIPS_CLASSW, NULL, TTS_NOPREFIX | WS_POPUP,
|
|
|
|
CW_USEDEFAULT, CW_USEDEFAULT, 10, 10, This->hwnd, NULL, hInst, NULL);
|
|
|
|
|
|
|
|
data->doc = This;
|
|
|
|
data->proc = (WNDPROC)GetWindowLongPtrW(This->tooltips_hwnd, GWLP_WNDPROC);
|
|
|
|
|
2020-11-24 23:29:19 +01:00
|
|
|
SetPropW(This->tooltips_hwnd, L"tooltip_data", data);
|
2006-03-27 21:02:28 +02:00
|
|
|
|
|
|
|
SetWindowLongPtrW(This->tooltips_hwnd, GWLP_WNDPROC, (LONG_PTR)tooltips_proc);
|
|
|
|
|
|
|
|
SetWindowPos(This->tooltips_hwnd, HWND_TOPMOST,0, 0, 0, 0,
|
|
|
|
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2009-09-16 22:10:47 +02:00
|
|
|
void show_tooltip(HTMLDocumentObj *This, DWORD x, DWORD y, LPCWSTR text)
|
2006-03-27 21:02:28 +02:00
|
|
|
{
|
|
|
|
TTTOOLINFOW toolinfo = {
|
|
|
|
sizeof(TTTOOLINFOW), 0, This->hwnd, 0xdeadbeef,
|
|
|
|
{x>2 ? x-2 : 0, y>0 ? y-2 : 0, x+2, y+2}, /* FIXME */
|
|
|
|
NULL, (LPWSTR)text, 0};
|
|
|
|
MSG msg = {This->hwnd, WM_MOUSEMOVE, 0, MAKELPARAM(x,y), 0, {x,y}};
|
|
|
|
|
2022-02-15 07:29:41 +01:00
|
|
|
TRACE("(%p)->(%ld %ld %s)\n", This, x, y, debugstr_w(text));
|
2006-03-27 21:02:28 +02:00
|
|
|
|
|
|
|
if(!This->tooltips_hwnd)
|
|
|
|
create_tooltips_window(This);
|
|
|
|
|
|
|
|
SendMessageW(This->tooltips_hwnd, TTM_ADDTOOLW, 0, (LPARAM)&toolinfo);
|
|
|
|
SendMessageW(This->tooltips_hwnd, TTM_ACTIVATE, TRUE, 0);
|
|
|
|
SendMessageW(This->tooltips_hwnd, TTM_RELAYEVENT, 0, (LPARAM)&msg);
|
|
|
|
}
|
|
|
|
|
2009-09-16 22:10:47 +02:00
|
|
|
void hide_tooltip(HTMLDocumentObj *This)
|
2006-03-27 21:02:28 +02:00
|
|
|
{
|
|
|
|
TTTOOLINFOW toolinfo = {
|
|
|
|
sizeof(TTTOOLINFOW), 0, This->hwnd, 0xdeadbeef,
|
|
|
|
{0,0,0,0}, NULL, NULL, 0};
|
|
|
|
|
|
|
|
TRACE("(%p)\n", This);
|
|
|
|
|
|
|
|
SendMessageW(This->tooltips_hwnd, TTM_DELTOOLW, 0, (LPARAM)&toolinfo);
|
|
|
|
SendMessageW(This->tooltips_hwnd, TTM_ACTIVATE, FALSE, 0);
|
|
|
|
}
|
|
|
|
|
2007-11-20 01:49:36 +01:00
|
|
|
HRESULT call_set_active_object(IOleInPlaceUIWindow *window, IOleInPlaceActiveObject *act_obj)
|
|
|
|
{
|
|
|
|
static WCHAR html_documentW[30];
|
|
|
|
|
2018-08-23 23:31:15 +02:00
|
|
|
if(act_obj && !html_documentW[0])
|
|
|
|
LoadStringW(hInst, IDS_HTMLDOCUMENT, html_documentW, ARRAY_SIZE(html_documentW));
|
2007-11-20 01:49:36 +01:00
|
|
|
|
2012-07-26 11:37:48 +02:00
|
|
|
return IOleInPlaceUIWindow_SetActiveObject(window, act_obj, act_obj ? html_documentW : NULL);
|
2007-11-20 01:49:36 +01:00
|
|
|
}
|
|
|
|
|
2005-04-13 16:41:19 +02:00
|
|
|
/**********************************************************
|
|
|
|
* IOleDocumentView implementation
|
|
|
|
*/
|
|
|
|
|
2018-02-28 16:31:56 +01:00
|
|
|
static inline HTMLDocumentObj *impl_from_IOleDocumentView(IOleDocumentView *iface)
|
2010-12-23 02:19:14 +01:00
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
return CONTAINING_RECORD(iface, HTMLDocumentObj, IOleDocumentView_iface);
|
2010-12-23 02:19:14 +01:00
|
|
|
}
|
2005-04-13 16:41:19 +02:00
|
|
|
|
|
|
|
static HRESULT WINAPI OleDocumentView_QueryInterface(IOleDocumentView *iface, REFIID riid, void **ppvObject)
|
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IOleDocumentView(iface);
|
|
|
|
return htmldoc_query_interface(&This->basedoc, riid, ppvObject);
|
2005-04-13 16:41:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI OleDocumentView_AddRef(IOleDocumentView *iface)
|
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IOleDocumentView(iface);
|
|
|
|
return htmldoc_addref(&This->basedoc);
|
2005-04-13 16:41:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI OleDocumentView_Release(IOleDocumentView *iface)
|
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IOleDocumentView(iface);
|
|
|
|
return htmldoc_release(&This->basedoc);
|
2005-04-13 16:41:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleDocumentView_SetInPlaceSite(IOleDocumentView *iface, IOleInPlaceSite *pIPSite)
|
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IOleDocumentView(iface);
|
2005-04-13 16:41:19 +02:00
|
|
|
TRACE("(%p)->(%p)\n", This, pIPSite);
|
|
|
|
|
|
|
|
if(pIPSite)
|
|
|
|
IOleInPlaceSite_AddRef(pIPSite);
|
|
|
|
|
2018-02-28 16:31:56 +01:00
|
|
|
if(This->ipsite)
|
|
|
|
IOleInPlaceSite_Release(This->ipsite);
|
2005-04-13 16:41:19 +02:00
|
|
|
|
2018-02-28 16:31:56 +01:00
|
|
|
This->ipsite = pIPSite;
|
|
|
|
This->request_uiactivate = TRUE;
|
2005-04-13 16:41:19 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleDocumentView_GetInPlaceSite(IOleDocumentView *iface, IOleInPlaceSite **ppIPSite)
|
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IOleDocumentView(iface);
|
2005-04-13 16:41:19 +02:00
|
|
|
TRACE("(%p)->(%p)\n", This, ppIPSite);
|
|
|
|
|
|
|
|
if(!ppIPSite)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2018-02-28 16:31:56 +01:00
|
|
|
if(This->ipsite)
|
|
|
|
IOleInPlaceSite_AddRef(This->ipsite);
|
2005-04-13 16:41:19 +02:00
|
|
|
|
2018-02-28 16:31:56 +01:00
|
|
|
*ppIPSite = This->ipsite;
|
2005-04-13 16:41:19 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleDocumentView_GetDocument(IOleDocumentView *iface, IUnknown **ppunk)
|
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IOleDocumentView(iface);
|
2005-04-13 16:41:19 +02:00
|
|
|
TRACE("(%p)->(%p)\n", This, ppunk);
|
|
|
|
|
|
|
|
if(!ppunk)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2018-02-28 16:31:56 +01:00
|
|
|
*ppunk = (IUnknown*)&This->basedoc.IHTMLDocument2_iface;
|
|
|
|
IUnknown_AddRef(*ppunk);
|
2005-04-13 16:41:19 +02:00
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleDocumentView_SetRect(IOleDocumentView *iface, LPRECT prcView)
|
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IOleDocumentView(iface);
|
2005-04-14 13:30:50 +02:00
|
|
|
RECT rect;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, prcView);
|
|
|
|
|
|
|
|
if(!prcView)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2018-02-28 16:31:56 +01:00
|
|
|
if(This->hwnd) {
|
|
|
|
GetClientRect(This->hwnd, &rect);
|
2016-10-20 10:24:06 +02:00
|
|
|
if(!EqualRect(prcView, &rect)) {
|
2018-02-28 16:31:56 +01:00
|
|
|
InvalidateRect(This->hwnd, NULL, TRUE);
|
2019-05-21 16:36:03 +02:00
|
|
|
SetWindowPos(This->hwnd, NULL, prcView->left, prcView->top, prcView->right - prcView->left,
|
|
|
|
prcView->bottom - prcView->top, SWP_NOZORDER | SWP_NOACTIVATE);
|
2005-04-14 13:30:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return S_OK;
|
2005-04-13 16:41:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleDocumentView_GetRect(IOleDocumentView *iface, LPRECT prcView)
|
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IOleDocumentView(iface);
|
2005-04-14 13:30:50 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%p)\n", This, prcView);
|
|
|
|
|
|
|
|
if(!prcView)
|
|
|
|
return E_INVALIDARG;
|
|
|
|
|
2018-02-28 16:31:56 +01:00
|
|
|
GetClientRect(This->hwnd, prcView);
|
2019-05-21 16:36:10 +02:00
|
|
|
MapWindowPoints(This->hwnd, GetParent(This->hwnd), (POINT*)prcView, 2);
|
2005-04-14 13:30:50 +02:00
|
|
|
return S_OK;
|
2005-04-13 16:41:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleDocumentView_SetRectComplex(IOleDocumentView *iface, LPRECT prcView,
|
|
|
|
LPRECT prcHScroll, LPRECT prcVScroll, LPRECT prcSizeBox)
|
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IOleDocumentView(iface);
|
2005-04-13 16:41:19 +02:00
|
|
|
FIXME("(%p)->(%p %p %p %p)\n", This, prcView, prcHScroll, prcVScroll, prcSizeBox);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleDocumentView_Show(IOleDocumentView *iface, BOOL fShow)
|
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IOleDocumentView(iface);
|
2005-08-15 11:41:30 +02:00
|
|
|
HRESULT hres;
|
|
|
|
|
2005-04-15 18:12:45 +02:00
|
|
|
TRACE("(%p)->(%x)\n", This, fShow);
|
|
|
|
|
2005-08-15 11:41:30 +02:00
|
|
|
if(fShow) {
|
2018-02-28 16:31:56 +01:00
|
|
|
if(!This->ui_active) {
|
|
|
|
hres = activate_window(This);
|
2005-08-15 11:41:30 +02:00
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
|
|
|
}
|
2018-02-28 16:31:56 +01:00
|
|
|
update_doc(This, UPDATE_UI);
|
|
|
|
ShowWindow(This->hwnd, SW_SHOW);
|
2005-08-15 11:41:30 +02:00
|
|
|
}else {
|
2018-02-28 16:31:56 +01:00
|
|
|
ShowWindow(This->hwnd, SW_HIDE);
|
2009-12-07 14:54:33 +01:00
|
|
|
|
2018-02-28 16:31:56 +01:00
|
|
|
if(This->in_place_active)
|
|
|
|
IOleInPlaceObjectWindowless_InPlaceDeactivate(&This->basedoc.IOleInPlaceObjectWindowless_iface);
|
2009-12-07 14:54:33 +01:00
|
|
|
|
2018-02-28 16:31:56 +01:00
|
|
|
if(This->ip_window) {
|
|
|
|
IOleInPlaceUIWindow_Release(This->ip_window);
|
|
|
|
This->ip_window = NULL;
|
2007-07-25 00:06:42 +02:00
|
|
|
}
|
2005-08-15 11:41:30 +02:00
|
|
|
}
|
2005-04-15 18:12:45 +02:00
|
|
|
|
|
|
|
return S_OK;
|
2005-04-13 16:41:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL fUIActivate)
|
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IOleDocumentView(iface);
|
2005-04-14 13:30:50 +02:00
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
TRACE("(%p)->(%x)\n", This, fUIActivate);
|
|
|
|
|
2018-02-28 16:31:56 +01:00
|
|
|
if(!This->ipsite) {
|
|
|
|
IOleClientSite *cs = This->client;
|
2009-12-07 14:54:33 +01:00
|
|
|
IOleInPlaceSite *ips;
|
|
|
|
|
|
|
|
if(!cs) {
|
|
|
|
WARN("this->ipsite = NULL\n");
|
|
|
|
return E_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
hres = IOleClientSite_QueryInterface(cs, &IID_IOleInPlaceSiteWindowless, (void**)&ips);
|
|
|
|
if(SUCCEEDED(hres))
|
2018-02-28 16:31:56 +01:00
|
|
|
This->ipsite = ips;
|
2009-12-07 14:54:33 +01:00
|
|
|
else {
|
|
|
|
hres = IOleClientSite_QueryInterface(cs, &IID_IOleInPlaceSiteEx, (void**)&ips);
|
|
|
|
if(SUCCEEDED(hres))
|
2018-02-28 16:31:56 +01:00
|
|
|
This->ipsite = ips;
|
2009-12-07 14:54:33 +01:00
|
|
|
else {
|
|
|
|
hres = IOleClientSite_QueryInterface(cs, &IID_IOleInPlaceSite, (void**)&ips);
|
|
|
|
if(SUCCEEDED(hres))
|
2018-02-28 16:31:56 +01:00
|
|
|
This->ipsite = ips;
|
2009-12-07 14:54:33 +01:00
|
|
|
else {
|
|
|
|
WARN("this->ipsite = NULL\n");
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-02-28 16:31:56 +01:00
|
|
|
IOleInPlaceSite_AddRef(This->ipsite);
|
|
|
|
This->request_uiactivate = FALSE;
|
|
|
|
HTMLDocument_LockContainer(This, TRUE);
|
2005-04-14 13:30:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if(fUIActivate) {
|
2007-07-25 00:06:42 +02:00
|
|
|
RECT rcBorderWidths;
|
|
|
|
|
2018-02-28 16:31:56 +01:00
|
|
|
if(This->ui_active)
|
2005-04-14 13:30:50 +02:00
|
|
|
return S_OK;
|
2005-08-01 12:59:45 +02:00
|
|
|
|
2018-02-28 16:31:56 +01:00
|
|
|
if(!This->window_active) {
|
|
|
|
hres = activate_window(This);
|
2005-08-15 11:41:30 +02:00
|
|
|
if(FAILED(hres))
|
|
|
|
return hres;
|
2005-07-18 11:13:32 +02:00
|
|
|
}
|
2005-04-14 13:30:50 +02:00
|
|
|
|
2018-02-28 16:31:56 +01:00
|
|
|
This->focus = TRUE;
|
|
|
|
if(This->nscontainer)
|
|
|
|
nsIWebBrowserFocus_Activate(This->nscontainer->focus);
|
|
|
|
notif_focus(This);
|
2007-07-25 00:06:42 +02:00
|
|
|
|
2018-02-28 16:31:56 +01:00
|
|
|
update_doc(This, UPDATE_UI);
|
2007-06-10 11:38:51 +02:00
|
|
|
|
2018-02-28 16:31:56 +01:00
|
|
|
hres = IOleInPlaceSite_OnUIActivate(This->ipsite);
|
2005-04-14 13:30:50 +02:00
|
|
|
if(SUCCEEDED(hres)) {
|
2018-02-28 16:31:56 +01:00
|
|
|
call_set_active_object((IOleInPlaceUIWindow*)This->frame,
|
|
|
|
&This->basedoc.IOleInPlaceActiveObject_iface);
|
2005-04-14 13:30:50 +02:00
|
|
|
}else {
|
2022-02-15 07:29:41 +01:00
|
|
|
FIXME("OnUIActivate failed: %08lx\n", hres);
|
2018-02-28 16:31:56 +01:00
|
|
|
IOleInPlaceFrame_Release(This->frame);
|
|
|
|
This->frame = NULL;
|
|
|
|
This->ui_active = FALSE;
|
2005-04-14 13:30:50 +02:00
|
|
|
return hres;
|
|
|
|
}
|
2005-07-13 13:29:38 +02:00
|
|
|
|
2018-02-28 16:31:56 +01:00
|
|
|
if(This->hostui) {
|
|
|
|
hres = IDocHostUIHandler_ShowUI(This->hostui,
|
2019-03-12 16:10:24 +01:00
|
|
|
This->nscontainer->usermode == EDITMODE ? DOCHOSTUITYPE_AUTHOR : DOCHOSTUITYPE_BROWSE,
|
2018-02-28 16:31:56 +01:00
|
|
|
&This->basedoc.IOleInPlaceActiveObject_iface, &This->basedoc.IOleCommandTarget_iface,
|
|
|
|
This->frame, This->ip_window);
|
2008-10-10 22:47:47 +02:00
|
|
|
if(FAILED(hres))
|
2018-02-28 16:31:56 +01:00
|
|
|
IDocHostUIHandler_HideUI(This->hostui);
|
2008-10-10 22:47:47 +02:00
|
|
|
}
|
2005-08-15 11:41:30 +02:00
|
|
|
|
2018-02-28 16:31:56 +01:00
|
|
|
if(This->ip_window)
|
|
|
|
call_set_active_object(This->ip_window, &This->basedoc.IOleInPlaceActiveObject_iface);
|
2007-07-25 00:06:42 +02:00
|
|
|
|
2016-07-30 22:06:02 +02:00
|
|
|
SetRectEmpty(&rcBorderWidths);
|
2018-02-28 16:31:56 +01:00
|
|
|
IOleInPlaceFrame_SetBorderSpace(This->frame, &rcBorderWidths);
|
2007-07-25 00:06:42 +02:00
|
|
|
|
2018-02-28 16:31:56 +01:00
|
|
|
This->ui_active = TRUE;
|
2005-04-14 13:30:50 +02:00
|
|
|
}else {
|
2018-02-28 16:31:56 +01:00
|
|
|
This->focus = FALSE;
|
|
|
|
nsIWebBrowserFocus_Deactivate(This->nscontainer->focus);
|
|
|
|
if(This->ui_active) {
|
|
|
|
This->ui_active = FALSE;
|
|
|
|
if(This->ip_window)
|
|
|
|
call_set_active_object(This->ip_window, NULL);
|
|
|
|
if(This->frame)
|
|
|
|
call_set_active_object((IOleInPlaceUIWindow*)This->frame, NULL);
|
|
|
|
if(This->hostui)
|
|
|
|
IDocHostUIHandler_HideUI(This->hostui);
|
|
|
|
if(This->ipsite)
|
|
|
|
IOleInPlaceSite_OnUIDeactivate(This->ipsite, FALSE);
|
2005-08-15 11:41:30 +02:00
|
|
|
}
|
2005-04-14 13:30:50 +02:00
|
|
|
}
|
|
|
|
return S_OK;
|
2005-04-13 16:41:19 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleDocumentView_Open(IOleDocumentView *iface)
|
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IOleDocumentView(iface);
|
2005-04-13 16:41:19 +02:00
|
|
|
FIXME("(%p)\n", This);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleDocumentView_CloseView(IOleDocumentView *iface, DWORD dwReserved)
|
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IOleDocumentView(iface);
|
2022-02-15 07:29:41 +01:00
|
|
|
TRACE("(%p)->(%lx)\n", This, dwReserved);
|
2005-04-15 18:12:45 +02:00
|
|
|
|
|
|
|
if(dwReserved)
|
2022-02-15 07:29:41 +01:00
|
|
|
WARN("dwReserved = %ld\n", dwReserved);
|
2005-04-15 18:12:45 +02:00
|
|
|
|
|
|
|
IOleDocumentView_Show(iface, FALSE);
|
|
|
|
return S_OK;
|
2005-04-13 16:41:19 +02:00
|
|
|
}
|
|
|
|
|
2016-07-19 10:03:12 +02:00
|
|
|
static HRESULT WINAPI OleDocumentView_SaveViewState(IOleDocumentView *iface, IStream *pstm)
|
2005-04-13 16:41:19 +02:00
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IOleDocumentView(iface);
|
2005-04-13 16:41:19 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, pstm);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2016-07-19 10:03:12 +02:00
|
|
|
static HRESULT WINAPI OleDocumentView_ApplyViewState(IOleDocumentView *iface, IStream *pstm)
|
2005-04-13 16:41:19 +02:00
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IOleDocumentView(iface);
|
2005-04-13 16:41:19 +02:00
|
|
|
FIXME("(%p)->(%p)\n", This, pstm);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleDocumentView_Clone(IOleDocumentView *iface, IOleInPlaceSite *pIPSiteNew,
|
|
|
|
IOleDocumentView **ppViewNew)
|
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IOleDocumentView(iface);
|
2005-04-13 16:41:19 +02:00
|
|
|
FIXME("(%p)->(%p %p)\n", This, pIPSiteNew, ppViewNew);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2005-06-01 21:57:42 +02:00
|
|
|
static const IOleDocumentViewVtbl OleDocumentViewVtbl = {
|
2005-04-13 16:41:19 +02:00
|
|
|
OleDocumentView_QueryInterface,
|
|
|
|
OleDocumentView_AddRef,
|
|
|
|
OleDocumentView_Release,
|
|
|
|
OleDocumentView_SetInPlaceSite,
|
|
|
|
OleDocumentView_GetInPlaceSite,
|
|
|
|
OleDocumentView_GetDocument,
|
|
|
|
OleDocumentView_SetRect,
|
|
|
|
OleDocumentView_GetRect,
|
|
|
|
OleDocumentView_SetRectComplex,
|
|
|
|
OleDocumentView_Show,
|
|
|
|
OleDocumentView_UIActivate,
|
|
|
|
OleDocumentView_Open,
|
|
|
|
OleDocumentView_CloseView,
|
|
|
|
OleDocumentView_SaveViewState,
|
|
|
|
OleDocumentView_ApplyViewState,
|
|
|
|
OleDocumentView_Clone
|
|
|
|
};
|
|
|
|
|
2005-06-23 18:44:43 +02:00
|
|
|
/**********************************************************
|
|
|
|
* IViewObject implementation
|
|
|
|
*/
|
|
|
|
|
2018-02-28 16:31:56 +01:00
|
|
|
static inline HTMLDocumentObj *impl_from_IViewObjectEx(IViewObjectEx *iface)
|
2010-12-23 02:21:09 +01:00
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
return CONTAINING_RECORD(iface, HTMLDocumentObj, IViewObjectEx_iface);
|
2010-12-23 02:21:09 +01:00
|
|
|
}
|
2005-06-23 18:44:43 +02:00
|
|
|
|
2010-12-16 14:59:51 +01:00
|
|
|
static HRESULT WINAPI ViewObject_QueryInterface(IViewObjectEx *iface, REFIID riid, void **ppv)
|
2005-06-23 18:44:43 +02:00
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IViewObjectEx(iface);
|
|
|
|
return htmldoc_query_interface(&This->basedoc, riid, ppv);
|
2005-06-23 18:44:43 +02:00
|
|
|
}
|
|
|
|
|
2009-12-15 23:45:34 +01:00
|
|
|
static ULONG WINAPI ViewObject_AddRef(IViewObjectEx *iface)
|
2005-06-23 18:44:43 +02:00
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IViewObjectEx(iface);
|
|
|
|
return htmldoc_addref(&This->basedoc);
|
2005-06-23 18:44:43 +02:00
|
|
|
}
|
|
|
|
|
2009-12-15 23:45:34 +01:00
|
|
|
static ULONG WINAPI ViewObject_Release(IViewObjectEx *iface)
|
2005-06-23 18:44:43 +02:00
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IViewObjectEx(iface);
|
|
|
|
return htmldoc_release(&This->basedoc);
|
2005-06-23 18:44:43 +02:00
|
|
|
}
|
|
|
|
|
2009-12-15 23:45:34 +01:00
|
|
|
static HRESULT WINAPI ViewObject_Draw(IViewObjectEx *iface, DWORD dwDrawAspect, LONG lindex, void *pvAspect,
|
2005-06-23 18:44:43 +02:00
|
|
|
DVTARGETDEVICE *ptd, HDC hdcTargetDev, HDC hdcDraw, LPCRECTL lprcBounds,
|
|
|
|
LPCRECTL lprcWBounds, BOOL (CALLBACK *pfnContinue)(ULONG_PTR dwContinue), ULONG_PTR dwContinue)
|
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IViewObjectEx(iface);
|
2022-02-15 07:29:41 +01:00
|
|
|
FIXME("(%p)->(%ld %ld %p %p %p %p %p %p %p %Id)\n", This, dwDrawAspect, lindex, pvAspect,
|
2005-06-23 18:44:43 +02:00
|
|
|
ptd, hdcTargetDev, hdcDraw, lprcBounds, lprcWBounds, pfnContinue, dwContinue);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2009-12-15 23:45:34 +01:00
|
|
|
static HRESULT WINAPI ViewObject_GetColorSet(IViewObjectEx *iface, DWORD dwDrawAspect, LONG lindex, void *pvAspect,
|
2005-06-23 18:44:43 +02:00
|
|
|
DVTARGETDEVICE *ptd, HDC hicTargetDev, LOGPALETTE **ppColorSet)
|
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IViewObjectEx(iface);
|
2022-02-15 07:29:41 +01:00
|
|
|
FIXME("(%p)->(%ld %ld %p %p %p %p)\n", This, dwDrawAspect, lindex, pvAspect, ptd, hicTargetDev, ppColorSet);
|
2005-06-23 18:44:43 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2009-12-15 23:45:34 +01:00
|
|
|
static HRESULT WINAPI ViewObject_Freeze(IViewObjectEx *iface, DWORD dwDrawAspect, LONG lindex,
|
2005-06-23 18:44:43 +02:00
|
|
|
void *pvAspect, DWORD *pdwFreeze)
|
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IViewObjectEx(iface);
|
2022-02-15 07:29:41 +01:00
|
|
|
FIXME("(%p)->(%ld %ld %p %p)\n", This, dwDrawAspect, lindex, pvAspect, pdwFreeze);
|
2005-06-23 18:44:43 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2009-12-15 23:45:34 +01:00
|
|
|
static HRESULT WINAPI ViewObject_Unfreeze(IViewObjectEx *iface, DWORD dwFreeze)
|
2005-06-23 18:44:43 +02:00
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IViewObjectEx(iface);
|
2022-02-15 07:29:41 +01:00
|
|
|
FIXME("(%p)->(%ld)\n", This, dwFreeze);
|
2005-06-23 18:44:43 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2009-12-15 23:45:34 +01:00
|
|
|
static HRESULT WINAPI ViewObject_SetAdvise(IViewObjectEx *iface, DWORD aspects, DWORD advf, IAdviseSink *pAdvSink)
|
2005-06-23 18:44:43 +02:00
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IViewObjectEx(iface);
|
2010-02-15 16:03:25 +01:00
|
|
|
|
2022-02-15 07:29:41 +01:00
|
|
|
TRACE("(%p)->(%ld %ld %p)\n", This, aspects, advf, pAdvSink);
|
2010-02-15 16:03:25 +01:00
|
|
|
|
|
|
|
if(aspects != DVASPECT_CONTENT || advf != ADVF_PRIMEFIRST)
|
2010-03-20 15:24:53 +01:00
|
|
|
FIXME("unsupported arguments\n");
|
2010-02-15 16:03:25 +01:00
|
|
|
|
2018-02-28 16:31:56 +01:00
|
|
|
if(This->view_sink)
|
|
|
|
IAdviseSink_Release(This->view_sink);
|
2010-02-15 16:03:25 +01:00
|
|
|
if(pAdvSink)
|
|
|
|
IAdviseSink_AddRef(pAdvSink);
|
|
|
|
|
2018-02-28 16:31:56 +01:00
|
|
|
This->view_sink = pAdvSink;
|
2010-02-15 16:03:25 +01:00
|
|
|
return S_OK;
|
2005-06-23 18:44:43 +02:00
|
|
|
}
|
|
|
|
|
2009-12-15 23:45:34 +01:00
|
|
|
static HRESULT WINAPI ViewObject_GetAdvise(IViewObjectEx *iface, DWORD *pAspects, DWORD *pAdvf, IAdviseSink **ppAdvSink)
|
2005-06-23 18:44:43 +02:00
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IViewObjectEx(iface);
|
2005-06-23 18:44:43 +02:00
|
|
|
FIXME("(%p)->(%p %p %p)\n", This, pAspects, pAdvf, ppAdvSink);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2009-12-15 23:45:34 +01:00
|
|
|
static HRESULT WINAPI ViewObject_GetExtent(IViewObjectEx *iface, DWORD dwDrawAspect, LONG lindex,
|
2005-06-23 18:44:43 +02:00
|
|
|
DVTARGETDEVICE* ptd, LPSIZEL lpsizel)
|
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IViewObjectEx(iface);
|
2022-02-15 07:29:41 +01:00
|
|
|
FIXME("(%p)->(%ld %ld %p %p)\n", This, dwDrawAspect, lindex, ptd, lpsizel);
|
2005-06-23 18:44:43 +02:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
2009-12-15 23:45:34 +01:00
|
|
|
static HRESULT WINAPI ViewObject_GetRect(IViewObjectEx *iface, DWORD dwAspect, LPRECTL pRect)
|
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IViewObjectEx(iface);
|
2022-02-15 07:29:41 +01:00
|
|
|
FIXME("(%p)->(%ld %p)\n", This, dwAspect, pRect);
|
2009-12-15 23:45:34 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ViewObject_GetViewStatus(IViewObjectEx *iface, DWORD *pdwStatus)
|
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IViewObjectEx(iface);
|
2009-12-15 23:45:34 +01:00
|
|
|
FIXME("(%p)->(%p)\n", This, pdwStatus);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ViewObject_QueryHitPoint(IViewObjectEx* iface, DWORD dwAspect,
|
|
|
|
LPCRECT pRectBounds, POINT ptlLoc, LONG lCloseHint, DWORD *pHitResult)
|
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IViewObjectEx(iface);
|
2022-02-15 07:29:41 +01:00
|
|
|
FIXME("(%p)->(%ld %p (%ld %ld) %ld %p)\n", This, dwAspect, pRectBounds, ptlLoc.x,
|
2009-12-15 23:45:34 +01:00
|
|
|
ptlLoc.y, lCloseHint, pHitResult);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ViewObject_QueryHitRect(IViewObjectEx *iface, DWORD dwAspect,
|
|
|
|
LPCRECT pRectBounds, LPCRECT pRectLoc, LONG lCloseHint, DWORD *pHitResult)
|
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IViewObjectEx(iface);
|
2022-02-15 07:29:41 +01:00
|
|
|
FIXME("(%p)->(%ld %p %p %ld %p)\n", This, dwAspect, pRectBounds, pRectLoc, lCloseHint, pHitResult);
|
2009-12-15 23:45:34 +01:00
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ViewObject_GetNaturalExtent(IViewObjectEx *iface, DWORD dwAspect, LONG lindex,
|
|
|
|
DVTARGETDEVICE *ptd, HDC hicTargetDev, DVEXTENTINFO *pExtentInfo, LPSIZEL pSizel)
|
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
HTMLDocumentObj *This = impl_from_IViewObjectEx(iface);
|
2022-02-15 07:29:41 +01:00
|
|
|
FIXME("(%p)->(%ld %ld %p %p %p %p\n", This, dwAspect,lindex, ptd,
|
2009-12-15 23:45:34 +01:00
|
|
|
hicTargetDev, pExtentInfo, pSizel);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IViewObjectExVtbl ViewObjectVtbl = {
|
2005-06-23 18:44:43 +02:00
|
|
|
ViewObject_QueryInterface,
|
|
|
|
ViewObject_AddRef,
|
|
|
|
ViewObject_Release,
|
|
|
|
ViewObject_Draw,
|
|
|
|
ViewObject_GetColorSet,
|
|
|
|
ViewObject_Freeze,
|
|
|
|
ViewObject_Unfreeze,
|
|
|
|
ViewObject_SetAdvise,
|
|
|
|
ViewObject_GetAdvise,
|
2009-12-15 23:45:34 +01:00
|
|
|
ViewObject_GetExtent,
|
|
|
|
ViewObject_GetRect,
|
|
|
|
ViewObject_GetViewStatus,
|
|
|
|
ViewObject_QueryHitPoint,
|
|
|
|
ViewObject_QueryHitRect,
|
|
|
|
ViewObject_GetNaturalExtent
|
2005-06-23 18:44:43 +02:00
|
|
|
};
|
|
|
|
|
2012-05-30 15:49:15 +02:00
|
|
|
static inline HTMLDocumentObj *impl_from_IWindowForBindingUI(IWindowForBindingUI *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, HTMLDocumentObj, IWindowForBindingUI_iface);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI WindowForBindingUI_QueryInterface(IWindowForBindingUI *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
HTMLDocumentObj *This = impl_from_IWindowForBindingUI(iface);
|
|
|
|
|
|
|
|
if(IsEqualGUID(&IID_IUnknown, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
|
|
|
|
*ppv = &This->IWindowForBindingUI_iface;
|
|
|
|
}else if(IsEqualGUID(&IID_IWindowForBindingUI, riid)) {
|
|
|
|
TRACE("(%p)->(IID_IWindowForBindingUI %p)\n", This, ppv);
|
|
|
|
*ppv = &This->IWindowForBindingUI_iface;
|
|
|
|
}else {
|
|
|
|
WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
|
|
|
|
*ppv = NULL;
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI WindowForBindingUI_AddRef(IWindowForBindingUI *iface)
|
|
|
|
{
|
|
|
|
HTMLDocumentObj *This = impl_from_IWindowForBindingUI(iface);
|
|
|
|
return htmldoc_addref(&This->basedoc);
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI WindowForBindingUI_Release(IWindowForBindingUI *iface)
|
|
|
|
{
|
|
|
|
HTMLDocumentObj *This = impl_from_IWindowForBindingUI(iface);
|
|
|
|
return htmldoc_release(&This->basedoc);
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI WindowForBindingUI_GetWindow(IWindowForBindingUI *iface, REFGUID rguidReason, HWND *phwnd)
|
|
|
|
{
|
|
|
|
HTMLDocumentObj *This = impl_from_IWindowForBindingUI(iface);
|
2012-05-30 15:49:41 +02:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s %p)\n", This, debugstr_guid(rguidReason), phwnd);
|
|
|
|
|
|
|
|
*phwnd = This->hwnd;
|
|
|
|
return S_OK;
|
2012-05-30 15:49:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static const IWindowForBindingUIVtbl WindowForBindingUIVtbl = {
|
|
|
|
WindowForBindingUI_QueryInterface,
|
|
|
|
WindowForBindingUI_AddRef,
|
|
|
|
WindowForBindingUI_Release,
|
|
|
|
WindowForBindingUI_GetWindow
|
|
|
|
};
|
|
|
|
|
2018-02-28 16:31:56 +01:00
|
|
|
void HTMLDocument_View_Init(HTMLDocumentObj *doc)
|
2012-05-30 15:49:15 +02:00
|
|
|
{
|
2018-02-28 16:31:56 +01:00
|
|
|
doc->IOleDocumentView_iface.lpVtbl = &OleDocumentViewVtbl;
|
|
|
|
doc->IViewObjectEx_iface.lpVtbl = &ViewObjectVtbl;
|
2012-05-30 15:49:15 +02:00
|
|
|
doc->IWindowForBindingUI_iface.lpVtbl = &WindowForBindingUIVtbl;
|
|
|
|
}
|