static nsresult NSAPI handle_blur(nsIDOMEventListener *iface, nsIDOMEvent *event) { NSContainer *This = NSEVENTLIST_THIS(iface)->This; TRACE("(%p)\n", This); if(!This->reset_focus && This->doc && This->doc->focus && !is_doc_child_focus(This)) { This->doc->focus = FALSE; notif_focus(This->doc); } return NS_OK; }
static nsresult NSAPI handle_focus(nsIDOMEventListener *iface, nsIDOMEvent *event) { HTMLDocumentNode *doc = NSEVENTLIST_THIS(iface)->This->doc; HTMLDocumentObj *doc_obj; TRACE("(%p)\n", doc); if(!doc) return NS_ERROR_FAILURE; doc_obj = doc->basedoc.doc_obj; if(!doc_obj->focus) { doc_obj->focus = TRUE; notif_focus(doc_obj); } return NS_OK; }
static nsresult NSAPI handle_blur(nsIDOMEventListener *iface, nsIDOMEvent *event) { HTMLDocumentNode *doc = NSEVENTLIST_THIS(iface)->This->doc; HTMLDocumentObj *doc_obj; TRACE("(%p)\n", doc); if(!doc || !doc->basedoc.doc_obj) return NS_ERROR_FAILURE; doc_obj = doc->basedoc.doc_obj; if(doc_obj->focus && !is_doc_child_focus(doc_obj->nscontainer)) { doc_obj->focus = FALSE; notif_focus(doc_obj); } return NS_OK; }
static HRESULT WINAPI OleInPlaceObjectWindowless_InPlaceDeactivate(IOleInPlaceObjectWindowless *iface) { HTMLDocument *This = impl_from_IOleInPlaceObjectWindowless(iface); TRACE("(%p)\n", This); if(This->doc_obj->ui_active) IOleDocumentView_UIActivate(&This->IOleDocumentView_iface, FALSE); This->doc_obj->window_active = FALSE; if(!This->doc_obj->in_place_active) return S_OK; if(This->doc_obj->frame) { IOleInPlaceFrame_Release(This->doc_obj->frame); This->doc_obj->frame = NULL; } if(This->doc_obj->hwnd) { ShowWindow(This->doc_obj->hwnd, SW_HIDE); SetWindowPos(This->doc_obj->hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); } This->doc_obj->focus = FALSE; notif_focus(This->doc_obj); This->doc_obj->in_place_active = FALSE; if(This->doc_obj->ipsite) { IOleInPlaceSiteEx *ipsiteex; HRESULT hres; hres = IOleInPlaceSite_QueryInterface(This->doc_obj->ipsite, &IID_IOleInPlaceSiteEx, (void**)&ipsiteex); if(SUCCEEDED(hres)) { IOleInPlaceSiteEx_OnInPlaceDeactivateEx(ipsiteex, TRUE); IOleInPlaceSiteEx_Release(ipsiteex); }else { IOleInPlaceSite_OnInPlaceDeactivate(This->doc_obj->ipsite); } } return S_OK; }
static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL fUIActivate) { HTMLDocument *This = DOCVIEW_THIS(iface); HRESULT hres; TRACE("(%p)->(%x)\n", This, fUIActivate); if(!This->doc_obj->ipsite) { IOleClientSite *cs = This->doc_obj->client; IOleInPlaceSite *ips; if(!cs) { WARN("this->ipsite = NULL\n"); return E_UNEXPECTED; } hres = IOleClientSite_QueryInterface(cs, &IID_IOleInPlaceSiteWindowless, (void**)&ips); if(SUCCEEDED(hres)) This->doc_obj->ipsite = ips; else { hres = IOleClientSite_QueryInterface(cs, &IID_IOleInPlaceSiteEx, (void**)&ips); if(SUCCEEDED(hres)) This->doc_obj->ipsite = ips; else { hres = IOleClientSite_QueryInterface(cs, &IID_IOleInPlaceSite, (void**)&ips); if(SUCCEEDED(hres)) This->doc_obj->ipsite = ips; else { WARN("this->ipsite = NULL\n"); return E_NOINTERFACE; } } } IOleClientSite_AddRef(This->doc_obj->ipsite); This->doc_obj->request_uiactivate = FALSE; HTMLDocument_LockContainer(This->doc_obj, TRUE); } if(fUIActivate) { RECT rcBorderWidths; if(This->doc_obj->ui_active) return S_OK; if(!This->doc_obj->window_active) { hres = activate_window(This->doc_obj); if(FAILED(hres)) return hres; } This->doc_obj->focus = TRUE; if(This->doc_obj->nscontainer) nsIWebBrowserFocus_Activate(This->doc_obj->nscontainer->focus); notif_focus(This->doc_obj); update_doc(This, UPDATE_UI); hres = IOleInPlaceSite_OnUIActivate(This->doc_obj->ipsite); if(SUCCEEDED(hres)) { call_set_active_object((IOleInPlaceUIWindow*)This->doc_obj->frame, ACTOBJ(This)); }else { FIXME("OnUIActivate failed: %08x\n", hres); IOleInPlaceFrame_Release(This->doc_obj->frame); This->doc_obj->frame = NULL; This->doc_obj->ui_active = FALSE; return hres; } if(This->doc_obj->hostui) { hres = IDocHostUIHandler_ShowUI(This->doc_obj->hostui, 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); } if(This->doc_obj->ip_window) call_set_active_object(This->doc_obj->ip_window, ACTOBJ(This)); memset(&rcBorderWidths, 0, sizeof(rcBorderWidths)); IOleInPlaceFrame_SetBorderSpace(This->doc_obj->frame, &rcBorderWidths); This->doc_obj->ui_active = TRUE; }else { This->doc_obj->focus = FALSE; nsIWebBrowserFocus_Deactivate(This->doc_obj->nscontainer->focus); if(This->doc_obj->ui_active) { This->doc_obj->ui_active = FALSE; if(This->doc_obj->ip_window) call_set_active_object(This->doc_obj->ip_window, NULL); if(This->doc_obj->frame) call_set_active_object((IOleInPlaceUIWindow*)This->doc_obj->frame, NULL); if(This->doc_obj->hostui) IDocHostUIHandler_HideUI(This->doc_obj->hostui); if(This->doc_obj->ipsite) IOleInPlaceSite_OnUIDeactivate(This->doc_obj->ipsite, FALSE); } } return S_OK; }
static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL fUIActivate) { HTMLDocument *This = DOCVIEW_THIS(iface); HRESULT hres; TRACE("(%p)->(%x)\n", This, fUIActivate); if(!This->ipsite) { FIXME("This->ipsite = NULL\n"); return E_FAIL; } if(fUIActivate) { RECT rcBorderWidths; if(This->ui_active) return S_OK; if(!This->window_active) { hres = activate_window(This); if(FAILED(hres)) return hres; } This->focus = TRUE; if(This->nscontainer) nsIWebBrowserFocus_Activate(This->nscontainer->focus); notif_focus(This); update_doc(This, UPDATE_UI); hres = IOleInPlaceSite_OnUIActivate(This->ipsite); if(SUCCEEDED(hres)) { call_set_active_object((IOleInPlaceUIWindow*)This->frame, ACTOBJ(This)); }else { FIXME("OnUIActivate failed: %08x\n", hres); IOleInPlaceFrame_Release(This->frame); This->frame = NULL; This->ui_active = FALSE; return hres; } hres = IDocHostUIHandler_ShowUI(This->hostui, This->usermode == EDITMODE ? DOCHOSTUITYPE_AUTHOR : DOCHOSTUITYPE_BROWSE, ACTOBJ(This), CMDTARGET(This), This->frame, This->ip_window); if(FAILED(hres)) IDocHostUIHandler_HideUI(This->hostui); if(This->ip_window) call_set_active_object(This->ip_window, ACTOBJ(This)); memset(&rcBorderWidths, 0, sizeof(rcBorderWidths)); IOleInPlaceFrame_SetBorderSpace(This->frame, &rcBorderWidths); This->ui_active = TRUE; }else { 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); } } return S_OK; }