Commit 56b69dff authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Moved usermode to HTMLDocumentObj.

parent e52e57cf
......@@ -100,7 +100,7 @@ void set_dirty(HTMLDocument *This, VARIANT_BOOL dirty)
{
nsresult nsres;
if(This->usermode != EDITMODE || !This->doc_obj->nscontainer || !This->doc_obj->nscontainer->editor)
if(This->doc_obj->usermode != EDITMODE || !This->doc_obj->nscontainer || !This->doc_obj->nscontainer->editor)
return;
if(dirty) {
......@@ -150,7 +150,7 @@ static DWORD query_ns_edit_status(HTMLDocument *This, const char *nscmd)
nsICommandParams *nsparam;
PRBool b = FALSE;
if(This->usermode != EDITMODE || This->readystate < READYSTATE_INTERACTIVE)
if(This->doc_obj->usermode != EDITMODE || This->readystate < READYSTATE_INTERACTIVE)
return OLECMDF_SUPPORTED;
if(This->doc_obj->nscontainer && nscmd) {
......@@ -185,7 +185,7 @@ static DWORD query_align_status(HTMLDocument *This, const char *align_str)
nsICommandParams *nsparam;
char *align = NULL;
if(This->usermode != EDITMODE || This->readystate < READYSTATE_INTERACTIVE)
if(This->doc_obj->usermode != EDITMODE || This->readystate < READYSTATE_INTERACTIVE)
return OLECMDF_SUPPORTED;
if(This->doc_obj->nscontainer) {
......@@ -715,7 +715,7 @@ static HRESULT query_justify(HTMLDocument *This, OLECMD *cmd)
case IDM_JUSTIFYLEFT:
TRACE("(%p) IDM_JUSTIFYLEFT\n", This);
/* FIXME: We should set OLECMDF_LATCHED only if it's set explicitly. */
if(This->usermode != EDITMODE || This->readystate < READYSTATE_INTERACTIVE)
if(This->doc_obj->usermode != EDITMODE || This->readystate < READYSTATE_INTERACTIVE)
cmd->cmdf = OLECMDF_SUPPORTED;
else
cmd->cmdf = OLECMDF_SUPPORTED | OLECMDF_ENABLED;
......
......@@ -1940,6 +1940,7 @@ HRESULT HTMLDocument_Create(IUnknown *pUnkOuter, REFIID riid, void** ppvObject)
doc->nscontainer = NSContainer_Create(doc, NULL);
list_init(&doc->bindings);
doc->usermode = UNKNOWN_USERMODE;
if(doc->nscontainer) {
nsresult nsres;
......
......@@ -284,7 +284,6 @@ struct HTMLDocument {
HTMLWindow *window;
nsIDOMHTMLDocument *nsdoc;
USERMODE usermode;
READYSTATE readystate;
LPWSTR mime;
......@@ -350,6 +349,8 @@ struct HTMLDocumentObj {
BOOL container_locked;
BOOL focus;
USERMODE usermode;
/* FIXME: probably should be in document node object */
nsChannelBSC *bscallback;
IMoniker *mon;
......
......@@ -121,7 +121,7 @@ static nsresult NSAPI handle_keypress(nsIDOMEventListener *iface,
TRACE("(%p)->(%p)\n", This, event);
update_doc(&This->doc->basedoc, UPDATE_UI);
if(This->doc->basedoc.usermode == EDITMODE)
if(This->doc->usermode == EDITMODE)
handle_edit_event(&This->doc->basedoc, event);
return NS_OK;
......@@ -145,7 +145,7 @@ static nsresult NSAPI handle_load(nsIDOMEventListener *iface, nsIDOMEvent *event
This->editor_controller = NULL;
}
if(This->doc->basedoc.usermode == EDITMODE)
if(This->doc->usermode == EDITMODE)
handle_edit_load(&This->doc->basedoc);
if(!This->doc->basedoc.nsdoc) {
......
......@@ -473,7 +473,7 @@ static HRESULT exec_mshtml_copy(HTMLDocument *This, DWORD cmdexecopt, VARIANT *i
{
TRACE("(%p)->(%08x %p %p)\n", This, cmdexecopt, in, out);
if(This->usermode == EDITMODE)
if(This->doc_obj->usermode == EDITMODE)
return editor_exec_copy(This, cmdexecopt, in, out);
do_ns_command(This, NSCMD_COPY, NULL);
......@@ -491,7 +491,7 @@ static HRESULT exec_mshtml_cut(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in
{
TRACE("(%p)->(%08x %p %p)\n", This, cmdexecopt, in, out);
if(This->usermode == EDITMODE)
if(This->doc_obj->usermode == EDITMODE)
return editor_exec_cut(This, cmdexecopt, in, out);
FIXME("Unimplemented in browse mode\n");
......@@ -509,7 +509,7 @@ static HRESULT exec_mshtml_paste(HTMLDocument *This, DWORD cmdexecopt, VARIANT *
{
TRACE("(%p)->(%08x %p %p)\n", This, cmdexecopt, in, out);
if(This->usermode == EDITMODE)
if(This->doc_obj->usermode == EDITMODE)
return editor_exec_paste(This, cmdexecopt, in, out);
FIXME("Unimplemented in browse mode\n");
......@@ -523,7 +523,7 @@ static HRESULT exec_browsemode(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in
if(in || out)
FIXME("unsupported args\n");
This->usermode = BROWSEMODE;
This->doc_obj->usermode = BROWSEMODE;
return S_OK;
}
......@@ -538,10 +538,10 @@ static HRESULT exec_editmode(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in,
if(in || out)
FIXME("unsupported args\n");
if(This->usermode == EDITMODE)
if(This->doc_obj->usermode == EDITMODE)
return S_OK;
This->usermode = EDITMODE;
This->doc_obj->usermode = EDITMODE;
if(This->doc_obj->mon) {
CLSID clsid = IID_NULL;
......
......@@ -103,7 +103,7 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
if(This->doc_obj->client) {
IOleClientSite_Release(This->doc_obj->client);
This->doc_obj->client = NULL;
This->usermode = UNKNOWN_USERMODE;
This->doc_obj->usermode = UNKNOWN_USERMODE;
}
if(This->doc_obj->hostui) {
......@@ -195,7 +195,7 @@ static HRESULT WINAPI OleObject_SetClientSite(IOleObject *iface, IOleClientSite
This->doc_obj->client = pClientSite;
This->doc_obj->hostui = pDocHostUIHandler;
if(This->usermode == UNKNOWN_USERMODE)
if(This->doc_obj->usermode == UNKNOWN_USERMODE)
IOleControl_OnAmbientPropertyChange(CONTROL(This), DISPID_AMBIENT_USERMODE);
IOleControl_OnAmbientPropertyChange(CONTROL(This), DISPID_AMBIENT_OFFLINEIFNOTCONNECTED);
......@@ -618,10 +618,10 @@ static HRESULT WINAPI OleControl_OnAmbientPropertyChange(IOleControl *iface, DIS
if(V_VT(&res) == VT_BOOL) {
if(V_BOOL(&res)) {
This->usermode = BROWSEMODE;
This->doc_obj->usermode = BROWSEMODE;
}else {
FIXME("edit mode is not supported\n");
This->usermode = EDITMODE;
This->doc_obj->usermode = EDITMODE;
}
}else {
FIXME("V_VT(res)=%d\n", V_VT(&res));
......@@ -767,6 +767,4 @@ void HTMLDocument_OleObj_Init(HTMLDocument *This)
This->lpOleDocumentVtbl = &OleDocumentVtbl;
This->lpOleControlVtbl = &OleControlVtbl;
This->lpCustomDocVtbl = &CustomDocVtbl;
This->usermode = UNKNOWN_USERMODE;
}
......@@ -529,7 +529,7 @@ static HRESULT WINAPI PersistStreamInit_IsDirty(IPersistStreamInit *iface)
TRACE("(%p)\n", This);
if(This->usermode == EDITMODE)
if(This->doc_obj->usermode == EDITMODE)
return editor_is_dirty(This);
return S_FALSE;
......
......@@ -254,7 +254,7 @@ static void set_parsecomplete(HTMLDocument *doc)
TRACE("(%p)\n", doc);
if(doc->usermode == EDITMODE)
if(doc->doc_obj->usermode == EDITMODE)
init_editor(doc);
call_explorer_69(doc->doc_obj);
......@@ -324,7 +324,7 @@ static void set_progress(HTMLDocument *doc)
&progress, NULL);
}
if(doc->usermode == EDITMODE && doc->doc_obj->hostui) {
if(doc->doc_obj->usermode == EDITMODE && doc->doc_obj->hostui) {
DOCHOSTUIINFO hostinfo;
memset(&hostinfo, 0, sizeof(DOCHOSTUIINFO));
......
......@@ -610,7 +610,7 @@ static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL f
if(This->doc_obj->hostui) {
hres = IDocHostUIHandler_ShowUI(This->doc_obj->hostui,
This->usermode == EDITMODE ? DOCHOSTUITYPE_AUTHOR : DOCHOSTUITYPE_BROWSE,
This->doc_obj->usermode == EDITMODE ? DOCHOSTUITYPE_AUTHOR : DOCHOSTUITYPE_BROWSE,
ACTOBJ(This), CMDTARGET(This), This->doc_obj->frame, This->doc_obj->ip_window);
if(FAILED(hres))
IDocHostUIHandler_HideUI(This->doc_obj->hostui);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment