1 /*
2 * RichEdit GUIDs and OLE interface
3 *
4 * Copyright 2004 by Krzysztof Foltman
5 * Copyright 2004 Aric Stewart
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22 #include <stdarg.h>
23
24 #define NONAMELESSUNION
25 #define NONAMELESSSTRUCT
26 #define COBJMACROS
27
28 #include "windef.h"
29 #include "winbase.h"
30 #include "wingdi.h"
31 #include "winuser.h"
32 #include "ole2.h"
33 #include "richole.h"
34 #include "editor.h"
35 #include "tom.h"
36 #include "wine/debug.h"
37
38 WINE_DEFAULT_DEBUG_CHANNEL(richedit);
39
40 /* there is no way to be consistent across different sets of headers - mingw, Wine, Win32 SDK*/
41
42 /* FIXME: the next 6 lines should be in textserv.h */
43 #include "initguid.h"
44 #define TEXTSERV_GUID(name, l, w1, w2, b1, b2) \
45 DEFINE_GUID(name, l, w1, w2, b1, b2, 0x00, 0xaa, 0x00, 0x6c, 0xad, 0xc5)
46
47 TEXTSERV_GUID(IID_ITextServices, 0x8d33f740, 0xcf58, 0x11ce, 0xa8, 0x9d);
48 TEXTSERV_GUID(IID_ITextHost, 0xc5bdd8d0, 0xd26e, 0x11ce, 0xa8, 0x9e);
49 TEXTSERV_GUID(IID_ITextHost2, 0xc5bdd8d0, 0xd26e, 0x11ce, 0xa8, 0x9e);
50 DEFINE_GUID(IID_ITextDocument, 0x8cc497c0, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
51 DEFINE_GUID(IID_ITextRange, 0x8cc497c2, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
52 DEFINE_GUID(IID_ITextSelection, 0x8cc497c1, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
53
54 typedef struct ITextSelectionImpl ITextSelectionImpl;
55
56 typedef struct IRichEditOleImpl {
57 const IRichEditOleVtbl *lpRichEditOleVtbl;
58 const ITextDocumentVtbl *lpTextDocumentVtbl;
59 LONG ref;
60
61 ME_TextEditor *editor;
62 ITextSelectionImpl *txtSel;
63 } IRichEditOleImpl;
64
65 struct ITextSelectionImpl {
66 const ITextSelectionVtbl *lpVtbl;
67 LONG ref;
68
69 IRichEditOleImpl *reOle;
70 };
71
72 static inline IRichEditOleImpl *impl_from_IRichEditOle(IRichEditOle *iface)
73 {
74 return (IRichEditOleImpl *)((BYTE*)iface - FIELD_OFFSET(IRichEditOleImpl, lpRichEditOleVtbl));
75 }
76
77 static inline IRichEditOleImpl *impl_from_ITextDocument(ITextDocument *iface)
78 {
79 return (IRichEditOleImpl *)((BYTE*)iface - FIELD_OFFSET(IRichEditOleImpl, lpTextDocumentVtbl));
80 }
81
82 static HRESULT WINAPI
83 IRichEditOle_fnQueryInterface(IRichEditOle *me, REFIID riid, LPVOID *ppvObj)
84 {
85 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
86
87 TRACE("%p %s\n", This, debugstr_guid(riid) );
88
89 *ppvObj = NULL;
90 if (IsEqualGUID(riid, &IID_IUnknown) ||
91 IsEqualGUID(riid, &IID_IRichEditOle))
92 *ppvObj = &This->lpRichEditOleVtbl;
93 else if (IsEqualGUID(riid, &IID_ITextDocument))
94 *ppvObj = &This->lpTextDocumentVtbl;
95 if (*ppvObj)
96 {
97 IRichEditOle_AddRef(me);
98 return S_OK;
99 }
100 FIXME("%p: unhandled interface %s\n", This, debugstr_guid(riid) );
101
102 return E_NOINTERFACE;
103 }
104
105 static ULONG WINAPI
106 IRichEditOle_fnAddRef(IRichEditOle *me)
107 {
108 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
109 ULONG ref = InterlockedIncrement( &This->ref );
110
111 TRACE("%p ref = %u\n", This, ref);
112
113 return ref;
114 }
115
116 static ULONG WINAPI
117 IRichEditOle_fnRelease(IRichEditOle *me)
118 {
119 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
120 ULONG ref = InterlockedDecrement(&This->ref);
121
122 TRACE ("%p ref=%u\n", This, ref);
123
124 if (!ref)
125 {
126 TRACE ("Destroying %p\n", This);
127 This->txtSel->reOle = NULL;
128 ITextSelection_Release((ITextSelection *) This->txtSel);
129 heap_free(This);
130 }
131 return ref;
132 }
133
134 static HRESULT WINAPI
135 IRichEditOle_fnActivateAs(IRichEditOle *me, REFCLSID rclsid, REFCLSID rclsidAs)
136 {
137 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
138 FIXME("stub %p\n",This);
139 return E_NOTIMPL;
140 }
141
142 static HRESULT WINAPI
143 IRichEditOle_fnContextSensitiveHelp(IRichEditOle *me, BOOL fEnterMode)
144 {
145 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
146 FIXME("stub %p\n",This);
147 return E_NOTIMPL;
148 }
149
150 static HRESULT WINAPI
151 IRichEditOle_fnConvertObject(IRichEditOle *me, LONG iob,
152 REFCLSID rclsidNew, LPCSTR lpstrUserTypeNew)
153 {
154 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
155 FIXME("stub %p\n",This);
156 return E_NOTIMPL;
157 }
158
159 static HRESULT WINAPI
160 IRichEditOle_fnGetClientSite(IRichEditOle *me,
161 LPOLECLIENTSITE *lplpolesite)
162 {
163 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
164 FIXME("stub %p\n",This);
165 return E_NOTIMPL;
166 }
167
168 static HRESULT WINAPI
169 IRichEditOle_fnGetClipboardData(IRichEditOle *me, CHARRANGE *lpchrg,
170 DWORD reco, LPDATAOBJECT *lplpdataobj)
171 {
172 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
173 CHARRANGE tmpchrg;
174
175 TRACE("(%p,%p,%d)\n",This, lpchrg, reco);
176 if(!lplpdataobj)
177 return E_INVALIDARG;
178 if(!lpchrg) {
179 ME_GetSelection(This->editor, &tmpchrg.cpMin, &tmpchrg.cpMax);
180 lpchrg = &tmpchrg;
181 }
182 return ME_GetDataObject(This->editor, lpchrg, lplpdataobj);
183 }
184
185 static LONG WINAPI IRichEditOle_fnGetLinkCount(IRichEditOle *me)
186 {
187 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
188 FIXME("stub %p\n",This);
189 return E_NOTIMPL;
190 }
191
192 static HRESULT WINAPI
193 IRichEditOle_fnGetObject(IRichEditOle *me, LONG iob,
194 REOBJECT *lpreobject, DWORD dwFlags)
195 {
196 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
197 FIXME("stub %p\n",This);
198 return E_NOTIMPL;
199 }
200
201 static LONG WINAPI
202 IRichEditOle_fnGetObjectCount(IRichEditOle *me)
203 {
204 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
205 FIXME("stub %p\n",This);
206 return E_NOTIMPL;
207 }
208
209 static HRESULT WINAPI
210 IRichEditOle_fnHandsOffStorage(IRichEditOle *me, LONG iob)
211 {
212 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
213 FIXME("stub %p\n",This);
214 return E_NOTIMPL;
215 }
216
217 static HRESULT WINAPI
218 IRichEditOle_fnImportDataObject(IRichEditOle *me, LPDATAOBJECT lpdataobj,
219 CLIPFORMAT cf, HGLOBAL hMetaPict)
220 {
221 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
222 FIXME("stub %p\n",This);
223 return E_NOTIMPL;
224 }
225
226 static HRESULT WINAPI
227 IRichEditOle_fnInPlaceDeactivate(IRichEditOle *me)
228 {
229 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
230 FIXME("stub %p\n",This);
231 return E_NOTIMPL;
232 }
233
234 static HRESULT WINAPI
235 IRichEditOle_fnInsertObject(IRichEditOle *me, REOBJECT *reo)
236 {
237 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
238 TRACE("(%p,%p)\n", This, reo);
239
240 if (reo->cbStruct < sizeof(*reo)) return STG_E_INVALIDPARAMETER;
241 if (reo->poleobj) IOleObject_AddRef(reo->poleobj);
242 if (reo->pstg) IStorage_AddRef(reo->pstg);
243 if (reo->polesite) IOleClientSite_AddRef(reo->polesite);
244
245 ME_InsertOLEFromCursor(This->editor, reo, 0);
246 return S_OK;
247 }
248
249 static HRESULT WINAPI IRichEditOle_fnSaveCompleted(IRichEditOle *me, LONG iob,
250 LPSTORAGE lpstg)
251 {
252 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
253 FIXME("stub %p\n",This);
254 return E_NOTIMPL;
255 }
256
257 static HRESULT WINAPI
258 IRichEditOle_fnSetDvaspect(IRichEditOle *me, LONG iob, DWORD dvaspect)
259 {
260 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
261 FIXME("stub %p\n",This);
262 return E_NOTIMPL;
263 }
264
265 static HRESULT WINAPI IRichEditOle_fnSetHostNames(IRichEditOle *me,
266 LPCSTR lpstrContainerApp, LPCSTR lpstrContainerObj)
267 {
268 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
269 FIXME("stub %p %s %s\n",This, lpstrContainerApp, lpstrContainerObj);
270 return E_NOTIMPL;
271 }
272
273 static HRESULT WINAPI
274 IRichEditOle_fnSetLinkAvailable(IRichEditOle *me, LONG iob, BOOL fAvailable)
275 {
276 IRichEditOleImpl *This = impl_from_IRichEditOle(me);
277 FIXME("stub %p\n",This);
278 return E_NOTIMPL;
279 }
280
281 static const IRichEditOleVtbl revt = {
282 IRichEditOle_fnQueryInterface,
283 IRichEditOle_fnAddRef,
284 IRichEditOle_fnRelease,
285 IRichEditOle_fnGetClientSite,
286 IRichEditOle_fnGetObjectCount,
287 IRichEditOle_fnGetLinkCount,
288 IRichEditOle_fnGetObject,
289 IRichEditOle_fnInsertObject,
290 IRichEditOle_fnConvertObject,
291 IRichEditOle_fnActivateAs,
292 IRichEditOle_fnSetHostNames,
293 IRichEditOle_fnSetLinkAvailable,
294 IRichEditOle_fnSetDvaspect,
295 IRichEditOle_fnHandsOffStorage,
296 IRichEditOle_fnSaveCompleted,
297 IRichEditOle_fnInPlaceDeactivate,
298 IRichEditOle_fnContextSensitiveHelp,
299 IRichEditOle_fnGetClipboardData,
300 IRichEditOle_fnImportDataObject
301 };
302
303 static HRESULT WINAPI
304 ITextDocument_fnQueryInterface(ITextDocument* me, REFIID riid,
305 void** ppvObject)
306 {
307 IRichEditOleImpl *This = impl_from_ITextDocument(me);
308 return IRichEditOle_fnQueryInterface((IRichEditOle*)&This->lpRichEditOleVtbl,
309 riid, ppvObject);
310 }
311
312 static ULONG WINAPI
313 ITextDocument_fnAddRef(ITextDocument* me)
314 {
315 IRichEditOleImpl *This = impl_from_ITextDocument(me);
316 return IRichEditOle_fnAddRef((IRichEditOle*)&This->lpRichEditOleVtbl);
317 }
318
319 static ULONG WINAPI
320 ITextDocument_fnRelease(ITextDocument* me)
321 {
322 IRichEditOleImpl *This = impl_from_ITextDocument(me);
323 return IRichEditOle_fnRelease((IRichEditOle*)&This->lpRichEditOleVtbl);
324 }
325
326 static HRESULT WINAPI
327 ITextDocument_fnGetTypeInfoCount(ITextDocument* me,
328 UINT* pctinfo)
329 {
330 IRichEditOleImpl *This = impl_from_ITextDocument(me);
331 FIXME("stub %p\n",This);
332 return E_NOTIMPL;
333 }
334
335 static HRESULT WINAPI
336 ITextDocument_fnGetTypeInfo(ITextDocument* me, UINT iTInfo, LCID lcid,
337 ITypeInfo** ppTInfo)
338 {
339 IRichEditOleImpl *This = impl_from_ITextDocument(me);
340 FIXME("stub %p\n",This);
341 return E_NOTIMPL;
342 }
343
344 static HRESULT WINAPI
345 ITextDocument_fnGetIDsOfNames(ITextDocument* me, REFIID riid,
346 LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId)
347 {
348 IRichEditOleImpl *This = impl_from_ITextDocument(me);
349 FIXME("stub %p\n",This);
350 return E_NOTIMPL;
351 }
352
353 static HRESULT WINAPI
354 ITextDocument_fnInvoke(ITextDocument* me, DISPID dispIdMember,
355 REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams,
356 VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr)
357 {
358 IRichEditOleImpl *This = impl_from_ITextDocument(me);
359 FIXME("stub %p\n",This);
360 return E_NOTIMPL;
361 }
362
363 static HRESULT WINAPI
364 ITextDocument_fnGetName(ITextDocument* me, BSTR* pName)
365 {
366 IRichEditOleImpl *This = impl_from_ITextDocument(me);
367 FIXME("stub %p\n",This);
368 return E_NOTIMPL;
369 }
370
371 static HRESULT WINAPI
372 ITextDocument_fnGetSelection(ITextDocument* me, ITextSelection** ppSel)
373 {
374 IRichEditOleImpl *This = impl_from_ITextDocument(me);
375 TRACE("(%p)\n", me);
376 *ppSel = (ITextSelection *) This->txtSel;
377 ITextSelection_AddRef(*ppSel);
378 return S_OK;
379 }
380
381 static HRESULT WINAPI
382 ITextDocument_fnGetStoryCount(ITextDocument* me, long* pCount)
383 {
384 IRichEditOleImpl *This = impl_from_ITextDocument(me);
385 FIXME("stub %p\n",This);
386 return E_NOTIMPL;
387 }
388
389 static HRESULT WINAPI
390 ITextDocument_fnGetStoryRanges(ITextDocument* me,
391 ITextStoryRanges** ppStories)
392 {
393 IRichEditOleImpl *This = impl_from_ITextDocument(me);
394 FIXME("stub %p\n",This);
395 return E_NOTIMPL;
396 }
397
398 static HRESULT WINAPI
399 ITextDocument_fnGetSaved(ITextDocument* me, long* pValue)
400 {
401 IRichEditOleImpl *This = impl_from_ITextDocument(me);
402 FIXME("stub %p\n",This);
403 return E_NOTIMPL;
404 }
405
406 static HRESULT WINAPI
407 ITextDocument_fnSetSaved(ITextDocument* me, long Value)
408 {
409 IRichEditOleImpl *This = impl_from_ITextDocument(me);
410 FIXME("stub %p\n",This);
411 return E_NOTIMPL;
412 }
413
414 static HRESULT WINAPI
415 ITextDocument_fnGetDefaultTabStop(ITextDocument* me, float* pValue)
416 {
417 IRichEditOleImpl *This = impl_from_ITextDocument(me);
418 FIXME("stub %p\n",This);
419 return E_NOTIMPL;
420 }
421
422 static HRESULT WINAPI
423 ITextDocument_fnSetDefaultTabStop(ITextDocument* me, float Value)
424 {
425 IRichEditOleImpl *This = impl_from_ITextDocument(me);
426 FIXME("stub %p\n",This);
427 return E_NOTIMPL;
428 }
429
430 static HRESULT WINAPI
431 ITextDocument_fnNew(ITextDocument* me)
432 {
433 IRichEditOleImpl *This = impl_from_ITextDocument(me);
434 FIXME("stub %p\n",This);
435 return E_NOTIMPL;
436 }
437
438 static HRESULT WINAPI
439 ITextDocument_fnOpen(ITextDocument* me, VARIANT* pVar, long Flags,
440 long CodePage)
441 {
442 IRichEditOleImpl *This = impl_from_ITextDocument(me);
443 FIXME("stub %p\n",This);
444 return E_NOTIMPL;
445 }
446
447 static HRESULT WINAPI
448 ITextDocument_fnSave(ITextDocument* me, VARIANT* pVar, long Flags,
449 long CodePage)
450 {
451 IRichEditOleImpl *This = impl_from_ITextDocument(me);
452 FIXME("stub %p\n",This);
453 return E_NOTIMPL;
454 }
455
456 static HRESULT WINAPI
457 ITextDocument_fnFreeze(ITextDocument* me, long* pCount)
458 {
459 IRichEditOleImpl *This = impl_from_ITextDocument(me);
460 FIXME("stub %p\n",This);
461 return E_NOTIMPL;
462 }
463
464 static HRESULT WINAPI
465 ITextDocument_fnUnfreeze(ITextDocument* me, long* pCount)
466 {
467 IRichEditOleImpl *This = impl_from_ITextDocument(me);
468 FIXME("stub %p\n",This);
469 return E_NOTIMPL;
470 }
471
472 static HRESULT WINAPI
473 ITextDocument_fnBeginEditCollection(ITextDocument* me)
474 {
475 IRichEditOleImpl *This = impl_from_ITextDocument(me);
476 FIXME("stub %p\n",This);
477 return E_NOTIMPL;
478 }
479
480 static HRESULT WINAPI
481 ITextDocument_fnEndEditCollection(ITextDocument* me)
482 {
483 IRichEditOleImpl *This = impl_from_ITextDocument(me);
484 FIXME("stub %p\n",This);
485 return E_NOTIMPL;
486 }
487
488 static HRESULT WINAPI
489 ITextDocument_fnUndo(ITextDocument* me, long Count, long* prop)
490 {
491 IRichEditOleImpl *This = impl_from_ITextDocument(me);
492 FIXME("stub %p\n",This);
493 return E_NOTIMPL;
494 }
495
496 static HRESULT WINAPI
497 ITextDocument_fnRedo(ITextDocument* me, long Count, long* prop)
498 {
499 IRichEditOleImpl *This = impl_from_ITextDocument(me);
500 FIXME("stub %p\n",This);
501 return E_NOTIMPL;
502 }
503
504 static HRESULT WINAPI
505 ITextDocument_fnRange(ITextDocument* me, long cp1, long cp2,
506 ITextRange** ppRange)
507 {
508 IRichEditOleImpl *This = impl_from_ITextDocument(me);
509 FIXME("stub %p\n",This);
510 return E_NOTIMPL;
511 }
512
513 static HRESULT WINAPI
514 ITextDocument_fnRangeFromPoint(ITextDocument* me, long x, long y,
515 ITextRange** ppRange)
516 {
517 IRichEditOleImpl *This = impl_from_ITextDocument(me);
518 FIXME("stub %p\n",This);
519 return E_NOTIMPL;
520 }
521
522 static const ITextDocumentVtbl tdvt = {
523 ITextDocument_fnQueryInterface,
524 ITextDocument_fnAddRef,
525 ITextDocument_fnRelease,
526 ITextDocument_fnGetTypeInfoCount,
527 ITextDocument_fnGetTypeInfo,
528 ITextDocument_fnGetIDsOfNames,
529 ITextDocument_fnInvoke,
530 ITextDocument_fnGetName,
531 ITextDocument_fnGetSelection,
532 ITextDocument_fnGetStoryCount,
533 ITextDocument_fnGetStoryRanges,
534 ITextDocument_fnGetSaved,
535 ITextDocument_fnSetSaved,
536 ITextDocument_fnGetDefaultTabStop,
537 ITextDocument_fnSetDefaultTabStop,
538 ITextDocument_fnNew,
539 ITextDocument_fnOpen,
540 ITextDocument_fnSave,
541 ITextDocument_fnFreeze,
542 ITextDocument_fnUnfreeze,
543 ITextDocument_fnBeginEditCollection,
544 ITextDocument_fnEndEditCollection,
545 ITextDocument_fnUndo,
546 ITextDocument_fnRedo,
547 ITextDocument_fnRange,
548 ITextDocument_fnRangeFromPoint
549 };
550
551 static HRESULT WINAPI ITextSelection_fnQueryInterface(
552 ITextSelection *me,
553 REFIID riid,
554 void **ppvObj)
555 {
556 *ppvObj = NULL;
557 if (IsEqualGUID(riid, &IID_IUnknown)
558 || IsEqualGUID(riid, &IID_IDispatch)
559 || IsEqualGUID(riid, &IID_ITextRange)
560 || IsEqualGUID(riid, &IID_ITextSelection))
561 {
562 *ppvObj = me;
563 ITextSelection_AddRef(me);
564 return S_OK;
565 }
566
567 return E_NOINTERFACE;
568 }
569
570 static ULONG WINAPI ITextSelection_fnAddRef(
571 ITextSelection *me)
572 {
573 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
574 return InterlockedIncrement(&This->ref);
575 }
576
577 static ULONG WINAPI ITextSelection_fnRelease(
578 ITextSelection *me)
579 {
580 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
581 ULONG ref = InterlockedDecrement(&This->ref);
582 if (ref == 0)
583 heap_free(This);
584 return ref;
585 }
586
587 static HRESULT WINAPI ITextSelection_fnGetTypeInfoCount(
588 ITextSelection *me,
589 UINT *pctinfo)
590 {
591 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
592 if (!This->reOle)
593 return CO_E_RELEASED;
594
595 FIXME("not implemented\n");
596 return E_NOTIMPL;
597 }
598
599 static HRESULT WINAPI ITextSelection_fnGetTypeInfo(
600 ITextSelection *me,
601 UINT iTInfo,
602 LCID lcid,
603 ITypeInfo **ppTInfo)
604 {
605 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
606 if (!This->reOle)
607 return CO_E_RELEASED;
608
609 FIXME("not implemented\n");
610 return E_NOTIMPL;
611 }
612
613 static HRESULT WINAPI ITextSelection_fnGetIDsOfNames(
614 ITextSelection *me,
615 REFIID riid,
616 LPOLESTR *rgszNames,
617 UINT cNames,
618 LCID lcid,
619 DISPID *rgDispId)
620 {
621 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
622 if (!This->reOle)
623 return CO_E_RELEASED;
624
625 FIXME("not implemented\n");
626 return E_NOTIMPL;
627 }
628
629 static HRESULT WINAPI ITextSelection_fnInvoke(
630 ITextSelection *me,
631 DISPID dispIdMember,
632 REFIID riid,
633 LCID lcid,
634 WORD wFlags,
635 DISPPARAMS *pDispParams,
636 VARIANT *pVarResult,
637 EXCEPINFO *pExcepInfo,
638 UINT *puArgErr)
639 {
640 FIXME("not implemented\n");
641 return E_NOTIMPL;
642 }
643
644 /*** ITextRange methods ***/
645 static HRESULT WINAPI ITextSelection_fnGetText(
646 ITextSelection *me,
647 BSTR *pbstr)
648 {
649 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
650 if (!This->reOle)
651 return CO_E_RELEASED;
652
653 FIXME("not implemented\n");
654 return E_NOTIMPL;
655 }
656
657 static HRESULT WINAPI ITextSelection_fnSetText(
658 ITextSelection *me,
659 BSTR bstr)
660 {
661 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
662 if (!This->reOle)
663 return CO_E_RELEASED;
664
665 FIXME("not implemented\n");
666 return E_NOTIMPL;
667 }
668
669 static HRESULT WINAPI ITextSelection_fnGetChar(
670 ITextSelection *me,
671 long *pch)
672 {
673 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
674 if (!This->reOle)
675 return CO_E_RELEASED;
676
677 FIXME("not implemented\n");
678 return E_NOTIMPL;
679 }
680
681 static HRESULT WINAPI ITextSelection_fnSetChar(
682 ITextSelection *me,
683 long ch)
684 {
685 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
686 if (!This->reOle)
687 return CO_E_RELEASED;
688
689 FIXME("not implemented\n");
690 return E_NOTIMPL;
691 }
692
693 static HRESULT WINAPI ITextSelection_fnGetDuplicate(
694 ITextSelection *me,
695 ITextRange **ppRange)
696 {
697 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
698 if (!This->reOle)
699 return CO_E_RELEASED;
700
701 FIXME("not implemented\n");
702 return E_NOTIMPL;
703 }
704
705 static HRESULT WINAPI ITextSelection_fnGetFormattedText(
706 ITextSelection *me,
707 ITextRange **ppRange)
708 {
709 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
710 if (!This->reOle)
711 return CO_E_RELEASED;
712
713 FIXME("not implemented\n");
714 return E_NOTIMPL;
715 }
716
717 static HRESULT WINAPI ITextSelection_fnSetFormattedText(
718 ITextSelection *me,
719 ITextRange *pRange)
720 {
721 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
722 if (!This->reOle)
723 return CO_E_RELEASED;
724
725 FIXME("not implemented\n");
726 return E_NOTIMPL;
727 }
728
729 static HRESULT WINAPI ITextSelection_fnGetStart(
730 ITextSelection *me,
731 long *pcpFirst)
732 {
733 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
734 if (!This->reOle)
735 return CO_E_RELEASED;
736
737 FIXME("not implemented\n");
738 return E_NOTIMPL;
739 }
740
741 static HRESULT WINAPI ITextSelection_fnSetStart(
742 ITextSelection *me,
743 long cpFirst)
744 {
745 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
746 if (!This->reOle)
747 return CO_E_RELEASED;
748
749 FIXME("not implemented\n");
750 return E_NOTIMPL;
751 }
752
753 static HRESULT WINAPI ITextSelection_fnGetEnd(
754 ITextSelection *me,
755 long *pcpLim)
756 {
757 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
758 if (!This->reOle)
759 return CO_E_RELEASED;
760
761 FIXME("not implemented\n");
762 return E_NOTIMPL;
763 }
764
765 static HRESULT WINAPI ITextSelection_fnSetEnd(
766 ITextSelection *me,
767 long cpLim)
768 {
769 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
770 if (!This->reOle)
771 return CO_E_RELEASED;
772
773 FIXME("not implemented\n");
774 return E_NOTIMPL;
775 }
776
777 static HRESULT WINAPI ITextSelection_fnGetFont(
778 ITextSelection *me,
779 ITextFont **pFont)
780 {
781 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
782 if (!This->reOle)
783 return CO_E_RELEASED;
784
785 FIXME("not implemented\n");
786 return E_NOTIMPL;
787 }
788
789 static HRESULT WINAPI ITextSelection_fnSetFont(
790 ITextSelection *me,
791 ITextFont *pFont)
792 {
793 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
794 if (!This->reOle)
795 return CO_E_RELEASED;
796
797 FIXME("not implemented\n");
798 return E_NOTIMPL;
799 }
800
801 static HRESULT WINAPI ITextSelection_fnGetPara(
802 ITextSelection *me,
803 ITextPara **ppPara)
804 {
805 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
806 if (!This->reOle)
807 return CO_E_RELEASED;
808
809 FIXME("not implemented\n");
810 return E_NOTIMPL;
811 }
812
813 static HRESULT WINAPI ITextSelection_fnSetPara(
814 ITextSelection *me,
815 ITextPara *pPara)
816 {
817 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
818 if (!This->reOle)
819 return CO_E_RELEASED;
820
821 FIXME("not implemented\n");
822 return E_NOTIMPL;
823 }
824
825 static HRESULT WINAPI ITextSelection_fnGetStoryLength(
826 ITextSelection *me,
827 long *pcch)
828 {
829 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
830 if (!This->reOle)
831 return CO_E_RELEASED;
832
833 FIXME("not implemented\n");
834 return E_NOTIMPL;
835 }
836
837 static HRESULT WINAPI ITextSelection_fnGetStoryType(
838 ITextSelection *me,
839 long *pValue)
840 {
841 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
842 if (!This->reOle)
843 return CO_E_RELEASED;
844
845 FIXME("not implemented\n");
846 return E_NOTIMPL;
847 }
848
849 static HRESULT WINAPI ITextSelection_fnCollapse(
850 ITextSelection *me,
851 long bStart)
852 {
853 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
854 if (!This->reOle)
855 return CO_E_RELEASED;
856
857 FIXME("not implemented\n");
858 return E_NOTIMPL;
859 }
860
861 static HRESULT WINAPI ITextSelection_fnExpand(
862 ITextSelection *me,
863 long Unit,
864 long *pDelta)
865 {
866 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
867 if (!This->reOle)
868 return CO_E_RELEASED;
869
870 FIXME("not implemented\n");
871 return E_NOTIMPL;
872 }
873
874 static HRESULT WINAPI ITextSelection_fnGetIndex(
875 ITextSelection *me,
876 long Unit,
877 long *pIndex)
878 {
879 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
880 if (!This->reOle)
881 return CO_E_RELEASED;
882
883 FIXME("not implemented\n");
884 return E_NOTIMPL;
885 }
886
887 static HRESULT WINAPI ITextSelection_fnSetIndex(
888 ITextSelection *me,
889 long Unit,
890 long Index,
891 long Extend)
892 {
893 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
894 if (!This->reOle)
895 return CO_E_RELEASED;
896
897 FIXME("not implemented\n");
898 return E_NOTIMPL;
899 }
900
901 static HRESULT WINAPI ITextSelection_fnSetRange(
902 ITextSelection *me,
903 long cpActive,
904 long cpOther)
905 {
906 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
907 if (!This->reOle)
908 return CO_E_RELEASED;
909
910 FIXME("not implemented\n");
911 return E_NOTIMPL;
912 }
913
914 static HRESULT WINAPI ITextSelection_fnInRange(
915 ITextSelection *me,
916 ITextRange *pRange,
917 long *pb)
918 {
919 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
920 if (!This->reOle)
921 return CO_E_RELEASED;
922
923 FIXME("not implemented\n");
924 return E_NOTIMPL;
925 }
926
927 static HRESULT WINAPI ITextSelection_fnInStory(
928 ITextSelection *me,
929 ITextRange *pRange,
930 long *pb)
931 {
932 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
933 if (!This->reOle)
934 return CO_E_RELEASED;
935
936 FIXME("not implemented\n");
937 return E_NOTIMPL;
938 }
939
940 static HRESULT WINAPI ITextSelection_fnIsEqual(
941 ITextSelection *me,
942 ITextRange *pRange,
943 long *pb)
944 {
945 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
946 if (!This->reOle)
947 return CO_E_RELEASED;
948
949 FIXME("not implemented\n");
950 return E_NOTIMPL;
951 }
952
953 static HRESULT WINAPI ITextSelection_fnSelect(
954 ITextSelection *me)
955 {
956 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
957 if (!This->reOle)
958 return CO_E_RELEASED;
959
960 FIXME("not implemented\n");
961 return E_NOTIMPL;
962 }
963
964 static HRESULT WINAPI ITextSelection_fnStartOf(
965 ITextSelection *me,
966 long Unit,
967 long Extend,
968 long *pDelta)
969 {
970 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
971 if (!This->reOle)
972 return CO_E_RELEASED;
973
974 FIXME("not implemented\n");
975 return E_NOTIMPL;
976 }
977
978 static HRESULT WINAPI ITextSelection_fnEndOf(
979 ITextSelection *me,
980 long Unit,
981 long Extend,
982 long *pDelta)
983 {
984 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
985 if (!This->reOle)
986 return CO_E_RELEASED;
987
988 FIXME("not implemented\n");
989 return E_NOTIMPL;
990 }
991
992 static HRESULT WINAPI ITextSelection_fnMove(
993 ITextSelection *me,
994 long Unit,
995 long Count,
996 long *pDelta)
997 {
998 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
999 if (!This->reOle)
1000 return CO_E_RELEASED;
1001
1002 FIXME("not implemented\n");
1003 return E_NOTIMPL;
1004 }
1005
1006 static HRESULT WINAPI ITextSelection_fnMoveStart(
1007 ITextSelection *me,
1008 long Unit,
1009 long Count,
1010 long *pDelta)
1011 {
1012 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1013 if (!This->reOle)
1014 return CO_E_RELEASED;
1015
1016 FIXME("not implemented\n");
1017 return E_NOTIMPL;
1018 }
1019
1020 static HRESULT WINAPI ITextSelection_fnMoveEnd(
1021 ITextSelection *me,
1022 long Unit,
1023 long Count,
1024 long *pDelta)
1025 {
1026 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1027 if (!This->reOle)
1028 return CO_E_RELEASED;
1029
1030 FIXME("not implemented\n");
1031 return E_NOTIMPL;
1032 }
1033
1034 static HRESULT WINAPI ITextSelection_fnMoveWhile(
1035 ITextSelection *me,
1036 VARIANT *Cset,
1037 long Count,
1038 long *pDelta)
1039 {
1040 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1041 if (!This->reOle)
1042 return CO_E_RELEASED;
1043
1044 FIXME("not implemented\n");
1045 return E_NOTIMPL;
1046 }
1047
1048 static HRESULT WINAPI ITextSelection_fnMoveStartWhile(
1049 ITextSelection *me,
1050 VARIANT *Cset,
1051 long Count,
1052 long *pDelta)
1053 {
1054 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1055 if (!This->reOle)
1056 return CO_E_RELEASED;
1057
1058 FIXME("not implemented\n");
1059 return E_NOTIMPL;
1060 }
1061
1062 static HRESULT WINAPI ITextSelection_fnMoveEndWhile(
1063 ITextSelection *me,
1064 VARIANT *Cset,
1065 long Count,
1066 long *pDelta)
1067 {
1068 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1069 if (!This->reOle)
1070 return CO_E_RELEASED;
1071
1072 FIXME("not implemented\n");
1073 return E_NOTIMPL;
1074 }
1075
1076 static HRESULT WINAPI ITextSelection_fnMoveUntil(
1077 ITextSelection *me,
1078 VARIANT *Cset,
1079 long Count,
1080 long *pDelta)
1081 {
1082 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1083 if (!This->reOle)
1084 return CO_E_RELEASED;
1085
1086 FIXME("not implemented\n");
1087 return E_NOTIMPL;
1088 }
1089
1090 static HRESULT WINAPI ITextSelection_fnMoveStartUntil(
1091 ITextSelection *me,
1092 VARIANT *Cset,
1093 long Count,
1094 long *pDelta)
1095 {
1096 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1097 if (!This->reOle)
1098 return CO_E_RELEASED;
1099
1100 FIXME("not implemented\n");
1101 return E_NOTIMPL;
1102 }
1103
1104 static HRESULT WINAPI ITextSelection_fnMoveEndUntil(
1105 ITextSelection *me,
1106 VARIANT *Cset,
1107 long Count,
1108 long *pDelta)
1109 {
1110 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1111 if (!This->reOle)
1112 return CO_E_RELEASED;
1113
1114 FIXME("not implemented\n");
1115 return E_NOTIMPL;
1116 }
1117
1118 static HRESULT WINAPI ITextSelection_fnFindText(
1119 ITextSelection *me,
1120 BSTR bstr,
1121 long cch,
1122 long Flags,
1123 long *pLength)
1124 {
1125 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1126 if (!This->reOle)
1127 return CO_E_RELEASED;
1128
1129 FIXME("not implemented\n");
1130 return E_NOTIMPL;
1131 }
1132
1133 static HRESULT WINAPI ITextSelection_fnFindTextStart(
1134 ITextSelection *me,
1135 BSTR bstr,
1136 long cch,
1137 long Flags,
1138 long *pLength)
1139 {
1140 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1141 if (!This->reOle)
1142 return CO_E_RELEASED;
1143
1144 FIXME("not implemented\n");
1145 return E_NOTIMPL;
1146 }
1147
1148 static HRESULT WINAPI ITextSelection_fnFindTextEnd(
1149 ITextSelection *me,
1150 BSTR bstr,
1151 long cch,
1152 long Flags,
1153 long *pLength)
1154 {
1155 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1156 if (!This->reOle)
1157 return CO_E_RELEASED;
1158
1159 FIXME("not implemented\n");
1160 return E_NOTIMPL;
1161 }
1162
1163 static HRESULT WINAPI ITextSelection_fnDelete(
1164 ITextSelection *me,
1165 long Unit,
1166 long Count,
1167 long *pDelta)
1168 {
1169 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1170 if (!This->reOle)
1171 return CO_E_RELEASED;
1172
1173 FIXME("not implemented\n");
1174 return E_NOTIMPL;
1175 }
1176
1177 static HRESULT WINAPI ITextSelection_fnCut(
1178 ITextSelection *me,
1179 VARIANT *pVar)
1180 {
1181 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1182 if (!This->reOle)
1183 return CO_E_RELEASED;
1184
1185 FIXME("not implemented\n");
1186 return E_NOTIMPL;
1187 }
1188
1189 static HRESULT WINAPI ITextSelection_fnCopy(
1190 ITextSelection *me,
1191 VARIANT *pVar)
1192 {
1193 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1194 if (!This->reOle)
1195 return CO_E_RELEASED;
1196
1197 FIXME("not implemented\n");
1198 return E_NOTIMPL;
1199 }
1200
1201 static HRESULT WINAPI ITextSelection_fnPaste(
1202 ITextSelection *me,
1203 VARIANT *pVar,
1204 long Format)
1205 {
1206 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1207 if (!This->reOle)
1208 return CO_E_RELEASED;
1209
1210 FIXME("not implemented\n");
1211 return E_NOTIMPL;
1212 }
1213
1214 static HRESULT WINAPI ITextSelection_fnCanPaste(
1215 ITextSelection *me,
1216 VARIANT *pVar,
1217 long Format,
1218 long *pb)
1219 {
1220 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1221 if (!This->reOle)
1222 return CO_E_RELEASED;
1223
1224 FIXME("not implemented\n");
1225 return E_NOTIMPL;
1226 }
1227
1228 static HRESULT WINAPI ITextSelection_fnCanEdit(
1229 ITextSelection *me,
1230 long *pb)
1231 {
1232 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1233 if (!This->reOle)
1234 return CO_E_RELEASED;
1235
1236 FIXME("not implemented\n");
1237 return E_NOTIMPL;
1238 }
1239
1240 static HRESULT WINAPI ITextSelection_fnChangeCase(
1241 ITextSelection *me,
1242 long Type)
1243 {
1244 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1245 if (!This->reOle)
1246 return CO_E_RELEASED;
1247
1248 FIXME("not implemented\n");
1249 return E_NOTIMPL;
1250 }
1251
1252 static HRESULT WINAPI ITextSelection_fnGetPoint(
1253 ITextSelection *me,
1254 long Type,
1255 long *cx,
1256 long *cy)
1257 {
1258 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1259 if (!This->reOle)
1260 return CO_E_RELEASED;
1261
1262 FIXME("not implemented\n");
1263 return E_NOTIMPL;
1264 }
1265
1266 static HRESULT WINAPI ITextSelection_fnSetPoint(
1267 ITextSelection *me,
1268 long x,
1269 long y,
1270 long Type,
1271 long Extend)
1272 {
1273 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1274 if (!This->reOle)
1275 return CO_E_RELEASED;
1276
1277 FIXME("not implemented\n");
1278 return E_NOTIMPL;
1279 }
1280
1281 static HRESULT WINAPI ITextSelection_fnScrollIntoView(
1282 ITextSelection *me,
1283 long Value)
1284 {
1285 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1286 if (!This->reOle)
1287 return CO_E_RELEASED;
1288
1289 FIXME("not implemented\n");
1290 return E_NOTIMPL;
1291 }
1292
1293 static HRESULT WINAPI ITextSelection_fnGetEmbeddedObject(
1294 ITextSelection *me,
1295 IUnknown **ppv)
1296 {
1297 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1298 if (!This->reOle)
1299 return CO_E_RELEASED;
1300
1301 FIXME("not implemented\n");
1302 return E_NOTIMPL;
1303 }
1304
1305 /*** ITextSelection methods ***/
1306 static HRESULT WINAPI ITextSelection_fnGetFlags(
1307 ITextSelection *me,
1308 long *pFlags)
1309 {
1310 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1311 if (!This->reOle)
1312 return CO_E_RELEASED;
1313
1314 FIXME("not implemented\n");
1315 return E_NOTIMPL;
1316 }
1317
1318 static HRESULT WINAPI ITextSelection_fnSetFlags(
1319 ITextSelection *me,
1320 long Flags)
1321 {
1322 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1323 if (!This->reOle)
1324 return CO_E_RELEASED;
1325
1326 FIXME("not implemented\n");
1327 return E_NOTIMPL;
1328 }
1329
1330 static HRESULT WINAPI ITextSelection_fnGetType(
1331 ITextSelection *me,
1332 long *pType)
1333 {
1334 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1335 if (!This->reOle)
1336 return CO_E_RELEASED;
1337
1338 FIXME("not implemented\n");
1339 return E_NOTIMPL;
1340 }
1341
1342 static HRESULT WINAPI ITextSelection_fnMoveLeft(
1343 ITextSelection *me,
1344 long Unit,
1345 long Count,
1346 long Extend,
1347 long *pDelta)
1348 {
1349 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1350 if (!This->reOle)
1351 return CO_E_RELEASED;
1352
1353 FIXME("not implemented\n");
1354 return E_NOTIMPL;
1355 }
1356
1357 static HRESULT WINAPI ITextSelection_fnMoveRight(
1358 ITextSelection *me,
1359 long Unit,
1360 long Count,
1361 long Extend,
1362 long *pDelta)
1363 {
1364 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1365 if (!This->reOle)
1366 return CO_E_RELEASED;
1367
1368 FIXME("not implemented\n");
1369 return E_NOTIMPL;
1370 }
1371
1372 static HRESULT WINAPI ITextSelection_fnMoveUp(
1373 ITextSelection *me,
1374 long Unit,
1375 long Count,
1376 long Extend,
1377 long *pDelta)
1378 {
1379 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1380 if (!This->reOle)
1381 return CO_E_RELEASED;
1382
1383 FIXME("not implemented\n");
1384 return E_NOTIMPL;
1385 }
1386
1387 static HRESULT WINAPI ITextSelection_fnMoveDown(
1388 ITextSelection *me,
1389 long Unit,
1390 long Count,
1391 long Extend,
1392 long *pDelta)
1393 {
1394 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1395 if (!This->reOle)
1396 return CO_E_RELEASED;
1397
1398 FIXME("not implemented\n");
1399 return E_NOTIMPL;
1400 }
1401
1402 static HRESULT WINAPI ITextSelection_fnHomeKey(
1403 ITextSelection *me,
1404 long Unit,
1405 long Extend,
1406 long *pDelta)
1407 {
1408 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1409 if (!This->reOle)
1410 return CO_E_RELEASED;
1411
1412 FIXME("not implemented\n");
1413 return E_NOTIMPL;
1414 }
1415
1416 static HRESULT WINAPI ITextSelection_fnEndKey(
1417 ITextSelection *me,
1418 long Unit,
1419 long Extend,
1420 long *pDelta)
1421 {
1422 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1423 if (!This->reOle)
1424 return CO_E_RELEASED;
1425
1426 FIXME("not implemented\n");
1427 return E_NOTIMPL;
1428 }
1429
1430 static HRESULT WINAPI ITextSelection_fnTypeText(
1431 ITextSelection *me,
1432 BSTR bstr)
1433 {
1434 ITextSelectionImpl *This = (ITextSelectionImpl *) me;
1435 if (!This->reOle)
1436 return CO_E_RELEASED;
1437
1438 FIXME("not implemented\n");
1439 return E_NOTIMPL;
1440 }
1441
1442 static const ITextSelectionVtbl tsvt = {
1443 ITextSelection_fnQueryInterface,
1444 ITextSelection_fnAddRef,
1445 ITextSelection_fnRelease,
1446 ITextSelection_fnGetTypeInfoCount,
1447 ITextSelection_fnGetTypeInfo,
1448 ITextSelection_fnGetIDsOfNames,
1449 ITextSelection_fnInvoke,
1450 ITextSelection_fnGetText,
1451 ITextSelection_fnSetText,
1452 ITextSelection_fnGetChar,
1453 ITextSelection_fnSetChar,
1454 ITextSelection_fnGetDuplicate,
1455 ITextSelection_fnGetFormattedText,
1456 ITextSelection_fnSetFormattedText,
1457 ITextSelection_fnGetStart,
1458 ITextSelection_fnSetStart,
1459 ITextSelection_fnGetEnd,
1460 ITextSelection_fnSetEnd,
1461 ITextSelection_fnGetFont,
1462 ITextSelection_fnSetFont,
1463 ITextSelection_fnGetPara,
1464 ITextSelection_fnSetPara,
1465 ITextSelection_fnGetStoryLength,
1466 ITextSelection_fnGetStoryType,
1467 ITextSelection_fnCollapse,
1468 ITextSelection_fnExpand,
1469 ITextSelection_fnGetIndex,
1470 ITextSelection_fnSetIndex,
1471 ITextSelection_fnSetRange,
1472 ITextSelection_fnInRange,
1473 ITextSelection_fnInStory,
1474 ITextSelection_fnIsEqual,
1475 ITextSelection_fnSelect,
1476 ITextSelection_fnStartOf,
1477 ITextSelection_fnEndOf,
1478 ITextSelection_fnMove,
1479 ITextSelection_fnMoveStart,
1480 ITextSelection_fnMoveEnd,
1481 ITextSelection_fnMoveWhile,
1482 ITextSelection_fnMoveStartWhile,
1483 ITextSelection_fnMoveEndWhile,
1484 ITextSelection_fnMoveUntil,
1485 ITextSelection_fnMoveStartUntil,
1486 ITextSelection_fnMoveEndUntil,
1487 ITextSelection_fnFindText,
1488 ITextSelection_fnFindTextStart,
1489 ITextSelection_fnFindTextEnd,
1490 ITextSelection_fnDelete,
1491 ITextSelection_fnCut,
1492 ITextSelection_fnCopy,
1493 ITextSelection_fnPaste,
1494 ITextSelection_fnCanPaste,
1495 ITextSelection_fnCanEdit,
1496 ITextSelection_fnChangeCase,
1497 ITextSelection_fnGetPoint,
1498 ITextSelection_fnSetPoint,
1499 ITextSelection_fnScrollIntoView,
1500 ITextSelection_fnGetEmbeddedObject,
1501 ITextSelection_fnGetFlags,
1502 ITextSelection_fnSetFlags,
1503 ITextSelection_fnGetType,
1504 ITextSelection_fnMoveLeft,
1505 ITextSelection_fnMoveRight,
1506 ITextSelection_fnMoveUp,
1507 ITextSelection_fnMoveDown,
1508 ITextSelection_fnHomeKey,
1509 ITextSelection_fnEndKey,
1510 ITextSelection_fnTypeText
1511 };
1512
1513 static ITextSelectionImpl *
1514 CreateTextSelection(IRichEditOleImpl *reOle)
1515 {
1516 ITextSelectionImpl *txtSel = heap_alloc(sizeof *txtSel);
1517 if (!txtSel)
1518 return NULL;
1519
1520 txtSel->lpVtbl = &tsvt;
1521 txtSel->ref = 1;
1522 txtSel->reOle = reOle;
1523 return txtSel;
1524 }
1525
1526 LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *ppObj)
1527 {
1528 IRichEditOleImpl *reo;
1529
1530 reo = heap_alloc(sizeof(IRichEditOleImpl));
1531 if (!reo)
1532 return 0;
1533
1534 reo->lpRichEditOleVtbl = &revt;
1535 reo->lpTextDocumentVtbl = &tdvt;
1536 reo->ref = 1;
1537 reo->editor = editor;
1538 reo->txtSel = CreateTextSelection(reo);
1539 if (!reo->txtSel)
1540 {
1541 heap_free(reo);
1542 return 0;
1543 }
1544 TRACE("Created %p\n",reo);
1545 *ppObj = (LPVOID) reo;
1546
1547 return 1;
1548 }
1549
1550 static void convert_sizel(ME_Context *c, const SIZEL* szl, SIZE* sz)
1551 {
1552 /* sizel is in .01 millimeters, sz in pixels */
1553 sz->cx = MulDiv(szl->cx, c->dpi.cx, 2540);
1554 sz->cy = MulDiv(szl->cy, c->dpi.cy, 2540);
1555 }
1556
1557 /******************************************************************************
1558 * ME_GetOLEObjectSize
1559 *
1560 * Sets run extent for OLE objects.
1561 */
1562 void ME_GetOLEObjectSize(ME_Context *c, ME_Run *run, SIZE *pSize)
1563 {
1564 IDataObject* ido;
1565 FORMATETC fmt;
1566 STGMEDIUM stgm;
1567 DIBSECTION dibsect;
1568 ENHMETAHEADER emh;
1569
1570 assert(run->nFlags & MERF_GRAPHICS);
1571 assert(run->ole_obj);
1572
1573 if (run->ole_obj->sizel.cx != 0 || run->ole_obj->sizel.cy != 0)
1574 {
1575 convert_sizel(c, &run->ole_obj->sizel, pSize);
1576 return;
1577 }
1578
1579 IOleObject_QueryInterface(run->ole_obj->poleobj, &IID_IDataObject, (void**)&ido);
1580 fmt.cfFormat = CF_BITMAP;
1581 fmt.ptd = NULL;
1582 fmt.dwAspect = DVASPECT_CONTENT;
1583 fmt.lindex = -1;
1584 fmt.tymed = TYMED_GDI;
1585 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK)
1586 {
1587 fmt.cfFormat = CF_ENHMETAFILE;
1588 fmt.tymed = TYMED_ENHMF;
1589 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK)
1590 {
1591 FIXME("unsupported format\n");
1592 pSize->cx = pSize->cy = 0;
1593 IDataObject_Release(ido);
1594 return;
1595 }
1596 }
1597
1598 switch (stgm.tymed)
1599 {
1600 case TYMED_GDI:
1601 GetObjectW(stgm.u.hBitmap, sizeof(dibsect), &dibsect);
1602 pSize->cx = dibsect.dsBm.bmWidth;
1603 pSize->cy = dibsect.dsBm.bmHeight;
1604 if (!stgm.pUnkForRelease) DeleteObject(stgm.u.hBitmap);
1605 break;
1606 case TYMED_ENHMF:
1607 GetEnhMetaFileHeader(stgm.u.hEnhMetaFile, sizeof(emh), &emh);
1608 pSize->cx = emh.rclBounds.right - emh.rclBounds.left;
1609 pSize->cy = emh.rclBounds.bottom - emh.rclBounds.top;
1610 if (!stgm.pUnkForRelease) DeleteEnhMetaFile(stgm.u.hEnhMetaFile);
1611 break;
1612 default:
1613 FIXME("Unsupported tymed %d\n", stgm.tymed);
1614 break;
1615 }
1616 IDataObject_Release(ido);
1617 if (c->editor->nZoomNumerator != 0)
1618 {
1619 pSize->cx = MulDiv(pSize->cx, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
1620 pSize->cy = MulDiv(pSize->cy, c->editor->nZoomNumerator, c->editor->nZoomDenominator);
1621 }
1622 }
1623
1624 void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run *run,
1625 ME_Paragraph *para, BOOL selected)
1626 {
1627 IDataObject* ido;
1628 FORMATETC fmt;
1629 STGMEDIUM stgm;
1630 DIBSECTION dibsect;
1631 ENHMETAHEADER emh;
1632 HDC hMemDC;
1633 SIZE sz;
1634 BOOL has_size;
1635
1636 assert(run->nFlags & MERF_GRAPHICS);
1637 assert(run->ole_obj);
1638 if (IOleObject_QueryInterface(run->ole_obj->poleobj, &IID_IDataObject, (void**)&ido) != S_OK)
1639 {
1640 FIXME("Couldn't get interface\n");
1641 return;
1642 }
1643 has_size = run->ole_obj->sizel.cx != 0 || run->ole_obj->sizel.cy != 0;
1644 fmt.cfFormat = CF_BITMAP;
1645 fmt.ptd = NULL;
1646 fmt.dwAspect = DVASPECT_CONTENT;
1647 fmt.lindex = -1;
1648 fmt.tymed = TYMED_GDI;
1649 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK)
1650 {
1651 fmt.cfFormat = CF_ENHMETAFILE;
1652 fmt.tymed = TYMED_ENHMF;
1653 if (IDataObject_GetData(ido, &fmt, &stgm) != S_OK)
1654 {
1655 FIXME("Couldn't get storage medium\n");
1656 IDataObject_Release(ido);
1657 return;
1658 }
1659 }
1660 switch (stgm.tymed)
1661 {
1662 case TYMED_GDI:
1663 GetObjectW(stgm.u.hBitmap, sizeof(dibsect), &dibsect);
1664 hMemDC = CreateCompatibleDC(c->hDC);
1665 SelectObject(hMemDC, stgm.u.hBitmap);
1666 if (!has_size && c->editor->nZoomNumerator == 0)
1667 {
1668 sz.cx = dibsect.dsBm.bmWidth;
1669 sz.cy = dibsect.dsBm.bmHeight;
1670 BitBlt(c->hDC, x, y - dibsect.dsBm.bmHeight,
1671 dibsect.dsBm.bmWidth, dibsect.dsBm.bmHeight,
1672 hMemDC, 0, 0, SRCCOPY);
1673 }
1674 else
1675 {
1676 if (has_size)
1677 {
1678 convert_sizel(c, &run->ole_obj->sizel, &sz);
1679 }
1680 else
1681 {
1682 sz.cx = MulDiv(dibsect.dsBm.bmWidth,
1683 c->editor->nZoomNumerator, c->editor->nZoomDenominator);
1684 sz.cy = MulDiv(dibsect.dsBm.bmHeight,
1685 c->editor->nZoomNumerator, c->editor->nZoomDenominator);
1686 }
1687 StretchBlt(c->hDC, x, y - sz.cy, sz.cx, sz.cy,
1688 hMemDC, 0, 0, dibsect.dsBm.bmWidth, dibsect.dsBm.bmHeight, SRCCOPY);
1689 }
1690 if (!stgm.pUnkForRelease) DeleteObject(stgm.u.hBitmap);
1691 break;
1692 case TYMED_ENHMF:
1693 GetEnhMetaFileHeader(stgm.u.hEnhMetaFile, sizeof(emh), &emh);
1694 if (!has_size && c->editor->nZoomNumerator == 0)
1695 {
1696 sz.cy = emh.rclBounds.bottom - emh.rclBounds.top;
1697 sz.cx = emh.rclBounds.right - emh.rclBounds.left;
1698 }
1699 else
1700 {
1701 if (has_size)
1702 {
1703 convert_sizel(c, &run->ole_obj->sizel, &sz);
1704 }
1705 else
1706 {
1707 sz.cy = MulDiv(emh.rclBounds.bottom - emh.rclBounds.top,
1708 c->editor->nZoomNumerator, c->editor->nZoomDenominator);
1709 sz.cx = MulDiv(emh.rclBounds.right - emh.rclBounds.left,
1710 c->editor->nZoomNumerator, c->editor->nZoomDenominator);
1711 }
1712 }
1713 {
1714 RECT rc;
1715
1716 rc.left = x;
1717 rc.top = y - sz.cy;
1718 rc.right = x + sz.cx;
1719 rc.bottom = y;
1720 PlayEnhMetaFile(c->hDC, stgm.u.hEnhMetaFile, &rc);
1721 }
1722 if (!stgm.pUnkForRelease) DeleteEnhMetaFile(stgm.u.hEnhMetaFile);
1723 break;
1724 default:
1725 FIXME("Unsupported tymed %d\n", stgm.tymed);
1726 selected = FALSE;
1727 break;
1728 }
1729 if (selected && !c->editor->bHideSelection)
1730 PatBlt(c->hDC, x, y - sz.cy, sz.cx, sz.cy, DSTINVERT);
1731 IDataObject_Release(ido);
1732 }
1733
1734 void ME_DeleteReObject(REOBJECT* reo)
1735 {
1736 if (reo->poleobj) IOleObject_Release(reo->poleobj);
1737 if (reo->pstg) IStorage_Release(reo->pstg);
1738 if (reo->polesite) IOleClientSite_Release(reo->polesite);
1739 FREE_OBJ(reo);
1740 }
1741
1742 void ME_CopyReObject(REOBJECT* dst, const REOBJECT* src)
1743 {
1744 *dst = *src;
1745
1746 if (dst->poleobj) IOleObject_AddRef(dst->poleobj);
1747 if (dst->pstg) IStorage_AddRef(dst->pstg);
1748 if (dst->polesite) IOleClientSite_AddRef(dst->polesite);
1749 }
1750
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.