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
24 #define NONAMELESSUNION
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(richedit
);
40 /* there is no way to be consistent across different sets of headers - mingw, Wine, Win32 SDK*/
44 DEFINE_GUID(LIBID_tom
, 0x8cc497c9, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
45 DEFINE_GUID(IID_ITextServices
, 0x8d33f740, 0xcf58, 0x11ce, 0xa8, 0x9d, 0x00, 0xaa, 0x00, 0x6c, 0xad, 0xc5);
46 DEFINE_GUID(IID_ITextHost
, 0x13e670f4,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1);
47 DEFINE_GUID(IID_ITextHost2
, 0x13e670f5,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1);
48 DEFINE_GUID(IID_ITextDocument
, 0x8cc497c0, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
49 DEFINE_GUID(IID_ITextRange
, 0x8cc497c2, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
50 DEFINE_GUID(IID_ITextSelection
, 0x8cc497c1, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
51 DEFINE_GUID(IID_ITextFont
, 0x8cc497c3, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
52 DEFINE_GUID(IID_ITextPara
, 0x8cc497c4, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
54 static ITypeLib
*typelib
;
66 static const IID
* const tid_ids
[] =
75 static ITypeInfo
*typeinfos
[LAST_tid
];
77 static HRESULT
load_typelib(void)
82 hr
= LoadRegTypeLib(&LIBID_tom
, 1, 0, LOCALE_SYSTEM_DEFAULT
, &tl
);
84 ERR("LoadRegTypeLib failed: %08x\n", hr
);
88 if (InterlockedCompareExchangePointer((void**)&typelib
, tl
, NULL
))
93 void release_typelib(void)
100 for (i
= 0; i
< sizeof(typeinfos
)/sizeof(*typeinfos
); i
++)
102 ITypeInfo_Release(typeinfos
[i
]);
104 ITypeLib_Release(typelib
);
107 static HRESULT
get_typeinfo(enum tid_t tid
, ITypeInfo
**typeinfo
)
120 hr
= ITypeLib_GetTypeInfoOfGuid(typelib
, tid_ids
[tid
], &ti
);
123 ERR("GetTypeInfoOfGuid(%s) failed: %08x\n", debugstr_guid(tid_ids
[tid
]), hr
);
127 if (InterlockedCompareExchangePointer((void**)(typeinfos
+tid
), ti
, NULL
))
128 ITypeInfo_Release(ti
);
131 *typeinfo
= typeinfos
[tid
];
135 /* private IID used to get back IRichEditOleImpl pointer */
136 DEFINE_GUID(IID_Igetrichole
, 0xe3ce5c7a, 0x8247, 0x4622, 0x81, 0xad, 0x11, 0x81, 0x02, 0xaa, 0x01, 0x30);
138 typedef struct ITextSelectionImpl ITextSelectionImpl
;
139 typedef struct IOleClientSiteImpl IOleClientSiteImpl
;
140 typedef struct ITextRangeImpl ITextRangeImpl
;
142 enum textfont_prop_id
{
168 FONT_PROPID_FIRST
= FONT_ALLCAPS
171 static const DWORD textfont_prop_masks
[] = {
204 typedef struct IRichEditOleImpl
{
205 IUnknown IUnknown_inner
;
206 IRichEditOle IRichEditOle_iface
;
207 ITextDocument ITextDocument_iface
;
211 ME_TextEditor
*editor
;
212 ITextSelectionImpl
*txtSel
;
213 IOleClientSiteImpl
*clientSite
;
214 struct list rangelist
;
217 struct ITextRangeImpl
{
218 ITextRange ITextRange_iface
;
223 IRichEditOleImpl
*reOle
;
226 struct ITextSelectionImpl
{
227 ITextSelection ITextSelection_iface
;
230 IRichEditOleImpl
*reOle
;
233 typedef struct ITextFontImpl
{
234 ITextFont ITextFont_iface
;
238 textfont_prop_val props
[FONT_PROPID_LAST
];
239 BOOL get_cache_enabled
;
240 BOOL set_cache_enabled
;
243 typedef struct ITextParaImpl
{
244 ITextPara ITextPara_iface
;
250 struct IOleClientSiteImpl
{
251 IOleClientSite IOleClientSite_iface
;
252 IOleWindow IOleWindow_iface
;
253 IOleInPlaceSite IOleInPlaceSite_iface
;
256 IRichEditOleImpl
*reOle
;
259 static inline IRichEditOleImpl
*impl_from_IRichEditOle(IRichEditOle
*iface
)
261 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, IRichEditOle_iface
);
264 static inline IRichEditOleImpl
*impl_from_ITextDocument(ITextDocument
*iface
)
266 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, ITextDocument_iface
);
269 static inline IRichEditOleImpl
*impl_from_IUnknown(IUnknown
*iface
)
271 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, IUnknown_inner
);
274 static inline IOleClientSiteImpl
*impl_from_IOleWindow(IOleWindow
*iface
)
276 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleWindow_iface
);
279 static inline IOleClientSiteImpl
*impl_from_IOleInPlaceSite(IOleInPlaceSite
*iface
)
281 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleInPlaceSite_iface
);
284 static inline ITextRangeImpl
*impl_from_ITextRange(ITextRange
*iface
)
286 return CONTAINING_RECORD(iface
, ITextRangeImpl
, ITextRange_iface
);
289 static inline ITextSelectionImpl
*impl_from_ITextSelection(ITextSelection
*iface
)
291 return CONTAINING_RECORD(iface
, ITextSelectionImpl
, ITextSelection_iface
);
294 static inline ITextFontImpl
*impl_from_ITextFont(ITextFont
*iface
)
296 return CONTAINING_RECORD(iface
, ITextFontImpl
, ITextFont_iface
);
299 static inline ITextParaImpl
*impl_from_ITextPara(ITextPara
*iface
)
301 return CONTAINING_RECORD(iface
, ITextParaImpl
, ITextPara_iface
);
304 static HRESULT
create_textfont(ITextRange
*, const ITextFontImpl
*, ITextFont
**);
305 static HRESULT
create_textpara(ITextRange
*, ITextPara
**);
307 static inline BOOL
is_equal_textfont_prop_value(enum textfont_prop_id propid
, textfont_prop_val
*left
,
308 textfont_prop_val
*right
)
327 case FONT_STRIKETHROUGH
:
329 case FONT_SUPERSCRIPT
:
332 return left
->l
== right
->l
;
334 return !strcmpW(left
->str
, right
->str
);
338 return left
->f
== right
->f
;
340 FIXME("unhandled font property %d\n", propid
);
345 static inline void init_textfont_prop_value(enum textfont_prop_id propid
, textfont_prop_val
*v
)
364 case FONT_STRIKETHROUGH
:
366 case FONT_SUPERSCRIPT
:
380 FIXME("unhandled font property %d\n", propid
);
386 static HRESULT
get_textfont_prop_for_pos(const IRichEditOleImpl
*reole
, int pos
, enum textfont_prop_id propid
,
387 textfont_prop_val
*value
)
392 memset(&fmt
, 0, sizeof(fmt
));
393 fmt
.cbSize
= sizeof(fmt
);
394 fmt
.dwMask
= textfont_prop_masks
[propid
];
396 ME_CursorFromCharOfs(reole
->editor
, pos
, &from
);
398 ME_MoveCursorChars(reole
->editor
, &to
, 1);
399 ME_GetCharFormat(reole
->editor
, &from
, &to
, &fmt
);
404 value
->l
= fmt
.dwEffects
& CFE_ALLCAPS
? tomTrue
: tomFalse
;
407 value
->l
= fmt
.bAnimation
;
410 value
->l
= fmt
.dwEffects
& CFE_AUTOBACKCOLOR
? GetSysColor(COLOR_WINDOW
) : fmt
.crBackColor
;
413 value
->l
= fmt
.dwEffects
& CFE_BOLD
? tomTrue
: tomFalse
;
416 value
->l
= fmt
.dwEffects
& CFE_EMBOSS
? tomTrue
: tomFalse
;
419 value
->l
= fmt
.dwEffects
& CFE_AUTOCOLOR
? GetSysColor(COLOR_WINDOWTEXT
) : fmt
.crTextColor
;
422 value
->l
= fmt
.dwEffects
& CFE_HIDDEN
? tomTrue
: tomFalse
;
425 value
->l
= fmt
.dwEffects
& CFE_IMPRINT
? tomTrue
: tomFalse
;
428 value
->l
= fmt
.dwEffects
& CFE_ITALIC
? tomTrue
: tomFalse
;
431 value
->f
= fmt
.wKerning
;
437 /* this case is used exclusively by GetName() */
438 value
->str
= SysAllocString(fmt
.szFaceName
);
440 return E_OUTOFMEMORY
;
443 value
->l
= fmt
.dwEffects
& CFE_OUTLINE
? tomTrue
: tomFalse
;
446 value
->f
= fmt
.yOffset
;
449 value
->l
= fmt
.dwEffects
& CFE_PROTECTED
? tomTrue
: tomFalse
;
452 value
->l
= fmt
.dwEffects
& CFE_SHADOW
? tomTrue
: tomFalse
;
455 value
->f
= fmt
.yHeight
;
458 value
->l
= fmt
.dwEffects
& CFE_SMALLCAPS
? tomTrue
: tomFalse
;
461 value
->f
= fmt
.sSpacing
;
463 case FONT_STRIKETHROUGH
:
464 value
->l
= fmt
.dwEffects
& CFE_STRIKEOUT
? tomTrue
: tomFalse
;
467 value
->l
= fmt
.dwEffects
& CFE_SUBSCRIPT
? tomTrue
: tomFalse
;
469 case FONT_SUPERSCRIPT
:
470 value
->l
= fmt
.dwEffects
& CFE_SUPERSCRIPT
? tomTrue
: tomFalse
;
473 value
->l
= fmt
.dwEffects
& CFE_UNDERLINE
? tomTrue
: tomFalse
;
476 value
->l
= fmt
.wWeight
;
479 FIXME("unhandled font property %d\n", propid
);
486 static inline const IRichEditOleImpl
*get_range_reole(ITextRange
*range
)
488 IRichEditOleImpl
*reole
= NULL
;
489 ITextRange_QueryInterface(range
, &IID_Igetrichole
, (void**)&reole
);
493 static HRESULT
get_textfont_prop(const ITextFontImpl
*font
, enum textfont_prop_id propid
, textfont_prop_val
*value
)
495 const IRichEditOleImpl
*reole
;
500 /* when font is not attached to any range use cached values */
501 if (!font
->range
|| font
->get_cache_enabled
) {
502 *value
= font
->props
[propid
];
506 if (!(reole
= get_range_reole(font
->range
)))
507 return CO_E_RELEASED
;
509 init_textfont_prop_value(propid
, value
);
511 ITextRange_GetStart(font
->range
, &start
);
512 ITextRange_GetEnd(font
->range
, &end
);
514 /* iterate trough a range to see if property value is consistent */
515 hr
= get_textfont_prop_for_pos(reole
, start
, propid
, &v
);
519 for (i
= start
+ 1; i
< end
; i
++) {
520 textfont_prop_val cur
;
522 hr
= get_textfont_prop_for_pos(reole
, i
, propid
, &cur
);
526 if (!is_equal_textfont_prop_value(propid
, &v
, &cur
))
534 static HRESULT
get_textfont_propf(const ITextFontImpl
*font
, enum textfont_prop_id propid
, FLOAT
*value
)
542 hr
= get_textfont_prop(font
, propid
, &v
);
547 static HRESULT
get_textfont_propl(const ITextFontImpl
*font
, enum textfont_prop_id propid
, LONG
*value
)
555 hr
= get_textfont_prop(font
, propid
, &v
);
560 /* Value should already have a terminal value, for boolean properties it means tomToggle is not handled */
561 static HRESULT
set_textfont_prop(ITextFontImpl
*font
, enum textfont_prop_id propid
, const textfont_prop_val
*value
)
563 const IRichEditOleImpl
*reole
;
568 /* when font is not attached to any range use cache */
569 if (!font
->range
|| font
->set_cache_enabled
) {
570 font
->props
[propid
] = *value
;
574 if (!(reole
= get_range_reole(font
->range
)))
575 return CO_E_RELEASED
;
577 memset(&fmt
, 0, sizeof(fmt
));
578 fmt
.cbSize
= sizeof(fmt
);
579 fmt
.dwMask
= textfont_prop_masks
[propid
];
584 fmt
.dwEffects
= value
->l
== tomTrue
? CFE_ITALIC
: 0;
587 FIXME("unhandled font property %d\n", propid
);
591 ITextRange_GetStart(font
->range
, &start
);
592 ITextRange_GetEnd(font
->range
, &end
);
594 ME_CursorFromCharOfs(reole
->editor
, start
, &from
);
595 ME_CursorFromCharOfs(reole
->editor
, end
, &to
);
596 ME_SetCharFormat(reole
->editor
, &from
, &to
, &fmt
);
601 static HRESULT
set_textfont_propd(ITextFontImpl
*font
, enum textfont_prop_id propid
, LONG value
)
611 get_textfont_propl(font
, propid
, &oldvalue
);
612 if (oldvalue
== tomFalse
)
614 else if (oldvalue
== tomTrue
)
623 return set_textfont_prop(font
, propid
, &v
);
629 static HRESULT
textfont_getname_from_range(ITextRange
*range
, BSTR
*ret
)
631 const IRichEditOleImpl
*reole
;
636 if (!(reole
= get_range_reole(range
)))
637 return CO_E_RELEASED
;
639 ITextRange_GetStart(range
, &start
);
640 hr
= get_textfont_prop_for_pos(reole
, start
, FONT_NAME
, &v
);
645 static void textfont_cache_range_props(ITextFontImpl
*font
)
647 enum textfont_prop_id propid
;
648 for (propid
= FONT_PROPID_FIRST
; propid
< FONT_PROPID_LAST
; propid
++) {
649 if (propid
== FONT_NAME
)
650 textfont_getname_from_range(font
->range
, &font
->props
[propid
].str
);
652 get_textfont_prop(font
, propid
, &font
->props
[propid
]);
656 static HRESULT WINAPI
IRichEditOleImpl_inner_fnQueryInterface(IUnknown
*iface
, REFIID riid
, LPVOID
*ppvObj
)
658 IRichEditOleImpl
*This
= impl_from_IUnknown(iface
);
660 TRACE("%p %s\n", This
, debugstr_guid(riid
));
663 if (IsEqualGUID(riid
, &IID_IUnknown
))
664 *ppvObj
= &This
->IUnknown_inner
;
665 else if (IsEqualGUID(riid
, &IID_IRichEditOle
))
666 *ppvObj
= &This
->IRichEditOle_iface
;
667 else if (IsEqualGUID(riid
, &IID_ITextDocument
))
668 *ppvObj
= &This
->ITextDocument_iface
;
671 IUnknown_AddRef((IUnknown
*)*ppvObj
);
674 FIXME("%p: unhandled interface %s\n", This
, debugstr_guid(riid
));
676 return E_NOINTERFACE
;
679 static ULONG WINAPI
IRichEditOleImpl_inner_fnAddRef(IUnknown
*iface
)
681 IRichEditOleImpl
*This
= impl_from_IUnknown(iface
);
682 ULONG ref
= InterlockedIncrement(&This
->ref
);
684 TRACE("%p ref = %u\n", This
, ref
);
689 static ULONG WINAPI
IRichEditOleImpl_inner_fnRelease(IUnknown
*iface
)
691 IRichEditOleImpl
*This
= impl_from_IUnknown(iface
);
692 ULONG ref
= InterlockedDecrement(&This
->ref
);
694 TRACE ("%p ref=%u\n", This
, ref
);
698 ITextRangeImpl
*txtRge
;
700 TRACE("Destroying %p\n", This
);
701 This
->txtSel
->reOle
= NULL
;
702 This
->editor
->reOle
= NULL
;
703 ITextSelection_Release(&This
->txtSel
->ITextSelection_iface
);
704 IOleClientSite_Release(&This
->clientSite
->IOleClientSite_iface
);
705 LIST_FOR_EACH_ENTRY(txtRge
, &This
->rangelist
, ITextRangeImpl
, entry
)
706 txtRge
->reOle
= NULL
;
712 static const IUnknownVtbl reo_unk_vtbl
=
714 IRichEditOleImpl_inner_fnQueryInterface
,
715 IRichEditOleImpl_inner_fnAddRef
,
716 IRichEditOleImpl_inner_fnRelease
719 static HRESULT WINAPI
720 IRichEditOle_fnQueryInterface(IRichEditOle
*me
, REFIID riid
, LPVOID
*ppvObj
)
722 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
723 return IUnknown_QueryInterface(This
->outer_unk
, riid
, ppvObj
);
727 IRichEditOle_fnAddRef(IRichEditOle
*me
)
729 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
730 return IUnknown_AddRef(This
->outer_unk
);
734 IRichEditOle_fnRelease(IRichEditOle
*me
)
736 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
737 return IUnknown_Release(This
->outer_unk
);
740 static HRESULT WINAPI
741 IRichEditOle_fnActivateAs(IRichEditOle
*me
, REFCLSID rclsid
, REFCLSID rclsidAs
)
743 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
744 FIXME("stub %p\n",This
);
748 static HRESULT WINAPI
749 IRichEditOle_fnContextSensitiveHelp(IRichEditOle
*me
, BOOL fEnterMode
)
751 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
752 FIXME("stub %p\n",This
);
756 static HRESULT WINAPI
757 IRichEditOle_fnConvertObject(IRichEditOle
*me
, LONG iob
,
758 REFCLSID rclsidNew
, LPCSTR lpstrUserTypeNew
)
760 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
761 FIXME("stub %p\n",This
);
765 static inline IOleClientSiteImpl
*impl_from_IOleClientSite(IOleClientSite
*iface
)
767 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleClientSite_iface
);
770 static HRESULT WINAPI
771 IOleClientSite_fnQueryInterface(IOleClientSite
*me
, REFIID riid
, LPVOID
*ppvObj
)
773 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(me
);
774 TRACE("%p %s\n", me
, debugstr_guid(riid
) );
777 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
778 IsEqualGUID(riid
, &IID_IOleClientSite
))
780 else if (IsEqualGUID(riid
, &IID_IOleWindow
))
781 *ppvObj
= &This
->IOleWindow_iface
;
782 else if (IsEqualGUID(riid
, &IID_IOleInPlaceSite
))
783 *ppvObj
= &This
->IOleInPlaceSite_iface
;
786 IOleClientSite_AddRef(me
);
789 FIXME("%p: unhandled interface %s\n", me
, debugstr_guid(riid
) );
791 return E_NOINTERFACE
;
794 static ULONG WINAPI
IOleClientSite_fnAddRef(IOleClientSite
*iface
)
796 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
797 return InterlockedIncrement(&This
->ref
);
800 static ULONG WINAPI
IOleClientSite_fnRelease(IOleClientSite
*iface
)
802 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
803 ULONG ref
= InterlockedDecrement(&This
->ref
);
809 static HRESULT WINAPI
IOleClientSite_fnSaveObject(IOleClientSite
*iface
)
811 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
813 return CO_E_RELEASED
;
815 FIXME("stub %p\n", iface
);
820 static HRESULT WINAPI
IOleClientSite_fnGetMoniker(IOleClientSite
*iface
, DWORD dwAssign
,
821 DWORD dwWhichMoniker
, IMoniker
**ppmk
)
823 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
825 return CO_E_RELEASED
;
827 FIXME("stub %p\n", iface
);
831 static HRESULT WINAPI
IOleClientSite_fnGetContainer(IOleClientSite
*iface
,
832 IOleContainer
**ppContainer
)
834 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
836 return CO_E_RELEASED
;
838 FIXME("stub %p\n", iface
);
842 static HRESULT WINAPI
IOleClientSite_fnShowObject(IOleClientSite
*iface
)
844 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
846 return CO_E_RELEASED
;
848 FIXME("stub %p\n", iface
);
852 static HRESULT WINAPI
IOleClientSite_fnOnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
854 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
856 return CO_E_RELEASED
;
858 FIXME("stub %p\n", iface
);
862 static HRESULT WINAPI
IOleClientSite_fnRequestNewObjectLayout(IOleClientSite
*iface
)
864 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
866 return CO_E_RELEASED
;
868 FIXME("stub %p\n", iface
);
872 static const IOleClientSiteVtbl ocst
= {
873 IOleClientSite_fnQueryInterface
,
874 IOleClientSite_fnAddRef
,
875 IOleClientSite_fnRelease
,
876 IOleClientSite_fnSaveObject
,
877 IOleClientSite_fnGetMoniker
,
878 IOleClientSite_fnGetContainer
,
879 IOleClientSite_fnShowObject
,
880 IOleClientSite_fnOnShowWindow
,
881 IOleClientSite_fnRequestNewObjectLayout
884 /* IOleWindow interface */
885 static HRESULT WINAPI
IOleWindow_fnQueryInterface(IOleWindow
*iface
, REFIID riid
, void **ppvObj
)
887 IOleClientSiteImpl
*This
= impl_from_IOleWindow(iface
);
888 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppvObj
);
891 static ULONG WINAPI
IOleWindow_fnAddRef(IOleWindow
*iface
)
893 IOleClientSiteImpl
*This
= impl_from_IOleWindow(iface
);
894 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
897 static ULONG WINAPI
IOleWindow_fnRelease(IOleWindow
*iface
)
899 IOleClientSiteImpl
*This
= impl_from_IOleWindow(iface
);
900 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
903 static HRESULT WINAPI
IOleWindow_fnContextSensitiveHelp(IOleWindow
*iface
, BOOL fEnterMode
)
905 IOleClientSiteImpl
*This
= impl_from_IOleWindow(iface
);
906 FIXME("not implemented: (%p)->(%d)\n", This
, fEnterMode
);
910 static HRESULT WINAPI
IOleWindow_fnGetWindow(IOleWindow
*iface
, HWND
*phwnd
)
912 IOleClientSiteImpl
*This
= impl_from_IOleWindow(iface
);
913 TRACE("(%p)->(%p)\n", This
, phwnd
);
918 *phwnd
= This
->reOle
->editor
->hWnd
;
922 static const IOleWindowVtbl olewinvt
= {
923 IOleWindow_fnQueryInterface
,
925 IOleWindow_fnRelease
,
926 IOleWindow_fnGetWindow
,
927 IOleWindow_fnContextSensitiveHelp
930 /* IOleInPlaceSite interface */
931 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnQueryInterface(IOleInPlaceSite
*iface
, REFIID riid
, void **ppvObj
)
933 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
934 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppvObj
);
937 static ULONG STDMETHODCALLTYPE
IOleInPlaceSite_fnAddRef(IOleInPlaceSite
*iface
)
939 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
940 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
943 static ULONG STDMETHODCALLTYPE
IOleInPlaceSite_fnRelease(IOleInPlaceSite
*iface
)
945 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
946 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
949 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnGetWindow(IOleInPlaceSite
*iface
, HWND
*phwnd
)
951 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
952 return IOleWindow_GetWindow(&This
->IOleWindow_iface
, phwnd
);
955 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnContextSensitiveHelp(IOleInPlaceSite
*iface
, BOOL fEnterMode
)
957 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
958 return IOleWindow_ContextSensitiveHelp(&This
->IOleWindow_iface
, fEnterMode
);
961 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnCanInPlaceActivate(IOleInPlaceSite
*iface
)
963 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
964 FIXME("not implemented: (%p)\n", This
);
968 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnInPlaceActivate(IOleInPlaceSite
*iface
)
970 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
971 FIXME("not implemented: (%p)\n", This
);
975 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnUIActivate(IOleInPlaceSite
*iface
)
977 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
978 FIXME("not implemented: (%p)\n", This
);
982 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnGetWindowContext(IOleInPlaceSite
*iface
, IOleInPlaceFrame
**ppFrame
,
983 IOleInPlaceUIWindow
**ppDoc
, LPRECT lprcPosRect
,
984 LPRECT lprcClipRect
, LPOLEINPLACEFRAMEINFO lpFrameInfo
)
986 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
987 FIXME("not implemented: (%p)->(%p %p %p %p %p)\n", This
, ppFrame
, ppDoc
, lprcPosRect
, lprcClipRect
, lpFrameInfo
);
991 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnScroll(IOleInPlaceSite
*iface
, SIZE scrollExtent
)
993 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
994 FIXME("not implemented: (%p)\n", This
);
998 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnUIDeactivate(IOleInPlaceSite
*iface
, BOOL fUndoable
)
1000 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1001 FIXME("not implemented: (%p)->(%d)\n", This
, fUndoable
);
1005 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnInPlaceDeactivate(IOleInPlaceSite
*iface
)
1007 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1008 FIXME("not implemented: (%p)\n", This
);
1012 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnDiscardUndoState(IOleInPlaceSite
*iface
)
1014 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1015 FIXME("not implemented: (%p)\n", This
);
1019 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnDeactivateAndUndo(IOleInPlaceSite
*iface
)
1021 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1022 FIXME("not implemented: (%p)\n", This
);
1026 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnPosRectChange(IOleInPlaceSite
*iface
, LPCRECT lprcPosRect
)
1028 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1029 FIXME("not implemented: (%p)->(%p)\n", This
, lprcPosRect
);
1033 static const IOleInPlaceSiteVtbl olestvt
=
1035 IOleInPlaceSite_fnQueryInterface
,
1036 IOleInPlaceSite_fnAddRef
,
1037 IOleInPlaceSite_fnRelease
,
1038 IOleInPlaceSite_fnGetWindow
,
1039 IOleInPlaceSite_fnContextSensitiveHelp
,
1040 IOleInPlaceSite_fnCanInPlaceActivate
,
1041 IOleInPlaceSite_fnOnInPlaceActivate
,
1042 IOleInPlaceSite_fnOnUIActivate
,
1043 IOleInPlaceSite_fnGetWindowContext
,
1044 IOleInPlaceSite_fnScroll
,
1045 IOleInPlaceSite_fnOnUIDeactivate
,
1046 IOleInPlaceSite_fnOnInPlaceDeactivate
,
1047 IOleInPlaceSite_fnDiscardUndoState
,
1048 IOleInPlaceSite_fnDeactivateAndUndo
,
1049 IOleInPlaceSite_fnOnPosRectChange
1052 static IOleClientSiteImpl
*
1053 CreateOleClientSite(IRichEditOleImpl
*reOle
)
1055 IOleClientSiteImpl
*clientSite
= heap_alloc(sizeof *clientSite
);
1059 clientSite
->IOleClientSite_iface
.lpVtbl
= &ocst
;
1060 clientSite
->IOleWindow_iface
.lpVtbl
= &olewinvt
;
1061 clientSite
->IOleInPlaceSite_iface
.lpVtbl
= &olestvt
;
1062 clientSite
->ref
= 1;
1063 clientSite
->reOle
= reOle
;
1067 static HRESULT WINAPI
1068 IRichEditOle_fnGetClientSite(IRichEditOle
*me
,
1069 LPOLECLIENTSITE
*lplpolesite
)
1071 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1073 TRACE("%p,%p\n",This
, lplpolesite
);
1076 return E_INVALIDARG
;
1077 *lplpolesite
= &This
->clientSite
->IOleClientSite_iface
;
1078 IOleClientSite_AddRef(*lplpolesite
);
1082 static HRESULT WINAPI
1083 IRichEditOle_fnGetClipboardData(IRichEditOle
*me
, CHARRANGE
*lpchrg
,
1084 DWORD reco
, LPDATAOBJECT
*lplpdataobj
)
1086 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1090 TRACE("(%p,%p,%d)\n",This
, lpchrg
, reco
);
1092 return E_INVALIDARG
;
1094 int nFrom
, nTo
, nStartCur
= ME_GetSelectionOfs(This
->editor
, &nFrom
, &nTo
);
1095 start
= This
->editor
->pCursors
[nStartCur
];
1096 nChars
= nTo
- nFrom
;
1098 ME_CursorFromCharOfs(This
->editor
, lpchrg
->cpMin
, &start
);
1099 nChars
= lpchrg
->cpMax
- lpchrg
->cpMin
;
1101 return ME_GetDataObject(This
->editor
, &start
, nChars
, lplpdataobj
);
1104 static LONG WINAPI
IRichEditOle_fnGetLinkCount(IRichEditOle
*me
)
1106 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1107 FIXME("stub %p\n",This
);
1111 static HRESULT WINAPI
1112 IRichEditOle_fnGetObject(IRichEditOle
*me
, LONG iob
,
1113 REOBJECT
*lpreobject
, DWORD dwFlags
)
1115 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1116 FIXME("stub %p\n",This
);
1121 IRichEditOle_fnGetObjectCount(IRichEditOle
*me
)
1123 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1124 FIXME("stub %p\n",This
);
1128 static HRESULT WINAPI
1129 IRichEditOle_fnHandsOffStorage(IRichEditOle
*me
, LONG iob
)
1131 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1132 FIXME("stub %p\n",This
);
1136 static HRESULT WINAPI
1137 IRichEditOle_fnImportDataObject(IRichEditOle
*me
, LPDATAOBJECT lpdataobj
,
1138 CLIPFORMAT cf
, HGLOBAL hMetaPict
)
1140 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1141 FIXME("stub %p\n",This
);
1145 static HRESULT WINAPI
1146 IRichEditOle_fnInPlaceDeactivate(IRichEditOle
*me
)
1148 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1149 FIXME("stub %p\n",This
);
1153 static HRESULT WINAPI
1154 IRichEditOle_fnInsertObject(IRichEditOle
*me
, REOBJECT
*reo
)
1156 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1157 TRACE("(%p,%p)\n", This
, reo
);
1159 if (reo
->cbStruct
< sizeof(*reo
)) return STG_E_INVALIDPARAMETER
;
1161 ME_InsertOLEFromCursor(This
->editor
, reo
, 0);
1162 ME_CommitUndo(This
->editor
);
1163 ME_UpdateRepaint(This
->editor
, FALSE
);
1167 static HRESULT WINAPI
IRichEditOle_fnSaveCompleted(IRichEditOle
*me
, LONG iob
,
1170 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1171 FIXME("stub %p\n",This
);
1175 static HRESULT WINAPI
1176 IRichEditOle_fnSetDvaspect(IRichEditOle
*me
, LONG iob
, DWORD dvaspect
)
1178 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1179 FIXME("stub %p\n",This
);
1183 static HRESULT WINAPI
IRichEditOle_fnSetHostNames(IRichEditOle
*me
,
1184 LPCSTR lpstrContainerApp
, LPCSTR lpstrContainerObj
)
1186 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1187 FIXME("stub %p %s %s\n",This
, lpstrContainerApp
, lpstrContainerObj
);
1191 static HRESULT WINAPI
1192 IRichEditOle_fnSetLinkAvailable(IRichEditOle
*me
, LONG iob
, BOOL fAvailable
)
1194 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1195 FIXME("stub %p\n",This
);
1199 static const IRichEditOleVtbl revt
= {
1200 IRichEditOle_fnQueryInterface
,
1201 IRichEditOle_fnAddRef
,
1202 IRichEditOle_fnRelease
,
1203 IRichEditOle_fnGetClientSite
,
1204 IRichEditOle_fnGetObjectCount
,
1205 IRichEditOle_fnGetLinkCount
,
1206 IRichEditOle_fnGetObject
,
1207 IRichEditOle_fnInsertObject
,
1208 IRichEditOle_fnConvertObject
,
1209 IRichEditOle_fnActivateAs
,
1210 IRichEditOle_fnSetHostNames
,
1211 IRichEditOle_fnSetLinkAvailable
,
1212 IRichEditOle_fnSetDvaspect
,
1213 IRichEditOle_fnHandsOffStorage
,
1214 IRichEditOle_fnSaveCompleted
,
1215 IRichEditOle_fnInPlaceDeactivate
,
1216 IRichEditOle_fnContextSensitiveHelp
,
1217 IRichEditOle_fnGetClipboardData
,
1218 IRichEditOle_fnImportDataObject
1221 /* ITextRange interface */
1222 static HRESULT WINAPI
ITextRange_fnQueryInterface(ITextRange
*me
, REFIID riid
, void **ppvObj
)
1224 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1227 if (IsEqualGUID(riid
, &IID_IUnknown
)
1228 || IsEqualGUID(riid
, &IID_IDispatch
)
1229 || IsEqualGUID(riid
, &IID_ITextRange
))
1232 ITextRange_AddRef(me
);
1235 else if (IsEqualGUID(riid
, &IID_Igetrichole
))
1237 *ppvObj
= This
->reOle
;
1241 return E_NOINTERFACE
;
1244 static ULONG WINAPI
ITextRange_fnAddRef(ITextRange
*me
)
1246 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1247 return InterlockedIncrement(&This
->ref
);
1250 static ULONG WINAPI
ITextRange_fnRelease(ITextRange
*me
)
1252 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1253 ULONG ref
= InterlockedDecrement(&This
->ref
);
1255 TRACE ("%p ref=%u\n", This
, ref
);
1260 list_remove(&This
->entry
);
1268 static HRESULT WINAPI
ITextRange_fnGetTypeInfoCount(ITextRange
*me
, UINT
*pctinfo
)
1270 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1271 TRACE("(%p)->(%p)\n", This
, pctinfo
);
1276 static HRESULT WINAPI
ITextRange_fnGetTypeInfo(ITextRange
*me
, UINT iTInfo
, LCID lcid
,
1277 ITypeInfo
**ppTInfo
)
1279 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1282 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
1284 hr
= get_typeinfo(ITextRange_tid
, ppTInfo
);
1286 ITypeInfo_AddRef(*ppTInfo
);
1290 static HRESULT WINAPI
ITextRange_fnGetIDsOfNames(ITextRange
*me
, REFIID riid
, LPOLESTR
*rgszNames
,
1291 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1293 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1297 TRACE("(%p)->(%p,%p,%u,%d,%p)\n", This
, riid
, rgszNames
, cNames
, lcid
,
1300 hr
= get_typeinfo(ITextRange_tid
, &ti
);
1302 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
1306 static HRESULT WINAPI
ITextRange_fnInvoke(ITextRange
*me
, DISPID dispIdMember
, REFIID riid
,
1307 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1308 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
1311 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1315 TRACE("(%p)->(%d,%p,%d,%u,%p,%p,%p,%p)\n", This
, dispIdMember
, riid
, lcid
,
1316 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1318 hr
= get_typeinfo(ITextRange_tid
, &ti
);
1320 hr
= ITypeInfo_Invoke(ti
, me
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1324 static HRESULT WINAPI
ITextRange_fnGetText(ITextRange
*me
, BSTR
*pbstr
)
1326 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1328 FIXME("(%p)->(%p): stub\n", This
, pbstr
);
1331 return CO_E_RELEASED
;
1334 return E_INVALIDARG
;
1340 static HRESULT WINAPI
ITextRange_fnSetText(ITextRange
*me
, BSTR bstr
)
1342 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1344 return CO_E_RELEASED
;
1346 FIXME("not implemented %p\n", This
);
1350 static HRESULT
range_GetChar(ME_TextEditor
*editor
, ME_Cursor
*cursor
, LONG
*pch
)
1354 ME_GetTextW(editor
, wch
, 1, cursor
, 1, FALSE
, cursor
->pRun
->next
->type
== diTextEnd
);
1360 static HRESULT WINAPI
ITextRange_fnGetChar(ITextRange
*me
, LONG
*pch
)
1362 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1366 return CO_E_RELEASED
;
1369 return E_INVALIDARG
;
1371 ME_CursorFromCharOfs(This
->reOle
->editor
, This
->start
, &cursor
);
1372 return range_GetChar(This
->reOle
->editor
, &cursor
, pch
);
1375 static HRESULT WINAPI
ITextRange_fnSetChar(ITextRange
*me
, LONG ch
)
1377 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1379 return CO_E_RELEASED
;
1381 FIXME("not implemented %p\n", This
);
1385 static HRESULT
CreateITextRange(IRichEditOleImpl
*reOle
, LONG start
, LONG end
, ITextRange
** ppRange
);
1387 static HRESULT WINAPI
ITextRange_fnGetDuplicate(ITextRange
*me
, ITextRange
**ppRange
)
1389 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1391 return CO_E_RELEASED
;
1393 TRACE("%p %p\n", This
, ppRange
);
1395 return E_INVALIDARG
;
1397 return CreateITextRange(This
->reOle
, This
->start
, This
->end
, ppRange
);
1400 static HRESULT WINAPI
ITextRange_fnGetFormattedText(ITextRange
*me
, ITextRange
**ppRange
)
1402 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1404 return CO_E_RELEASED
;
1406 FIXME("not implemented %p\n", This
);
1410 static HRESULT WINAPI
ITextRange_fnSetFormattedText(ITextRange
*me
, ITextRange
*pRange
)
1412 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1414 return CO_E_RELEASED
;
1416 FIXME("not implemented %p\n", This
);
1420 static HRESULT WINAPI
ITextRange_fnGetStart(ITextRange
*me
, LONG
*start
)
1422 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1424 TRACE("(%p)->(%p)\n", This
, start
);
1427 return CO_E_RELEASED
;
1430 return E_INVALIDARG
;
1432 *start
= This
->start
;
1436 static HRESULT
textrange_setstart(const IRichEditOleImpl
*reole
, LONG value
, LONG
*start
, LONG
*end
)
1443 if (value
== *start
)
1446 if (value
<= *end
) {
1451 len
= ME_GetTextLength(reole
->editor
);
1452 *start
= *end
= value
> len
? len
: value
;
1456 static HRESULT WINAPI
ITextRange_fnSetStart(ITextRange
*me
, LONG value
)
1458 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1460 TRACE("(%p)->(%d)\n", This
, value
);
1463 return CO_E_RELEASED
;
1465 return textrange_setstart(This
->reOle
, value
, &This
->start
, &This
->end
);
1468 static HRESULT WINAPI
ITextRange_fnGetEnd(ITextRange
*me
, LONG
*end
)
1470 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1472 TRACE("(%p)->(%p)\n", This
, end
);
1475 return CO_E_RELEASED
;
1478 return E_INVALIDARG
;
1484 static HRESULT
textrange_setend(const IRichEditOleImpl
*reole
, LONG value
, LONG
*start
, LONG
*end
)
1491 if (value
< *start
) {
1492 *start
= *end
= max(0, value
);
1496 len
= ME_GetTextLength(reole
->editor
);
1497 *end
= value
> len
? len
+ 1 : value
;
1501 static HRESULT WINAPI
ITextRange_fnSetEnd(ITextRange
*me
, LONG value
)
1503 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1505 TRACE("(%p)->(%d)\n", This
, value
);
1508 return CO_E_RELEASED
;
1510 return textrange_setend(This
->reOle
, value
, &This
->start
, &This
->end
);
1513 static HRESULT WINAPI
ITextRange_fnGetFont(ITextRange
*me
, ITextFont
**font
)
1515 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1517 TRACE("(%p)->(%p)\n", This
, font
);
1520 return CO_E_RELEASED
;
1523 return E_INVALIDARG
;
1525 return create_textfont(me
, NULL
, font
);
1528 static HRESULT WINAPI
ITextRange_fnSetFont(ITextRange
*me
, ITextFont
*pFont
)
1530 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1532 return CO_E_RELEASED
;
1534 FIXME("not implemented %p\n", This
);
1538 static HRESULT WINAPI
ITextRange_fnGetPara(ITextRange
*me
, ITextPara
**para
)
1540 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1542 TRACE("(%p)->(%p)\n", This
, para
);
1545 return CO_E_RELEASED
;
1548 return E_INVALIDARG
;
1550 return create_textpara(me
, para
);
1553 static HRESULT WINAPI
ITextRange_fnSetPara(ITextRange
*me
, ITextPara
*pPara
)
1555 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1557 return CO_E_RELEASED
;
1559 FIXME("not implemented %p\n", This
);
1563 static HRESULT WINAPI
ITextRange_fnGetStoryLength(ITextRange
*me
, LONG
*pcch
)
1565 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1567 return CO_E_RELEASED
;
1569 FIXME("not implemented %p\n", This
);
1573 static HRESULT WINAPI
ITextRange_fnGetStoryType(ITextRange
*me
, LONG
*pValue
)
1575 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1577 return CO_E_RELEASED
;
1579 FIXME("not implemented %p\n", This
);
1583 static HRESULT
range_Collapse(LONG bStart
, LONG
*start
, LONG
*end
)
1588 if (bStart
== tomEnd
|| bStart
== tomFalse
)
1595 static HRESULT WINAPI
ITextRange_fnCollapse(ITextRange
*me
, LONG bStart
)
1597 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1599 return CO_E_RELEASED
;
1601 return range_Collapse(bStart
, &This
->start
, &This
->end
);
1604 static HRESULT WINAPI
ITextRange_fnExpand(ITextRange
*me
, LONG Unit
, LONG
*pDelta
)
1606 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1608 return CO_E_RELEASED
;
1610 FIXME("not implemented %p\n", This
);
1614 static HRESULT WINAPI
ITextRange_fnGetIndex(ITextRange
*me
, LONG Unit
, LONG
*pIndex
)
1616 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1618 return CO_E_RELEASED
;
1620 FIXME("not implemented %p\n", This
);
1624 static HRESULT WINAPI
ITextRange_fnSetIndex(ITextRange
*me
, LONG Unit
, LONG Index
,
1627 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1629 return CO_E_RELEASED
;
1631 FIXME("not implemented %p\n", This
);
1635 static HRESULT WINAPI
ITextRange_fnSetRange(ITextRange
*me
, LONG cpActive
, LONG cpOther
)
1637 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1639 return CO_E_RELEASED
;
1641 FIXME("not implemented %p\n", This
);
1645 static HRESULT WINAPI
ITextRange_fnInRange(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
1647 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1649 return CO_E_RELEASED
;
1651 FIXME("not implemented %p\n", This
);
1655 static HRESULT WINAPI
ITextRange_fnInStory(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
1657 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1659 return CO_E_RELEASED
;
1661 FIXME("not implemented %p\n", This
);
1665 static HRESULT WINAPI
ITextRange_fnIsEqual(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
1667 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1669 return CO_E_RELEASED
;
1671 FIXME("not implemented %p\n", This
);
1675 static HRESULT WINAPI
ITextRange_fnSelect(ITextRange
*me
)
1677 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1679 return CO_E_RELEASED
;
1681 FIXME("not implemented %p\n", This
);
1685 static HRESULT WINAPI
ITextRange_fnStartOf(ITextRange
*me
, LONG Unit
, LONG Extend
,
1688 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1690 return CO_E_RELEASED
;
1692 FIXME("not implemented %p\n", This
);
1696 static HRESULT WINAPI
ITextRange_fnEndOf(ITextRange
*me
, LONG Unit
, LONG Extend
,
1699 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1701 return CO_E_RELEASED
;
1703 FIXME("not implemented %p\n", This
);
1707 static HRESULT WINAPI
ITextRange_fnMove(ITextRange
*me
, LONG Unit
, LONG Count
, LONG
*pDelta
)
1709 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1711 return CO_E_RELEASED
;
1713 FIXME("not implemented %p\n", This
);
1717 static HRESULT WINAPI
ITextRange_fnMoveStart(ITextRange
*me
, LONG Unit
, LONG Count
,
1720 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1722 return CO_E_RELEASED
;
1724 FIXME("not implemented %p\n", This
);
1728 static HRESULT WINAPI
ITextRange_fnMoveEnd(ITextRange
*me
, LONG Unit
, LONG Count
,
1731 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1733 return CO_E_RELEASED
;
1735 FIXME("not implemented %p\n", This
);
1739 static HRESULT WINAPI
ITextRange_fnMoveWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
1742 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1744 return CO_E_RELEASED
;
1746 FIXME("not implemented %p\n", This
);
1750 static HRESULT WINAPI
ITextRange_fnMoveStartWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
1753 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1755 return CO_E_RELEASED
;
1757 FIXME("not implemented %p\n", This
);
1761 static HRESULT WINAPI
ITextRange_fnMoveEndWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
1764 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1766 return CO_E_RELEASED
;
1768 FIXME("not implemented %p\n", This
);
1772 static HRESULT WINAPI
ITextRange_fnMoveUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
1775 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1777 return CO_E_RELEASED
;
1779 FIXME("not implemented %p\n", This
);
1783 static HRESULT WINAPI
ITextRange_fnMoveStartUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
1786 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1788 return CO_E_RELEASED
;
1790 FIXME("not implemented %p\n", This
);
1794 static HRESULT WINAPI
ITextRange_fnMoveEndUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
1797 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1799 return CO_E_RELEASED
;
1801 FIXME("not implemented %p\n", This
);
1805 static HRESULT WINAPI
ITextRange_fnFindText(ITextRange
*me
, BSTR bstr
, LONG cch
, LONG Flags
,
1808 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1810 return CO_E_RELEASED
;
1812 FIXME("not implemented %p\n", This
);
1816 static HRESULT WINAPI
ITextRange_fnFindTextStart(ITextRange
*me
, BSTR bstr
, LONG cch
,
1817 LONG Flags
, LONG
*pLength
)
1819 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1821 return CO_E_RELEASED
;
1823 FIXME("not implemented %p\n", This
);
1827 static HRESULT WINAPI
ITextRange_fnFindTextEnd(ITextRange
*me
, BSTR bstr
, LONG cch
,
1828 LONG Flags
, LONG
*pLength
)
1830 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1832 return CO_E_RELEASED
;
1834 FIXME("not implemented %p\n", This
);
1838 static HRESULT WINAPI
ITextRange_fnDelete(ITextRange
*me
, LONG Unit
, LONG Count
,
1841 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1843 return CO_E_RELEASED
;
1845 FIXME("not implemented %p\n", This
);
1849 static HRESULT WINAPI
ITextRange_fnCut(ITextRange
*me
, VARIANT
*pVar
)
1851 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1853 return CO_E_RELEASED
;
1855 FIXME("not implemented %p\n", This
);
1859 static HRESULT WINAPI
ITextRange_fnCopy(ITextRange
*me
, VARIANT
*pVar
)
1861 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1863 return CO_E_RELEASED
;
1865 FIXME("not implemented %p\n", This
);
1869 static HRESULT WINAPI
ITextRange_fnPaste(ITextRange
*me
, VARIANT
*pVar
, LONG Format
)
1871 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1873 return CO_E_RELEASED
;
1875 FIXME("not implemented %p\n", This
);
1879 static HRESULT WINAPI
ITextRange_fnCanPaste(ITextRange
*me
, VARIANT
*pVar
, LONG Format
,
1882 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1884 return CO_E_RELEASED
;
1886 FIXME("not implemented %p\n", This
);
1890 static HRESULT WINAPI
ITextRange_fnCanEdit(ITextRange
*me
, LONG
*pb
)
1892 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1894 return CO_E_RELEASED
;
1896 FIXME("not implemented %p\n", This
);
1900 static HRESULT WINAPI
ITextRange_fnChangeCase(ITextRange
*me
, LONG Type
)
1902 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1904 return CO_E_RELEASED
;
1906 FIXME("not implemented %p\n", This
);
1910 static HRESULT WINAPI
ITextRange_fnGetPoint(ITextRange
*me
, LONG Type
, LONG
*cx
, LONG
*cy
)
1912 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1914 return CO_E_RELEASED
;
1916 FIXME("not implemented %p\n", This
);
1920 static HRESULT WINAPI
ITextRange_fnSetPoint(ITextRange
*me
, LONG x
, LONG y
, LONG Type
,
1923 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1925 return CO_E_RELEASED
;
1927 FIXME("not implemented %p\n", This
);
1931 static HRESULT WINAPI
ITextRange_fnScrollIntoView(ITextRange
*me
, LONG Value
)
1933 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1935 return CO_E_RELEASED
;
1937 FIXME("not implemented %p\n", This
);
1941 static HRESULT WINAPI
ITextRange_fnGetEmbeddedObject(ITextRange
*me
, IUnknown
**ppv
)
1943 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1945 return CO_E_RELEASED
;
1947 FIXME("not implemented %p\n", This
);
1951 static const ITextRangeVtbl trvt
= {
1952 ITextRange_fnQueryInterface
,
1953 ITextRange_fnAddRef
,
1954 ITextRange_fnRelease
,
1955 ITextRange_fnGetTypeInfoCount
,
1956 ITextRange_fnGetTypeInfo
,
1957 ITextRange_fnGetIDsOfNames
,
1958 ITextRange_fnInvoke
,
1959 ITextRange_fnGetText
,
1960 ITextRange_fnSetText
,
1961 ITextRange_fnGetChar
,
1962 ITextRange_fnSetChar
,
1963 ITextRange_fnGetDuplicate
,
1964 ITextRange_fnGetFormattedText
,
1965 ITextRange_fnSetFormattedText
,
1966 ITextRange_fnGetStart
,
1967 ITextRange_fnSetStart
,
1968 ITextRange_fnGetEnd
,
1969 ITextRange_fnSetEnd
,
1970 ITextRange_fnGetFont
,
1971 ITextRange_fnSetFont
,
1972 ITextRange_fnGetPara
,
1973 ITextRange_fnSetPara
,
1974 ITextRange_fnGetStoryLength
,
1975 ITextRange_fnGetStoryType
,
1976 ITextRange_fnCollapse
,
1977 ITextRange_fnExpand
,
1978 ITextRange_fnGetIndex
,
1979 ITextRange_fnSetIndex
,
1980 ITextRange_fnSetRange
,
1981 ITextRange_fnInRange
,
1982 ITextRange_fnInStory
,
1983 ITextRange_fnIsEqual
,
1984 ITextRange_fnSelect
,
1985 ITextRange_fnStartOf
,
1988 ITextRange_fnMoveStart
,
1989 ITextRange_fnMoveEnd
,
1990 ITextRange_fnMoveWhile
,
1991 ITextRange_fnMoveStartWhile
,
1992 ITextRange_fnMoveEndWhile
,
1993 ITextRange_fnMoveUntil
,
1994 ITextRange_fnMoveStartUntil
,
1995 ITextRange_fnMoveEndUntil
,
1996 ITextRange_fnFindText
,
1997 ITextRange_fnFindTextStart
,
1998 ITextRange_fnFindTextEnd
,
1999 ITextRange_fnDelete
,
2003 ITextRange_fnCanPaste
,
2004 ITextRange_fnCanEdit
,
2005 ITextRange_fnChangeCase
,
2006 ITextRange_fnGetPoint
,
2007 ITextRange_fnSetPoint
,
2008 ITextRange_fnScrollIntoView
,
2009 ITextRange_fnGetEmbeddedObject
2013 static HRESULT WINAPI
TextFont_QueryInterface(ITextFont
*iface
, REFIID riid
, void **ppv
)
2015 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2017 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
2019 if (IsEqualIID(riid
, &IID_ITextFont
) ||
2020 IsEqualIID(riid
, &IID_IDispatch
) ||
2021 IsEqualIID(riid
, &IID_IUnknown
))
2024 ITextFont_AddRef(iface
);
2029 return E_NOINTERFACE
;
2032 static ULONG WINAPI
TextFont_AddRef(ITextFont
*iface
)
2034 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2035 ULONG ref
= InterlockedIncrement(&This
->ref
);
2036 TRACE("(%p)->(%u)\n", This
, ref
);
2040 static ULONG WINAPI
TextFont_Release(ITextFont
*iface
)
2042 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2043 ULONG ref
= InterlockedDecrement(&This
->ref
);
2045 TRACE("(%p)->(%u)\n", This
, ref
);
2050 ITextRange_Release(This
->range
);
2051 SysFreeString(This
->props
[FONT_NAME
].str
);
2058 static HRESULT WINAPI
TextFont_GetTypeInfoCount(ITextFont
*iface
, UINT
*pctinfo
)
2060 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2061 TRACE("(%p)->(%p)\n", This
, pctinfo
);
2066 static HRESULT WINAPI
TextFont_GetTypeInfo(ITextFont
*iface
, UINT iTInfo
, LCID lcid
,
2067 ITypeInfo
**ppTInfo
)
2069 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2072 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
2074 hr
= get_typeinfo(ITextFont_tid
, ppTInfo
);
2076 ITypeInfo_AddRef(*ppTInfo
);
2080 static HRESULT WINAPI
TextFont_GetIDsOfNames(ITextFont
*iface
, REFIID riid
,
2081 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
2083 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2087 TRACE("(%p)->(%p,%p,%u,%d,%p)\n", This
, riid
, rgszNames
, cNames
, lcid
,
2090 hr
= get_typeinfo(ITextFont_tid
, &ti
);
2092 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
2096 static HRESULT WINAPI
TextFont_Invoke(
2098 DISPID dispIdMember
,
2102 DISPPARAMS
*pDispParams
,
2103 VARIANT
*pVarResult
,
2104 EXCEPINFO
*pExcepInfo
,
2107 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2111 TRACE("(%p)->(%d,%p,%d,%u,%p,%p,%p,%p)\n", This
, dispIdMember
, riid
, lcid
,
2112 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2114 hr
= get_typeinfo(ITextFont_tid
, &ti
);
2116 hr
= ITypeInfo_Invoke(ti
, iface
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2120 static HRESULT WINAPI
TextFont_GetDuplicate(ITextFont
*iface
, ITextFont
**ret
)
2122 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2124 TRACE("(%p)->(%p)\n", This
, ret
);
2127 return E_INVALIDARG
;
2130 if (This
->range
&& !get_range_reole(This
->range
))
2131 return CO_E_RELEASED
;
2133 return create_textfont(NULL
, This
, ret
);
2136 static HRESULT WINAPI
TextFont_SetDuplicate(ITextFont
*iface
, ITextFont
*pFont
)
2138 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2139 FIXME("(%p)->(%p): stub\n", This
, pFont
);
2143 static HRESULT WINAPI
TextFont_CanChange(ITextFont
*iface
, LONG
*ret
)
2145 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2146 FIXME("(%p)->(%p): stub\n", This
, ret
);
2150 static HRESULT WINAPI
TextFont_IsEqual(ITextFont
*iface
, ITextFont
*font
, LONG
*ret
)
2152 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2153 FIXME("(%p)->(%p %p): stub\n", This
, font
, ret
);
2157 static void textfont_reset_to_default(ITextFontImpl
*font
)
2159 enum textfont_prop_id id
;
2161 for (id
= FONT_PROPID_FIRST
; id
< FONT_PROPID_LAST
; id
++) {
2165 case FONT_ANIMATION
:
2172 case FONT_PROTECTED
:
2174 case FONT_SMALLCAPS
:
2175 case FONT_STRIKETHROUGH
:
2176 case FONT_SUBSCRIPT
:
2177 case FONT_SUPERSCRIPT
:
2178 case FONT_UNDERLINE
:
2179 font
->props
[id
].l
= tomFalse
;
2181 case FONT_BACKCOLOR
:
2182 case FONT_FORECOLOR
:
2183 font
->props
[id
].l
= tomAutoColor
;
2189 font
->props
[id
].f
= 0.0;
2192 font
->props
[id
].l
= GetSystemDefaultLCID();
2195 static const WCHAR sysW
[] = {'S','y','s','t','e','m',0};
2196 SysFreeString(font
->props
[id
].str
);
2197 font
->props
[id
].str
= SysAllocString(sysW
);
2201 font
->props
[id
].l
= FW_NORMAL
;
2204 FIXME("font property %d not handled\n", id
);
2209 static void textfont_reset_to_undefined(ITextFontImpl
*font
)
2211 enum textfont_prop_id id
;
2213 for (id
= FONT_PROPID_FIRST
; id
< FONT_PROPID_LAST
; id
++) {
2217 case FONT_ANIMATION
:
2224 case FONT_PROTECTED
:
2226 case FONT_SMALLCAPS
:
2227 case FONT_STRIKETHROUGH
:
2228 case FONT_SUBSCRIPT
:
2229 case FONT_SUPERSCRIPT
:
2230 case FONT_UNDERLINE
:
2231 case FONT_BACKCOLOR
:
2232 case FONT_FORECOLOR
:
2235 font
->props
[id
].l
= tomUndefined
;
2241 font
->props
[id
].f
= tomUndefined
;
2246 FIXME("font property %d not handled\n", id
);
2251 static void textfont_apply_range_props(ITextFontImpl
*font
)
2253 enum textfont_prop_id propid
;
2254 for (propid
= FONT_PROPID_FIRST
; propid
< FONT_PROPID_LAST
; propid
++)
2255 set_textfont_prop(font
, propid
, &font
->props
[propid
]);
2258 static HRESULT WINAPI
TextFont_Reset(ITextFont
*iface
, LONG value
)
2260 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2262 TRACE("(%p)->(%d)\n", This
, value
);
2264 /* If font is attached to a range, released or not, we can't
2265 reset to undefined */
2267 if (!get_range_reole(This
->range
))
2268 return CO_E_RELEASED
;
2273 return E_INVALIDARG
;
2275 textfont_cache_range_props(This
);
2276 This
->get_cache_enabled
= TRUE
;
2279 This
->get_cache_enabled
= FALSE
;
2282 This
->set_cache_enabled
= TRUE
;
2285 This
->set_cache_enabled
= FALSE
;
2286 textfont_apply_range_props(This
);
2289 FIXME("reset mode %d not supported\n", value
);
2297 /* reset to global defaults */
2299 textfont_reset_to_default(This
);
2301 /* all properties are set to tomUndefined, font name is retained */
2303 textfont_reset_to_undefined(This
);
2313 FIXME("reset mode %d not supported\n", value
);
2317 static HRESULT WINAPI
TextFont_GetStyle(ITextFont
*iface
, LONG
*value
)
2319 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2320 FIXME("(%p)->(%p): stub\n", This
, value
);
2324 static HRESULT WINAPI
TextFont_SetStyle(ITextFont
*iface
, LONG value
)
2326 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2327 FIXME("(%p)->(%d): stub\n", This
, value
);
2331 static HRESULT WINAPI
TextFont_GetAllCaps(ITextFont
*iface
, LONG
*value
)
2333 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2334 TRACE("(%p)->(%p)\n", This
, value
);
2335 return get_textfont_propl(This
, FONT_ALLCAPS
, value
);
2338 static HRESULT WINAPI
TextFont_SetAllCaps(ITextFont
*iface
, LONG value
)
2340 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2341 FIXME("(%p)->(%d): stub\n", This
, value
);
2345 static HRESULT WINAPI
TextFont_GetAnimation(ITextFont
*iface
, LONG
*value
)
2347 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2348 TRACE("(%p)->(%p)\n", This
, value
);
2349 return get_textfont_propl(This
, FONT_ANIMATION
, value
);
2352 static HRESULT WINAPI
TextFont_SetAnimation(ITextFont
*iface
, LONG value
)
2354 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2355 FIXME("(%p)->(%d): stub\n", This
, value
);
2359 static HRESULT WINAPI
TextFont_GetBackColor(ITextFont
*iface
, LONG
*value
)
2361 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2362 TRACE("(%p)->(%p)\n", This
, value
);
2363 return get_textfont_propl(This
, FONT_BACKCOLOR
, value
);
2366 static HRESULT WINAPI
TextFont_SetBackColor(ITextFont
*iface
, LONG value
)
2368 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2369 FIXME("(%p)->(%d): stub\n", This
, value
);
2373 static HRESULT WINAPI
TextFont_GetBold(ITextFont
*iface
, LONG
*value
)
2375 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2376 TRACE("(%p)->(%p)\n", This
, value
);
2377 return get_textfont_propl(This
, FONT_BOLD
, value
);
2380 static HRESULT WINAPI
TextFont_SetBold(ITextFont
*iface
, LONG value
)
2382 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2383 FIXME("(%p)->(%d): stub\n", This
, value
);
2387 static HRESULT WINAPI
TextFont_GetEmboss(ITextFont
*iface
, LONG
*value
)
2389 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2390 TRACE("(%p)->(%p)\n", This
, value
);
2391 return get_textfont_propl(This
, FONT_EMBOSS
, value
);
2394 static HRESULT WINAPI
TextFont_SetEmboss(ITextFont
*iface
, LONG value
)
2396 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2397 FIXME("(%p)->(%d): stub\n", This
, value
);
2401 static HRESULT WINAPI
TextFont_GetForeColor(ITextFont
*iface
, LONG
*value
)
2403 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2404 TRACE("(%p)->(%p)\n", This
, value
);
2405 return get_textfont_propl(This
, FONT_FORECOLOR
, value
);
2408 static HRESULT WINAPI
TextFont_SetForeColor(ITextFont
*iface
, LONG value
)
2410 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2411 FIXME("(%p)->(%d): stub\n", This
, value
);
2415 static HRESULT WINAPI
TextFont_GetHidden(ITextFont
*iface
, LONG
*value
)
2417 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2418 TRACE("(%p)->(%p)\n", This
, value
);
2419 return get_textfont_propl(This
, FONT_HIDDEN
, value
);
2422 static HRESULT WINAPI
TextFont_SetHidden(ITextFont
*iface
, LONG value
)
2424 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2425 FIXME("(%p)->(%d): stub\n", This
, value
);
2429 static HRESULT WINAPI
TextFont_GetEngrave(ITextFont
*iface
, LONG
*value
)
2431 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2432 TRACE("(%p)->(%p)\n", This
, value
);
2433 return get_textfont_propl(This
, FONT_ENGRAVE
, value
);
2436 static HRESULT WINAPI
TextFont_SetEngrave(ITextFont
*iface
, LONG value
)
2438 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2439 FIXME("(%p)->(%d): stub\n", This
, value
);
2443 static HRESULT WINAPI
TextFont_GetItalic(ITextFont
*iface
, LONG
*value
)
2445 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2446 TRACE("(%p)->(%p)\n", This
, value
);
2447 return get_textfont_propl(This
, FONT_ITALIC
, value
);
2450 static HRESULT WINAPI
TextFont_SetItalic(ITextFont
*iface
, LONG value
)
2452 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2453 TRACE("(%p)->(%d)\n", This
, value
);
2454 return set_textfont_propd(This
, FONT_ITALIC
, value
);
2457 static HRESULT WINAPI
TextFont_GetKerning(ITextFont
*iface
, FLOAT
*value
)
2459 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2460 TRACE("(%p)->(%p)\n", This
, value
);
2461 return get_textfont_propf(This
, FONT_KERNING
, value
);
2464 static HRESULT WINAPI
TextFont_SetKerning(ITextFont
*iface
, FLOAT value
)
2466 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2467 FIXME("(%p)->(%.2f): stub\n", This
, value
);
2471 static HRESULT WINAPI
TextFont_GetLanguageID(ITextFont
*iface
, LONG
*value
)
2473 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2474 TRACE("(%p)->(%p)\n", This
, value
);
2475 return get_textfont_propl(This
, FONT_LANGID
, value
);
2478 static HRESULT WINAPI
TextFont_SetLanguageID(ITextFont
*iface
, LONG value
)
2480 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2481 FIXME("(%p)->(%d): stub\n", This
, value
);
2485 static HRESULT WINAPI
TextFont_GetName(ITextFont
*iface
, BSTR
*value
)
2487 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2489 TRACE("(%p)->(%p)\n", This
, value
);
2492 return E_INVALIDARG
;
2497 if (This
->props
[FONT_NAME
].str
)
2498 *value
= SysAllocString(This
->props
[FONT_NAME
].str
);
2500 *value
= SysAllocStringLen(NULL
, 0);
2501 return *value
? S_OK
: E_OUTOFMEMORY
;
2504 return textfont_getname_from_range(This
->range
, value
);
2507 static HRESULT WINAPI
TextFont_SetName(ITextFont
*iface
, BSTR value
)
2509 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2510 FIXME("(%p)->(%s): stub\n", This
, debugstr_w(value
));
2514 static HRESULT WINAPI
TextFont_GetOutline(ITextFont
*iface
, LONG
*value
)
2516 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2517 TRACE("(%p)->(%p)\n", This
, value
);
2518 return get_textfont_propl(This
, FONT_OUTLINE
, value
);
2521 static HRESULT WINAPI
TextFont_SetOutline(ITextFont
*iface
, LONG value
)
2523 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2524 FIXME("(%p)->(%d): stub\n", This
, value
);
2528 static HRESULT WINAPI
TextFont_GetPosition(ITextFont
*iface
, FLOAT
*value
)
2530 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2531 TRACE("(%p)->(%p)\n", This
, value
);
2532 return get_textfont_propf(This
, FONT_POSITION
, value
);
2535 static HRESULT WINAPI
TextFont_SetPosition(ITextFont
*iface
, FLOAT value
)
2537 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2538 FIXME("(%p)->(%.2f): stub\n", This
, value
);
2542 static HRESULT WINAPI
TextFont_GetProtected(ITextFont
*iface
, LONG
*value
)
2544 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2545 TRACE("(%p)->(%p)\n", This
, value
);
2546 return get_textfont_propl(This
, FONT_PROTECTED
, value
);
2549 static HRESULT WINAPI
TextFont_SetProtected(ITextFont
*iface
, LONG value
)
2551 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2552 FIXME("(%p)->(%d): stub\n", This
, value
);
2556 static HRESULT WINAPI
TextFont_GetShadow(ITextFont
*iface
, LONG
*value
)
2558 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2559 TRACE("(%p)->(%p)\n", This
, value
);
2560 return get_textfont_propl(This
, FONT_SHADOW
, value
);
2563 static HRESULT WINAPI
TextFont_SetShadow(ITextFont
*iface
, LONG value
)
2565 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2566 FIXME("(%p)->(%d): stub\n", This
, value
);
2570 static HRESULT WINAPI
TextFont_GetSize(ITextFont
*iface
, FLOAT
*value
)
2572 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2573 TRACE("(%p)->(%p)\n", This
, value
);
2574 return get_textfont_propf(This
, FONT_SIZE
, value
);
2577 static HRESULT WINAPI
TextFont_SetSize(ITextFont
*iface
, FLOAT value
)
2579 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2580 FIXME("(%p)->(%.2f): stub\n", This
, value
);
2584 static HRESULT WINAPI
TextFont_GetSmallCaps(ITextFont
*iface
, LONG
*value
)
2586 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2587 TRACE("(%p)->(%p)\n", This
, value
);
2588 return get_textfont_propl(This
, FONT_SMALLCAPS
, value
);
2591 static HRESULT WINAPI
TextFont_SetSmallCaps(ITextFont
*iface
, LONG value
)
2593 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2594 FIXME("(%p)->(%d): stub\n", This
, value
);
2598 static HRESULT WINAPI
TextFont_GetSpacing(ITextFont
*iface
, FLOAT
*value
)
2600 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2601 TRACE("(%p)->(%p)\n", This
, value
);
2602 return get_textfont_propf(This
, FONT_SPACING
, value
);
2605 static HRESULT WINAPI
TextFont_SetSpacing(ITextFont
*iface
, FLOAT value
)
2607 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2608 FIXME("(%p)->(%.2f): stub\n", This
, value
);
2612 static HRESULT WINAPI
TextFont_GetStrikeThrough(ITextFont
*iface
, LONG
*value
)
2614 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2615 TRACE("(%p)->(%p)\n", This
, value
);
2616 return get_textfont_propl(This
, FONT_STRIKETHROUGH
, value
);
2619 static HRESULT WINAPI
TextFont_SetStrikeThrough(ITextFont
*iface
, LONG value
)
2621 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2622 FIXME("(%p)->(%d): stub\n", This
, value
);
2626 static HRESULT WINAPI
TextFont_GetSubscript(ITextFont
*iface
, LONG
*value
)
2628 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2629 TRACE("(%p)->(%p)\n", This
, value
);
2630 return get_textfont_propl(This
, FONT_SUBSCRIPT
, value
);
2633 static HRESULT WINAPI
TextFont_SetSubscript(ITextFont
*iface
, LONG value
)
2635 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2636 FIXME("(%p)->(%d): stub\n", This
, value
);
2640 static HRESULT WINAPI
TextFont_GetSuperscript(ITextFont
*iface
, LONG
*value
)
2642 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2643 TRACE("(%p)->(%p)\n", This
, value
);
2644 return get_textfont_propl(This
, FONT_SUPERSCRIPT
, value
);
2647 static HRESULT WINAPI
TextFont_SetSuperscript(ITextFont
*iface
, LONG value
)
2649 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2650 FIXME("(%p)->(%d): stub\n", This
, value
);
2654 static HRESULT WINAPI
TextFont_GetUnderline(ITextFont
*iface
, LONG
*value
)
2656 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2657 TRACE("(%p)->(%p)\n", This
, value
);
2658 return get_textfont_propl(This
, FONT_UNDERLINE
, value
);
2661 static HRESULT WINAPI
TextFont_SetUnderline(ITextFont
*iface
, LONG value
)
2663 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2664 FIXME("(%p)->(%d): stub\n", This
, value
);
2668 static HRESULT WINAPI
TextFont_GetWeight(ITextFont
*iface
, LONG
*value
)
2670 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2671 TRACE("(%p)->(%p)\n", This
, value
);
2672 return get_textfont_propl(This
, FONT_WEIGHT
, value
);
2675 static HRESULT WINAPI
TextFont_SetWeight(ITextFont
*iface
, LONG value
)
2677 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2678 FIXME("(%p)->(%d): stub\n", This
, value
);
2682 static ITextFontVtbl textfontvtbl
= {
2683 TextFont_QueryInterface
,
2686 TextFont_GetTypeInfoCount
,
2687 TextFont_GetTypeInfo
,
2688 TextFont_GetIDsOfNames
,
2690 TextFont_GetDuplicate
,
2691 TextFont_SetDuplicate
,
2697 TextFont_GetAllCaps
,
2698 TextFont_SetAllCaps
,
2699 TextFont_GetAnimation
,
2700 TextFont_SetAnimation
,
2701 TextFont_GetBackColor
,
2702 TextFont_SetBackColor
,
2707 TextFont_GetForeColor
,
2708 TextFont_SetForeColor
,
2711 TextFont_GetEngrave
,
2712 TextFont_SetEngrave
,
2715 TextFont_GetKerning
,
2716 TextFont_SetKerning
,
2717 TextFont_GetLanguageID
,
2718 TextFont_SetLanguageID
,
2721 TextFont_GetOutline
,
2722 TextFont_SetOutline
,
2723 TextFont_GetPosition
,
2724 TextFont_SetPosition
,
2725 TextFont_GetProtected
,
2726 TextFont_SetProtected
,
2731 TextFont_GetSmallCaps
,
2732 TextFont_SetSmallCaps
,
2733 TextFont_GetSpacing
,
2734 TextFont_SetSpacing
,
2735 TextFont_GetStrikeThrough
,
2736 TextFont_SetStrikeThrough
,
2737 TextFont_GetSubscript
,
2738 TextFont_SetSubscript
,
2739 TextFont_GetSuperscript
,
2740 TextFont_SetSuperscript
,
2741 TextFont_GetUnderline
,
2742 TextFont_SetUnderline
,
2747 static HRESULT
create_textfont(ITextRange
*range
, const ITextFontImpl
*src
, ITextFont
**ret
)
2749 ITextFontImpl
*font
;
2752 font
= heap_alloc(sizeof(*font
));
2754 return E_OUTOFMEMORY
;
2756 font
->ITextFont_iface
.lpVtbl
= &textfontvtbl
;
2761 font
->get_cache_enabled
= TRUE
;
2762 font
->set_cache_enabled
= TRUE
;
2763 memcpy(&font
->props
, &src
->props
, sizeof(font
->props
));
2764 if (font
->props
[FONT_NAME
].str
)
2765 font
->props
[FONT_NAME
].str
= SysAllocString(font
->props
[FONT_NAME
].str
);
2768 font
->range
= range
;
2769 ITextRange_AddRef(range
);
2771 /* cache current properties */
2772 font
->get_cache_enabled
= FALSE
;
2773 font
->set_cache_enabled
= FALSE
;
2774 textfont_cache_range_props(font
);
2777 *ret
= &font
->ITextFont_iface
;
2782 static HRESULT WINAPI
TextPara_QueryInterface(ITextPara
*iface
, REFIID riid
, void **ppv
)
2784 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2786 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
2788 if (IsEqualIID(riid
, &IID_ITextPara
) ||
2789 IsEqualIID(riid
, &IID_IDispatch
) ||
2790 IsEqualIID(riid
, &IID_IUnknown
))
2793 ITextPara_AddRef(iface
);
2798 return E_NOINTERFACE
;
2801 static ULONG WINAPI
TextPara_AddRef(ITextPara
*iface
)
2803 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2804 ULONG ref
= InterlockedIncrement(&This
->ref
);
2805 TRACE("(%p)->(%u)\n", This
, ref
);
2809 static ULONG WINAPI
TextPara_Release(ITextPara
*iface
)
2811 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2812 ULONG ref
= InterlockedDecrement(&This
->ref
);
2814 TRACE("(%p)->(%u)\n", This
, ref
);
2818 ITextRange_Release(This
->range
);
2825 static HRESULT WINAPI
TextPara_GetTypeInfoCount(ITextPara
*iface
, UINT
*pctinfo
)
2827 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2828 TRACE("(%p)->(%p)\n", This
, pctinfo
);
2833 static HRESULT WINAPI
TextPara_GetTypeInfo(ITextPara
*iface
, UINT iTInfo
, LCID lcid
,
2834 ITypeInfo
**ppTInfo
)
2836 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2839 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
2841 hr
= get_typeinfo(ITextPara_tid
, ppTInfo
);
2843 ITypeInfo_AddRef(*ppTInfo
);
2847 static HRESULT WINAPI
TextPara_GetIDsOfNames(ITextPara
*iface
, REFIID riid
,
2848 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
2850 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2854 TRACE("(%p)->(%p,%p,%u,%d,%p)\n", This
, riid
, rgszNames
, cNames
, lcid
,
2857 hr
= get_typeinfo(ITextPara_tid
, &ti
);
2859 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
2863 static HRESULT WINAPI
TextPara_Invoke(
2865 DISPID dispIdMember
,
2869 DISPPARAMS
*pDispParams
,
2870 VARIANT
*pVarResult
,
2871 EXCEPINFO
*pExcepInfo
,
2874 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2878 TRACE("(%p)->(%d,%p,%d,%u,%p,%p,%p,%p)\n", This
, dispIdMember
, riid
, lcid
,
2879 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2881 hr
= get_typeinfo(ITextPara_tid
, &ti
);
2883 hr
= ITypeInfo_Invoke(ti
, iface
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2887 static HRESULT WINAPI
TextPara_GetDuplicate(ITextPara
*iface
, ITextPara
**ret
)
2889 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2890 FIXME("(%p)->(%p)\n", This
, ret
);
2894 static HRESULT WINAPI
TextPara_SetDuplicate(ITextPara
*iface
, ITextPara
*para
)
2896 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2897 FIXME("(%p)->(%p)\n", This
, para
);
2901 static HRESULT WINAPI
TextPara_CanChange(ITextPara
*iface
, LONG
*ret
)
2903 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2904 FIXME("(%p)->(%p)\n", This
, ret
);
2908 static HRESULT WINAPI
TextPara_IsEqual(ITextPara
*iface
, ITextPara
*para
, LONG
*ret
)
2910 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2911 FIXME("(%p)->(%p %p)\n", This
, para
, ret
);
2915 static HRESULT WINAPI
TextPara_Reset(ITextPara
*iface
, LONG value
)
2917 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2918 FIXME("(%p)->(%d)\n", This
, value
);
2922 static HRESULT WINAPI
TextPara_GetStyle(ITextPara
*iface
, LONG
*value
)
2924 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2925 FIXME("(%p)->(%p)\n", This
, value
);
2929 static HRESULT WINAPI
TextPara_SetStyle(ITextPara
*iface
, LONG value
)
2931 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2932 FIXME("(%p)->(%d)\n", This
, value
);
2936 static HRESULT WINAPI
TextPara_GetAlignment(ITextPara
*iface
, LONG
*value
)
2938 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2939 FIXME("(%p)->(%p)\n", This
, value
);
2943 static HRESULT WINAPI
TextPara_SetAlignment(ITextPara
*iface
, LONG value
)
2945 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2946 FIXME("(%p)->(%d)\n", This
, value
);
2950 static HRESULT WINAPI
TextPara_GetHyphenation(ITextPara
*iface
, LONG
*value
)
2952 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2953 FIXME("(%p)->(%p)\n", This
, value
);
2957 static HRESULT WINAPI
TextPara_SetHyphenation(ITextPara
*iface
, LONG value
)
2959 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2960 FIXME("(%p)->(%d)\n", This
, value
);
2964 static HRESULT WINAPI
TextPara_GetFirstLineIndent(ITextPara
*iface
, FLOAT
*value
)
2966 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2967 FIXME("(%p)->(%p)\n", This
, value
);
2971 static HRESULT WINAPI
TextPara_GetKeepTogether(ITextPara
*iface
, LONG
*value
)
2973 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2974 FIXME("(%p)->(%p)\n", This
, value
);
2978 static HRESULT WINAPI
TextPara_SetKeepTogether(ITextPara
*iface
, LONG value
)
2980 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2981 FIXME("(%p)->(%d)\n", This
, value
);
2985 static HRESULT WINAPI
TextPara_GetKeepWithNext(ITextPara
*iface
, LONG
*value
)
2987 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2988 FIXME("(%p)->(%p)\n", This
, value
);
2992 static HRESULT WINAPI
TextPara_SetKeepWithNext(ITextPara
*iface
, LONG value
)
2994 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2995 FIXME("(%p)->(%d)\n", This
, value
);
2999 static HRESULT WINAPI
TextPara_GetLeftIndent(ITextPara
*iface
, FLOAT
*value
)
3001 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3002 FIXME("(%p)->(%p)\n", This
, value
);
3006 static HRESULT WINAPI
TextPara_GetLineSpacing(ITextPara
*iface
, FLOAT
*value
)
3008 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3009 FIXME("(%p)->(%p)\n", This
, value
);
3013 static HRESULT WINAPI
TextPara_GetLineSpacingRule(ITextPara
*iface
, LONG
*value
)
3015 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3016 FIXME("(%p)->(%p)\n", This
, value
);
3020 static HRESULT WINAPI
TextPara_GetListAlignment(ITextPara
*iface
, LONG
*value
)
3022 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3023 FIXME("(%p)->(%p)\n", This
, value
);
3027 static HRESULT WINAPI
TextPara_SetListAlignment(ITextPara
*iface
, LONG value
)
3029 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3030 FIXME("(%p)->(%d)\n", This
, value
);
3034 static HRESULT WINAPI
TextPara_GetListLevelIndex(ITextPara
*iface
, LONG
*value
)
3036 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3037 FIXME("(%p)->(%p)\n", This
, value
);
3041 static HRESULT WINAPI
TextPara_SetListLevelIndex(ITextPara
*iface
, LONG value
)
3043 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3044 FIXME("(%p)->(%d)\n", This
, value
);
3048 static HRESULT WINAPI
TextPara_GetListStart(ITextPara
*iface
, LONG
*value
)
3050 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3051 FIXME("(%p)->(%p)\n", This
, value
);
3055 static HRESULT WINAPI
TextPara_SetListStart(ITextPara
*iface
, LONG value
)
3057 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3058 FIXME("(%p)->(%d)\n", This
, value
);
3062 static HRESULT WINAPI
TextPara_GetListTab(ITextPara
*iface
, FLOAT
*value
)
3064 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3065 FIXME("(%p)->(%p)\n", This
, value
);
3069 static HRESULT WINAPI
TextPara_SetListTab(ITextPara
*iface
, FLOAT value
)
3071 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3072 FIXME("(%p)->(%.2f)\n", This
, value
);
3076 static HRESULT WINAPI
TextPara_GetListType(ITextPara
*iface
, LONG
*value
)
3078 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3079 FIXME("(%p)->(%p)\n", This
, value
);
3083 static HRESULT WINAPI
TextPara_SetListType(ITextPara
*iface
, LONG value
)
3085 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3086 FIXME("(%p)->(%d)\n", This
, value
);
3090 static HRESULT WINAPI
TextPara_GetNoLineNumber(ITextPara
*iface
, LONG
*value
)
3092 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3093 FIXME("(%p)->(%p)\n", This
, value
);
3097 static HRESULT WINAPI
TextPara_SetNoLineNumber(ITextPara
*iface
, LONG value
)
3099 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3100 FIXME("(%p)->(%d)\n", This
, value
);
3104 static HRESULT WINAPI
TextPara_GetPageBreakBefore(ITextPara
*iface
, LONG
*value
)
3106 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3107 FIXME("(%p)->(%p)\n", This
, value
);
3111 static HRESULT WINAPI
TextPara_SetPageBreakBefore(ITextPara
*iface
, LONG value
)
3113 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3114 FIXME("(%p)->(%d)\n", This
, value
);
3118 static HRESULT WINAPI
TextPara_GetRightIndent(ITextPara
*iface
, FLOAT
*value
)
3120 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3121 FIXME("(%p)->(%p)\n", This
, value
);
3125 static HRESULT WINAPI
TextPara_SetRightIndent(ITextPara
*iface
, FLOAT value
)
3127 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3128 FIXME("(%p)->(%.2f)\n", This
, value
);
3132 static HRESULT WINAPI
TextPara_SetIndents(ITextPara
*iface
, FLOAT StartIndent
, FLOAT LeftIndent
, FLOAT RightIndent
)
3134 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3135 FIXME("(%p)->(%.2f %.2f %.2f)\n", This
, StartIndent
, LeftIndent
, RightIndent
);
3139 static HRESULT WINAPI
TextPara_SetLineSpacing(ITextPara
*iface
, LONG LineSpacingRule
, FLOAT LineSpacing
)
3141 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3142 FIXME("(%p)->(%d %.2f)\n", This
, LineSpacingRule
, LineSpacing
);
3146 static HRESULT WINAPI
TextPara_GetSpaceAfter(ITextPara
*iface
, FLOAT
*value
)
3148 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3149 FIXME("(%p)->(%p)\n", This
, value
);
3153 static HRESULT WINAPI
TextPara_SetSpaceAfter(ITextPara
*iface
, FLOAT value
)
3155 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3156 FIXME("(%p)->(%.2f)\n", This
, value
);
3160 static HRESULT WINAPI
TextPara_GetSpaceBefore(ITextPara
*iface
, FLOAT
*value
)
3162 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3163 FIXME("(%p)->(%p)\n", This
, value
);
3167 static HRESULT WINAPI
TextPara_SetSpaceBefore(ITextPara
*iface
, FLOAT value
)
3169 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3170 FIXME("(%p)->(%.2f)\n", This
, value
);
3174 static HRESULT WINAPI
TextPara_GetWidowControl(ITextPara
*iface
, LONG
*value
)
3176 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3177 FIXME("(%p)->(%p)\n", This
, value
);
3181 static HRESULT WINAPI
TextPara_SetWidowControl(ITextPara
*iface
, LONG value
)
3183 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3184 FIXME("(%p)->(%d)\n", This
, value
);
3188 static HRESULT WINAPI
TextPara_GetTabCount(ITextPara
*iface
, LONG
*value
)
3190 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3191 FIXME("(%p)->(%p)\n", This
, value
);
3195 static HRESULT WINAPI
TextPara_AddTab(ITextPara
*iface
, FLOAT tbPos
, LONG tbAlign
, LONG tbLeader
)
3197 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3198 FIXME("(%p)->(%.2f %d %d)\n", This
, tbPos
, tbAlign
, tbLeader
);
3202 static HRESULT WINAPI
TextPara_ClearAllTabs(ITextPara
*iface
)
3204 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3205 FIXME("(%p)\n", This
);
3209 static HRESULT WINAPI
TextPara_DeleteTab(ITextPara
*iface
, FLOAT pos
)
3211 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3212 FIXME("(%p)->(%.2f)\n", This
, pos
);
3216 static HRESULT WINAPI
TextPara_GetTab(ITextPara
*iface
, LONG iTab
, FLOAT
*ptbPos
, LONG
*ptbAlign
, LONG
*ptbLeader
)
3218 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3219 FIXME("(%p)->(%d %p %p %p)\n", This
, iTab
, ptbPos
, ptbAlign
, ptbLeader
);
3223 static ITextParaVtbl textparavtbl
= {
3224 TextPara_QueryInterface
,
3227 TextPara_GetTypeInfoCount
,
3228 TextPara_GetTypeInfo
,
3229 TextPara_GetIDsOfNames
,
3231 TextPara_GetDuplicate
,
3232 TextPara_SetDuplicate
,
3238 TextPara_GetAlignment
,
3239 TextPara_SetAlignment
,
3240 TextPara_GetHyphenation
,
3241 TextPara_SetHyphenation
,
3242 TextPara_GetFirstLineIndent
,
3243 TextPara_GetKeepTogether
,
3244 TextPara_SetKeepTogether
,
3245 TextPara_GetKeepWithNext
,
3246 TextPara_SetKeepWithNext
,
3247 TextPara_GetLeftIndent
,
3248 TextPara_GetLineSpacing
,
3249 TextPara_GetLineSpacingRule
,
3250 TextPara_GetListAlignment
,
3251 TextPara_SetListAlignment
,
3252 TextPara_GetListLevelIndex
,
3253 TextPara_SetListLevelIndex
,
3254 TextPara_GetListStart
,
3255 TextPara_SetListStart
,
3256 TextPara_GetListTab
,
3257 TextPara_SetListTab
,
3258 TextPara_GetListType
,
3259 TextPara_SetListType
,
3260 TextPara_GetNoLineNumber
,
3261 TextPara_SetNoLineNumber
,
3262 TextPara_GetPageBreakBefore
,
3263 TextPara_SetPageBreakBefore
,
3264 TextPara_GetRightIndent
,
3265 TextPara_SetRightIndent
,
3266 TextPara_SetIndents
,
3267 TextPara_SetLineSpacing
,
3268 TextPara_GetSpaceAfter
,
3269 TextPara_SetSpaceAfter
,
3270 TextPara_GetSpaceBefore
,
3271 TextPara_SetSpaceBefore
,
3272 TextPara_GetWidowControl
,
3273 TextPara_SetWidowControl
,
3274 TextPara_GetTabCount
,
3276 TextPara_ClearAllTabs
,
3281 static HRESULT
create_textpara(ITextRange
*range
, ITextPara
**ret
)
3283 ITextParaImpl
*para
;
3286 para
= heap_alloc(sizeof(*para
));
3288 return E_OUTOFMEMORY
;
3290 para
->ITextPara_iface
.lpVtbl
= &textparavtbl
;
3292 para
->range
= range
;
3293 ITextRange_AddRef(range
);
3295 *ret
= ¶
->ITextPara_iface
;
3300 static HRESULT WINAPI
3301 ITextDocument_fnQueryInterface(ITextDocument
* me
, REFIID riid
,
3304 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3305 return IRichEditOle_QueryInterface(&This
->IRichEditOle_iface
, riid
, ppvObject
);
3309 ITextDocument_fnAddRef(ITextDocument
* me
)
3311 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3312 return IRichEditOle_AddRef(&This
->IRichEditOle_iface
);
3316 ITextDocument_fnRelease(ITextDocument
* me
)
3318 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3319 return IRichEditOle_Release(&This
->IRichEditOle_iface
);
3322 static HRESULT WINAPI
3323 ITextDocument_fnGetTypeInfoCount(ITextDocument
* me
,
3326 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3327 TRACE("(%p)->(%p)\n", This
, pctinfo
);
3332 static HRESULT WINAPI
3333 ITextDocument_fnGetTypeInfo(ITextDocument
* me
, UINT iTInfo
, LCID lcid
,
3334 ITypeInfo
** ppTInfo
)
3336 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3339 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
3341 hr
= get_typeinfo(ITextDocument_tid
, ppTInfo
);
3343 ITypeInfo_AddRef(*ppTInfo
);
3347 static HRESULT WINAPI
3348 ITextDocument_fnGetIDsOfNames(ITextDocument
* me
, REFIID riid
,
3349 LPOLESTR
* rgszNames
, UINT cNames
, LCID lcid
, DISPID
* rgDispId
)
3351 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3355 TRACE("(%p)->(%p,%p,%u,%d,%p)\n", This
, riid
, rgszNames
, cNames
, lcid
,
3358 hr
= get_typeinfo(ITextDocument_tid
, &ti
);
3360 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
3364 static HRESULT WINAPI
3365 ITextDocument_fnInvoke(ITextDocument
* me
, DISPID dispIdMember
,
3366 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
* pDispParams
,
3367 VARIANT
* pVarResult
, EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
)
3369 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3373 TRACE("(%p)->(%d,%p,%d,%u,%p,%p,%p,%p)\n", This
, dispIdMember
, riid
, lcid
,
3374 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3376 hr
= get_typeinfo(ITextDocument_tid
, &ti
);
3378 hr
= ITypeInfo_Invoke(ti
, me
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3382 static HRESULT WINAPI
3383 ITextDocument_fnGetName(ITextDocument
* me
, BSTR
* pName
)
3385 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3386 FIXME("stub %p\n",This
);
3390 static HRESULT WINAPI
3391 ITextDocument_fnGetSelection(ITextDocument
* me
, ITextSelection
** ppSel
)
3393 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3394 TRACE("(%p)\n", me
);
3397 return E_INVALIDARG
;
3398 *ppSel
= &This
->txtSel
->ITextSelection_iface
;
3399 ITextSelection_AddRef(*ppSel
);
3403 static HRESULT WINAPI
3404 ITextDocument_fnGetStoryCount(ITextDocument
* me
, LONG
* pCount
)
3406 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3407 FIXME("stub %p\n",This
);
3411 static HRESULT WINAPI
3412 ITextDocument_fnGetStoryRanges(ITextDocument
* me
,
3413 ITextStoryRanges
** ppStories
)
3415 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3416 FIXME("stub %p\n",This
);
3420 static HRESULT WINAPI
3421 ITextDocument_fnGetSaved(ITextDocument
* me
, LONG
* pValue
)
3423 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3424 FIXME("stub %p\n",This
);
3428 static HRESULT WINAPI
3429 ITextDocument_fnSetSaved(ITextDocument
* me
, LONG Value
)
3431 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3432 FIXME("stub %p\n",This
);
3436 static HRESULT WINAPI
3437 ITextDocument_fnGetDefaultTabStop(ITextDocument
* me
, float* pValue
)
3439 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3440 FIXME("stub %p\n",This
);
3444 static HRESULT WINAPI
3445 ITextDocument_fnSetDefaultTabStop(ITextDocument
* me
, float Value
)
3447 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3448 FIXME("stub %p\n",This
);
3452 static HRESULT WINAPI
3453 ITextDocument_fnNew(ITextDocument
* me
)
3455 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3456 FIXME("stub %p\n",This
);
3460 static HRESULT WINAPI
3461 ITextDocument_fnOpen(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
3464 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3465 FIXME("stub %p\n",This
);
3469 static HRESULT WINAPI
3470 ITextDocument_fnSave(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
3473 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3474 FIXME("stub %p\n",This
);
3478 static HRESULT WINAPI
3479 ITextDocument_fnFreeze(ITextDocument
* me
, LONG
* pCount
)
3481 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3482 FIXME("stub %p\n",This
);
3486 static HRESULT WINAPI
3487 ITextDocument_fnUnfreeze(ITextDocument
* me
, LONG
* pCount
)
3489 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3490 FIXME("stub %p\n",This
);
3494 static HRESULT WINAPI
3495 ITextDocument_fnBeginEditCollection(ITextDocument
* me
)
3497 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3498 FIXME("stub %p\n",This
);
3502 static HRESULT WINAPI
3503 ITextDocument_fnEndEditCollection(ITextDocument
* me
)
3505 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3506 FIXME("stub %p\n",This
);
3510 static HRESULT WINAPI
3511 ITextDocument_fnUndo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
3513 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3514 FIXME("stub %p\n",This
);
3518 static HRESULT WINAPI
3519 ITextDocument_fnRedo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
3521 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3522 FIXME("stub %p\n",This
);
3526 static HRESULT
CreateITextRange(IRichEditOleImpl
*reOle
, LONG start
, LONG end
, ITextRange
** ppRange
)
3528 ITextRangeImpl
*txtRge
= heap_alloc(sizeof(ITextRangeImpl
));
3531 return E_OUTOFMEMORY
;
3532 txtRge
->ITextRange_iface
.lpVtbl
= &trvt
;
3534 txtRge
->reOle
= reOle
;
3535 txtRge
->start
= start
;
3537 list_add_head(&reOle
->rangelist
, &txtRge
->entry
);
3538 *ppRange
= &txtRge
->ITextRange_iface
;
3542 static HRESULT WINAPI
3543 ITextDocument_fnRange(ITextDocument
* me
, LONG cp1
, LONG cp2
,
3544 ITextRange
** ppRange
)
3546 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3547 const int len
= ME_GetTextLength(This
->editor
) + 1;
3549 TRACE("%p %p %d %d\n", This
, ppRange
, cp1
, cp2
);
3551 return E_INVALIDARG
;
3555 cp1
= min(cp1
, len
);
3556 cp2
= min(cp2
, len
);
3565 cp1
= cp2
= len
- 1;
3567 return CreateITextRange(This
, cp1
, cp2
, ppRange
);
3570 static HRESULT WINAPI
3571 ITextDocument_fnRangeFromPoint(ITextDocument
* me
, LONG x
, LONG y
,
3572 ITextRange
** ppRange
)
3574 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3575 FIXME("stub %p\n",This
);
3579 static const ITextDocumentVtbl tdvt
= {
3580 ITextDocument_fnQueryInterface
,
3581 ITextDocument_fnAddRef
,
3582 ITextDocument_fnRelease
,
3583 ITextDocument_fnGetTypeInfoCount
,
3584 ITextDocument_fnGetTypeInfo
,
3585 ITextDocument_fnGetIDsOfNames
,
3586 ITextDocument_fnInvoke
,
3587 ITextDocument_fnGetName
,
3588 ITextDocument_fnGetSelection
,
3589 ITextDocument_fnGetStoryCount
,
3590 ITextDocument_fnGetStoryRanges
,
3591 ITextDocument_fnGetSaved
,
3592 ITextDocument_fnSetSaved
,
3593 ITextDocument_fnGetDefaultTabStop
,
3594 ITextDocument_fnSetDefaultTabStop
,
3595 ITextDocument_fnNew
,
3596 ITextDocument_fnOpen
,
3597 ITextDocument_fnSave
,
3598 ITextDocument_fnFreeze
,
3599 ITextDocument_fnUnfreeze
,
3600 ITextDocument_fnBeginEditCollection
,
3601 ITextDocument_fnEndEditCollection
,
3602 ITextDocument_fnUndo
,
3603 ITextDocument_fnRedo
,
3604 ITextDocument_fnRange
,
3605 ITextDocument_fnRangeFromPoint
3608 /* ITextSelection */
3609 static HRESULT WINAPI
ITextSelection_fnQueryInterface(
3614 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3617 if (IsEqualGUID(riid
, &IID_IUnknown
)
3618 || IsEqualGUID(riid
, &IID_IDispatch
)
3619 || IsEqualGUID(riid
, &IID_ITextRange
)
3620 || IsEqualGUID(riid
, &IID_ITextSelection
))
3623 ITextSelection_AddRef(me
);
3626 else if (IsEqualGUID(riid
, &IID_Igetrichole
))
3628 *ppvObj
= This
->reOle
;
3632 return E_NOINTERFACE
;
3635 static ULONG WINAPI
ITextSelection_fnAddRef(ITextSelection
*me
)
3637 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3638 return InterlockedIncrement(&This
->ref
);
3641 static ULONG WINAPI
ITextSelection_fnRelease(ITextSelection
*me
)
3643 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3644 ULONG ref
= InterlockedDecrement(&This
->ref
);
3650 static HRESULT WINAPI
ITextSelection_fnGetTypeInfoCount(ITextSelection
*me
, UINT
*pctinfo
)
3652 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3653 TRACE("(%p)->(%p)\n", This
, pctinfo
);
3658 static HRESULT WINAPI
ITextSelection_fnGetTypeInfo(ITextSelection
*me
, UINT iTInfo
, LCID lcid
,
3659 ITypeInfo
**ppTInfo
)
3661 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3664 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
3666 hr
= get_typeinfo(ITextSelection_tid
, ppTInfo
);
3668 ITypeInfo_AddRef(*ppTInfo
);
3672 static HRESULT WINAPI
ITextSelection_fnGetIDsOfNames(ITextSelection
*me
, REFIID riid
,
3673 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3675 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3679 TRACE("(%p)->(%p,%p,%u,%d,%p)\n", This
, riid
, rgszNames
, cNames
, lcid
,
3682 hr
= get_typeinfo(ITextSelection_tid
, &ti
);
3684 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
3688 static HRESULT WINAPI
ITextSelection_fnInvoke(
3690 DISPID dispIdMember
,
3694 DISPPARAMS
*pDispParams
,
3695 VARIANT
*pVarResult
,
3696 EXCEPINFO
*pExcepInfo
,
3699 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3703 TRACE("(%p)->(%d,%p,%d,%u,%p,%p,%p,%p)\n", This
, dispIdMember
, riid
, lcid
,
3704 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3706 hr
= get_typeinfo(ITextSelection_tid
, &ti
);
3708 hr
= ITypeInfo_Invoke(ti
, me
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3712 /*** ITextRange methods ***/
3713 static HRESULT WINAPI
ITextSelection_fnGetText(ITextSelection
*me
, BSTR
*pbstr
)
3715 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3716 ME_Cursor
*start
= NULL
, *end
= NULL
;
3720 TRACE("(%p)->(%p)\n", This
, pbstr
);
3723 return CO_E_RELEASED
;
3726 return E_INVALIDARG
;
3728 ME_GetSelection(This
->reOle
->editor
, &start
, &end
);
3729 endOfs
= ME_GetCursorOfs(end
);
3730 nChars
= endOfs
- ME_GetCursorOfs(start
);
3737 *pbstr
= SysAllocStringLen(NULL
, nChars
);
3739 return E_OUTOFMEMORY
;
3741 bEOP
= (end
->pRun
->next
->type
== diTextEnd
&& endOfs
> ME_GetTextLength(This
->reOle
->editor
));
3742 ME_GetTextW(This
->reOle
->editor
, *pbstr
, nChars
, start
, nChars
, FALSE
, bEOP
);
3743 TRACE("%s\n", wine_dbgstr_w(*pbstr
));
3748 static HRESULT WINAPI
ITextSelection_fnSetText(ITextSelection
*me
, BSTR bstr
)
3750 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3752 return CO_E_RELEASED
;
3754 FIXME("not implemented\n");
3758 static HRESULT WINAPI
ITextSelection_fnGetChar(ITextSelection
*me
, LONG
*pch
)
3760 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3761 ME_Cursor
*start
= NULL
, *end
= NULL
;
3764 return CO_E_RELEASED
;
3767 return E_INVALIDARG
;
3769 ME_GetSelection(This
->reOle
->editor
, &start
, &end
);
3770 return range_GetChar(This
->reOle
->editor
, start
, pch
);
3773 static HRESULT WINAPI
ITextSelection_fnSetChar(ITextSelection
*me
, LONG ch
)
3775 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3777 return CO_E_RELEASED
;
3779 FIXME("not implemented\n");
3783 static HRESULT WINAPI
ITextSelection_fnGetDuplicate(ITextSelection
*me
, ITextRange
**ppRange
)
3785 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3787 return CO_E_RELEASED
;
3789 FIXME("not implemented\n");
3793 static HRESULT WINAPI
ITextSelection_fnGetFormattedText(ITextSelection
*me
, ITextRange
**ppRange
)
3795 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3797 return CO_E_RELEASED
;
3799 FIXME("not implemented\n");
3803 static HRESULT WINAPI
ITextSelection_fnSetFormattedText(ITextSelection
*me
, ITextRange
*pRange
)
3805 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3807 return CO_E_RELEASED
;
3809 FIXME("not implemented\n");
3813 static HRESULT WINAPI
ITextSelection_fnGetStart(ITextSelection
*me
, LONG
*pcpFirst
)
3815 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3818 return CO_E_RELEASED
;
3821 return E_INVALIDARG
;
3822 ME_GetSelectionOfs(This
->reOle
->editor
, pcpFirst
, &lim
);
3823 TRACE("%d\n", *pcpFirst
);
3827 static HRESULT WINAPI
ITextSelection_fnSetStart(ITextSelection
*me
, LONG value
)
3829 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3833 TRACE("(%p)->(%d)\n", This
, value
);
3836 return CO_E_RELEASED
;
3838 ME_GetSelectionOfs(This
->reOle
->editor
, &start
, &end
);
3839 hr
= textrange_setstart(This
->reOle
, value
, &start
, &end
);
3841 ME_SetSelection(This
->reOle
->editor
, start
, end
);
3846 static HRESULT WINAPI
ITextSelection_fnGetEnd(ITextSelection
*me
, LONG
*pcpLim
)
3848 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3851 return CO_E_RELEASED
;
3854 return E_INVALIDARG
;
3855 ME_GetSelectionOfs(This
->reOle
->editor
, &first
, pcpLim
);
3856 TRACE("%d\n", *pcpLim
);
3860 static HRESULT WINAPI
ITextSelection_fnSetEnd(ITextSelection
*me
, LONG value
)
3862 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3866 TRACE("(%p)->(%d)\n", This
, value
);
3869 return CO_E_RELEASED
;
3871 ME_GetSelectionOfs(This
->reOle
->editor
, &start
, &end
);
3872 hr
= textrange_setend(This
->reOle
, value
, &start
, &end
);
3874 ME_SetSelection(This
->reOle
->editor
, start
, end
);
3879 static HRESULT WINAPI
ITextSelection_fnGetFont(ITextSelection
*me
, ITextFont
**font
)
3881 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3883 TRACE("(%p)->(%p)\n", This
, font
);
3886 return CO_E_RELEASED
;
3889 return E_INVALIDARG
;
3891 return create_textfont((ITextRange
*)me
, NULL
, font
);
3894 static HRESULT WINAPI
ITextSelection_fnSetFont(ITextSelection
*me
, ITextFont
*pFont
)
3896 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3898 return CO_E_RELEASED
;
3900 FIXME("not implemented\n");
3904 static HRESULT WINAPI
ITextSelection_fnGetPara(ITextSelection
*me
, ITextPara
**para
)
3906 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3908 return CO_E_RELEASED
;
3910 FIXME("not implemented\n");
3914 static HRESULT WINAPI
ITextSelection_fnSetPara(ITextSelection
*me
, ITextPara
*pPara
)
3916 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3918 return CO_E_RELEASED
;
3920 FIXME("not implemented\n");
3924 static HRESULT WINAPI
ITextSelection_fnGetStoryLength(ITextSelection
*me
, LONG
*pcch
)
3926 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3928 return CO_E_RELEASED
;
3930 FIXME("not implemented\n");
3934 static HRESULT WINAPI
ITextSelection_fnGetStoryType(ITextSelection
*me
, LONG
*pValue
)
3936 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3938 return CO_E_RELEASED
;
3940 FIXME("not implemented\n");
3944 static HRESULT WINAPI
ITextSelection_fnCollapse(ITextSelection
*me
, LONG bStart
)
3946 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3950 return CO_E_RELEASED
;
3952 ME_GetSelectionOfs(This
->reOle
->editor
, &start
, &end
);
3953 hres
= range_Collapse(bStart
, &start
, &end
);
3954 if (SUCCEEDED(hres
))
3955 ME_SetSelection(This
->reOle
->editor
, start
, end
);
3959 static HRESULT WINAPI
ITextSelection_fnExpand(ITextSelection
*me
, LONG Unit
, LONG
*pDelta
)
3961 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3963 return CO_E_RELEASED
;
3965 FIXME("not implemented\n");
3969 static HRESULT WINAPI
ITextSelection_fnGetIndex(ITextSelection
*me
, LONG Unit
, LONG
*pIndex
)
3971 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3973 return CO_E_RELEASED
;
3975 FIXME("not implemented\n");
3979 static HRESULT WINAPI
ITextSelection_fnSetIndex(ITextSelection
*me
, LONG Unit
, LONG Index
,
3982 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3984 return CO_E_RELEASED
;
3986 FIXME("not implemented\n");
3990 static HRESULT WINAPI
ITextSelection_fnSetRange(ITextSelection
*me
, LONG cpActive
, LONG cpOther
)
3992 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3994 return CO_E_RELEASED
;
3996 FIXME("not implemented\n");
4000 static HRESULT WINAPI
ITextSelection_fnInRange(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
4002 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4004 return CO_E_RELEASED
;
4006 FIXME("not implemented\n");
4010 static HRESULT WINAPI
ITextSelection_fnInStory(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
4012 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4014 return CO_E_RELEASED
;
4016 FIXME("not implemented\n");
4020 static HRESULT WINAPI
ITextSelection_fnIsEqual(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
4022 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4024 return CO_E_RELEASED
;
4026 FIXME("not implemented\n");
4030 static HRESULT WINAPI
ITextSelection_fnSelect(ITextSelection
*me
)
4032 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4034 return CO_E_RELEASED
;
4036 FIXME("not implemented\n");
4040 static HRESULT WINAPI
ITextSelection_fnStartOf(ITextSelection
*me
, LONG Unit
, LONG Extend
,
4043 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4045 return CO_E_RELEASED
;
4047 FIXME("not implemented\n");
4051 static HRESULT WINAPI
ITextSelection_fnEndOf(ITextSelection
*me
, LONG Unit
, LONG Extend
,
4054 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4056 return CO_E_RELEASED
;
4058 FIXME("not implemented\n");
4062 static HRESULT WINAPI
ITextSelection_fnMove(ITextSelection
*me
, LONG Unit
, LONG Count
, LONG
*pDelta
)
4064 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4066 return CO_E_RELEASED
;
4068 FIXME("not implemented\n");
4072 static HRESULT WINAPI
ITextSelection_fnMoveStart(ITextSelection
*me
, LONG Unit
, LONG Count
,
4075 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4077 return CO_E_RELEASED
;
4079 FIXME("not implemented\n");
4083 static HRESULT WINAPI
ITextSelection_fnMoveEnd(ITextSelection
*me
, LONG Unit
, LONG Count
,
4086 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4088 return CO_E_RELEASED
;
4090 FIXME("not implemented\n");
4094 static HRESULT WINAPI
ITextSelection_fnMoveWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
4097 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4099 return CO_E_RELEASED
;
4101 FIXME("not implemented\n");
4105 static HRESULT WINAPI
ITextSelection_fnMoveStartWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
4108 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4110 return CO_E_RELEASED
;
4112 FIXME("not implemented\n");
4116 static HRESULT WINAPI
ITextSelection_fnMoveEndWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
4119 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4121 return CO_E_RELEASED
;
4123 FIXME("not implemented\n");
4127 static HRESULT WINAPI
ITextSelection_fnMoveUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
4130 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4132 return CO_E_RELEASED
;
4134 FIXME("not implemented\n");
4138 static HRESULT WINAPI
ITextSelection_fnMoveStartUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
4141 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4143 return CO_E_RELEASED
;
4145 FIXME("not implemented\n");
4149 static HRESULT WINAPI
ITextSelection_fnMoveEndUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
4152 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4154 return CO_E_RELEASED
;
4156 FIXME("not implemented\n");
4160 static HRESULT WINAPI
ITextSelection_fnFindText(ITextSelection
*me
, BSTR bstr
, LONG cch
, LONG Flags
,
4163 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4165 return CO_E_RELEASED
;
4167 FIXME("not implemented\n");
4171 static HRESULT WINAPI
ITextSelection_fnFindTextStart(ITextSelection
*me
, BSTR bstr
, LONG cch
,
4172 LONG Flags
, LONG
*pLength
)
4174 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4176 return CO_E_RELEASED
;
4178 FIXME("not implemented\n");
4182 static HRESULT WINAPI
ITextSelection_fnFindTextEnd(ITextSelection
*me
, BSTR bstr
, LONG cch
,
4183 LONG Flags
, LONG
*pLength
)
4185 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4187 return CO_E_RELEASED
;
4189 FIXME("not implemented\n");
4193 static HRESULT WINAPI
ITextSelection_fnDelete(ITextSelection
*me
, LONG Unit
, LONG Count
,
4196 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4198 return CO_E_RELEASED
;
4200 FIXME("not implemented\n");
4204 static HRESULT WINAPI
ITextSelection_fnCut(ITextSelection
*me
, VARIANT
*pVar
)
4206 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4208 return CO_E_RELEASED
;
4210 FIXME("not implemented\n");
4214 static HRESULT WINAPI
ITextSelection_fnCopy(ITextSelection
*me
, VARIANT
*pVar
)
4216 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4218 return CO_E_RELEASED
;
4220 FIXME("not implemented\n");
4224 static HRESULT WINAPI
ITextSelection_fnPaste(ITextSelection
*me
, VARIANT
*pVar
, LONG Format
)
4226 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4228 return CO_E_RELEASED
;
4230 FIXME("not implemented\n");
4234 static HRESULT WINAPI
ITextSelection_fnCanPaste(ITextSelection
*me
, VARIANT
*pVar
, LONG Format
,
4237 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4239 return CO_E_RELEASED
;
4241 FIXME("not implemented\n");
4245 static HRESULT WINAPI
ITextSelection_fnCanEdit(ITextSelection
*me
, LONG
*pb
)
4247 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4249 return CO_E_RELEASED
;
4251 FIXME("not implemented\n");
4255 static HRESULT WINAPI
ITextSelection_fnChangeCase(ITextSelection
*me
, LONG Type
)
4257 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4259 return CO_E_RELEASED
;
4261 FIXME("not implemented\n");
4265 static HRESULT WINAPI
ITextSelection_fnGetPoint(ITextSelection
*me
, LONG Type
, LONG
*cx
, LONG
*cy
)
4267 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4269 return CO_E_RELEASED
;
4271 FIXME("not implemented\n");
4275 static HRESULT WINAPI
ITextSelection_fnSetPoint(ITextSelection
*me
, LONG x
, LONG y
, LONG Type
,
4278 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4280 return CO_E_RELEASED
;
4282 FIXME("not implemented\n");
4286 static HRESULT WINAPI
ITextSelection_fnScrollIntoView(ITextSelection
*me
, LONG Value
)
4288 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4290 return CO_E_RELEASED
;
4292 FIXME("not implemented\n");
4296 static HRESULT WINAPI
ITextSelection_fnGetEmbeddedObject(ITextSelection
*me
, IUnknown
**ppv
)
4298 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4300 return CO_E_RELEASED
;
4302 FIXME("not implemented\n");
4306 /*** ITextSelection methods ***/
4307 static HRESULT WINAPI
ITextSelection_fnGetFlags(ITextSelection
*me
, LONG
*pFlags
)
4309 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4311 return CO_E_RELEASED
;
4313 FIXME("not implemented\n");
4317 static HRESULT WINAPI
ITextSelection_fnSetFlags(ITextSelection
*me
, LONG Flags
)
4319 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4321 return CO_E_RELEASED
;
4323 FIXME("not implemented\n");
4327 static HRESULT WINAPI
ITextSelection_fnGetType(ITextSelection
*me
, LONG
*pType
)
4329 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4331 return CO_E_RELEASED
;
4333 FIXME("not implemented\n");
4337 static HRESULT WINAPI
ITextSelection_fnMoveLeft(ITextSelection
*me
, LONG Unit
, LONG Count
,
4338 LONG Extend
, LONG
*pDelta
)
4340 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4342 return CO_E_RELEASED
;
4344 FIXME("not implemented\n");
4348 static HRESULT WINAPI
ITextSelection_fnMoveRight(ITextSelection
*me
, LONG Unit
, LONG Count
,
4349 LONG Extend
, LONG
*pDelta
)
4351 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4353 return CO_E_RELEASED
;
4355 FIXME("not implemented\n");
4359 static HRESULT WINAPI
ITextSelection_fnMoveUp(ITextSelection
*me
, LONG Unit
, LONG Count
,
4360 LONG Extend
, LONG
*pDelta
)
4362 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4364 return CO_E_RELEASED
;
4366 FIXME("not implemented\n");
4370 static HRESULT WINAPI
ITextSelection_fnMoveDown(ITextSelection
*me
, LONG Unit
, LONG Count
,
4371 LONG Extend
, LONG
*pDelta
)
4373 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4375 return CO_E_RELEASED
;
4377 FIXME("not implemented\n");
4381 static HRESULT WINAPI
ITextSelection_fnHomeKey(ITextSelection
*me
, LONG Unit
, LONG Extend
,
4384 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4386 return CO_E_RELEASED
;
4388 FIXME("not implemented\n");
4392 static HRESULT WINAPI
ITextSelection_fnEndKey(ITextSelection
*me
, LONG Unit
, LONG Extend
,
4395 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4397 return CO_E_RELEASED
;
4399 FIXME("not implemented\n");
4403 static HRESULT WINAPI
ITextSelection_fnTypeText(ITextSelection
*me
, BSTR bstr
)
4405 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4407 return CO_E_RELEASED
;
4409 FIXME("not implemented\n");
4413 static const ITextSelectionVtbl tsvt
= {
4414 ITextSelection_fnQueryInterface
,
4415 ITextSelection_fnAddRef
,
4416 ITextSelection_fnRelease
,
4417 ITextSelection_fnGetTypeInfoCount
,
4418 ITextSelection_fnGetTypeInfo
,
4419 ITextSelection_fnGetIDsOfNames
,
4420 ITextSelection_fnInvoke
,
4421 ITextSelection_fnGetText
,
4422 ITextSelection_fnSetText
,
4423 ITextSelection_fnGetChar
,
4424 ITextSelection_fnSetChar
,
4425 ITextSelection_fnGetDuplicate
,
4426 ITextSelection_fnGetFormattedText
,
4427 ITextSelection_fnSetFormattedText
,
4428 ITextSelection_fnGetStart
,
4429 ITextSelection_fnSetStart
,
4430 ITextSelection_fnGetEnd
,
4431 ITextSelection_fnSetEnd
,
4432 ITextSelection_fnGetFont
,
4433 ITextSelection_fnSetFont
,
4434 ITextSelection_fnGetPara
,
4435 ITextSelection_fnSetPara
,
4436 ITextSelection_fnGetStoryLength
,
4437 ITextSelection_fnGetStoryType
,
4438 ITextSelection_fnCollapse
,
4439 ITextSelection_fnExpand
,
4440 ITextSelection_fnGetIndex
,
4441 ITextSelection_fnSetIndex
,
4442 ITextSelection_fnSetRange
,
4443 ITextSelection_fnInRange
,
4444 ITextSelection_fnInStory
,
4445 ITextSelection_fnIsEqual
,
4446 ITextSelection_fnSelect
,
4447 ITextSelection_fnStartOf
,
4448 ITextSelection_fnEndOf
,
4449 ITextSelection_fnMove
,
4450 ITextSelection_fnMoveStart
,
4451 ITextSelection_fnMoveEnd
,
4452 ITextSelection_fnMoveWhile
,
4453 ITextSelection_fnMoveStartWhile
,
4454 ITextSelection_fnMoveEndWhile
,
4455 ITextSelection_fnMoveUntil
,
4456 ITextSelection_fnMoveStartUntil
,
4457 ITextSelection_fnMoveEndUntil
,
4458 ITextSelection_fnFindText
,
4459 ITextSelection_fnFindTextStart
,
4460 ITextSelection_fnFindTextEnd
,
4461 ITextSelection_fnDelete
,
4462 ITextSelection_fnCut
,
4463 ITextSelection_fnCopy
,
4464 ITextSelection_fnPaste
,
4465 ITextSelection_fnCanPaste
,
4466 ITextSelection_fnCanEdit
,
4467 ITextSelection_fnChangeCase
,
4468 ITextSelection_fnGetPoint
,
4469 ITextSelection_fnSetPoint
,
4470 ITextSelection_fnScrollIntoView
,
4471 ITextSelection_fnGetEmbeddedObject
,
4472 ITextSelection_fnGetFlags
,
4473 ITextSelection_fnSetFlags
,
4474 ITextSelection_fnGetType
,
4475 ITextSelection_fnMoveLeft
,
4476 ITextSelection_fnMoveRight
,
4477 ITextSelection_fnMoveUp
,
4478 ITextSelection_fnMoveDown
,
4479 ITextSelection_fnHomeKey
,
4480 ITextSelection_fnEndKey
,
4481 ITextSelection_fnTypeText
4484 static ITextSelectionImpl
*
4485 CreateTextSelection(IRichEditOleImpl
*reOle
)
4487 ITextSelectionImpl
*txtSel
= heap_alloc(sizeof *txtSel
);
4491 txtSel
->ITextSelection_iface
.lpVtbl
= &tsvt
;
4493 txtSel
->reOle
= reOle
;
4497 LRESULT
CreateIRichEditOle(IUnknown
*outer_unk
, ME_TextEditor
*editor
, LPVOID
*ppvObj
)
4499 IRichEditOleImpl
*reo
;
4501 reo
= heap_alloc(sizeof(IRichEditOleImpl
));
4505 reo
->IUnknown_inner
.lpVtbl
= &reo_unk_vtbl
;
4506 reo
->IRichEditOle_iface
.lpVtbl
= &revt
;
4507 reo
->ITextDocument_iface
.lpVtbl
= &tdvt
;
4509 reo
->editor
= editor
;
4510 reo
->txtSel
= CreateTextSelection(reo
);
4516 reo
->clientSite
= CreateOleClientSite(reo
);
4517 if (!reo
->clientSite
)
4519 ITextSelection_Release(&reo
->txtSel
->ITextSelection_iface
);
4523 TRACE("Created %p\n",reo
);
4524 list_init(&reo
->rangelist
);
4526 reo
->outer_unk
= outer_unk
;
4528 reo
->outer_unk
= &reo
->IUnknown_inner
;
4529 *ppvObj
= &reo
->IRichEditOle_iface
;
4534 static void convert_sizel(const ME_Context
*c
, const SIZEL
* szl
, SIZE
* sz
)
4536 /* sizel is in .01 millimeters, sz in pixels */
4537 sz
->cx
= MulDiv(szl
->cx
, c
->dpi
.cx
, 2540);
4538 sz
->cy
= MulDiv(szl
->cy
, c
->dpi
.cy
, 2540);
4541 /******************************************************************************
4542 * ME_GetOLEObjectSize
4544 * Sets run extent for OLE objects.
4546 void ME_GetOLEObjectSize(const ME_Context
*c
, ME_Run
*run
, SIZE
*pSize
)
4554 assert(run
->nFlags
& MERF_GRAPHICS
);
4555 assert(run
->ole_obj
);
4557 if (run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0)
4559 convert_sizel(c
, &run
->ole_obj
->sizel
, pSize
);
4560 if (c
->editor
->nZoomNumerator
!= 0)
4562 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
4563 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
4568 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
4570 FIXME("Query Interface IID_IDataObject failed!\n");
4571 pSize
->cx
= pSize
->cy
= 0;
4574 fmt
.cfFormat
= CF_BITMAP
;
4576 fmt
.dwAspect
= DVASPECT_CONTENT
;
4578 fmt
.tymed
= TYMED_GDI
;
4579 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
4581 fmt
.cfFormat
= CF_ENHMETAFILE
;
4582 fmt
.tymed
= TYMED_ENHMF
;
4583 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
4585 FIXME("unsupported format\n");
4586 pSize
->cx
= pSize
->cy
= 0;
4587 IDataObject_Release(ido
);
4595 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
4596 pSize
->cx
= dibsect
.dsBm
.bmWidth
;
4597 pSize
->cy
= dibsect
.dsBm
.bmHeight
;
4598 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
4601 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
4602 pSize
->cx
= emh
.rclBounds
.right
- emh
.rclBounds
.left
;
4603 pSize
->cy
= emh
.rclBounds
.bottom
- emh
.rclBounds
.top
;
4604 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
4607 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
4610 IDataObject_Release(ido
);
4611 if (c
->editor
->nZoomNumerator
!= 0)
4613 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
4614 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
4618 void ME_DrawOLE(ME_Context
*c
, int x
, int y
, ME_Run
*run
,
4619 ME_Paragraph
*para
, BOOL selected
)
4630 assert(run
->nFlags
& MERF_GRAPHICS
);
4631 assert(run
->ole_obj
);
4632 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
4634 FIXME("Couldn't get interface\n");
4637 has_size
= run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0;
4638 fmt
.cfFormat
= CF_BITMAP
;
4640 fmt
.dwAspect
= DVASPECT_CONTENT
;
4642 fmt
.tymed
= TYMED_GDI
;
4643 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
4645 fmt
.cfFormat
= CF_ENHMETAFILE
;
4646 fmt
.tymed
= TYMED_ENHMF
;
4647 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
4649 FIXME("Couldn't get storage medium\n");
4650 IDataObject_Release(ido
);
4657 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
4658 hMemDC
= CreateCompatibleDC(c
->hDC
);
4659 SelectObject(hMemDC
, stgm
.u
.hBitmap
);
4662 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
4664 sz
.cx
= MulDiv(dibsect
.dsBm
.bmWidth
, c
->dpi
.cx
, 96);
4665 sz
.cy
= MulDiv(dibsect
.dsBm
.bmHeight
, c
->dpi
.cy
, 96);
4667 if (c
->editor
->nZoomNumerator
!= 0)
4669 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
4670 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
4672 if (sz
.cx
== dibsect
.dsBm
.bmWidth
&& sz
.cy
== dibsect
.dsBm
.bmHeight
)
4674 BitBlt(c
->hDC
, x
, y
- sz
.cy
,
4675 dibsect
.dsBm
.bmWidth
, dibsect
.dsBm
.bmHeight
,
4676 hMemDC
, 0, 0, SRCCOPY
);
4678 StretchBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
,
4679 hMemDC
, 0, 0, dibsect
.dsBm
.bmWidth
,
4680 dibsect
.dsBm
.bmHeight
, SRCCOPY
);
4683 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
4686 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
4689 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
4691 sz
.cy
= MulDiv(emh
.rclBounds
.bottom
- emh
.rclBounds
.top
, c
->dpi
.cx
, 96);
4692 sz
.cx
= MulDiv(emh
.rclBounds
.right
- emh
.rclBounds
.left
, c
->dpi
.cy
, 96);
4694 if (c
->editor
->nZoomNumerator
!= 0)
4696 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
4697 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
4705 rc
.right
= x
+ sz
.cx
;
4707 PlayEnhMetaFile(c
->hDC
, stgm
.u
.hEnhMetaFile
, &rc
);
4709 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
4712 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
4716 if (selected
&& !c
->editor
->bHideSelection
)
4717 PatBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
, DSTINVERT
);
4718 IDataObject_Release(ido
);
4721 void ME_DeleteReObject(REOBJECT
* reo
)
4723 if (reo
->poleobj
) IOleObject_Release(reo
->poleobj
);
4724 if (reo
->pstg
) IStorage_Release(reo
->pstg
);
4725 if (reo
->polesite
) IOleClientSite_Release(reo
->polesite
);
4729 void ME_CopyReObject(REOBJECT
* dst
, const REOBJECT
* src
)
4733 if (dst
->poleobj
) IOleObject_AddRef(dst
->poleobj
);
4734 if (dst
->pstg
) IStorage_AddRef(dst
->pstg
);
4735 if (dst
->polesite
) IOleClientSite_AddRef(dst
->polesite
);
4738 void ME_GetITextDocumentInterface(IRichEditOle
*iface
, LPVOID
*ppvObj
)
4740 IRichEditOleImpl
*This
= impl_from_IRichEditOle(iface
);
4741 *ppvObj
= &This
->ITextDocument_iface
;