2005-07-03 11:22:23 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2005 Jacek Caban
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 12:49:52 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2005-07-03 11:22:23 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#define COBJMACROS
|
|
|
|
|
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
|
|
|
#include "winuser.h"
|
|
|
|
#include "ole2.h"
|
|
|
|
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
#include "mshtml_private.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
|
|
|
|
2007-09-09 18:17:30 +00:00
|
|
|
typedef struct {
|
2010-12-06 22:32:21 +00:00
|
|
|
IOleUndoManager IOleUndoManager_iface;
|
2007-09-09 18:17:30 +00:00
|
|
|
|
|
|
|
LONG ref;
|
|
|
|
} UndoManager;
|
|
|
|
|
2010-12-06 22:32:21 +00:00
|
|
|
static inline UndoManager *impl_from_IOleUndoManager(IOleUndoManager *iface)
|
|
|
|
{
|
|
|
|
return CONTAINING_RECORD(iface, UndoManager, IOleUndoManager_iface);
|
|
|
|
}
|
2007-09-09 18:17:30 +00:00
|
|
|
|
|
|
|
static HRESULT WINAPI OleUndoManager_QueryInterface(IOleUndoManager *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
2010-12-06 22:32:21 +00:00
|
|
|
UndoManager *This = impl_from_IOleUndoManager(iface);
|
2007-09-09 18:17:30 +00:00
|
|
|
|
|
|
|
if(IsEqualGUID(riid, &IID_IUnknown)) {
|
|
|
|
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
|
2010-12-06 22:32:21 +00:00
|
|
|
*ppv = &This->IOleUndoManager_iface;
|
2007-09-09 18:17:30 +00:00
|
|
|
}else if(IsEqualGUID(riid, &IID_IOleUndoManager)) {
|
|
|
|
TRACE("(%p)->(IID_IOleUndoManager %p)\n", This, ppv);
|
2010-12-06 22:32:21 +00:00
|
|
|
*ppv = &This->IOleUndoManager_iface;
|
2010-12-20 18:09:34 +00:00
|
|
|
}else {
|
|
|
|
*ppv = NULL;
|
|
|
|
FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
|
|
|
|
return E_NOINTERFACE;
|
2007-09-09 18:17:30 +00:00
|
|
|
}
|
|
|
|
|
2010-12-20 18:09:34 +00:00
|
|
|
IUnknown_AddRef((IUnknown*)*ppv);
|
|
|
|
return S_OK;
|
2007-09-09 18:17:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI OleUndoManager_AddRef(IOleUndoManager *iface)
|
|
|
|
{
|
2010-12-06 22:32:21 +00:00
|
|
|
UndoManager *This = impl_from_IOleUndoManager(iface);
|
2007-09-09 18:17:30 +00:00
|
|
|
LONG ref = InterlockedIncrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p) ref=%d\n", This, ref);
|
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI OleUndoManager_Release(IOleUndoManager *iface)
|
|
|
|
{
|
2010-12-06 22:32:21 +00:00
|
|
|
UndoManager *This = impl_from_IOleUndoManager(iface);
|
2007-09-09 18:17:30 +00:00
|
|
|
LONG ref = InterlockedDecrement(&This->ref);
|
|
|
|
|
|
|
|
TRACE("(%p) ref=%d\n", This, ref);
|
|
|
|
|
|
|
|
if(!ref)
|
2007-12-05 20:52:31 +00:00
|
|
|
heap_free(This);
|
2007-09-09 18:17:30 +00:00
|
|
|
|
|
|
|
return ref;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleUndoManager_Open(IOleUndoManager *iface, IOleParentUndoUnit *pPUU)
|
|
|
|
{
|
2010-12-06 22:32:21 +00:00
|
|
|
UndoManager *This = impl_from_IOleUndoManager(iface);
|
2007-09-09 18:17:30 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, pPUU);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleUndoManager_Close(IOleUndoManager *iface, IOleParentUndoUnit *pPUU,
|
|
|
|
BOOL fCommit)
|
|
|
|
{
|
2010-12-06 22:32:21 +00:00
|
|
|
UndoManager *This = impl_from_IOleUndoManager(iface);
|
2007-09-09 18:17:30 +00:00
|
|
|
FIXME("(%p)->(%p %x)\n", This, pPUU, fCommit);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleUndoManager_Add(IOleUndoManager *iface, IOleUndoUnit *pUU)
|
|
|
|
{
|
2010-12-06 22:32:21 +00:00
|
|
|
UndoManager *This = impl_from_IOleUndoManager(iface);
|
2007-09-09 18:17:30 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, pUU);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleUndoManager_GetOpenParentState(IOleUndoManager *iface, DWORD *pdwState)
|
|
|
|
{
|
2010-12-06 22:32:21 +00:00
|
|
|
UndoManager *This = impl_from_IOleUndoManager(iface);
|
2007-09-09 18:17:30 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, pdwState);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleUndoManager_DiscardFrom(IOleUndoManager *iface, IOleUndoUnit *pUU)
|
|
|
|
{
|
2010-12-06 22:32:21 +00:00
|
|
|
UndoManager *This = impl_from_IOleUndoManager(iface);
|
2007-09-09 18:17:30 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, pUU);
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleUndoManager_UndoTo(IOleUndoManager *iface, IOleUndoUnit *pUU)
|
|
|
|
{
|
2010-12-06 22:32:21 +00:00
|
|
|
UndoManager *This = impl_from_IOleUndoManager(iface);
|
2007-09-09 18:17:30 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, pUU);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleUndoManager_RedoTo(IOleUndoManager *iface, IOleUndoUnit *pUU)
|
|
|
|
{
|
2010-12-06 22:32:21 +00:00
|
|
|
UndoManager *This = impl_from_IOleUndoManager(iface);
|
2007-09-09 18:17:30 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, pUU);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleUndoManager_EnumUndoable(IOleUndoManager *iface,
|
|
|
|
IEnumOleUndoUnits **ppEnum)
|
|
|
|
{
|
2010-12-06 22:32:21 +00:00
|
|
|
UndoManager *This = impl_from_IOleUndoManager(iface);
|
2007-09-09 18:17:30 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, ppEnum);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleUndoManager_EnumRedoable(IOleUndoManager *iface,
|
|
|
|
IEnumOleUndoUnits **ppEnum)
|
|
|
|
{
|
2010-12-06 22:32:21 +00:00
|
|
|
UndoManager *This = impl_from_IOleUndoManager(iface);
|
2007-09-09 18:17:30 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, ppEnum);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleUndoManager_GetLastUndoDescription(IOleUndoManager *iface, BSTR *pBstr)
|
|
|
|
{
|
2010-12-06 22:32:21 +00:00
|
|
|
UndoManager *This = impl_from_IOleUndoManager(iface);
|
2007-09-09 18:17:30 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, pBstr);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleUndoManager_GetLastRedoDescription(IOleUndoManager *iface, BSTR *pBstr)
|
|
|
|
{
|
2010-12-06 22:32:21 +00:00
|
|
|
UndoManager *This = impl_from_IOleUndoManager(iface);
|
2007-09-09 18:17:30 +00:00
|
|
|
FIXME("(%p)->(%p)\n", This, pBstr);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI OleUndoManager_Enable(IOleUndoManager *iface, BOOL fEnable)
|
|
|
|
{
|
2010-12-06 22:32:21 +00:00
|
|
|
UndoManager *This = impl_from_IOleUndoManager(iface);
|
2007-09-09 18:17:30 +00:00
|
|
|
FIXME("(%p)->(%x)\n", This, fEnable);
|
|
|
|
return E_NOTIMPL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const IOleUndoManagerVtbl OleUndoManagerVtbl = {
|
|
|
|
OleUndoManager_QueryInterface,
|
|
|
|
OleUndoManager_AddRef,
|
|
|
|
OleUndoManager_Release,
|
|
|
|
OleUndoManager_Open,
|
|
|
|
OleUndoManager_Close,
|
|
|
|
OleUndoManager_Add,
|
|
|
|
OleUndoManager_GetOpenParentState,
|
|
|
|
OleUndoManager_DiscardFrom,
|
|
|
|
OleUndoManager_UndoTo,
|
|
|
|
OleUndoManager_RedoTo,
|
|
|
|
OleUndoManager_EnumUndoable,
|
|
|
|
OleUndoManager_EnumRedoable,
|
|
|
|
OleUndoManager_GetLastUndoDescription,
|
|
|
|
OleUndoManager_GetLastRedoDescription,
|
|
|
|
OleUndoManager_Enable
|
|
|
|
};
|
|
|
|
|
|
|
|
static IOleUndoManager *create_undomgr(void)
|
|
|
|
{
|
2007-12-05 20:52:31 +00:00
|
|
|
UndoManager *ret = heap_alloc(sizeof(UndoManager));
|
2007-09-09 18:17:30 +00:00
|
|
|
|
2010-12-06 22:32:21 +00:00
|
|
|
ret->IOleUndoManager_iface.lpVtbl = &OleUndoManagerVtbl;
|
2007-09-09 18:17:30 +00:00
|
|
|
ret->ref = 1;
|
|
|
|
|
2010-12-06 22:32:21 +00:00
|
|
|
return &ret->IOleUndoManager_iface;
|
2007-09-09 18:17:30 +00:00
|
|
|
}
|
|
|
|
|
2005-07-03 11:22:23 +00:00
|
|
|
/**********************************************************
|
2008-04-04 19:23:01 +00:00
|
|
|
* IServiceProvider implementation
|
2005-07-03 11:22:23 +00:00
|
|
|
*/
|
|
|
|
|
2005-08-11 10:30:30 +00:00
|
|
|
#define SERVPROV_THIS(iface) DEFINE_THIS(HTMLDocument, ServiceProvider, iface)
|
2005-07-03 11:22:23 +00:00
|
|
|
|
|
|
|
static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
HTMLDocument *This = SERVPROV_THIS(iface);
|
2010-12-16 13:59:51 +00:00
|
|
|
return htmldoc_query_interface(This, riid, ppv);
|
2005-07-03 11:22:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
|
|
|
|
{
|
|
|
|
HTMLDocument *This = SERVPROV_THIS(iface);
|
2010-12-16 13:59:51 +00:00
|
|
|
return htmldoc_addref(This);
|
2005-07-03 11:22:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
|
|
|
|
{
|
|
|
|
HTMLDocument *This = SERVPROV_THIS(iface);
|
2010-12-16 13:59:51 +00:00
|
|
|
return htmldoc_release(This);
|
2005-07-03 11:22:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
|
|
|
|
REFIID riid, void **ppv)
|
|
|
|
{
|
|
|
|
HTMLDocument *This = SERVPROV_THIS(iface);
|
|
|
|
|
2006-05-24 15:58:27 +00:00
|
|
|
if(IsEqualGUID(&CLSID_CMarkup, guidService)) {
|
|
|
|
FIXME("(%p)->(CLSID_CMarkup %s %p)\n", This, debugstr_guid(riid), ppv);
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
2005-07-03 11:22:23 +00:00
|
|
|
|
2010-11-04 12:08:10 +00:00
|
|
|
if(IsEqualGUID(&SID_SOleUndoManager, guidService)) {
|
|
|
|
TRACE("SID_SOleUndoManager\n");
|
2007-09-09 18:17:30 +00:00
|
|
|
|
2009-09-16 20:10:30 +00:00
|
|
|
if(!This->doc_obj->undomgr)
|
|
|
|
This->doc_obj->undomgr = create_undomgr();
|
2007-09-09 18:17:30 +00:00
|
|
|
|
2010-11-04 12:08:10 +00:00
|
|
|
return IOleUndoManager_QueryInterface(This->doc_obj->undomgr, riid, ppv);
|
2007-09-09 18:17:30 +00:00
|
|
|
}
|
|
|
|
|
2010-12-17 02:38:44 +00:00
|
|
|
TRACE("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
|
|
|
|
|
2009-12-28 19:08:46 +00:00
|
|
|
if(This->doc_obj->client) {
|
|
|
|
IServiceProvider *sp;
|
|
|
|
HRESULT hres;
|
|
|
|
|
|
|
|
hres = IOleClientSite_QueryInterface(This->doc_obj->client,
|
|
|
|
&IID_IServiceProvider, (void**)&sp);
|
|
|
|
if(SUCCEEDED(hres)) {
|
|
|
|
hres = IServiceProvider_QueryService(sp, guidService, riid, ppv);
|
|
|
|
IServiceProvider_Release(sp);
|
|
|
|
|
|
|
|
if(SUCCEEDED(hres))
|
|
|
|
return hres;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-17 02:38:44 +00:00
|
|
|
FIXME("unknown service %s\n", debugstr_guid(guidService));
|
2009-12-28 19:08:46 +00:00
|
|
|
return E_NOINTERFACE;
|
2005-07-03 11:22:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static const IServiceProviderVtbl ServiceProviderVtbl = {
|
|
|
|
ServiceProvider_QueryInterface,
|
|
|
|
ServiceProvider_AddRef,
|
|
|
|
ServiceProvider_Release,
|
|
|
|
ServiceProvider_QueryService
|
|
|
|
};
|
|
|
|
|
|
|
|
void HTMLDocument_Service_Init(HTMLDocument *This)
|
|
|
|
{
|
|
|
|
This->lpServiceProviderVtbl = &ServiceProviderVtbl;
|
|
|
|
}
|