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