- Added more tests.
[wine] / dlls / mshtml / persist.c
1 /*
2  * Copyright 2005 Jacek Caban
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 #include "config.h"
20
21 #include <stdarg.h>
22 #include <stdio.h>
23
24 #define COBJMACROS
25
26 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "ole2.h"
30 #include "docobj.h"
31
32 #include "mshtml.h"
33 #include "mshtmhst.h"
34
35 #include "wine/debug.h"
36
37 #include "mshtml_private.h"
38
39 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
40
41 /**********************************************************
42  * IPersistMoniker implementation
43  */
44
45 #define PERSISTMON_THIS \
46     HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpPersistMonikerVtbl));
47
48 static HRESULT WINAPI PersistMoniker_QueryInterface(IPersistMoniker *iface, REFIID riid,
49                                                             void **ppvObject)
50 {
51     PERSISTMON_THIS
52     return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
53 }
54
55 static ULONG WINAPI PersistMoniker_AddRef(IPersistMoniker *iface)
56 {
57     PERSISTMON_THIS
58     return IHTMLDocument2_AddRef(HTMLDOC(This));
59 }
60
61 static ULONG WINAPI PersistMoniker_Release(IPersistMoniker *iface)
62 {
63     PERSISTMON_THIS
64     return IHTMLDocument2_Release(HTMLDOC(This));
65 }
66
67 static HRESULT WINAPI PersistMoniker_GetClassID(IPersistMoniker *iface, CLSID *pClassID)
68 {
69     PERSISTMON_THIS
70     return IPersist_GetClassID(PERSIST(This), pClassID);
71 }
72
73 static HRESULT WINAPI PersistMoniker_IsDirty(IPersistMoniker *iface)
74 {
75     FIXME("(%p)\n", iface);
76     return E_NOTIMPL;
77 }
78
79 static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAvailable,
80         IMoniker *pimkName, LPBC pibc, DWORD grfMode)
81 {
82     FIXME("(%p)->(%x %p %p %08lx)\n", iface, fFullyAvailable, pimkName, pibc, grfMode);
83     return S_OK;
84 }
85
86 static HRESULT WINAPI PersistMoniker_Save(IPersistMoniker *iface, IMoniker *pimkName,
87         LPBC pbc, BOOL fRemember)
88 {
89     FIXME("(%p)->(%p %p %x)\n", iface, pimkName, pbc, fRemember);
90     return E_NOTIMPL;
91 }
92
93 static HRESULT WINAPI PersistMoniker_SaveCompleted(IPersistMoniker *iface, IMoniker *pimkName, LPBC pibc)
94 {
95     FIXME("(%p)->(%p %p)\n", iface, pimkName, pibc);
96     return E_NOTIMPL;
97 }
98
99 static HRESULT WINAPI PersistMoniker_GetCurMoniker(IPersistMoniker *iface, IMoniker **ppimkName)
100 {
101     FIXME("(%p)->(%p)\n", iface, ppimkName);
102     return E_NOTIMPL;
103 }
104
105 static const IPersistMonikerVtbl PersistMonikerVtbl = {
106     PersistMoniker_QueryInterface,
107     PersistMoniker_AddRef,
108     PersistMoniker_Release,
109     PersistMoniker_GetClassID,
110     PersistMoniker_IsDirty,
111     PersistMoniker_Load,
112     PersistMoniker_Save,
113     PersistMoniker_SaveCompleted,
114     PersistMoniker_GetCurMoniker
115 };
116
117 /**********************************************************
118  * IMonikerProp implementation
119  */
120
121 #define MONPROP_THIS \
122     HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpMonikerPropVtbl));
123
124 static HRESULT WINAPI MonikerProp_QueryInterface(IMonikerProp *iface, REFIID riid, void **ppvObject)
125 {
126     MONPROP_THIS
127     return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
128 }
129
130 static ULONG WINAPI MonikerProp_AddRef(IMonikerProp *iface)
131 {
132     MONPROP_THIS
133     return IHTMLDocument2_AddRef(HTMLDOC(This));
134 }
135
136 static ULONG WINAPI MonikerProp_Release(IMonikerProp *iface)
137 {
138     MONPROP_THIS
139     return IHTMLDocument_Release(HTMLDOC(This));
140 }
141
142 static HRESULT WINAPI MonikerProp_PutProperty(IMonikerProp *iface, MONIKERPROPERTY mkp, LPCWSTR val)
143 {
144     FIXME("(%p)->(%d %s)\n", iface, mkp, debugstr_w(val));
145     return E_NOTIMPL;
146 }
147
148 static const IMonikerPropVtbl MonikerPropVtbl = {
149     MonikerProp_QueryInterface,
150     MonikerProp_AddRef,
151     MonikerProp_Release,
152     MonikerProp_PutProperty
153 };
154
155 /**********************************************************
156  * IPersistFile implementation
157  */
158
159 #define PERSISTFILE_THIS \
160         HTMLDocument* const This=(HTMLDocument*)((char*)(iface)-offsetof(HTMLDocument,lpPersistFileVtbl));
161
162 static HRESULT WINAPI PersistFile_QueryInterface(IPersistFile *iface, REFIID riid, void **ppvObject)
163 {
164     PERSISTFILE_THIS
165     return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppvObject);
166 }
167
168 static ULONG WINAPI PersistFile_AddRef(IPersistFile *iface)
169 {
170     PERSISTFILE_THIS
171     return IHTMLDocument2_AddRef(HTMLDOC(This));
172 }
173
174 static ULONG WINAPI PersistFile_Release(IPersistFile *iface)
175 {
176     PERSISTFILE_THIS
177     return IHTMLDocument2_Release(HTMLDOC(This));
178 }
179
180 static HRESULT WINAPI PersistFile_GetClassID(IPersistFile *iface, CLSID *pClassID)
181 {
182     TRACE("(%p)->(%p)\n", iface, pClassID);
183
184     if(!pClassID)
185         return E_INVALIDARG;
186
187     memcpy(pClassID, &CLSID_HTMLDocument, sizeof(CLSID));
188     return S_OK;
189 }
190
191 static HRESULT WINAPI PersistFile_IsDirty(IPersistFile *iface)
192 {
193     FIXME("(%p)\n", iface);
194     return E_NOTIMPL;
195 }
196
197 static HRESULT WINAPI PersistFile_Load(IPersistFile *iface, LPCOLESTR pszFileName, DWORD dwMode)
198 {
199     FIXME("(%p)->(%s %08lx)\n", iface, debugstr_w(pszFileName), dwMode);
200     return E_NOTIMPL;
201 }
202
203 static HRESULT WINAPI PersistFile_Save(IPersistFile *iface, LPCOLESTR pszFileName, BOOL fRemember)
204 {
205     FIXME("(%p)->(%s %x)\n", iface, debugstr_w(pszFileName), fRemember);
206     return E_NOTIMPL;
207 }
208
209 static HRESULT WINAPI PersistFile_SaveCompleted(IPersistFile *iface, LPCOLESTR pszFileName)
210 {
211     FIXME("(%p)->(%s)\n", iface, debugstr_w(pszFileName));
212     return E_NOTIMPL;
213 }
214
215 static HRESULT WINAPI PersistFile_GetCurFile(IPersistFile *iface, LPOLESTR *pszFileName)
216 {
217     FIXME("(%p)->(%p)\n", iface, pszFileName);
218     return E_NOTIMPL;
219 }
220
221 static const IPersistFileVtbl PersistFileVtbl = {
222     PersistFile_QueryInterface,
223     PersistFile_AddRef,
224     PersistFile_Release,
225     PersistFile_GetClassID,
226     PersistFile_IsDirty,
227     PersistFile_Load,
228     PersistFile_Save,
229     PersistFile_SaveCompleted,
230     PersistFile_GetCurFile
231 };
232
233 void HTMLDocument_Persist_Init(HTMLDocument *This)
234 {
235     This->lpPersistMonikerVtbl = &PersistMonikerVtbl;
236     This->lpPersistFileVtbl = &PersistFileVtbl;
237     This->lpMonikerPropVtbl = &MonikerPropVtbl;
238 }