ReactOS 0.4.15-dev-7907-g95bf896
service.c
Go to the documentation of this file.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19#include "mshtml_private.h"
20
21typedef struct {
23
26
28{
29 return CONTAINING_RECORD(iface, UndoManager, IOleUndoManager_iface);
30}
31
33{
35
37 TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
38 *ppv = &This->IOleUndoManager_iface;
39 }else if(IsEqualGUID(riid, &IID_IOleUndoManager)) {
40 TRACE("(%p)->(IID_IOleUndoManager %p)\n", This, ppv);
41 *ppv = &This->IOleUndoManager_iface;
42 }else {
43 *ppv = NULL;
44 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
45 return E_NOINTERFACE;
46 }
47
48 IUnknown_AddRef((IUnknown*)*ppv);
49 return S_OK;
50}
51
53{
56
57 TRACE("(%p) ref=%d\n", This, ref);
58
59 return ref;
60}
61
63{
66
67 TRACE("(%p) ref=%d\n", This, ref);
68
69 if(!ref)
71
72 return ref;
73}
74
76{
78 FIXME("(%p)->(%p)\n", This, pPUU);
79 return E_NOTIMPL;
80}
81
83 BOOL fCommit)
84{
86 FIXME("(%p)->(%p %x)\n", This, pPUU, fCommit);
87 return E_NOTIMPL;
88}
89
91{
93 FIXME("(%p)->(%p)\n", This, pUU);
94 return E_NOTIMPL;
95}
96
98{
100 FIXME("(%p)->(%p)\n", This, pdwState);
101 return E_NOTIMPL;
102}
103
105{
107 FIXME("(%p)->(%p)\n", This, pUU);
108 return S_OK;
109}
110
112{
114 FIXME("(%p)->(%p)\n", This, pUU);
115 return E_NOTIMPL;
116}
117
119{
121 FIXME("(%p)->(%p)\n", This, pUU);
122 return E_NOTIMPL;
123}
124
126 IEnumOleUndoUnits **ppEnum)
127{
129 FIXME("(%p)->(%p)\n", This, ppEnum);
130 return E_NOTIMPL;
131}
132
134 IEnumOleUndoUnits **ppEnum)
135{
137 FIXME("(%p)->(%p)\n", This, ppEnum);
138 return E_NOTIMPL;
139}
140
142{
144 FIXME("(%p)->(%p)\n", This, pBstr);
145 return E_NOTIMPL;
146}
147
149{
151 FIXME("(%p)->(%p)\n", This, pBstr);
152 return E_NOTIMPL;
153}
154
156{
158 FIXME("(%p)->(%x)\n", This, fEnable);
159 return E_NOTIMPL;
160}
161
162static const IOleUndoManagerVtbl OleUndoManagerVtbl = {
178};
179
181{
183
184 if (!ret) return NULL;
185
186 ret->IOleUndoManager_iface.lpVtbl = &OleUndoManagerVtbl;
187 ret->ref = 1;
188
189 return &ret->IOleUndoManager_iface;
190}
191
192typedef struct {
193 IHTMLEditServices IHTMLEditServices_iface;
195} editsvcs;
196
197static inline editsvcs *impl_from_IHTMLEditServices(IHTMLEditServices *iface)
198{
199 return CONTAINING_RECORD(iface, editsvcs, IHTMLEditServices_iface);
200}
201
202static HRESULT WINAPI editsvcs_QueryInterface(IHTMLEditServices *iface, REFIID riid, void **ppv)
203{
205
206 TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
207
209 *ppv = &This->IHTMLEditServices_iface;
210 } else if(IsEqualGUID(riid, &IID_IHTMLEditServices)) {
211 *ppv = &This->IHTMLEditServices_iface;
212 } else {
213 *ppv = NULL;
214 FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
215 return E_NOINTERFACE;
216 }
217
218 IUnknown_AddRef((IUnknown*)*ppv);
219 return S_OK;
220}
221
222static ULONG WINAPI editsvcs_AddRef(IHTMLEditServices *iface)
223{
226
227 TRACE("(%p) ref=%d\n", This, ref);
228 return ref;
229}
230
231static ULONG WINAPI editsvcs_Release(IHTMLEditServices *iface)
232{
235
236 TRACE("(%p) ref=%d\n", This, ref);
237
238 if(!ref)
240
241 return ref;
242}
243
244static HRESULT WINAPI editsvcs_AddDesigner(IHTMLEditServices *iface,
245 IHTMLEditDesigner *pIDesigner)
246{
248 FIXME("(%p)->(%p)\n", This, pIDesigner);
249 return E_NOTIMPL;
250}
251
252static HRESULT WINAPI editsvcs_RemoveDesigner(IHTMLEditServices *iface,
253 IHTMLEditDesigner *pIDesigner)
254{
256 FIXME("(%p)->(%p)\n", This, pIDesigner);
257 return E_NOTIMPL;
258}
259
260static HRESULT WINAPI editsvcs_GetSelectionServices(IHTMLEditServices *iface,
261 IMarkupContainer *pIContainer, ISelectionServices **ppSelSvc)
262{
264 FIXME("(%p)->(%p,%p)\n", This, pIContainer, ppSelSvc);
265 return E_NOTIMPL;
266}
267
268static HRESULT WINAPI editsvcs_MoveToSelectionAnchor(IHTMLEditServices *iface,
269 IMarkupPointer *pIStartAnchor)
270{
272 FIXME("(%p)->(%p)\n", This, pIStartAnchor);
273 return E_NOTIMPL;
274}
275
276static HRESULT WINAPI editsvcs_MoveToSelectionEnd(IHTMLEditServices *iface,
277 IMarkupPointer *pIEndAnchor)
278{
280 FIXME("(%p)->(%p)\n", This, pIEndAnchor);
281 return E_NOTIMPL;
282}
283
284static HRESULT WINAPI editsvcs_SelectRange(IHTMLEditServices *iface,
285 IMarkupPointer *pStart, IMarkupPointer *pEnd, SELECTION_TYPE eType)
286{
288 FIXME("(%p)->(%p,%p,%#x)\n", This, pStart, pEnd, eType);
289 return E_NOTIMPL;
290}
291
292static const IHTMLEditServicesVtbl editsvcsVtbl = {
302};
303
304static IHTMLEditServices *create_editsvcs(void)
305{
306 editsvcs *ret = heap_alloc(sizeof(*ret));
307
308 if (ret) {
309 ret->IHTMLEditServices_iface.lpVtbl = &editsvcsVtbl;
310 ret->ref = 1;
311 return &ret->IHTMLEditServices_iface;
312 }
313
314 return NULL;
315}
316
317/**********************************************************
318 * IServiceProvider implementation
319 */
320
322{
323 return CONTAINING_RECORD(iface, HTMLDocument, IServiceProvider_iface);
324}
325
327{
330}
331
333{
335 return htmldoc_addref(This);
336}
337
339{
341 return htmldoc_release(This);
342}
343
345 REFIID riid, void **ppv)
346{
348
349 if(IsEqualGUID(&CLSID_CMarkup, guidService)) {
350 FIXME("(%p)->(CLSID_CMarkup %s %p)\n", This, debugstr_guid(riid), ppv);
351 return E_NOINTERFACE;
352 }
353
354 if(IsEqualGUID(&SID_SOleUndoManager, guidService)) {
355 TRACE("SID_SOleUndoManager\n");
356
357 if(!This->doc_obj->undomgr)
358 This->doc_obj->undomgr = create_undomgr();
359
360 if (!This->doc_obj->undomgr)
361 return E_OUTOFMEMORY;
362
363 return IOleUndoManager_QueryInterface(This->doc_obj->undomgr, riid, ppv);
364 }
365
366 if(IsEqualGUID(&SID_SContainerDispatch, guidService)) {
367 TRACE("SID_SContainerDispatch\n");
368 return IHTMLDocument2_QueryInterface(&This->IHTMLDocument2_iface, riid, ppv);
369 }
370
371 if(IsEqualGUID(&IID_IWindowForBindingUI, guidService)) {
372 TRACE("IID_IWindowForBindingUI\n");
373 return IWindowForBindingUI_QueryInterface(&This->doc_obj->IWindowForBindingUI_iface, riid, ppv);
374 }
375
376 if(IsEqualGUID(&SID_SHTMLEditServices, guidService)) {
377 TRACE("SID_SHTMLEditServices\n");
378
379 if(!This->doc_obj->editsvcs)
380 This->doc_obj->editsvcs = create_editsvcs();
381
382 if (!This->doc_obj->editsvcs)
383 return E_OUTOFMEMORY;
384
385 return IHTMLEditServices_QueryInterface(This->doc_obj->editsvcs, riid, ppv);
386 }
387
388 TRACE("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
389
390 if(This->doc_obj->client) {
392
393 hres = do_query_service((IUnknown*)This->doc_obj->client, guidService, riid, ppv);
394 if(SUCCEEDED(hres))
395 return hres;
396 }
397
398 FIXME("unknown service %s\n", debugstr_guid(guidService));
399 return E_NOINTERFACE;
400}
401
402static const IServiceProviderVtbl ServiceProviderVtbl = {
407};
408
410{
411 This->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl;
412}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
const GUID IID_IUnknown
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_NOTIMPL
Definition: ddrawi.h:99
#define NULL
Definition: types.h:112
OLECHAR * BSTR
Definition: compat.h:2293
HRESULT do_query_service(IUnknown *unk, REFGUID guid_service, REFIID riid, void **ppv)
Definition: main.c:148
const char * debugstr_mshtml_guid(const GUID *iid)
Definition: main.c:542
static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService, REFIID riid, void **ppv)
Definition: service.c:344
static ULONG WINAPI editsvcs_Release(IHTMLEditServices *iface)
Definition: service.c:231
static IOleUndoManager * create_undomgr(void)
Definition: service.c:180
static ULONG WINAPI OleUndoManager_AddRef(IOleUndoManager *iface)
Definition: service.c:52
static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
Definition: service.c:338
void HTMLDocument_Service_Init(HTMLDocument *This)
Definition: service.c:409
static editsvcs * impl_from_IHTMLEditServices(IHTMLEditServices *iface)
Definition: service.c:197
static HRESULT WINAPI OleUndoManager_Add(IOleUndoManager *iface, IOleUndoUnit *pUU)
Definition: service.c:90
static ULONG WINAPI editsvcs_AddRef(IHTMLEditServices *iface)
Definition: service.c:222
static HRESULT WINAPI OleUndoManager_RedoTo(IOleUndoManager *iface, IOleUndoUnit *pUU)
Definition: service.c:118
static HRESULT WINAPI editsvcs_RemoveDesigner(IHTMLEditServices *iface, IHTMLEditDesigner *pIDesigner)
Definition: service.c:252
static const IOleUndoManagerVtbl OleUndoManagerVtbl
Definition: service.c:162
static HRESULT WINAPI OleUndoManager_GetOpenParentState(IOleUndoManager *iface, DWORD *pdwState)
Definition: service.c:97
static HRESULT WINAPI OleUndoManager_DiscardFrom(IOleUndoManager *iface, IOleUndoUnit *pUU)
Definition: service.c:104
static HRESULT WINAPI OleUndoManager_Open(IOleUndoManager *iface, IOleParentUndoUnit *pPUU)
Definition: service.c:75
static HRESULT WINAPI OleUndoManager_UndoTo(IOleUndoManager *iface, IOleUndoUnit *pUU)
Definition: service.c:111
static HRESULT WINAPI OleUndoManager_EnumRedoable(IOleUndoManager *iface, IEnumOleUndoUnits **ppEnum)
Definition: service.c:133
static HRESULT WINAPI OleUndoManager_QueryInterface(IOleUndoManager *iface, REFIID riid, void **ppv)
Definition: service.c:32
static HRESULT WINAPI editsvcs_GetSelectionServices(IHTMLEditServices *iface, IMarkupContainer *pIContainer, ISelectionServices **ppSelSvc)
Definition: service.c:260
static HTMLDocument * impl_from_IServiceProvider(IServiceProvider *iface)
Definition: service.c:321
static HRESULT WINAPI OleUndoManager_Close(IOleUndoManager *iface, IOleParentUndoUnit *pPUU, BOOL fCommit)
Definition: service.c:82
static HRESULT WINAPI editsvcs_SelectRange(IHTMLEditServices *iface, IMarkupPointer *pStart, IMarkupPointer *pEnd, SELECTION_TYPE eType)
Definition: service.c:284
static UndoManager * impl_from_IOleUndoManager(IOleUndoManager *iface)
Definition: service.c:27
static HRESULT WINAPI editsvcs_MoveToSelectionEnd(IHTMLEditServices *iface, IMarkupPointer *pIEndAnchor)
Definition: service.c:276
static HRESULT WINAPI editsvcs_QueryInterface(IHTMLEditServices *iface, REFIID riid, void **ppv)
Definition: service.c:202
static IHTMLEditServices * create_editsvcs(void)
Definition: service.c:304
static HRESULT WINAPI OleUndoManager_EnumUndoable(IOleUndoManager *iface, IEnumOleUndoUnits **ppEnum)
Definition: service.c:125
static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
Definition: service.c:326
static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
Definition: service.c:332
static const IServiceProviderVtbl ServiceProviderVtbl
Definition: service.c:402
static HRESULT WINAPI OleUndoManager_Enable(IOleUndoManager *iface, BOOL fEnable)
Definition: service.c:155
static HRESULT WINAPI OleUndoManager_GetLastUndoDescription(IOleUndoManager *iface, BSTR *pBstr)
Definition: service.c:141
static ULONG WINAPI OleUndoManager_Release(IOleUndoManager *iface)
Definition: service.c:62
static HRESULT WINAPI editsvcs_MoveToSelectionAnchor(IHTMLEditServices *iface, IMarkupPointer *pIStartAnchor)
Definition: service.c:268
static HRESULT WINAPI OleUndoManager_GetLastRedoDescription(IOleUndoManager *iface, BSTR *pBstr)
Definition: service.c:148
static HRESULT WINAPI editsvcs_AddDesigner(IHTMLEditServices *iface, IHTMLEditDesigner *pIDesigner)
Definition: service.c:244
static const IHTMLEditServicesVtbl editsvcsVtbl
Definition: service.c:292
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define debugstr_guid
Definition: kernel32.h:35
HRESULT hres
Definition: protocol.c:465
enum _SELECTION_TYPE SELECTION_TYPE
static HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
static ULONG htmldoc_addref(HTMLDocument *This)
static ULONG htmldoc_release(HTMLDocument *This)
long LONG
Definition: pedump.c:60
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define TRACE(s)
Definition: solgame.cpp:4
IOleUndoManager IOleUndoManager_iface
Definition: service.c:22
LONG ref
Definition: service.c:24
Definition: scsiwmi.h:51
LONG ref
Definition: service.c:194
IHTMLEditServices IHTMLEditServices_iface
Definition: service.c:193
Definition: send.c:48
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
int ret
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:2364