ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

service.c
Go to the documentation of this file.
00001 /*
00002  * Copyright 2005 Jacek Caban
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00017  */
00018 
00019 #include "config.h"
00020 
00021 #include <stdarg.h>
00022 #include <stdio.h>
00023 
00024 #define COBJMACROS
00025 
00026 #include "windef.h"
00027 #include "winbase.h"
00028 #include "winuser.h"
00029 #include "ole2.h"
00030 
00031 #include "wine/debug.h"
00032 
00033 #include "mshtml_private.h"
00034 
00035 WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
00036 
00037 typedef struct {
00038     const IOleUndoManagerVtbl  *lpOleUndoManagerVtbl;
00039 
00040     LONG ref;
00041 } UndoManager;
00042 
00043 #define UNDOMGR(x)  ((IOleUndoManager*)  &(x)->lpOleUndoManagerVtbl)
00044 
00045 #define UNDOMGR_THIS(iface) DEFINE_THIS(UndoManager, OleUndoManager, iface)
00046 
00047 static HRESULT WINAPI OleUndoManager_QueryInterface(IOleUndoManager *iface, REFIID riid, void **ppv)
00048 {
00049     UndoManager *This = UNDOMGR_THIS(iface);
00050 
00051     *ppv = NULL;
00052 
00053     if(IsEqualGUID(riid, &IID_IUnknown)) {
00054         TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
00055         *ppv = UNDOMGR(This);
00056     }else if(IsEqualGUID(riid, &IID_IOleUndoManager)) {
00057         TRACE("(%p)->(IID_IOleUndoManager %p)\n", This, ppv);
00058         *ppv = UNDOMGR(This);
00059     }
00060 
00061 
00062     FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
00063     return E_NOINTERFACE;
00064 }
00065 
00066 static ULONG WINAPI OleUndoManager_AddRef(IOleUndoManager *iface)
00067 {
00068     UndoManager *This = UNDOMGR_THIS(iface);
00069     LONG ref = InterlockedIncrement(&This->ref);
00070 
00071     TRACE("(%p) ref=%d\n", This, ref);
00072 
00073     return ref;
00074 }
00075 
00076 static ULONG WINAPI OleUndoManager_Release(IOleUndoManager *iface)
00077 {
00078     UndoManager *This = UNDOMGR_THIS(iface);
00079     LONG ref = InterlockedDecrement(&This->ref);
00080 
00081     TRACE("(%p) ref=%d\n", This, ref);
00082 
00083     if(!ref)
00084         heap_free(This);
00085 
00086     return ref;
00087 }
00088 
00089 static HRESULT WINAPI OleUndoManager_Open(IOleUndoManager *iface, IOleParentUndoUnit *pPUU)
00090 {
00091     UndoManager *This = UNDOMGR_THIS(iface);
00092     FIXME("(%p)->(%p)\n", This, pPUU);
00093     return E_NOTIMPL;
00094 }
00095 
00096 static HRESULT WINAPI OleUndoManager_Close(IOleUndoManager *iface, IOleParentUndoUnit *pPUU,
00097         BOOL fCommit)
00098 {
00099     UndoManager *This = UNDOMGR_THIS(iface);
00100     FIXME("(%p)->(%p %x)\n", This, pPUU, fCommit);
00101     return E_NOTIMPL;
00102 }
00103 
00104 static HRESULT WINAPI OleUndoManager_Add(IOleUndoManager *iface, IOleUndoUnit *pUU)
00105 {
00106     UndoManager *This = UNDOMGR_THIS(iface);
00107     FIXME("(%p)->(%p)\n", This, pUU);
00108     return E_NOTIMPL;
00109 }
00110 
00111 static HRESULT WINAPI OleUndoManager_GetOpenParentState(IOleUndoManager *iface, DWORD *pdwState)
00112 {
00113     UndoManager *This = UNDOMGR_THIS(iface);
00114     FIXME("(%p)->(%p)\n", This, pdwState);
00115     return E_NOTIMPL;
00116 }
00117 
00118 static HRESULT WINAPI OleUndoManager_DiscardFrom(IOleUndoManager *iface, IOleUndoUnit *pUU)
00119 {
00120     UndoManager *This = UNDOMGR_THIS(iface);
00121     FIXME("(%p)->(%p)\n", This, pUU);
00122     return S_OK;
00123 }
00124 
00125 static HRESULT WINAPI OleUndoManager_UndoTo(IOleUndoManager *iface, IOleUndoUnit *pUU)
00126 {
00127     UndoManager *This = UNDOMGR_THIS(iface);
00128     FIXME("(%p)->(%p)\n", This, pUU);
00129     return E_NOTIMPL;
00130 }
00131 
00132 static HRESULT WINAPI OleUndoManager_RedoTo(IOleUndoManager *iface, IOleUndoUnit *pUU)
00133 {
00134     UndoManager *This = UNDOMGR_THIS(iface);
00135     FIXME("(%p)->(%p)\n", This, pUU);
00136     return E_NOTIMPL;
00137 }
00138 
00139 static HRESULT WINAPI OleUndoManager_EnumUndoable(IOleUndoManager *iface,
00140         IEnumOleUndoUnits **ppEnum)
00141 {
00142     UndoManager *This = UNDOMGR_THIS(iface);
00143     FIXME("(%p)->(%p)\n", This, ppEnum);
00144     return E_NOTIMPL;
00145 }
00146 
00147 static HRESULT WINAPI OleUndoManager_EnumRedoable(IOleUndoManager *iface,
00148         IEnumOleUndoUnits **ppEnum)
00149 {
00150     UndoManager *This = UNDOMGR_THIS(iface);
00151     FIXME("(%p)->(%p)\n", This, ppEnum);
00152     return E_NOTIMPL;
00153 }
00154 
00155 static HRESULT WINAPI OleUndoManager_GetLastUndoDescription(IOleUndoManager *iface, BSTR *pBstr)
00156 {
00157     UndoManager *This = UNDOMGR_THIS(iface);
00158     FIXME("(%p)->(%p)\n", This, pBstr);
00159     return E_NOTIMPL;
00160 }
00161 
00162 static HRESULT WINAPI OleUndoManager_GetLastRedoDescription(IOleUndoManager *iface, BSTR *pBstr)
00163 {
00164     UndoManager *This = UNDOMGR_THIS(iface);
00165     FIXME("(%p)->(%p)\n", This, pBstr);
00166     return E_NOTIMPL;
00167 }
00168 
00169 static HRESULT WINAPI OleUndoManager_Enable(IOleUndoManager *iface, BOOL fEnable)
00170 {
00171     UndoManager *This = UNDOMGR_THIS(iface);
00172     FIXME("(%p)->(%x)\n", This, fEnable);
00173     return E_NOTIMPL;
00174 }
00175 
00176 #undef UNDOMGR_THIS
00177 
00178 static const IOleUndoManagerVtbl OleUndoManagerVtbl = {
00179     OleUndoManager_QueryInterface,
00180     OleUndoManager_AddRef,
00181     OleUndoManager_Release,
00182     OleUndoManager_Open,
00183     OleUndoManager_Close,
00184     OleUndoManager_Add,
00185     OleUndoManager_GetOpenParentState,
00186     OleUndoManager_DiscardFrom,
00187     OleUndoManager_UndoTo,
00188     OleUndoManager_RedoTo,
00189     OleUndoManager_EnumUndoable,
00190     OleUndoManager_EnumRedoable,
00191     OleUndoManager_GetLastUndoDescription,
00192     OleUndoManager_GetLastRedoDescription,
00193     OleUndoManager_Enable
00194 };
00195 
00196 static IOleUndoManager *create_undomgr(void)
00197 {
00198     UndoManager *ret = heap_alloc(sizeof(UndoManager));
00199 
00200     ret->lpOleUndoManagerVtbl = &OleUndoManagerVtbl;
00201     ret->ref = 1;
00202 
00203     return UNDOMGR(ret);
00204 }
00205 
00206 /**********************************************************
00207  * IServiceProvider implementation
00208  */
00209 
00210 #define SERVPROV_THIS(iface) DEFINE_THIS(HTMLDocument, ServiceProvider, iface)
00211 
00212 static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv)
00213 {
00214     HTMLDocument *This = SERVPROV_THIS(iface);
00215     return IHTMLDocument2_QueryInterface(HTMLDOC(This), riid, ppv);
00216 }
00217 
00218 static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface)
00219 {
00220     HTMLDocument *This = SERVPROV_THIS(iface);
00221     return IHTMLDocument2_AddRef(HTMLDOC(This));
00222 }
00223 
00224 static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface)
00225 {
00226     HTMLDocument *This = SERVPROV_THIS(iface);
00227     return IHTMLDocument_Release(HTMLDOC(This));
00228 }
00229 
00230 static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService,
00231         REFIID riid, void **ppv)
00232 {
00233     HTMLDocument *This = SERVPROV_THIS(iface);
00234     
00235     if(IsEqualGUID(&CLSID_CMarkup, guidService)) {
00236         FIXME("(%p)->(CLSID_CMarkup %s %p)\n", This, debugstr_guid(riid), ppv);
00237         return E_NOINTERFACE;
00238     }
00239 
00240     if(IsEqualGUID(&IID_IOleUndoManager, riid)) {
00241         TRACE("(%p)->(IID_IOleUndoManager %p)\n", This, ppv);
00242 
00243         if(!This->doc_obj->undomgr)
00244             This->doc_obj->undomgr = create_undomgr();
00245 
00246         IOleUndoManager_AddRef(This->doc_obj->undomgr);
00247         *ppv = This->doc_obj->undomgr;
00248         return S_OK;
00249     }
00250 
00251     if(This->doc_obj->client) {
00252         IServiceProvider *sp;
00253         HRESULT hres;
00254 
00255         hres = IOleClientSite_QueryInterface(This->doc_obj->client,
00256                 &IID_IServiceProvider, (void**)&sp);
00257         if(SUCCEEDED(hres)) {
00258             hres = IServiceProvider_QueryService(sp, guidService, riid, ppv);
00259             IServiceProvider_Release(sp);
00260 
00261             if(SUCCEEDED(hres))
00262                 return hres;
00263         }
00264     }
00265 
00266     FIXME("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
00267     
00268     return E_NOINTERFACE;
00269 }
00270 
00271 static const IServiceProviderVtbl ServiceProviderVtbl = {
00272     ServiceProvider_QueryInterface,
00273     ServiceProvider_AddRef,
00274     ServiceProvider_Release,
00275     ServiceProvider_QueryService
00276 };
00277 
00278 void HTMLDocument_Service_Init(HTMLDocument *This)
00279 {
00280     This->lpServiceProviderVtbl = &ServiceProviderVtbl;
00281 }

Generated on Sat May 26 2012 04:17:41 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.