mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-06 04:51:11 +00:00
mshtml: Moved exec_editmode implementation to a helper function in editor.c.
This commit is contained in:
parent
9d4284cc0d
commit
cf6288e2ab
|
@ -26,6 +26,7 @@
|
|||
#include "winuser.h"
|
||||
#include "ole2.h"
|
||||
#include "mshtmcid.h"
|
||||
#include "shlguid.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
|
@ -1263,3 +1264,104 @@ HRESULT editor_is_dirty(HTMLDocument *This)
|
|||
|
||||
return modified ? S_OK : S_FALSE;
|
||||
}
|
||||
|
||||
HRESULT setup_edit_mode(HTMLDocumentObj *doc)
|
||||
{
|
||||
IMoniker *mon;
|
||||
HRESULT hres;
|
||||
|
||||
if(doc->usermode == EDITMODE)
|
||||
return S_OK;
|
||||
|
||||
doc->usermode = EDITMODE;
|
||||
|
||||
if(doc->basedoc.window->mon) {
|
||||
CLSID clsid = IID_NULL;
|
||||
hres = IMoniker_GetClassID(doc->basedoc.window->mon, &clsid);
|
||||
if(SUCCEEDED(hres)) {
|
||||
/* We should use IMoniker::Save here */
|
||||
FIXME("Use CLSID %s\n", debugstr_guid(&clsid));
|
||||
}
|
||||
}
|
||||
|
||||
if(doc->frame)
|
||||
IOleInPlaceFrame_SetStatusText(doc->frame, NULL);
|
||||
|
||||
doc->basedoc.window->readystate = READYSTATE_UNINITIALIZED;
|
||||
|
||||
if(doc->client) {
|
||||
IOleCommandTarget *cmdtrg;
|
||||
|
||||
hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&cmdtrg);
|
||||
if(SUCCEEDED(hres)) {
|
||||
VARIANT var;
|
||||
|
||||
V_VT(&var) = VT_I4;
|
||||
V_I4(&var) = 0;
|
||||
IOleCommandTarget_Exec(cmdtrg, &CGID_ShellDocView, 37, 0, &var, NULL);
|
||||
|
||||
IOleCommandTarget_Release(cmdtrg);
|
||||
}
|
||||
}
|
||||
|
||||
if(doc->hostui) {
|
||||
DOCHOSTUIINFO hostinfo;
|
||||
|
||||
memset(&hostinfo, 0, sizeof(DOCHOSTUIINFO));
|
||||
hostinfo.cbSize = sizeof(DOCHOSTUIINFO);
|
||||
hres = IDocHostUIHandler_GetHostInfo(doc->hostui, &hostinfo);
|
||||
if(SUCCEEDED(hres))
|
||||
/* FIXME: use hostinfo */
|
||||
TRACE("hostinfo = {%u %08x %08x %s %s}\n",
|
||||
hostinfo.cbSize, hostinfo.dwFlags, hostinfo.dwDoubleClick,
|
||||
debugstr_w(hostinfo.pchHostCss), debugstr_w(hostinfo.pchHostNS));
|
||||
}
|
||||
|
||||
update_doc(&doc->basedoc, UPDATE_UI);
|
||||
|
||||
if(doc->basedoc.window->mon) {
|
||||
/* FIXME: We should find nicer way to do this */
|
||||
remove_target_tasks(doc->basedoc.task_magic);
|
||||
|
||||
mon = doc->basedoc.window->mon;
|
||||
IMoniker_AddRef(mon);
|
||||
}else {
|
||||
static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
|
||||
|
||||
hres = CreateURLMoniker(NULL, about_blankW, &mon);
|
||||
if(FAILED(hres)) {
|
||||
FIXME("CreateURLMoniker failed: %08x\n", hres);
|
||||
return hres;
|
||||
}
|
||||
}
|
||||
|
||||
hres = IPersistMoniker_Load(&doc->basedoc.IPersistMoniker_iface, TRUE, mon, NULL, 0);
|
||||
IMoniker_Release(mon);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(doc->ui_active) {
|
||||
if(doc->ip_window)
|
||||
call_set_active_object(doc->ip_window, NULL);
|
||||
if(doc->hostui)
|
||||
IDocHostUIHandler_HideUI(doc->hostui);
|
||||
}
|
||||
|
||||
if(doc->ui_active) {
|
||||
RECT rcBorderWidths;
|
||||
|
||||
if(doc->hostui)
|
||||
IDocHostUIHandler_ShowUI(doc->hostui, DOCHOSTUITYPE_AUTHOR,
|
||||
&doc->basedoc.IOleInPlaceActiveObject_iface, &doc->basedoc.IOleCommandTarget_iface,
|
||||
doc->frame, doc->ip_window);
|
||||
|
||||
if(doc->ip_window)
|
||||
call_set_active_object(doc->ip_window, &doc->basedoc.IOleInPlaceActiveObject_iface);
|
||||
|
||||
memset(&rcBorderWidths, 0, sizeof(rcBorderWidths));
|
||||
if(doc->frame)
|
||||
IOleInPlaceFrame_SetBorderSpace(doc->frame, &rcBorderWidths);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -952,6 +952,7 @@ void update_title(HTMLDocumentObj*) DECLSPEC_HIDDEN;
|
|||
HRESULT do_query_service(IUnknown*,REFGUID,REFIID,void**) DECLSPEC_HIDDEN;
|
||||
|
||||
/* editor */
|
||||
HRESULT setup_edit_mode(HTMLDocumentObj*) DECLSPEC_HIDDEN;
|
||||
void init_editor(HTMLDocument*) DECLSPEC_HIDDEN;
|
||||
void handle_edit_event(HTMLDocument*,nsIDOMEvent*) DECLSPEC_HIDDEN;
|
||||
HRESULT editor_exec_copy(HTMLDocument*,DWORD,VARIANT*,VARIANT*) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -592,109 +592,12 @@ static HRESULT exec_browsemode(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in
|
|||
|
||||
static HRESULT exec_editmode(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
|
||||
{
|
||||
IMoniker *mon;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%p)->(%08x %p %p)\n", This, cmdexecopt, in, out);
|
||||
|
||||
if(in || out)
|
||||
FIXME("unsupported args\n");
|
||||
|
||||
if(This->doc_obj->usermode == EDITMODE)
|
||||
return S_OK;
|
||||
|
||||
This->doc_obj->usermode = EDITMODE;
|
||||
|
||||
if(This->window->mon) {
|
||||
CLSID clsid = IID_NULL;
|
||||
hres = IMoniker_GetClassID(This->window->mon, &clsid);
|
||||
if(SUCCEEDED(hres)) {
|
||||
/* We should use IMoniker::Save here */
|
||||
FIXME("Use CLSID %s\n", debugstr_guid(&clsid));
|
||||
}
|
||||
}
|
||||
|
||||
if(This->doc_obj->frame)
|
||||
IOleInPlaceFrame_SetStatusText(This->doc_obj->frame, NULL);
|
||||
|
||||
This->window->readystate = READYSTATE_UNINITIALIZED;
|
||||
|
||||
if(This->doc_obj->client) {
|
||||
IOleCommandTarget *cmdtrg;
|
||||
|
||||
hres = IOleClientSite_QueryInterface(This->doc_obj->client, &IID_IOleCommandTarget,
|
||||
(void**)&cmdtrg);
|
||||
if(SUCCEEDED(hres)) {
|
||||
VARIANT var;
|
||||
|
||||
V_VT(&var) = VT_I4;
|
||||
V_I4(&var) = 0;
|
||||
IOleCommandTarget_Exec(cmdtrg, &CGID_ShellDocView, 37, 0, &var, NULL);
|
||||
|
||||
IOleCommandTarget_Release(cmdtrg);
|
||||
}
|
||||
}
|
||||
|
||||
if(This->doc_obj->hostui) {
|
||||
DOCHOSTUIINFO hostinfo;
|
||||
|
||||
memset(&hostinfo, 0, sizeof(DOCHOSTUIINFO));
|
||||
hostinfo.cbSize = sizeof(DOCHOSTUIINFO);
|
||||
hres = IDocHostUIHandler_GetHostInfo(This->doc_obj->hostui, &hostinfo);
|
||||
if(SUCCEEDED(hres))
|
||||
/* FIXME: use hostinfo */
|
||||
TRACE("hostinfo = {%u %08x %08x %s %s}\n",
|
||||
hostinfo.cbSize, hostinfo.dwFlags, hostinfo.dwDoubleClick,
|
||||
debugstr_w(hostinfo.pchHostCss), debugstr_w(hostinfo.pchHostNS));
|
||||
}
|
||||
|
||||
update_doc(This, UPDATE_UI);
|
||||
|
||||
if(This->window->mon) {
|
||||
/* FIXME: We should find nicer way to do this */
|
||||
remove_target_tasks(This->task_magic);
|
||||
|
||||
mon = This->window->mon;
|
||||
IMoniker_AddRef(mon);
|
||||
}else {
|
||||
static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
|
||||
|
||||
hres = CreateURLMoniker(NULL, about_blankW, &mon);
|
||||
if(FAILED(hres)) {
|
||||
FIXME("CreateURLMoniker failed: %08x\n", hres);
|
||||
return hres;
|
||||
}
|
||||
}
|
||||
|
||||
hres = IPersistMoniker_Load(&This->IPersistMoniker_iface, TRUE, mon, NULL, 0);
|
||||
IMoniker_Release(mon);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
if(This->doc_obj->ui_active) {
|
||||
if(This->doc_obj->ip_window)
|
||||
call_set_active_object(This->doc_obj->ip_window, NULL);
|
||||
if(This->doc_obj->hostui)
|
||||
IDocHostUIHandler_HideUI(This->doc_obj->hostui);
|
||||
}
|
||||
|
||||
if(This->doc_obj->ui_active) {
|
||||
RECT rcBorderWidths;
|
||||
|
||||
if(This->doc_obj->hostui)
|
||||
IDocHostUIHandler_ShowUI(This->doc_obj->hostui, DOCHOSTUITYPE_AUTHOR,
|
||||
&This->IOleInPlaceActiveObject_iface, &This->IOleCommandTarget_iface,
|
||||
This->doc_obj->frame, This->doc_obj->ip_window);
|
||||
|
||||
if(This->doc_obj->ip_window)
|
||||
call_set_active_object(This->doc_obj->ip_window, &This->IOleInPlaceActiveObject_iface);
|
||||
|
||||
memset(&rcBorderWidths, 0, sizeof(rcBorderWidths));
|
||||
if(This->doc_obj->frame)
|
||||
IOleInPlaceFrame_SetBorderSpace(This->doc_obj->frame, &rcBorderWidths);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
return setup_edit_mode(This->doc_obj);
|
||||
}
|
||||
|
||||
static HRESULT exec_htmleditmode(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, VARIANT *out)
|
||||
|
|
Loading…
Reference in a new issue