Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenwebbrowser.c
Go to the documentation of this file.
00001 /* 00002 * WebBrowser Implementation 00003 * 00004 * Copyright 2005 James Hawkins 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * This library is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with this library; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00019 */ 00020 00021 #include "hhctrl.h" 00022 00023 #include "wine/debug.h" 00024 00025 WINE_DEFAULT_DEBUG_CHANNEL(htmlhelp); 00026 00027 #define ICOM_THIS_MULTI(impl,field,iface) impl* const This=(impl*)((char*)(iface) - offsetof(impl,field)) 00028 00029 typedef struct IOleClientSiteImpl 00030 { 00031 const IOleClientSiteVtbl *lpVtbl; 00032 const IOleInPlaceSiteVtbl *lpvtblOleInPlaceSite; 00033 const IOleInPlaceFrameVtbl *lpvtblOleInPlaceFrame; 00034 const IDocHostUIHandlerVtbl *lpvtblDocHostUIHandler; 00035 00036 /* IOleClientSiteImpl data */ 00037 IOleObject *pBrowserObject; 00038 LONG ref; 00039 00040 /* IOleInPlaceFrame data */ 00041 HWND hwndWindow; 00042 } IOleClientSiteImpl; 00043 00044 #define CLIENTSITE(x) ((IOleClientSite*) &(x)->lpVtbl) 00045 #define DOCHOSTUI(x) ((IDocHostUIHandler*) &(x)->lpvtblDocHostUIHandler) 00046 #define INPLACESITE(x) ((IOleInPlaceSite*) &(x)->lpvtblOleInPlaceSite) 00047 #define INPLACEFRAME(x) ((IOleInPlaceFrame*) &(x)->lpvtblOleInPlaceFrame) 00048 00049 static HRESULT STDMETHODCALLTYPE Site_QueryInterface(IOleClientSite *iface, REFIID riid, void **ppvObj) 00050 { 00051 ICOM_THIS_MULTI(IOleClientSiteImpl, lpVtbl, iface); 00052 00053 *ppvObj = NULL; 00054 00055 if (IsEqualIID(riid, &IID_IUnknown)) { 00056 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppvObj); 00057 *ppvObj = CLIENTSITE(This); 00058 }else if(IsEqualIID(riid, &IID_IOleClientSite)) { 00059 TRACE("(%p)->(IID_IOleClientSite %p)\n", This, ppvObj); 00060 *ppvObj = CLIENTSITE(This); 00061 }else if (IsEqualIID(riid, &IID_IOleInPlaceSite)) { 00062 TRACE("(%p)->(IID_IOleInPlaceSite %p)\n", This, ppvObj); 00063 *ppvObj = &(This->lpvtblOleInPlaceSite); 00064 }else if (IsEqualIID(riid, &IID_IOleInPlaceFrame)) { 00065 TRACE("(%p)->(IID_IOleInPlaceFrame %p)\n", This, ppvObj); 00066 *ppvObj = &(This->lpvtblOleInPlaceSite); 00067 }else if (IsEqualIID(riid, &IID_IDocHostUIHandler)) { 00068 TRACE("(%p)->(IID_IDocHostUIHandler %p)\n", This, ppvObj); 00069 *ppvObj = &(This->lpvtblDocHostUIHandler); 00070 }else { 00071 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObj); 00072 return E_NOINTERFACE; 00073 } 00074 00075 IUnknown_AddRef((IUnknown*)*ppvObj); 00076 return S_OK; 00077 } 00078 00079 static ULONG STDMETHODCALLTYPE Site_AddRef(IOleClientSite *iface) 00080 { 00081 ICOM_THIS_MULTI(IOleClientSiteImpl, lpVtbl, iface); 00082 LONG ref = InterlockedIncrement(&This->ref); 00083 00084 TRACE("(%p) ref=%d\n", This, ref); 00085 00086 return ref; 00087 } 00088 00089 static ULONG STDMETHODCALLTYPE Site_Release(IOleClientSite *iface) 00090 { 00091 ICOM_THIS_MULTI(IOleClientSiteImpl, lpVtbl, iface); 00092 LONG ref = InterlockedDecrement(&This->ref); 00093 00094 TRACE("(%p) ref=%d\n", This, ref); 00095 00096 if(!ref) 00097 heap_free(This); 00098 00099 return ref; 00100 } 00101 00102 static HRESULT STDMETHODCALLTYPE Site_SaveObject(IOleClientSite *iface) 00103 { 00104 return E_NOTIMPL; 00105 } 00106 00107 static HRESULT STDMETHODCALLTYPE Site_GetMoniker(IOleClientSite *iface, DWORD dwAssign, DWORD dwWhichMoniker, IMoniker **ppmk) 00108 { 00109 return E_NOTIMPL; 00110 } 00111 00112 static HRESULT STDMETHODCALLTYPE Site_GetContainer(IOleClientSite *iface, LPOLECONTAINER *ppContainer) 00113 { 00114 *ppContainer = NULL; 00115 00116 return E_NOINTERFACE; 00117 } 00118 00119 static HRESULT STDMETHODCALLTYPE Site_ShowObject(IOleClientSite *iface) 00120 { 00121 return NOERROR; 00122 } 00123 00124 static HRESULT STDMETHODCALLTYPE Site_OnShowWindow(IOleClientSite *iface, BOOL fShow) 00125 { 00126 return E_NOTIMPL; 00127 } 00128 00129 static HRESULT STDMETHODCALLTYPE Site_RequestNewObjectLayout(IOleClientSite *iface) 00130 { 00131 return E_NOTIMPL; 00132 } 00133 00134 static const IOleClientSiteVtbl MyIOleClientSiteTable = 00135 { 00136 Site_QueryInterface, 00137 Site_AddRef, 00138 Site_Release, 00139 Site_SaveObject, 00140 Site_GetMoniker, 00141 Site_GetContainer, 00142 Site_ShowObject, 00143 Site_OnShowWindow, 00144 Site_RequestNewObjectLayout 00145 }; 00146 00147 static HRESULT STDMETHODCALLTYPE UI_QueryInterface(IDocHostUIHandler *iface, REFIID riid, LPVOID *ppvObj) 00148 { 00149 ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblDocHostUIHandler, iface); 00150 00151 return IOleClientSite_QueryInterface(CLIENTSITE(This), riid, ppvObj); 00152 } 00153 00154 static ULONG STDMETHODCALLTYPE UI_AddRef(IDocHostUIHandler *iface) 00155 { 00156 ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblDocHostUIHandler, iface); 00157 00158 return IOleClientSite_AddRef(CLIENTSITE(This)); 00159 } 00160 00161 static ULONG STDMETHODCALLTYPE UI_Release(IDocHostUIHandler * iface) 00162 { 00163 ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblDocHostUIHandler, iface); 00164 00165 return IOleClientSite_Release(CLIENTSITE(This)); 00166 } 00167 00168 static HRESULT STDMETHODCALLTYPE UI_ShowContextMenu(IDocHostUIHandler *iface, DWORD dwID, POINT *ppt, IUnknown *pcmdtReserved, IDispatch *pdispReserved) 00169 { 00170 return S_OK; 00171 } 00172 00173 static HRESULT STDMETHODCALLTYPE UI_GetHostInfo(IDocHostUIHandler *iface, DOCHOSTUIINFO *pInfo) 00174 { 00175 pInfo->cbSize = sizeof(DOCHOSTUIINFO); 00176 pInfo->dwFlags = DOCHOSTUIFLAG_NO3DBORDER; 00177 pInfo->dwDoubleClick = DOCHOSTUIDBLCLK_DEFAULT; 00178 00179 return S_OK; 00180 } 00181 00182 static HRESULT STDMETHODCALLTYPE UI_ShowUI(IDocHostUIHandler *iface, DWORD dwID, IOleInPlaceActiveObject *pActiveObject, IOleCommandTarget *pCommandTarget, IOleInPlaceFrame *pFrame, IOleInPlaceUIWindow *pDoc) 00183 { 00184 return S_OK; 00185 } 00186 00187 static HRESULT STDMETHODCALLTYPE UI_HideUI(IDocHostUIHandler *iface) 00188 { 00189 return S_OK; 00190 } 00191 00192 static HRESULT STDMETHODCALLTYPE UI_UpdateUI(IDocHostUIHandler *iface) 00193 { 00194 return S_OK; 00195 } 00196 00197 static HRESULT STDMETHODCALLTYPE UI_EnableModeless(IDocHostUIHandler *iface, BOOL fEnable) 00198 { 00199 return S_OK; 00200 } 00201 00202 static HRESULT STDMETHODCALLTYPE UI_OnDocWindowActivate(IDocHostUIHandler *iface, BOOL fActivate) 00203 { 00204 return S_OK; 00205 } 00206 00207 static HRESULT STDMETHODCALLTYPE UI_OnFrameWindowActivate(IDocHostUIHandler *iface, BOOL fActivate) 00208 { 00209 return S_OK; 00210 } 00211 00212 static HRESULT STDMETHODCALLTYPE UI_ResizeBorder(IDocHostUIHandler *iface, LPCRECT prcBorder, IOleInPlaceUIWindow *pUIWindow, BOOL fRameWindow) 00213 { 00214 return S_OK; 00215 } 00216 00217 static HRESULT STDMETHODCALLTYPE UI_TranslateAccelerator(IDocHostUIHandler *iface, LPMSG lpMsg, const GUID *pguidCmdGroup, DWORD nCmdID) 00218 { 00219 return S_FALSE; 00220 } 00221 00222 static HRESULT STDMETHODCALLTYPE UI_GetOptionKeyPath(IDocHostUIHandler *iface, LPOLESTR *pchKey, DWORD dw) 00223 { 00224 return S_FALSE; 00225 } 00226 00227 static HRESULT STDMETHODCALLTYPE UI_GetDropTarget(IDocHostUIHandler *iface, IDropTarget *pDropTarget, IDropTarget **ppDropTarget) 00228 { 00229 return S_FALSE; 00230 } 00231 00232 static HRESULT STDMETHODCALLTYPE UI_GetExternal(IDocHostUIHandler *iface, IDispatch **ppDispatch) 00233 { 00234 *ppDispatch = NULL; 00235 return S_FALSE; 00236 } 00237 00238 static HRESULT STDMETHODCALLTYPE UI_TranslateUrl(IDocHostUIHandler *iface, DWORD dwTranslate, OLECHAR *pchURLIn, OLECHAR **ppchURLOut) 00239 { 00240 *ppchURLOut = NULL; 00241 return S_FALSE; 00242 } 00243 00244 static HRESULT STDMETHODCALLTYPE UI_FilterDataObject(IDocHostUIHandler *iface, IDataObject *pDO, IDataObject **ppDORet) 00245 { 00246 *ppDORet = NULL; 00247 return S_FALSE; 00248 } 00249 00250 static const IDocHostUIHandlerVtbl MyIDocHostUIHandlerTable = 00251 { 00252 UI_QueryInterface, 00253 UI_AddRef, 00254 UI_Release, 00255 UI_ShowContextMenu, 00256 UI_GetHostInfo, 00257 UI_ShowUI, 00258 UI_HideUI, 00259 UI_UpdateUI, 00260 UI_EnableModeless, 00261 UI_OnDocWindowActivate, 00262 UI_OnFrameWindowActivate, 00263 UI_ResizeBorder, 00264 UI_TranslateAccelerator, 00265 UI_GetOptionKeyPath, 00266 UI_GetDropTarget, 00267 UI_GetExternal, 00268 UI_TranslateUrl, 00269 UI_FilterDataObject 00270 }; 00271 00272 static HRESULT STDMETHODCALLTYPE InPlace_QueryInterface(IOleInPlaceSite *iface, REFIID riid, LPVOID *ppvObj) 00273 { 00274 ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceSite, iface); 00275 00276 return IOleClientSite_QueryInterface(CLIENTSITE(This), riid, ppvObj); 00277 } 00278 00279 static ULONG STDMETHODCALLTYPE InPlace_AddRef(IOleInPlaceSite *iface) 00280 { 00281 ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceSite, iface); 00282 00283 return IOleClientSite_AddRef(CLIENTSITE(This)); 00284 } 00285 00286 static ULONG STDMETHODCALLTYPE InPlace_Release(IOleInPlaceSite *iface) 00287 { 00288 ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceSite, iface); 00289 00290 return IOleClientSite_Release(CLIENTSITE(This)); 00291 } 00292 00293 static HRESULT STDMETHODCALLTYPE InPlace_GetWindow(IOleInPlaceSite *iface, HWND *lphwnd) 00294 { 00295 ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceSite, iface); 00296 *lphwnd = This->hwndWindow; 00297 00298 return S_OK; 00299 } 00300 00301 static HRESULT STDMETHODCALLTYPE InPlace_ContextSensitiveHelp(IOleInPlaceSite *iface, BOOL fEnterMode) 00302 { 00303 return E_NOTIMPL; 00304 } 00305 00306 static HRESULT STDMETHODCALLTYPE InPlace_CanInPlaceActivate(IOleInPlaceSite *iface) 00307 { 00308 return S_OK; 00309 } 00310 00311 static HRESULT STDMETHODCALLTYPE InPlace_OnInPlaceActivate(IOleInPlaceSite *iface) 00312 { 00313 return S_OK; 00314 } 00315 00316 static HRESULT STDMETHODCALLTYPE InPlace_OnUIActivate(IOleInPlaceSite *iface) 00317 { 00318 return S_OK; 00319 } 00320 00321 static HRESULT STDMETHODCALLTYPE InPlace_GetWindowContext(IOleInPlaceSite *iface, LPOLEINPLACEFRAME *lplpFrame, LPOLEINPLACEUIWINDOW *lplpDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo) 00322 { 00323 ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceSite, iface); 00324 00325 *lplpFrame = INPLACEFRAME(This); 00326 IOleInPlaceFrame_AddRef(INPLACEFRAME(This)); 00327 00328 *lplpDoc = NULL; 00329 00330 lpFrameInfo->fMDIApp = FALSE; 00331 lpFrameInfo->hwndFrame = This->hwndWindow; 00332 lpFrameInfo->haccel = NULL; 00333 lpFrameInfo->cAccelEntries = 0; 00334 00335 return S_OK; 00336 } 00337 00338 static HRESULT STDMETHODCALLTYPE InPlace_Scroll(IOleInPlaceSite *iface, SIZE scrollExtent) 00339 { 00340 return E_NOTIMPL; 00341 } 00342 00343 static HRESULT STDMETHODCALLTYPE InPlace_OnUIDeactivate(IOleInPlaceSite *iface, BOOL fUndoable) 00344 { 00345 return S_OK; 00346 } 00347 00348 static HRESULT STDMETHODCALLTYPE InPlace_OnInPlaceDeactivate(IOleInPlaceSite *iface) 00349 { 00350 return S_OK; 00351 } 00352 00353 static HRESULT STDMETHODCALLTYPE InPlace_DiscardUndoState(IOleInPlaceSite *iface) 00354 { 00355 return E_NOTIMPL; 00356 } 00357 00358 static HRESULT STDMETHODCALLTYPE InPlace_DeactivateAndUndo(IOleInPlaceSite *iface) 00359 { 00360 return E_NOTIMPL; 00361 } 00362 00363 static HRESULT STDMETHODCALLTYPE InPlace_OnPosRectChange(IOleInPlaceSite *iface, LPCRECT lprcPosRect) 00364 { 00365 ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceSite, iface); 00366 IOleInPlaceObject *inplace; 00367 00368 if (IOleObject_QueryInterface(This->pBrowserObject, &IID_IOleInPlaceObject, 00369 (void **)&inplace) == S_OK) 00370 { 00371 IOleInPlaceObject_SetObjectRects(inplace, lprcPosRect, lprcPosRect); 00372 IOleInPlaceObject_Release(inplace); 00373 } 00374 00375 return S_OK; 00376 } 00377 00378 static const IOleInPlaceSiteVtbl MyIOleInPlaceSiteTable = 00379 { 00380 InPlace_QueryInterface, 00381 InPlace_AddRef, 00382 InPlace_Release, 00383 InPlace_GetWindow, 00384 InPlace_ContextSensitiveHelp, 00385 InPlace_CanInPlaceActivate, 00386 InPlace_OnInPlaceActivate, 00387 InPlace_OnUIActivate, 00388 InPlace_GetWindowContext, 00389 InPlace_Scroll, 00390 InPlace_OnUIDeactivate, 00391 InPlace_OnInPlaceDeactivate, 00392 InPlace_DiscardUndoState, 00393 InPlace_DeactivateAndUndo, 00394 InPlace_OnPosRectChange 00395 }; 00396 00397 static HRESULT STDMETHODCALLTYPE Frame_QueryInterface(IOleInPlaceFrame *iface, REFIID riid, LPVOID *ppvObj) 00398 { 00399 ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceFrame, iface); 00400 00401 return IOleClientSite_QueryInterface(CLIENTSITE(This), riid, ppvObj); 00402 } 00403 00404 static ULONG STDMETHODCALLTYPE Frame_AddRef(IOleInPlaceFrame *iface) 00405 { 00406 ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceFrame, iface); 00407 00408 return IOleClientSite_AddRef(CLIENTSITE(This)); 00409 } 00410 00411 static ULONG STDMETHODCALLTYPE Frame_Release(IOleInPlaceFrame *iface) 00412 { 00413 ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceFrame, iface); 00414 00415 return IOleClientSite_Release(CLIENTSITE(This)); 00416 } 00417 00418 static HRESULT STDMETHODCALLTYPE Frame_GetWindow(IOleInPlaceFrame *iface, HWND *lphwnd) 00419 { 00420 ICOM_THIS_MULTI(IOleClientSiteImpl, lpvtblOleInPlaceFrame, iface); 00421 *lphwnd = This->hwndWindow; 00422 00423 return S_OK; 00424 } 00425 00426 static HRESULT STDMETHODCALLTYPE Frame_ContextSensitiveHelp(IOleInPlaceFrame *iface, BOOL fEnterMode) 00427 { 00428 return E_NOTIMPL; 00429 } 00430 00431 static HRESULT STDMETHODCALLTYPE Frame_GetBorder(IOleInPlaceFrame *iface, LPRECT lprectBorder) 00432 { 00433 return E_NOTIMPL; 00434 } 00435 00436 static HRESULT STDMETHODCALLTYPE Frame_RequestBorderSpace(IOleInPlaceFrame *iface, LPCBORDERWIDTHS pborderwidths) 00437 { 00438 return E_NOTIMPL; 00439 } 00440 00441 static HRESULT STDMETHODCALLTYPE Frame_SetBorderSpace(IOleInPlaceFrame *iface, LPCBORDERWIDTHS pborderwidths) 00442 { 00443 return E_NOTIMPL; 00444 } 00445 00446 static HRESULT STDMETHODCALLTYPE Frame_SetActiveObject(IOleInPlaceFrame *iface, IOleInPlaceActiveObject *pActiveObject, LPCOLESTR pszObjName) 00447 { 00448 return S_OK; 00449 } 00450 00451 static HRESULT STDMETHODCALLTYPE Frame_InsertMenus(IOleInPlaceFrame *iface, HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths) 00452 { 00453 return E_NOTIMPL; 00454 } 00455 00456 static HRESULT STDMETHODCALLTYPE Frame_SetMenu(IOleInPlaceFrame *iface, HMENU hmenuShared, HOLEMENU holemenu, HWND hwndActiveObject) 00457 { 00458 return S_OK; 00459 } 00460 00461 static HRESULT STDMETHODCALLTYPE Frame_RemoveMenus(IOleInPlaceFrame *iface, HMENU hmenuShared) 00462 { 00463 return E_NOTIMPL; 00464 } 00465 00466 static HRESULT STDMETHODCALLTYPE Frame_SetStatusText(IOleInPlaceFrame *iface, LPCOLESTR pszStatusText) 00467 { 00468 return S_OK; 00469 } 00470 00471 static HRESULT STDMETHODCALLTYPE Frame_EnableModeless(IOleInPlaceFrame *iface, BOOL fEnable) 00472 { 00473 return S_OK; 00474 } 00475 00476 static HRESULT STDMETHODCALLTYPE Frame_TranslateAccelerator(IOleInPlaceFrame *iface, LPMSG lpmsg, WORD wID) 00477 { 00478 return E_NOTIMPL; 00479 } 00480 00481 static const IOleInPlaceFrameVtbl MyIOleInPlaceFrameTable = 00482 { 00483 Frame_QueryInterface, 00484 Frame_AddRef, 00485 Frame_Release, 00486 Frame_GetWindow, 00487 Frame_ContextSensitiveHelp, 00488 Frame_GetBorder, 00489 Frame_RequestBorderSpace, 00490 Frame_SetBorderSpace, 00491 Frame_SetActiveObject, 00492 Frame_InsertMenus, 00493 Frame_SetMenu, 00494 Frame_RemoveMenus, 00495 Frame_SetStatusText, 00496 Frame_EnableModeless, 00497 Frame_TranslateAccelerator 00498 }; 00499 00500 static HRESULT STDMETHODCALLTYPE Storage_QueryInterface(IStorage *This, REFIID riid, LPVOID *ppvObj) 00501 { 00502 return E_NOTIMPL; 00503 } 00504 00505 static ULONG STDMETHODCALLTYPE Storage_AddRef(IStorage *This) 00506 { 00507 return 1; 00508 } 00509 00510 static ULONG STDMETHODCALLTYPE Storage_Release(IStorage *This) 00511 { 00512 return 2; 00513 } 00514 00515 static HRESULT STDMETHODCALLTYPE Storage_CreateStream(IStorage *This, const WCHAR *pwcsName, DWORD grfMode, DWORD reserved1, DWORD reserved2, IStream **ppstm) 00516 { 00517 return E_NOTIMPL; 00518 } 00519 00520 static HRESULT STDMETHODCALLTYPE Storage_OpenStream(IStorage *This, const WCHAR * pwcsName, void *reserved1, DWORD grfMode, DWORD reserved2, IStream **ppstm) 00521 { 00522 return E_NOTIMPL; 00523 } 00524 00525 static HRESULT STDMETHODCALLTYPE Storage_CreateStorage(IStorage *This, const WCHAR *pwcsName, DWORD grfMode, DWORD reserved1, DWORD reserved2, IStorage **ppstg) 00526 { 00527 return E_NOTIMPL; 00528 } 00529 00530 static HRESULT STDMETHODCALLTYPE Storage_OpenStorage(IStorage *This, const WCHAR * pwcsName, IStorage * pstgPriority, DWORD grfMode, SNB snbExclude, DWORD reserved, IStorage **ppstg) 00531 { 00532 return E_NOTIMPL; 00533 } 00534 00535 static HRESULT STDMETHODCALLTYPE Storage_CopyTo(IStorage *This, DWORD ciidExclude, IID const *rgiidExclude, SNB snbExclude,IStorage *pstgDest) 00536 { 00537 return E_NOTIMPL; 00538 } 00539 00540 static HRESULT STDMETHODCALLTYPE Storage_MoveElementTo(IStorage *This, const OLECHAR *pwcsName,IStorage * pstgDest, const OLECHAR *pwcsNewName, DWORD grfFlags) 00541 { 00542 return E_NOTIMPL; 00543 } 00544 00545 static HRESULT STDMETHODCALLTYPE Storage_Commit(IStorage *This, DWORD grfCommitFlags) 00546 { 00547 return E_NOTIMPL; 00548 } 00549 00550 static HRESULT STDMETHODCALLTYPE Storage_Revert(IStorage *This) 00551 { 00552 return E_NOTIMPL; 00553 } 00554 00555 static HRESULT STDMETHODCALLTYPE Storage_EnumElements(IStorage *This, DWORD reserved1, void *reserved2, DWORD reserved3, IEnumSTATSTG **ppenum) 00556 { 00557 return E_NOTIMPL; 00558 } 00559 00560 static HRESULT STDMETHODCALLTYPE Storage_DestroyElement(IStorage *This, const OLECHAR *pwcsName) 00561 { 00562 return E_NOTIMPL; 00563 } 00564 00565 static HRESULT STDMETHODCALLTYPE Storage_RenameElement(IStorage *This, const WCHAR *pwcsOldName, const WCHAR *pwcsNewName) 00566 { 00567 return E_NOTIMPL; 00568 } 00569 00570 static HRESULT STDMETHODCALLTYPE Storage_SetElementTimes(IStorage *This, const WCHAR *pwcsName, FILETIME const *pctime, FILETIME const *patime, FILETIME const *pmtime) 00571 { 00572 return E_NOTIMPL; 00573 } 00574 00575 static HRESULT STDMETHODCALLTYPE Storage_SetClass(IStorage *This, REFCLSID clsid) 00576 { 00577 return S_OK; 00578 } 00579 00580 static HRESULT STDMETHODCALLTYPE Storage_SetStateBits(IStorage *This, DWORD grfStateBits, DWORD grfMask) 00581 { 00582 return E_NOTIMPL; 00583 } 00584 00585 static HRESULT STDMETHODCALLTYPE Storage_Stat(IStorage *This, STATSTG *pstatstg, DWORD grfStatFlag) 00586 { 00587 return E_NOTIMPL; 00588 } 00589 00590 static const IStorageVtbl MyIStorageTable = 00591 { 00592 Storage_QueryInterface, 00593 Storage_AddRef, 00594 Storage_Release, 00595 Storage_CreateStream, 00596 Storage_OpenStream, 00597 Storage_CreateStorage, 00598 Storage_OpenStorage, 00599 Storage_CopyTo, 00600 Storage_MoveElementTo, 00601 Storage_Commit, 00602 Storage_Revert, 00603 Storage_EnumElements, 00604 Storage_DestroyElement, 00605 Storage_RenameElement, 00606 Storage_SetElementTimes, 00607 Storage_SetClass, 00608 Storage_SetStateBits, 00609 Storage_Stat 00610 }; 00611 00612 static IStorage MyIStorage = { &MyIStorageTable }; 00613 00614 BOOL InitWebBrowser(HHInfo *info, HWND hwndParent) 00615 { 00616 IOleClientSiteImpl *iOleClientSiteImpl; 00617 IOleInPlaceObject *inplace; 00618 IOleObject *browserObject; 00619 IWebBrowser2 *webBrowser2; 00620 HRESULT hr; 00621 RECT rc; 00622 00623 iOleClientSiteImpl = heap_alloc_zero(sizeof(IOleClientSiteImpl)); 00624 if (!iOleClientSiteImpl) 00625 return FALSE; 00626 00627 iOleClientSiteImpl->ref = 1; 00628 iOleClientSiteImpl->lpVtbl = &MyIOleClientSiteTable; 00629 iOleClientSiteImpl->lpvtblOleInPlaceSite = &MyIOleInPlaceSiteTable; 00630 iOleClientSiteImpl->lpvtblOleInPlaceFrame = &MyIOleInPlaceFrameTable; 00631 iOleClientSiteImpl->hwndWindow = hwndParent; 00632 iOleClientSiteImpl->lpvtblDocHostUIHandler = &MyIDocHostUIHandlerTable; 00633 00634 hr = OleCreate(&CLSID_WebBrowser, &IID_IOleObject, OLERENDER_DRAW, 0, 00635 (IOleClientSite *)iOleClientSiteImpl, &MyIStorage, 00636 (void **)&browserObject); 00637 00638 info->client_site = (IOleClientSite *)iOleClientSiteImpl; 00639 info->wb_object = browserObject; 00640 00641 if (FAILED(hr)) goto error; 00642 00643 /* make the browser object accessible to the IOleClientSite implementation */ 00644 iOleClientSiteImpl->pBrowserObject = browserObject; 00645 00646 GetClientRect(hwndParent, &rc); 00647 00648 hr = OleSetContainedObject((struct IUnknown *)browserObject, TRUE); 00649 if (FAILED(hr)) goto error; 00650 00651 hr = IOleObject_DoVerb(browserObject, OLEIVERB_SHOW, NULL, 00652 (IOleClientSite *)iOleClientSiteImpl, 00653 -1, hwndParent, &rc); 00654 if (FAILED(hr)) goto error; 00655 00656 hr = IOleObject_QueryInterface(browserObject, &IID_IOleInPlaceObject, (void**)&inplace); 00657 if (FAILED(hr)) goto error; 00658 00659 IOleInPlaceObject_SetObjectRects(inplace, &rc, &rc); 00660 IOleInPlaceObject_Release(inplace); 00661 00662 hr = IOleObject_QueryInterface(browserObject, &IID_IWebBrowser2, 00663 (void **)&webBrowser2); 00664 if (SUCCEEDED(hr)) 00665 { 00666 info->web_browser = webBrowser2; 00667 return TRUE; 00668 } 00669 00670 error: 00671 ReleaseWebBrowser(info); 00672 heap_free(iOleClientSiteImpl); 00673 00674 return FALSE; 00675 } 00676 00677 void ReleaseWebBrowser(HHInfo *info) 00678 { 00679 HRESULT hres; 00680 00681 if (info->web_browser) 00682 { 00683 IWebBrowser2_Release(info->web_browser); 00684 info->web_browser = NULL; 00685 } 00686 00687 if (info->client_site) 00688 { 00689 IOleClientSite_Release(info->client_site); 00690 info->client_site = NULL; 00691 } 00692 00693 if(info->wb_object) { 00694 IOleInPlaceSite *inplace; 00695 00696 hres = IOleObject_QueryInterface(info->wb_object, &IID_IOleInPlaceSite, (void**)&inplace); 00697 if(SUCCEEDED(hres)) { 00698 IOleInPlaceSite_OnInPlaceDeactivate(inplace); 00699 IOleInPlaceSite_Release(inplace); 00700 } 00701 00702 IOleObject_SetClientSite(info->wb_object, NULL); 00703 00704 IOleObject_Release(info->wb_object); 00705 info->wb_object = NULL; 00706 } 00707 } 00708 00709 void ResizeWebBrowser(HHInfo *info, DWORD dwWidth, DWORD dwHeight) 00710 { 00711 if (!info->web_browser) 00712 return; 00713 00714 IWebBrowser2_put_Width(info->web_browser, dwWidth); 00715 IWebBrowser2_put_Height(info->web_browser, dwHeight); 00716 } 00717 00718 void DoPageAction(HHInfo *info, DWORD dwAction) 00719 { 00720 IWebBrowser2 *pWebBrowser2 = info->web_browser; 00721 00722 if (!pWebBrowser2) 00723 return; 00724 00725 switch (dwAction) 00726 { 00727 case WB_GOBACK: 00728 IWebBrowser2_GoBack(pWebBrowser2); 00729 break; 00730 case WB_GOFORWARD: 00731 IWebBrowser2_GoForward(pWebBrowser2); 00732 break; 00733 case WB_GOHOME: 00734 IWebBrowser2_GoHome(pWebBrowser2); 00735 break; 00736 case WB_SEARCH: 00737 IWebBrowser2_GoSearch(pWebBrowser2); 00738 break; 00739 case WB_REFRESH: 00740 IWebBrowser2_Refresh(pWebBrowser2); 00741 case WB_STOP: 00742 IWebBrowser2_Stop(pWebBrowser2); 00743 } 00744 } Generated on Sun May 27 2012 04:23:52 for ReactOS by
1.7.6.1
|