2 * RichEdit GUIDs and OLE interface
4 * Copyright 2004 by Krzysztof Foltman
5 * Copyright 2004 Aric Stewart
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.
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.
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
26 WINE_DEFAULT_DEBUG_CHANNEL(richedit
);
28 /* there is no way to be consistent across different sets of headers - mingw, Wine, Win32 SDK*/
31 DEFINE_GUID(IID_ITextServices
, 0x8d33f740, 0xcf58, 0x11ce, 0xa8, 0x9d, 0x00, 0xaa, 0x00, 0x6c, 0xad, 0xc5);
32 DEFINE_GUID(IID_ITextHost
, 0x13e670f4,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1);
33 DEFINE_GUID(IID_ITextHost2
, 0x13e670f5,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1);
34 DEFINE_GUID(IID_ITextDocument
, 0x8cc497c0, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
35 DEFINE_GUID(IID_ITextRange
, 0x8cc497c2, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
36 DEFINE_GUID(IID_ITextSelection
, 0x8cc497c1, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
38 typedef struct ITextSelectionImpl ITextSelectionImpl
;
39 typedef struct IOleClientSiteImpl IOleClientSiteImpl
;
41 typedef struct IRichEditOleImpl
{
42 IRichEditOle IRichEditOle_iface
;
43 ITextDocument ITextDocument_iface
;
46 ME_TextEditor
*editor
;
47 ITextSelectionImpl
*txtSel
;
48 IOleClientSiteImpl
*clientSite
;
51 struct ITextSelectionImpl
{
52 ITextSelection ITextSelection_iface
;
55 IRichEditOleImpl
*reOle
;
58 struct IOleClientSiteImpl
{
59 IOleClientSite IOleClientSite_iface
;
62 IRichEditOleImpl
*reOle
;
65 static inline IRichEditOleImpl
*impl_from_IRichEditOle(IRichEditOle
*iface
)
67 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, IRichEditOle_iface
);
70 static inline IRichEditOleImpl
*impl_from_ITextDocument(ITextDocument
*iface
)
72 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, ITextDocument_iface
);
76 IRichEditOle_fnQueryInterface(IRichEditOle
*me
, REFIID riid
, LPVOID
*ppvObj
)
78 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
80 TRACE("%p %s\n", This
, debugstr_guid(riid
) );
83 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
84 IsEqualGUID(riid
, &IID_IRichEditOle
))
85 *ppvObj
= &This
->IRichEditOle_iface
;
86 else if (IsEqualGUID(riid
, &IID_ITextDocument
))
87 *ppvObj
= &This
->ITextDocument_iface
;
90 IRichEditOle_AddRef(me
);
93 FIXME("%p: unhandled interface %s\n", This
, debugstr_guid(riid
) );
99 IRichEditOle_fnAddRef(IRichEditOle
*me
)
101 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
102 ULONG ref
= InterlockedIncrement( &This
->ref
);
104 TRACE("%p ref = %u\n", This
, ref
);
110 IRichEditOle_fnRelease(IRichEditOle
*me
)
112 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
113 ULONG ref
= InterlockedDecrement(&This
->ref
);
115 TRACE ("%p ref=%u\n", This
, ref
);
119 TRACE ("Destroying %p\n", This
);
120 This
->txtSel
->reOle
= NULL
;
121 ITextSelection_Release(&This
->txtSel
->ITextSelection_iface
);
122 IOleClientSite_Release(&This
->clientSite
->IOleClientSite_iface
);
128 static HRESULT WINAPI
129 IRichEditOle_fnActivateAs(IRichEditOle
*me
, REFCLSID rclsid
, REFCLSID rclsidAs
)
131 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
132 FIXME("stub %p\n",This
);
136 static HRESULT WINAPI
137 IRichEditOle_fnContextSensitiveHelp(IRichEditOle
*me
, BOOL fEnterMode
)
139 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
140 FIXME("stub %p\n",This
);
144 static HRESULT WINAPI
145 IRichEditOle_fnConvertObject(IRichEditOle
*me
, LONG iob
,
146 REFCLSID rclsidNew
, LPCSTR lpstrUserTypeNew
)
148 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
149 FIXME("stub %p\n",This
);
153 static inline IOleClientSiteImpl
*impl_from_IOleClientSite(IOleClientSite
*iface
)
155 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleClientSite_iface
);
158 static HRESULT WINAPI
159 IOleClientSite_fnQueryInterface(IOleClientSite
*me
, REFIID riid
, LPVOID
*ppvObj
)
161 TRACE("%p %s\n", me
, debugstr_guid(riid
) );
164 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
165 IsEqualGUID(riid
, &IID_IOleClientSite
))
169 IOleClientSite_AddRef(me
);
172 FIXME("%p: unhandled interface %s\n", me
, debugstr_guid(riid
) );
174 return E_NOINTERFACE
;
177 static ULONG WINAPI
IOleClientSite_fnAddRef(IOleClientSite
*iface
)
179 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
180 return InterlockedIncrement(&This
->ref
);
183 static ULONG WINAPI
IOleClientSite_fnRelease(IOleClientSite
*iface
)
185 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
186 ULONG ref
= InterlockedDecrement(&This
->ref
);
192 static HRESULT WINAPI
IOleClientSite_fnSaveObject(IOleClientSite
*iface
)
194 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
196 return CO_E_RELEASED
;
198 FIXME("stub %p\n", iface
);
203 static HRESULT WINAPI
IOleClientSite_fnGetMoniker(IOleClientSite
*iface
, DWORD dwAssign
,
204 DWORD dwWhichMoniker
, IMoniker
**ppmk
)
206 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
208 return CO_E_RELEASED
;
210 FIXME("stub %p\n", iface
);
214 static HRESULT WINAPI
IOleClientSite_fnGetContainer(IOleClientSite
*iface
,
215 IOleContainer
**ppContainer
)
217 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
219 return CO_E_RELEASED
;
221 FIXME("stub %p\n", iface
);
225 static HRESULT WINAPI
IOleClientSite_fnShowObject(IOleClientSite
*iface
)
227 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
229 return CO_E_RELEASED
;
231 FIXME("stub %p\n", iface
);
235 static HRESULT WINAPI
IOleClientSite_fnOnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
237 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
239 return CO_E_RELEASED
;
241 FIXME("stub %p\n", iface
);
245 static HRESULT WINAPI
IOleClientSite_fnRequestNewObjectLayout(IOleClientSite
*iface
)
247 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
249 return CO_E_RELEASED
;
251 FIXME("stub %p\n", iface
);
255 static const IOleClientSiteVtbl ocst
= {
256 IOleClientSite_fnQueryInterface
,
257 IOleClientSite_fnAddRef
,
258 IOleClientSite_fnRelease
,
259 IOleClientSite_fnSaveObject
,
260 IOleClientSite_fnGetMoniker
,
261 IOleClientSite_fnGetContainer
,
262 IOleClientSite_fnShowObject
,
263 IOleClientSite_fnOnShowWindow
,
264 IOleClientSite_fnRequestNewObjectLayout
267 static IOleClientSiteImpl
*
268 CreateOleClientSite(IRichEditOleImpl
*reOle
)
270 IOleClientSiteImpl
*clientSite
= heap_alloc(sizeof *clientSite
);
274 clientSite
->IOleClientSite_iface
.lpVtbl
= &ocst
;
276 clientSite
->reOle
= reOle
;
280 static HRESULT WINAPI
281 IRichEditOle_fnGetClientSite(IRichEditOle
*me
,
282 LPOLECLIENTSITE
*lplpolesite
)
284 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
286 TRACE("%p,%p\n",This
, lplpolesite
);
290 *lplpolesite
= &This
->clientSite
->IOleClientSite_iface
;
291 IOleClientSite_AddRef(*lplpolesite
);
295 static HRESULT WINAPI
296 IRichEditOle_fnGetClipboardData(IRichEditOle
*me
, CHARRANGE
*lpchrg
,
297 DWORD reco
, LPDATAOBJECT
*lplpdataobj
)
299 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
303 TRACE("(%p,%p,%d)\n",This
, lpchrg
, reco
);
307 int nFrom
, nTo
, nStartCur
= ME_GetSelectionOfs(This
->editor
, &nFrom
, &nTo
);
308 start
= This
->editor
->pCursors
[nStartCur
];
309 nChars
= nTo
- nFrom
;
311 ME_CursorFromCharOfs(This
->editor
, lpchrg
->cpMin
, &start
);
312 nChars
= lpchrg
->cpMax
- lpchrg
->cpMin
;
314 return ME_GetDataObject(This
->editor
, &start
, nChars
, lplpdataobj
);
317 static LONG WINAPI
IRichEditOle_fnGetLinkCount(IRichEditOle
*me
)
319 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
320 FIXME("stub %p\n",This
);
324 static HRESULT WINAPI
325 IRichEditOle_fnGetObject(IRichEditOle
*me
, LONG iob
,
326 REOBJECT
*lpreobject
, DWORD dwFlags
)
328 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
329 FIXME("stub %p\n",This
);
334 IRichEditOle_fnGetObjectCount(IRichEditOle
*me
)
336 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
337 FIXME("stub %p\n",This
);
341 static HRESULT WINAPI
342 IRichEditOle_fnHandsOffStorage(IRichEditOle
*me
, LONG iob
)
344 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
345 FIXME("stub %p\n",This
);
349 static HRESULT WINAPI
350 IRichEditOle_fnImportDataObject(IRichEditOle
*me
, LPDATAOBJECT lpdataobj
,
351 CLIPFORMAT cf
, HGLOBAL hMetaPict
)
353 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
354 FIXME("stub %p\n",This
);
358 static HRESULT WINAPI
359 IRichEditOle_fnInPlaceDeactivate(IRichEditOle
*me
)
361 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
362 FIXME("stub %p\n",This
);
366 static HRESULT WINAPI
367 IRichEditOle_fnInsertObject(IRichEditOle
*me
, REOBJECT
*reo
)
369 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
370 TRACE("(%p,%p)\n", This
, reo
);
372 if (reo
->cbStruct
< sizeof(*reo
)) return STG_E_INVALIDPARAMETER
;
374 ME_InsertOLEFromCursor(This
->editor
, reo
, 0);
375 ME_CommitUndo(This
->editor
);
376 ME_UpdateRepaint(This
->editor
, FALSE
);
380 static HRESULT WINAPI
IRichEditOle_fnSaveCompleted(IRichEditOle
*me
, LONG iob
,
383 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
384 FIXME("stub %p\n",This
);
388 static HRESULT WINAPI
389 IRichEditOle_fnSetDvaspect(IRichEditOle
*me
, LONG iob
, DWORD dvaspect
)
391 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
392 FIXME("stub %p\n",This
);
396 static HRESULT WINAPI
IRichEditOle_fnSetHostNames(IRichEditOle
*me
,
397 LPCSTR lpstrContainerApp
, LPCSTR lpstrContainerObj
)
399 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
400 FIXME("stub %p %s %s\n",This
, lpstrContainerApp
, lpstrContainerObj
);
404 static HRESULT WINAPI
405 IRichEditOle_fnSetLinkAvailable(IRichEditOle
*me
, LONG iob
, BOOL fAvailable
)
407 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
408 FIXME("stub %p\n",This
);
412 static const IRichEditOleVtbl revt
= {
413 IRichEditOle_fnQueryInterface
,
414 IRichEditOle_fnAddRef
,
415 IRichEditOle_fnRelease
,
416 IRichEditOle_fnGetClientSite
,
417 IRichEditOle_fnGetObjectCount
,
418 IRichEditOle_fnGetLinkCount
,
419 IRichEditOle_fnGetObject
,
420 IRichEditOle_fnInsertObject
,
421 IRichEditOle_fnConvertObject
,
422 IRichEditOle_fnActivateAs
,
423 IRichEditOle_fnSetHostNames
,
424 IRichEditOle_fnSetLinkAvailable
,
425 IRichEditOle_fnSetDvaspect
,
426 IRichEditOle_fnHandsOffStorage
,
427 IRichEditOle_fnSaveCompleted
,
428 IRichEditOle_fnInPlaceDeactivate
,
429 IRichEditOle_fnContextSensitiveHelp
,
430 IRichEditOle_fnGetClipboardData
,
431 IRichEditOle_fnImportDataObject
434 static HRESULT WINAPI
435 ITextDocument_fnQueryInterface(ITextDocument
* me
, REFIID riid
,
438 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
439 return IRichEditOle_QueryInterface(&This
->IRichEditOle_iface
, riid
, ppvObject
);
443 ITextDocument_fnAddRef(ITextDocument
* me
)
445 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
446 return IRichEditOle_AddRef(&This
->IRichEditOle_iface
);
450 ITextDocument_fnRelease(ITextDocument
* me
)
452 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
453 return IRichEditOle_Release(&This
->IRichEditOle_iface
);
456 static HRESULT WINAPI
457 ITextDocument_fnGetTypeInfoCount(ITextDocument
* me
,
460 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
461 FIXME("stub %p\n",This
);
465 static HRESULT WINAPI
466 ITextDocument_fnGetTypeInfo(ITextDocument
* me
, UINT iTInfo
, LCID lcid
,
469 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
470 FIXME("stub %p\n",This
);
474 static HRESULT WINAPI
475 ITextDocument_fnGetIDsOfNames(ITextDocument
* me
, REFIID riid
,
476 LPOLESTR
* rgszNames
, UINT cNames
, LCID lcid
, DISPID
* rgDispId
)
478 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
479 FIXME("stub %p\n",This
);
483 static HRESULT WINAPI
484 ITextDocument_fnInvoke(ITextDocument
* me
, DISPID dispIdMember
,
485 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
* pDispParams
,
486 VARIANT
* pVarResult
, EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
)
488 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
489 FIXME("stub %p\n",This
);
493 static HRESULT WINAPI
494 ITextDocument_fnGetName(ITextDocument
* me
, BSTR
* pName
)
496 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
497 FIXME("stub %p\n",This
);
501 static HRESULT WINAPI
502 ITextDocument_fnGetSelection(ITextDocument
* me
, ITextSelection
** ppSel
)
504 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
506 *ppSel
= &This
->txtSel
->ITextSelection_iface
;
507 ITextSelection_AddRef(*ppSel
);
511 static HRESULT WINAPI
512 ITextDocument_fnGetStoryCount(ITextDocument
* me
, LONG
* pCount
)
514 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
515 FIXME("stub %p\n",This
);
519 static HRESULT WINAPI
520 ITextDocument_fnGetStoryRanges(ITextDocument
* me
,
521 ITextStoryRanges
** ppStories
)
523 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
524 FIXME("stub %p\n",This
);
528 static HRESULT WINAPI
529 ITextDocument_fnGetSaved(ITextDocument
* me
, LONG
* pValue
)
531 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
532 FIXME("stub %p\n",This
);
536 static HRESULT WINAPI
537 ITextDocument_fnSetSaved(ITextDocument
* me
, LONG Value
)
539 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
540 FIXME("stub %p\n",This
);
544 static HRESULT WINAPI
545 ITextDocument_fnGetDefaultTabStop(ITextDocument
* me
, float* pValue
)
547 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
548 FIXME("stub %p\n",This
);
552 static HRESULT WINAPI
553 ITextDocument_fnSetDefaultTabStop(ITextDocument
* me
, float Value
)
555 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
556 FIXME("stub %p\n",This
);
560 static HRESULT WINAPI
561 ITextDocument_fnNew(ITextDocument
* me
)
563 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
564 FIXME("stub %p\n",This
);
568 static HRESULT WINAPI
569 ITextDocument_fnOpen(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
572 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
573 FIXME("stub %p\n",This
);
577 static HRESULT WINAPI
578 ITextDocument_fnSave(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
581 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
582 FIXME("stub %p\n",This
);
586 static HRESULT WINAPI
587 ITextDocument_fnFreeze(ITextDocument
* me
, LONG
* pCount
)
589 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
590 FIXME("stub %p\n",This
);
594 static HRESULT WINAPI
595 ITextDocument_fnUnfreeze(ITextDocument
* me
, LONG
* pCount
)
597 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
598 FIXME("stub %p\n",This
);
602 static HRESULT WINAPI
603 ITextDocument_fnBeginEditCollection(ITextDocument
* me
)
605 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
606 FIXME("stub %p\n",This
);
610 static HRESULT WINAPI
611 ITextDocument_fnEndEditCollection(ITextDocument
* me
)
613 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
614 FIXME("stub %p\n",This
);
618 static HRESULT WINAPI
619 ITextDocument_fnUndo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
621 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
622 FIXME("stub %p\n",This
);
626 static HRESULT WINAPI
627 ITextDocument_fnRedo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
629 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
630 FIXME("stub %p\n",This
);
634 static HRESULT WINAPI
635 ITextDocument_fnRange(ITextDocument
* me
, LONG cp1
, LONG cp2
,
636 ITextRange
** ppRange
)
638 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
639 FIXME("stub %p\n",This
);
643 static HRESULT WINAPI
644 ITextDocument_fnRangeFromPoint(ITextDocument
* me
, LONG x
, LONG y
,
645 ITextRange
** ppRange
)
647 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
648 FIXME("stub %p\n",This
);
652 static const ITextDocumentVtbl tdvt
= {
653 ITextDocument_fnQueryInterface
,
654 ITextDocument_fnAddRef
,
655 ITextDocument_fnRelease
,
656 ITextDocument_fnGetTypeInfoCount
,
657 ITextDocument_fnGetTypeInfo
,
658 ITextDocument_fnGetIDsOfNames
,
659 ITextDocument_fnInvoke
,
660 ITextDocument_fnGetName
,
661 ITextDocument_fnGetSelection
,
662 ITextDocument_fnGetStoryCount
,
663 ITextDocument_fnGetStoryRanges
,
664 ITextDocument_fnGetSaved
,
665 ITextDocument_fnSetSaved
,
666 ITextDocument_fnGetDefaultTabStop
,
667 ITextDocument_fnSetDefaultTabStop
,
669 ITextDocument_fnOpen
,
670 ITextDocument_fnSave
,
671 ITextDocument_fnFreeze
,
672 ITextDocument_fnUnfreeze
,
673 ITextDocument_fnBeginEditCollection
,
674 ITextDocument_fnEndEditCollection
,
675 ITextDocument_fnUndo
,
676 ITextDocument_fnRedo
,
677 ITextDocument_fnRange
,
678 ITextDocument_fnRangeFromPoint
681 static inline ITextSelectionImpl
*impl_from_ITextSelection(ITextSelection
*iface
)
683 return CONTAINING_RECORD(iface
, ITextSelectionImpl
, ITextSelection_iface
);
686 static HRESULT WINAPI
ITextSelection_fnQueryInterface(
692 if (IsEqualGUID(riid
, &IID_IUnknown
)
693 || IsEqualGUID(riid
, &IID_IDispatch
)
694 || IsEqualGUID(riid
, &IID_ITextRange
)
695 || IsEqualGUID(riid
, &IID_ITextSelection
))
698 ITextSelection_AddRef(me
);
702 return E_NOINTERFACE
;
705 static ULONG WINAPI
ITextSelection_fnAddRef(ITextSelection
*me
)
707 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
708 return InterlockedIncrement(&This
->ref
);
711 static ULONG WINAPI
ITextSelection_fnRelease(ITextSelection
*me
)
713 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
714 ULONG ref
= InterlockedDecrement(&This
->ref
);
720 static HRESULT WINAPI
ITextSelection_fnGetTypeInfoCount(ITextSelection
*me
, UINT
*pctinfo
)
722 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
724 return CO_E_RELEASED
;
726 FIXME("not implemented\n");
730 static HRESULT WINAPI
ITextSelection_fnGetTypeInfo(ITextSelection
*me
, UINT iTInfo
, LCID lcid
,
733 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
735 return CO_E_RELEASED
;
737 FIXME("not implemented\n");
741 static HRESULT WINAPI
ITextSelection_fnGetIDsOfNames(ITextSelection
*me
, REFIID riid
,
742 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
744 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
746 return CO_E_RELEASED
;
748 FIXME("not implemented\n");
752 static HRESULT WINAPI
ITextSelection_fnInvoke(
758 DISPPARAMS
*pDispParams
,
760 EXCEPINFO
*pExcepInfo
,
763 FIXME("not implemented\n");
767 /*** ITextRange methods ***/
768 static HRESULT WINAPI
ITextSelection_fnGetText(ITextSelection
*me
, BSTR
*pbstr
)
770 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
772 return CO_E_RELEASED
;
774 FIXME("not implemented\n");
778 static HRESULT WINAPI
ITextSelection_fnSetText(ITextSelection
*me
, BSTR bstr
)
780 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
782 return CO_E_RELEASED
;
784 FIXME("not implemented\n");
788 static HRESULT WINAPI
ITextSelection_fnGetChar(ITextSelection
*me
, LONG
*pch
)
790 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
792 return CO_E_RELEASED
;
794 FIXME("not implemented\n");
798 static HRESULT WINAPI
ITextSelection_fnSetChar(ITextSelection
*me
, LONG ch
)
800 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
802 return CO_E_RELEASED
;
804 FIXME("not implemented\n");
808 static HRESULT WINAPI
ITextSelection_fnGetDuplicate(ITextSelection
*me
, ITextRange
**ppRange
)
810 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
812 return CO_E_RELEASED
;
814 FIXME("not implemented\n");
818 static HRESULT WINAPI
ITextSelection_fnGetFormattedText(ITextSelection
*me
, ITextRange
**ppRange
)
820 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
822 return CO_E_RELEASED
;
824 FIXME("not implemented\n");
828 static HRESULT WINAPI
ITextSelection_fnSetFormattedText(ITextSelection
*me
, ITextRange
*pRange
)
830 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
832 return CO_E_RELEASED
;
834 FIXME("not implemented\n");
838 static HRESULT WINAPI
ITextSelection_fnGetStart(ITextSelection
*me
, LONG
*pcpFirst
)
840 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
842 return CO_E_RELEASED
;
844 FIXME("not implemented\n");
848 static HRESULT WINAPI
ITextSelection_fnSetStart(ITextSelection
*me
, LONG cpFirst
)
850 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
852 return CO_E_RELEASED
;
854 FIXME("not implemented\n");
858 static HRESULT WINAPI
ITextSelection_fnGetEnd(ITextSelection
*me
, LONG
*pcpLim
)
860 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
862 return CO_E_RELEASED
;
864 FIXME("not implemented\n");
868 static HRESULT WINAPI
ITextSelection_fnSetEnd(ITextSelection
*me
, LONG cpLim
)
870 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
872 return CO_E_RELEASED
;
874 FIXME("not implemented\n");
878 static HRESULT WINAPI
ITextSelection_fnGetFont(ITextSelection
*me
, ITextFont
**pFont
)
880 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
882 return CO_E_RELEASED
;
884 FIXME("not implemented\n");
888 static HRESULT WINAPI
ITextSelection_fnSetFont(ITextSelection
*me
, ITextFont
*pFont
)
890 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
892 return CO_E_RELEASED
;
894 FIXME("not implemented\n");
898 static HRESULT WINAPI
ITextSelection_fnGetPara(ITextSelection
*me
, ITextPara
**ppPara
)
900 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
902 return CO_E_RELEASED
;
904 FIXME("not implemented\n");
908 static HRESULT WINAPI
ITextSelection_fnSetPara(ITextSelection
*me
, ITextPara
*pPara
)
910 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
912 return CO_E_RELEASED
;
914 FIXME("not implemented\n");
918 static HRESULT WINAPI
ITextSelection_fnGetStoryLength(ITextSelection
*me
, LONG
*pcch
)
920 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
922 return CO_E_RELEASED
;
924 FIXME("not implemented\n");
928 static HRESULT WINAPI
ITextSelection_fnGetStoryType(ITextSelection
*me
, LONG
*pValue
)
930 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
932 return CO_E_RELEASED
;
934 FIXME("not implemented\n");
938 static HRESULT WINAPI
ITextSelection_fnCollapse(ITextSelection
*me
, LONG bStart
)
940 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
942 return CO_E_RELEASED
;
944 FIXME("not implemented\n");
948 static HRESULT WINAPI
ITextSelection_fnExpand(ITextSelection
*me
, LONG Unit
, LONG
*pDelta
)
950 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
952 return CO_E_RELEASED
;
954 FIXME("not implemented\n");
958 static HRESULT WINAPI
ITextSelection_fnGetIndex(ITextSelection
*me
, LONG Unit
, LONG
*pIndex
)
960 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
962 return CO_E_RELEASED
;
964 FIXME("not implemented\n");
968 static HRESULT WINAPI
ITextSelection_fnSetIndex(ITextSelection
*me
, LONG Unit
, LONG Index
,
971 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
973 return CO_E_RELEASED
;
975 FIXME("not implemented\n");
979 static HRESULT WINAPI
ITextSelection_fnSetRange(ITextSelection
*me
, LONG cpActive
, LONG cpOther
)
981 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
983 return CO_E_RELEASED
;
985 FIXME("not implemented\n");
989 static HRESULT WINAPI
ITextSelection_fnInRange(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
991 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
993 return CO_E_RELEASED
;
995 FIXME("not implemented\n");
999 static HRESULT WINAPI
ITextSelection_fnInStory(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
1001 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1003 return CO_E_RELEASED
;
1005 FIXME("not implemented\n");
1009 static HRESULT WINAPI
ITextSelection_fnIsEqual(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
1011 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1013 return CO_E_RELEASED
;
1015 FIXME("not implemented\n");
1019 static HRESULT WINAPI
ITextSelection_fnSelect(ITextSelection
*me
)
1021 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1023 return CO_E_RELEASED
;
1025 FIXME("not implemented\n");
1029 static HRESULT WINAPI
ITextSelection_fnStartOf(ITextSelection
*me
, LONG Unit
, LONG Extend
,
1032 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1034 return CO_E_RELEASED
;
1036 FIXME("not implemented\n");
1040 static HRESULT WINAPI
ITextSelection_fnEndOf(ITextSelection
*me
, LONG Unit
, LONG Extend
,
1043 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1045 return CO_E_RELEASED
;
1047 FIXME("not implemented\n");
1051 static HRESULT WINAPI
ITextSelection_fnMove(ITextSelection
*me
, LONG Unit
, LONG Count
, LONG
*pDelta
)
1053 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1055 return CO_E_RELEASED
;
1057 FIXME("not implemented\n");
1061 static HRESULT WINAPI
ITextSelection_fnMoveStart(ITextSelection
*me
, LONG Unit
, LONG Count
,
1064 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1066 return CO_E_RELEASED
;
1068 FIXME("not implemented\n");
1072 static HRESULT WINAPI
ITextSelection_fnMoveEnd(ITextSelection
*me
, LONG Unit
, LONG Count
,
1075 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1077 return CO_E_RELEASED
;
1079 FIXME("not implemented\n");
1083 static HRESULT WINAPI
ITextSelection_fnMoveWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1086 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1088 return CO_E_RELEASED
;
1090 FIXME("not implemented\n");
1094 static HRESULT WINAPI
ITextSelection_fnMoveStartWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1097 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1099 return CO_E_RELEASED
;
1101 FIXME("not implemented\n");
1105 static HRESULT WINAPI
ITextSelection_fnMoveEndWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1108 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1110 return CO_E_RELEASED
;
1112 FIXME("not implemented\n");
1116 static HRESULT WINAPI
ITextSelection_fnMoveUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1119 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1121 return CO_E_RELEASED
;
1123 FIXME("not implemented\n");
1127 static HRESULT WINAPI
ITextSelection_fnMoveStartUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1130 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1132 return CO_E_RELEASED
;
1134 FIXME("not implemented\n");
1138 static HRESULT WINAPI
ITextSelection_fnMoveEndUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
1141 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1143 return CO_E_RELEASED
;
1145 FIXME("not implemented\n");
1149 static HRESULT WINAPI
ITextSelection_fnFindText(ITextSelection
*me
, BSTR bstr
, LONG cch
, LONG Flags
,
1152 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1154 return CO_E_RELEASED
;
1156 FIXME("not implemented\n");
1160 static HRESULT WINAPI
ITextSelection_fnFindTextStart(ITextSelection
*me
, BSTR bstr
, LONG cch
,
1161 LONG Flags
, LONG
*pLength
)
1163 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1165 return CO_E_RELEASED
;
1167 FIXME("not implemented\n");
1171 static HRESULT WINAPI
ITextSelection_fnFindTextEnd(ITextSelection
*me
, BSTR bstr
, LONG cch
,
1172 LONG Flags
, LONG
*pLength
)
1174 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1176 return CO_E_RELEASED
;
1178 FIXME("not implemented\n");
1182 static HRESULT WINAPI
ITextSelection_fnDelete(ITextSelection
*me
, LONG Unit
, LONG Count
,
1185 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1187 return CO_E_RELEASED
;
1189 FIXME("not implemented\n");
1193 static HRESULT WINAPI
ITextSelection_fnCut(ITextSelection
*me
, VARIANT
*pVar
)
1195 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1197 return CO_E_RELEASED
;
1199 FIXME("not implemented\n");
1203 static HRESULT WINAPI
ITextSelection_fnCopy(ITextSelection
*me
, VARIANT
*pVar
)
1205 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1207 return CO_E_RELEASED
;
1209 FIXME("not implemented\n");
1213 static HRESULT WINAPI
ITextSelection_fnPaste(ITextSelection
*me
, VARIANT
*pVar
, LONG Format
)
1215 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1217 return CO_E_RELEASED
;
1219 FIXME("not implemented\n");
1223 static HRESULT WINAPI
ITextSelection_fnCanPaste(ITextSelection
*me
, VARIANT
*pVar
, LONG Format
,
1226 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1228 return CO_E_RELEASED
;
1230 FIXME("not implemented\n");
1234 static HRESULT WINAPI
ITextSelection_fnCanEdit(ITextSelection
*me
, LONG
*pb
)
1236 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1238 return CO_E_RELEASED
;
1240 FIXME("not implemented\n");
1244 static HRESULT WINAPI
ITextSelection_fnChangeCase(ITextSelection
*me
, LONG Type
)
1246 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1248 return CO_E_RELEASED
;
1250 FIXME("not implemented\n");
1254 static HRESULT WINAPI
ITextSelection_fnGetPoint(ITextSelection
*me
, LONG Type
, LONG
*cx
, LONG
*cy
)
1256 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1258 return CO_E_RELEASED
;
1260 FIXME("not implemented\n");
1264 static HRESULT WINAPI
ITextSelection_fnSetPoint(ITextSelection
*me
, LONG x
, LONG y
, LONG Type
,
1267 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1269 return CO_E_RELEASED
;
1271 FIXME("not implemented\n");
1275 static HRESULT WINAPI
ITextSelection_fnScrollIntoView(ITextSelection
*me
, LONG Value
)
1277 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1279 return CO_E_RELEASED
;
1281 FIXME("not implemented\n");
1285 static HRESULT WINAPI
ITextSelection_fnGetEmbeddedObject(ITextSelection
*me
, IUnknown
**ppv
)
1287 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1289 return CO_E_RELEASED
;
1291 FIXME("not implemented\n");
1295 /*** ITextSelection methods ***/
1296 static HRESULT WINAPI
ITextSelection_fnGetFlags(ITextSelection
*me
, LONG
*pFlags
)
1298 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1300 return CO_E_RELEASED
;
1302 FIXME("not implemented\n");
1306 static HRESULT WINAPI
ITextSelection_fnSetFlags(ITextSelection
*me
, LONG Flags
)
1308 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1310 return CO_E_RELEASED
;
1312 FIXME("not implemented\n");
1316 static HRESULT WINAPI
ITextSelection_fnGetType(ITextSelection
*me
, LONG
*pType
)
1318 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1320 return CO_E_RELEASED
;
1322 FIXME("not implemented\n");
1326 static HRESULT WINAPI
ITextSelection_fnMoveLeft(ITextSelection
*me
, LONG Unit
, LONG Count
,
1327 LONG Extend
, LONG
*pDelta
)
1329 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1331 return CO_E_RELEASED
;
1333 FIXME("not implemented\n");
1337 static HRESULT WINAPI
ITextSelection_fnMoveRight(ITextSelection
*me
, LONG Unit
, LONG Count
,
1338 LONG Extend
, LONG
*pDelta
)
1340 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1342 return CO_E_RELEASED
;
1344 FIXME("not implemented\n");
1348 static HRESULT WINAPI
ITextSelection_fnMoveUp(ITextSelection
*me
, LONG Unit
, LONG Count
,
1349 LONG Extend
, LONG
*pDelta
)
1351 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1353 return CO_E_RELEASED
;
1355 FIXME("not implemented\n");
1359 static HRESULT WINAPI
ITextSelection_fnMoveDown(ITextSelection
*me
, LONG Unit
, LONG Count
,
1360 LONG Extend
, LONG
*pDelta
)
1362 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1364 return CO_E_RELEASED
;
1366 FIXME("not implemented\n");
1370 static HRESULT WINAPI
ITextSelection_fnHomeKey(ITextSelection
*me
, LONG Unit
, LONG Extend
,
1373 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1375 return CO_E_RELEASED
;
1377 FIXME("not implemented\n");
1381 static HRESULT WINAPI
ITextSelection_fnEndKey(ITextSelection
*me
, LONG Unit
, LONG Extend
,
1384 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1386 return CO_E_RELEASED
;
1388 FIXME("not implemented\n");
1392 static HRESULT WINAPI
ITextSelection_fnTypeText(ITextSelection
*me
, BSTR bstr
)
1394 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
1396 return CO_E_RELEASED
;
1398 FIXME("not implemented\n");
1402 static const ITextSelectionVtbl tsvt
= {
1403 ITextSelection_fnQueryInterface
,
1404 ITextSelection_fnAddRef
,
1405 ITextSelection_fnRelease
,
1406 ITextSelection_fnGetTypeInfoCount
,
1407 ITextSelection_fnGetTypeInfo
,
1408 ITextSelection_fnGetIDsOfNames
,
1409 ITextSelection_fnInvoke
,
1410 ITextSelection_fnGetText
,
1411 ITextSelection_fnSetText
,
1412 ITextSelection_fnGetChar
,
1413 ITextSelection_fnSetChar
,
1414 ITextSelection_fnGetDuplicate
,
1415 ITextSelection_fnGetFormattedText
,
1416 ITextSelection_fnSetFormattedText
,
1417 ITextSelection_fnGetStart
,
1418 ITextSelection_fnSetStart
,
1419 ITextSelection_fnGetEnd
,
1420 ITextSelection_fnSetEnd
,
1421 ITextSelection_fnGetFont
,
1422 ITextSelection_fnSetFont
,
1423 ITextSelection_fnGetPara
,
1424 ITextSelection_fnSetPara
,
1425 ITextSelection_fnGetStoryLength
,
1426 ITextSelection_fnGetStoryType
,
1427 ITextSelection_fnCollapse
,
1428 ITextSelection_fnExpand
,
1429 ITextSelection_fnGetIndex
,
1430 ITextSelection_fnSetIndex
,
1431 ITextSelection_fnSetRange
,
1432 ITextSelection_fnInRange
,
1433 ITextSelection_fnInStory
,
1434 ITextSelection_fnIsEqual
,
1435 ITextSelection_fnSelect
,
1436 ITextSelection_fnStartOf
,
1437 ITextSelection_fnEndOf
,
1438 ITextSelection_fnMove
,
1439 ITextSelection_fnMoveStart
,
1440 ITextSelection_fnMoveEnd
,
1441 ITextSelection_fnMoveWhile
,
1442 ITextSelection_fnMoveStartWhile
,
1443 ITextSelection_fnMoveEndWhile
,
1444 ITextSelection_fnMoveUntil
,
1445 ITextSelection_fnMoveStartUntil
,
1446 ITextSelection_fnMoveEndUntil
,
1447 ITextSelection_fnFindText
,
1448 ITextSelection_fnFindTextStart
,
1449 ITextSelection_fnFindTextEnd
,
1450 ITextSelection_fnDelete
,
1451 ITextSelection_fnCut
,
1452 ITextSelection_fnCopy
,
1453 ITextSelection_fnPaste
,
1454 ITextSelection_fnCanPaste
,
1455 ITextSelection_fnCanEdit
,
1456 ITextSelection_fnChangeCase
,
1457 ITextSelection_fnGetPoint
,
1458 ITextSelection_fnSetPoint
,
1459 ITextSelection_fnScrollIntoView
,
1460 ITextSelection_fnGetEmbeddedObject
,
1461 ITextSelection_fnGetFlags
,
1462 ITextSelection_fnSetFlags
,
1463 ITextSelection_fnGetType
,
1464 ITextSelection_fnMoveLeft
,
1465 ITextSelection_fnMoveRight
,
1466 ITextSelection_fnMoveUp
,
1467 ITextSelection_fnMoveDown
,
1468 ITextSelection_fnHomeKey
,
1469 ITextSelection_fnEndKey
,
1470 ITextSelection_fnTypeText
1473 static ITextSelectionImpl
*
1474 CreateTextSelection(IRichEditOleImpl
*reOle
)
1476 ITextSelectionImpl
*txtSel
= heap_alloc(sizeof *txtSel
);
1480 txtSel
->ITextSelection_iface
.lpVtbl
= &tsvt
;
1482 txtSel
->reOle
= reOle
;
1486 LRESULT
CreateIRichEditOle(ME_TextEditor
*editor
, LPVOID
*ppObj
)
1488 IRichEditOleImpl
*reo
;
1490 reo
= heap_alloc(sizeof(IRichEditOleImpl
));
1494 reo
->IRichEditOle_iface
.lpVtbl
= &revt
;
1495 reo
->ITextDocument_iface
.lpVtbl
= &tdvt
;
1497 reo
->editor
= editor
;
1498 reo
->txtSel
= CreateTextSelection(reo
);
1504 reo
->clientSite
= CreateOleClientSite(reo
);
1507 ITextSelection_Release(&reo
->txtSel
->ITextSelection_iface
);
1511 TRACE("Created %p\n",reo
);
1517 static void convert_sizel(const ME_Context
*c
, const SIZEL
* szl
, SIZE
* sz
)
1519 /* sizel is in .01 millimeters, sz in pixels */
1520 sz
->cx
= MulDiv(szl
->cx
, c
->dpi
.cx
, 2540);
1521 sz
->cy
= MulDiv(szl
->cy
, c
->dpi
.cy
, 2540);
1524 /******************************************************************************
1525 * ME_GetOLEObjectSize
1527 * Sets run extent for OLE objects.
1529 void ME_GetOLEObjectSize(const ME_Context
*c
, ME_Run
*run
, SIZE
*pSize
)
1537 assert(run
->nFlags
& MERF_GRAPHICS
);
1538 assert(run
->ole_obj
);
1540 if (run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0)
1542 convert_sizel(c
, &run
->ole_obj
->sizel
, pSize
);
1543 if (c
->editor
->nZoomNumerator
!= 0)
1545 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1546 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1551 IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
);
1552 fmt
.cfFormat
= CF_BITMAP
;
1554 fmt
.dwAspect
= DVASPECT_CONTENT
;
1556 fmt
.tymed
= TYMED_GDI
;
1557 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
1559 fmt
.cfFormat
= CF_ENHMETAFILE
;
1560 fmt
.tymed
= TYMED_ENHMF
;
1561 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
1563 FIXME("unsupported format\n");
1564 pSize
->cx
= pSize
->cy
= 0;
1565 IDataObject_Release(ido
);
1573 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
1574 pSize
->cx
= dibsect
.dsBm
.bmWidth
;
1575 pSize
->cy
= dibsect
.dsBm
.bmHeight
;
1576 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
1579 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
1580 pSize
->cx
= emh
.rclBounds
.right
- emh
.rclBounds
.left
;
1581 pSize
->cy
= emh
.rclBounds
.bottom
- emh
.rclBounds
.top
;
1582 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
1585 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
1588 IDataObject_Release(ido
);
1589 if (c
->editor
->nZoomNumerator
!= 0)
1591 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1592 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1596 void ME_DrawOLE(ME_Context
*c
, int x
, int y
, ME_Run
*run
,
1597 ME_Paragraph
*para
, BOOL selected
)
1608 assert(run
->nFlags
& MERF_GRAPHICS
);
1609 assert(run
->ole_obj
);
1610 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
1612 FIXME("Couldn't get interface\n");
1615 has_size
= run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0;
1616 fmt
.cfFormat
= CF_BITMAP
;
1618 fmt
.dwAspect
= DVASPECT_CONTENT
;
1620 fmt
.tymed
= TYMED_GDI
;
1621 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
1623 fmt
.cfFormat
= CF_ENHMETAFILE
;
1624 fmt
.tymed
= TYMED_ENHMF
;
1625 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
1627 FIXME("Couldn't get storage medium\n");
1628 IDataObject_Release(ido
);
1635 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
1636 hMemDC
= CreateCompatibleDC(c
->hDC
);
1637 SelectObject(hMemDC
, stgm
.u
.hBitmap
);
1640 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
1642 sz
.cx
= MulDiv(dibsect
.dsBm
.bmWidth
, c
->dpi
.cx
, 96);
1643 sz
.cy
= MulDiv(dibsect
.dsBm
.bmHeight
, c
->dpi
.cy
, 96);
1645 if (c
->editor
->nZoomNumerator
!= 0)
1647 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1648 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1650 if (sz
.cx
== dibsect
.dsBm
.bmWidth
&& sz
.cy
== dibsect
.dsBm
.bmHeight
)
1652 BitBlt(c
->hDC
, x
, y
- sz
.cy
,
1653 dibsect
.dsBm
.bmWidth
, dibsect
.dsBm
.bmHeight
,
1654 hMemDC
, 0, 0, SRCCOPY
);
1656 StretchBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
,
1657 hMemDC
, 0, 0, dibsect
.dsBm
.bmWidth
,
1658 dibsect
.dsBm
.bmHeight
, SRCCOPY
);
1661 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
1664 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
1667 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
1669 sz
.cy
= MulDiv(emh
.rclBounds
.bottom
- emh
.rclBounds
.top
, c
->dpi
.cx
, 96);
1670 sz
.cx
= MulDiv(emh
.rclBounds
.right
- emh
.rclBounds
.left
, c
->dpi
.cy
, 96);
1672 if (c
->editor
->nZoomNumerator
!= 0)
1674 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1675 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
1683 rc
.right
= x
+ sz
.cx
;
1685 PlayEnhMetaFile(c
->hDC
, stgm
.u
.hEnhMetaFile
, &rc
);
1687 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
1690 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
1694 if (selected
&& !c
->editor
->bHideSelection
)
1695 PatBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
, DSTINVERT
);
1696 IDataObject_Release(ido
);
1699 void ME_DeleteReObject(REOBJECT
* reo
)
1701 if (reo
->poleobj
) IOleObject_Release(reo
->poleobj
);
1702 if (reo
->pstg
) IStorage_Release(reo
->pstg
);
1703 if (reo
->polesite
) IOleClientSite_Release(reo
->polesite
);
1707 void ME_CopyReObject(REOBJECT
* dst
, const REOBJECT
* src
)
1711 if (dst
->poleobj
) IOleObject_AddRef(dst
->poleobj
);
1712 if (dst
->pstg
) IStorage_AddRef(dst
->pstg
);
1713 if (dst
->polesite
) IOleClientSite_AddRef(dst
->polesite
);