persist.c 5.79 KB
Newer Older
1
/*
2
 * Implementation of IPersist interfaces for WebBrowser control
3 4
 *
 * Copyright 2001 John R. Sheets (for CodeWeavers)
5
 * Copyright 2005 Jacek Caban
6 7 8 9 10 11 12 13 14 15 16 17 18
 *
 * 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
19
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 21 22 23 24 25 26 27 28 29 30
 */

#include "wine/debug.h"
#include "shdocvw.h"

WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);

/**********************************************************************
 * Implement the IPersistStorage interface
 */

31
#define PERSTORAGE_THIS(ifce) DEFINE_THIS(WebBrowser, PersistStorage, iface)
32

33 34 35 36 37
static HRESULT WINAPI PersistStorage_QueryInterface(IPersistStorage *iface,
        REFIID riid, LPVOID *ppobj)
{
    WebBrowser *This = PERSTORAGE_THIS(iface);
    return IWebBrowser_QueryInterface(WEBBROWSER(This), riid, ppobj);
38 39
}

40
static ULONG WINAPI PersistStorage_AddRef(IPersistStorage *iface)
41
{
42 43
    WebBrowser *This = PERSTORAGE_THIS(iface);
    return IWebBrowser_AddRef(WEBBROWSER(This));
44 45
}

46
static ULONG WINAPI PersistStorage_Release(IPersistStorage *iface)
47
{
48 49
    WebBrowser *This = PERSTORAGE_THIS(iface);
    return IWebBrowser_Release(WEBBROWSER(This));
50 51
}

52
static HRESULT WINAPI PersistStorage_GetClassID(IPersistStorage *iface, CLSID *pClassID)
53
{
54 55 56
    WebBrowser *This = PERSTORAGE_THIS(iface);
    FIXME("(%p)->(%p)\n", This, pClassID);
    return E_NOTIMPL;
57 58
}

59
static HRESULT WINAPI PersistStorage_IsDirty(IPersistStorage *iface)
60
{
61 62 63
    WebBrowser *This = PERSTORAGE_THIS(iface);
    FIXME("(%p)\n", This);
    return E_NOTIMPL;
64 65
}

66
static HRESULT WINAPI PersistStorage_InitNew(IPersistStorage *iface, LPSTORAGE pStg)
67
{
68 69 70
    WebBrowser *This = PERSTORAGE_THIS(iface);
    FIXME("(%p)->(%p)\n", This, pStg);
    return E_NOTIMPL;
71 72
}

73
static HRESULT WINAPI PersistStorage_Load(IPersistStorage *iface, LPSTORAGE pStg)
74
{
75 76 77
    WebBrowser *This = PERSTORAGE_THIS(iface);
    FIXME("(%p)->(%p)\n", This, pStg);
    return E_NOTIMPL;
78 79
}

80 81
static HRESULT WINAPI PersistStorage_Save(IPersistStorage *iface, LPSTORAGE pStg,
        BOOL fSameAsLoad)
82
{
83 84 85
    WebBrowser *This = PERSTORAGE_THIS(iface);
    FIXME("(%p)->(%p %x)\n", This, pStg, fSameAsLoad);
    return E_NOTIMPL;
86 87
}

88
static HRESULT WINAPI PersistStorage_SaveCompleted(IPersistStorage *iface, LPSTORAGE pStgNew)
89
{
90 91 92
    WebBrowser *This = PERSTORAGE_THIS(iface);
    FIXME("(%p)->(%p)\n", This, pStgNew);
    return E_NOTIMPL;
93 94
}

95
#define PERSTORAGE_THIS(ifce) DEFINE_THIS(WebBrowser, PersistStorage, iface)
96

97 98 99 100 101 102 103 104 105 106 107
static const IPersistStorageVtbl PersistStorageVtbl =
{
    PersistStorage_QueryInterface,
    PersistStorage_AddRef,
    PersistStorage_Release,
    PersistStorage_GetClassID,
    PersistStorage_IsDirty,
    PersistStorage_InitNew,
    PersistStorage_Load,
    PersistStorage_Save,
    PersistStorage_SaveCompleted
108 109 110 111 112 113
};

