📄 defaulthandler.c
字号:
This->pDataDelegate = NULL;
}
if (This->pPSDelegate)
{
IPersistStorage_Release(This->pPSDelegate);
This->pPSDelegate = NULL;
}
IOleObject_Release(This->pOleDelegate);
This->pOleDelegate = NULL;
}
/************************************************************************
* DefaultHandler_Close (IOleObject)
*
* The default handler's implementation of this method is meaningless
* without a running server so it does nothing.
*
* See Windows documentation for more details on IOleObject methods.
*/
static HRESULT WINAPI DefaultHandler_Close(
IOleObject* iface,
DWORD dwSaveOption)
{
DefaultHandler *This = impl_from_IOleObject(iface);
HRESULT hr;
TRACE("(%d)\n", dwSaveOption);
if (!This->pOleDelegate)
return S_OK;
hr = IOleObject_Close(This->pOleDelegate, dwSaveOption);
DefaultHandler_Stop(This);
return hr;
}
/************************************************************************
* DefaultHandler_SetMoniker (IOleObject)
*
* The default handler's implementation of this method does nothing.
*
* See Windows documentation for more details on IOleObject methods.
*/
static HRESULT WINAPI DefaultHandler_SetMoniker(
IOleObject* iface,
DWORD dwWhichMoniker,
IMoniker* pmk)
{
DefaultHandler *This = impl_from_IOleObject(iface);
TRACE("(%p, %d, %p)\n",
iface,
dwWhichMoniker,
pmk);
if (This->pOleDelegate)
return IOleObject_SetMoniker(This->pOleDelegate, dwWhichMoniker, pmk);
return S_OK;
}
/************************************************************************
* DefaultHandler_GetMoniker (IOleObject)
*
* Delegate this request to the client site if we have one.
*
* See Windows documentation for more details on IOleObject methods.
*/
static HRESULT WINAPI DefaultHandler_GetMoniker(
IOleObject* iface,
DWORD dwAssign,
DWORD dwWhichMoniker,
IMoniker** ppmk)
{
DefaultHandler *This = impl_from_IOleObject(iface);
TRACE("(%p, %d, %d, %p)\n",
iface, dwAssign, dwWhichMoniker, ppmk);
if (This->pOleDelegate)
return IOleObject_GetMoniker(This->pOleDelegate, dwAssign, dwWhichMoniker,
ppmk);
/* FIXME: dwWhichMoniker == OLEWHICHMK_CONTAINER only? */
if (This->clientSite)
{
return IOleClientSite_GetMoniker(This->clientSite,
dwAssign,
dwWhichMoniker,
ppmk);
}
return E_FAIL;
}
/************************************************************************
* DefaultHandler_InitFromData (IOleObject)
*
* This method is meaningless if the server is not running
*
* See Windows documentation for more details on IOleObject methods.
*/
static HRESULT WINAPI DefaultHandler_InitFromData(
IOleObject* iface,
IDataObject* pDataObject,
BOOL fCreation,
DWORD dwReserved)
{
DefaultHandler *This = impl_from_IOleObject(iface);
TRACE("(%p, %p, %d, %d)\n",
iface, pDataObject, fCreation, dwReserved);
if (This->pOleDelegate)
return IOleObject_InitFromData(This->pOleDelegate, pDataObject, fCreation,
dwReserved);
return OLE_E_NOTRUNNING;
}
/************************************************************************
* DefaultHandler_GetClipboardData (IOleObject)
*
* This method is meaningless if the server is not running
*
* See Windows documentation for more details on IOleObject methods.
*/
static HRESULT WINAPI DefaultHandler_GetClipboardData(
IOleObject* iface,
DWORD dwReserved,
IDataObject** ppDataObject)
{
DefaultHandler *This = impl_from_IOleObject(iface);
TRACE("(%p, %d, %p)\n",
iface, dwReserved, ppDataObject);
if (This->pOleDelegate)
return IOleObject_GetClipboardData(This->pOleDelegate, dwReserved,
ppDataObject);
return OLE_E_NOTRUNNING;
}
static HRESULT WINAPI DefaultHandler_DoVerb(
IOleObject* iface,
LONG iVerb,
struct tagMSG* lpmsg,
IOleClientSite* pActiveSite,
LONG lindex,
HWND hwndParent,
LPCRECT lprcPosRect)
{
DefaultHandler *This = impl_from_IOleObject(iface);
IRunnableObject *pRunnableObj = (IRunnableObject *)&This->lpvtblIRunnableObject;
HRESULT hr;
TRACE("(%d, %p, %p, %d, %p, %s)\n", iVerb, lpmsg, pActiveSite, lindex, hwndParent, wine_dbgstr_rect(lprcPosRect));
hr = IRunnableObject_Run(pRunnableObj, NULL);
if (FAILED(hr)) return hr;
return IOleObject_DoVerb(This->pOleDelegate, iVerb, lpmsg, pActiveSite,
lindex, hwndParent, lprcPosRect);
}
/************************************************************************
* DefaultHandler_EnumVerbs (IOleObject)
*
* The default handler implementation of this method simply delegates
* to OleRegEnumVerbs
*
* See Windows documentation for more details on IOleObject methods.
*/
static HRESULT WINAPI DefaultHandler_EnumVerbs(
IOleObject* iface,
IEnumOLEVERB** ppEnumOleVerb)
{
DefaultHandler *This = impl_from_IOleObject(iface);
HRESULT hr = OLE_S_USEREG;
TRACE("(%p, %p)\n", iface, ppEnumOleVerb);
if (This->pOleDelegate)
hr = IOleObject_EnumVerbs(This->pOleDelegate, ppEnumOleVerb);
if (hr == OLE_S_USEREG)
return OleRegEnumVerbs(&This->clsid, ppEnumOleVerb);
else
return hr;
}
static HRESULT WINAPI DefaultHandler_Update(
IOleObject* iface)
{
FIXME(": Stub\n");
return E_NOTIMPL;
}
/************************************************************************
* DefaultHandler_IsUpToDate (IOleObject)
*
* This method is meaningless if the server is not running
*
* See Windows documentation for more details on IOleObject methods.
*/
static HRESULT WINAPI DefaultHandler_IsUpToDate(
IOleObject* iface)
{
TRACE("(%p)\n", iface);
return OLE_E_NOTRUNNING;
}
/************************************************************************
* DefaultHandler_GetUserClassID (IOleObject)
*
* TODO: Map to a new class ID if emulation is active.
*
* See Windows documentation for more details on IOleObject methods.
*/
static HRESULT WINAPI DefaultHandler_GetUserClassID(
IOleObject* iface,
CLSID* pClsid)
{
DefaultHandler *This = impl_from_IOleObject(iface);
TRACE("(%p, %p)\n", iface, pClsid);
if (This->pOleDelegate)
return IOleObject_GetUserClassID(This->pOleDelegate, pClsid);
/* Sanity check. */
if (!pClsid)
return E_POINTER;
memcpy(pClsid, &This->clsid, sizeof(CLSID));
return S_OK;
}
/************************************************************************
* DefaultHandler_GetUserType (IOleObject)
*
* The default handler implementation of this method simply delegates
* to OleRegGetUserType
*
* See Windows documentation for more details on IOleObject methods.
*/
static HRESULT WINAPI DefaultHandler_GetUserType(
IOleObject* iface,
DWORD dwFormOfType,
LPOLESTR* pszUserType)
{
DefaultHandler *This = impl_from_IOleObject(iface);
TRACE("(%p, %d, %p)\n", iface, dwFormOfType, pszUserType);
return OleRegGetUserType(&This->clsid, dwFormOfType, pszUserType);
}
/************************************************************************
* DefaultHandler_SetExtent (IOleObject)
*
* This method is meaningless if the server is not running
*
* See Windows documentation for more details on IOleObject methods.
*/
static HRESULT WINAPI DefaultHandler_SetExtent(
IOleObject* iface,
DWORD dwDrawAspect,
SIZEL* psizel)
{
DefaultHandler *This = impl_from_IOleObject(iface);
TRACE("(%p, %x, (%d x %d))\n", iface,
dwDrawAspect, psizel->cx, psizel->cy);
if (This->pOleDelegate)
IOleObject_SetExtent(This->pOleDelegate, dwDrawAspect, psizel);
return OLE_E_NOTRUNNING;
}
/************************************************************************
* DefaultHandler_GetExtent (IOleObject)
*
* The default handler's implementation of this method returns uses
* the cache to locate the aspect and extract the extent from it.
*
* See Windows documentation for more details on IOleObject methods.
*/
static HRESULT WINAPI DefaultHandler_GetExtent(
IOleObject* iface,
DWORD dwDrawAspect,
SIZEL* psizel)
{
DVTARGETDEVICE* targetDevice;
IViewObject2* cacheView = NULL;
HRESULT hres;
DefaultHandler *This = impl_from_IOleObject(iface);
TRACE("(%p, %x, %p)\n", iface, dwDrawAspect, psizel);
if (This->pOleDelegate)
return IOleObject_GetExtent(This->pOleDelegate, dwDrawAspect, psizel);
hres = IUnknown_QueryInterface(This->dataCache, &IID_IViewObject2, (void**)&cacheView);
if (FAILED(hres))
return E_UNEXPECTED;
/*
* Prepare the call to the cache's GetExtent method.
*
* Here we would build a valid DVTARGETDEVICE structure
* but, since we are calling into the data cache, we
* know it's implementation and we'll skip this
* extra work until later.
*/
targetDevice = NULL;
hres = IViewObject2_GetExtent(cacheView,
dwDrawAspect,
-1,
targetDevice,
psizel);
/*
* Cleanup
*/
IViewObject2_Release(cacheView);
return hres;
}
/************************************************************************
* DefaultHandler_Advise (IOleObject)
*
* The default handler's implementation of this method simply
* delegates to the OleAdviseHolder.
*
* See Windows documentation for more details on IOleObject methods.
*/
static HRESULT WINAPI DefaultHandler_Advise(
IOleObject* iface,
IAdviseSink* pAdvSink,
DWORD* pdwConnection)
{
HRESULT hres = S_OK;
DefaultHandler *This = impl_from_IOleObject(iface);
TRACE("(%p, %p, %p)\n", iface, pAdvSink, pdwConnection);
/* Make sure we have an advise holder before we start. */
if (!This->oleAdviseHolder)
hres = CreateOleAdviseHolder(&This->oleAdviseHolder);
if (SUCCEEDED(hres))
hres = IOleAdviseHolder_Advise(This->oleAdviseHolder,
pAdvSink,
pdwConnection);
return hres;
}
/************************************************************************
* DefaultHandler_Unadvise (IOleObject)
*
* The default handler's implementation of this method simply
* delegates to the OleAdviseHolder.
*
* See Windows documentation for more details on IOleObject methods.
*/
static HRESULT WINAPI DefaultHandler_Unadvise(
IOleObject* iface,
DWORD dwConnection)
{
DefaultHandler *This = impl_from_IOleObject(iface);
TRACE("(%p, %d)\n", iface, dwConnection);
/*
* If we don't have an advise holder yet, it means we don't have
* a connection.
*/
if (!This->oleAdviseHolder)
return OLE_E_NOCONNECTION;
return IOleAdviseHolder_Unadvise(This->oleAdviseHolder,
dwConnection);
}
/************************************************************************
* DefaultHandler_EnumAdvise (IOleObject)
*
* The default handler's implementation of this method simply
* delegates to the OleAdviseHolder.
*
* See Windows documentation for more details on IOleObject methods.
*/
static HRESULT WINAPI DefaultHandler_EnumAdvise(
IOleObject* iface,
IEnumSTATDATA** ppenumAdvise)
{
DefaultHandler *This = impl_from_IOleObject(iface);
TRACE("(%p, %p)\n", iface, ppenumAdvise);
/* Sanity check */
if (!ppenumAdvise)
return E_POINTER;
*ppenumAdvise = NULL;
if (!This->oleAdviseHolder)
return S_OK;
return IOleAdviseHolder_EnumAdvise(This->oleAdviseHolder, ppenumAdvise);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -