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
[][2] = {
172 { CFM_ALLCAPS
, CFE_ALLCAPS
},
174 { CFM_BACKCOLOR
, CFE_AUTOBACKCOLOR
},
175 { CFM_BOLD
, CFE_BOLD
},
176 { CFM_EMBOSS
, CFE_EMBOSS
},
177 { CFM_COLOR
, CFE_AUTOCOLOR
},
178 { CFM_HIDDEN
, CFE_HIDDEN
},
179 { CFM_IMPRINT
, CFE_IMPRINT
},
180 { CFM_ITALIC
, CFE_ITALIC
},
184 { CFM_OUTLINE
, CFE_OUTLINE
},
186 { CFM_PROTECTED
, CFE_PROTECTED
},
187 { CFM_SHADOW
, CFE_SHADOW
},
189 { CFM_SMALLCAPS
, CFE_SMALLCAPS
},
191 { CFM_STRIKEOUT
, CFE_STRIKEOUT
},
192 { CFM_SUBSCRIPT
, CFE_SUBSCRIPT
},
193 { CFM_SUPERSCRIPT
, CFE_SUPERSCRIPT
},
194 { CFM_UNDERLINE
, CFE_UNDERLINE
},
204 enum range_update_op
{
208 typedef struct IRichEditOleImpl
{
209 IUnknown IUnknown_inner
;
210 IRichEditOle IRichEditOle_iface
;
211 ITextDocument ITextDocument_iface
;
215 ME_TextEditor
*editor
;
216 ITextSelectionImpl
*txtSel
;
217 IOleClientSiteImpl
*clientSite
;
218 struct list rangelist
;
221 struct ITextRangeImpl
{
222 ITextRange ITextRange_iface
;
227 IRichEditOleImpl
*reOle
;
230 struct ITextSelectionImpl
{
231 ITextSelection ITextSelection_iface
;
234 IRichEditOleImpl
*reOle
;
237 typedef struct ITextFontImpl
{
238 ITextFont ITextFont_iface
;
242 textfont_prop_val props
[FONT_PROPID_LAST
];
243 BOOL get_cache_enabled
;
244 BOOL set_cache_enabled
;
247 typedef struct ITextParaImpl
{
248 ITextPara ITextPara_iface
;
254 struct IOleClientSiteImpl
{
255 IOleClientSite IOleClientSite_iface
;
256 IOleWindow IOleWindow_iface
;
257 IOleInPlaceSite IOleInPlaceSite_iface
;
260 IRichEditOleImpl
*reOle
;
263 static inline IRichEditOleImpl
*impl_from_IRichEditOle(IRichEditOle
*iface
)
265 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, IRichEditOle_iface
);
268 static inline IRichEditOleImpl
*impl_from_ITextDocument(ITextDocument
*iface
)
270 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, ITextDocument_iface
);
273 static inline IRichEditOleImpl
*impl_from_IUnknown(IUnknown
*iface
)
275 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, IUnknown_inner
);
278 static inline IOleClientSiteImpl
*impl_from_IOleWindow(IOleWindow
*iface
)
280 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleWindow_iface
);
283 static inline IOleClientSiteImpl
*impl_from_IOleInPlaceSite(IOleInPlaceSite
*iface
)
285 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleInPlaceSite_iface
);
288 static inline ITextRangeImpl
*impl_from_ITextRange(ITextRange
*iface
)
290 return CONTAINING_RECORD(iface
, ITextRangeImpl
, ITextRange_iface
);
293 static inline ITextSelectionImpl
*impl_from_ITextSelection(ITextSelection
*iface
)
295 return CONTAINING_RECORD(iface
, ITextSelectionImpl
, ITextSelection_iface
);
298 static inline ITextFontImpl
*impl_from_ITextFont(ITextFont
*iface
)
300 return CONTAINING_RECORD(iface
, ITextFontImpl
, ITextFont_iface
);
303 static inline ITextParaImpl
*impl_from_ITextPara(ITextPara
*iface
)
305 return CONTAINING_RECORD(iface
, ITextParaImpl
, ITextPara_iface
);
308 static HRESULT
create_textfont(ITextRange
*, const ITextFontImpl
*, ITextFont
**);
309 static HRESULT
create_textpara(ITextRange
*, ITextPara
**);
311 static void textranges_update_ranges(IRichEditOleImpl
*reole
, LONG start
, LONG end
, enum range_update_op op
)
313 ITextRangeImpl
*range
;
315 LIST_FOR_EACH_ENTRY(range
, &reole
->rangelist
, ITextRangeImpl
, entry
) {
318 case RANGE_UPDATE_DELETE
:
319 /* range fully covered by deleted range - collapse to insertion point */
320 if (range
->start
>= start
&& range
->end
<= end
)
321 range
->start
= range
->end
= start
;
322 /* deleted range cuts from the right */
323 else if (range
->start
< start
&& range
->end
<= end
)
325 /* deleted range cuts from the left */
326 else if (range
->start
>= start
&& range
->end
> end
) {
327 range
->start
= start
;
328 range
->end
-= end
- start
;
330 /* deleted range cuts within */
332 range
->end
-= end
- start
;
335 FIXME("unknown update op, %d\n", op
);
340 static inline BOOL
is_equal_textfont_prop_value(enum textfont_prop_id propid
, textfont_prop_val
*left
,
341 textfont_prop_val
*right
)
360 case FONT_STRIKETHROUGH
:
362 case FONT_SUPERSCRIPT
:
365 return left
->l
== right
->l
;
367 return !strcmpW(left
->str
, right
->str
);
371 return left
->f
== right
->f
;
373 FIXME("unhandled font property %d\n", propid
);
378 static inline void init_textfont_prop_value(enum textfont_prop_id propid
, textfont_prop_val
*v
)
397 case FONT_STRIKETHROUGH
:
399 case FONT_SUPERSCRIPT
:
413 FIXME("unhandled font property %d\n", propid
);
419 static HRESULT
get_textfont_prop_for_pos(const IRichEditOleImpl
*reole
, int pos
, enum textfont_prop_id propid
,
420 textfont_prop_val
*value
)
425 memset(&fmt
, 0, sizeof(fmt
));
426 fmt
.cbSize
= sizeof(fmt
);
427 fmt
.dwMask
= textfont_prop_masks
[propid
][0];
429 ME_CursorFromCharOfs(reole
->editor
, pos
, &from
);
431 ME_MoveCursorChars(reole
->editor
, &to
, 1);
432 ME_GetCharFormat(reole
->editor
, &from
, &to
, &fmt
);
446 case FONT_STRIKETHROUGH
:
448 case FONT_SUPERSCRIPT
:
450 value
->l
= fmt
.dwEffects
& textfont_prop_masks
[propid
][1] ? tomTrue
: tomFalse
;
453 value
->l
= fmt
.bAnimation
;
456 value
->l
= fmt
.dwEffects
& CFE_AUTOBACKCOLOR
? GetSysColor(COLOR_WINDOW
) : fmt
.crBackColor
;
459 value
->l
= fmt
.dwEffects
& CFE_AUTOCOLOR
? GetSysColor(COLOR_WINDOWTEXT
) : fmt
.crTextColor
;
462 value
->f
= fmt
.wKerning
;
468 /* this case is used exclusively by GetName() */
469 value
->str
= SysAllocString(fmt
.szFaceName
);
471 return E_OUTOFMEMORY
;
474 value
->f
= fmt
.yOffset
;
477 value
->f
= fmt
.yHeight
;
480 value
->f
= fmt
.sSpacing
;
483 value
->l
= fmt
.wWeight
;
486 FIXME("unhandled font property %d\n", propid
);
493 static inline const IRichEditOleImpl
*get_range_reole(ITextRange
*range
)
495 IRichEditOleImpl
*reole
= NULL
;
496 ITextRange_QueryInterface(range
, &IID_Igetrichole
, (void**)&reole
);
500 static HRESULT
get_textfont_prop(const ITextFontImpl
*font
, enum textfont_prop_id propid
, textfont_prop_val
*value
)
502 const IRichEditOleImpl
*reole
;
507 /* when font is not attached to any range use cached values */
508 if (!font
->range
|| font
->get_cache_enabled
) {
509 *value
= font
->props
[propid
];
513 if (!(reole
= get_range_reole(font
->range
)))
514 return CO_E_RELEASED
;
516 init_textfont_prop_value(propid
, value
);
518 ITextRange_GetStart(font
->range
, &start
);
519 ITextRange_GetEnd(font
->range
, &end
);
521 /* iterate trough a range to see if property value is consistent */
522 hr
= get_textfont_prop_for_pos(reole
, start
, propid
, &v
);
526 for (i
= start
+ 1; i
< end
; i
++) {
527 textfont_prop_val cur
;
529 hr
= get_textfont_prop_for_pos(reole
, i
, propid
, &cur
);
533 if (!is_equal_textfont_prop_value(propid
, &v
, &cur
))
541 static HRESULT
get_textfont_propf(const ITextFontImpl
*font
, enum textfont_prop_id propid
, FLOAT
*value
)
549 hr
= get_textfont_prop(font
, propid
, &v
);
554 static HRESULT
get_textfont_propl(const ITextFontImpl
*font
, enum textfont_prop_id propid
, LONG
*value
)
562 hr
= get_textfont_prop(font
, propid
, &v
);
567 /* Value should already have a terminal value, for boolean properties it means tomToggle is not handled */
568 static HRESULT
set_textfont_prop(ITextFontImpl
*font
, enum textfont_prop_id propid
, const textfont_prop_val
*value
)
570 const IRichEditOleImpl
*reole
;
575 /* when font is not attached to any range use cache */
576 if (!font
->range
|| font
->set_cache_enabled
) {
577 if (propid
== FONT_NAME
) {
578 SysFreeString(font
->props
[propid
].str
);
579 font
->props
[propid
].str
= SysAllocString(value
->str
);
582 font
->props
[propid
] = *value
;
586 if (!(reole
= get_range_reole(font
->range
)))
587 return CO_E_RELEASED
;
589 memset(&fmt
, 0, sizeof(fmt
));
590 fmt
.cbSize
= sizeof(fmt
);
591 fmt
.dwMask
= textfont_prop_masks
[propid
][0];
605 case FONT_STRIKETHROUGH
:
607 case FONT_SUPERSCRIPT
:
609 fmt
.dwEffects
= value
->l
== tomTrue
? textfont_prop_masks
[propid
][1] : 0;
612 fmt
.bAnimation
= value
->l
;
616 if (value
->l
== tomAutoColor
)
617 fmt
.dwEffects
= textfont_prop_masks
[propid
][1];
618 else if (propid
== FONT_BACKCOLOR
)
619 fmt
.crBackColor
= value
->l
;
621 fmt
.crTextColor
= value
->l
;
624 fmt
.wKerning
= value
->f
;
630 fmt
.yOffset
= value
->f
;
633 fmt
.yHeight
= value
->f
;
636 fmt
.sSpacing
= value
->f
;
639 fmt
.wWeight
= value
->l
;
642 lstrcpynW(fmt
.szFaceName
, value
->str
, sizeof(fmt
.szFaceName
)/sizeof(WCHAR
));
645 FIXME("unhandled font property %d\n", propid
);
649 ITextRange_GetStart(font
->range
, &start
);
650 ITextRange_GetEnd(font
->range
, &end
);
652 ME_CursorFromCharOfs(reole
->editor
, start
, &from
);
653 ME_CursorFromCharOfs(reole
->editor
, end
, &to
);
654 ME_SetCharFormat(reole
->editor
, &from
, &to
, &fmt
);
659 static inline HRESULT
set_textfont_propl(ITextFontImpl
*font
, enum textfont_prop_id propid
, LONG value
)
663 return set_textfont_prop(font
, propid
, &v
);
666 static inline HRESULT
set_textfont_propf(ITextFontImpl
*font
, enum textfont_prop_id propid
, FLOAT value
)
670 return set_textfont_prop(font
, propid
, &v
);
673 static HRESULT
set_textfont_propd(ITextFontImpl
*font
, enum textfont_prop_id propid
, LONG value
)
683 get_textfont_propl(font
, propid
, &oldvalue
);
684 if (oldvalue
== tomFalse
)
686 else if (oldvalue
== tomTrue
)
695 return set_textfont_prop(font
, propid
, &v
);
701 static HRESULT
textfont_getname_from_range(ITextRange
*range
, BSTR
*ret
)
703 const IRichEditOleImpl
*reole
;
708 if (!(reole
= get_range_reole(range
)))
709 return CO_E_RELEASED
;
711 ITextRange_GetStart(range
, &start
);
712 hr
= get_textfont_prop_for_pos(reole
, start
, FONT_NAME
, &v
);
717 static void textfont_cache_range_props(ITextFontImpl
*font
)
719 enum textfont_prop_id propid
;
720 for (propid
= FONT_PROPID_FIRST
; propid
< FONT_PROPID_LAST
; propid
++) {
721 if (propid
== FONT_NAME
)
722 textfont_getname_from_range(font
->range
, &font
->props
[propid
].str
);
724 get_textfont_prop(font
, propid
, &font
->props
[propid
]);
728 static HRESULT WINAPI
IRichEditOleImpl_inner_fnQueryInterface(IUnknown
*iface
, REFIID riid
, LPVOID
*ppvObj
)
730 IRichEditOleImpl
*This
= impl_from_IUnknown(iface
);
732 TRACE("%p %s\n", This
, debugstr_guid(riid
));
735 if (IsEqualGUID(riid
, &IID_IUnknown
))
736 *ppvObj
= &This
->IUnknown_inner
;
737 else if (IsEqualGUID(riid
, &IID_IRichEditOle
))
738 *ppvObj
= &This
->IRichEditOle_iface
;
739 else if (IsEqualGUID(riid
, &IID_ITextDocument
))
740 *ppvObj
= &This
->ITextDocument_iface
;
743 IUnknown_AddRef((IUnknown
*)*ppvObj
);
746 FIXME("%p: unhandled interface %s\n", This
, debugstr_guid(riid
));
748 return E_NOINTERFACE
;
751 static ULONG WINAPI
IRichEditOleImpl_inner_fnAddRef(IUnknown
*iface
)
753 IRichEditOleImpl
*This
= impl_from_IUnknown(iface
);
754 ULONG ref
= InterlockedIncrement(&This
->ref
);
756 TRACE("%p ref = %u\n", This
, ref
);
761 static ULONG WINAPI
IRichEditOleImpl_inner_fnRelease(IUnknown
*iface
)
763 IRichEditOleImpl
*This
= impl_from_IUnknown(iface
);
764 ULONG ref
= InterlockedDecrement(&This
->ref
);
766 TRACE ("%p ref=%u\n", This
, ref
);
770 ITextRangeImpl
*txtRge
;
772 TRACE("Destroying %p\n", This
);
773 This
->txtSel
->reOle
= NULL
;
774 This
->editor
->reOle
= NULL
;
775 ITextSelection_Release(&This
->txtSel
->ITextSelection_iface
);
776 IOleClientSite_Release(&This
->clientSite
->IOleClientSite_iface
);
777 LIST_FOR_EACH_ENTRY(txtRge
, &This
->rangelist
, ITextRangeImpl
, entry
)
778 txtRge
->reOle
= NULL
;
784 static const IUnknownVtbl reo_unk_vtbl
=
786 IRichEditOleImpl_inner_fnQueryInterface
,
787 IRichEditOleImpl_inner_fnAddRef
,
788 IRichEditOleImpl_inner_fnRelease
791 static HRESULT WINAPI
792 IRichEditOle_fnQueryInterface(IRichEditOle
*me
, REFIID riid
, LPVOID
*ppvObj
)
794 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
795 return IUnknown_QueryInterface(This
->outer_unk
, riid
, ppvObj
);
799 IRichEditOle_fnAddRef(IRichEditOle
*me
)
801 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
802 return IUnknown_AddRef(This
->outer_unk
);
806 IRichEditOle_fnRelease(IRichEditOle
*me
)
808 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
809 return IUnknown_Release(This
->outer_unk
);
812 static HRESULT WINAPI
813 IRichEditOle_fnActivateAs(IRichEditOle
*me
, REFCLSID rclsid
, REFCLSID rclsidAs
)
815 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
816 FIXME("stub %p\n",This
);
820 static HRESULT WINAPI
821 IRichEditOle_fnContextSensitiveHelp(IRichEditOle
*me
, BOOL fEnterMode
)
823 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
824 FIXME("stub %p\n",This
);
828 static HRESULT WINAPI
829 IRichEditOle_fnConvertObject(IRichEditOle
*me
, LONG iob
,
830 REFCLSID rclsidNew
, LPCSTR lpstrUserTypeNew
)
832 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
833 FIXME("stub %p\n",This
);
837 static inline IOleClientSiteImpl
*impl_from_IOleClientSite(IOleClientSite
*iface
)
839 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleClientSite_iface
);
842 static HRESULT WINAPI
843 IOleClientSite_fnQueryInterface(IOleClientSite
*me
, REFIID riid
, LPVOID
*ppvObj
)
845 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(me
);
846 TRACE("%p %s\n", me
, debugstr_guid(riid
) );
849 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
850 IsEqualGUID(riid
, &IID_IOleClientSite
))
852 else if (IsEqualGUID(riid
, &IID_IOleWindow
))
853 *ppvObj
= &This
->IOleWindow_iface
;
854 else if (IsEqualGUID(riid
, &IID_IOleInPlaceSite
))
855 *ppvObj
= &This
->IOleInPlaceSite_iface
;
858 IOleClientSite_AddRef(me
);
861 FIXME("%p: unhandled interface %s\n", me
, debugstr_guid(riid
) );
863 return E_NOINTERFACE
;
866 static ULONG WINAPI
IOleClientSite_fnAddRef(IOleClientSite
*iface
)
868 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
869 return InterlockedIncrement(&This
->ref
);
872 static ULONG WINAPI
IOleClientSite_fnRelease(IOleClientSite
*iface
)
874 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
875 ULONG ref
= InterlockedDecrement(&This
->ref
);
881 static HRESULT WINAPI
IOleClientSite_fnSaveObject(IOleClientSite
*iface
)
883 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
885 return CO_E_RELEASED
;
887 FIXME("stub %p\n", iface
);
892 static HRESULT WINAPI
IOleClientSite_fnGetMoniker(IOleClientSite
*iface
, DWORD dwAssign
,
893 DWORD dwWhichMoniker
, IMoniker
**ppmk
)
895 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
897 return CO_E_RELEASED
;
899 FIXME("stub %p\n", iface
);
903 static HRESULT WINAPI
IOleClientSite_fnGetContainer(IOleClientSite
*iface
,
904 IOleContainer
**ppContainer
)
906 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
908 return CO_E_RELEASED
;
910 FIXME("stub %p\n", iface
);
914 static HRESULT WINAPI
IOleClientSite_fnShowObject(IOleClientSite
*iface
)
916 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
918 return CO_E_RELEASED
;
920 FIXME("stub %p\n", iface
);
924 static HRESULT WINAPI
IOleClientSite_fnOnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
926 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
928 return CO_E_RELEASED
;
930 FIXME("stub %p\n", iface
);
934 static HRESULT WINAPI
IOleClientSite_fnRequestNewObjectLayout(IOleClientSite
*iface
)
936 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
938 return CO_E_RELEASED
;
940 FIXME("stub %p\n", iface
);
944 static const IOleClientSiteVtbl ocst
= {
945 IOleClientSite_fnQueryInterface
,
946 IOleClientSite_fnAddRef
,
947 IOleClientSite_fnRelease
,
948 IOleClientSite_fnSaveObject
,
949 IOleClientSite_fnGetMoniker
,
950 IOleClientSite_fnGetContainer
,
951 IOleClientSite_fnShowObject
,
952 IOleClientSite_fnOnShowWindow
,
953 IOleClientSite_fnRequestNewObjectLayout
956 /* IOleWindow interface */
957 static HRESULT WINAPI
IOleWindow_fnQueryInterface(IOleWindow
*iface
, REFIID riid
, void **ppvObj
)
959 IOleClientSiteImpl
*This
= impl_from_IOleWindow(iface
);
960 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppvObj
);
963 static ULONG WINAPI
IOleWindow_fnAddRef(IOleWindow
*iface
)
965 IOleClientSiteImpl
*This
= impl_from_IOleWindow(iface
);
966 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
969 static ULONG WINAPI
IOleWindow_fnRelease(IOleWindow
*iface
)
971 IOleClientSiteImpl
*This
= impl_from_IOleWindow(iface
);
972 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
975 static HRESULT WINAPI
IOleWindow_fnContextSensitiveHelp(IOleWindow
*iface
, BOOL fEnterMode
)
977 IOleClientSiteImpl
*This
= impl_from_IOleWindow(iface
);
978 FIXME("not implemented: (%p)->(%d)\n", This
, fEnterMode
);
982 static HRESULT WINAPI
IOleWindow_fnGetWindow(IOleWindow
*iface
, HWND
*phwnd
)
984 IOleClientSiteImpl
*This
= impl_from_IOleWindow(iface
);
985 TRACE("(%p)->(%p)\n", This
, phwnd
);
990 *phwnd
= This
->reOle
->editor
->hWnd
;
994 static const IOleWindowVtbl olewinvt
= {
995 IOleWindow_fnQueryInterface
,
997 IOleWindow_fnRelease
,
998 IOleWindow_fnGetWindow
,
999 IOleWindow_fnContextSensitiveHelp
1002 /* IOleInPlaceSite interface */
1003 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnQueryInterface(IOleInPlaceSite
*iface
, REFIID riid
, void **ppvObj
)
1005 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1006 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppvObj
);
1009 static ULONG STDMETHODCALLTYPE
IOleInPlaceSite_fnAddRef(IOleInPlaceSite
*iface
)
1011 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1012 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
1015 static ULONG STDMETHODCALLTYPE
IOleInPlaceSite_fnRelease(IOleInPlaceSite
*iface
)
1017 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1018 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
1021 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnGetWindow(IOleInPlaceSite
*iface
, HWND
*phwnd
)
1023 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1024 return IOleWindow_GetWindow(&This
->IOleWindow_iface
, phwnd
);
1027 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnContextSensitiveHelp(IOleInPlaceSite
*iface
, BOOL fEnterMode
)
1029 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1030 return IOleWindow_ContextSensitiveHelp(&This
->IOleWindow_iface
, fEnterMode
);
1033 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnCanInPlaceActivate(IOleInPlaceSite
*iface
)
1035 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1036 FIXME("not implemented: (%p)\n", This
);
1040 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnInPlaceActivate(IOleInPlaceSite
*iface
)
1042 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1043 FIXME("not implemented: (%p)\n", This
);
1047 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnUIActivate(IOleInPlaceSite
*iface
)
1049 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1050 FIXME("not implemented: (%p)\n", This
);
1054 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnGetWindowContext(IOleInPlaceSite
*iface
, IOleInPlaceFrame
**ppFrame
,
1055 IOleInPlaceUIWindow
**ppDoc
, LPRECT lprcPosRect
,
1056 LPRECT lprcClipRect
, LPOLEINPLACEFRAMEINFO lpFrameInfo
)
1058 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1059 FIXME("not implemented: (%p)->(%p %p %p %p %p)\n", This
, ppFrame
, ppDoc
, lprcPosRect
, lprcClipRect
, lpFrameInfo
);
1063 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnScroll(IOleInPlaceSite
*iface
, SIZE scrollExtent
)
1065 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1066 FIXME("not implemented: (%p)\n", This
);
1070 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnUIDeactivate(IOleInPlaceSite
*iface
, BOOL fUndoable
)
1072 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1073 FIXME("not implemented: (%p)->(%d)\n", This
, fUndoable
);
1077 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnInPlaceDeactivate(IOleInPlaceSite
*iface
)
1079 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1080 FIXME("not implemented: (%p)\n", This
);
1084 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnDiscardUndoState(IOleInPlaceSite
*iface
)
1086 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1087 FIXME("not implemented: (%p)\n", This
);
1091 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnDeactivateAndUndo(IOleInPlaceSite
*iface
)
1093 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1094 FIXME("not implemented: (%p)\n", This
);
1098 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnPosRectChange(IOleInPlaceSite
*iface
, LPCRECT lprcPosRect
)
1100 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1101 FIXME("not implemented: (%p)->(%p)\n", This
, lprcPosRect
);
1105 static const IOleInPlaceSiteVtbl olestvt
=
1107 IOleInPlaceSite_fnQueryInterface
,
1108 IOleInPlaceSite_fnAddRef
,
1109 IOleInPlaceSite_fnRelease
,
1110 IOleInPlaceSite_fnGetWindow
,
1111 IOleInPlaceSite_fnContextSensitiveHelp
,
1112 IOleInPlaceSite_fnCanInPlaceActivate
,
1113 IOleInPlaceSite_fnOnInPlaceActivate
,
1114 IOleInPlaceSite_fnOnUIActivate
,
1115 IOleInPlaceSite_fnGetWindowContext
,
1116 IOleInPlaceSite_fnScroll
,
1117 IOleInPlaceSite_fnOnUIDeactivate
,
1118 IOleInPlaceSite_fnOnInPlaceDeactivate
,
1119 IOleInPlaceSite_fnDiscardUndoState
,
1120 IOleInPlaceSite_fnDeactivateAndUndo
,
1121 IOleInPlaceSite_fnOnPosRectChange
1124 static IOleClientSiteImpl
*
1125 CreateOleClientSite(IRichEditOleImpl
*reOle
)
1127 IOleClientSiteImpl
*clientSite
= heap_alloc(sizeof *clientSite
);
1131 clientSite
->IOleClientSite_iface
.lpVtbl
= &ocst
;
1132 clientSite
->IOleWindow_iface
.lpVtbl
= &olewinvt
;
1133 clientSite
->IOleInPlaceSite_iface
.lpVtbl
= &olestvt
;
1134 clientSite
->ref
= 1;
1135 clientSite
->reOle
= reOle
;
1139 static HRESULT WINAPI
1140 IRichEditOle_fnGetClientSite(IRichEditOle
*me
,
1141 LPOLECLIENTSITE
*lplpolesite
)
1143 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1145 TRACE("%p,%p\n",This
, lplpolesite
);
1148 return E_INVALIDARG
;
1149 *lplpolesite
= &This
->clientSite
->IOleClientSite_iface
;
1150 IOleClientSite_AddRef(*lplpolesite
);
1154 static HRESULT WINAPI
1155 IRichEditOle_fnGetClipboardData(IRichEditOle
*me
, CHARRANGE
*lpchrg
,
1156 DWORD reco
, LPDATAOBJECT
*lplpdataobj
)
1158 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1162 TRACE("(%p,%p,%d)\n",This
, lpchrg
, reco
);
1164 return E_INVALIDARG
;
1166 int nFrom
, nTo
, nStartCur
= ME_GetSelectionOfs(This
->editor
, &nFrom
, &nTo
);
1167 start
= This
->editor
->pCursors
[nStartCur
];
1168 nChars
= nTo
- nFrom
;
1170 ME_CursorFromCharOfs(This
->editor
, lpchrg
->cpMin
, &start
);
1171 nChars
= lpchrg
->cpMax
- lpchrg
->cpMin
;
1173 return ME_GetDataObject(This
->editor
, &start
, nChars
, lplpdataobj
);
1176 static LONG WINAPI
IRichEditOle_fnGetLinkCount(IRichEditOle
*me
)
1178 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1179 FIXME("stub %p\n",This
);
1183 static HRESULT WINAPI
1184 IRichEditOle_fnGetObject(IRichEditOle
*me
, LONG iob
,
1185 REOBJECT
*lpreobject
, DWORD dwFlags
)
1187 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1188 FIXME("stub %p\n",This
);
1193 IRichEditOle_fnGetObjectCount(IRichEditOle
*me
)
1195 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1196 FIXME("stub %p\n",This
);
1200 static HRESULT WINAPI
1201 IRichEditOle_fnHandsOffStorage(IRichEditOle
*me
, LONG iob
)
1203 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1204 FIXME("stub %p\n",This
);
1208 static HRESULT WINAPI
1209 IRichEditOle_fnImportDataObject(IRichEditOle
*me
, LPDATAOBJECT lpdataobj
,
1210 CLIPFORMAT cf
, HGLOBAL hMetaPict
)
1212 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1213 FIXME("stub %p\n",This
);
1217 static HRESULT WINAPI
1218 IRichEditOle_fnInPlaceDeactivate(IRichEditOle
*me
)
1220 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1221 FIXME("stub %p\n",This
);
1225 static HRESULT WINAPI
1226 IRichEditOle_fnInsertObject(IRichEditOle
*me
, REOBJECT
*reo
)
1228 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1229 TRACE("(%p,%p)\n", This
, reo
);
1231 if (reo
->cbStruct
< sizeof(*reo
)) return STG_E_INVALIDPARAMETER
;
1233 ME_InsertOLEFromCursor(This
->editor
, reo
, 0);
1234 ME_CommitUndo(This
->editor
);
1235 ME_UpdateRepaint(This
->editor
, FALSE
);
1239 static HRESULT WINAPI
IRichEditOle_fnSaveCompleted(IRichEditOle
*me
, LONG iob
,
1242 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1243 FIXME("stub %p\n",This
);
1247 static HRESULT WINAPI
1248 IRichEditOle_fnSetDvaspect(IRichEditOle
*me
, LONG iob
, DWORD dvaspect
)
1250 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1251 FIXME("stub %p\n",This
);
1255 static HRESULT WINAPI
IRichEditOle_fnSetHostNames(IRichEditOle
*me
,
1256 LPCSTR lpstrContainerApp
, LPCSTR lpstrContainerObj
)
1258 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1259 FIXME("stub %p %s %s\n",This
, lpstrContainerApp
, lpstrContainerObj
);
1263 static HRESULT WINAPI
1264 IRichEditOle_fnSetLinkAvailable(IRichEditOle
*me
, LONG iob
, BOOL fAvailable
)
1266 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1267 FIXME("stub %p\n",This
);
1271 static const IRichEditOleVtbl revt
= {
1272 IRichEditOle_fnQueryInterface
,
1273 IRichEditOle_fnAddRef
,
1274 IRichEditOle_fnRelease
,
1275 IRichEditOle_fnGetClientSite
,
1276 IRichEditOle_fnGetObjectCount
,
1277 IRichEditOle_fnGetLinkCount
,
1278 IRichEditOle_fnGetObject
,
1279 IRichEditOle_fnInsertObject
,
1280 IRichEditOle_fnConvertObject
,
1281 IRichEditOle_fnActivateAs
,
1282 IRichEditOle_fnSetHostNames
,
1283 IRichEditOle_fnSetLinkAvailable
,
1284 IRichEditOle_fnSetDvaspect
,
1285 IRichEditOle_fnHandsOffStorage
,
1286 IRichEditOle_fnSaveCompleted
,
1287 IRichEditOle_fnInPlaceDeactivate
,
1288 IRichEditOle_fnContextSensitiveHelp
,
1289 IRichEditOle_fnGetClipboardData
,
1290 IRichEditOle_fnImportDataObject
1293 /* ITextRange interface */
1294 static HRESULT WINAPI
ITextRange_fnQueryInterface(ITextRange
*me
, REFIID riid
, void **ppvObj
)
1296 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1299 if (IsEqualGUID(riid
, &IID_IUnknown
)
1300 || IsEqualGUID(riid
, &IID_IDispatch
)
1301 || IsEqualGUID(riid
, &IID_ITextRange
))
1304 ITextRange_AddRef(me
);
1307 else if (IsEqualGUID(riid
, &IID_Igetrichole
))
1309 *ppvObj
= This
->reOle
;
1313 return E_NOINTERFACE
;
1316 static ULONG WINAPI
ITextRange_fnAddRef(ITextRange
*me
)
1318 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1319 return InterlockedIncrement(&This
->ref
);
1322 static ULONG WINAPI
ITextRange_fnRelease(ITextRange
*me
)
1324 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1325 ULONG ref
= InterlockedDecrement(&This
->ref
);
1327 TRACE ("%p ref=%u\n", This
, ref
);
1332 list_remove(&This
->entry
);
1340 static HRESULT WINAPI
ITextRange_fnGetTypeInfoCount(ITextRange
*me
, UINT
*pctinfo
)
1342 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1343 TRACE("(%p)->(%p)\n", This
, pctinfo
);
1348 static HRESULT WINAPI
ITextRange_fnGetTypeInfo(ITextRange
*me
, UINT iTInfo
, LCID lcid
,
1349 ITypeInfo
**ppTInfo
)
1351 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1354 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
1356 hr
= get_typeinfo(ITextRange_tid
, ppTInfo
);
1358 ITypeInfo_AddRef(*ppTInfo
);
1362 static HRESULT WINAPI
ITextRange_fnGetIDsOfNames(ITextRange
*me
, REFIID riid
, LPOLESTR
*rgszNames
,
1363 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1365 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1369 TRACE("(%p)->(%p,%p,%u,%d,%p)\n", This
, riid
, rgszNames
, cNames
, lcid
,
1372 hr
= get_typeinfo(ITextRange_tid
, &ti
);
1374 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
1378 static HRESULT WINAPI
ITextRange_fnInvoke(ITextRange
*me
, DISPID dispIdMember
, REFIID riid
,
1379 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1380 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
1383 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1387 TRACE("(%p)->(%d,%p,%d,%u,%p,%p,%p,%p)\n", This
, dispIdMember
, riid
, lcid
,
1388 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1390 hr
= get_typeinfo(ITextRange_tid
, &ti
);
1392 hr
= ITypeInfo_Invoke(ti
, me
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1396 static HRESULT WINAPI
ITextRange_fnGetText(ITextRange
*me
, BSTR
*pbstr
)
1398 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1400 FIXME("(%p)->(%p): stub\n", This
, pbstr
);
1403 return CO_E_RELEASED
;
1406 return E_INVALIDARG
;
1412 static HRESULT WINAPI
ITextRange_fnSetText(ITextRange
*me
, BSTR str
)
1414 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1415 ME_TextEditor
*editor
;
1420 TRACE("(%p)->(%s)\n", This
, debugstr_w(str
));
1423 return CO_E_RELEASED
;
1425 editor
= This
->reOle
->editor
;
1427 /* delete only where's something to delete */
1428 if (This
->start
!= This
->end
) {
1429 ME_CursorFromCharOfs(editor
, This
->start
, &cursor
);
1430 ME_InternalDeleteText(editor
, &cursor
, This
->end
- This
->start
, FALSE
);
1433 if (!str
|| !*str
) {
1434 /* will update this range as well */
1435 textranges_update_ranges(This
->reOle
, This
->start
, This
->end
, RANGE_UPDATE_DELETE
);
1439 /* it's safer not to rely on stored BSTR length */
1441 cursor
= editor
->pCursors
[0];
1442 ME_CursorFromCharOfs(editor
, This
->start
, &editor
->pCursors
[0]);
1443 style
= ME_GetInsertStyle(editor
, 0);
1444 ME_InsertTextFromCursor(editor
, 0, str
, len
, style
);
1445 ME_ReleaseStyle(style
);
1446 editor
->pCursors
[0] = cursor
;
1448 if (len
< This
->end
- This
->start
)
1449 textranges_update_ranges(This
->reOle
, This
->start
+ len
, This
->end
, RANGE_UPDATE_DELETE
);
1451 This
->end
= len
- This
->start
;
1456 static HRESULT
range_GetChar(ME_TextEditor
*editor
, ME_Cursor
*cursor
, LONG
*pch
)
1460 ME_GetTextW(editor
, wch
, 1, cursor
, 1, FALSE
, cursor
->pRun
->next
->type
== diTextEnd
);
1466 static HRESULT WINAPI
ITextRange_fnGetChar(ITextRange
*me
, LONG
*pch
)
1468 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1472 return CO_E_RELEASED
;
1475 return E_INVALIDARG
;
1477 ME_CursorFromCharOfs(This
->reOle
->editor
, This
->start
, &cursor
);
1478 return range_GetChar(This
->reOle
->editor
, &cursor
, pch
);
1481 static HRESULT WINAPI
ITextRange_fnSetChar(ITextRange
*me
, LONG ch
)
1483 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1485 return CO_E_RELEASED
;
1487 FIXME("not implemented %p\n", This
);
1491 static HRESULT
CreateITextRange(IRichEditOleImpl
*reOle
, LONG start
, LONG end
, ITextRange
** ppRange
);
1493 static HRESULT WINAPI
ITextRange_fnGetDuplicate(ITextRange
*me
, ITextRange
**ppRange
)
1495 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1497 return CO_E_RELEASED
;
1499 TRACE("%p %p\n", This
, ppRange
);
1501 return E_INVALIDARG
;
1503 return CreateITextRange(This
->reOle
, This
->start
, This
->end
, ppRange
);
1506 static HRESULT WINAPI
ITextRange_fnGetFormattedText(ITextRange
*me
, ITextRange
**ppRange
)
1508 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1510 return CO_E_RELEASED
;
1512 FIXME("not implemented %p\n", This
);
1516 static HRESULT WINAPI
ITextRange_fnSetFormattedText(ITextRange
*me
, ITextRange
*pRange
)
1518 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1520 return CO_E_RELEASED
;
1522 FIXME("not implemented %p\n", This
);
1526 static HRESULT WINAPI
ITextRange_fnGetStart(ITextRange
*me
, LONG
*start
)
1528 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1530 TRACE("(%p)->(%p)\n", This
, start
);
1533 return CO_E_RELEASED
;
1536 return E_INVALIDARG
;
1538 *start
= This
->start
;
1542 static HRESULT
textrange_setstart(const IRichEditOleImpl
*reole
, LONG value
, LONG
*start
, LONG
*end
)
1549 if (value
== *start
)
1552 if (value
<= *end
) {
1557 len
= ME_GetTextLength(reole
->editor
);
1558 *start
= *end
= value
> len
? len
: value
;
1562 static HRESULT WINAPI
ITextRange_fnSetStart(ITextRange
*me
, LONG value
)
1564 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1566 TRACE("(%p)->(%d)\n", This
, value
);
1569 return CO_E_RELEASED
;
1571 return textrange_setstart(This
->reOle
, value
, &This
->start
, &This
->end
);
1574 static HRESULT WINAPI
ITextRange_fnGetEnd(ITextRange
*me
, LONG
*end
)
1576 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1578 TRACE("(%p)->(%p)\n", This
, end
);
1581 return CO_E_RELEASED
;
1584 return E_INVALIDARG
;
1590 static HRESULT
textrange_setend(const IRichEditOleImpl
*reole
, LONG value
, LONG
*start
, LONG
*end
)
1597 if (value
< *start
) {
1598 *start
= *end
= max(0, value
);
1602 len
= ME_GetTextLength(reole
->editor
);
1603 *end
= value
> len
? len
+ 1 : value
;
1607 static HRESULT WINAPI
ITextRange_fnSetEnd(ITextRange
*me
, LONG value
)
1609 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1611 TRACE("(%p)->(%d)\n", This
, value
);
1614 return CO_E_RELEASED
;
1616 return textrange_setend(This
->reOle
, value
, &This
->start
, &This
->end
);
1619 static HRESULT WINAPI
ITextRange_fnGetFont(ITextRange
*me
, ITextFont
**font
)
1621 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1623 TRACE("(%p)->(%p)\n", This
, font
);
1626 return CO_E_RELEASED
;
1629 return E_INVALIDARG
;
1631 return create_textfont(me
, NULL
, font
);
1634 static HRESULT WINAPI
ITextRange_fnSetFont(ITextRange
*me
, ITextFont
*pFont
)
1636 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1638 return CO_E_RELEASED
;
1640 FIXME("not implemented %p\n", This
);
1644 static HRESULT WINAPI
ITextRange_fnGetPara(ITextRange
*me
, ITextPara
**para
)
1646 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1648 TRACE("(%p)->(%p)\n", This
, para
);
1651 return CO_E_RELEASED
;
1654 return E_INVALIDARG
;
1656 return create_textpara(me
, para
);
1659 static HRESULT WINAPI
ITextRange_fnSetPara(ITextRange
*me
, ITextPara
*pPara
)
1661 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1663 return CO_E_RELEASED
;
1665 FIXME("not implemented %p\n", This
);
1669 static HRESULT WINAPI
ITextRange_fnGetStoryLength(ITextRange
*me
, LONG
*pcch
)
1671 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1673 return CO_E_RELEASED
;
1675 FIXME("not implemented %p\n", This
);
1679 static HRESULT WINAPI
ITextRange_fnGetStoryType(ITextRange
*me
, LONG
*pValue
)
1681 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1683 return CO_E_RELEASED
;
1685 FIXME("not implemented %p\n", This
);
1689 static HRESULT
range_Collapse(LONG bStart
, LONG
*start
, LONG
*end
)
1694 if (bStart
== tomEnd
|| bStart
== tomFalse
)
1701 static HRESULT WINAPI
ITextRange_fnCollapse(ITextRange
*me
, LONG bStart
)
1703 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1705 return CO_E_RELEASED
;
1707 return range_Collapse(bStart
, &This
->start
, &This
->end
);
1710 static HRESULT WINAPI
ITextRange_fnExpand(ITextRange
*me
, LONG Unit
, LONG
*pDelta
)
1712 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1714 return CO_E_RELEASED
;
1716 FIXME("not implemented %p\n", This
);
1720 static HRESULT WINAPI
ITextRange_fnGetIndex(ITextRange
*me
, LONG Unit
, LONG
*pIndex
)
1722 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1724 return CO_E_RELEASED
;
1726 FIXME("not implemented %p\n", This
);
1730 static HRESULT WINAPI
ITextRange_fnSetIndex(ITextRange
*me
, LONG Unit
, LONG Index
,
1733 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1735 return CO_E_RELEASED
;
1737 FIXME("not implemented %p\n", This
);
1741 static HRESULT WINAPI
ITextRange_fnSetRange(ITextRange
*me
, LONG cpActive
, LONG cpOther
)
1743 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1745 return CO_E_RELEASED
;
1747 FIXME("not implemented %p\n", This
);
1751 static HRESULT WINAPI
ITextRange_fnInRange(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
1753 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1755 return CO_E_RELEASED
;
1757 FIXME("not implemented %p\n", This
);
1761 static HRESULT WINAPI
ITextRange_fnInStory(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
1763 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1765 return CO_E_RELEASED
;
1767 FIXME("not implemented %p\n", This
);
1771 static HRESULT WINAPI
ITextRange_fnIsEqual(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
1773 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1775 return CO_E_RELEASED
;
1777 FIXME("not implemented %p\n", This
);
1781 static HRESULT WINAPI
ITextRange_fnSelect(ITextRange
*me
)
1783 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1785 return CO_E_RELEASED
;
1787 FIXME("not implemented %p\n", This
);
1791 static HRESULT WINAPI
ITextRange_fnStartOf(ITextRange
*me
, LONG Unit
, LONG Extend
,
1794 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1796 return CO_E_RELEASED
;
1798 FIXME("not implemented %p\n", This
);
1802 static HRESULT WINAPI
ITextRange_fnEndOf(ITextRange
*me
, LONG Unit
, LONG Extend
,
1805 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1807 return CO_E_RELEASED
;
1809 FIXME("not implemented %p\n", This
);
1813 static HRESULT WINAPI
ITextRange_fnMove(ITextRange
*me
, LONG Unit
, LONG Count
, LONG
*pDelta
)
1815 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1817 return CO_E_RELEASED
;
1819 FIXME("not implemented %p\n", This
);
1823 static HRESULT WINAPI
ITextRange_fnMoveStart(ITextRange
*me
, LONG Unit
, LONG Count
,
1826 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1828 return CO_E_RELEASED
;
1830 FIXME("not implemented %p\n", This
);
1834 static HRESULT WINAPI
ITextRange_fnMoveEnd(ITextRange
*me
, LONG Unit
, LONG Count
,
1837 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1839 return CO_E_RELEASED
;
1841 FIXME("not implemented %p\n", This
);
1845 static HRESULT WINAPI
ITextRange_fnMoveWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
1848 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1850 return CO_E_RELEASED
;
1852 FIXME("not implemented %p\n", This
);
1856 static HRESULT WINAPI
ITextRange_fnMoveStartWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
1859 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1861 return CO_E_RELEASED
;
1863 FIXME("not implemented %p\n", This
);
1867 static HRESULT WINAPI
ITextRange_fnMoveEndWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
1870 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1872 return CO_E_RELEASED
;
1874 FIXME("not implemented %p\n", This
);
1878 static HRESULT WINAPI
ITextRange_fnMoveUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
1881 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1883 return CO_E_RELEASED
;
1885 FIXME("not implemented %p\n", This
);
1889 static HRESULT WINAPI
ITextRange_fnMoveStartUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
1892 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1894 return CO_E_RELEASED
;
1896 FIXME("not implemented %p\n", This
);
1900 static HRESULT WINAPI
ITextRange_fnMoveEndUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
1903 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1905 return CO_E_RELEASED
;
1907 FIXME("not implemented %p\n", This
);
1911 static HRESULT WINAPI
ITextRange_fnFindText(ITextRange
*me
, BSTR bstr
, LONG cch
, LONG Flags
,
1914 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1916 return CO_E_RELEASED
;
1918 FIXME("not implemented %p\n", This
);
1922 static HRESULT WINAPI
ITextRange_fnFindTextStart(ITextRange
*me
, BSTR bstr
, LONG cch
,
1923 LONG Flags
, LONG
*pLength
)
1925 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1927 return CO_E_RELEASED
;
1929 FIXME("not implemented %p\n", This
);
1933 static HRESULT WINAPI
ITextRange_fnFindTextEnd(ITextRange
*me
, BSTR bstr
, LONG cch
,
1934 LONG Flags
, LONG
*pLength
)
1936 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1938 return CO_E_RELEASED
;
1940 FIXME("not implemented %p\n", This
);
1944 static HRESULT WINAPI
ITextRange_fnDelete(ITextRange
*me
, LONG Unit
, LONG Count
,
1947 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1949 return CO_E_RELEASED
;
1951 FIXME("not implemented %p\n", This
);
1955 static HRESULT WINAPI
ITextRange_fnCut(ITextRange
*me
, VARIANT
*pVar
)
1957 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1959 return CO_E_RELEASED
;
1961 FIXME("not implemented %p\n", This
);
1965 static HRESULT WINAPI
ITextRange_fnCopy(ITextRange
*me
, VARIANT
*pVar
)
1967 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1969 return CO_E_RELEASED
;
1971 FIXME("not implemented %p\n", This
);
1975 static HRESULT WINAPI
ITextRange_fnPaste(ITextRange
*me
, VARIANT
*pVar
, LONG Format
)
1977 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1979 return CO_E_RELEASED
;
1981 FIXME("not implemented %p\n", This
);
1985 static HRESULT WINAPI
ITextRange_fnCanPaste(ITextRange
*me
, VARIANT
*pVar
, LONG Format
,
1988 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1990 return CO_E_RELEASED
;
1992 FIXME("not implemented %p\n", This
);
1996 static HRESULT WINAPI
ITextRange_fnCanEdit(ITextRange
*me
, LONG
*pb
)
1998 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2000 return CO_E_RELEASED
;
2002 FIXME("not implemented %p\n", This
);
2006 static HRESULT WINAPI
ITextRange_fnChangeCase(ITextRange
*me
, LONG Type
)
2008 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2010 return CO_E_RELEASED
;
2012 FIXME("not implemented %p\n", This
);
2016 static HRESULT WINAPI
ITextRange_fnGetPoint(ITextRange
*me
, LONG Type
, LONG
*cx
, LONG
*cy
)
2018 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2020 return CO_E_RELEASED
;
2022 FIXME("not implemented %p\n", This
);
2026 static HRESULT WINAPI
ITextRange_fnSetPoint(ITextRange
*me
, LONG x
, LONG y
, LONG Type
,
2029 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2031 return CO_E_RELEASED
;
2033 FIXME("not implemented %p\n", This
);
2037 static HRESULT WINAPI
ITextRange_fnScrollIntoView(ITextRange
*me
, LONG Value
)
2039 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2041 return CO_E_RELEASED
;
2043 FIXME("not implemented %p\n", This
);
2047 static HRESULT WINAPI
ITextRange_fnGetEmbeddedObject(ITextRange
*me
, IUnknown
**ppv
)
2049 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2051 return CO_E_RELEASED
;
2053 FIXME("not implemented %p\n", This
);
2057 static const ITextRangeVtbl trvt
= {
2058 ITextRange_fnQueryInterface
,
2059 ITextRange_fnAddRef
,
2060 ITextRange_fnRelease
,
2061 ITextRange_fnGetTypeInfoCount
,
2062 ITextRange_fnGetTypeInfo
,
2063 ITextRange_fnGetIDsOfNames
,
2064 ITextRange_fnInvoke
,
2065 ITextRange_fnGetText
,
2066 ITextRange_fnSetText
,
2067 ITextRange_fnGetChar
,
2068 ITextRange_fnSetChar
,
2069 ITextRange_fnGetDuplicate
,
2070 ITextRange_fnGetFormattedText
,
2071 ITextRange_fnSetFormattedText
,
2072 ITextRange_fnGetStart
,
2073 ITextRange_fnSetStart
,
2074 ITextRange_fnGetEnd
,
2075 ITextRange_fnSetEnd
,
2076 ITextRange_fnGetFont
,
2077 ITextRange_fnSetFont
,
2078 ITextRange_fnGetPara
,
2079 ITextRange_fnSetPara
,
2080 ITextRange_fnGetStoryLength
,
2081 ITextRange_fnGetStoryType
,
2082 ITextRange_fnCollapse
,
2083 ITextRange_fnExpand
,
2084 ITextRange_fnGetIndex
,
2085 ITextRange_fnSetIndex
,
2086 ITextRange_fnSetRange
,
2087 ITextRange_fnInRange
,
2088 ITextRange_fnInStory
,
2089 ITextRange_fnIsEqual
,
2090 ITextRange_fnSelect
,
2091 ITextRange_fnStartOf
,
2094 ITextRange_fnMoveStart
,
2095 ITextRange_fnMoveEnd
,
2096 ITextRange_fnMoveWhile
,
2097 ITextRange_fnMoveStartWhile
,
2098 ITextRange_fnMoveEndWhile
,
2099 ITextRange_fnMoveUntil
,
2100 ITextRange_fnMoveStartUntil
,
2101 ITextRange_fnMoveEndUntil
,
2102 ITextRange_fnFindText
,
2103 ITextRange_fnFindTextStart
,
2104 ITextRange_fnFindTextEnd
,
2105 ITextRange_fnDelete
,
2109 ITextRange_fnCanPaste
,
2110 ITextRange_fnCanEdit
,
2111 ITextRange_fnChangeCase
,
2112 ITextRange_fnGetPoint
,
2113 ITextRange_fnSetPoint
,
2114 ITextRange_fnScrollIntoView
,
2115 ITextRange_fnGetEmbeddedObject
2119 static HRESULT WINAPI
TextFont_QueryInterface(ITextFont
*iface
, REFIID riid
, void **ppv
)
2121 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2123 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
2125 if (IsEqualIID(riid
, &IID_ITextFont
) ||
2126 IsEqualIID(riid
, &IID_IDispatch
) ||
2127 IsEqualIID(riid
, &IID_IUnknown
))
2130 ITextFont_AddRef(iface
);
2135 return E_NOINTERFACE
;
2138 static ULONG WINAPI
TextFont_AddRef(ITextFont
*iface
)
2140 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2141 ULONG ref
= InterlockedIncrement(&This
->ref
);
2142 TRACE("(%p)->(%u)\n", This
, ref
);
2146 static ULONG WINAPI
TextFont_Release(ITextFont
*iface
)
2148 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2149 ULONG ref
= InterlockedDecrement(&This
->ref
);
2151 TRACE("(%p)->(%u)\n", This
, ref
);
2156 ITextRange_Release(This
->range
);
2157 SysFreeString(This
->props
[FONT_NAME
].str
);
2164 static HRESULT WINAPI
TextFont_GetTypeInfoCount(ITextFont
*iface
, UINT
*pctinfo
)
2166 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2167 TRACE("(%p)->(%p)\n", This
, pctinfo
);
2172 static HRESULT WINAPI
TextFont_GetTypeInfo(ITextFont
*iface
, UINT iTInfo
, LCID lcid
,
2173 ITypeInfo
**ppTInfo
)
2175 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2178 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
2180 hr
= get_typeinfo(ITextFont_tid
, ppTInfo
);
2182 ITypeInfo_AddRef(*ppTInfo
);
2186 static HRESULT WINAPI
TextFont_GetIDsOfNames(ITextFont
*iface
, REFIID riid
,
2187 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
2189 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2193 TRACE("(%p)->(%p,%p,%u,%d,%p)\n", This
, riid
, rgszNames
, cNames
, lcid
,
2196 hr
= get_typeinfo(ITextFont_tid
, &ti
);
2198 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
2202 static HRESULT WINAPI
TextFont_Invoke(
2204 DISPID dispIdMember
,
2208 DISPPARAMS
*pDispParams
,
2209 VARIANT
*pVarResult
,
2210 EXCEPINFO
*pExcepInfo
,
2213 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2217 TRACE("(%p)->(%d,%p,%d,%u,%p,%p,%p,%p)\n", This
, dispIdMember
, riid
, lcid
,
2218 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2220 hr
= get_typeinfo(ITextFont_tid
, &ti
);
2222 hr
= ITypeInfo_Invoke(ti
, iface
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2226 static HRESULT WINAPI
TextFont_GetDuplicate(ITextFont
*iface
, ITextFont
**ret
)
2228 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2230 TRACE("(%p)->(%p)\n", This
, ret
);
2233 return E_INVALIDARG
;
2236 if (This
->range
&& !get_range_reole(This
->range
))
2237 return CO_E_RELEASED
;
2239 return create_textfont(NULL
, This
, ret
);
2242 static HRESULT WINAPI
TextFont_SetDuplicate(ITextFont
*iface
, ITextFont
*pFont
)
2244 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2245 FIXME("(%p)->(%p): stub\n", This
, pFont
);
2249 static HRESULT WINAPI
TextFont_CanChange(ITextFont
*iface
, LONG
*ret
)
2251 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2252 FIXME("(%p)->(%p): stub\n", This
, ret
);
2256 static HRESULT WINAPI
TextFont_IsEqual(ITextFont
*iface
, ITextFont
*font
, LONG
*ret
)
2258 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2259 FIXME("(%p)->(%p %p): stub\n", This
, font
, ret
);
2263 static void textfont_reset_to_default(ITextFontImpl
*font
)
2265 enum textfont_prop_id id
;
2267 for (id
= FONT_PROPID_FIRST
; id
< FONT_PROPID_LAST
; id
++) {
2271 case FONT_ANIMATION
:
2278 case FONT_PROTECTED
:
2280 case FONT_SMALLCAPS
:
2281 case FONT_STRIKETHROUGH
:
2282 case FONT_SUBSCRIPT
:
2283 case FONT_SUPERSCRIPT
:
2284 case FONT_UNDERLINE
:
2285 font
->props
[id
].l
= tomFalse
;
2287 case FONT_BACKCOLOR
:
2288 case FONT_FORECOLOR
:
2289 font
->props
[id
].l
= tomAutoColor
;
2295 font
->props
[id
].f
= 0.0;
2298 font
->props
[id
].l
= GetSystemDefaultLCID();
2301 static const WCHAR sysW
[] = {'S','y','s','t','e','m',0};
2302 SysFreeString(font
->props
[id
].str
);
2303 font
->props
[id
].str
= SysAllocString(sysW
);
2307 font
->props
[id
].l
= FW_NORMAL
;
2310 FIXME("font property %d not handled\n", id
);
2315 static void textfont_reset_to_undefined(ITextFontImpl
*font
)
2317 enum textfont_prop_id id
;
2319 for (id
= FONT_PROPID_FIRST
; id
< FONT_PROPID_LAST
; id
++) {
2323 case FONT_ANIMATION
:
2330 case FONT_PROTECTED
:
2332 case FONT_SMALLCAPS
:
2333 case FONT_STRIKETHROUGH
:
2334 case FONT_SUBSCRIPT
:
2335 case FONT_SUPERSCRIPT
:
2336 case FONT_UNDERLINE
:
2337 case FONT_BACKCOLOR
:
2338 case FONT_FORECOLOR
:
2341 font
->props
[id
].l
= tomUndefined
;
2347 font
->props
[id
].f
= tomUndefined
;
2352 FIXME("font property %d not handled\n", id
);
2357 static void textfont_apply_range_props(ITextFontImpl
*font
)
2359 enum textfont_prop_id propid
;
2360 for (propid
= FONT_PROPID_FIRST
; propid
< FONT_PROPID_LAST
; propid
++)
2361 set_textfont_prop(font
, propid
, &font
->props
[propid
]);
2364 static HRESULT WINAPI
TextFont_Reset(ITextFont
*iface
, LONG value
)
2366 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2368 TRACE("(%p)->(%d)\n", This
, value
);
2370 /* If font is attached to a range, released or not, we can't
2371 reset to undefined */
2373 if (!get_range_reole(This
->range
))
2374 return CO_E_RELEASED
;
2379 return E_INVALIDARG
;
2381 textfont_cache_range_props(This
);
2382 This
->get_cache_enabled
= TRUE
;
2385 This
->get_cache_enabled
= FALSE
;
2388 This
->set_cache_enabled
= TRUE
;
2391 This
->set_cache_enabled
= FALSE
;
2392 textfont_apply_range_props(This
);
2395 FIXME("reset mode %d not supported\n", value
);
2403 /* reset to global defaults */
2405 textfont_reset_to_default(This
);
2407 /* all properties are set to tomUndefined, font name is retained */
2409 textfont_reset_to_undefined(This
);
2419 FIXME("reset mode %d not supported\n", value
);
2423 static HRESULT WINAPI
TextFont_GetStyle(ITextFont
*iface
, LONG
*value
)
2425 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2426 FIXME("(%p)->(%p): stub\n", This
, value
);
2430 static HRESULT WINAPI
TextFont_SetStyle(ITextFont
*iface
, LONG value
)
2432 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2433 FIXME("(%p)->(%d): stub\n", This
, value
);
2437 static HRESULT WINAPI
TextFont_GetAllCaps(ITextFont
*iface
, LONG
*value
)
2439 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2440 TRACE("(%p)->(%p)\n", This
, value
);
2441 return get_textfont_propl(This
, FONT_ALLCAPS
, value
);
2444 static HRESULT WINAPI
TextFont_SetAllCaps(ITextFont
*iface
, LONG value
)
2446 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2447 TRACE("(%p)->(%d)\n", This
, value
);
2448 return set_textfont_propd(This
, FONT_ALLCAPS
, value
);
2451 static HRESULT WINAPI
TextFont_GetAnimation(ITextFont
*iface
, LONG
*value
)
2453 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2454 TRACE("(%p)->(%p)\n", This
, value
);
2455 return get_textfont_propl(This
, FONT_ANIMATION
, value
);
2458 static HRESULT WINAPI
TextFont_SetAnimation(ITextFont
*iface
, LONG value
)
2460 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2462 TRACE("(%p)->(%d)\n", This
, value
);
2464 if (value
< tomNoAnimation
|| value
> tomAnimationMax
)
2465 return E_INVALIDARG
;
2467 return set_textfont_propl(This
, FONT_ANIMATION
, value
);
2470 static HRESULT WINAPI
TextFont_GetBackColor(ITextFont
*iface
, LONG
*value
)
2472 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2473 TRACE("(%p)->(%p)\n", This
, value
);
2474 return get_textfont_propl(This
, FONT_BACKCOLOR
, value
);
2477 static HRESULT WINAPI
TextFont_SetBackColor(ITextFont
*iface
, LONG value
)
2479 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2480 TRACE("(%p)->(%d)\n", This
, value
);
2481 return set_textfont_propl(This
, FONT_BACKCOLOR
, value
);
2484 static HRESULT WINAPI
TextFont_GetBold(ITextFont
*iface
, LONG
*value
)
2486 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2487 TRACE("(%p)->(%p)\n", This
, value
);
2488 return get_textfont_propl(This
, FONT_BOLD
, value
);
2491 static HRESULT WINAPI
TextFont_SetBold(ITextFont
*iface
, LONG value
)
2493 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2494 TRACE("(%p)->(%d)\n", This
, value
);
2495 return set_textfont_propd(This
, FONT_BOLD
, value
);
2498 static HRESULT WINAPI
TextFont_GetEmboss(ITextFont
*iface
, LONG
*value
)
2500 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2501 TRACE("(%p)->(%p)\n", This
, value
);
2502 return get_textfont_propl(This
, FONT_EMBOSS
, value
);
2505 static HRESULT WINAPI
TextFont_SetEmboss(ITextFont
*iface
, LONG value
)
2507 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2508 TRACE("(%p)->(%d)\n", This
, value
);
2509 return set_textfont_propd(This
, FONT_EMBOSS
, value
);
2512 static HRESULT WINAPI
TextFont_GetForeColor(ITextFont
*iface
, LONG
*value
)
2514 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2515 TRACE("(%p)->(%p)\n", This
, value
);
2516 return get_textfont_propl(This
, FONT_FORECOLOR
, value
);
2519 static HRESULT WINAPI
TextFont_SetForeColor(ITextFont
*iface
, LONG value
)
2521 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2522 TRACE("(%p)->(%d)\n", This
, value
);
2523 return set_textfont_propl(This
, FONT_FORECOLOR
, value
);
2526 static HRESULT WINAPI
TextFont_GetHidden(ITextFont
*iface
, LONG
*value
)
2528 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2529 TRACE("(%p)->(%p)\n", This
, value
);
2530 return get_textfont_propl(This
, FONT_HIDDEN
, value
);
2533 static HRESULT WINAPI
TextFont_SetHidden(ITextFont
*iface
, LONG value
)
2535 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2536 TRACE("(%p)->(%d)\n", This
, value
);
2537 return set_textfont_propd(This
, FONT_HIDDEN
, value
);
2540 static HRESULT WINAPI
TextFont_GetEngrave(ITextFont
*iface
, LONG
*value
)
2542 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2543 TRACE("(%p)->(%p)\n", This
, value
);
2544 return get_textfont_propl(This
, FONT_ENGRAVE
, value
);
2547 static HRESULT WINAPI
TextFont_SetEngrave(ITextFont
*iface
, LONG value
)
2549 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2550 TRACE("(%p)->(%d)\n", This
, value
);
2551 return set_textfont_propd(This
, FONT_ENGRAVE
, value
);
2554 static HRESULT WINAPI
TextFont_GetItalic(ITextFont
*iface
, LONG
*value
)
2556 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2557 TRACE("(%p)->(%p)\n", This
, value
);
2558 return get_textfont_propl(This
, FONT_ITALIC
, value
);
2561 static HRESULT WINAPI
TextFont_SetItalic(ITextFont
*iface
, LONG value
)
2563 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2564 TRACE("(%p)->(%d)\n", This
, value
);
2565 return set_textfont_propd(This
, FONT_ITALIC
, value
);
2568 static HRESULT WINAPI
TextFont_GetKerning(ITextFont
*iface
, FLOAT
*value
)
2570 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2571 TRACE("(%p)->(%p)\n", This
, value
);
2572 return get_textfont_propf(This
, FONT_KERNING
, value
);
2575 static HRESULT WINAPI
TextFont_SetKerning(ITextFont
*iface
, FLOAT value
)
2577 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2578 TRACE("(%p)->(%.2f)\n", This
, value
);
2579 return set_textfont_propf(This
, FONT_KERNING
, value
);
2582 static HRESULT WINAPI
TextFont_GetLanguageID(ITextFont
*iface
, LONG
*value
)
2584 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2585 TRACE("(%p)->(%p)\n", This
, value
);
2586 return get_textfont_propl(This
, FONT_LANGID
, value
);
2589 static HRESULT WINAPI
TextFont_SetLanguageID(ITextFont
*iface
, LONG value
)
2591 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2592 TRACE("(%p)->(%d)\n", This
, value
);
2593 return set_textfont_propl(This
, FONT_LANGID
, value
);
2596 static HRESULT WINAPI
TextFont_GetName(ITextFont
*iface
, BSTR
*value
)
2598 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2600 TRACE("(%p)->(%p)\n", This
, value
);
2603 return E_INVALIDARG
;
2608 if (This
->props
[FONT_NAME
].str
)
2609 *value
= SysAllocString(This
->props
[FONT_NAME
].str
);
2611 *value
= SysAllocStringLen(NULL
, 0);
2612 return *value
? S_OK
: E_OUTOFMEMORY
;
2615 return textfont_getname_from_range(This
->range
, value
);
2618 static HRESULT WINAPI
TextFont_SetName(ITextFont
*iface
, BSTR value
)
2620 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2621 textfont_prop_val v
;
2623 TRACE("(%p)->(%s)\n", This
, debugstr_w(value
));
2626 return set_textfont_prop(This
, FONT_NAME
, &v
);
2629 static HRESULT WINAPI
TextFont_GetOutline(ITextFont
*iface
, LONG
*value
)
2631 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2632 TRACE("(%p)->(%p)\n", This
, value
);
2633 return get_textfont_propl(This
, FONT_OUTLINE
, value
);
2636 static HRESULT WINAPI
TextFont_SetOutline(ITextFont
*iface
, LONG value
)
2638 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2639 TRACE("(%p)->(%d)\n", This
, value
);
2640 return set_textfont_propd(This
, FONT_OUTLINE
, value
);
2643 static HRESULT WINAPI
TextFont_GetPosition(ITextFont
*iface
, FLOAT
*value
)
2645 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2646 TRACE("(%p)->(%p)\n", This
, value
);
2647 return get_textfont_propf(This
, FONT_POSITION
, value
);
2650 static HRESULT WINAPI
TextFont_SetPosition(ITextFont
*iface
, FLOAT value
)
2652 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2653 TRACE("(%p)->(%.2f)\n", This
, value
);
2654 return set_textfont_propf(This
, FONT_POSITION
, value
);
2657 static HRESULT WINAPI
TextFont_GetProtected(ITextFont
*iface
, LONG
*value
)
2659 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2660 TRACE("(%p)->(%p)\n", This
, value
);
2661 return get_textfont_propl(This
, FONT_PROTECTED
, value
);
2664 static HRESULT WINAPI
TextFont_SetProtected(ITextFont
*iface
, LONG value
)
2666 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2667 TRACE("(%p)->(%d)\n", This
, value
);
2668 return set_textfont_propd(This
, FONT_PROTECTED
, value
);
2671 static HRESULT WINAPI
TextFont_GetShadow(ITextFont
*iface
, LONG
*value
)
2673 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2674 TRACE("(%p)->(%p)\n", This
, value
);
2675 return get_textfont_propl(This
, FONT_SHADOW
, value
);
2678 static HRESULT WINAPI
TextFont_SetShadow(ITextFont
*iface
, LONG value
)
2680 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2681 TRACE("(%p)->(%d)\n", This
, value
);
2682 return set_textfont_propd(This
, FONT_SHADOW
, value
);
2685 static HRESULT WINAPI
TextFont_GetSize(ITextFont
*iface
, FLOAT
*value
)
2687 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2688 TRACE("(%p)->(%p)\n", This
, value
);
2689 return get_textfont_propf(This
, FONT_SIZE
, value
);
2692 static HRESULT WINAPI
TextFont_SetSize(ITextFont
*iface
, FLOAT value
)
2694 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2695 TRACE("(%p)->(%.2f)\n", This
, value
);
2696 return set_textfont_propf(This
, FONT_SIZE
, value
);
2699 static HRESULT WINAPI
TextFont_GetSmallCaps(ITextFont
*iface
, LONG
*value
)
2701 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2702 TRACE("(%p)->(%p)\n", This
, value
);
2703 return get_textfont_propl(This
, FONT_SMALLCAPS
, value
);
2706 static HRESULT WINAPI
TextFont_SetSmallCaps(ITextFont
*iface
, LONG value
)
2708 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2709 TRACE("(%p)->(%d)\n", This
, value
);
2710 return set_textfont_propd(This
, FONT_SMALLCAPS
, value
);
2713 static HRESULT WINAPI
TextFont_GetSpacing(ITextFont
*iface
, FLOAT
*value
)
2715 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2716 TRACE("(%p)->(%p)\n", This
, value
);
2717 return get_textfont_propf(This
, FONT_SPACING
, value
);
2720 static HRESULT WINAPI
TextFont_SetSpacing(ITextFont
*iface
, FLOAT value
)
2722 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2723 TRACE("(%p)->(%.2f)\n", This
, value
);
2724 return set_textfont_propf(This
, FONT_SPACING
, value
);
2727 static HRESULT WINAPI
TextFont_GetStrikeThrough(ITextFont
*iface
, LONG
*value
)
2729 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2730 TRACE("(%p)->(%p)\n", This
, value
);
2731 return get_textfont_propl(This
, FONT_STRIKETHROUGH
, value
);
2734 static HRESULT WINAPI
TextFont_SetStrikeThrough(ITextFont
*iface
, LONG value
)
2736 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2737 TRACE("(%p)->(%d)\n", This
, value
);
2738 return set_textfont_propd(This
, FONT_STRIKETHROUGH
, value
);
2741 static HRESULT WINAPI
TextFont_GetSubscript(ITextFont
*iface
, LONG
*value
)
2743 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2744 TRACE("(%p)->(%p)\n", This
, value
);
2745 return get_textfont_propl(This
, FONT_SUBSCRIPT
, value
);
2748 static HRESULT WINAPI
TextFont_SetSubscript(ITextFont
*iface
, LONG value
)
2750 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2751 TRACE("(%p)->(%d)\n", This
, value
);
2752 return set_textfont_propd(This
, FONT_SUBSCRIPT
, value
);
2755 static HRESULT WINAPI
TextFont_GetSuperscript(ITextFont
*iface
, LONG
*value
)
2757 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2758 TRACE("(%p)->(%p)\n", This
, value
);
2759 return get_textfont_propl(This
, FONT_SUPERSCRIPT
, value
);
2762 static HRESULT WINAPI
TextFont_SetSuperscript(ITextFont
*iface
, LONG value
)
2764 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2765 TRACE("(%p)->(%d)\n", This
, value
);
2766 return set_textfont_propd(This
, FONT_SUPERSCRIPT
, value
);
2769 static HRESULT WINAPI
TextFont_GetUnderline(ITextFont
*iface
, LONG
*value
)
2771 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2772 TRACE("(%p)->(%p)\n", This
, value
);
2773 return get_textfont_propl(This
, FONT_UNDERLINE
, value
);
2776 static HRESULT WINAPI
TextFont_SetUnderline(ITextFont
*iface
, LONG value
)
2778 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2779 TRACE("(%p)->(%d)\n", This
, value
);
2780 return set_textfont_propd(This
, FONT_UNDERLINE
, value
);
2783 static HRESULT WINAPI
TextFont_GetWeight(ITextFont
*iface
, LONG
*value
)
2785 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2786 TRACE("(%p)->(%p)\n", This
, value
);
2787 return get_textfont_propl(This
, FONT_WEIGHT
, value
);
2790 static HRESULT WINAPI
TextFont_SetWeight(ITextFont
*iface
, LONG value
)
2792 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2793 TRACE("(%p)->(%d)\n", This
, value
);
2794 return set_textfont_propl(This
, FONT_WEIGHT
, value
);
2797 static ITextFontVtbl textfontvtbl
= {
2798 TextFont_QueryInterface
,
2801 TextFont_GetTypeInfoCount
,
2802 TextFont_GetTypeInfo
,
2803 TextFont_GetIDsOfNames
,
2805 TextFont_GetDuplicate
,
2806 TextFont_SetDuplicate
,
2812 TextFont_GetAllCaps
,
2813 TextFont_SetAllCaps
,
2814 TextFont_GetAnimation
,
2815 TextFont_SetAnimation
,
2816 TextFont_GetBackColor
,
2817 TextFont_SetBackColor
,
2822 TextFont_GetForeColor
,
2823 TextFont_SetForeColor
,
2826 TextFont_GetEngrave
,
2827 TextFont_SetEngrave
,
2830 TextFont_GetKerning
,
2831 TextFont_SetKerning
,
2832 TextFont_GetLanguageID
,
2833 TextFont_SetLanguageID
,
2836 TextFont_GetOutline
,
2837 TextFont_SetOutline
,
2838 TextFont_GetPosition
,
2839 TextFont_SetPosition
,
2840 TextFont_GetProtected
,
2841 TextFont_SetProtected
,
2846 TextFont_GetSmallCaps
,
2847 TextFont_SetSmallCaps
,
2848 TextFont_GetSpacing
,
2849 TextFont_SetSpacing
,
2850 TextFont_GetStrikeThrough
,
2851 TextFont_SetStrikeThrough
,
2852 TextFont_GetSubscript
,
2853 TextFont_SetSubscript
,
2854 TextFont_GetSuperscript
,
2855 TextFont_SetSuperscript
,
2856 TextFont_GetUnderline
,
2857 TextFont_SetUnderline
,
2862 static HRESULT
create_textfont(ITextRange
*range
, const ITextFontImpl
*src
, ITextFont
**ret
)
2864 ITextFontImpl
*font
;
2867 font
= heap_alloc(sizeof(*font
));
2869 return E_OUTOFMEMORY
;
2871 font
->ITextFont_iface
.lpVtbl
= &textfontvtbl
;
2876 font
->get_cache_enabled
= TRUE
;
2877 font
->set_cache_enabled
= TRUE
;
2878 memcpy(&font
->props
, &src
->props
, sizeof(font
->props
));
2879 if (font
->props
[FONT_NAME
].str
)
2880 font
->props
[FONT_NAME
].str
= SysAllocString(font
->props
[FONT_NAME
].str
);
2883 font
->range
= range
;
2884 ITextRange_AddRef(range
);
2886 /* cache current properties */
2887 font
->get_cache_enabled
= FALSE
;
2888 font
->set_cache_enabled
= FALSE
;
2889 textfont_cache_range_props(font
);
2892 *ret
= &font
->ITextFont_iface
;
2897 static HRESULT WINAPI
TextPara_QueryInterface(ITextPara
*iface
, REFIID riid
, void **ppv
)
2899 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2901 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
2903 if (IsEqualIID(riid
, &IID_ITextPara
) ||
2904 IsEqualIID(riid
, &IID_IDispatch
) ||
2905 IsEqualIID(riid
, &IID_IUnknown
))
2908 ITextPara_AddRef(iface
);
2913 return E_NOINTERFACE
;
2916 static ULONG WINAPI
TextPara_AddRef(ITextPara
*iface
)
2918 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2919 ULONG ref
= InterlockedIncrement(&This
->ref
);
2920 TRACE("(%p)->(%u)\n", This
, ref
);
2924 static ULONG WINAPI
TextPara_Release(ITextPara
*iface
)
2926 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2927 ULONG ref
= InterlockedDecrement(&This
->ref
);
2929 TRACE("(%p)->(%u)\n", This
, ref
);
2933 ITextRange_Release(This
->range
);
2940 static HRESULT WINAPI
TextPara_GetTypeInfoCount(ITextPara
*iface
, UINT
*pctinfo
)
2942 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2943 TRACE("(%p)->(%p)\n", This
, pctinfo
);
2948 static HRESULT WINAPI
TextPara_GetTypeInfo(ITextPara
*iface
, UINT iTInfo
, LCID lcid
,
2949 ITypeInfo
**ppTInfo
)
2951 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2954 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
2956 hr
= get_typeinfo(ITextPara_tid
, ppTInfo
);
2958 ITypeInfo_AddRef(*ppTInfo
);
2962 static HRESULT WINAPI
TextPara_GetIDsOfNames(ITextPara
*iface
, REFIID riid
,
2963 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
2965 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2969 TRACE("(%p)->(%p,%p,%u,%d,%p)\n", This
, riid
, rgszNames
, cNames
, lcid
,
2972 hr
= get_typeinfo(ITextPara_tid
, &ti
);
2974 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
2978 static HRESULT WINAPI
TextPara_Invoke(
2980 DISPID dispIdMember
,
2984 DISPPARAMS
*pDispParams
,
2985 VARIANT
*pVarResult
,
2986 EXCEPINFO
*pExcepInfo
,
2989 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
2993 TRACE("(%p)->(%d,%p,%d,%u,%p,%p,%p,%p)\n", This
, dispIdMember
, riid
, lcid
,
2994 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2996 hr
= get_typeinfo(ITextPara_tid
, &ti
);
2998 hr
= ITypeInfo_Invoke(ti
, iface
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3002 static HRESULT WINAPI
TextPara_GetDuplicate(ITextPara
*iface
, ITextPara
**ret
)
3004 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3005 FIXME("(%p)->(%p)\n", This
, ret
);
3009 static HRESULT WINAPI
TextPara_SetDuplicate(ITextPara
*iface
, ITextPara
*para
)
3011 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3012 FIXME("(%p)->(%p)\n", This
, para
);
3016 static HRESULT WINAPI
TextPara_CanChange(ITextPara
*iface
, LONG
*ret
)
3018 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3019 FIXME("(%p)->(%p)\n", This
, ret
);
3023 static HRESULT WINAPI
TextPara_IsEqual(ITextPara
*iface
, ITextPara
*para
, LONG
*ret
)
3025 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3026 FIXME("(%p)->(%p %p)\n", This
, para
, ret
);
3030 static HRESULT WINAPI
TextPara_Reset(ITextPara
*iface
, LONG value
)
3032 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3033 FIXME("(%p)->(%d)\n", This
, value
);
3037 static HRESULT WINAPI
TextPara_GetStyle(ITextPara
*iface
, LONG
*value
)
3039 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3040 FIXME("(%p)->(%p)\n", This
, value
);
3044 static HRESULT WINAPI
TextPara_SetStyle(ITextPara
*iface
, LONG value
)
3046 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3047 FIXME("(%p)->(%d)\n", This
, value
);
3051 static HRESULT WINAPI
TextPara_GetAlignment(ITextPara
*iface
, LONG
*value
)
3053 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3054 FIXME("(%p)->(%p)\n", This
, value
);
3058 static HRESULT WINAPI
TextPara_SetAlignment(ITextPara
*iface
, LONG value
)
3060 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3061 FIXME("(%p)->(%d)\n", This
, value
);
3065 static HRESULT WINAPI
TextPara_GetHyphenation(ITextPara
*iface
, LONG
*value
)
3067 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3068 FIXME("(%p)->(%p)\n", This
, value
);
3072 static HRESULT WINAPI
TextPara_SetHyphenation(ITextPara
*iface
, LONG value
)
3074 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3075 FIXME("(%p)->(%d)\n", This
, value
);
3079 static HRESULT WINAPI
TextPara_GetFirstLineIndent(ITextPara
*iface
, FLOAT
*value
)
3081 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3082 FIXME("(%p)->(%p)\n", This
, value
);
3086 static HRESULT WINAPI
TextPara_GetKeepTogether(ITextPara
*iface
, LONG
*value
)
3088 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3089 FIXME("(%p)->(%p)\n", This
, value
);
3093 static HRESULT WINAPI
TextPara_SetKeepTogether(ITextPara
*iface
, LONG value
)
3095 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3096 FIXME("(%p)->(%d)\n", This
, value
);
3100 static HRESULT WINAPI
TextPara_GetKeepWithNext(ITextPara
*iface
, LONG
*value
)
3102 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3103 FIXME("(%p)->(%p)\n", This
, value
);
3107 static HRESULT WINAPI
TextPara_SetKeepWithNext(ITextPara
*iface
, LONG value
)
3109 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3110 FIXME("(%p)->(%d)\n", This
, value
);
3114 static HRESULT WINAPI
TextPara_GetLeftIndent(ITextPara
*iface
, FLOAT
*value
)
3116 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3117 FIXME("(%p)->(%p)\n", This
, value
);
3121 static HRESULT WINAPI
TextPara_GetLineSpacing(ITextPara
*iface
, FLOAT
*value
)
3123 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3124 FIXME("(%p)->(%p)\n", This
, value
);
3128 static HRESULT WINAPI
TextPara_GetLineSpacingRule(ITextPara
*iface
, LONG
*value
)
3130 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3131 FIXME("(%p)->(%p)\n", This
, value
);
3135 static HRESULT WINAPI
TextPara_GetListAlignment(ITextPara
*iface
, LONG
*value
)
3137 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3138 FIXME("(%p)->(%p)\n", This
, value
);
3142 static HRESULT WINAPI
TextPara_SetListAlignment(ITextPara
*iface
, LONG value
)
3144 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3145 FIXME("(%p)->(%d)\n", This
, value
);
3149 static HRESULT WINAPI
TextPara_GetListLevelIndex(ITextPara
*iface
, LONG
*value
)
3151 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3152 FIXME("(%p)->(%p)\n", This
, value
);
3156 static HRESULT WINAPI
TextPara_SetListLevelIndex(ITextPara
*iface
, LONG value
)
3158 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3159 FIXME("(%p)->(%d)\n", This
, value
);
3163 static HRESULT WINAPI
TextPara_GetListStart(ITextPara
*iface
, LONG
*value
)
3165 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3166 FIXME("(%p)->(%p)\n", This
, value
);
3170 static HRESULT WINAPI
TextPara_SetListStart(ITextPara
*iface
, LONG value
)
3172 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3173 FIXME("(%p)->(%d)\n", This
, value
);
3177 static HRESULT WINAPI
TextPara_GetListTab(ITextPara
*iface
, FLOAT
*value
)
3179 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3180 FIXME("(%p)->(%p)\n", This
, value
);
3184 static HRESULT WINAPI
TextPara_SetListTab(ITextPara
*iface
, FLOAT value
)
3186 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3187 FIXME("(%p)->(%.2f)\n", This
, value
);
3191 static HRESULT WINAPI
TextPara_GetListType(ITextPara
*iface
, LONG
*value
)
3193 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3194 FIXME("(%p)->(%p)\n", This
, value
);
3198 static HRESULT WINAPI
TextPara_SetListType(ITextPara
*iface
, LONG value
)
3200 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3201 FIXME("(%p)->(%d)\n", This
, value
);
3205 static HRESULT WINAPI
TextPara_GetNoLineNumber(ITextPara
*iface
, LONG
*value
)
3207 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3208 FIXME("(%p)->(%p)\n", This
, value
);
3212 static HRESULT WINAPI
TextPara_SetNoLineNumber(ITextPara
*iface
, LONG value
)
3214 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3215 FIXME("(%p)->(%d)\n", This
, value
);
3219 static HRESULT WINAPI
TextPara_GetPageBreakBefore(ITextPara
*iface
, LONG
*value
)
3221 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3222 FIXME("(%p)->(%p)\n", This
, value
);
3226 static HRESULT WINAPI
TextPara_SetPageBreakBefore(ITextPara
*iface
, LONG value
)
3228 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3229 FIXME("(%p)->(%d)\n", This
, value
);
3233 static HRESULT WINAPI
TextPara_GetRightIndent(ITextPara
*iface
, FLOAT
*value
)
3235 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3236 FIXME("(%p)->(%p)\n", This
, value
);
3240 static HRESULT WINAPI
TextPara_SetRightIndent(ITextPara
*iface
, FLOAT value
)
3242 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3243 FIXME("(%p)->(%.2f)\n", This
, value
);
3247 static HRESULT WINAPI
TextPara_SetIndents(ITextPara
*iface
, FLOAT StartIndent
, FLOAT LeftIndent
, FLOAT RightIndent
)
3249 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3250 FIXME("(%p)->(%.2f %.2f %.2f)\n", This
, StartIndent
, LeftIndent
, RightIndent
);
3254 static HRESULT WINAPI
TextPara_SetLineSpacing(ITextPara
*iface
, LONG LineSpacingRule
, FLOAT LineSpacing
)
3256 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3257 FIXME("(%p)->(%d %.2f)\n", This
, LineSpacingRule
, LineSpacing
);
3261 static HRESULT WINAPI
TextPara_GetSpaceAfter(ITextPara
*iface
, FLOAT
*value
)
3263 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3264 FIXME("(%p)->(%p)\n", This
, value
);
3268 static HRESULT WINAPI
TextPara_SetSpaceAfter(ITextPara
*iface
, FLOAT value
)
3270 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3271 FIXME("(%p)->(%.2f)\n", This
, value
);
3275 static HRESULT WINAPI
TextPara_GetSpaceBefore(ITextPara
*iface
, FLOAT
*value
)
3277 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3278 FIXME("(%p)->(%p)\n", This
, value
);
3282 static HRESULT WINAPI
TextPara_SetSpaceBefore(ITextPara
*iface
, FLOAT value
)
3284 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3285 FIXME("(%p)->(%.2f)\n", This
, value
);
3289 static HRESULT WINAPI
TextPara_GetWidowControl(ITextPara
*iface
, LONG
*value
)
3291 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3292 FIXME("(%p)->(%p)\n", This
, value
);
3296 static HRESULT WINAPI
TextPara_SetWidowControl(ITextPara
*iface
, LONG value
)
3298 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3299 FIXME("(%p)->(%d)\n", This
, value
);
3303 static HRESULT WINAPI
TextPara_GetTabCount(ITextPara
*iface
, LONG
*value
)
3305 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3306 FIXME("(%p)->(%p)\n", This
, value
);
3310 static HRESULT WINAPI
TextPara_AddTab(ITextPara
*iface
, FLOAT tbPos
, LONG tbAlign
, LONG tbLeader
)
3312 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3313 FIXME("(%p)->(%.2f %d %d)\n", This
, tbPos
, tbAlign
, tbLeader
);
3317 static HRESULT WINAPI
TextPara_ClearAllTabs(ITextPara
*iface
)
3319 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3320 FIXME("(%p)\n", This
);
3324 static HRESULT WINAPI
TextPara_DeleteTab(ITextPara
*iface
, FLOAT pos
)
3326 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3327 FIXME("(%p)->(%.2f)\n", This
, pos
);
3331 static HRESULT WINAPI
TextPara_GetTab(ITextPara
*iface
, LONG iTab
, FLOAT
*ptbPos
, LONG
*ptbAlign
, LONG
*ptbLeader
)
3333 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3334 FIXME("(%p)->(%d %p %p %p)\n", This
, iTab
, ptbPos
, ptbAlign
, ptbLeader
);
3338 static ITextParaVtbl textparavtbl
= {
3339 TextPara_QueryInterface
,
3342 TextPara_GetTypeInfoCount
,
3343 TextPara_GetTypeInfo
,
3344 TextPara_GetIDsOfNames
,
3346 TextPara_GetDuplicate
,
3347 TextPara_SetDuplicate
,
3353 TextPara_GetAlignment
,
3354 TextPara_SetAlignment
,
3355 TextPara_GetHyphenation
,
3356 TextPara_SetHyphenation
,
3357 TextPara_GetFirstLineIndent
,
3358 TextPara_GetKeepTogether
,
3359 TextPara_SetKeepTogether
,
3360 TextPara_GetKeepWithNext
,
3361 TextPara_SetKeepWithNext
,
3362 TextPara_GetLeftIndent
,
3363 TextPara_GetLineSpacing
,
3364 TextPara_GetLineSpacingRule
,
3365 TextPara_GetListAlignment
,
3366 TextPara_SetListAlignment
,
3367 TextPara_GetListLevelIndex
,
3368 TextPara_SetListLevelIndex
,
3369 TextPara_GetListStart
,
3370 TextPara_SetListStart
,
3371 TextPara_GetListTab
,
3372 TextPara_SetListTab
,
3373 TextPara_GetListType
,
3374 TextPara_SetListType
,
3375 TextPara_GetNoLineNumber
,
3376 TextPara_SetNoLineNumber
,
3377 TextPara_GetPageBreakBefore
,
3378 TextPara_SetPageBreakBefore
,
3379 TextPara_GetRightIndent
,
3380 TextPara_SetRightIndent
,
3381 TextPara_SetIndents
,
3382 TextPara_SetLineSpacing
,
3383 TextPara_GetSpaceAfter
,
3384 TextPara_SetSpaceAfter
,
3385 TextPara_GetSpaceBefore
,
3386 TextPara_SetSpaceBefore
,
3387 TextPara_GetWidowControl
,
3388 TextPara_SetWidowControl
,
3389 TextPara_GetTabCount
,
3391 TextPara_ClearAllTabs
,
3396 static HRESULT
create_textpara(ITextRange
*range
, ITextPara
**ret
)
3398 ITextParaImpl
*para
;
3401 para
= heap_alloc(sizeof(*para
));
3403 return E_OUTOFMEMORY
;
3405 para
->ITextPara_iface
.lpVtbl
= &textparavtbl
;
3407 para
->range
= range
;
3408 ITextRange_AddRef(range
);
3410 *ret
= ¶
->ITextPara_iface
;
3415 static HRESULT WINAPI
3416 ITextDocument_fnQueryInterface(ITextDocument
* me
, REFIID riid
,
3419 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3420 return IRichEditOle_QueryInterface(&This
->IRichEditOle_iface
, riid
, ppvObject
);
3424 ITextDocument_fnAddRef(ITextDocument
* me
)
3426 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3427 return IRichEditOle_AddRef(&This
->IRichEditOle_iface
);
3431 ITextDocument_fnRelease(ITextDocument
* me
)
3433 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3434 return IRichEditOle_Release(&This
->IRichEditOle_iface
);
3437 static HRESULT WINAPI
3438 ITextDocument_fnGetTypeInfoCount(ITextDocument
* me
,
3441 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3442 TRACE("(%p)->(%p)\n", This
, pctinfo
);
3447 static HRESULT WINAPI
3448 ITextDocument_fnGetTypeInfo(ITextDocument
* me
, UINT iTInfo
, LCID lcid
,
3449 ITypeInfo
** ppTInfo
)
3451 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3454 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
3456 hr
= get_typeinfo(ITextDocument_tid
, ppTInfo
);
3458 ITypeInfo_AddRef(*ppTInfo
);
3462 static HRESULT WINAPI
3463 ITextDocument_fnGetIDsOfNames(ITextDocument
* me
, REFIID riid
,
3464 LPOLESTR
* rgszNames
, UINT cNames
, LCID lcid
, DISPID
* rgDispId
)
3466 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3470 TRACE("(%p)->(%p,%p,%u,%d,%p)\n", This
, riid
, rgszNames
, cNames
, lcid
,
3473 hr
= get_typeinfo(ITextDocument_tid
, &ti
);
3475 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
3479 static HRESULT WINAPI
3480 ITextDocument_fnInvoke(ITextDocument
* me
, DISPID dispIdMember
,
3481 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
* pDispParams
,
3482 VARIANT
* pVarResult
, EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
)
3484 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3488 TRACE("(%p)->(%d,%p,%d,%u,%p,%p,%p,%p)\n", This
, dispIdMember
, riid
, lcid
,
3489 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3491 hr
= get_typeinfo(ITextDocument_tid
, &ti
);
3493 hr
= ITypeInfo_Invoke(ti
, me
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3497 static HRESULT WINAPI
3498 ITextDocument_fnGetName(ITextDocument
* me
, BSTR
* pName
)
3500 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3501 FIXME("stub %p\n",This
);
3505 static HRESULT WINAPI
3506 ITextDocument_fnGetSelection(ITextDocument
* me
, ITextSelection
** ppSel
)
3508 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3509 TRACE("(%p)\n", me
);
3512 return E_INVALIDARG
;
3513 *ppSel
= &This
->txtSel
->ITextSelection_iface
;
3514 ITextSelection_AddRef(*ppSel
);
3518 static HRESULT WINAPI
3519 ITextDocument_fnGetStoryCount(ITextDocument
* me
, LONG
* pCount
)
3521 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3522 FIXME("stub %p\n",This
);
3526 static HRESULT WINAPI
3527 ITextDocument_fnGetStoryRanges(ITextDocument
* me
,
3528 ITextStoryRanges
** ppStories
)
3530 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3531 FIXME("stub %p\n",This
);
3535 static HRESULT WINAPI
3536 ITextDocument_fnGetSaved(ITextDocument
* me
, LONG
* pValue
)
3538 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3539 FIXME("stub %p\n",This
);
3543 static HRESULT WINAPI
3544 ITextDocument_fnSetSaved(ITextDocument
* me
, LONG Value
)
3546 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3547 FIXME("stub %p\n",This
);
3551 static HRESULT WINAPI
3552 ITextDocument_fnGetDefaultTabStop(ITextDocument
* me
, float* pValue
)
3554 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3555 FIXME("stub %p\n",This
);
3559 static HRESULT WINAPI
3560 ITextDocument_fnSetDefaultTabStop(ITextDocument
* me
, float Value
)
3562 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3563 FIXME("stub %p\n",This
);
3567 static HRESULT WINAPI
3568 ITextDocument_fnNew(ITextDocument
* me
)
3570 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3571 FIXME("stub %p\n",This
);
3575 static HRESULT WINAPI
3576 ITextDocument_fnOpen(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
3579 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3580 FIXME("stub %p\n",This
);
3584 static HRESULT WINAPI
3585 ITextDocument_fnSave(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
3588 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3589 FIXME("stub %p\n",This
);
3593 static HRESULT WINAPI
3594 ITextDocument_fnFreeze(ITextDocument
* me
, LONG
* pCount
)
3596 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3597 FIXME("stub %p\n",This
);
3601 static HRESULT WINAPI
3602 ITextDocument_fnUnfreeze(ITextDocument
* me
, LONG
* pCount
)
3604 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3605 FIXME("stub %p\n",This
);
3609 static HRESULT WINAPI
3610 ITextDocument_fnBeginEditCollection(ITextDocument
* me
)
3612 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3613 FIXME("stub %p\n",This
);
3617 static HRESULT WINAPI
3618 ITextDocument_fnEndEditCollection(ITextDocument
* me
)
3620 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3621 FIXME("stub %p\n",This
);
3625 static HRESULT WINAPI
3626 ITextDocument_fnUndo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
3628 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3629 FIXME("stub %p\n",This
);
3633 static HRESULT WINAPI
3634 ITextDocument_fnRedo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
3636 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3637 FIXME("stub %p\n",This
);
3641 static HRESULT
CreateITextRange(IRichEditOleImpl
*reOle
, LONG start
, LONG end
, ITextRange
** ppRange
)
3643 ITextRangeImpl
*txtRge
= heap_alloc(sizeof(ITextRangeImpl
));
3646 return E_OUTOFMEMORY
;
3647 txtRge
->ITextRange_iface
.lpVtbl
= &trvt
;
3649 txtRge
->reOle
= reOle
;
3650 txtRge
->start
= start
;
3652 list_add_head(&reOle
->rangelist
, &txtRge
->entry
);
3653 *ppRange
= &txtRge
->ITextRange_iface
;
3657 static HRESULT WINAPI
3658 ITextDocument_fnRange(ITextDocument
* me
, LONG cp1
, LONG cp2
,
3659 ITextRange
** ppRange
)
3661 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3662 const int len
= ME_GetTextLength(This
->editor
) + 1;
3664 TRACE("%p %p %d %d\n", This
, ppRange
, cp1
, cp2
);
3666 return E_INVALIDARG
;
3670 cp1
= min(cp1
, len
);
3671 cp2
= min(cp2
, len
);
3680 cp1
= cp2
= len
- 1;
3682 return CreateITextRange(This
, cp1
, cp2
, ppRange
);
3685 static HRESULT WINAPI
3686 ITextDocument_fnRangeFromPoint(ITextDocument
* me
, LONG x
, LONG y
,
3687 ITextRange
** ppRange
)
3689 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3690 FIXME("stub %p\n",This
);
3694 static const ITextDocumentVtbl tdvt
= {
3695 ITextDocument_fnQueryInterface
,
3696 ITextDocument_fnAddRef
,
3697 ITextDocument_fnRelease
,
3698 ITextDocument_fnGetTypeInfoCount
,
3699 ITextDocument_fnGetTypeInfo
,
3700 ITextDocument_fnGetIDsOfNames
,
3701 ITextDocument_fnInvoke
,
3702 ITextDocument_fnGetName
,
3703 ITextDocument_fnGetSelection
,
3704 ITextDocument_fnGetStoryCount
,
3705 ITextDocument_fnGetStoryRanges
,
3706 ITextDocument_fnGetSaved
,
3707 ITextDocument_fnSetSaved
,
3708 ITextDocument_fnGetDefaultTabStop
,
3709 ITextDocument_fnSetDefaultTabStop
,
3710 ITextDocument_fnNew
,
3711 ITextDocument_fnOpen
,
3712 ITextDocument_fnSave
,
3713 ITextDocument_fnFreeze
,
3714 ITextDocument_fnUnfreeze
,
3715 ITextDocument_fnBeginEditCollection
,
3716 ITextDocument_fnEndEditCollection
,
3717 ITextDocument_fnUndo
,
3718 ITextDocument_fnRedo
,
3719 ITextDocument_fnRange
,
3720 ITextDocument_fnRangeFromPoint
3723 /* ITextSelection */
3724 static HRESULT WINAPI
ITextSelection_fnQueryInterface(
3729 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3732 if (IsEqualGUID(riid
, &IID_IUnknown
)
3733 || IsEqualGUID(riid
, &IID_IDispatch
)
3734 || IsEqualGUID(riid
, &IID_ITextRange
)
3735 || IsEqualGUID(riid
, &IID_ITextSelection
))
3738 ITextSelection_AddRef(me
);
3741 else if (IsEqualGUID(riid
, &IID_Igetrichole
))
3743 *ppvObj
= This
->reOle
;
3747 return E_NOINTERFACE
;
3750 static ULONG WINAPI
ITextSelection_fnAddRef(ITextSelection
*me
)
3752 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3753 return InterlockedIncrement(&This
->ref
);
3756 static ULONG WINAPI
ITextSelection_fnRelease(ITextSelection
*me
)
3758 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3759 ULONG ref
= InterlockedDecrement(&This
->ref
);
3765 static HRESULT WINAPI
ITextSelection_fnGetTypeInfoCount(ITextSelection
*me
, UINT
*pctinfo
)
3767 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3768 TRACE("(%p)->(%p)\n", This
, pctinfo
);
3773 static HRESULT WINAPI
ITextSelection_fnGetTypeInfo(ITextSelection
*me
, UINT iTInfo
, LCID lcid
,
3774 ITypeInfo
**ppTInfo
)
3776 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3779 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
3781 hr
= get_typeinfo(ITextSelection_tid
, ppTInfo
);
3783 ITypeInfo_AddRef(*ppTInfo
);
3787 static HRESULT WINAPI
ITextSelection_fnGetIDsOfNames(ITextSelection
*me
, REFIID riid
,
3788 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3790 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3794 TRACE("(%p)->(%p,%p,%u,%d,%p)\n", This
, riid
, rgszNames
, cNames
, lcid
,
3797 hr
= get_typeinfo(ITextSelection_tid
, &ti
);
3799 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
3803 static HRESULT WINAPI
ITextSelection_fnInvoke(
3805 DISPID dispIdMember
,
3809 DISPPARAMS
*pDispParams
,
3810 VARIANT
*pVarResult
,
3811 EXCEPINFO
*pExcepInfo
,
3814 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3818 TRACE("(%p)->(%d,%p,%d,%u,%p,%p,%p,%p)\n", This
, dispIdMember
, riid
, lcid
,
3819 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3821 hr
= get_typeinfo(ITextSelection_tid
, &ti
);
3823 hr
= ITypeInfo_Invoke(ti
, me
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3827 /*** ITextRange methods ***/
3828 static HRESULT WINAPI
ITextSelection_fnGetText(ITextSelection
*me
, BSTR
*pbstr
)
3830 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3831 ME_Cursor
*start
= NULL
, *end
= NULL
;
3835 TRACE("(%p)->(%p)\n", This
, pbstr
);
3838 return CO_E_RELEASED
;
3841 return E_INVALIDARG
;
3843 ME_GetSelection(This
->reOle
->editor
, &start
, &end
);
3844 endOfs
= ME_GetCursorOfs(end
);
3845 nChars
= endOfs
- ME_GetCursorOfs(start
);
3852 *pbstr
= SysAllocStringLen(NULL
, nChars
);
3854 return E_OUTOFMEMORY
;
3856 bEOP
= (end
->pRun
->next
->type
== diTextEnd
&& endOfs
> ME_GetTextLength(This
->reOle
->editor
));
3857 ME_GetTextW(This
->reOle
->editor
, *pbstr
, nChars
, start
, nChars
, FALSE
, bEOP
);
3858 TRACE("%s\n", wine_dbgstr_w(*pbstr
));
3863 static HRESULT WINAPI
ITextSelection_fnSetText(ITextSelection
*me
, BSTR bstr
)
3865 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3867 return CO_E_RELEASED
;
3869 FIXME("not implemented\n");
3873 static HRESULT WINAPI
ITextSelection_fnGetChar(ITextSelection
*me
, LONG
*pch
)
3875 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3876 ME_Cursor
*start
= NULL
, *end
= NULL
;
3879 return CO_E_RELEASED
;
3882 return E_INVALIDARG
;
3884 ME_GetSelection(This
->reOle
->editor
, &start
, &end
);
3885 return range_GetChar(This
->reOle
->editor
, start
, pch
);
3888 static HRESULT WINAPI
ITextSelection_fnSetChar(ITextSelection
*me
, LONG ch
)
3890 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3892 return CO_E_RELEASED
;
3894 FIXME("not implemented\n");
3898 static HRESULT WINAPI
ITextSelection_fnGetDuplicate(ITextSelection
*me
, ITextRange
**ppRange
)
3900 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3902 return CO_E_RELEASED
;
3904 FIXME("not implemented\n");
3908 static HRESULT WINAPI
ITextSelection_fnGetFormattedText(ITextSelection
*me
, ITextRange
**ppRange
)
3910 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3912 return CO_E_RELEASED
;
3914 FIXME("not implemented\n");
3918 static HRESULT WINAPI
ITextSelection_fnSetFormattedText(ITextSelection
*me
, ITextRange
*pRange
)
3920 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3922 return CO_E_RELEASED
;
3924 FIXME("not implemented\n");
3928 static HRESULT WINAPI
ITextSelection_fnGetStart(ITextSelection
*me
, LONG
*pcpFirst
)
3930 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3933 return CO_E_RELEASED
;
3936 return E_INVALIDARG
;
3937 ME_GetSelectionOfs(This
->reOle
->editor
, pcpFirst
, &lim
);
3938 TRACE("%d\n", *pcpFirst
);
3942 static HRESULT WINAPI
ITextSelection_fnSetStart(ITextSelection
*me
, LONG value
)
3944 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3948 TRACE("(%p)->(%d)\n", This
, value
);
3951 return CO_E_RELEASED
;
3953 ME_GetSelectionOfs(This
->reOle
->editor
, &start
, &end
);
3954 hr
= textrange_setstart(This
->reOle
, value
, &start
, &end
);
3956 ME_SetSelection(This
->reOle
->editor
, start
, end
);
3961 static HRESULT WINAPI
ITextSelection_fnGetEnd(ITextSelection
*me
, LONG
*pcpLim
)
3963 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3966 return CO_E_RELEASED
;
3969 return E_INVALIDARG
;
3970 ME_GetSelectionOfs(This
->reOle
->editor
, &first
, pcpLim
);
3971 TRACE("%d\n", *pcpLim
);
3975 static HRESULT WINAPI
ITextSelection_fnSetEnd(ITextSelection
*me
, LONG value
)
3977 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3981 TRACE("(%p)->(%d)\n", This
, value
);
3984 return CO_E_RELEASED
;
3986 ME_GetSelectionOfs(This
->reOle
->editor
, &start
, &end
);
3987 hr
= textrange_setend(This
->reOle
, value
, &start
, &end
);
3989 ME_SetSelection(This
->reOle
->editor
, start
, end
);
3994 static HRESULT WINAPI
ITextSelection_fnGetFont(ITextSelection
*me
, ITextFont
**font
)
3996 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
3998 TRACE("(%p)->(%p)\n", This
, font
);
4001 return CO_E_RELEASED
;
4004 return E_INVALIDARG
;
4006 return create_textfont((ITextRange
*)me
, NULL
, font
);
4009 static HRESULT WINAPI
ITextSelection_fnSetFont(ITextSelection
*me
, ITextFont
*pFont
)
4011 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4013 return CO_E_RELEASED
;
4015 FIXME("not implemented\n");
4019 static HRESULT WINAPI
ITextSelection_fnGetPara(ITextSelection
*me
, ITextPara
**para
)
4021 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4023 return CO_E_RELEASED
;
4025 FIXME("not implemented\n");
4029 static HRESULT WINAPI
ITextSelection_fnSetPara(ITextSelection
*me
, ITextPara
*pPara
)
4031 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4033 return CO_E_RELEASED
;
4035 FIXME("not implemented\n");
4039 static HRESULT WINAPI
ITextSelection_fnGetStoryLength(ITextSelection
*me
, LONG
*pcch
)
4041 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4043 return CO_E_RELEASED
;
4045 FIXME("not implemented\n");
4049 static HRESULT WINAPI
ITextSelection_fnGetStoryType(ITextSelection
*me
, LONG
*pValue
)
4051 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4053 return CO_E_RELEASED
;
4055 FIXME("not implemented\n");
4059 static HRESULT WINAPI
ITextSelection_fnCollapse(ITextSelection
*me
, LONG bStart
)
4061 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4065 return CO_E_RELEASED
;
4067 ME_GetSelectionOfs(This
->reOle
->editor
, &start
, &end
);
4068 hres
= range_Collapse(bStart
, &start
, &end
);
4069 if (SUCCEEDED(hres
))
4070 ME_SetSelection(This
->reOle
->editor
, start
, end
);
4074 static HRESULT WINAPI
ITextSelection_fnExpand(ITextSelection
*me
, LONG Unit
, LONG
*pDelta
)
4076 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4078 return CO_E_RELEASED
;
4080 FIXME("not implemented\n");
4084 static HRESULT WINAPI
ITextSelection_fnGetIndex(ITextSelection
*me
, LONG Unit
, LONG
*pIndex
)
4086 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4088 return CO_E_RELEASED
;
4090 FIXME("not implemented\n");
4094 static HRESULT WINAPI
ITextSelection_fnSetIndex(ITextSelection
*me
, LONG Unit
, LONG Index
,
4097 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4099 return CO_E_RELEASED
;
4101 FIXME("not implemented\n");
4105 static HRESULT WINAPI
ITextSelection_fnSetRange(ITextSelection
*me
, LONG cpActive
, LONG cpOther
)
4107 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4109 return CO_E_RELEASED
;
4111 FIXME("not implemented\n");
4115 static HRESULT WINAPI
ITextSelection_fnInRange(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
4117 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4119 return CO_E_RELEASED
;
4121 FIXME("not implemented\n");
4125 static HRESULT WINAPI
ITextSelection_fnInStory(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
4127 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4129 return CO_E_RELEASED
;
4131 FIXME("not implemented\n");
4135 static HRESULT WINAPI
ITextSelection_fnIsEqual(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
4137 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4139 return CO_E_RELEASED
;
4141 FIXME("not implemented\n");
4145 static HRESULT WINAPI
ITextSelection_fnSelect(ITextSelection
*me
)
4147 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4149 return CO_E_RELEASED
;
4151 FIXME("not implemented\n");
4155 static HRESULT WINAPI
ITextSelection_fnStartOf(ITextSelection
*me
, LONG Unit
, LONG Extend
,
4158 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4160 return CO_E_RELEASED
;
4162 FIXME("not implemented\n");
4166 static HRESULT WINAPI
ITextSelection_fnEndOf(ITextSelection
*me
, LONG Unit
, LONG Extend
,
4169 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4171 return CO_E_RELEASED
;
4173 FIXME("not implemented\n");
4177 static HRESULT WINAPI
ITextSelection_fnMove(ITextSelection
*me
, LONG Unit
, LONG Count
, LONG
*pDelta
)
4179 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4181 return CO_E_RELEASED
;
4183 FIXME("not implemented\n");
4187 static HRESULT WINAPI
ITextSelection_fnMoveStart(ITextSelection
*me
, LONG Unit
, LONG Count
,
4190 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4192 return CO_E_RELEASED
;
4194 FIXME("not implemented\n");
4198 static HRESULT WINAPI
ITextSelection_fnMoveEnd(ITextSelection
*me
, LONG Unit
, LONG Count
,
4201 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4203 return CO_E_RELEASED
;
4205 FIXME("not implemented\n");
4209 static HRESULT WINAPI
ITextSelection_fnMoveWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
4212 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4214 return CO_E_RELEASED
;
4216 FIXME("not implemented\n");
4220 static HRESULT WINAPI
ITextSelection_fnMoveStartWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
4223 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4225 return CO_E_RELEASED
;
4227 FIXME("not implemented\n");
4231 static HRESULT WINAPI
ITextSelection_fnMoveEndWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
4234 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4236 return CO_E_RELEASED
;
4238 FIXME("not implemented\n");
4242 static HRESULT WINAPI
ITextSelection_fnMoveUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
4245 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4247 return CO_E_RELEASED
;
4249 FIXME("not implemented\n");
4253 static HRESULT WINAPI
ITextSelection_fnMoveStartUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
4256 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4258 return CO_E_RELEASED
;
4260 FIXME("not implemented\n");
4264 static HRESULT WINAPI
ITextSelection_fnMoveEndUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
4267 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4269 return CO_E_RELEASED
;
4271 FIXME("not implemented\n");
4275 static HRESULT WINAPI
ITextSelection_fnFindText(ITextSelection
*me
, BSTR bstr
, LONG cch
, LONG Flags
,
4278 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4280 return CO_E_RELEASED
;
4282 FIXME("not implemented\n");
4286 static HRESULT WINAPI
ITextSelection_fnFindTextStart(ITextSelection
*me
, BSTR bstr
, LONG cch
,
4287 LONG Flags
, LONG
*pLength
)
4289 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4291 return CO_E_RELEASED
;
4293 FIXME("not implemented\n");
4297 static HRESULT WINAPI
ITextSelection_fnFindTextEnd(ITextSelection
*me
, BSTR bstr
, LONG cch
,
4298 LONG Flags
, LONG
*pLength
)
4300 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4302 return CO_E_RELEASED
;
4304 FIXME("not implemented\n");
4308 static HRESULT WINAPI
ITextSelection_fnDelete(ITextSelection
*me
, LONG Unit
, LONG Count
,
4311 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4313 return CO_E_RELEASED
;
4315 FIXME("not implemented\n");
4319 static HRESULT WINAPI
ITextSelection_fnCut(ITextSelection
*me
, VARIANT
*pVar
)
4321 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4323 return CO_E_RELEASED
;
4325 FIXME("not implemented\n");
4329 static HRESULT WINAPI
ITextSelection_fnCopy(ITextSelection
*me
, VARIANT
*pVar
)
4331 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4333 return CO_E_RELEASED
;
4335 FIXME("not implemented\n");
4339 static HRESULT WINAPI
ITextSelection_fnPaste(ITextSelection
*me
, VARIANT
*pVar
, LONG Format
)
4341 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4343 return CO_E_RELEASED
;
4345 FIXME("not implemented\n");
4349 static HRESULT WINAPI
ITextSelection_fnCanPaste(ITextSelection
*me
, VARIANT
*pVar
, LONG Format
,
4352 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4354 return CO_E_RELEASED
;
4356 FIXME("not implemented\n");
4360 static HRESULT WINAPI
ITextSelection_fnCanEdit(ITextSelection
*me
, LONG
*pb
)
4362 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4364 return CO_E_RELEASED
;
4366 FIXME("not implemented\n");
4370 static HRESULT WINAPI
ITextSelection_fnChangeCase(ITextSelection
*me
, LONG Type
)
4372 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4374 return CO_E_RELEASED
;
4376 FIXME("not implemented\n");
4380 static HRESULT WINAPI
ITextSelection_fnGetPoint(ITextSelection
*me
, LONG Type
, LONG
*cx
, LONG
*cy
)
4382 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4384 return CO_E_RELEASED
;
4386 FIXME("not implemented\n");
4390 static HRESULT WINAPI
ITextSelection_fnSetPoint(ITextSelection
*me
, LONG x
, LONG y
, LONG Type
,
4393 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4395 return CO_E_RELEASED
;
4397 FIXME("not implemented\n");
4401 static HRESULT WINAPI
ITextSelection_fnScrollIntoView(ITextSelection
*me
, LONG Value
)
4403 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4405 return CO_E_RELEASED
;
4407 FIXME("not implemented\n");
4411 static HRESULT WINAPI
ITextSelection_fnGetEmbeddedObject(ITextSelection
*me
, IUnknown
**ppv
)
4413 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4415 return CO_E_RELEASED
;
4417 FIXME("not implemented\n");
4421 /*** ITextSelection methods ***/
4422 static HRESULT WINAPI
ITextSelection_fnGetFlags(ITextSelection
*me
, LONG
*pFlags
)
4424 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4426 return CO_E_RELEASED
;
4428 FIXME("not implemented\n");
4432 static HRESULT WINAPI
ITextSelection_fnSetFlags(ITextSelection
*me
, LONG Flags
)
4434 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4436 return CO_E_RELEASED
;
4438 FIXME("not implemented\n");
4442 static HRESULT WINAPI
ITextSelection_fnGetType(ITextSelection
*me
, LONG
*pType
)
4444 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4446 return CO_E_RELEASED
;
4448 FIXME("not implemented\n");
4452 static HRESULT WINAPI
ITextSelection_fnMoveLeft(ITextSelection
*me
, LONG Unit
, LONG Count
,
4453 LONG Extend
, LONG
*pDelta
)
4455 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4457 return CO_E_RELEASED
;
4459 FIXME("not implemented\n");
4463 static HRESULT WINAPI
ITextSelection_fnMoveRight(ITextSelection
*me
, LONG Unit
, LONG Count
,
4464 LONG Extend
, LONG
*pDelta
)
4466 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4468 return CO_E_RELEASED
;
4470 FIXME("not implemented\n");
4474 static HRESULT WINAPI
ITextSelection_fnMoveUp(ITextSelection
*me
, LONG Unit
, LONG Count
,
4475 LONG Extend
, LONG
*pDelta
)
4477 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4479 return CO_E_RELEASED
;
4481 FIXME("not implemented\n");
4485 static HRESULT WINAPI
ITextSelection_fnMoveDown(ITextSelection
*me
, LONG Unit
, LONG Count
,
4486 LONG Extend
, LONG
*pDelta
)
4488 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4490 return CO_E_RELEASED
;
4492 FIXME("not implemented\n");
4496 static HRESULT WINAPI
ITextSelection_fnHomeKey(ITextSelection
*me
, LONG Unit
, LONG Extend
,
4499 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4501 return CO_E_RELEASED
;
4503 FIXME("not implemented\n");
4507 static HRESULT WINAPI
ITextSelection_fnEndKey(ITextSelection
*me
, LONG Unit
, LONG Extend
,
4510 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4512 return CO_E_RELEASED
;
4514 FIXME("not implemented\n");
4518 static HRESULT WINAPI
ITextSelection_fnTypeText(ITextSelection
*me
, BSTR bstr
)
4520 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4522 return CO_E_RELEASED
;
4524 FIXME("not implemented\n");
4528 static const ITextSelectionVtbl tsvt
= {
4529 ITextSelection_fnQueryInterface
,
4530 ITextSelection_fnAddRef
,
4531 ITextSelection_fnRelease
,
4532 ITextSelection_fnGetTypeInfoCount
,
4533 ITextSelection_fnGetTypeInfo
,
4534 ITextSelection_fnGetIDsOfNames
,
4535 ITextSelection_fnInvoke
,
4536 ITextSelection_fnGetText
,
4537 ITextSelection_fnSetText
,
4538 ITextSelection_fnGetChar
,
4539 ITextSelection_fnSetChar
,
4540 ITextSelection_fnGetDuplicate
,
4541 ITextSelection_fnGetFormattedText
,
4542 ITextSelection_fnSetFormattedText
,
4543 ITextSelection_fnGetStart
,
4544 ITextSelection_fnSetStart
,
4545 ITextSelection_fnGetEnd
,
4546 ITextSelection_fnSetEnd
,
4547 ITextSelection_fnGetFont
,
4548 ITextSelection_fnSetFont
,
4549 ITextSelection_fnGetPara
,
4550 ITextSelection_fnSetPara
,
4551 ITextSelection_fnGetStoryLength
,
4552 ITextSelection_fnGetStoryType
,
4553 ITextSelection_fnCollapse
,
4554 ITextSelection_fnExpand
,
4555 ITextSelection_fnGetIndex
,
4556 ITextSelection_fnSetIndex
,
4557 ITextSelection_fnSetRange
,
4558 ITextSelection_fnInRange
,
4559 ITextSelection_fnInStory
,
4560 ITextSelection_fnIsEqual
,
4561 ITextSelection_fnSelect
,
4562 ITextSelection_fnStartOf
,
4563 ITextSelection_fnEndOf
,
4564 ITextSelection_fnMove
,
4565 ITextSelection_fnMoveStart
,
4566 ITextSelection_fnMoveEnd
,
4567 ITextSelection_fnMoveWhile
,
4568 ITextSelection_fnMoveStartWhile
,
4569 ITextSelection_fnMoveEndWhile
,
4570 ITextSelection_fnMoveUntil
,
4571 ITextSelection_fnMoveStartUntil
,
4572 ITextSelection_fnMoveEndUntil
,
4573 ITextSelection_fnFindText
,
4574 ITextSelection_fnFindTextStart
,
4575 ITextSelection_fnFindTextEnd
,
4576 ITextSelection_fnDelete
,
4577 ITextSelection_fnCut
,
4578 ITextSelection_fnCopy
,
4579 ITextSelection_fnPaste
,
4580 ITextSelection_fnCanPaste
,
4581 ITextSelection_fnCanEdit
,
4582 ITextSelection_fnChangeCase
,
4583 ITextSelection_fnGetPoint
,
4584 ITextSelection_fnSetPoint
,
4585 ITextSelection_fnScrollIntoView
,
4586 ITextSelection_fnGetEmbeddedObject
,
4587 ITextSelection_fnGetFlags
,
4588 ITextSelection_fnSetFlags
,
4589 ITextSelection_fnGetType
,
4590 ITextSelection_fnMoveLeft
,
4591 ITextSelection_fnMoveRight
,
4592 ITextSelection_fnMoveUp
,
4593 ITextSelection_fnMoveDown
,
4594 ITextSelection_fnHomeKey
,
4595 ITextSelection_fnEndKey
,
4596 ITextSelection_fnTypeText
4599 static ITextSelectionImpl
*
4600 CreateTextSelection(IRichEditOleImpl
*reOle
)
4602 ITextSelectionImpl
*txtSel
= heap_alloc(sizeof *txtSel
);
4606 txtSel
->ITextSelection_iface
.lpVtbl
= &tsvt
;
4608 txtSel
->reOle
= reOle
;
4612 LRESULT
CreateIRichEditOle(IUnknown
*outer_unk
, ME_TextEditor
*editor
, LPVOID
*ppvObj
)
4614 IRichEditOleImpl
*reo
;
4616 reo
= heap_alloc(sizeof(IRichEditOleImpl
));
4620 reo
->IUnknown_inner
.lpVtbl
= &reo_unk_vtbl
;
4621 reo
->IRichEditOle_iface
.lpVtbl
= &revt
;
4622 reo
->ITextDocument_iface
.lpVtbl
= &tdvt
;
4624 reo
->editor
= editor
;
4625 reo
->txtSel
= CreateTextSelection(reo
);
4631 reo
->clientSite
= CreateOleClientSite(reo
);
4632 if (!reo
->clientSite
)
4634 ITextSelection_Release(&reo
->txtSel
->ITextSelection_iface
);
4638 TRACE("Created %p\n",reo
);
4639 list_init(&reo
->rangelist
);
4641 reo
->outer_unk
= outer_unk
;
4643 reo
->outer_unk
= &reo
->IUnknown_inner
;
4644 *ppvObj
= &reo
->IRichEditOle_iface
;
4649 static void convert_sizel(const ME_Context
*c
, const SIZEL
* szl
, SIZE
* sz
)
4651 /* sizel is in .01 millimeters, sz in pixels */
4652 sz
->cx
= MulDiv(szl
->cx
, c
->dpi
.cx
, 2540);
4653 sz
->cy
= MulDiv(szl
->cy
, c
->dpi
.cy
, 2540);
4656 /******************************************************************************
4657 * ME_GetOLEObjectSize
4659 * Sets run extent for OLE objects.
4661 void ME_GetOLEObjectSize(const ME_Context
*c
, ME_Run
*run
, SIZE
*pSize
)
4669 assert(run
->nFlags
& MERF_GRAPHICS
);
4670 assert(run
->ole_obj
);
4672 if (run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0)
4674 convert_sizel(c
, &run
->ole_obj
->sizel
, pSize
);
4675 if (c
->editor
->nZoomNumerator
!= 0)
4677 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
4678 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
4683 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
4685 FIXME("Query Interface IID_IDataObject failed!\n");
4686 pSize
->cx
= pSize
->cy
= 0;
4689 fmt
.cfFormat
= CF_BITMAP
;
4691 fmt
.dwAspect
= DVASPECT_CONTENT
;
4693 fmt
.tymed
= TYMED_GDI
;
4694 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
4696 fmt
.cfFormat
= CF_ENHMETAFILE
;
4697 fmt
.tymed
= TYMED_ENHMF
;
4698 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
4700 FIXME("unsupported format\n");
4701 pSize
->cx
= pSize
->cy
= 0;
4702 IDataObject_Release(ido
);
4710 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
4711 pSize
->cx
= dibsect
.dsBm
.bmWidth
;
4712 pSize
->cy
= dibsect
.dsBm
.bmHeight
;
4713 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
4716 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
4717 pSize
->cx
= emh
.rclBounds
.right
- emh
.rclBounds
.left
;
4718 pSize
->cy
= emh
.rclBounds
.bottom
- emh
.rclBounds
.top
;
4719 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
4722 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
4725 IDataObject_Release(ido
);
4726 if (c
->editor
->nZoomNumerator
!= 0)
4728 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
4729 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
4733 void ME_DrawOLE(ME_Context
*c
, int x
, int y
, ME_Run
*run
,
4734 ME_Paragraph
*para
, BOOL selected
)
4745 assert(run
->nFlags
& MERF_GRAPHICS
);
4746 assert(run
->ole_obj
);
4747 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
4749 FIXME("Couldn't get interface\n");
4752 has_size
= run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0;
4753 fmt
.cfFormat
= CF_BITMAP
;
4755 fmt
.dwAspect
= DVASPECT_CONTENT
;
4757 fmt
.tymed
= TYMED_GDI
;
4758 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
4760 fmt
.cfFormat
= CF_ENHMETAFILE
;
4761 fmt
.tymed
= TYMED_ENHMF
;
4762 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
4764 FIXME("Couldn't get storage medium\n");
4765 IDataObject_Release(ido
);
4772 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
4773 hMemDC
= CreateCompatibleDC(c
->hDC
);
4774 SelectObject(hMemDC
, stgm
.u
.hBitmap
);
4777 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
4779 sz
.cx
= MulDiv(dibsect
.dsBm
.bmWidth
, c
->dpi
.cx
, 96);
4780 sz
.cy
= MulDiv(dibsect
.dsBm
.bmHeight
, c
->dpi
.cy
, 96);
4782 if (c
->editor
->nZoomNumerator
!= 0)
4784 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
4785 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
4787 if (sz
.cx
== dibsect
.dsBm
.bmWidth
&& sz
.cy
== dibsect
.dsBm
.bmHeight
)
4789 BitBlt(c
->hDC
, x
, y
- sz
.cy
,
4790 dibsect
.dsBm
.bmWidth
, dibsect
.dsBm
.bmHeight
,
4791 hMemDC
, 0, 0, SRCCOPY
);
4793 StretchBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
,
4794 hMemDC
, 0, 0, dibsect
.dsBm
.bmWidth
,
4795 dibsect
.dsBm
.bmHeight
, SRCCOPY
);
4798 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
4801 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
4804 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
4806 sz
.cy
= MulDiv(emh
.rclBounds
.bottom
- emh
.rclBounds
.top
, c
->dpi
.cx
, 96);
4807 sz
.cx
= MulDiv(emh
.rclBounds
.right
- emh
.rclBounds
.left
, c
->dpi
.cy
, 96);
4809 if (c
->editor
->nZoomNumerator
!= 0)
4811 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
4812 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
4820 rc
.right
= x
+ sz
.cx
;
4822 PlayEnhMetaFile(c
->hDC
, stgm
.u
.hEnhMetaFile
, &rc
);
4824 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
4827 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
4831 if (selected
&& !c
->editor
->bHideSelection
)
4832 PatBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
, DSTINVERT
);
4833 IDataObject_Release(ido
);
4836 void ME_DeleteReObject(REOBJECT
* reo
)
4838 if (reo
->poleobj
) IOleObject_Release(reo
->poleobj
);
4839 if (reo
->pstg
) IStorage_Release(reo
->pstg
);
4840 if (reo
->polesite
) IOleClientSite_Release(reo
->polesite
);
4844 void ME_CopyReObject(REOBJECT
* dst
, const REOBJECT
* src
)
4848 if (dst
->poleobj
) IOleObject_AddRef(dst
->poleobj
);
4849 if (dst
->pstg
) IStorage_AddRef(dst
->pstg
);
4850 if (dst
->polesite
) IOleClientSite_AddRef(dst
->polesite
);
4853 void ME_GetITextDocumentInterface(IRichEditOle
*iface
, LPVOID
*ppvObj
)
4855 IRichEditOleImpl
*This
= impl_from_IRichEditOle(iface
);
4856 *ppvObj
= &This
->ITextDocument_iface
;