/**********************************************************************
 * Implement the IPersistStreamInit interface
 */

114
#define PERSTRINIT_THIS(iface) DEFINE_THIS(WebBrowser, PersistStreamInit, iface)
115

116 117 118 119 120
static HRESULT WINAPI PersistStreamInit_QueryInterface(IPersistStreamInit *iface,
        REFIID riid, LPVOID *ppobj)
{
    WebBrowser *This = PERSTRINIT_THIS(iface);
    return IWebBrowser_QueryInterface(WEBBROWSER(This), riid, ppobj);
121 122
}

123
static ULONG WINAPI PersistStreamInit_AddRef(IPersistStreamInit *iface)
124
{
125 126
    WebBrowser *This = PERSTRINIT_THIS(iface);
    return IWebBrowser_AddRef(WEBBROWSER(This));
127 128
}

129
static ULONG WINAPI PersistStreamInit_Release(IPersistStreamInit *iface)
130
{
131 132
    WebBrowser *This = PERSTRINIT_THIS(iface);
    return IWebBrowser_Release(WEBBROWSER(This));
133 134
}

135
static HRESULT WINAPI PersistStreamInit_GetClassID(IPersistStreamInit *iface, CLSID *pClassID)
136
{
137 138
    WebBrowser *This = PERSTRINIT_THIS(iface);
    return IPersistStorage_GetClassID(PERSTORAGE(This), pClassID);
139 140
}

141
static HRESULT WINAPI PersistStreamInit_IsDirty(IPersistStreamInit *iface)
142
{
143 144
    WebBrowser *This = PERSTRINIT_THIS(iface);
    return IPersistStorage_IsDirty(PERSTORAGE(This));
145 146
}

147
static HRESULT WINAPI PersistStreamInit_Load(IPersistStreamInit *iface, LPSTREAM pStg)
148
{
149 150
    WebBrowser *This = PERSTRINIT_THIS(iface);
    FIXME("(%p)->(%p)\n", This, pStg);
151
    return S_OK;
152 153
}

154 155
static HRESULT WINAPI PersistStreamInit_Save(IPersistStreamInit *iface, LPSTREAM pStg,
        BOOL fSameAsLoad)
156
{
157 158 159
    WebBrowser *This = PERSTRINIT_THIS(iface);
    FIXME("(%p)->(%p %x)\n", This, pStg, fSameAsLoad);
    return E_NOTIMPL;
160 161
}

162 163
static HRESULT WINAPI PersistStreamInit_GetSizeMax(IPersistStreamInit *iface,
        ULARGE_INTEGER *pcbSize)
164
{
165 166 167
    WebBrowser *This = PERSTRINIT_THIS(iface);
    FIXME("(%p)->(%p)\n", This, pcbSize);
    return E_NOTIMPL;
168 169
}

170
static HRESULT WINAPI PersistStreamInit_InitNew(IPersistStreamInit *iface)
171
{
172 173
    WebBrowser *This = PERSTRINIT_THIS(iface);
    FIXME("(%p)\n", This);
174
    return S_OK;
175 176
}

177
#undef PERSTRINIT_THIS
178

179 180 181 182 183 184 185 186 187 188 189
static const IPersistStreamInitVtbl PersistStreamInitVtbl =
{
    PersistStreamInit_QueryInterface,
    PersistStreamInit_AddRef,
    PersistStreamInit_Release,
    PersistStreamInit_GetClassID,
    PersistStreamInit_IsDirty,
    PersistStreamInit_Load,
    PersistStreamInit_Save,
    PersistStreamInit_GetSizeMax,
    PersistStreamInit_InitNew
190 191
};

192 193 194 195 196
void WebBrowser_Persist_Init(WebBrowser *This)
{
    This->lpPersistStorageVtbl    = &PersistStorageVtbl;
    This->lpPersistStreamInitVtbl = &PersistStreamInitVtbl;
}