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