Sweden-Number/ole/oleobj.c

227 lines
6.0 KiB
C
Raw Normal View History

/*
* OLE2 COM objects
*
* Copyright 1998 Eric Kohl
*/
#include <string.h>
1999-02-28 20:14:33 +01:00
#include "winbase.h"
#include "winerror.h"
1999-03-10 19:03:53 +01:00
#include "oleidl.h"
#include "debug.h"
DEFAULT_DEBUG_CHANNEL(ole)
/**************************************************************************
* IOleAdviseHolder Implementation
*/
1999-03-10 19:03:53 +01:00
typedef struct
{
ICOM_VTABLE(IOleAdviseHolder)* lpvtbl;
DWORD ref;
} IOleAdviseHolderImpl;
static HRESULT WINAPI IOleAdviseHolder_fnQueryInterface(LPOLEADVISEHOLDER,REFIID,LPVOID*);
static ULONG WINAPI IOleAdviseHolder_fnAddRef(LPOLEADVISEHOLDER);
static ULONG WINAPI IOleAdviseHolder_fnRelease(LPOLEADVISEHOLDER);
static HRESULT WINAPI IOleAdviseHolder_fnAdvise(LPOLEADVISEHOLDER, IAdviseSink*, DWORD*);
static HRESULT WINAPI IOleAdviseHolder_fnUnadvise (LPOLEADVISEHOLDER, DWORD);
static HRESULT WINAPI IOleAdviseHolder_fnEnumAdvise (LPOLEADVISEHOLDER, IEnumSTATDATA **);
static HRESULT WINAPI IOleAdviseHolder_fnSendOnRename (LPOLEADVISEHOLDER, IMoniker *);
static HRESULT WINAPI IOleAdviseHolder_fnSendOnSave (LPOLEADVISEHOLDER);
static HRESULT WINAPI IOleAdviseHolder_fnSendOnClose (LPOLEADVISEHOLDER);
/**************************************************************************
* IOleAdviseHolder_VTable
*/
1999-03-10 19:03:53 +01:00
static struct ICOM_VTABLE(IOleAdviseHolder) oahvt =
{
1999-03-10 19:03:53 +01:00
IOleAdviseHolder_fnQueryInterface,
IOleAdviseHolder_fnAddRef,
IOleAdviseHolder_fnRelease,
IOleAdviseHolder_fnAdvise,
IOleAdviseHolder_fnUnadvise,
IOleAdviseHolder_fnEnumAdvise,
IOleAdviseHolder_fnSendOnRename,
IOleAdviseHolder_fnSendOnSave,
IOleAdviseHolder_fnSendOnClose
};
/**************************************************************************
* IOleAdviseHolder_Constructor
*/
LPOLEADVISEHOLDER IOleAdviseHolder_Constructor()
{
1999-03-10 19:03:53 +01:00
IOleAdviseHolderImpl* lpoah;
1999-03-10 19:03:53 +01:00
lpoah= (IOleAdviseHolderImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IOleAdviseHolderImpl));
lpoah->ref = 1;
lpoah->lpvtbl = &oahvt;
FIXME (ole, "(%p)->()\n", lpoah);
1999-03-10 19:03:53 +01:00
return (LPOLEADVISEHOLDER)lpoah;
}
/**************************************************************************
* IOleAdviseHolder_QueryInterface
*/
static HRESULT WINAPI
1999-03-10 19:03:53 +01:00
IOleAdviseHolder_fnQueryInterface (LPOLEADVISEHOLDER iface, REFIID riid, LPVOID *ppvObj)
{
1999-03-10 19:03:53 +01:00
ICOM_THIS(IOleAdviseHolderImpl, iface);
char xriid[50];
WINE_StringFromCLSID((LPCLSID)riid,xriid);
1999-03-10 19:03:53 +01:00
FIXME (ole, "(%p)->(\n\tIID:\t%s)\n", This, xriid);
*ppvObj = NULL;
if(IsEqualIID(riid, &IID_IUnknown)) {
/* IUnknown */
1999-03-10 19:03:53 +01:00
*ppvObj = This;
}
else if(IsEqualIID(riid, &IID_IOleAdviseHolder)) {
/* IOleAdviseHolder */
1999-03-10 19:03:53 +01:00
*ppvObj = (IOleAdviseHolder*) This;
}
if(*ppvObj) {
1999-03-10 19:03:53 +01:00
(*(LPOLEADVISEHOLDER*)ppvObj)->lpvtbl->fnAddRef(iface);
FIXME (ole, "-- Interface: (%p)->(%p)\n", ppvObj, *ppvObj);
return S_OK;
}
FIXME (ole, "-- Interface: E_NOINTERFACE\n");
return E_NOINTERFACE;
}
/******************************************************************************
* IOleAdviseHolder_AddRef
*/
static ULONG WINAPI
1999-03-10 19:03:53 +01:00
IOleAdviseHolder_fnAddRef (LPOLEADVISEHOLDER iface)
{
1999-03-10 19:03:53 +01:00
ICOM_THIS(IOleAdviseHolderImpl, iface);
FIXME (ole, "(%p)->(count=%lu)\n", This, This->ref);
return ++(This->ref);
}
/******************************************************************************
* IOleAdviseHolder_Release
*/
static ULONG WINAPI
1999-03-10 19:03:53 +01:00
IOleAdviseHolder_fnRelease (LPOLEADVISEHOLDER iface)
{
1999-03-10 19:03:53 +01:00
ICOM_THIS(IOleAdviseHolderImpl, iface);
FIXME (ole, "(%p)->(count=%lu)\n", This, This->ref);
if (!--(This->ref)) {
FIXME (ole, "-- destroying IOleAdviseHolder(%p)\n", This);
HeapFree(GetProcessHeap(),0,This);
return 0;
}
1999-03-10 19:03:53 +01:00
return This->ref;
}
/******************************************************************************
* IOleAdviseHolder_Advise
*/
static HRESULT WINAPI
1999-03-10 19:03:53 +01:00
IOleAdviseHolder_fnAdvise (LPOLEADVISEHOLDER iface,
IAdviseSink *pAdvise, DWORD *pdwConnection)
{
1999-03-10 19:03:53 +01:00
ICOM_THIS(IOleAdviseHolderImpl, iface);
FIXME (ole, "(%p)->(%p %p)\n", This, pAdvise, pdwConnection);
*pdwConnection = 0;
return S_OK;
}
/******************************************************************************
* IOleAdviseHolder_Unadvise
*/
static HRESULT WINAPI
1999-03-10 19:03:53 +01:00
IOleAdviseHolder_fnUnadvise (LPOLEADVISEHOLDER iface, DWORD dwConnection)
{
1999-03-10 19:03:53 +01:00
ICOM_THIS(IOleAdviseHolderImpl, iface);
FIXME (ole, "(%p)->(%lu)\n", This, dwConnection);
return S_OK;
}
/******************************************************************************
* IOleAdviseHolder_EnumAdvise
*/
static HRESULT WINAPI
1999-03-10 19:03:53 +01:00
IOleAdviseHolder_fnEnumAdvise (LPOLEADVISEHOLDER iface, IEnumSTATDATA **ppenumAdvise)
{
1999-03-10 19:03:53 +01:00
ICOM_THIS(IOleAdviseHolderImpl, iface);
FIXME (ole, "(%p)->(%p)\n", This, ppenumAdvise);
*ppenumAdvise = NULL;
return S_OK;
}
/******************************************************************************
* IOleAdviseHolder_SendOnRename
*/
static HRESULT WINAPI
1999-03-10 19:03:53 +01:00
IOleAdviseHolder_fnSendOnRename (LPOLEADVISEHOLDER iface, IMoniker *pmk)
{
1999-03-10 19:03:53 +01:00
ICOM_THIS(IOleAdviseHolderImpl, iface);
FIXME (ole, "(%p)->(%p)\n", This, pmk);
return S_OK;
}
/******************************************************************************
* IOleAdviseHolder_SendOnSave
*/
static HRESULT WINAPI
1999-03-10 19:03:53 +01:00
IOleAdviseHolder_fnSendOnSave (LPOLEADVISEHOLDER iface)
{
1999-03-10 19:03:53 +01:00
ICOM_THIS(IOleAdviseHolderImpl, iface);
FIXME (ole, "(%p)\n", This);
return S_OK;
}
/******************************************************************************
* IOleAdviseHolder_SendOnClose
*/
static HRESULT WINAPI
1999-03-10 19:03:53 +01:00
IOleAdviseHolder_fnSendOnClose (LPOLEADVISEHOLDER iface)
{
1999-03-10 19:03:53 +01:00
ICOM_THIS(IOleAdviseHolderImpl, iface);
FIXME (ole, "(%p)\n", This);
return S_OK;
}
/***********************************************************************
* API functions
*/
/***********************************************************************
* CreateOleAdviseHolder [OLE32.59]
*/
HRESULT WINAPI CreateOleAdviseHolder (LPOLEADVISEHOLDER *ppOAHolder)
{
FIXME(ole,"(%p): stub!\n", ppOAHolder);
*ppOAHolder = IOleAdviseHolder_Constructor ();
if (*ppOAHolder)
return S_OK;
*ppOAHolder = 0;
return E_OUTOFMEMORY;
}