0b091ee826c7dfd4b3ce66203a99137d32d51d52
[reactos.git] / reactos / lib / shdocvw / persist.c
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 * 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.
11 *
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.
16 *
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22 #define COBJMACROS
23 #include "wine/debug.h"
24 #include "shdocvw.h"
25
26 WINE_DEFAULT_DEBUG_CHANNEL(shdocvw);
27
28 /**********************************************************************
29 * Implement the IPersistStorage interface
30 */
31
32 #define PERSTORAGE_THIS(ifce) DEFINE_THIS(WebBrowser, PersistStorage, iface)
33
34 static HRESULT WINAPI PersistStorage_QueryInterface(IPersistStorage *iface,
35 REFIID riid, LPVOID *ppobj)
36 {
37 WebBrowser *This = PERSTORAGE_THIS(iface);
38 return IWebBrowser_QueryInterface(WEBBROWSER(This), riid, ppobj);
39 }
40
41 static ULONG WINAPI PersistStorage_AddRef(IPersistStorage *iface)
42 {
43 WebBrowser *This = PERSTORAGE_THIS(iface);
44 return IWebBrowser_AddRef(WEBBROWSER(This));
45 }
46
47 static ULONG WINAPI PersistStorage_Release(IPersistStorage *iface)
48 {
49 WebBrowser *This = PERSTORAGE_THIS(iface);
50 return IWebBrowser_Release(WEBBROWSER(This));
51 }
52
53 static HRESULT WINAPI PersistStorage_GetClassID(IPersistStorage *iface, CLSID *pClassID)
54 {
55 WebBrowser *This = PERSTORAGE_THIS(iface);
56 FIXME("(%p)->(%p)\n", This, pClassID);
57 return E_NOTIMPL;
58 }
59
60 static HRESULT WINAPI PersistStorage_IsDirty(IPersistStorage *iface)
61 {
62 WebBrowser *This = PERSTORAGE_THIS(iface);
63 FIXME("(%p)\n", This);
64 return E_NOTIMPL;
65 }
66
67 static HRESULT WINAPI PersistStorage_InitNew(IPersistStorage *iface, LPSTORAGE pStg)
68 {
69 WebBrowser *This = PERSTORAGE_THIS(iface);
70 FIXME("(%p)->(%p)\n", This, pStg);
71 return E_NOTIMPL;
72 }
73
74 static HRESULT WINAPI PersistStorage_Load(IPersistStorage *iface, LPSTORAGE pStg)
75 {
76 WebBrowser *This = PERSTORAGE_THIS(iface);
77 FIXME("(%p)->(%p)\n", This, pStg);
78 return E_NOTIMPL;
79 }
80
81 static HRESULT WINAPI PersistStorage_Save(IPersistStorage *iface, LPSTORAGE pStg,
82 BOOL fSameAsLoad)
83 {
84 WebBrowser *This = PERSTORAGE_THIS(iface);
85 FIXME("(%p)->(%p %x)\n", This, pStg, fSameAsLoad);
86 return E_NOTIMPL;
87 }
88
89 static HRESULT WINAPI PersistStorage_SaveCompleted(IPersistStorage *iface, LPSTORAGE pStgNew)
90 {
91 WebBrowser *This = PERSTORAGE_THIS(iface);
92 FIXME("(%p)->(%p)\n", This, pStgNew);
93 return E_NOTIMPL;
94 }
95
96 #define PERSTORAGE_THIS(ifce) DEFINE_THIS(WebBrowser, PersistStorage, iface)
97
98 static const IPersistStorageVtbl PersistStorageVtbl =
99 {
100 PersistStorage_QueryInterface,
101 PersistStorage_AddRef,
102 PersistStorage_Release,
103 PersistStorage_GetClassID,
104 PersistStorage_IsDirty,
105 PersistStorage_InitNew,
106 PersistStorage_Load,
107 PersistStorage_Save,
108 PersistStorage_SaveCompleted
109 };
110
111 /**********************************************************************
112 * Implement the IPersistStreamInit interface
113 */
114
115 #define PERSTRINIT_THIS(iface) DEFINE_THIS(WebBrowser, PersistStreamInit, iface)
116
117 static HRESULT WINAPI PersistStreamInit_QueryInterface(IPersistStreamInit *iface,
118 REFIID riid, LPVOID *ppobj)
119 {
120 WebBrowser *This = PERSTRINIT_THIS(iface);
121 return IWebBrowser_QueryInterface(WEBBROWSER(This), riid, ppobj);
122 }
123
124 static ULONG WINAPI PersistStreamInit_AddRef(IPersistStreamInit *iface)
125 {
126 WebBrowser *This = PERSTRINIT_THIS(iface);
127 return IWebBrowser_AddRef(WEBBROWSER(This));
128 }
129
130 static ULONG WINAPI PersistStreamInit_Release(IPersistStreamInit *iface)
131 {
132 WebBrowser *This = PERSTRINIT_THIS(iface);
133 return IWebBrowser_Release(WEBBROWSER(This));
134 }
135
136 static HRESULT WINAPI PersistStreamInit_GetClassID(IPersistStreamInit *iface, CLSID *pClassID)
137 {
138 WebBrowser *This = PERSTRINIT_THIS(iface);
139 return IPersistStorage_GetClassID(PERSTORAGE(This), pClassID);
140 }
141
142 static HRESULT WINAPI PersistStreamInit_IsDirty(IPersistStreamInit *iface)
143 {
144 WebBrowser *This = PERSTRINIT_THIS(iface);
145 return IPersistStorage_IsDirty(PERSTORAGE(This));
146 }
147
148 static HRESULT WINAPI PersistStreamInit_Load(IPersistStreamInit *iface, LPSTREAM pStg)
149 {
150 WebBrowser *This = PERSTRINIT_THIS(iface);
151 FIXME("(%p)->(%p)\n", This, pStg);
152 return E_NOTIMPL;
153 }
154
155 static HRESULT WINAPI PersistStreamInit_Save(IPersistStreamInit *iface, LPSTREAM pStg,
156 BOOL fSameAsLoad)
157 {
158 WebBrowser *This = PERSTRINIT_THIS(iface);
159 FIXME("(%p)->(%p %x)\n", This, pStg, fSameAsLoad);
160 return E_NOTIMPL;
161 }
162
163 static HRESULT WINAPI PersistStreamInit_GetSizeMax(IPersistStreamInit *iface,
164 ULARGE_INTEGER *pcbSize)
165 {
166 WebBrowser *This = PERSTRINIT_THIS(iface);
167 FIXME("(%p)->(%p)\n", This, pcbSize);
168 return E_NOTIMPL;
169 }
170
171 static HRESULT WINAPI PersistStreamInit_InitNew(IPersistStreamInit *iface)
172 {
173 WebBrowser *This = PERSTRINIT_THIS(iface);
174 FIXME("(%p)\n", This);
175 return E_NOTIMPL;
176 }
177
178 #undef PERSTRINIT_THIS
179
180 static const IPersistStreamInitVtbl PersistStreamInitVtbl =
181 {
182 PersistStreamInit_QueryInterface,
183 PersistStreamInit_AddRef,
184 PersistStreamInit_Release,
185 PersistStreamInit_GetClassID,
186 PersistStreamInit_IsDirty,
187 PersistStreamInit_Load,
188 PersistStreamInit_Save,
189 PersistStreamInit_GetSizeMax,
190 PersistStreamInit_InitNew
191 };
192
193 void WebBrowser_Persist_Init(WebBrowser *This)
194 {
195 This->lpPersistStorageVtbl = &PersistStorageVtbl;
196 This->lpPersistStreamInitVtbl = &PersistStreamInitVtbl;
197 }