Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenrichole.c
Go to the documentation of this file.
00001 /* 00002 * RichEdit GUIDs and OLE interface 00003 * 00004 * Copyright 2004 by Krzysztof Foltman 00005 * Copyright 2004 Aric Stewart 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with this library; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00020 */ 00021 00022 #include <stdarg.h> 00023 00024 #define NONAMELESSUNION 00025 #define NONAMELESSSTRUCT 00026 #define COBJMACROS 00027 00028 #include "windef.h" 00029 #include "winbase.h" 00030 #include "wingdi.h" 00031 #include "winuser.h" 00032 #include "ole2.h" 00033 #include "richole.h" 00034 #include "editor.h" 00035 #include "tom.h" 00036 #include "wine/debug.h" 00037 00038 WINE_DEFAULT_DEBUG_CHANNEL(richedit); 00039 00040 /* there is no way to be consistent across different sets of headers - mingw, Wine, Win32 SDK*/ 00041 00042 #include "initguid.h" 00043 DEFINE_GUID(IID_ITextServices, 0x8d33f740, 0xcf58, 0x11ce, 0xa8, 0x9d, 0x00, 0xaa, 0x00, 0x6c, 0xad, 0xc5); 00044 DEFINE_GUID(IID_ITextHost, 0x13e670f4,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1); 00045 DEFINE_GUID(IID_ITextHost2, 0x13e670f5,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1); 00046 DEFINE_GUID(IID_ITextDocument, 0x8cc497c0, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d); 00047 DEFINE_GUID(IID_ITextRange, 0x8cc497c2, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d); 00048 DEFINE_GUID(IID_ITextSelection, 0x8cc497c1, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d); 00049 00050 typedef struct ITextSelectionImpl ITextSelectionImpl; 00051 typedef struct IOleClientSiteImpl IOleClientSiteImpl; 00052 00053 typedef struct IRichEditOleImpl { 00054 IRichEditOle IRichEditOle_iface; 00055 ITextDocument ITextDocument_iface; 00056 LONG ref; 00057 00058 ME_TextEditor *editor; 00059 ITextSelectionImpl *txtSel; 00060 IOleClientSiteImpl *clientSite; 00061 } IRichEditOleImpl; 00062 00063 struct ITextSelectionImpl { 00064 ITextSelection ITextSelection_iface; 00065 LONG ref; 00066 00067 IRichEditOleImpl *reOle; 00068 }; 00069 00070 struct IOleClientSiteImpl { 00071 IOleClientSite IOleClientSite_iface; 00072 LONG ref; 00073 00074 IRichEditOleImpl *reOle; 00075 }; 00076 00077 static inline IRichEditOleImpl *impl_from_IRichEditOle(IRichEditOle *iface) 00078 { 00079 return CONTAINING_RECORD(iface, IRichEditOleImpl, IRichEditOle_iface); 00080 } 00081 00082 static inline IRichEditOleImpl *impl_from_ITextDocument(ITextDocument *iface) 00083 { 00084 return CONTAINING_RECORD(iface, IRichEditOleImpl, ITextDocument_iface); 00085 } 00086 00087 static HRESULT WINAPI 00088 IRichEditOle_fnQueryInterface(IRichEditOle *me, REFIID riid, LPVOID *ppvObj) 00089 { 00090 IRichEditOleImpl *This = impl_from_IRichEditOle(me); 00091 00092 TRACE("%p %s\n", This, debugstr_guid(riid) ); 00093 00094 *ppvObj = NULL; 00095 if (IsEqualGUID(riid, &IID_IUnknown) || 00096 IsEqualGUID(riid, &IID_IRichEditOle)) 00097 *ppvObj = &This->IRichEditOle_iface; 00098 else if (IsEqualGUID(riid, &IID_ITextDocument)) 00099 *ppvObj = &This->ITextDocument_iface; 00100 if (*ppvObj) 00101 { 00102 IRichEditOle_AddRef(me); 00103 return S_OK; 00104 } 00105 FIXME("%p: unhandled interface %s\n", This, debugstr_guid(riid) ); 00106 00107 return E_NOINTERFACE; 00108 } 00109 00110 static ULONG WINAPI 00111 IRichEditOle_fnAddRef(IRichEditOle *me) 00112 { 00113 IRichEditOleImpl *This = impl_from_IRichEditOle(me); 00114 ULONG ref = InterlockedIncrement( &This->ref ); 00115 00116 TRACE("%p ref = %u\n", This, ref); 00117 00118 return ref; 00119 } 00120 00121 static ULONG WINAPI 00122 IRichEditOle_fnRelease(IRichEditOle *me) 00123 { 00124 IRichEditOleImpl *This = impl_from_IRichEditOle(me); 00125 ULONG ref = InterlockedDecrement(&This->ref); 00126 00127 TRACE ("%p ref=%u\n", This, ref); 00128 00129 if (!ref) 00130 { 00131 TRACE ("Destroying %p\n", This); 00132 This->txtSel->reOle = NULL; 00133 ITextSelection_Release(&This->txtSel->ITextSelection_iface); 00134 IOleClientSite_Release(&This->clientSite->IOleClientSite_iface); 00135 heap_free(This); 00136 } 00137 return ref; 00138 } 00139 00140 static HRESULT WINAPI 00141 IRichEditOle_fnActivateAs(IRichEditOle *me, REFCLSID rclsid, REFCLSID rclsidAs) 00142 { 00143 IRichEditOleImpl *This = impl_from_IRichEditOle(me); 00144 FIXME("stub %p\n",This); 00145 return E_NOTIMPL; 00146 } 00147 00148 static HRESULT WINAPI 00149 IRichEditOle_fnContextSensitiveHelp(IRichEditOle *me, BOOL fEnterMode) 00150 { 00151 IRichEditOleImpl *This = impl_from_IRichEditOle(me); 00152 FIXME("stub %p\n",This); 00153 return E_NOTIMPL; 00154 } 00155 00156 static HRESULT WINAPI 00157 IRichEditOle_fnConvertObject(IRichEditOle *me, LONG iob, 00158 REFCLSID rclsidNew, LPCSTR lpstrUserTypeNew) 00159 { 00160 IRichEditOleImpl *This = impl_from_IRichEditOle(me); 00161 FIXME("stub %p\n",This); 00162 return E_NOTIMPL; 00163 } 00164 00165 static inline IOleClientSiteImpl *impl_from_IOleClientSite(IOleClientSite *iface) 00166 { 00167 return CONTAINING_RECORD(iface, IOleClientSiteImpl, IOleClientSite_iface); 00168 } 00169 00170 static HRESULT WINAPI 00171 IOleClientSite_fnQueryInterface(IOleClientSite *me, REFIID riid, LPVOID *ppvObj) 00172 { 00173 TRACE("%p %s\n", me, debugstr_guid(riid) ); 00174 00175 *ppvObj = NULL; 00176 if (IsEqualGUID(riid, &IID_IUnknown) || 00177 IsEqualGUID(riid, &IID_IOleClientSite)) 00178 *ppvObj = me; 00179 if (*ppvObj) 00180 { 00181 IOleClientSite_AddRef(me); 00182 return S_OK; 00183 } 00184 FIXME("%p: unhandled interface %s\n", me, debugstr_guid(riid) ); 00185 00186 return E_NOINTERFACE; 00187 } 00188 00189 static ULONG WINAPI IOleClientSite_fnAddRef(IOleClientSite *iface) 00190 { 00191 IOleClientSiteImpl *This = impl_from_IOleClientSite(iface); 00192 return InterlockedIncrement(&This->ref); 00193 } 00194 00195 static ULONG WINAPI IOleClientSite_fnRelease(IOleClientSite *iface) 00196 { 00197 IOleClientSiteImpl *This = impl_from_IOleClientSite(iface); 00198 ULONG ref = InterlockedDecrement(&This->ref); 00199 if (ref == 0) 00200 heap_free(This); 00201 return ref; 00202 } 00203 00204 static HRESULT WINAPI IOleClientSite_fnSaveObject(IOleClientSite *iface) 00205 { 00206 IOleClientSiteImpl *This = impl_from_IOleClientSite(iface); 00207 if (!This->reOle) 00208 return CO_E_RELEASED; 00209 00210 FIXME("stub %p\n", iface); 00211 return E_NOTIMPL; 00212 } 00213 00214 00215 static HRESULT WINAPI IOleClientSite_fnGetMoniker(IOleClientSite *iface, DWORD dwAssign, 00216 DWORD dwWhichMoniker, IMoniker **ppmk) 00217 { 00218 IOleClientSiteImpl *This = impl_from_IOleClientSite(iface); 00219 if (!This->reOle) 00220 return CO_E_RELEASED; 00221 00222 FIXME("stub %p\n", iface); 00223 return E_NOTIMPL; 00224 } 00225 00226 static HRESULT WINAPI IOleClientSite_fnGetContainer(IOleClientSite *iface, 00227 IOleContainer **ppContainer) 00228 { 00229 IOleClientSiteImpl *This = impl_from_IOleClientSite(iface); 00230 if (!This->reOle) 00231 return CO_E_RELEASED; 00232 00233 FIXME("stub %p\n", iface); 00234 return E_NOTIMPL; 00235 } 00236 00237 static HRESULT WINAPI IOleClientSite_fnShowObject(IOleClientSite *iface) 00238 { 00239 IOleClientSiteImpl *This = impl_from_IOleClientSite(iface); 00240 if (!This->reOle) 00241 return CO_E_RELEASED; 00242 00243 FIXME("stub %p\n", iface); 00244 return E_NOTIMPL; 00245 } 00246 00247 static HRESULT WINAPI IOleClientSite_fnOnShowWindow(IOleClientSite *iface, BOOL fShow) 00248 { 00249 IOleClientSiteImpl *This = impl_from_IOleClientSite(iface); 00250 if (!This->reOle) 00251 return CO_E_RELEASED; 00252 00253 FIXME("stub %p\n", iface); 00254 return E_NOTIMPL; 00255 } 00256 00257 static HRESULT WINAPI IOleClientSite_fnRequestNewObjectLayout(IOleClientSite *iface) 00258 { 00259 IOleClientSiteImpl *This = impl_from_IOleClientSite(iface); 00260 if (!This->reOle) 00261 return CO_E_RELEASED; 00262 00263 FIXME("stub %p\n", iface); 00264 return E_NOTIMPL; 00265 } 00266 00267 static const IOleClientSiteVtbl ocst = { 00268 IOleClientSite_fnQueryInterface, 00269 IOleClientSite_fnAddRef, 00270 IOleClientSite_fnRelease, 00271 IOleClientSite_fnSaveObject, 00272 IOleClientSite_fnGetMoniker, 00273 IOleClientSite_fnGetContainer, 00274 IOleClientSite_fnShowObject, 00275 IOleClientSite_fnOnShowWindow, 00276 IOleClientSite_fnRequestNewObjectLayout 00277 }; 00278 00279 static IOleClientSiteImpl * 00280 CreateOleClientSite(IRichEditOleImpl *reOle) 00281 { 00282 IOleClientSiteImpl *clientSite = heap_alloc(sizeof *clientSite); 00283 if (!clientSite) 00284 return NULL; 00285 00286 clientSite->IOleClientSite_iface.lpVtbl = &ocst; 00287 clientSite->ref = 1; 00288 clientSite->reOle = reOle; 00289 return clientSite; 00290 } 00291 00292 static HRESULT WINAPI 00293 IRichEditOle_fnGetClientSite(IRichEditOle *me, 00294 LPOLECLIENTSITE *lplpolesite) 00295 { 00296 IRichEditOleImpl *This = impl_from_IRichEditOle(me); 00297 00298 TRACE("%p,%p\n",This, lplpolesite); 00299 00300 if(!lplpolesite) 00301 return E_INVALIDARG; 00302 *lplpolesite = &This->clientSite->IOleClientSite_iface; 00303 IOleClientSite_fnAddRef(*lplpolesite); 00304 return S_OK; 00305 } 00306 00307 static HRESULT WINAPI 00308 IRichEditOle_fnGetClipboardData(IRichEditOle *me, CHARRANGE *lpchrg, 00309 DWORD reco, LPDATAOBJECT *lplpdataobj) 00310 { 00311 IRichEditOleImpl *This = impl_from_IRichEditOle(me); 00312 ME_Cursor start; 00313 int nChars; 00314 00315 TRACE("(%p,%p,%d)\n",This, lpchrg, reco); 00316 if(!lplpdataobj) 00317 return E_INVALIDARG; 00318 if(!lpchrg) { 00319 int nFrom, nTo, nStartCur = ME_GetSelectionOfs(This->editor, &nFrom, &nTo); 00320 start = This->editor->pCursors[nStartCur]; 00321 nChars = nTo - nFrom; 00322 } else { 00323 ME_CursorFromCharOfs(This->editor, lpchrg->cpMin, &start); 00324 nChars = lpchrg->cpMax - lpchrg->cpMin; 00325 } 00326 return ME_GetDataObject(This->editor, &start, nChars, lplpdataobj); 00327 } 00328 00329 static LONG WINAPI IRichEditOle_fnGetLinkCount(IRichEditOle *me) 00330 { 00331 IRichEditOleImpl *This = impl_from_IRichEditOle(me); 00332 FIXME("stub %p\n",This); 00333 return E_NOTIMPL; 00334 } 00335 00336 static HRESULT WINAPI 00337 IRichEditOle_fnGetObject(IRichEditOle *me, LONG iob, 00338 REOBJECT *lpreobject, DWORD dwFlags) 00339 { 00340 IRichEditOleImpl *This = impl_from_IRichEditOle(me); 00341 FIXME("stub %p\n",This); 00342 return E_NOTIMPL; 00343 } 00344 00345 static LONG WINAPI 00346 IRichEditOle_fnGetObjectCount(IRichEditOle *me) 00347 { 00348 IRichEditOleImpl *This = impl_from_IRichEditOle(me); 00349 FIXME("stub %p\n",This); 00350 return 0; 00351 } 00352 00353 static HRESULT WINAPI 00354 IRichEditOle_fnHandsOffStorage(IRichEditOle *me, LONG iob) 00355 { 00356 IRichEditOleImpl *This = impl_from_IRichEditOle(me); 00357 FIXME("stub %p\n",This); 00358 return E_NOTIMPL; 00359 } 00360 00361 static HRESULT WINAPI 00362 IRichEditOle_fnImportDataObject(IRichEditOle *me, LPDATAOBJECT lpdataobj, 00363 CLIPFORMAT cf, HGLOBAL hMetaPict) 00364 { 00365 IRichEditOleImpl *This = impl_from_IRichEditOle(me); 00366 FIXME("stub %p\n",This); 00367 return E_NOTIMPL; 00368 } 00369 00370 static HRESULT WINAPI 00371 IRichEditOle_fnInPlaceDeactivate(IRichEditOle *me) 00372 { 00373 IRichEditOleImpl *This = impl_from_IRichEditOle(me); 00374 FIXME("stub %p\n",This); 00375 return E_NOTIMPL; 00376 } 00377 00378 static HRESULT WINAPI 00379 IRichEditOle_fnInsertObject(IRichEditOle *me, REOBJECT *reo) 00380 { 00381 IRichEditOleImpl *This = impl_from_IRichEditOle(me); 00382 TRACE("(%p,%p)\n", This, reo); 00383 00384 if (reo->cbStruct < sizeof(*reo)) return STG_E_INVALIDPARAMETER; 00385 00386 ME_InsertOLEFromCursor(This->editor, reo, 0); 00387 ME_CommitUndo(This->editor); 00388 ME_UpdateRepaint(This->editor, FALSE); 00389 return S_OK; 00390 } 00391 00392 static HRESULT WINAPI IRichEditOle_fnSaveCompleted(IRichEditOle *me, LONG iob, 00393 LPSTORAGE lpstg) 00394 { 00395 IRichEditOleImpl *This = impl_from_IRichEditOle(me); 00396 FIXME("stub %p\n",This); 00397 return E_NOTIMPL; 00398 } 00399 00400 static HRESULT WINAPI 00401 IRichEditOle_fnSetDvaspect(IRichEditOle *me, LONG iob, DWORD dvaspect) 00402 { 00403 IRichEditOleImpl *This = impl_from_IRichEditOle(me); 00404 FIXME("stub %p\n",This); 00405 return E_NOTIMPL; 00406 } 00407 00408 static HRESULT WINAPI IRichEditOle_fnSetHostNames(IRichEditOle *me, 00409 LPCSTR lpstrContainerApp, LPCSTR lpstrContainerObj) 00410 { 00411 IRichEditOleImpl *This = impl_from_IRichEditOle(me); 00412 FIXME("stub %p %s %s\n",This, lpstrContainerApp, lpstrContainerObj); 00413 return E_NOTIMPL; 00414 } 00415 00416 static HRESULT WINAPI 00417 IRichEditOle_fnSetLinkAvailable(IRichEditOle *me, LONG iob, BOOL fAvailable) 00418 { 00419 IRichEditOleImpl *This = impl_from_IRichEditOle(me); 00420 FIXME("stub %p\n",This); 00421 return E_NOTIMPL; 00422 } 00423 00424 static const IRichEditOleVtbl revt = { 00425 IRichEditOle_fnQueryInterface, 00426 IRichEditOle_fnAddRef, 00427 IRichEditOle_fnRelease, 00428 IRichEditOle_fnGetClientSite, 00429 IRichEditOle_fnGetObjectCount, 00430 IRichEditOle_fnGetLinkCount, 00431 IRichEditOle_fnGetObject, 00432 IRichEditOle_fnInsertObject, 00433 IRichEditOle_fnConvertObject, 00434 IRichEditOle_fnActivateAs, 00435 IRichEditOle_fnSetHostNames, 00436 IRichEditOle_fnSetLinkAvailable, 00437 IRichEditOle_fnSetDvaspect, 00438 IRichEditOle_fnHandsOffStorage, 00439 IRichEditOle_fnSaveCompleted, 00440 IRichEditOle_fnInPlaceDeactivate, 00441 IRichEditOle_fnContextSensitiveHelp, 00442 IRichEditOle_fnGetClipboardData, 00443 IRichEditOle_fnImportDataObject 00444 }; 00445 00446 static HRESULT WINAPI 00447 ITextDocument_fnQueryInterface(ITextDocument* me, REFIID riid, 00448 void** ppvObject) 00449 { 00450 IRichEditOleImpl *This = impl_from_ITextDocument(me); 00451 return IRichEditOle_fnQueryInterface(&This->IRichEditOle_iface, riid, ppvObject); 00452 } 00453 00454 static ULONG WINAPI 00455 ITextDocument_fnAddRef(ITextDocument* me) 00456 { 00457 IRichEditOleImpl *This = impl_from_ITextDocument(me); 00458 return IRichEditOle_fnAddRef(&This->IRichEditOle_iface); 00459 } 00460 00461 static ULONG WINAPI 00462 ITextDocument_fnRelease(ITextDocument* me) 00463 { 00464 IRichEditOleImpl *This = impl_from_ITextDocument(me); 00465 return IRichEditOle_fnRelease(&This->IRichEditOle_iface); 00466 } 00467 00468 static HRESULT WINAPI 00469 ITextDocument_fnGetTypeInfoCount(ITextDocument* me, 00470 UINT* pctinfo) 00471 { 00472 IRichEditOleImpl *This = impl_from_ITextDocument(me); 00473 FIXME("stub %p\n",This); 00474 return E_NOTIMPL; 00475 } 00476 00477 static HRESULT WINAPI 00478 ITextDocument_fnGetTypeInfo(ITextDocument* me, UINT iTInfo, LCID lcid, 00479 ITypeInfo** ppTInfo) 00480 { 00481 IRichEditOleImpl *This = impl_from_ITextDocument(me); 00482 FIXME("stub %p\n",This); 00483 return E_NOTIMPL; 00484 } 00485 00486 static HRESULT WINAPI 00487 ITextDocument_fnGetIDsOfNames(ITextDocument* me, REFIID riid, 00488 LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId) 00489 { 00490 IRichEditOleImpl *This = impl_from_ITextDocument(me); 00491 FIXME("stub %p\n",This); 00492 return E_NOTIMPL; 00493 } 00494 00495 static HRESULT WINAPI 00496 ITextDocument_fnInvoke(ITextDocument* me, DISPID dispIdMember, 00497 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, 00498 VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr) 00499 { 00500 IRichEditOleImpl *This = impl_from_ITextDocument(me); 00501 FIXME("stub %p\n",This); 00502 return E_NOTIMPL; 00503 } 00504 00505 static HRESULT WINAPI 00506 ITextDocument_fnGetName(ITextDocument* me, BSTR* pName) 00507 { 00508 IRichEditOleImpl *This = impl_from_ITextDocument(me); 00509 FIXME("stub %p\n",This); 00510 return E_NOTIMPL; 00511 } 00512 00513 static HRESULT WINAPI 00514 ITextDocument_fnGetSelection(ITextDocument* me, ITextSelection** ppSel) 00515 { 00516 IRichEditOleImpl *This = impl_from_ITextDocument(me); 00517 TRACE("(%p)\n", me); 00518 *ppSel = &This->txtSel->ITextSelection_iface; 00519 ITextSelection_AddRef(*ppSel); 00520 return S_OK; 00521 } 00522 00523 static HRESULT WINAPI 00524 ITextDocument_fnGetStoryCount(ITextDocument* me, LONG* pCount) 00525 { 00526 IRichEditOleImpl *This = impl_from_ITextDocument(me); 00527 FIXME("stub %p\n",This); 00528 return E_NOTIMPL; 00529 } 00530 00531 static HRESULT WINAPI 00532 ITextDocument_fnGetStoryRanges(ITextDocument* me, 00533 ITextStoryRanges** ppStories) 00534 { 00535 IRichEditOleImpl *This = impl_from_ITextDocument(me); 00536 FIXME("stub %p\n",This); 00537 return E_NOTIMPL; 00538 } 00539 00540 static HRESULT WINAPI 00541 ITextDocument_fnGetSaved(ITextDocument* me, LONG* pValue) 00542 { 00543 IRichEditOleImpl *This = impl_from_ITextDocument(me); 00544 FIXME("stub %p\n",This); 00545 return E_NOTIMPL; 00546 } 00547 00548 static HRESULT WINAPI 00549 ITextDocument_fnSetSaved(ITextDocument* me, LONG Value) 00550 { 00551 IRichEditOleImpl *This = impl_from_ITextDocument(me); 00552 FIXME("stub %p\n",This); 00553 return E_NOTIMPL; 00554 } 00555 00556 static HRESULT WINAPI 00557 ITextDocument_fnGetDefaultTabStop(ITextDocument* me, float* pValue) 00558 { 00559 IRichEditOleImpl *This = impl_from_ITextDocument(me); 00560 FIXME("stub %p\n",This); 00561 return E_NOTIMPL; 00562 } 00563 00564 static HRESULT WINAPI 00565 ITextDocument_fnSetDefaultTabStop(ITextDocument* me, float Value) 00566 { 00567 IRichEditOleImpl *This = impl_from_ITextDocument(me); 00568 FIXME("stub %p\n",This); 00569 return E_NOTIMPL; 00570 } 00571 00572 static HRESULT WINAPI 00573 ITextDocument_fnNew(ITextDocument* me) 00574 { 00575 IRichEditOleImpl *This = impl_from_ITextDocument(me); 00576 FIXME("stub %p\n",This); 00577 return E_NOTIMPL; 00578 } 00579 00580 static HRESULT WINAPI 00581 ITextDocument_fnOpen(ITextDocument* me, VARIANT* pVar, LONG Flags, 00582 LONG CodePage) 00583 { 00584 IRichEditOleImpl *This = impl_from_ITextDocument(me); 00585 FIXME("stub %p\n",This); 00586 return E_NOTIMPL; 00587 } 00588 00589 static HRESULT WINAPI 00590 ITextDocument_fnSave(ITextDocument* me, VARIANT* pVar, LONG Flags, 00591 LONG CodePage) 00592 { 00593 IRichEditOleImpl *This = impl_from_ITextDocument(me); 00594 FIXME("stub %p\n",This); 00595 return E_NOTIMPL; 00596 } 00597 00598 static HRESULT WINAPI 00599 ITextDocument_fnFreeze(ITextDocument* me, LONG* pCount) 00600 { 00601 IRichEditOleImpl *This = impl_from_ITextDocument(me); 00602 FIXME("stub %p\n",This); 00603 return E_NOTIMPL; 00604 } 00605 00606 static HRESULT WINAPI 00607 ITextDocument_fnUnfreeze(ITextDocument* me, LONG* pCount) 00608 { 00609 IRichEditOleImpl *This = impl_from_ITextDocument(me); 00610 FIXME("stub %p\n",This); 00611 return E_NOTIMPL; 00612 } 00613 00614 static HRESULT WINAPI 00615 ITextDocument_fnBeginEditCollection(ITextDocument* me) 00616 { 00617 IRichEditOleImpl *This = impl_from_ITextDocument(me); 00618 FIXME("stub %p\n",This); 00619 return E_NOTIMPL; 00620 } 00621 00622 static HRESULT WINAPI 00623 ITextDocument_fnEndEditCollection(ITextDocument* me) 00624 { 00625 IRichEditOleImpl *This = impl_from_ITextDocument(me); 00626 FIXME("stub %p\n",This); 00627 return E_NOTIMPL; 00628 } 00629 00630 static HRESULT WINAPI 00631 ITextDocument_fnUndo(ITextDocument* me, LONG Count, LONG* prop) 00632 { 00633 IRichEditOleImpl *This = impl_from_ITextDocument(me); 00634 FIXME("stub %p\n",This); 00635 return E_NOTIMPL; 00636 } 00637 00638 static HRESULT WINAPI 00639 ITextDocument_fnRedo(ITextDocument* me, LONG Count, LONG* prop) 00640 { 00641 IRichEditOleImpl *This = impl_from_ITextDocument(me); 00642 FIXME("stub %p\n",This); 00643 return E_NOTIMPL; 00644 } 00645 00646 static HRESULT WINAPI 00647 ITextDocument_fnRange(ITextDocument* me, LONG cp1, LONG cp2, 00648 ITextRange** ppRange) 00649 { 00650 IRichEditOleImpl *This = impl_from_ITextDocument(me); 00651 FIXME("stub %p\n",This); 00652 return E_NOTIMPL; 00653 } 00654 00655 static HRESULT WINAPI 00656 ITextDocument_fnRangeFromPoint(ITextDocument* me, LONG x, LONG y, 00657 ITextRange** ppRange) 00658 { 00659 IRichEditOleImpl *This = impl_from_ITextDocument(me); 00660 FIXME("stub %p\n",This); 00661 return E_NOTIMPL; 00662 } 00663 00664 static const ITextDocumentVtbl tdvt = { 00665 ITextDocument_fnQueryInterface, 00666 ITextDocument_fnAddRef, 00667 ITextDocument_fnRelease, 00668 ITextDocument_fnGetTypeInfoCount, 00669 ITextDocument_fnGetTypeInfo, 00670 ITextDocument_fnGetIDsOfNames, 00671 ITextDocument_fnInvoke, 00672 ITextDocument_fnGetName, 00673 ITextDocument_fnGetSelection, 00674 ITextDocument_fnGetStoryCount, 00675 ITextDocument_fnGetStoryRanges, 00676 ITextDocument_fnGetSaved, 00677 ITextDocument_fnSetSaved, 00678 ITextDocument_fnGetDefaultTabStop, 00679 ITextDocument_fnSetDefaultTabStop, 00680 ITextDocument_fnNew, 00681 ITextDocument_fnOpen, 00682 ITextDocument_fnSave, 00683 ITextDocument_fnFreeze, 00684 ITextDocument_fnUnfreeze, 00685 ITextDocument_fnBeginEditCollection, 00686 ITextDocument_fnEndEditCollection, 00687 ITextDocument_fnUndo, 00688 ITextDocument_fnRedo, 00689 ITextDocument_fnRange, 00690 ITextDocument_fnRangeFromPoint 00691 }; 00692 00693 static inline ITextSelectionImpl *impl_from_ITextSelection(ITextSelection *iface) 00694 { 00695 return CONTAINING_RECORD(iface, ITextSelectionImpl, ITextSelection_iface); 00696 } 00697 00698 static HRESULT WINAPI ITextSelection_fnQueryInterface( 00699 ITextSelection *me, 00700 REFIID riid, 00701 void **ppvObj) 00702 { 00703 *ppvObj = NULL; 00704 if (IsEqualGUID(riid, &IID_IUnknown) 00705 || IsEqualGUID(riid, &IID_IDispatch) 00706 || IsEqualGUID(riid, &IID_ITextRange) 00707 || IsEqualGUID(riid, &IID_ITextSelection)) 00708 { 00709 *ppvObj = me; 00710 ITextSelection_AddRef(me); 00711 return S_OK; 00712 } 00713 00714 return E_NOINTERFACE; 00715 } 00716 00717 static ULONG WINAPI ITextSelection_fnAddRef(ITextSelection *me) 00718 { 00719 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00720 return InterlockedIncrement(&This->ref); 00721 } 00722 00723 static ULONG WINAPI ITextSelection_fnRelease(ITextSelection *me) 00724 { 00725 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00726 ULONG ref = InterlockedDecrement(&This->ref); 00727 if (ref == 0) 00728 heap_free(This); 00729 return ref; 00730 } 00731 00732 static HRESULT WINAPI ITextSelection_fnGetTypeInfoCount(ITextSelection *me, UINT *pctinfo) 00733 { 00734 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00735 if (!This->reOle) 00736 return CO_E_RELEASED; 00737 00738 FIXME("not implemented\n"); 00739 return E_NOTIMPL; 00740 } 00741 00742 static HRESULT WINAPI ITextSelection_fnGetTypeInfo(ITextSelection *me, UINT iTInfo, LCID lcid, 00743 ITypeInfo **ppTInfo) 00744 { 00745 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00746 if (!This->reOle) 00747 return CO_E_RELEASED; 00748 00749 FIXME("not implemented\n"); 00750 return E_NOTIMPL; 00751 } 00752 00753 static HRESULT WINAPI ITextSelection_fnGetIDsOfNames(ITextSelection *me, REFIID riid, 00754 LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) 00755 { 00756 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00757 if (!This->reOle) 00758 return CO_E_RELEASED; 00759 00760 FIXME("not implemented\n"); 00761 return E_NOTIMPL; 00762 } 00763 00764 static HRESULT WINAPI ITextSelection_fnInvoke( 00765 ITextSelection *me, 00766 DISPID dispIdMember, 00767 REFIID riid, 00768 LCID lcid, 00769 WORD wFlags, 00770 DISPPARAMS *pDispParams, 00771 VARIANT *pVarResult, 00772 EXCEPINFO *pExcepInfo, 00773 UINT *puArgErr) 00774 { 00775 FIXME("not implemented\n"); 00776 return E_NOTIMPL; 00777 } 00778 00779 /*** ITextRange methods ***/ 00780 static HRESULT WINAPI ITextSelection_fnGetText(ITextSelection *me, BSTR *pbstr) 00781 { 00782 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00783 if (!This->reOle) 00784 return CO_E_RELEASED; 00785 00786 FIXME("not implemented\n"); 00787 return E_NOTIMPL; 00788 } 00789 00790 static HRESULT WINAPI ITextSelection_fnSetText(ITextSelection *me, BSTR bstr) 00791 { 00792 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00793 if (!This->reOle) 00794 return CO_E_RELEASED; 00795 00796 FIXME("not implemented\n"); 00797 return E_NOTIMPL; 00798 } 00799 00800 static HRESULT WINAPI ITextSelection_fnGetChar(ITextSelection *me, LONG *pch) 00801 { 00802 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00803 if (!This->reOle) 00804 return CO_E_RELEASED; 00805 00806 FIXME("not implemented\n"); 00807 return E_NOTIMPL; 00808 } 00809 00810 static HRESULT WINAPI ITextSelection_fnSetChar(ITextSelection *me, LONG ch) 00811 { 00812 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00813 if (!This->reOle) 00814 return CO_E_RELEASED; 00815 00816 FIXME("not implemented\n"); 00817 return E_NOTIMPL; 00818 } 00819 00820 static HRESULT WINAPI ITextSelection_fnGetDuplicate(ITextSelection *me, ITextRange **ppRange) 00821 { 00822 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00823 if (!This->reOle) 00824 return CO_E_RELEASED; 00825 00826 FIXME("not implemented\n"); 00827 return E_NOTIMPL; 00828 } 00829 00830 static HRESULT WINAPI ITextSelection_fnGetFormattedText(ITextSelection *me, ITextRange **ppRange) 00831 { 00832 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00833 if (!This->reOle) 00834 return CO_E_RELEASED; 00835 00836 FIXME("not implemented\n"); 00837 return E_NOTIMPL; 00838 } 00839 00840 static HRESULT WINAPI ITextSelection_fnSetFormattedText(ITextSelection *me, ITextRange *pRange) 00841 { 00842 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00843 if (!This->reOle) 00844 return CO_E_RELEASED; 00845 00846 FIXME("not implemented\n"); 00847 return E_NOTIMPL; 00848 } 00849 00850 static HRESULT WINAPI ITextSelection_fnGetStart(ITextSelection *me, LONG *pcpFirst) 00851 { 00852 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00853 if (!This->reOle) 00854 return CO_E_RELEASED; 00855 00856 FIXME("not implemented\n"); 00857 return E_NOTIMPL; 00858 } 00859 00860 static HRESULT WINAPI ITextSelection_fnSetStart(ITextSelection *me, LONG cpFirst) 00861 { 00862 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00863 if (!This->reOle) 00864 return CO_E_RELEASED; 00865 00866 FIXME("not implemented\n"); 00867 return E_NOTIMPL; 00868 } 00869 00870 static HRESULT WINAPI ITextSelection_fnGetEnd(ITextSelection *me, LONG *pcpLim) 00871 { 00872 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00873 if (!This->reOle) 00874 return CO_E_RELEASED; 00875 00876 FIXME("not implemented\n"); 00877 return E_NOTIMPL; 00878 } 00879 00880 static HRESULT WINAPI ITextSelection_fnSetEnd(ITextSelection *me, LONG cpLim) 00881 { 00882 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00883 if (!This->reOle) 00884 return CO_E_RELEASED; 00885 00886 FIXME("not implemented\n"); 00887 return E_NOTIMPL; 00888 } 00889 00890 static HRESULT WINAPI ITextSelection_fnGetFont(ITextSelection *me, ITextFont **pFont) 00891 { 00892 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00893 if (!This->reOle) 00894 return CO_E_RELEASED; 00895 00896 FIXME("not implemented\n"); 00897 return E_NOTIMPL; 00898 } 00899 00900 static HRESULT WINAPI ITextSelection_fnSetFont(ITextSelection *me, ITextFont *pFont) 00901 { 00902 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00903 if (!This->reOle) 00904 return CO_E_RELEASED; 00905 00906 FIXME("not implemented\n"); 00907 return E_NOTIMPL; 00908 } 00909 00910 static HRESULT WINAPI ITextSelection_fnGetPara(ITextSelection *me, ITextPara **ppPara) 00911 { 00912 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00913 if (!This->reOle) 00914 return CO_E_RELEASED; 00915 00916 FIXME("not implemented\n"); 00917 return E_NOTIMPL; 00918 } 00919 00920 static HRESULT WINAPI ITextSelection_fnSetPara(ITextSelection *me, ITextPara *pPara) 00921 { 00922 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00923 if (!This->reOle) 00924 return CO_E_RELEASED; 00925 00926 FIXME("not implemented\n"); 00927 return E_NOTIMPL; 00928 } 00929 00930 static HRESULT WINAPI ITextSelection_fnGetStoryLength(ITextSelection *me, LONG *pcch) 00931 { 00932 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00933 if (!This->reOle) 00934 return CO_E_RELEASED; 00935 00936 FIXME("not implemented\n"); 00937 return E_NOTIMPL; 00938 } 00939 00940 static HRESULT WINAPI ITextSelection_fnGetStoryType(ITextSelection *me, LONG *pValue) 00941 { 00942 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00943 if (!This->reOle) 00944 return CO_E_RELEASED; 00945 00946 FIXME("not implemented\n"); 00947 return E_NOTIMPL; 00948 } 00949 00950 static HRESULT WINAPI ITextSelection_fnCollapse(ITextSelection *me, LONG bStart) 00951 { 00952 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00953 if (!This->reOle) 00954 return CO_E_RELEASED; 00955 00956 FIXME("not implemented\n"); 00957 return E_NOTIMPL; 00958 } 00959 00960 static HRESULT WINAPI ITextSelection_fnExpand(ITextSelection *me, LONG Unit, LONG *pDelta) 00961 { 00962 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00963 if (!This->reOle) 00964 return CO_E_RELEASED; 00965 00966 FIXME("not implemented\n"); 00967 return E_NOTIMPL; 00968 } 00969 00970 static HRESULT WINAPI ITextSelection_fnGetIndex(ITextSelection *me, LONG Unit, LONG *pIndex) 00971 { 00972 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00973 if (!This->reOle) 00974 return CO_E_RELEASED; 00975 00976 FIXME("not implemented\n"); 00977 return E_NOTIMPL; 00978 } 00979 00980 static HRESULT WINAPI ITextSelection_fnSetIndex(ITextSelection *me, LONG Unit, LONG Index, 00981 LONG Extend) 00982 { 00983 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00984 if (!This->reOle) 00985 return CO_E_RELEASED; 00986 00987 FIXME("not implemented\n"); 00988 return E_NOTIMPL; 00989 } 00990 00991 static HRESULT WINAPI ITextSelection_fnSetRange(ITextSelection *me, LONG cpActive, LONG cpOther) 00992 { 00993 ITextSelectionImpl *This = impl_from_ITextSelection(me); 00994 if (!This->reOle) 00995 return CO_E_RELEASED; 00996 00997 FIXME("not implemented\n"); 00998 return E_NOTIMPL; 00999 } 01000 01001 static HRESULT WINAPI ITextSelection_fnInRange(ITextSelection *me, ITextRange *pRange, LONG *pb) 01002 { 01003 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01004 if (!This->reOle) 01005 return CO_E_RELEASED; 01006 01007 FIXME("not implemented\n"); 01008 return E_NOTIMPL; 01009 } 01010 01011 static HRESULT WINAPI ITextSelection_fnInStory(ITextSelection *me, ITextRange *pRange, LONG *pb) 01012 { 01013 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01014 if (!This->reOle) 01015 return CO_E_RELEASED; 01016 01017 FIXME("not implemented\n"); 01018 return E_NOTIMPL; 01019 } 01020 01021 static HRESULT WINAPI ITextSelection_fnIsEqual(ITextSelection *me, ITextRange *pRange, LONG *pb) 01022 { 01023 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01024 if (!This->reOle) 01025 return CO_E_RELEASED; 01026 01027 FIXME("not implemented\n"); 01028 return E_NOTIMPL; 01029 } 01030 01031 static HRESULT WINAPI ITextSelection_fnSelect(ITextSelection *me) 01032 { 01033 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01034 if (!This->reOle) 01035 return CO_E_RELEASED; 01036 01037 FIXME("not implemented\n"); 01038 return E_NOTIMPL; 01039 } 01040 01041 static HRESULT WINAPI ITextSelection_fnStartOf(ITextSelection *me, LONG Unit, LONG Extend, 01042 LONG *pDelta) 01043 { 01044 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01045 if (!This->reOle) 01046 return CO_E_RELEASED; 01047 01048 FIXME("not implemented\n"); 01049 return E_NOTIMPL; 01050 } 01051 01052 static HRESULT WINAPI ITextSelection_fnEndOf(ITextSelection *me, LONG Unit, LONG Extend, 01053 LONG *pDelta) 01054 { 01055 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01056 if (!This->reOle) 01057 return CO_E_RELEASED; 01058 01059 FIXME("not implemented\n"); 01060 return E_NOTIMPL; 01061 } 01062 01063 static HRESULT WINAPI ITextSelection_fnMove(ITextSelection *me, LONG Unit, LONG Count, LONG *pDelta) 01064 { 01065 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01066 if (!This->reOle) 01067 return CO_E_RELEASED; 01068 01069 FIXME("not implemented\n"); 01070 return E_NOTIMPL; 01071 } 01072 01073 static HRESULT WINAPI ITextSelection_fnMoveStart(ITextSelection *me, LONG Unit, LONG Count, 01074 LONG *pDelta) 01075 { 01076 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01077 if (!This->reOle) 01078 return CO_E_RELEASED; 01079 01080 FIXME("not implemented\n"); 01081 return E_NOTIMPL; 01082 } 01083 01084 static HRESULT WINAPI ITextSelection_fnMoveEnd(ITextSelection *me, LONG Unit, LONG Count, 01085 LONG *pDelta) 01086 { 01087 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01088 if (!This->reOle) 01089 return CO_E_RELEASED; 01090 01091 FIXME("not implemented\n"); 01092 return E_NOTIMPL; 01093 } 01094 01095 static HRESULT WINAPI ITextSelection_fnMoveWhile(ITextSelection *me, VARIANT *Cset, LONG Count, 01096 LONG *pDelta) 01097 { 01098 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01099 if (!This->reOle) 01100 return CO_E_RELEASED; 01101 01102 FIXME("not implemented\n"); 01103 return E_NOTIMPL; 01104 } 01105 01106 static HRESULT WINAPI ITextSelection_fnMoveStartWhile(ITextSelection *me, VARIANT *Cset, LONG Count, 01107 LONG *pDelta) 01108 { 01109 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01110 if (!This->reOle) 01111 return CO_E_RELEASED; 01112 01113 FIXME("not implemented\n"); 01114 return E_NOTIMPL; 01115 } 01116 01117 static HRESULT WINAPI ITextSelection_fnMoveEndWhile(ITextSelection *me, VARIANT *Cset, LONG Count, 01118 LONG *pDelta) 01119 { 01120 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01121 if (!This->reOle) 01122 return CO_E_RELEASED; 01123 01124 FIXME("not implemented\n"); 01125 return E_NOTIMPL; 01126 } 01127 01128 static HRESULT WINAPI ITextSelection_fnMoveUntil(ITextSelection *me, VARIANT *Cset, LONG Count, 01129 LONG *pDelta) 01130 { 01131 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01132 if (!This->reOle) 01133 return CO_E_RELEASED; 01134 01135 FIXME("not implemented\n"); 01136 return E_NOTIMPL; 01137 } 01138 01139 static HRESULT WINAPI ITextSelection_fnMoveStartUntil(ITextSelection *me, VARIANT *Cset, LONG Count, 01140 LONG *pDelta) 01141 { 01142 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01143 if (!This->reOle) 01144 return CO_E_RELEASED; 01145 01146 FIXME("not implemented\n"); 01147 return E_NOTIMPL; 01148 } 01149 01150 static HRESULT WINAPI ITextSelection_fnMoveEndUntil(ITextSelection *me, VARIANT *Cset, LONG Count, 01151 LONG *pDelta) 01152 { 01153 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01154 if (!This->reOle) 01155 return CO_E_RELEASED; 01156 01157 FIXME("not implemented\n"); 01158 return E_NOTIMPL; 01159 } 01160 01161 static HRESULT WINAPI ITextSelection_fnFindText(ITextSelection *me, BSTR bstr, LONG cch, LONG Flags, 01162 LONG *pLength) 01163 { 01164 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01165 if (!This->reOle) 01166 return CO_E_RELEASED; 01167 01168 FIXME("not implemented\n"); 01169 return E_NOTIMPL; 01170 } 01171 01172 static HRESULT WINAPI ITextSelection_fnFindTextStart(ITextSelection *me, BSTR bstr, LONG cch, 01173 LONG Flags, LONG *pLength) 01174 { 01175 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01176 if (!This->reOle) 01177 return CO_E_RELEASED; 01178 01179 FIXME("not implemented\n"); 01180 return E_NOTIMPL; 01181 } 01182 01183 static HRESULT WINAPI ITextSelection_fnFindTextEnd(ITextSelection *me, BSTR bstr, LONG cch, 01184 LONG Flags, LONG *pLength) 01185 { 01186 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01187 if (!This->reOle) 01188 return CO_E_RELEASED; 01189 01190 FIXME("not implemented\n"); 01191 return E_NOTIMPL; 01192 } 01193 01194 static HRESULT WINAPI ITextSelection_fnDelete(ITextSelection *me, LONG Unit, LONG Count, 01195 LONG *pDelta) 01196 { 01197 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01198 if (!This->reOle) 01199 return CO_E_RELEASED; 01200 01201 FIXME("not implemented\n"); 01202 return E_NOTIMPL; 01203 } 01204 01205 static HRESULT WINAPI ITextSelection_fnCut(ITextSelection *me, VARIANT *pVar) 01206 { 01207 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01208 if (!This->reOle) 01209 return CO_E_RELEASED; 01210 01211 FIXME("not implemented\n"); 01212 return E_NOTIMPL; 01213 } 01214 01215 static HRESULT WINAPI ITextSelection_fnCopy(ITextSelection *me, VARIANT *pVar) 01216 { 01217 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01218 if (!This->reOle) 01219 return CO_E_RELEASED; 01220 01221 FIXME("not implemented\n"); 01222 return E_NOTIMPL; 01223 } 01224 01225 static HRESULT WINAPI ITextSelection_fnPaste(ITextSelection *me, VARIANT *pVar, LONG Format) 01226 { 01227 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01228 if (!This->reOle) 01229 return CO_E_RELEASED; 01230 01231 FIXME("not implemented\n"); 01232 return E_NOTIMPL; 01233 } 01234 01235 static HRESULT WINAPI ITextSelection_fnCanPaste(ITextSelection *me, VARIANT *pVar, LONG Format, 01236 LONG *pb) 01237 { 01238 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01239 if (!This->reOle) 01240 return CO_E_RELEASED; 01241 01242 FIXME("not implemented\n"); 01243 return E_NOTIMPL; 01244 } 01245 01246 static HRESULT WINAPI ITextSelection_fnCanEdit(ITextSelection *me, LONG *pb) 01247 { 01248 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01249 if (!This->reOle) 01250 return CO_E_RELEASED; 01251 01252 FIXME("not implemented\n"); 01253 return E_NOTIMPL; 01254 } 01255 01256 static HRESULT WINAPI ITextSelection_fnChangeCase(ITextSelection *me, LONG Type) 01257 { 01258 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01259 if (!This->reOle) 01260 return CO_E_RELEASED; 01261 01262 FIXME("not implemented\n"); 01263 return E_NOTIMPL; 01264 } 01265 01266 static HRESULT WINAPI ITextSelection_fnGetPoint(ITextSelection *me, LONG Type, LONG *cx, LONG *cy) 01267 { 01268 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01269 if (!This->reOle) 01270 return CO_E_RELEASED; 01271 01272 FIXME("not implemented\n"); 01273 return E_NOTIMPL; 01274 } 01275 01276 static HRESULT WINAPI ITextSelection_fnSetPoint(ITextSelection *me, LONG x, LONG y, LONG Type, 01277 LONG Extend) 01278 { 01279 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01280 if (!This->reOle) 01281 return CO_E_RELEASED; 01282 01283 FIXME("not implemented\n"); 01284 return E_NOTIMPL; 01285 } 01286 01287 static HRESULT WINAPI ITextSelection_fnScrollIntoView(ITextSelection *me, LONG Value) 01288 { 01289 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01290 if (!This->reOle) 01291 return CO_E_RELEASED; 01292 01293 FIXME("not implemented\n"); 01294 return E_NOTIMPL; 01295 } 01296 01297 static HRESULT WINAPI ITextSelection_fnGetEmbeddedObject(ITextSelection *me, IUnknown **ppv) 01298 { 01299 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01300 if (!This->reOle) 01301 return CO_E_RELEASED; 01302 01303 FIXME("not implemented\n"); 01304 return E_NOTIMPL; 01305 } 01306 01307 /*** ITextSelection methods ***/ 01308 static HRESULT WINAPI ITextSelection_fnGetFlags(ITextSelection *me, LONG *pFlags) 01309 { 01310 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01311 if (!This->reOle) 01312 return CO_E_RELEASED; 01313 01314 FIXME("not implemented\n"); 01315 return E_NOTIMPL; 01316 } 01317 01318 static HRESULT WINAPI ITextSelection_fnSetFlags(ITextSelection *me, LONG Flags) 01319 { 01320 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01321 if (!This->reOle) 01322 return CO_E_RELEASED; 01323 01324 FIXME("not implemented\n"); 01325 return E_NOTIMPL; 01326 } 01327 01328 static HRESULT WINAPI ITextSelection_fnGetType(ITextSelection *me, LONG *pType) 01329 { 01330 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01331 if (!This->reOle) 01332 return CO_E_RELEASED; 01333 01334 FIXME("not implemented\n"); 01335 return E_NOTIMPL; 01336 } 01337 01338 static HRESULT WINAPI ITextSelection_fnMoveLeft(ITextSelection *me, LONG Unit, LONG Count, 01339 LONG Extend, LONG *pDelta) 01340 { 01341 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01342 if (!This->reOle) 01343 return CO_E_RELEASED; 01344 01345 FIXME("not implemented\n"); 01346 return E_NOTIMPL; 01347 } 01348 01349 static HRESULT WINAPI ITextSelection_fnMoveRight(ITextSelection *me, LONG Unit, LONG Count, 01350 LONG Extend, LONG *pDelta) 01351 { 01352 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01353 if (!This->reOle) 01354 return CO_E_RELEASED; 01355 01356 FIXME("not implemented\n"); 01357 return E_NOTIMPL; 01358 } 01359 01360 static HRESULT WINAPI ITextSelection_fnMoveUp(ITextSelection *me, LONG Unit, LONG Count, 01361 LONG Extend, LONG *pDelta) 01362 { 01363 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01364 if (!This->reOle) 01365 return CO_E_RELEASED; 01366 01367 FIXME("not implemented\n"); 01368 return E_NOTIMPL; 01369 } 01370 01371 static HRESULT WINAPI ITextSelection_fnMoveDown(ITextSelection *me, LONG Unit, LONG Count, 01372 LONG Extend, LONG *pDelta) 01373 { 01374 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01375 if (!This->reOle) 01376 return CO_E_RELEASED; 01377 01378 FIXME("not implemented\n"); 01379 return E_NOTIMPL; 01380 } 01381 01382 static HRESULT WINAPI ITextSelection_fnHomeKey(ITextSelection *me, LONG Unit, LONG Extend, 01383 LONG *pDelta) 01384 { 01385 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01386 if (!This->reOle) 01387 return CO_E_RELEASED; 01388 01389 FIXME("not implemented\n"); 01390 return E_NOTIMPL; 01391 } 01392 01393 static HRESULT WINAPI ITextSelection_fnEndKey(ITextSelection *me, LONG Unit, LONG Extend, 01394 LONG *pDelta) 01395 { 01396 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01397 if (!This->reOle) 01398 return CO_E_RELEASED; 01399 01400 FIXME("not implemented\n"); 01401 return E_NOTIMPL; 01402 } 01403 01404 static HRESULT WINAPI ITextSelection_fnTypeText(ITextSelection *me, BSTR bstr) 01405 { 01406 ITextSelectionImpl *This = impl_from_ITextSelection(me); 01407 if (!This->reOle) 01408 return CO_E_RELEASED; 01409 01410 FIXME("not implemented\n"); 01411 return E_NOTIMPL; 01412 } 01413 01414 static const ITextSelectionVtbl tsvt = { 01415 ITextSelection_fnQueryInterface, 01416 ITextSelection_fnAddRef, 01417 ITextSelection_fnRelease, 01418 ITextSelection_fnGetTypeInfoCount, 01419 ITextSelection_fnGetTypeInfo, 01420 ITextSelection_fnGetIDsOfNames, 01421 ITextSelection_fnInvoke, 01422 ITextSelection_fnGetText, 01423 ITextSelection_fnSetText, 01424 ITextSelection_fnGetChar, 01425 ITextSelection_fnSetChar, 01426 ITextSelection_fnGetDuplicate, 01427 ITextSelection_fnGetFormattedText, 01428 ITextSelection_fnSetFormattedText, 01429 ITextSelection_fnGetStart, 01430 ITextSelection_fnSetStart, 01431 ITextSelection_fnGetEnd, 01432 ITextSelection_fnSetEnd, 01433 ITextSelection_fnGetFont, 01434 ITextSelection_fnSetFont, 01435 ITextSelection_fnGetPara, 01436 ITextSelection_fnSetPara, 01437 ITextSelection_fnGetStoryLength, 01438 ITextSelection_fnGetStoryType, 01439 ITextSelection_fnCollapse, 01440 ITextSelection_fnExpand, 01441 ITextSelection_fnGetIndex, 01442 ITextSelection_fnSetIndex, 01443 ITextSelection_fnSetRange, 01444 ITextSelection_fnInRange, 01445 ITextSelection_fnInStory, 01446 ITextSelection_fnIsEqual, 01447 ITextSelection_fnSelect, 01448 ITextSelection_fnStartOf, 01449 ITextSelection_fnEndOf, 01450 ITextSelection_fnMove, 01451 ITextSelection_fnMoveStart, 01452 ITextSelection_fnMoveEnd, 01453 ITextSelection_fnMoveWhile, 01454 ITextSelection_fnMoveStartWhile, 01455 ITextSelection_fnMoveEndWhile, 01456 ITextSelection_fnMoveUntil, 01457 ITextSelection_fnMoveStartUntil, 01458 ITextSelection_fnMoveEndUntil, 01459 ITextSelection_fnFindText, 01460 ITextSelection_fnFindTextStart, 01461 ITextSelection_fnFindTextEnd, 01462 ITextSelection_fnDelete, 01463 ITextSelection_fnCut, 01464 ITextSelection_fnCopy, 01465 ITextSelection_fnPaste, 01466 ITextSelection_fnCanPaste, 01467 ITextSelection_fnCanEdit, 01468 ITextSelection_fnChangeCase, 01469 ITextSelection_fnGetPoint, 01470 ITextSelection_fnSetPoint, 01471 ITextSelection_fnScrollIntoView, 01472 ITextSelection_fnGetEmbeddedObject, 01473 ITextSelection_fnGetFlags, 01474 ITextSelection_fnSetFlags, 01475 ITextSelection_fnGetType, 01476 ITextSelection_fnMoveLeft, 01477 ITextSelection_fnMoveRight, 01478 ITextSelection_fnMoveUp, 01479 ITextSelection_fnMoveDown, 01480 ITextSelection_fnHomeKey, 01481 ITextSelection_fnEndKey, 01482 ITextSelection_fnTypeText 01483 }; 01484 01485 static ITextSelectionImpl * 01486 CreateTextSelection(IRichEditOleImpl *reOle) 01487 { 01488 ITextSelectionImpl *txtSel = heap_alloc(sizeof *txtSel); 01489 if (!txtSel) 01490 return NULL; 01491 01492 txtSel->ITextSelection_iface.lpVtbl = &tsvt; 01493 txtSel->ref = 1; 01494 txtSel->reOle = reOle; 01495 return txtSel; 01496 } 01497 01498 LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *ppObj) 01499 { 01500 IRichEditOleImpl *reo; 01501 01502 reo = heap_alloc(sizeof(IRichEditOleImpl)); 01503 if (!reo) 01504 return 0; 01505 01506 reo->IRichEditOle_iface.lpVtbl = &revt; 01507 reo->ITextDocument_iface.lpVtbl = &tdvt; 01508 reo->ref = 1; 01509 reo->editor = editor; 01510 reo->txtSel = CreateTextSelection(reo); 01511 if (!reo->txtSel) 01512 { 01513 heap_free(reo); 01514 return 0; 01515 } 01516 reo->clientSite = CreateOleClientSite(reo); 01517 if (!reo->txtSel) 01518 { 01519 ITextSelection_Release(&reo->txtSel->ITextSelection_iface); 01520 heap_free(reo); 01521 return 0; 01522 } 01523 TRACE("Created %p\n",reo); 01524 *ppObj = reo; 01525 01526 return 1; 01527 } 01528 01529 static void convert_sizel(const ME_Context *c, const SIZEL* szl, SIZE* sz) 01530 { 01531 /* sizel is in .01 millimeters, sz in pixels */ 01532 sz->cx = MulDiv(szl->cx, c->dpi.cx, 2540); 01533 sz->cy = MulDiv(szl->cy, c->dpi.cy, 2540); 01534 } 01535 01536 /****************************************************************************** 01537 * ME_GetOLEObjectSize 01538 * 01539 * Sets run extent for OLE objects. 01540 */ 01541 void ME_GetOLEObjectSize(const ME_Context *c, ME_Run *run, SIZE *pSize) 01542 { 01543 IDataObject* ido; 01544 FORMATETC fmt; 01545 STGMEDIUM stgm; 01546 DIBSECTION dibsect; 01547 ENHMETAHEADER emh; 01548 01549 assert(run->nFlags & MERF_GRAPHICS); 01550 assert(run->ole_obj); 01551 01552 if (run->ole_obj->sizel.cx != 0 || run->ole_obj->sizel.cy != 0) 01553 { 01554 convert_sizel(c, &run->ole_obj->sizel, pSize); 01555 if (c->editor->nZoomNumerator != 0) 01556 { 01557 pSize->cx = MulDiv(pSize->cx, c->editor->nZoomNumerator, c->editor->nZoomDenominator); 01558 pSize->cy = MulDiv(pSize->cy, c->editor->nZoomNumerator, c->editor->nZoomDenominator); 01559 } 01560 return; 01561 } 01562 01563 IOleObject_QueryInterface(run->ole_obj->poleobj, &IID_IDataObject, (void**)&ido); 01564 fmt.cfFormat = CF_BITMAP; 01565 fmt.ptd = NULL; 01566 fmt.dwAspect = DVASPECT_CONTENT; 01567 fmt.lindex = -1; 01568 fmt.tymed = TYMED_GDI; 01569 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK) 01570 { 01571 fmt.cfFormat = CF_ENHMETAFILE; 01572 fmt.tymed = TYMED_ENHMF; 01573 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK) 01574 { 01575 FIXME("unsupported format\n"); 01576 pSize->cx = pSize->cy = 0; 01577 IDataObject_Release(ido); 01578 return; 01579 } 01580 } 01581 01582 switch (stgm.tymed) 01583 { 01584 case TYMED_GDI: 01585 GetObjectW(stgm.u.hBitmap, sizeof(dibsect), &dibsect); 01586 pSize->cx = dibsect.dsBm.bmWidth; 01587 pSize->cy = dibsect.dsBm.bmHeight; 01588 if (!stgm.pUnkForRelease) DeleteObject(stgm.u.hBitmap); 01589 break; 01590 case TYMED_ENHMF: 01591 GetEnhMetaFileHeader(stgm.u.hEnhMetaFile, sizeof(emh), &emh); 01592 pSize->cx = emh.rclBounds.right - emh.rclBounds.left; 01593 pSize->cy = emh.rclBounds.bottom - emh.rclBounds.top; 01594 if (!stgm.pUnkForRelease) DeleteEnhMetaFile(stgm.u.hEnhMetaFile); 01595 break; 01596 default: 01597 FIXME("Unsupported tymed %d\n", stgm.tymed); 01598 break; 01599 } 01600 IDataObject_Release(ido); 01601 if (c->editor->nZoomNumerator != 0) 01602 { 01603 pSize->cx = MulDiv(pSize->cx, c->editor->nZoomNumerator, c->editor->nZoomDenominator); 01604 pSize->cy = MulDiv(pSize->cy, c->editor->nZoomNumerator, c->editor->nZoomDenominator); 01605 } 01606 } 01607 01608 void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run *run, 01609 ME_Paragraph *para, BOOL selected) 01610 { 01611 IDataObject* ido; 01612 FORMATETC fmt; 01613 STGMEDIUM stgm; 01614 DIBSECTION dibsect; 01615 ENHMETAHEADER emh; 01616 HDC hMemDC; 01617 SIZE sz; 01618 BOOL has_size; 01619 01620 assert(run->nFlags & MERF_GRAPHICS); 01621 assert(run->ole_obj); 01622 if (IOleObject_QueryInterface(run->ole_obj->poleobj, &IID_IDataObject, (void**)&ido) != S_OK) 01623 { 01624 FIXME("Couldn't get interface\n"); 01625 return; 01626 } 01627 has_size = run->ole_obj->sizel.cx != 0 || run->ole_obj->sizel.cy != 0; 01628 fmt.cfFormat = CF_BITMAP; 01629 fmt.ptd = NULL; 01630 fmt.dwAspect = DVASPECT_CONTENT; 01631 fmt.lindex = -1; 01632 fmt.tymed = TYMED_GDI; 01633 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK) 01634 { 01635 fmt.cfFormat = CF_ENHMETAFILE; 01636 fmt.tymed = TYMED_ENHMF; 01637 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK) 01638 { 01639 FIXME("Couldn't get storage medium\n"); 01640 IDataObject_Release(ido); 01641 return; 01642 } 01643 } 01644 switch (stgm.tymed) 01645 { 01646 case TYMED_GDI: 01647 GetObjectW(stgm.u.hBitmap, sizeof(dibsect), &dibsect); 01648 hMemDC = CreateCompatibleDC(c->hDC); 01649 SelectObject(hMemDC, stgm.u.hBitmap); 01650 if (has_size) 01651 { 01652 convert_sizel(c, &run->ole_obj->sizel, &sz); 01653 } else { 01654 sz.cx = MulDiv(dibsect.dsBm.bmWidth, c->dpi.cx, 96); 01655 sz.cy = MulDiv(dibsect.dsBm.bmHeight, c->dpi.cy, 96); 01656 } 01657 if (c->editor->nZoomNumerator != 0) 01658 { 01659 sz.cx = MulDiv(sz.cx, c->editor->nZoomNumerator, c->editor->nZoomDenominator); 01660 sz.cy = MulDiv(sz.cy, c->editor->nZoomNumerator, c->editor->nZoomDenominator); 01661 } 01662 if (sz.cx == dibsect.dsBm.bmWidth && sz.cy == dibsect.dsBm.bmHeight) 01663 { 01664 BitBlt(c->hDC, x, y - sz.cy, 01665 dibsect.dsBm.bmWidth, dibsect.dsBm.bmHeight, 01666 hMemDC, 0, 0, SRCCOPY); 01667 } else { 01668 StretchBlt(c->hDC, x, y - sz.cy, sz.cx, sz.cy, 01669 hMemDC, 0, 0, dibsect.dsBm.bmWidth, 01670 dibsect.dsBm.bmHeight, SRCCOPY); 01671 } 01672 DeleteDC(hMemDC); 01673 if (!stgm.pUnkForRelease) DeleteObject(stgm.u.hBitmap); 01674 break; 01675 case TYMED_ENHMF: 01676 GetEnhMetaFileHeader(stgm.u.hEnhMetaFile, sizeof(emh), &emh); 01677 if (has_size) 01678 { 01679 convert_sizel(c, &run->ole_obj->sizel, &sz); 01680 } else { 01681 sz.cy = MulDiv(emh.rclBounds.bottom - emh.rclBounds.top, c->dpi.cx, 96); 01682 sz.cx = MulDiv(emh.rclBounds.right - emh.rclBounds.left, c->dpi.cy, 96); 01683 } 01684 if (c->editor->nZoomNumerator != 0) 01685 { 01686 sz.cx = MulDiv(sz.cx, c->editor->nZoomNumerator, c->editor->nZoomDenominator); 01687 sz.cy = MulDiv(sz.cy, c->editor->nZoomNumerator, c->editor->nZoomDenominator); 01688 } 01689 01690 { 01691 RECT rc; 01692 01693 rc.left = x; 01694 rc.top = y - sz.cy; 01695 rc.right = x + sz.cx; 01696 rc.bottom = y; 01697 PlayEnhMetaFile(c->hDC, stgm.u.hEnhMetaFile, &rc); 01698 } 01699 if (!stgm.pUnkForRelease) DeleteEnhMetaFile(stgm.u.hEnhMetaFile); 01700 break; 01701 default: 01702 FIXME("Unsupported tymed %d\n", stgm.tymed); 01703 selected = FALSE; 01704 break; 01705 } 01706 if (selected && !c->editor->bHideSelection) 01707 PatBlt(c->hDC, x, y - sz.cy, sz.cx, sz.cy, DSTINVERT); 01708 IDataObject_Release(ido); 01709 } 01710 01711 void ME_DeleteReObject(REOBJECT* reo) 01712 { 01713 if (reo->poleobj) IOleObject_Release(reo->poleobj); 01714 if (reo->pstg) IStorage_Release(reo->pstg); 01715 if (reo->polesite) IOleClientSite_Release(reo->polesite); 01716 FREE_OBJ(reo); 01717 } 01718 01719 void ME_CopyReObject(REOBJECT* dst, const REOBJECT* src) 01720 { 01721 *dst = *src; 01722 01723 if (dst->poleobj) IOleObject_AddRef(dst->poleobj); 01724 if (dst->pstg) IStorage_AddRef(dst->pstg); 01725 if (dst->polesite) IOleClientSite_AddRef(dst->polesite); 01726 } Generated on Sun May 27 2012 04:25:59 for ReactOS by
1.7.6.1
|