2 * Implementation of IPersist interfaces for WebBrowser control
4 * Copyright 2001 John R. Sheets (for CodeWeavers)
5 * Copyright 2005 Jacek Caban
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * 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
22 #include "wine/debug.h"
25 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw
);
27 /**********************************************************************
28 * Implement the IPersistStorage interface
31 static inline WebBrowser
*impl_from_IPersistStorage(IPersistStorage
*iface
)
33 return CONTAINING_RECORD(iface
, WebBrowser
, IPersistStorage_iface
);
36 static HRESULT WINAPI
PersistStorage_QueryInterface(IPersistStorage
*iface
,
37 REFIID riid
, LPVOID
*ppobj
)
39 WebBrowser
*This
= impl_from_IPersistStorage(iface
);
40 return IWebBrowser_QueryInterface(&This
->IWebBrowser2_iface
, riid
, ppobj
);
43 static ULONG WINAPI
PersistStorage_AddRef(IPersistStorage
*iface
)
45 WebBrowser
*This
= impl_from_IPersistStorage(iface
);
46 return IWebBrowser_AddRef(&This
->IWebBrowser2_iface
);
49 static ULONG WINAPI
PersistStorage_Release(IPersistStorage
*iface
)
51 WebBrowser
*This
= impl_from_IPersistStorage(iface
);
52 return IWebBrowser_Release(&This
->IWebBrowser2_iface
);
55 static HRESULT WINAPI
PersistStorage_GetClassID(IPersistStorage
*iface
, CLSID
*pClassID
)
57 WebBrowser
*This
= impl_from_IPersistStorage(iface
);
58 FIXME("(%p)->(%p)\n", This
, pClassID
);
62 static HRESULT WINAPI
PersistStorage_IsDirty(IPersistStorage
*iface
)
64 WebBrowser
*This
= impl_from_IPersistStorage(iface
);
65 FIXME("(%p)\n", This
);
69 static HRESULT WINAPI
PersistStorage_InitNew(IPersistStorage
*iface
, LPSTORAGE pStg
)
71 WebBrowser
*This
= impl_from_IPersistStorage(iface
);
72 FIXME("(%p)->(%p)\n", This
, pStg
);
76 static HRESULT WINAPI
PersistStorage_Load(IPersistStorage
*iface
, LPSTORAGE pStg
)
78 WebBrowser
*This
= impl_from_IPersistStorage(iface
);
79 FIXME("(%p)->(%p)\n", This
, pStg
);
83 static HRESULT WINAPI
PersistStorage_Save(IPersistStorage
*iface
, LPSTORAGE pStg
,
86 WebBrowser
*This
= impl_from_IPersistStorage(iface
);
87 FIXME("(%p)->(%p %x)\n", This
, pStg
, fSameAsLoad
);
91 static HRESULT WINAPI
PersistStorage_SaveCompleted(IPersistStorage
*iface
, LPSTORAGE pStgNew
)
93 WebBrowser
*This
= impl_from_IPersistStorage(iface
);
94 FIXME("(%p)->(%p)\n", This
, pStgNew
);
98 static const IPersistStorageVtbl PersistStorageVtbl
=
100 PersistStorage_QueryInterface
,
101 PersistStorage_AddRef
,
102 PersistStorage_Release
,
103 PersistStorage_GetClassID
,
104 PersistStorage_IsDirty
,
105 PersistStorage_InitNew
,
108 PersistStorage_SaveCompleted
111 /**********************************************************************
112 * Implement the IPersistMemory interface
115 static inline WebBrowser
*impl_from_IPersistMemory(IPersistMemory
*iface
)
117 return CONTAINING_RECORD(iface
, WebBrowser
, IPersistMemory_iface
);
120 static HRESULT WINAPI
PersistMemory_QueryInterface(IPersistMemory
*iface
,
121 REFIID riid
, LPVOID
*ppobj
)
123 WebBrowser
*This
= impl_from_IPersistMemory(iface
);
124 return IWebBrowser_QueryInterface(&This
->IWebBrowser2_iface
, riid
, ppobj
);
127 static ULONG WINAPI
PersistMemory_AddRef(IPersistMemory
*iface
)
129 WebBrowser
*This
= impl_from_IPersistMemory(iface
);
130 return IWebBrowser_AddRef(&This
->IWebBrowser2_iface
);
133 static ULONG WINAPI
PersistMemory_Release(IPersistMemory
*iface
)
135 WebBrowser
*This
= impl_from_IPersistMemory(iface
);
136 return IWebBrowser_Release(&This
->IWebBrowser2_iface
);
139 static HRESULT WINAPI
PersistMemory_GetClassID(IPersistMemory
*iface
, CLSID
*pClassID
)
141 WebBrowser
*This
= impl_from_IPersistMemory(iface
);
142 FIXME("(%p)->(%p)\n", This
, pClassID
);
146 static HRESULT WINAPI
PersistMemory_IsDirty(IPersistMemory
*iface
)
148 WebBrowser
*This
= impl_from_IPersistMemory(iface
);
149 FIXME("(%p)\n", This
);
153 static HRESULT WINAPI
PersistMemory_InitNew(IPersistMemory
*iface
)
155 WebBrowser
*This
= impl_from_IPersistMemory(iface
);
156 FIXME("(%p)\n", This
);
160 static HRESULT WINAPI
PersistMemory_Load(IPersistMemory
*iface
, LPVOID pMem
, ULONG cbSize
)
162 WebBrowser
*This
= impl_from_IPersistMemory(iface
);
163 FIXME("(%p)->(%p %x)\n", This
, pMem
, cbSize
);
167 static HRESULT WINAPI
PersistMemory_Save(IPersistMemory
*iface
, LPVOID pMem
,
168 BOOL fClearDirty
, ULONG cbSize
)
170 WebBrowser
*This
= impl_from_IPersistMemory(iface
);
171 FIXME("(%p)->(%p %x %x)\n", This
, pMem
, fClearDirty
, cbSize
);
175 static HRESULT WINAPI
PersistMemory_GetSizeMax(IPersistMemory
*iface
, ULONG
*pCbSize
)
177 WebBrowser
*This
= impl_from_IPersistMemory(iface
);
178 FIXME("(%p)->(%p)\n", This
, pCbSize
);
182 static const IPersistMemoryVtbl PersistMemoryVtbl
=
184 PersistMemory_QueryInterface
,
185 PersistMemory_AddRef
,
186 PersistMemory_Release
,
187 PersistMemory_GetClassID
,
188 PersistMemory_IsDirty
,
191 PersistMemory_GetSizeMax
,
192 PersistMemory_InitNew
195 /**********************************************************************
196 * Implement the IPersistStreamInit interface
199 static inline WebBrowser
*impl_from_IPersistStreamInit(IPersistStreamInit
*iface
)
201 return CONTAINING_RECORD(iface
, WebBrowser
, IPersistStreamInit_iface
);
204 static HRESULT WINAPI
PersistStreamInit_QueryInterface(IPersistStreamInit
*iface
,
205 REFIID riid
, LPVOID
*ppobj
)
207 WebBrowser
*This
= impl_from_IPersistStreamInit(iface
);
208 return IWebBrowser_QueryInterface(&This
->IWebBrowser2_iface
, riid
, ppobj
);
211 static ULONG WINAPI
PersistStreamInit_AddRef(IPersistStreamInit
*iface
)
213 WebBrowser
*This
= impl_from_IPersistStreamInit(iface
);
214 return IWebBrowser_AddRef(&This
->IWebBrowser2_iface
);
217 static ULONG WINAPI
PersistStreamInit_Release(IPersistStreamInit
*iface
)
219 WebBrowser
*This
= impl_from_IPersistStreamInit(iface
);
220 return IWebBrowser_Release(&This
->IWebBrowser2_iface
);
223 static HRESULT WINAPI
PersistStreamInit_GetClassID(IPersistStreamInit
*iface
, CLSID
*pClassID
)
225 WebBrowser
*This
= impl_from_IPersistStreamInit(iface
);
226 return IPersistStorage_GetClassID(&This
->IPersistStorage_iface
, pClassID
);
229 static HRESULT WINAPI
PersistStreamInit_IsDirty(IPersistStreamInit
*iface
)
231 WebBrowser
*This
= impl_from_IPersistStreamInit(iface
);
232 return IPersistStorage_IsDirty(&This
->IPersistStorage_iface
);
235 static HRESULT WINAPI
PersistStreamInit_Load(IPersistStreamInit
*iface
, LPSTREAM pStg
)
237 WebBrowser
*This
= impl_from_IPersistStreamInit(iface
);
238 FIXME("(%p)->(%p)\n", This
, pStg
);
242 static HRESULT WINAPI
PersistStreamInit_Save(IPersistStreamInit
*iface
, LPSTREAM pStg
,
245 WebBrowser
*This
= impl_from_IPersistStreamInit(iface
);
246 FIXME("(%p)->(%p %x)\n", This
, pStg
, fSameAsLoad
);
250 static HRESULT WINAPI
PersistStreamInit_GetSizeMax(IPersistStreamInit
*iface
,
251 ULARGE_INTEGER
*pcbSize
)
253 WebBrowser
*This
= impl_from_IPersistStreamInit(iface
);
254 FIXME("(%p)->(%p)\n", This
, pcbSize
);
258 static HRESULT WINAPI
PersistStreamInit_InitNew(IPersistStreamInit
*iface
)
260 WebBrowser
*This
= impl_from_IPersistStreamInit(iface
);
261 FIXME("(%p)\n", This
);
265 static const IPersistStreamInitVtbl PersistStreamInitVtbl
=
267 PersistStreamInit_QueryInterface
,
268 PersistStreamInit_AddRef
,
269 PersistStreamInit_Release
,
270 PersistStreamInit_GetClassID
,
271 PersistStreamInit_IsDirty
,
272 PersistStreamInit_Load
,
273 PersistStreamInit_Save
,
274 PersistStreamInit_GetSizeMax
,
275 PersistStreamInit_InitNew
278 void WebBrowser_Persist_Init(WebBrowser
*This
)
280 This
->IPersistStorage_iface
.lpVtbl
= &PersistStorageVtbl
;
281 This
->IPersistMemory_iface
.lpVtbl
= &PersistMemoryVtbl
;
282 This
->IPersistStreamInit_iface
.lpVtbl
= &PersistStreamInitVtbl
;