mirror of
https://github.com/reactos/wine.git
synced 2024-11-29 06:30:37 +00:00
- Beginning implementation of true IPersistMoniker::Load.
- THIS macros cleanup.
This commit is contained in:
parent
31dd4af57d
commit
0cdb3c9765
@ -4,7 +4,7 @@ SRCDIR = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
MODULE = mshtml.dll
|
||||
IMPORTLIB = libmshtml.$(IMPLIBEXT)
|
||||
IMPORTS = ole32 user32 gdi32 advapi32 kernel32 ntdll
|
||||
IMPORTS = urlmon ole32 user32 gdi32 advapi32 kernel32 ntdll
|
||||
EXTRALIBS = $(LIBUNICODE) -lstrmiids -luuid
|
||||
EXTRADEFS = -DCOM_NO_WINDOWS_H
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#define NS_SUCCEEDED(res) (!NS_FAILED(res))
|
||||
|
||||
typedef struct NSContainer NSContainer;
|
||||
typedef struct BindStatusCallback BindStatusCallback;
|
||||
|
||||
typedef struct {
|
||||
const IHTMLDocument2Vtbl *lpHTMLDocument2Vtbl;
|
||||
@ -56,6 +57,8 @@ typedef struct {
|
||||
BOOL in_place_active;
|
||||
BOOL ui_active;
|
||||
BOOL has_key_path;
|
||||
|
||||
BindStatusCallback *status_callback;
|
||||
} HTMLDocument;
|
||||
|
||||
struct NSContainer {
|
||||
@ -86,6 +89,7 @@ struct NSContainer {
|
||||
#define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
|
||||
#define CMDTARGET(x) ((IOleCommandTarget*) &(x)->lpOleCommandTargetVtbl)
|
||||
#define CONTROL(x) ((IOleControl*) &(x)->lpOleControlVtbl)
|
||||
#define STATUSCLB(x) ((IBindStatusCallback*) &(x)->lpBindStatusCallbackVtbl)
|
||||
|
||||
#define DEFINE_THIS(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,lp ## ifc ## Vtbl)))
|
||||
|
||||
|
@ -38,53 +38,221 @@
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
||||
|
||||
struct BindStatusCallback {
|
||||
const IBindStatusCallbackVtbl *lpBindStatusCallbackVtbl;
|
||||
|
||||
LONG ref;
|
||||
|
||||
HTMLDocument *doc;
|
||||
IBinding *binding;
|
||||
};
|
||||
|
||||
#define STATUSCLB_THIS(iface) DEFINE_THIS(BindStatusCallback, BindStatusCallback, iface)
|
||||
|
||||
static HRESULT WINAPI BindStatusCallback_QueryInterface(IBindStatusCallback *iface,
|
||||
REFIID riid, void **ppv)
|
||||
{
|
||||
BindStatusCallback *This = STATUSCLB_THIS(iface);
|
||||
|
||||
*ppv = NULL;
|
||||
if(IsEqualGUID(&IID_IUnknown, riid)) {
|
||||
TRACE("(%p)->(IID_IUnknown, %p)\n", This, ppv);
|
||||
*ppv = STATUSCLB(This);
|
||||
}else if(IsEqualGUID(&IID_IBindStatusCallback, riid)) {
|
||||
TRACE("(%p)->(IID_IBindStatusCallback, %p)\n", This, ppv);
|
||||
*ppv = STATUSCLB(This);
|
||||
}
|
||||
|
||||
if(*ppv) {
|
||||
IBindStatusCallback_AddRef(STATUSCLB(This));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
TRACE("Unsupported riid = %s\n", debugstr_guid(riid));
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI BindStatusCallback_AddRef(IBindStatusCallback *iface)
|
||||
{
|
||||
BindStatusCallback *This = STATUSCLB_THIS(iface);
|
||||
LONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("(%p) ref = %ld\n", This, ref);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
static ULONG WINAPI BindStatusCallback_Release(IBindStatusCallback *iface)
|
||||
{
|
||||
BindStatusCallback *This = STATUSCLB_THIS(iface);
|
||||
LONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
TRACE("(%p) ref = %ld\n", This, ref);
|
||||
|
||||
if(!ref) {
|
||||
if(This->doc->status_callback == This)
|
||||
This->doc->status_callback = NULL;
|
||||
IHTMLDocument2_Release(HTMLDOC(This->doc));
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BindStatusCallback_OnStartBinding(IBindStatusCallback *iface,
|
||||
DWORD dwReserved, IBinding *pbind)
|
||||
{
|
||||
BindStatusCallback *This = STATUSCLB_THIS(iface);
|
||||
|
||||
TRACE("(%p)->(%ld %p)\n", This, dwReserved, pbind);
|
||||
|
||||
This->binding = pbind;
|
||||
IBinding_AddRef(pbind);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BindStatusCallback_GetPriority(IBindStatusCallback *iface, LONG *pnPriority)
|
||||
{
|
||||
BindStatusCallback *This = STATUSCLB_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, pnPriority);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BindStatusCallback_OnLowResource(IBindStatusCallback *iface, DWORD reserved)
|
||||
{
|
||||
BindStatusCallback *This = STATUSCLB_THIS(iface);
|
||||
FIXME("(%p)->(%ld)\n", This, reserved);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BindStatusCallback_OnProgress(IBindStatusCallback *iface, ULONG ulProgress,
|
||||
ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
|
||||
{
|
||||
BindStatusCallback *This = STATUSCLB_THIS(iface);
|
||||
TRACE("%p)->(%lu %lu %lu %s)\n", This, ulProgress, ulProgressMax, ulStatusCode,
|
||||
debugstr_w(szStatusText));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BindStatusCallback_OnStopBinding(IBindStatusCallback *iface,
|
||||
HRESULT hresult, LPCWSTR szError)
|
||||
{
|
||||
BindStatusCallback *This = STATUSCLB_THIS(iface);
|
||||
|
||||
TRACE("(%p)->(%08lx %s)\n", This, hresult, debugstr_w(szError));
|
||||
|
||||
IBinding_Release(This->binding);
|
||||
This->binding = NULL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BindStatusCallback_GetBindInfo(IBindStatusCallback *iface,
|
||||
DWORD *grfBINDF, BINDINFO *pbindinfo)
|
||||
{
|
||||
BindStatusCallback *This = STATUSCLB_THIS(iface);
|
||||
DWORD size;
|
||||
|
||||
TRACE("(%p)->(%p %p)\n", This, grfBINDF, pbindinfo);
|
||||
|
||||
*grfBINDF = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA;
|
||||
size = pbindinfo->cbSize;
|
||||
memset(pbindinfo, 0, size);
|
||||
pbindinfo->cbSize = size;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BindStatusCallback_OnDataAvailable(IBindStatusCallback *iface,
|
||||
DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed)
|
||||
{
|
||||
BindStatusCallback *This = STATUSCLB_THIS(iface);
|
||||
TRACE("(%p)->(%08lx %ld %p %p)\n", This, grfBSCF, dwSize, pformatetc, pstgmed);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI BindStatusCallback_OnObjectAvailable(IBindStatusCallback *iface,
|
||||
REFIID riid, IUnknown *punk)
|
||||
{
|
||||
BindStatusCallback *This = STATUSCLB_THIS(iface);
|
||||
FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), punk);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static const IBindStatusCallbackVtbl BindStatusCallbackVtbl = {
|
||||
BindStatusCallback_QueryInterface,
|
||||
BindStatusCallback_AddRef,
|
||||
BindStatusCallback_Release,
|
||||
BindStatusCallback_OnStartBinding,
|
||||
BindStatusCallback_GetPriority,
|
||||
BindStatusCallback_OnLowResource,
|
||||
BindStatusCallback_OnProgress,
|
||||
BindStatusCallback_OnStopBinding,
|
||||
BindStatusCallback_GetBindInfo,
|
||||
BindStatusCallback_OnDataAvailable,
|
||||
BindStatusCallback_OnObjectAvailable
|
||||
};
|
||||
|
||||
static BindStatusCallback *BindStatusCallback_Create(HTMLDocument *doc)
|
||||
{
|
||||
BindStatusCallback *ret = HeapAlloc(GetProcessHeap(), 0, sizeof(BindStatusCallback));
|
||||
ret->lpBindStatusCallbackVtbl = &BindStatusCallbackVtbl;
|
||||
ret->ref = 0;
|
||||
ret->doc = doc;
|
||||
IHTMLDocument2_AddRef(HTMLDOC(doc));
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**********************************************************
|
||||
* IPersistMoniker implementation
|
||||
*/
|
||||
|
||||
#define PERSISTMON_THIS \
|
||||
HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpPersistMonikerVtbl));
|
||||
#define PERSISTMON_THIS(iface) DEFINE_THIS(HTMLDocument, PersistMoniker, iface)
|
||||
|
||||
static HRESULT WINAPI PersistMoniker_QueryInterface(IPersistMoniker *iface, REFIID riid,
|
||||
void **ppvObject)
|
||||
{
|
||||
PERSISTMON_THIS
|
||||
HTMLDocument *This = PERSISTMON_THIS(iface);
|
||||
return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
|
||||
}
|
||||
|
||||
static ULONG WINAPI PersistMoniker_AddRef(IPersistMoniker *iface)
|
||||
{
|
||||
PERSISTMON_THIS
|
||||
HTMLDocument *This = PERSISTMON_THIS(iface);
|
||||
return IHTMLDocument2_AddRef(HTMLDOC(This));
|
||||
}
|
||||
|
||||
static ULONG WINAPI PersistMoniker_Release(IPersistMoniker *iface)
|
||||
{
|
||||
PERSISTMON_THIS
|
||||
HTMLDocument *This = PERSISTMON_THIS(iface);
|
||||
return IHTMLDocument2_Release(HTMLDOC(This));
|
||||
}
|
||||
|
||||
static HRESULT WINAPI PersistMoniker_GetClassID(IPersistMoniker *iface, CLSID *pClassID)
|
||||
{
|
||||
PERSISTMON_THIS
|
||||
HTMLDocument *This = PERSISTMON_THIS(iface);
|
||||
return IPersist_GetClassID(PERSIST(This), pClassID);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI PersistMoniker_IsDirty(IPersistMoniker *iface)
|
||||
{
|
||||
FIXME("(%p)\n", iface);
|
||||
HTMLDocument *This = PERSISTMON_THIS(iface);
|
||||
FIXME("(%p)\n", This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAvailable,
|
||||
IMoniker *pimkName, LPBC pibc, DWORD grfMode)
|
||||
{
|
||||
PERSISTMON_THIS
|
||||
HTMLDocument *This = PERSISTMON_THIS(iface);
|
||||
IBindCtx *pbind;
|
||||
BindStatusCallback *callback;
|
||||
IStream *str;
|
||||
LPWSTR url;
|
||||
HRESULT hres;
|
||||
nsresult nsres;
|
||||
|
||||
FIXME("(%p)->(%x %p %p %08lx)\n", iface, fFullyAvailable, pimkName, pibc, grfMode);
|
||||
FIXME("(%p)->(%x %p %p %08lx)\n", This, fFullyAvailable, pimkName, pibc, grfMode);
|
||||
|
||||
/* FIXME:
|
||||
* This is a HACK, we should use moniker's BindToStorage instead of Gecko's LoadURI.
|
||||
@ -100,32 +268,60 @@ static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAva
|
||||
if(This->hwnd) {
|
||||
nsres = nsIWebNavigation_LoadURI(This->nscontainer->navigation, url,
|
||||
LOAD_FLAGS_NONE, NULL, NULL, NULL);
|
||||
if(NS_FAILED(nsres))
|
||||
if(NS_SUCCEEDED(nsres))
|
||||
return S_OK;
|
||||
else
|
||||
WARN("LoadURI failed: %08lx\n", nsres);
|
||||
}else {
|
||||
This->nscontainer->url = url;
|
||||
return S_OK;
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: Use grfMode */
|
||||
|
||||
if(fFullyAvailable)
|
||||
FIXME("not supported fFullyAvailable\n");
|
||||
if(pibc)
|
||||
FIXME("not supported pibc\n");
|
||||
|
||||
if(This->status_callback && This->status_callback->binding)
|
||||
IBinding_Abort(This->status_callback->binding);
|
||||
|
||||
callback = This->status_callback = BindStatusCallback_Create(This);
|
||||
|
||||
CreateAsyncBindCtx(0, STATUSCLB(callback), NULL, &pbind);
|
||||
|
||||
hres = IMoniker_BindToStorage(pimkName, pbind, NULL, &IID_IStream, (void**)&str);
|
||||
if(str)
|
||||
IStream_Release(str);
|
||||
if(FAILED(hres)) {
|
||||
WARN("BindToStorage failed: %08lx\n", hres);
|
||||
return hres;
|
||||
}
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI PersistMoniker_Save(IPersistMoniker *iface, IMoniker *pimkName,
|
||||
LPBC pbc, BOOL fRemember)
|
||||
{
|
||||
FIXME("(%p)->(%p %p %x)\n", iface, pimkName, pbc, fRemember);
|
||||
HTMLDocument *This = PERSISTMON_THIS(iface);
|
||||
FIXME("(%p)->(%p %p %x)\n", This, pimkName, pbc, fRemember);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI PersistMoniker_SaveCompleted(IPersistMoniker *iface, IMoniker *pimkName, LPBC pibc)
|
||||
{
|
||||
FIXME("(%p)->(%p %p)\n", iface, pimkName, pibc);
|
||||
HTMLDocument *This = PERSISTMON_THIS(iface);
|
||||
FIXME("(%p)->(%p %p)\n", This, pimkName, pibc);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI PersistMoniker_GetCurMoniker(IPersistMoniker *iface, IMoniker **ppimkName)
|
||||
{
|
||||
FIXME("(%p)->(%p)\n", iface, ppimkName);
|
||||
HTMLDocument *This = PERSISTMON_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, ppimkName);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
@ -145,30 +341,30 @@ static const IPersistMonikerVtbl PersistMonikerVtbl = {
|
||||
* IMonikerProp implementation
|
||||
*/
|
||||
|
||||
#define MONPROP_THIS \
|
||||
HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpMonikerPropVtbl));
|
||||
#define MONPROP_THIS(iface) DEFINE_THIS(HTMLDocument, MonikerProp, iface)
|
||||
|
||||
static HRESULT WINAPI MonikerProp_QueryInterface(IMonikerProp *iface, REFIID riid, void **ppvObject)
|
||||
{
|
||||
MONPROP_THIS
|
||||
HTMLDocument *This = MONPROP_THIS(iface);
|
||||
return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
|
||||
}
|
||||
|
||||
static ULONG WINAPI MonikerProp_AddRef(IMonikerProp *iface)
|
||||
{
|
||||
MONPROP_THIS
|
||||
HTMLDocument *This = MONPROP_THIS(iface);
|
||||
return IHTMLDocument2_AddRef(HTMLDOC(This));
|
||||
}
|
||||
|
||||
static ULONG WINAPI MonikerProp_Release(IMonikerProp *iface)
|
||||
{
|
||||
MONPROP_THIS
|
||||
HTMLDocument *This = MONPROP_THIS(iface);
|
||||
return IHTMLDocument_Release(HTMLDOC(This));
|
||||
}
|
||||
|
||||
static HRESULT WINAPI MonikerProp_PutProperty(IMonikerProp *iface, MONIKERPROPERTY mkp, LPCWSTR val)
|
||||
{
|
||||
FIXME("(%p)->(%d %s)\n", iface, mkp, debugstr_w(val));
|
||||
HTMLDocument *This = MONPROP_THIS(iface);
|
||||
FIXME("(%p)->(%d %s)\n", This, mkp, debugstr_w(val));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
@ -183,30 +379,31 @@ static const IMonikerPropVtbl MonikerPropVtbl = {
|
||||
* IPersistFile implementation
|
||||
*/
|
||||
|
||||
#define PERSISTFILE_THIS \
|
||||
HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpPersistFileVtbl));
|
||||
#define PERSISTFILE_THIS(iface) DEFINE_THIS(HTMLDocument, PersistFile, iface)
|
||||
|
||||
static HRESULT WINAPI PersistFile_QueryInterface(IPersistFile *iface, REFIID riid, void **ppvObject)
|
||||
{
|
||||
PERSISTFILE_THIS
|
||||
HTMLDocument *This = PERSISTFILE_THIS(iface);
|
||||
return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
|
||||
}
|
||||
|
||||
static ULONG WINAPI PersistFile_AddRef(IPersistFile *iface)
|
||||
{
|
||||
PERSISTFILE_THIS
|
||||
HTMLDocument *This = PERSISTFILE_THIS(iface);
|
||||
return IHTMLDocument2_AddRef(HTMLDOC(This));
|
||||
}
|
||||
|
||||
static ULONG WINAPI PersistFile_Release(IPersistFile *iface)
|
||||
{
|
||||
PERSISTFILE_THIS
|
||||
HTMLDocument *This = PERSISTFILE_THIS(iface);
|
||||
return IHTMLDocument2_Release(HTMLDOC(This));
|
||||
}
|
||||
|
||||
static HRESULT WINAPI PersistFile_GetClassID(IPersistFile *iface, CLSID *pClassID)
|
||||
{
|
||||
TRACE("(%p)->(%p)\n", iface, pClassID);
|
||||
HTMLDocument *This = PERSISTFILE_THIS(iface);
|
||||
|
||||
TRACE("(%p)->(%p)\n", This, pClassID);
|
||||
|
||||
if(!pClassID)
|
||||
return E_INVALIDARG;
|
||||
@ -217,31 +414,36 @@ static HRESULT WINAPI PersistFile_GetClassID(IPersistFile *iface, CLSID *pClassI
|
||||
|
||||
static HRESULT WINAPI PersistFile_IsDirty(IPersistFile *iface)
|
||||
{
|
||||
FIXME("(%p)\n", iface);
|
||||
HTMLDocument *This = PERSISTFILE_THIS(iface);
|
||||
FIXME("(%p)\n", This);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI PersistFile_Load(IPersistFile *iface, LPCOLESTR pszFileName, DWORD dwMode)
|
||||
{
|
||||
FIXME("(%p)->(%s %08lx)\n", iface, debugstr_w(pszFileName), dwMode);
|
||||
HTMLDocument *This = PERSISTFILE_THIS(iface);
|
||||
FIXME("(%p)->(%s %08lx)\n", This, debugstr_w(pszFileName), dwMode);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI PersistFile_Save(IPersistFile *iface, LPCOLESTR pszFileName, BOOL fRemember)
|
||||
{
|
||||
FIXME("(%p)->(%s %x)\n", iface, debugstr_w(pszFileName), fRemember);
|
||||
HTMLDocument *This = PERSISTFILE_THIS(iface);
|
||||
FIXME("(%p)->(%s %x)\n", This, debugstr_w(pszFileName), fRemember);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI PersistFile_SaveCompleted(IPersistFile *iface, LPCOLESTR pszFileName)
|
||||
{
|
||||
FIXME("(%p)->(%s)\n", iface, debugstr_w(pszFileName));
|
||||
HTMLDocument *This = PERSISTFILE_THIS(iface);
|
||||
FIXME("(%p)->(%s)\n", This, debugstr_w(pszFileName));
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI PersistFile_GetCurFile(IPersistFile *iface, LPOLESTR *pszFileName)
|
||||
{
|
||||
FIXME("(%p)->(%p)\n", iface, pszFileName);
|
||||
HTMLDocument *This = PERSISTFILE_THIS(iface);
|
||||
FIXME("(%p)->(%p)\n", This, pszFileName);
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
@ -262,4 +464,6 @@ void HTMLDocument_Persist_Init(HTMLDocument *This)
|
||||
This->lpPersistMonikerVtbl = &PersistMonikerVtbl;
|
||||
This->lpPersistFileVtbl = &PersistFileVtbl;
|
||||
This->lpMonikerPropVtbl = &MonikerPropVtbl;
|
||||
|
||||
This->status_callback = NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user