static LRESULT resize_document(DocHost *This, LONG width, LONG height) { RECT rect = {0, 0, width, height}; TRACE("(%p)->(%d %d)\n", This, width, height); if(This->view) IOleDocumentView_SetRect(This->view, &rect); return 0; }
static HRESULT WINAPI OleObject_DoVerb(IOleObject *iface, LONG iVerb, LPMSG lpmsg, IOleClientSite *pActiveSite, LONG lindex, HWND hwndParent, LPCRECT lprcPosRect) { HTMLDocument *This = impl_from_IOleObject(iface); IOleDocumentSite *pDocSite; HRESULT hres; TRACE("(%p)->(%d %p %p %d %p %p)\n", This, iVerb, lpmsg, pActiveSite, lindex, hwndParent, lprcPosRect); if(iVerb != OLEIVERB_SHOW && iVerb != OLEIVERB_UIACTIVATE && iVerb != OLEIVERB_INPLACEACTIVATE) { FIXME("iVerb = %d not supported\n", iVerb); return E_NOTIMPL; } if(!pActiveSite) pActiveSite = This->doc_obj->client; hres = IOleClientSite_QueryInterface(pActiveSite, &IID_IOleDocumentSite, (void**)&pDocSite); if(SUCCEEDED(hres)) { HTMLDocument_LockContainer(This->doc_obj, TRUE); /* FIXME: Create new IOleDocumentView. See CreateView for more info. */ hres = IOleDocumentSite_ActivateMe(pDocSite, &This->IOleDocumentView_iface); IOleDocumentSite_Release(pDocSite); }else { hres = IOleDocumentView_UIActivate(&This->IOleDocumentView_iface, TRUE); if(SUCCEEDED(hres)) { if(lprcPosRect) { RECT rect; /* We need to pass rect as not const pointer */ rect = *lprcPosRect; IOleDocumentView_SetRect(&This->IOleDocumentView_iface, &rect); } IOleDocumentView_Show(&This->IOleDocumentView_iface, TRUE); } } return hres; }
static HRESULT WINAPI OleDocumentSite_ActivateMe(IOleDocumentSite *iface, IOleDocumentView *pViewToActivate) { DocHost *This = DOCSITE_THIS(iface); IOleDocument *oledoc; RECT rect; HRESULT hres; TRACE("(%p)->(%p)\n", This, pViewToActivate); hres = IUnknown_QueryInterface(This->document, &IID_IOleDocument, (void**)&oledoc); if(FAILED(hres)) return hres; IOleDocument_CreateView(oledoc, INPLACESITE(This), NULL, 0, &This->view); IOleDocument_Release(oledoc); GetClientRect(This->hwnd, &rect); IOleDocumentView_SetRect(This->view, &rect); hres = IOleDocumentView_Show(This->view, TRUE); return hres; }