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 WINE_DEFAULT_DEBUG_CHANNEL(richedit
);
26 /* there is no way to be consistent across different sets of headers - mingw, Wine, Win32 SDK*/
30 DEFINE_GUID(LIBID_tom
, 0x8cc497c9, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
31 DEFINE_GUID(IID_ITextServices
, 0x8d33f740, 0xcf58, 0x11ce, 0xa8, 0x9d, 0x00, 0xaa, 0x00, 0x6c, 0xad, 0xc5);
32 DEFINE_GUID(IID_ITextHost
, 0x13e670f4,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1);
33 DEFINE_GUID(IID_ITextHost2
, 0x13e670f5,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1);
34 DEFINE_GUID(IID_ITextDocument
, 0x8cc497c0, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
35 DEFINE_GUID(IID_ITextRange
, 0x8cc497c2, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
36 DEFINE_GUID(IID_ITextSelection
, 0x8cc497c1, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
37 DEFINE_GUID(IID_ITextFont
, 0x8cc497c3, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
38 DEFINE_GUID(IID_ITextPara
, 0x8cc497c4, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
40 static ITypeLib
*typelib
;
52 static const IID
* const tid_ids
[] =
61 static ITypeInfo
*typeinfos
[LAST_tid
];
63 static HRESULT
load_typelib(void)
68 hr
= LoadRegTypeLib(&LIBID_tom
, 1, 0, LOCALE_SYSTEM_DEFAULT
, &tl
);
70 ERR("LoadRegTypeLib failed: %08x\n", hr
);
74 if (InterlockedCompareExchangePointer((void**)&typelib
, tl
, NULL
))
79 void release_typelib(void)
86 for (i
= 0; i
< sizeof(typeinfos
)/sizeof(*typeinfos
); i
++)
88 ITypeInfo_Release(typeinfos
[i
]);
90 ITypeLib_Release(typelib
);
93 static HRESULT
get_typeinfo(enum tid_t tid
, ITypeInfo
**typeinfo
)
106 hr
= ITypeLib_GetTypeInfoOfGuid(typelib
, tid_ids
[tid
], &ti
);
109 ERR("GetTypeInfoOfGuid(%s) failed: %08x\n", debugstr_guid(tid_ids
[tid
]), hr
);
113 if (InterlockedCompareExchangePointer((void**)(typeinfos
+tid
), ti
, NULL
))
114 ITypeInfo_Release(ti
);
117 *typeinfo
= typeinfos
[tid
];
121 /* private IID used to get back IRichEditOleImpl pointer */
122 DEFINE_GUID(IID_Igetrichole
, 0xe3ce5c7a, 0x8247, 0x4622, 0x81, 0xad, 0x11, 0x81, 0x02, 0xaa, 0x01, 0x30);
124 typedef struct ITextSelectionImpl ITextSelectionImpl
;
125 typedef struct IOleClientSiteImpl IOleClientSiteImpl
;
126 typedef struct ITextRangeImpl ITextRangeImpl
;
128 enum textfont_prop_id
{
154 FONT_PROPID_FIRST
= FONT_ALLCAPS
157 static const DWORD textfont_prop_masks
[][2] = {
158 { CFM_ALLCAPS
, CFE_ALLCAPS
},
160 { CFM_BACKCOLOR
, CFE_AUTOBACKCOLOR
},
161 { CFM_BOLD
, CFE_BOLD
},
162 { CFM_EMBOSS
, CFE_EMBOSS
},
163 { CFM_COLOR
, CFE_AUTOCOLOR
},
164 { CFM_HIDDEN
, CFE_HIDDEN
},
165 { CFM_IMPRINT
, CFE_IMPRINT
},
166 { CFM_ITALIC
, CFE_ITALIC
},
170 { CFM_OUTLINE
, CFE_OUTLINE
},
172 { CFM_PROTECTED
, CFE_PROTECTED
},
173 { CFM_SHADOW
, CFE_SHADOW
},
175 { CFM_SMALLCAPS
, CFE_SMALLCAPS
},
177 { CFM_STRIKEOUT
, CFE_STRIKEOUT
},
178 { CFM_SUBSCRIPT
, CFE_SUBSCRIPT
},
179 { CFM_SUPERSCRIPT
, CFE_SUPERSCRIPT
},
180 { CFM_UNDERLINE
, CFE_UNDERLINE
},
190 enum range_update_op
{
194 typedef struct IRichEditOleImpl
{
195 IUnknown IUnknown_inner
;
196 IRichEditOle IRichEditOle_iface
;
197 ITextDocument ITextDocument_iface
;
201 ME_TextEditor
*editor
;
202 ITextSelectionImpl
*txtSel
;
204 struct list rangelist
;
205 struct list clientsites
;
210 IRichEditOleImpl
*reole
;
213 struct ITextRangeImpl
{
214 struct reole_child child
;
215 ITextRange ITextRange_iface
;
220 struct ITextSelectionImpl
{
221 ITextSelection ITextSelection_iface
;
224 IRichEditOleImpl
*reOle
;
227 typedef struct ITextFontImpl
{
228 ITextFont ITextFont_iface
;
232 textfont_prop_val props
[FONT_PROPID_LAST
];
233 BOOL get_cache_enabled
;
234 BOOL set_cache_enabled
;
237 typedef struct ITextParaImpl
{
238 ITextPara ITextPara_iface
;
244 struct IOleClientSiteImpl
{
245 struct reole_child child
;
246 IOleClientSite IOleClientSite_iface
;
247 IOleInPlaceSite IOleInPlaceSite_iface
;
251 static inline IRichEditOleImpl
*impl_from_IRichEditOle(IRichEditOle
*iface
)
253 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, IRichEditOle_iface
);
256 static inline IRichEditOleImpl
*impl_from_ITextDocument(ITextDocument
*iface
)
258 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, ITextDocument_iface
);
261 static inline IRichEditOleImpl
*impl_from_IUnknown(IUnknown
*iface
)
263 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, IUnknown_inner
);
266 static inline IOleClientSiteImpl
*impl_from_IOleInPlaceSite(IOleInPlaceSite
*iface
)
268 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleInPlaceSite_iface
);
271 static inline ITextRangeImpl
*impl_from_ITextRange(ITextRange
*iface
)
273 return CONTAINING_RECORD(iface
, ITextRangeImpl
, ITextRange_iface
);
276 static inline ITextSelectionImpl
*impl_from_ITextSelection(ITextSelection
*iface
)
278 return CONTAINING_RECORD(iface
, ITextSelectionImpl
, ITextSelection_iface
);
281 static inline ITextFontImpl
*impl_from_ITextFont(ITextFont
*iface
)
283 return CONTAINING_RECORD(iface
, ITextFontImpl
, ITextFont_iface
);
286 static inline ITextParaImpl
*impl_from_ITextPara(ITextPara
*iface
)
288 return CONTAINING_RECORD(iface
, ITextParaImpl
, ITextPara_iface
);
291 static HRESULT
create_textfont(ITextRange
*, const ITextFontImpl
*, ITextFont
**);
292 static HRESULT
create_textpara(ITextRange
*, ITextPara
**);
293 static ITextSelectionImpl
*CreateTextSelection(IRichEditOleImpl
*);
295 static HRESULT
textrange_get_storylength(ME_TextEditor
*editor
, LONG
*length
)
300 *length
= ME_GetTextLength(editor
) + 1;
304 static void textranges_update_ranges(IRichEditOleImpl
*reole
, LONG start
, LONG end
, enum range_update_op op
)
306 ITextRangeImpl
*range
;
308 LIST_FOR_EACH_ENTRY(range
, &reole
->rangelist
, ITextRangeImpl
, child
.entry
) {
311 case RANGE_UPDATE_DELETE
:
312 /* range fully covered by deleted range - collapse to insertion point */
313 if (range
->start
>= start
&& range
->end
<= end
)
314 range
->start
= range
->end
= start
;
315 /* deleted range cuts from the right */
316 else if (range
->start
< start
&& range
->end
<= end
)
318 /* deleted range cuts from the left */
319 else if (range
->start
>= start
&& range
->end
> end
) {
320 range
->start
= start
;
321 range
->end
-= end
- start
;
323 /* deleted range cuts within */
325 range
->end
-= end
- start
;
328 FIXME("unknown update op, %d\n", op
);
333 static inline BOOL
is_equal_textfont_prop_value(enum textfont_prop_id propid
, textfont_prop_val
*left
,
334 textfont_prop_val
*right
)
353 case FONT_STRIKETHROUGH
:
355 case FONT_SUPERSCRIPT
:
358 return left
->l
== right
->l
;
360 return !strcmpW(left
->str
, right
->str
);
364 return left
->f
== right
->f
;
366 FIXME("unhandled font property %d\n", propid
);
371 static inline void init_textfont_prop_value(enum textfont_prop_id propid
, textfont_prop_val
*v
)
390 case FONT_STRIKETHROUGH
:
392 case FONT_SUPERSCRIPT
:
406 FIXME("unhandled font property %d\n", propid
);
412 static inline FLOAT
twips_to_points(LONG value
)
414 return value
* 72.0 / 1440;
417 static inline FLOAT
points_to_twips(FLOAT value
)
419 return value
* 1440 / 72.0;
422 static HRESULT
get_textfont_prop_for_pos(const IRichEditOleImpl
*reole
, int pos
, enum textfont_prop_id propid
,
423 textfont_prop_val
*value
)
428 memset(&fmt
, 0, sizeof(fmt
));
429 fmt
.cbSize
= sizeof(fmt
);
430 fmt
.dwMask
= textfont_prop_masks
[propid
][0];
432 ME_CursorFromCharOfs(reole
->editor
, pos
, &from
);
434 ME_MoveCursorChars(reole
->editor
, &to
, 1, FALSE
);
435 ME_GetCharFormat(reole
->editor
, &from
, &to
, &fmt
);
449 case FONT_STRIKETHROUGH
:
451 case FONT_SUPERSCRIPT
:
453 value
->l
= fmt
.dwEffects
& textfont_prop_masks
[propid
][1] ? tomTrue
: tomFalse
;
456 value
->l
= fmt
.bAnimation
;
459 value
->l
= fmt
.dwEffects
& CFE_AUTOBACKCOLOR
? GetSysColor(COLOR_WINDOW
) : fmt
.crBackColor
;
462 value
->l
= fmt
.dwEffects
& CFE_AUTOCOLOR
? GetSysColor(COLOR_WINDOWTEXT
) : fmt
.crTextColor
;
465 value
->f
= twips_to_points(fmt
.wKerning
);
471 /* this case is used exclusively by GetName() */
472 value
->str
= SysAllocString(fmt
.szFaceName
);
474 return E_OUTOFMEMORY
;
477 value
->f
= twips_to_points(fmt
.yOffset
);
480 value
->f
= twips_to_points(fmt
.yHeight
);
483 value
->f
= fmt
.sSpacing
;
486 value
->l
= fmt
.wWeight
;
489 FIXME("unhandled font property %d\n", propid
);
496 static inline const IRichEditOleImpl
*get_range_reole(ITextRange
*range
)
498 IRichEditOleImpl
*reole
= NULL
;
499 ITextRange_QueryInterface(range
, &IID_Igetrichole
, (void**)&reole
);
503 static void textrange_set_font(ITextRange
*range
, ITextFont
*font
)
511 #define CHARFORMAT_SET_B_FIELD(mask, value) \
512 if (hr == S_OK && value != tomUndefined) { \
513 fmt.dwMask |= CFM_##mask; \
514 if (value == tomTrue) fmt.dwEffects |= CFE_##mask; \
517 /* fill format data from font */
518 memset(&fmt
, 0, sizeof(fmt
));
519 fmt
.cbSize
= sizeof(fmt
);
521 value
= tomUndefined
;
522 hr
= ITextFont_GetAllCaps(font
, &value
);
523 CHARFORMAT_SET_B_FIELD(ALLCAPS
, value
);
525 value
= tomUndefined
;
526 hr
= ITextFont_GetBold(font
, &value
);
527 CHARFORMAT_SET_B_FIELD(BOLD
, value
);
529 value
= tomUndefined
;
530 hr
= ITextFont_GetEmboss(font
, &value
);
531 CHARFORMAT_SET_B_FIELD(EMBOSS
, value
);
533 value
= tomUndefined
;
534 hr
= ITextFont_GetHidden(font
, &value
);
535 CHARFORMAT_SET_B_FIELD(HIDDEN
, value
);
537 value
= tomUndefined
;
538 hr
= ITextFont_GetEngrave(font
, &value
);
539 CHARFORMAT_SET_B_FIELD(IMPRINT
, value
);
541 value
= tomUndefined
;
542 hr
= ITextFont_GetItalic(font
, &value
);
543 CHARFORMAT_SET_B_FIELD(ITALIC
, value
);
545 value
= tomUndefined
;
546 hr
= ITextFont_GetOutline(font
, &value
);
547 CHARFORMAT_SET_B_FIELD(OUTLINE
, value
);
549 value
= tomUndefined
;
550 hr
= ITextFont_GetProtected(font
, &value
);
551 CHARFORMAT_SET_B_FIELD(PROTECTED
, value
);
553 value
= tomUndefined
;
554 hr
= ITextFont_GetShadow(font
, &value
);
555 CHARFORMAT_SET_B_FIELD(SHADOW
, value
);
557 value
= tomUndefined
;
558 hr
= ITextFont_GetSmallCaps(font
, &value
);
559 CHARFORMAT_SET_B_FIELD(SMALLCAPS
, value
);
561 value
= tomUndefined
;
562 hr
= ITextFont_GetStrikeThrough(font
, &value
);
563 CHARFORMAT_SET_B_FIELD(STRIKEOUT
, value
);
565 value
= tomUndefined
;
566 hr
= ITextFont_GetSubscript(font
, &value
);
567 CHARFORMAT_SET_B_FIELD(SUBSCRIPT
, value
);
569 value
= tomUndefined
;
570 hr
= ITextFont_GetSuperscript(font
, &value
);
571 CHARFORMAT_SET_B_FIELD(SUPERSCRIPT
, value
);
573 value
= tomUndefined
;
574 hr
= ITextFont_GetUnderline(font
, &value
);
575 CHARFORMAT_SET_B_FIELD(UNDERLINE
, value
);
577 #undef CHARFORMAT_SET_B_FIELD
579 value
= tomUndefined
;
580 hr
= ITextFont_GetAnimation(font
, &value
);
581 if (hr
== S_OK
&& value
!= tomUndefined
) {
582 fmt
.dwMask
|= CFM_ANIMATION
;
583 fmt
.bAnimation
= value
;
586 value
= tomUndefined
;
587 hr
= ITextFont_GetBackColor(font
, &value
);
588 if (hr
== S_OK
&& value
!= tomUndefined
) {
589 fmt
.dwMask
|= CFM_BACKCOLOR
;
590 if (value
== tomAutoColor
)
591 fmt
.dwEffects
|= CFE_AUTOBACKCOLOR
;
593 fmt
.crBackColor
= value
;
596 value
= tomUndefined
;
597 hr
= ITextFont_GetForeColor(font
, &value
);
598 if (hr
== S_OK
&& value
!= tomUndefined
) {
599 fmt
.dwMask
|= CFM_COLOR
;
600 if (value
== tomAutoColor
)
601 fmt
.dwEffects
|= CFE_AUTOCOLOR
;
603 fmt
.crTextColor
= value
;
606 value
= tomUndefined
;
607 hr
= ITextFont_GetKerning(font
, &f
);
608 if (hr
== S_OK
&& f
!= tomUndefined
) {
609 fmt
.dwMask
|= CFM_KERNING
;
610 fmt
.wKerning
= points_to_twips(f
);
613 value
= tomUndefined
;
614 hr
= ITextFont_GetLanguageID(font
, &value
);
615 if (hr
== S_OK
&& value
!= tomUndefined
) {
616 fmt
.dwMask
|= CFM_LCID
;
620 if (ITextFont_GetName(font
, &str
) == S_OK
) {
621 fmt
.dwMask
|= CFM_FACE
;
622 lstrcpynW(fmt
.szFaceName
, str
, sizeof(fmt
.szFaceName
)/sizeof(WCHAR
));
626 hr
= ITextFont_GetPosition(font
, &f
);
627 if (hr
== S_OK
&& f
!= tomUndefined
) {
628 fmt
.dwMask
|= CFM_OFFSET
;
629 fmt
.yOffset
= points_to_twips(f
);
632 hr
= ITextFont_GetSize(font
, &f
);
633 if (hr
== S_OK
&& f
!= tomUndefined
) {
634 fmt
.dwMask
|= CFM_SIZE
;
635 fmt
.yHeight
= points_to_twips(f
);
638 hr
= ITextFont_GetSpacing(font
, &f
);
639 if (hr
== S_OK
&& f
!= tomUndefined
) {
640 fmt
.dwMask
|= CFM_SPACING
;
644 hr
= ITextFont_GetWeight(font
, &value
);
645 if (hr
== S_OK
&& value
!= tomUndefined
) {
646 fmt
.dwMask
|= CFM_WEIGHT
;
651 const IRichEditOleImpl
*reole
= get_range_reole(range
);
655 ITextRange_GetStart(range
, &start
);
656 ITextRange_GetEnd(range
, &end
);
658 ME_CursorFromCharOfs(reole
->editor
, start
, &from
);
659 ME_CursorFromCharOfs(reole
->editor
, end
, &to
);
660 ME_SetCharFormat(reole
->editor
, &from
, &to
, &fmt
);
664 static HRESULT
get_textfont_prop(const ITextFontImpl
*font
, enum textfont_prop_id propid
, textfont_prop_val
*value
)
666 const IRichEditOleImpl
*reole
;
671 /* when font is not attached to any range use cached values */
672 if (!font
->range
|| font
->get_cache_enabled
) {
673 *value
= font
->props
[propid
];
677 if (!(reole
= get_range_reole(font
->range
)))
678 return CO_E_RELEASED
;
680 init_textfont_prop_value(propid
, value
);
682 ITextRange_GetStart(font
->range
, &start
);
683 ITextRange_GetEnd(font
->range
, &end
);
685 /* iterate trough a range to see if property value is consistent */
686 hr
= get_textfont_prop_for_pos(reole
, start
, propid
, &v
);
690 for (i
= start
+ 1; i
< end
; i
++) {
691 textfont_prop_val cur
;
693 hr
= get_textfont_prop_for_pos(reole
, i
, propid
, &cur
);
697 if (!is_equal_textfont_prop_value(propid
, &v
, &cur
))
705 static HRESULT
get_textfont_propf(const ITextFontImpl
*font
, enum textfont_prop_id propid
, FLOAT
*value
)
713 hr
= get_textfont_prop(font
, propid
, &v
);
718 static HRESULT
get_textfont_propl(const ITextFontImpl
*font
, enum textfont_prop_id propid
, LONG
*value
)
726 hr
= get_textfont_prop(font
, propid
, &v
);
731 /* Value should already have a terminal value, for boolean properties it means tomToggle is not handled */
732 static HRESULT
set_textfont_prop(ITextFontImpl
*font
, enum textfont_prop_id propid
, const textfont_prop_val
*value
)
734 const IRichEditOleImpl
*reole
;
739 /* when font is not attached to any range use cache */
740 if (!font
->range
|| font
->set_cache_enabled
) {
741 if (propid
== FONT_NAME
) {
742 SysFreeString(font
->props
[propid
].str
);
743 font
->props
[propid
].str
= SysAllocString(value
->str
);
746 font
->props
[propid
] = *value
;
750 if (!(reole
= get_range_reole(font
->range
)))
751 return CO_E_RELEASED
;
753 memset(&fmt
, 0, sizeof(fmt
));
754 fmt
.cbSize
= sizeof(fmt
);
755 fmt
.dwMask
= textfont_prop_masks
[propid
][0];
769 case FONT_STRIKETHROUGH
:
771 case FONT_SUPERSCRIPT
:
773 fmt
.dwEffects
= value
->l
== tomTrue
? textfont_prop_masks
[propid
][1] : 0;
776 fmt
.bAnimation
= value
->l
;
780 if (value
->l
== tomAutoColor
)
781 fmt
.dwEffects
= textfont_prop_masks
[propid
][1];
782 else if (propid
== FONT_BACKCOLOR
)
783 fmt
.crBackColor
= value
->l
;
785 fmt
.crTextColor
= value
->l
;
788 fmt
.wKerning
= value
->f
;
794 fmt
.yOffset
= value
->f
;
797 fmt
.yHeight
= value
->f
;
800 fmt
.sSpacing
= value
->f
;
803 fmt
.wWeight
= value
->l
;
806 lstrcpynW(fmt
.szFaceName
, value
->str
, sizeof(fmt
.szFaceName
)/sizeof(WCHAR
));
809 FIXME("unhandled font property %d\n", propid
);
813 ITextRange_GetStart(font
->range
, &start
);
814 ITextRange_GetEnd(font
->range
, &end
);
816 ME_CursorFromCharOfs(reole
->editor
, start
, &from
);
817 ME_CursorFromCharOfs(reole
->editor
, end
, &to
);
818 ME_SetCharFormat(reole
->editor
, &from
, &to
, &fmt
);
823 static inline HRESULT
set_textfont_propl(ITextFontImpl
*font
, enum textfont_prop_id propid
, LONG value
)
827 return set_textfont_prop(font
, propid
, &v
);
830 static inline HRESULT
set_textfont_propf(ITextFontImpl
*font
, enum textfont_prop_id propid
, FLOAT value
)
834 return set_textfont_prop(font
, propid
, &v
);
837 static HRESULT
set_textfont_propd(ITextFontImpl
*font
, enum textfont_prop_id propid
, LONG value
)
847 get_textfont_propl(font
, propid
, &oldvalue
);
848 if (oldvalue
== tomFalse
)
850 else if (oldvalue
== tomTrue
)
859 return set_textfont_prop(font
, propid
, &v
);
865 static HRESULT
textfont_getname_from_range(ITextRange
*range
, BSTR
*ret
)
867 const IRichEditOleImpl
*reole
;
872 if (!(reole
= get_range_reole(range
)))
873 return CO_E_RELEASED
;
875 ITextRange_GetStart(range
, &start
);
876 hr
= get_textfont_prop_for_pos(reole
, start
, FONT_NAME
, &v
);
881 static void textfont_cache_range_props(ITextFontImpl
*font
)
883 enum textfont_prop_id propid
;
884 for (propid
= FONT_PROPID_FIRST
; propid
< FONT_PROPID_LAST
; propid
++) {
885 if (propid
== FONT_NAME
)
886 textfont_getname_from_range(font
->range
, &font
->props
[propid
].str
);
888 get_textfont_prop(font
, propid
, &font
->props
[propid
]);
892 static HRESULT
textrange_expand(ITextRange
*range
, LONG unit
, LONG
*delta
)
894 LONG expand_start
, expand_end
;
900 ITextRange_GetStoryLength(range
, &expand_end
);
903 FIXME("unit %d is not supported\n", unit
);
910 ITextRange_GetStart(range
, &start
);
911 ITextRange_GetEnd(range
, &end
);
912 *delta
= expand_end
- expand_start
- (end
- start
);
915 ITextRange_SetStart(range
, expand_start
);
916 ITextRange_SetEnd(range
, expand_end
);
921 static HRESULT WINAPI
IRichEditOleImpl_inner_fnQueryInterface(IUnknown
*iface
, REFIID riid
, LPVOID
*ppvObj
)
923 IRichEditOleImpl
*This
= impl_from_IUnknown(iface
);
925 TRACE("%p %s\n", This
, debugstr_guid(riid
));
928 if (IsEqualGUID(riid
, &IID_IUnknown
))
929 *ppvObj
= &This
->IUnknown_inner
;
930 else if (IsEqualGUID(riid
, &IID_IRichEditOle
))
931 *ppvObj
= &This
->IRichEditOle_iface
;
932 else if (IsEqualGUID(riid
, &IID_ITextDocument
))
933 *ppvObj
= &This
->ITextDocument_iface
;
936 IUnknown_AddRef((IUnknown
*)*ppvObj
);
939 FIXME("%p: unhandled interface %s\n", This
, debugstr_guid(riid
));
941 return E_NOINTERFACE
;
944 static ULONG WINAPI
IRichEditOleImpl_inner_fnAddRef(IUnknown
*iface
)
946 IRichEditOleImpl
*This
= impl_from_IUnknown(iface
);
947 ULONG ref
= InterlockedIncrement(&This
->ref
);
949 TRACE("%p ref = %u\n", This
, ref
);
954 static ULONG WINAPI
IRichEditOleImpl_inner_fnRelease(IUnknown
*iface
)
956 IRichEditOleImpl
*This
= impl_from_IUnknown(iface
);
957 ULONG ref
= InterlockedDecrement(&This
->ref
);
959 TRACE ("%p ref=%u\n", This
, ref
);
963 IOleClientSiteImpl
*clientsite
;
964 ITextRangeImpl
*txtRge
;
966 This
->editor
->reOle
= NULL
;
968 This
->txtSel
->reOle
= NULL
;
969 ITextSelection_Release(&This
->txtSel
->ITextSelection_iface
);
972 LIST_FOR_EACH_ENTRY(txtRge
, &This
->rangelist
, ITextRangeImpl
, child
.entry
)
973 txtRge
->child
.reole
= NULL
;
975 LIST_FOR_EACH_ENTRY(clientsite
, &This
->clientsites
, IOleClientSiteImpl
, child
.entry
)
976 clientsite
->child
.reole
= NULL
;
983 static const IUnknownVtbl reo_unk_vtbl
=
985 IRichEditOleImpl_inner_fnQueryInterface
,
986 IRichEditOleImpl_inner_fnAddRef
,
987 IRichEditOleImpl_inner_fnRelease
990 static HRESULT WINAPI
991 IRichEditOle_fnQueryInterface(IRichEditOle
*me
, REFIID riid
, LPVOID
*ppvObj
)
993 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
994 return IUnknown_QueryInterface(This
->outer_unk
, riid
, ppvObj
);
998 IRichEditOle_fnAddRef(IRichEditOle
*me
)
1000 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1001 return IUnknown_AddRef(This
->outer_unk
);
1005 IRichEditOle_fnRelease(IRichEditOle
*me
)
1007 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1008 return IUnknown_Release(This
->outer_unk
);
1011 static HRESULT WINAPI
1012 IRichEditOle_fnActivateAs(IRichEditOle
*me
, REFCLSID rclsid
, REFCLSID rclsidAs
)
1014 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1015 FIXME("stub %p\n",This
);
1019 static HRESULT WINAPI
1020 IRichEditOle_fnContextSensitiveHelp(IRichEditOle
*me
, BOOL fEnterMode
)
1022 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1023 FIXME("stub %p\n",This
);
1027 static HRESULT WINAPI
1028 IRichEditOle_fnConvertObject(IRichEditOle
*me
, LONG iob
,
1029 REFCLSID rclsidNew
, LPCSTR lpstrUserTypeNew
)
1031 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1032 FIXME("stub %p\n",This
);
1036 static inline IOleClientSiteImpl
*impl_from_IOleClientSite(IOleClientSite
*iface
)
1038 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleClientSite_iface
);
1041 static HRESULT WINAPI
1042 IOleClientSite_fnQueryInterface(IOleClientSite
*me
, REFIID riid
, LPVOID
*ppvObj
)
1044 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(me
);
1045 TRACE("%p %s\n", me
, debugstr_guid(riid
) );
1048 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
1049 IsEqualGUID(riid
, &IID_IOleClientSite
))
1051 else if (IsEqualGUID(riid
, &IID_IOleWindow
) ||
1052 IsEqualGUID(riid
, &IID_IOleInPlaceSite
))
1053 *ppvObj
= &This
->IOleInPlaceSite_iface
;
1056 IOleClientSite_AddRef(me
);
1059 FIXME("%p: unhandled interface %s\n", me
, debugstr_guid(riid
) );
1061 return E_NOINTERFACE
;
1064 static ULONG WINAPI
IOleClientSite_fnAddRef(IOleClientSite
*iface
)
1066 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1067 ULONG ref
= InterlockedIncrement(&This
->ref
);
1068 TRACE("(%p)->(%u)\n", This
, ref
);
1072 static ULONG WINAPI
IOleClientSite_fnRelease(IOleClientSite
*iface
)
1074 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1075 ULONG ref
= InterlockedDecrement(&This
->ref
);
1077 TRACE("(%p)->(%u)\n", This
, ref
);
1080 if (This
->child
.reole
) {
1081 list_remove(&This
->child
.entry
);
1082 This
->child
.reole
= NULL
;
1089 static HRESULT WINAPI
IOleClientSite_fnSaveObject(IOleClientSite
*iface
)
1091 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1092 if (!This
->child
.reole
)
1093 return CO_E_RELEASED
;
1095 FIXME("stub %p\n", iface
);
1099 static HRESULT WINAPI
IOleClientSite_fnGetMoniker(IOleClientSite
*iface
, DWORD dwAssign
,
1100 DWORD dwWhichMoniker
, IMoniker
**ppmk
)
1102 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1103 if (!This
->child
.reole
)
1104 return CO_E_RELEASED
;
1106 FIXME("stub %p\n", iface
);
1110 static HRESULT WINAPI
IOleClientSite_fnGetContainer(IOleClientSite
*iface
,
1111 IOleContainer
**ppContainer
)
1113 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1114 if (!This
->child
.reole
)
1115 return CO_E_RELEASED
;
1117 FIXME("stub %p\n", iface
);
1121 static HRESULT WINAPI
IOleClientSite_fnShowObject(IOleClientSite
*iface
)
1123 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1124 if (!This
->child
.reole
)
1125 return CO_E_RELEASED
;
1127 FIXME("stub %p\n", iface
);
1131 static HRESULT WINAPI
IOleClientSite_fnOnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
1133 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1134 if (!This
->child
.reole
)
1135 return CO_E_RELEASED
;
1137 FIXME("stub %p\n", iface
);
1141 static HRESULT WINAPI
IOleClientSite_fnRequestNewObjectLayout(IOleClientSite
*iface
)
1143 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1144 if (!This
->child
.reole
)
1145 return CO_E_RELEASED
;
1147 FIXME("stub %p\n", iface
);
1151 static const IOleClientSiteVtbl ocst
= {
1152 IOleClientSite_fnQueryInterface
,
1153 IOleClientSite_fnAddRef
,
1154 IOleClientSite_fnRelease
,
1155 IOleClientSite_fnSaveObject
,
1156 IOleClientSite_fnGetMoniker
,
1157 IOleClientSite_fnGetContainer
,
1158 IOleClientSite_fnShowObject
,
1159 IOleClientSite_fnOnShowWindow
,
1160 IOleClientSite_fnRequestNewObjectLayout
1163 /* IOleInPlaceSite interface */
1164 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnQueryInterface(IOleInPlaceSite
*iface
, REFIID riid
, void **ppvObj
)
1166 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1167 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppvObj
);
1170 static ULONG STDMETHODCALLTYPE
IOleInPlaceSite_fnAddRef(IOleInPlaceSite
*iface
)
1172 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1173 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
1176 static ULONG STDMETHODCALLTYPE
IOleInPlaceSite_fnRelease(IOleInPlaceSite
*iface
)
1178 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1179 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
1182 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnGetWindow(IOleInPlaceSite
*iface
, HWND
*phwnd
)
1184 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1186 TRACE("(%p)->(%p)\n", This
, phwnd
);
1188 if (!This
->child
.reole
)
1189 return CO_E_RELEASED
;
1192 return E_INVALIDARG
;
1194 *phwnd
= This
->child
.reole
->editor
->hWnd
;
1198 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnContextSensitiveHelp(IOleInPlaceSite
*iface
, BOOL fEnterMode
)
1200 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1201 FIXME("not implemented: (%p)->(%d)\n", This
, fEnterMode
);
1205 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnCanInPlaceActivate(IOleInPlaceSite
*iface
)
1207 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1208 FIXME("not implemented: (%p)\n", This
);
1212 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnInPlaceActivate(IOleInPlaceSite
*iface
)
1214 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1215 FIXME("not implemented: (%p)\n", This
);
1219 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnUIActivate(IOleInPlaceSite
*iface
)
1221 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1222 FIXME("not implemented: (%p)\n", This
);
1226 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnGetWindowContext(IOleInPlaceSite
*iface
, IOleInPlaceFrame
**ppFrame
,
1227 IOleInPlaceUIWindow
**ppDoc
, LPRECT lprcPosRect
,
1228 LPRECT lprcClipRect
, LPOLEINPLACEFRAMEINFO lpFrameInfo
)
1230 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1231 FIXME("not implemented: (%p)->(%p %p %p %p %p)\n", This
, ppFrame
, ppDoc
, lprcPosRect
, lprcClipRect
, lpFrameInfo
);
1235 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnScroll(IOleInPlaceSite
*iface
, SIZE scrollExtent
)
1237 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1238 FIXME("not implemented: (%p)\n", This
);
1242 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnUIDeactivate(IOleInPlaceSite
*iface
, BOOL fUndoable
)
1244 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1245 FIXME("not implemented: (%p)->(%d)\n", This
, fUndoable
);
1249 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnInPlaceDeactivate(IOleInPlaceSite
*iface
)
1251 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1252 FIXME("not implemented: (%p)\n", This
);
1256 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnDiscardUndoState(IOleInPlaceSite
*iface
)
1258 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1259 FIXME("not implemented: (%p)\n", This
);
1263 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnDeactivateAndUndo(IOleInPlaceSite
*iface
)
1265 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1266 FIXME("not implemented: (%p)\n", This
);
1270 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnPosRectChange(IOleInPlaceSite
*iface
, LPCRECT lprcPosRect
)
1272 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1273 FIXME("not implemented: (%p)->(%p)\n", This
, lprcPosRect
);
1277 static const IOleInPlaceSiteVtbl olestvt
=
1279 IOleInPlaceSite_fnQueryInterface
,
1280 IOleInPlaceSite_fnAddRef
,
1281 IOleInPlaceSite_fnRelease
,
1282 IOleInPlaceSite_fnGetWindow
,
1283 IOleInPlaceSite_fnContextSensitiveHelp
,
1284 IOleInPlaceSite_fnCanInPlaceActivate
,
1285 IOleInPlaceSite_fnOnInPlaceActivate
,
1286 IOleInPlaceSite_fnOnUIActivate
,
1287 IOleInPlaceSite_fnGetWindowContext
,
1288 IOleInPlaceSite_fnScroll
,
1289 IOleInPlaceSite_fnOnUIDeactivate
,
1290 IOleInPlaceSite_fnOnInPlaceDeactivate
,
1291 IOleInPlaceSite_fnDiscardUndoState
,
1292 IOleInPlaceSite_fnDeactivateAndUndo
,
1293 IOleInPlaceSite_fnOnPosRectChange
1296 static HRESULT
CreateOleClientSite(IRichEditOleImpl
*reOle
, IOleClientSite
**ret
)
1298 IOleClientSiteImpl
*clientSite
= heap_alloc(sizeof *clientSite
);
1301 return E_OUTOFMEMORY
;
1303 clientSite
->IOleClientSite_iface
.lpVtbl
= &ocst
;
1304 clientSite
->IOleInPlaceSite_iface
.lpVtbl
= &olestvt
;
1305 clientSite
->ref
= 1;
1306 clientSite
->child
.reole
= reOle
;
1307 list_add_head(&reOle
->clientsites
, &clientSite
->child
.entry
);
1309 *ret
= &clientSite
->IOleClientSite_iface
;
1313 static HRESULT WINAPI
1314 IRichEditOle_fnGetClientSite(IRichEditOle
*me
, IOleClientSite
**clientsite
)
1316 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1318 TRACE("(%p)->(%p)\n", This
, clientsite
);
1321 return E_INVALIDARG
;
1323 return CreateOleClientSite(This
, clientsite
);
1326 static HRESULT WINAPI
1327 IRichEditOle_fnGetClipboardData(IRichEditOle
*me
, CHARRANGE
*lpchrg
,
1328 DWORD reco
, LPDATAOBJECT
*lplpdataobj
)
1330 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1334 TRACE("(%p,%p,%d)\n",This
, lpchrg
, reco
);
1336 return E_INVALIDARG
;
1338 int nFrom
, nTo
, nStartCur
= ME_GetSelectionOfs(This
->editor
, &nFrom
, &nTo
);
1339 start
= This
->editor
->pCursors
[nStartCur
];
1340 nChars
= nTo
- nFrom
;
1342 ME_CursorFromCharOfs(This
->editor
, lpchrg
->cpMin
, &start
);
1343 nChars
= lpchrg
->cpMax
- lpchrg
->cpMin
;
1345 return ME_GetDataObject(This
->editor
, &start
, nChars
, lplpdataobj
);
1348 static LONG WINAPI
IRichEditOle_fnGetLinkCount(IRichEditOle
*me
)
1350 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1351 FIXME("stub %p\n",This
);
1355 static HRESULT WINAPI
1356 IRichEditOle_fnGetObject(IRichEditOle
*me
, LONG iob
,
1357 REOBJECT
*lpreobject
, DWORD dwFlags
)
1359 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1360 FIXME("stub %p\n",This
);
1365 IRichEditOle_fnGetObjectCount(IRichEditOle
*me
)
1367 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1368 FIXME("stub %p\n",This
);
1372 static HRESULT WINAPI
1373 IRichEditOle_fnHandsOffStorage(IRichEditOle
*me
, LONG iob
)
1375 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1376 FIXME("stub %p\n",This
);
1380 static HRESULT WINAPI
1381 IRichEditOle_fnImportDataObject(IRichEditOle
*me
, LPDATAOBJECT lpdataobj
,
1382 CLIPFORMAT cf
, HGLOBAL hMetaPict
)
1384 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1385 FIXME("stub %p\n",This
);
1389 static HRESULT WINAPI
1390 IRichEditOle_fnInPlaceDeactivate(IRichEditOle
*me
)
1392 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1393 FIXME("stub %p\n",This
);
1397 static HRESULT WINAPI
1398 IRichEditOle_fnInsertObject(IRichEditOle
*me
, REOBJECT
*reo
)
1400 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1402 TRACE("(%p,%p)\n", This
, reo
);
1405 return E_INVALIDARG
;
1407 if (reo
->cbStruct
< sizeof(*reo
)) return STG_E_INVALIDPARAMETER
;
1409 ME_InsertOLEFromCursor(This
->editor
, reo
, 0);
1410 ME_CommitUndo(This
->editor
);
1411 ME_UpdateRepaint(This
->editor
, FALSE
);
1415 static HRESULT WINAPI
IRichEditOle_fnSaveCompleted(IRichEditOle
*me
, LONG iob
,
1418 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1419 FIXME("stub %p\n",This
);
1423 static HRESULT WINAPI
1424 IRichEditOle_fnSetDvaspect(IRichEditOle
*me
, LONG iob
, DWORD dvaspect
)
1426 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1427 FIXME("stub %p\n",This
);
1431 static HRESULT WINAPI
IRichEditOle_fnSetHostNames(IRichEditOle
*me
,
1432 LPCSTR lpstrContainerApp
, LPCSTR lpstrContainerObj
)
1434 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1435 FIXME("stub %p %s %s\n",This
, lpstrContainerApp
, lpstrContainerObj
);
1439 static HRESULT WINAPI
1440 IRichEditOle_fnSetLinkAvailable(IRichEditOle
*me
, LONG iob
, BOOL fAvailable
)
1442 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1443 FIXME("stub %p\n",This
);
1447 static const IRichEditOleVtbl revt
= {
1448 IRichEditOle_fnQueryInterface
,
1449 IRichEditOle_fnAddRef
,
1450 IRichEditOle_fnRelease
,
1451 IRichEditOle_fnGetClientSite
,
1452 IRichEditOle_fnGetObjectCount
,
1453 IRichEditOle_fnGetLinkCount
,
1454 IRichEditOle_fnGetObject
,
1455 IRichEditOle_fnInsertObject
,
1456 IRichEditOle_fnConvertObject
,
1457 IRichEditOle_fnActivateAs
,
1458 IRichEditOle_fnSetHostNames
,
1459 IRichEditOle_fnSetLinkAvailable
,
1460 IRichEditOle_fnSetDvaspect
,
1461 IRichEditOle_fnHandsOffStorage
,
1462 IRichEditOle_fnSaveCompleted
,
1463 IRichEditOle_fnInPlaceDeactivate
,
1464 IRichEditOle_fnContextSensitiveHelp
,
1465 IRichEditOle_fnGetClipboardData
,
1466 IRichEditOle_fnImportDataObject
1469 /* ITextRange interface */
1470 static HRESULT WINAPI
ITextRange_fnQueryInterface(ITextRange
*me
, REFIID riid
, void **ppvObj
)
1472 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1475 if (IsEqualGUID(riid
, &IID_IUnknown
)
1476 || IsEqualGUID(riid
, &IID_IDispatch
)
1477 || IsEqualGUID(riid
, &IID_ITextRange
))
1480 ITextRange_AddRef(me
);
1483 else if (IsEqualGUID(riid
, &IID_Igetrichole
))
1485 *ppvObj
= This
->child
.reole
;
1489 return E_NOINTERFACE
;
1492 static ULONG WINAPI
ITextRange_fnAddRef(ITextRange
*me
)
1494 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1495 return InterlockedIncrement(&This
->ref
);
1498 static ULONG WINAPI
ITextRange_fnRelease(ITextRange
*me
)
1500 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1501 ULONG ref
= InterlockedDecrement(&This
->ref
);
1503 TRACE ("%p ref=%u\n", This
, ref
);
1506 if (This
->child
.reole
)
1508 list_remove(&This
->child
.entry
);
1509 This
->child
.reole
= NULL
;
1516 static HRESULT WINAPI
ITextRange_fnGetTypeInfoCount(ITextRange
*me
, UINT
*pctinfo
)
1518 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1519 TRACE("(%p)->(%p)\n", This
, pctinfo
);
1524 static HRESULT WINAPI
ITextRange_fnGetTypeInfo(ITextRange
*me
, UINT iTInfo
, LCID lcid
,
1525 ITypeInfo
**ppTInfo
)
1527 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1530 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
1532 hr
= get_typeinfo(ITextRange_tid
, ppTInfo
);
1534 ITypeInfo_AddRef(*ppTInfo
);
1538 static HRESULT WINAPI
ITextRange_fnGetIDsOfNames(ITextRange
*me
, REFIID riid
, LPOLESTR
*rgszNames
,
1539 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1541 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1545 TRACE("(%p)->(%s, %p, %u, %d, %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
,
1548 hr
= get_typeinfo(ITextRange_tid
, &ti
);
1550 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
1554 static HRESULT WINAPI
ITextRange_fnInvoke(ITextRange
*me
, DISPID dispIdMember
, REFIID riid
,
1555 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1556 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
1559 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1563 TRACE("(%p)->(%d, %s, %d, %u, %p, %p, %p, %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
1564 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1566 hr
= get_typeinfo(ITextRange_tid
, &ti
);
1568 hr
= ITypeInfo_Invoke(ti
, me
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1572 static HRESULT WINAPI
ITextRange_fnGetText(ITextRange
*me
, BSTR
*str
)
1574 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1575 ME_TextEditor
*editor
;
1576 ME_Cursor start
, end
;
1580 TRACE("(%p)->(%p)\n", This
, str
);
1582 if (!This
->child
.reole
)
1583 return CO_E_RELEASED
;
1586 return E_INVALIDARG
;
1588 /* return early for degenerate range */
1589 if (This
->start
== This
->end
) {
1594 editor
= This
->child
.reole
->editor
;
1595 ME_CursorFromCharOfs(editor
, This
->start
, &start
);
1596 ME_CursorFromCharOfs(editor
, This
->end
, &end
);
1598 length
= This
->end
- This
->start
;
1599 *str
= SysAllocStringLen(NULL
, length
);
1601 return E_OUTOFMEMORY
;
1603 bEOP
= (end
.pRun
->next
->type
== diTextEnd
&& This
->end
> ME_GetTextLength(editor
));
1604 ME_GetTextW(editor
, *str
, length
, &start
, length
, FALSE
, bEOP
);
1608 static HRESULT WINAPI
ITextRange_fnSetText(ITextRange
*me
, BSTR str
)
1610 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1611 ME_TextEditor
*editor
;
1616 TRACE("(%p)->(%s)\n", This
, debugstr_w(str
));
1618 if (!This
->child
.reole
)
1619 return CO_E_RELEASED
;
1621 editor
= This
->child
.reole
->editor
;
1623 /* delete only where's something to delete */
1624 if (This
->start
!= This
->end
) {
1625 ME_CursorFromCharOfs(editor
, This
->start
, &cursor
);
1626 ME_InternalDeleteText(editor
, &cursor
, This
->end
- This
->start
, FALSE
);
1629 if (!str
|| !*str
) {
1630 /* will update this range as well */
1631 textranges_update_ranges(This
->child
.reole
, This
->start
, This
->end
, RANGE_UPDATE_DELETE
);
1635 /* it's safer not to rely on stored BSTR length */
1637 cursor
= editor
->pCursors
[0];
1638 ME_CursorFromCharOfs(editor
, This
->start
, &editor
->pCursors
[0]);
1639 style
= ME_GetInsertStyle(editor
, 0);
1640 ME_InsertTextFromCursor(editor
, 0, str
, len
, style
);
1641 ME_ReleaseStyle(style
);
1642 editor
->pCursors
[0] = cursor
;
1644 if (len
< This
->end
- This
->start
)
1645 textranges_update_ranges(This
->child
.reole
, This
->start
+ len
, This
->end
, RANGE_UPDATE_DELETE
);
1647 This
->end
= len
- This
->start
;
1652 static HRESULT
range_GetChar(ME_TextEditor
*editor
, ME_Cursor
*cursor
, LONG
*pch
)
1656 ME_GetTextW(editor
, wch
, 1, cursor
, 1, FALSE
, cursor
->pRun
->next
->type
== diTextEnd
);
1662 static HRESULT WINAPI
ITextRange_fnGetChar(ITextRange
*me
, LONG
*pch
)
1664 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1665 ME_TextEditor
*editor
;
1668 TRACE("(%p)->(%p)\n", This
, pch
);
1670 if (!This
->child
.reole
)
1671 return CO_E_RELEASED
;
1674 return E_INVALIDARG
;
1676 editor
= This
->child
.reole
->editor
;
1677 ME_CursorFromCharOfs(editor
, This
->start
, &cursor
);
1678 return range_GetChar(editor
, &cursor
, pch
);
1681 static HRESULT WINAPI
ITextRange_fnSetChar(ITextRange
*me
, LONG ch
)
1683 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1685 FIXME("(%p)->(%x): stub\n", This
, ch
);
1687 if (!This
->child
.reole
)
1688 return CO_E_RELEASED
;
1693 static HRESULT
CreateITextRange(IRichEditOleImpl
*reOle
, LONG start
, LONG end
, ITextRange
** ppRange
);
1695 static HRESULT WINAPI
ITextRange_fnGetDuplicate(ITextRange
*me
, ITextRange
**ppRange
)
1697 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1699 TRACE("(%p)->(%p)\n", This
, ppRange
);
1701 if (!This
->child
.reole
)
1702 return CO_E_RELEASED
;
1705 return E_INVALIDARG
;
1707 return CreateITextRange(This
->child
.reole
, This
->start
, This
->end
, ppRange
);
1710 static HRESULT WINAPI
ITextRange_fnGetFormattedText(ITextRange
*me
, ITextRange
**range
)
1712 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1714 FIXME("(%p)->(%p): stub\n", This
, range
);
1716 if (!This
->child
.reole
)
1717 return CO_E_RELEASED
;
1722 static HRESULT WINAPI
ITextRange_fnSetFormattedText(ITextRange
*me
, ITextRange
*range
)
1724 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1726 FIXME("(%p)->(%p): stub\n", This
, range
);
1728 if (!This
->child
.reole
)
1729 return CO_E_RELEASED
;
1734 static HRESULT WINAPI
ITextRange_fnGetStart(ITextRange
*me
, LONG
*start
)
1736 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1738 TRACE("(%p)->(%p)\n", This
, start
);
1740 if (!This
->child
.reole
)
1741 return CO_E_RELEASED
;
1744 return E_INVALIDARG
;
1746 *start
= This
->start
;
1750 static HRESULT
textrange_setstart(const IRichEditOleImpl
*reole
, LONG value
, LONG
*start
, LONG
*end
)
1757 if (value
== *start
)
1760 if (value
<= *end
) {
1765 len
= ME_GetTextLength(reole
->editor
);
1766 *start
= *end
= value
> len
? len
: value
;
1770 static HRESULT WINAPI
ITextRange_fnSetStart(ITextRange
*me
, LONG value
)
1772 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1774 TRACE("(%p)->(%d)\n", This
, value
);
1776 if (!This
->child
.reole
)
1777 return CO_E_RELEASED
;
1779 return textrange_setstart(This
->child
.reole
, value
, &This
->start
, &This
->end
);
1782 static HRESULT WINAPI
ITextRange_fnGetEnd(ITextRange
*me
, LONG
*end
)
1784 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1786 TRACE("(%p)->(%p)\n", This
, end
);
1788 if (!This
->child
.reole
)
1789 return CO_E_RELEASED
;
1792 return E_INVALIDARG
;
1798 static HRESULT
textrange_setend(const IRichEditOleImpl
*reole
, LONG value
, LONG
*start
, LONG
*end
)
1805 if (value
< *start
) {
1806 *start
= *end
= max(0, value
);
1810 len
= ME_GetTextLength(reole
->editor
);
1811 *end
= value
> len
? len
+ 1 : value
;
1815 static HRESULT WINAPI
ITextRange_fnSetEnd(ITextRange
*me
, LONG value
)
1817 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1819 TRACE("(%p)->(%d)\n", This
, value
);
1821 if (!This
->child
.reole
)
1822 return CO_E_RELEASED
;
1824 return textrange_setend(This
->child
.reole
, value
, &This
->start
, &This
->end
);
1827 static HRESULT WINAPI
ITextRange_fnGetFont(ITextRange
*me
, ITextFont
**font
)
1829 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1831 TRACE("(%p)->(%p)\n", This
, font
);
1833 if (!This
->child
.reole
)
1834 return CO_E_RELEASED
;
1837 return E_INVALIDARG
;
1839 return create_textfont(me
, NULL
, font
);
1842 static HRESULT WINAPI
ITextRange_fnSetFont(ITextRange
*me
, ITextFont
*font
)
1844 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1846 TRACE("(%p)->(%p)\n", This
, font
);
1849 return E_INVALIDARG
;
1851 if (!This
->child
.reole
)
1852 return CO_E_RELEASED
;
1854 textrange_set_font(me
, font
);
1858 static HRESULT WINAPI
ITextRange_fnGetPara(ITextRange
*me
, ITextPara
**para
)
1860 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1862 TRACE("(%p)->(%p)\n", This
, para
);
1864 if (!This
->child
.reole
)
1865 return CO_E_RELEASED
;
1868 return E_INVALIDARG
;
1870 return create_textpara(me
, para
);
1873 static HRESULT WINAPI
ITextRange_fnSetPara(ITextRange
*me
, ITextPara
*para
)
1875 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1877 FIXME("(%p)->(%p): stub\n", This
, para
);
1879 if (!This
->child
.reole
)
1880 return CO_E_RELEASED
;
1885 static HRESULT WINAPI
ITextRange_fnGetStoryLength(ITextRange
*me
, LONG
*length
)
1887 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1889 TRACE("(%p)->(%p)\n", This
, length
);
1891 if (!This
->child
.reole
)
1892 return CO_E_RELEASED
;
1894 return textrange_get_storylength(This
->child
.reole
->editor
, length
);
1897 static HRESULT WINAPI
ITextRange_fnGetStoryType(ITextRange
*me
, LONG
*value
)
1899 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1901 TRACE("(%p)->(%p)\n", This
, value
);
1903 if (!This
->child
.reole
)
1904 return CO_E_RELEASED
;
1907 return E_INVALIDARG
;
1909 *value
= tomUnknownStory
;
1913 static HRESULT
range_Collapse(LONG bStart
, LONG
*start
, LONG
*end
)
1918 if (bStart
== tomEnd
)
1925 static HRESULT WINAPI
ITextRange_fnCollapse(ITextRange
*me
, LONG bStart
)
1927 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1929 TRACE("(%p)->(%d)\n", This
, bStart
);
1931 if (!This
->child
.reole
)
1932 return CO_E_RELEASED
;
1934 return range_Collapse(bStart
, &This
->start
, &This
->end
);
1937 static HRESULT WINAPI
ITextRange_fnExpand(ITextRange
*me
, LONG unit
, LONG
*delta
)
1939 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1941 TRACE("(%p)->(%d %p)\n", This
, unit
, delta
);
1943 if (!This
->child
.reole
)
1944 return CO_E_RELEASED
;
1946 return textrange_expand(me
, unit
, delta
);
1949 static HRESULT WINAPI
ITextRange_fnGetIndex(ITextRange
*me
, LONG unit
, LONG
*index
)
1951 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1953 FIXME("(%p)->(%d %p): stub\n", This
, unit
, index
);
1955 if (!This
->child
.reole
)
1956 return CO_E_RELEASED
;
1961 static HRESULT WINAPI
ITextRange_fnSetIndex(ITextRange
*me
, LONG unit
, LONG index
,
1964 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1966 FIXME("(%p)->(%d %d %d): stub\n", This
, unit
, index
, extend
);
1968 if (!This
->child
.reole
)
1969 return CO_E_RELEASED
;
1974 static HRESULT WINAPI
ITextRange_fnSetRange(ITextRange
*me
, LONG anchor
, LONG active
)
1976 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1978 FIXME("(%p)->(%d %d): stub\n", This
, anchor
, active
);
1980 if (!This
->child
.reole
)
1981 return CO_E_RELEASED
;
1986 static HRESULT
textrange_inrange(LONG start
, LONG end
, ITextRange
*range
, LONG
*ret
)
1993 if (FAILED(ITextRange_GetStart(range
, &from
)) || FAILED(ITextRange_GetEnd(range
, &to
))) {
1997 *ret
= (start
>= from
&& end
<= to
) ? tomTrue
: tomFalse
;
1998 return *ret
== tomTrue
? S_OK
: S_FALSE
;
2001 static HRESULT WINAPI
ITextRange_fnInRange(ITextRange
*me
, ITextRange
*range
, LONG
*ret
)
2003 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2005 TRACE("(%p)->(%p %p)\n", This
, range
, ret
);
2010 if (!This
->child
.reole
)
2011 return CO_E_RELEASED
;
2016 return textrange_inrange(This
->start
, This
->end
, range
, ret
);
2019 static HRESULT WINAPI
ITextRange_fnInStory(ITextRange
*me
, ITextRange
*pRange
, LONG
*ret
)
2021 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2023 FIXME("(%p)->(%p): stub\n", This
, ret
);
2025 if (!This
->child
.reole
)
2026 return CO_E_RELEASED
;
2031 static HRESULT
textrange_isequal(LONG start
, LONG end
, ITextRange
*range
, LONG
*ret
)
2038 if (FAILED(ITextRange_GetStart(range
, &from
)) || FAILED(ITextRange_GetEnd(range
, &to
))) {
2042 *ret
= (start
== from
&& end
== to
) ? tomTrue
: tomFalse
;
2043 return *ret
== tomTrue
? S_OK
: S_FALSE
;
2046 static HRESULT WINAPI
ITextRange_fnIsEqual(ITextRange
*me
, ITextRange
*range
, LONG
*ret
)
2048 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2050 TRACE("(%p)->(%p %p)\n", This
, range
, ret
);
2055 if (!This
->child
.reole
)
2056 return CO_E_RELEASED
;
2061 return textrange_isequal(This
->start
, This
->end
, range
, ret
);
2064 static HRESULT WINAPI
ITextRange_fnSelect(ITextRange
*me
)
2066 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2068 TRACE("(%p)\n", This
);
2070 if (!This
->child
.reole
)
2071 return CO_E_RELEASED
;
2073 ME_SetSelection(This
->child
.reole
->editor
, This
->start
, This
->end
);
2077 static HRESULT WINAPI
ITextRange_fnStartOf(ITextRange
*me
, LONG unit
, LONG extend
,
2080 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2082 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, extend
, delta
);
2084 if (!This
->child
.reole
)
2085 return CO_E_RELEASED
;
2090 static HRESULT WINAPI
ITextRange_fnEndOf(ITextRange
*me
, LONG unit
, LONG extend
,
2093 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2095 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, extend
, delta
);
2097 if (!This
->child
.reole
)
2098 return CO_E_RELEASED
;
2103 static HRESULT WINAPI
ITextRange_fnMove(ITextRange
*me
, LONG unit
, LONG count
, LONG
*delta
)
2105 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2107 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, count
, delta
);
2109 if (!This
->child
.reole
)
2110 return CO_E_RELEASED
;
2115 static HRESULT WINAPI
ITextRange_fnMoveStart(ITextRange
*me
, LONG unit
, LONG count
,
2118 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2120 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, count
, delta
);
2122 if (!This
->child
.reole
)
2123 return CO_E_RELEASED
;
2128 static HRESULT WINAPI
ITextRange_fnMoveEnd(ITextRange
*me
, LONG unit
, LONG count
,
2131 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2133 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, count
, delta
);
2135 if (!This
->child
.reole
)
2136 return CO_E_RELEASED
;
2141 static HRESULT WINAPI
ITextRange_fnMoveWhile(ITextRange
*me
, VARIANT
*charset
, LONG count
,
2144 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2146 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
2148 if (!This
->child
.reole
)
2149 return CO_E_RELEASED
;
2154 static HRESULT WINAPI
ITextRange_fnMoveStartWhile(ITextRange
*me
, VARIANT
*charset
, LONG count
,
2157 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2159 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
2161 if (!This
->child
.reole
)
2162 return CO_E_RELEASED
;
2167 static HRESULT WINAPI
ITextRange_fnMoveEndWhile(ITextRange
*me
, VARIANT
*charset
, LONG count
,
2170 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2172 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
2174 if (!This
->child
.reole
)
2175 return CO_E_RELEASED
;
2180 static HRESULT WINAPI
ITextRange_fnMoveUntil(ITextRange
*me
, VARIANT
*charset
, LONG count
,
2183 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2185 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
2187 if (!This
->child
.reole
)
2188 return CO_E_RELEASED
;
2193 static HRESULT WINAPI
ITextRange_fnMoveStartUntil(ITextRange
*me
, VARIANT
*charset
, LONG count
,
2196 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2198 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
2200 if (!This
->child
.reole
)
2201 return CO_E_RELEASED
;
2206 static HRESULT WINAPI
ITextRange_fnMoveEndUntil(ITextRange
*me
, VARIANT
*charset
, LONG count
,
2209 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2211 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
2213 if (!This
->child
.reole
)
2214 return CO_E_RELEASED
;
2219 static HRESULT WINAPI
ITextRange_fnFindText(ITextRange
*me
, BSTR text
, LONG count
, LONG flags
,
2222 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2224 FIXME("(%p)->(%s %d %x %p): stub\n", This
, debugstr_w(text
), count
, flags
, length
);
2226 if (!This
->child
.reole
)
2227 return CO_E_RELEASED
;
2232 static HRESULT WINAPI
ITextRange_fnFindTextStart(ITextRange
*me
, BSTR text
, LONG count
,
2233 LONG flags
, LONG
*length
)
2235 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2237 FIXME("(%p)->(%s %d %x %p): stub\n", This
, debugstr_w(text
), count
, flags
, length
);
2239 if (!This
->child
.reole
)
2240 return CO_E_RELEASED
;
2245 static HRESULT WINAPI
ITextRange_fnFindTextEnd(ITextRange
*me
, BSTR text
, LONG count
,
2246 LONG flags
, LONG
*length
)
2248 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2250 FIXME("(%p)->(%s %d %x %p): stub\n", This
, debugstr_w(text
), count
, flags
, length
);
2252 if (!This
->child
.reole
)
2253 return CO_E_RELEASED
;
2258 static HRESULT WINAPI
ITextRange_fnDelete(ITextRange
*me
, LONG unit
, LONG count
, LONG
*delta
)
2260 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2262 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, count
, delta
);
2264 if (!This
->child
.reole
)
2265 return CO_E_RELEASED
;
2270 static HRESULT WINAPI
ITextRange_fnCut(ITextRange
*me
, VARIANT
*v
)
2272 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2274 FIXME("(%p)->(%p): stub\n", This
, v
);
2276 if (!This
->child
.reole
)
2277 return CO_E_RELEASED
;
2282 static HRESULT WINAPI
ITextRange_fnCopy(ITextRange
*me
, VARIANT
*v
)
2284 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2286 FIXME("(%p)->(%p): stub\n", This
, v
);
2288 if (!This
->child
.reole
)
2289 return CO_E_RELEASED
;
2294 static HRESULT WINAPI
ITextRange_fnPaste(ITextRange
*me
, VARIANT
*v
, LONG format
)
2296 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2298 FIXME("(%p)->(%s %x): stub\n", This
, debugstr_variant(v
), format
);
2300 if (!This
->child
.reole
)
2301 return CO_E_RELEASED
;
2306 static HRESULT WINAPI
ITextRange_fnCanPaste(ITextRange
*me
, VARIANT
*v
, LONG format
, LONG
*ret
)
2308 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2310 FIXME("(%p)->(%s %x %p): stub\n", This
, debugstr_variant(v
), format
, ret
);
2312 if (!This
->child
.reole
)
2313 return CO_E_RELEASED
;
2318 static HRESULT WINAPI
ITextRange_fnCanEdit(ITextRange
*me
, LONG
*ret
)
2320 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2322 FIXME("(%p)->(%p): stub\n", This
, ret
);
2324 if (!This
->child
.reole
)
2325 return CO_E_RELEASED
;
2330 static HRESULT WINAPI
ITextRange_fnChangeCase(ITextRange
*me
, LONG type
)
2332 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2334 FIXME("(%p)->(%d): stub\n", This
, type
);
2336 if (!This
->child
.reole
)
2337 return CO_E_RELEASED
;
2342 static HRESULT WINAPI
ITextRange_fnGetPoint(ITextRange
*me
, LONG type
, LONG
*cx
, LONG
*cy
)
2344 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2346 FIXME("(%p)->(%d %p %p): stub\n", This
, type
, cx
, cy
);
2348 if (!This
->child
.reole
)
2349 return CO_E_RELEASED
;
2354 static HRESULT WINAPI
ITextRange_fnSetPoint(ITextRange
*me
, LONG x
, LONG y
, LONG type
,
2357 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2359 FIXME("(%p)->(%d %d %d %d): stub\n", This
, x
, y
, type
, extend
);
2361 if (!This
->child
.reole
)
2362 return CO_E_RELEASED
;
2367 static HRESULT WINAPI
ITextRange_fnScrollIntoView(ITextRange
*me
, LONG value
)
2369 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2370 ME_TextEditor
*editor
;
2374 TRACE("(%p)->(%d)\n", This
, value
);
2376 if (!This
->child
.reole
)
2377 return CO_E_RELEASED
;
2379 editor
= This
->child
.reole
->editor
;
2384 ME_CursorFromCharOfs(editor
, This
->start
, &cursor
);
2385 ME_GetCursorCoordinates(editor
, &cursor
, &x
, &y
, &height
);
2388 FIXME("bStart value %d not handled\n", value
);
2391 ME_ScrollAbs(editor
, x
, y
);
2395 static HRESULT WINAPI
ITextRange_fnGetEmbeddedObject(ITextRange
*me
, IUnknown
**ppv
)
2397 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2399 FIXME("(%p)->(%p): stub\n", This
, ppv
);
2401 if (!This
->child
.reole
)
2402 return CO_E_RELEASED
;
2407 static const ITextRangeVtbl trvt
= {
2408 ITextRange_fnQueryInterface
,
2409 ITextRange_fnAddRef
,
2410 ITextRange_fnRelease
,
2411 ITextRange_fnGetTypeInfoCount
,
2412 ITextRange_fnGetTypeInfo
,
2413 ITextRange_fnGetIDsOfNames
,
2414 ITextRange_fnInvoke
,
2415 ITextRange_fnGetText
,
2416 ITextRange_fnSetText
,
2417 ITextRange_fnGetChar
,
2418 ITextRange_fnSetChar
,
2419 ITextRange_fnGetDuplicate
,
2420 ITextRange_fnGetFormattedText
,
2421 ITextRange_fnSetFormattedText
,
2422 ITextRange_fnGetStart
,
2423 ITextRange_fnSetStart
,
2424 ITextRange_fnGetEnd
,
2425 ITextRange_fnSetEnd
,
2426 ITextRange_fnGetFont
,
2427 ITextRange_fnSetFont
,
2428 ITextRange_fnGetPara
,
2429 ITextRange_fnSetPara
,
2430 ITextRange_fnGetStoryLength
,
2431 ITextRange_fnGetStoryType
,
2432 ITextRange_fnCollapse
,
2433 ITextRange_fnExpand
,
2434 ITextRange_fnGetIndex
,
2435 ITextRange_fnSetIndex
,
2436 ITextRange_fnSetRange
,
2437 ITextRange_fnInRange
,
2438 ITextRange_fnInStory
,
2439 ITextRange_fnIsEqual
,
2440 ITextRange_fnSelect
,
2441 ITextRange_fnStartOf
,
2444 ITextRange_fnMoveStart
,
2445 ITextRange_fnMoveEnd
,
2446 ITextRange_fnMoveWhile
,
2447 ITextRange_fnMoveStartWhile
,
2448 ITextRange_fnMoveEndWhile
,
2449 ITextRange_fnMoveUntil
,
2450 ITextRange_fnMoveStartUntil
,
2451 ITextRange_fnMoveEndUntil
,
2452 ITextRange_fnFindText
,
2453 ITextRange_fnFindTextStart
,
2454 ITextRange_fnFindTextEnd
,
2455 ITextRange_fnDelete
,
2459 ITextRange_fnCanPaste
,
2460 ITextRange_fnCanEdit
,
2461 ITextRange_fnChangeCase
,
2462 ITextRange_fnGetPoint
,
2463 ITextRange_fnSetPoint
,
2464 ITextRange_fnScrollIntoView
,
2465 ITextRange_fnGetEmbeddedObject
2469 static HRESULT WINAPI
TextFont_QueryInterface(ITextFont
*iface
, REFIID riid
, void **ppv
)
2471 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2473 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
2475 if (IsEqualIID(riid
, &IID_ITextFont
) ||
2476 IsEqualIID(riid
, &IID_IDispatch
) ||
2477 IsEqualIID(riid
, &IID_IUnknown
))
2480 ITextFont_AddRef(iface
);
2485 return E_NOINTERFACE
;
2488 static ULONG WINAPI
TextFont_AddRef(ITextFont
*iface
)
2490 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2491 ULONG ref
= InterlockedIncrement(&This
->ref
);
2492 TRACE("(%p)->(%u)\n", This
, ref
);
2496 static ULONG WINAPI
TextFont_Release(ITextFont
*iface
)
2498 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2499 ULONG ref
= InterlockedDecrement(&This
->ref
);
2501 TRACE("(%p)->(%u)\n", This
, ref
);
2506 ITextRange_Release(This
->range
);
2507 SysFreeString(This
->props
[FONT_NAME
].str
);
2514 static HRESULT WINAPI
TextFont_GetTypeInfoCount(ITextFont
*iface
, UINT
*pctinfo
)
2516 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2517 TRACE("(%p)->(%p)\n", This
, pctinfo
);
2522 static HRESULT WINAPI
TextFont_GetTypeInfo(ITextFont
*iface
, UINT iTInfo
, LCID lcid
,
2523 ITypeInfo
**ppTInfo
)
2525 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2528 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
2530 hr
= get_typeinfo(ITextFont_tid
, ppTInfo
);
2532 ITypeInfo_AddRef(*ppTInfo
);
2536 static HRESULT WINAPI
TextFont_GetIDsOfNames(ITextFont
*iface
, REFIID riid
,
2537 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
2539 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2543 TRACE("(%p)->(%s, %p, %u, %d, %p)\n", This
, debugstr_guid(riid
),
2544 rgszNames
, cNames
, lcid
, rgDispId
);
2546 hr
= get_typeinfo(ITextFont_tid
, &ti
);
2548 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
2552 static HRESULT WINAPI
TextFont_Invoke(
2554 DISPID dispIdMember
,
2558 DISPPARAMS
*pDispParams
,
2559 VARIANT
*pVarResult
,
2560 EXCEPINFO
*pExcepInfo
,
2563 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2567 TRACE("(%p)->(%d, %s, %d, %u, %p, %p, %p, %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
2568 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2570 hr
= get_typeinfo(ITextFont_tid
, &ti
);
2572 hr
= ITypeInfo_Invoke(ti
, iface
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2576 static HRESULT WINAPI
TextFont_GetDuplicate(ITextFont
*iface
, ITextFont
**ret
)
2578 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2580 TRACE("(%p)->(%p)\n", This
, ret
);
2583 return E_INVALIDARG
;
2586 if (This
->range
&& !get_range_reole(This
->range
))
2587 return CO_E_RELEASED
;
2589 return create_textfont(NULL
, This
, ret
);
2592 static HRESULT WINAPI
TextFont_SetDuplicate(ITextFont
*iface
, ITextFont
*pFont
)
2594 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2595 FIXME("(%p)->(%p): stub\n", This
, pFont
);
2599 static HRESULT WINAPI
TextFont_CanChange(ITextFont
*iface
, LONG
*ret
)
2601 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2602 FIXME("(%p)->(%p): stub\n", This
, ret
);
2606 static HRESULT WINAPI
TextFont_IsEqual(ITextFont
*iface
, ITextFont
*font
, LONG
*ret
)
2608 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2609 FIXME("(%p)->(%p %p): stub\n", This
, font
, ret
);
2613 static void textfont_reset_to_default(ITextFontImpl
*font
)
2615 enum textfont_prop_id id
;
2617 for (id
= FONT_PROPID_FIRST
; id
< FONT_PROPID_LAST
; id
++) {
2621 case FONT_ANIMATION
:
2628 case FONT_PROTECTED
:
2630 case FONT_SMALLCAPS
:
2631 case FONT_STRIKETHROUGH
:
2632 case FONT_SUBSCRIPT
:
2633 case FONT_SUPERSCRIPT
:
2634 case FONT_UNDERLINE
:
2635 font
->props
[id
].l
= tomFalse
;
2637 case FONT_BACKCOLOR
:
2638 case FONT_FORECOLOR
:
2639 font
->props
[id
].l
= tomAutoColor
;
2645 font
->props
[id
].f
= 0.0;
2648 font
->props
[id
].l
= GetSystemDefaultLCID();
2651 static const WCHAR sysW
[] = {'S','y','s','t','e','m',0};
2652 SysFreeString(font
->props
[id
].str
);
2653 font
->props
[id
].str
= SysAllocString(sysW
);
2657 font
->props
[id
].l
= FW_NORMAL
;
2660 FIXME("font property %d not handled\n", id
);
2665 static void textfont_reset_to_undefined(ITextFontImpl
*font
)
2667 enum textfont_prop_id id
;
2669 for (id
= FONT_PROPID_FIRST
; id
< FONT_PROPID_LAST
; id
++) {
2673 case FONT_ANIMATION
:
2680 case FONT_PROTECTED
:
2682 case FONT_SMALLCAPS
:
2683 case FONT_STRIKETHROUGH
:
2684 case FONT_SUBSCRIPT
:
2685 case FONT_SUPERSCRIPT
:
2686 case FONT_UNDERLINE
:
2687 case FONT_BACKCOLOR
:
2688 case FONT_FORECOLOR
:
2691 font
->props
[id
].l
= tomUndefined
;
2697 font
->props
[id
].f
= tomUndefined
;
2702 FIXME("font property %d not handled\n", id
);
2707 static void textfont_apply_range_props(ITextFontImpl
*font
)
2709 enum textfont_prop_id propid
;
2710 for (propid
= FONT_PROPID_FIRST
; propid
< FONT_PROPID_LAST
; propid
++)
2711 set_textfont_prop(font
, propid
, &font
->props
[propid
]);
2714 static HRESULT WINAPI
TextFont_Reset(ITextFont
*iface
, LONG value
)
2716 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2718 TRACE("(%p)->(%d)\n", This
, value
);
2720 /* If font is attached to a range, released or not, we can't
2721 reset to undefined */
2723 if (!get_range_reole(This
->range
))
2724 return CO_E_RELEASED
;
2729 return E_INVALIDARG
;
2731 textfont_cache_range_props(This
);
2732 This
->get_cache_enabled
= TRUE
;
2735 This
->get_cache_enabled
= FALSE
;
2738 This
->set_cache_enabled
= TRUE
;
2741 This
->set_cache_enabled
= FALSE
;
2742 textfont_apply_range_props(This
);
2746 return E_INVALIDARG
;
2748 FIXME("reset mode %d not supported\n", value
);
2756 /* reset to global defaults */
2758 textfont_reset_to_default(This
);
2760 /* all properties are set to tomUndefined, font name is retained */
2762 textfont_reset_to_undefined(This
);
2771 return E_INVALIDARG
;
2775 FIXME("reset mode %d not supported\n", value
);
2779 static HRESULT WINAPI
TextFont_GetStyle(ITextFont
*iface
, LONG
*value
)
2781 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2782 FIXME("(%p)->(%p): stub\n", This
, value
);
2786 static HRESULT WINAPI
TextFont_SetStyle(ITextFont
*iface
, LONG value
)
2788 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2789 FIXME("(%p)->(%d): stub\n", This
, value
);
2793 static HRESULT WINAPI
TextFont_GetAllCaps(ITextFont
*iface
, LONG
*value
)
2795 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2796 TRACE("(%p)->(%p)\n", This
, value
);
2797 return get_textfont_propl(This
, FONT_ALLCAPS
, value
);
2800 static HRESULT WINAPI
TextFont_SetAllCaps(ITextFont
*iface
, LONG value
)
2802 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2803 TRACE("(%p)->(%d)\n", This
, value
);
2804 return set_textfont_propd(This
, FONT_ALLCAPS
, value
);
2807 static HRESULT WINAPI
TextFont_GetAnimation(ITextFont
*iface
, LONG
*value
)
2809 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2810 TRACE("(%p)->(%p)\n", This
, value
);
2811 return get_textfont_propl(This
, FONT_ANIMATION
, value
);
2814 static HRESULT WINAPI
TextFont_SetAnimation(ITextFont
*iface
, LONG value
)
2816 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2818 TRACE("(%p)->(%d)\n", This
, value
);
2820 if (value
< tomNoAnimation
|| value
> tomAnimationMax
)
2821 return E_INVALIDARG
;
2823 return set_textfont_propl(This
, FONT_ANIMATION
, value
);
2826 static HRESULT WINAPI
TextFont_GetBackColor(ITextFont
*iface
, LONG
*value
)
2828 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2829 TRACE("(%p)->(%p)\n", This
, value
);
2830 return get_textfont_propl(This
, FONT_BACKCOLOR
, value
);
2833 static HRESULT WINAPI
TextFont_SetBackColor(ITextFont
*iface
, LONG value
)
2835 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2836 TRACE("(%p)->(%d)\n", This
, value
);
2837 return set_textfont_propl(This
, FONT_BACKCOLOR
, value
);
2840 static HRESULT WINAPI
TextFont_GetBold(ITextFont
*iface
, LONG
*value
)
2842 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2843 TRACE("(%p)->(%p)\n", This
, value
);
2844 return get_textfont_propl(This
, FONT_BOLD
, value
);
2847 static HRESULT WINAPI
TextFont_SetBold(ITextFont
*iface
, LONG value
)
2849 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2850 TRACE("(%p)->(%d)\n", This
, value
);
2851 return set_textfont_propd(This
, FONT_BOLD
, value
);
2854 static HRESULT WINAPI
TextFont_GetEmboss(ITextFont
*iface
, LONG
*value
)
2856 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2857 TRACE("(%p)->(%p)\n", This
, value
);
2858 return get_textfont_propl(This
, FONT_EMBOSS
, value
);
2861 static HRESULT WINAPI
TextFont_SetEmboss(ITextFont
*iface
, LONG value
)
2863 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2864 TRACE("(%p)->(%d)\n", This
, value
);
2865 return set_textfont_propd(This
, FONT_EMBOSS
, value
);
2868 static HRESULT WINAPI
TextFont_GetForeColor(ITextFont
*iface
, LONG
*value
)
2870 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2871 TRACE("(%p)->(%p)\n", This
, value
);
2872 return get_textfont_propl(This
, FONT_FORECOLOR
, value
);
2875 static HRESULT WINAPI
TextFont_SetForeColor(ITextFont
*iface
, LONG value
)
2877 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2878 TRACE("(%p)->(%d)\n", This
, value
);
2879 return set_textfont_propl(This
, FONT_FORECOLOR
, value
);
2882 static HRESULT WINAPI
TextFont_GetHidden(ITextFont
*iface
, LONG
*value
)
2884 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2885 TRACE("(%p)->(%p)\n", This
, value
);
2886 return get_textfont_propl(This
, FONT_HIDDEN
, value
);
2889 static HRESULT WINAPI
TextFont_SetHidden(ITextFont
*iface
, LONG value
)
2891 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2892 TRACE("(%p)->(%d)\n", This
, value
);
2893 return set_textfont_propd(This
, FONT_HIDDEN
, value
);
2896 static HRESULT WINAPI
TextFont_GetEngrave(ITextFont
*iface
, LONG
*value
)
2898 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2899 TRACE("(%p)->(%p)\n", This
, value
);
2900 return get_textfont_propl(This
, FONT_ENGRAVE
, value
);
2903 static HRESULT WINAPI
TextFont_SetEngrave(ITextFont
*iface
, LONG value
)
2905 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2906 TRACE("(%p)->(%d)\n", This
, value
);
2907 return set_textfont_propd(This
, FONT_ENGRAVE
, value
);
2910 static HRESULT WINAPI
TextFont_GetItalic(ITextFont
*iface
, LONG
*value
)
2912 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2913 TRACE("(%p)->(%p)\n", This
, value
);
2914 return get_textfont_propl(This
, FONT_ITALIC
, value
);
2917 static HRESULT WINAPI
TextFont_SetItalic(ITextFont
*iface
, LONG value
)
2919 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2920 TRACE("(%p)->(%d)\n", This
, value
);
2921 return set_textfont_propd(This
, FONT_ITALIC
, value
);
2924 static HRESULT WINAPI
TextFont_GetKerning(ITextFont
*iface
, FLOAT
*value
)
2926 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2927 TRACE("(%p)->(%p)\n", This
, value
);
2928 return get_textfont_propf(This
, FONT_KERNING
, value
);
2931 static HRESULT WINAPI
TextFont_SetKerning(ITextFont
*iface
, FLOAT value
)
2933 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2934 TRACE("(%p)->(%.2f)\n", This
, value
);
2935 return set_textfont_propf(This
, FONT_KERNING
, value
);
2938 static HRESULT WINAPI
TextFont_GetLanguageID(ITextFont
*iface
, LONG
*value
)
2940 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2941 TRACE("(%p)->(%p)\n", This
, value
);
2942 return get_textfont_propl(This
, FONT_LANGID
, value
);
2945 static HRESULT WINAPI
TextFont_SetLanguageID(ITextFont
*iface
, LONG value
)
2947 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2948 TRACE("(%p)->(%d)\n", This
, value
);
2949 return set_textfont_propl(This
, FONT_LANGID
, value
);
2952 static HRESULT WINAPI
TextFont_GetName(ITextFont
*iface
, BSTR
*value
)
2954 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2956 TRACE("(%p)->(%p)\n", This
, value
);
2959 return E_INVALIDARG
;
2964 if (This
->props
[FONT_NAME
].str
)
2965 *value
= SysAllocString(This
->props
[FONT_NAME
].str
);
2967 *value
= SysAllocStringLen(NULL
, 0);
2968 return *value
? S_OK
: E_OUTOFMEMORY
;
2971 return textfont_getname_from_range(This
->range
, value
);
2974 static HRESULT WINAPI
TextFont_SetName(ITextFont
*iface
, BSTR value
)
2976 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2977 textfont_prop_val v
;
2979 TRACE("(%p)->(%s)\n", This
, debugstr_w(value
));
2982 return set_textfont_prop(This
, FONT_NAME
, &v
);
2985 static HRESULT WINAPI
TextFont_GetOutline(ITextFont
*iface
, LONG
*value
)
2987 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2988 TRACE("(%p)->(%p)\n", This
, value
);
2989 return get_textfont_propl(This
, FONT_OUTLINE
, value
);
2992 static HRESULT WINAPI
TextFont_SetOutline(ITextFont
*iface
, LONG value
)
2994 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2995 TRACE("(%p)->(%d)\n", This
, value
);
2996 return set_textfont_propd(This
, FONT_OUTLINE
, value
);
2999 static HRESULT WINAPI
TextFont_GetPosition(ITextFont
*iface
, FLOAT
*value
)
3001 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3002 TRACE("(%p)->(%p)\n", This
, value
);
3003 return get_textfont_propf(This
, FONT_POSITION
, value
);
3006 static HRESULT WINAPI
TextFont_SetPosition(ITextFont
*iface
, FLOAT value
)
3008 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3009 TRACE("(%p)->(%.2f)\n", This
, value
);
3010 return set_textfont_propf(This
, FONT_POSITION
, value
);
3013 static HRESULT WINAPI
TextFont_GetProtected(ITextFont
*iface
, LONG
*value
)
3015 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3016 TRACE("(%p)->(%p)\n", This
, value
);
3017 return get_textfont_propl(This
, FONT_PROTECTED
, value
);
3020 static HRESULT WINAPI
TextFont_SetProtected(ITextFont
*iface
, LONG value
)
3022 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3023 TRACE("(%p)->(%d)\n", This
, value
);
3024 return set_textfont_propd(This
, FONT_PROTECTED
, value
);
3027 static HRESULT WINAPI
TextFont_GetShadow(ITextFont
*iface
, LONG
*value
)
3029 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3030 TRACE("(%p)->(%p)\n", This
, value
);
3031 return get_textfont_propl(This
, FONT_SHADOW
, value
);
3034 static HRESULT WINAPI
TextFont_SetShadow(ITextFont
*iface
, LONG value
)
3036 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3037 TRACE("(%p)->(%d)\n", This
, value
);
3038 return set_textfont_propd(This
, FONT_SHADOW
, value
);
3041 static HRESULT WINAPI
TextFont_GetSize(ITextFont
*iface
, FLOAT
*value
)
3043 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3044 TRACE("(%p)->(%p)\n", This
, value
);
3045 return get_textfont_propf(This
, FONT_SIZE
, value
);
3048 static HRESULT WINAPI
TextFont_SetSize(ITextFont
*iface
, FLOAT value
)
3050 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3051 TRACE("(%p)->(%.2f)\n", This
, value
);
3052 return set_textfont_propf(This
, FONT_SIZE
, value
);
3055 static HRESULT WINAPI
TextFont_GetSmallCaps(ITextFont
*iface
, LONG
*value
)
3057 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3058 TRACE("(%p)->(%p)\n", This
, value
);
3059 return get_textfont_propl(This
, FONT_SMALLCAPS
, value
);
3062 static HRESULT WINAPI
TextFont_SetSmallCaps(ITextFont
*iface
, LONG value
)
3064 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3065 TRACE("(%p)->(%d)\n", This
, value
);
3066 return set_textfont_propd(This
, FONT_SMALLCAPS
, value
);
3069 static HRESULT WINAPI
TextFont_GetSpacing(ITextFont
*iface
, FLOAT
*value
)
3071 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3072 TRACE("(%p)->(%p)\n", This
, value
);
3073 return get_textfont_propf(This
, FONT_SPACING
, value
);
3076 static HRESULT WINAPI
TextFont_SetSpacing(ITextFont
*iface
, FLOAT value
)
3078 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3079 TRACE("(%p)->(%.2f)\n", This
, value
);
3080 return set_textfont_propf(This
, FONT_SPACING
, value
);
3083 static HRESULT WINAPI
TextFont_GetStrikeThrough(ITextFont
*iface
, LONG
*value
)
3085 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3086 TRACE("(%p)->(%p)\n", This
, value
);
3087 return get_textfont_propl(This
, FONT_STRIKETHROUGH
, value
);
3090 static HRESULT WINAPI
TextFont_SetStrikeThrough(ITextFont
*iface
, LONG value
)
3092 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3093 TRACE("(%p)->(%d)\n", This
, value
);
3094 return set_textfont_propd(This
, FONT_STRIKETHROUGH
, value
);
3097 static HRESULT WINAPI
TextFont_GetSubscript(ITextFont
*iface
, LONG
*value
)
3099 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3100 TRACE("(%p)->(%p)\n", This
, value
);
3101 return get_textfont_propl(This
, FONT_SUBSCRIPT
, value
);
3104 static HRESULT WINAPI
TextFont_SetSubscript(ITextFont
*iface
, LONG value
)
3106 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3107 TRACE("(%p)->(%d)\n", This
, value
);
3108 return set_textfont_propd(This
, FONT_SUBSCRIPT
, value
);
3111 static HRESULT WINAPI
TextFont_GetSuperscript(ITextFont
*iface
, LONG
*value
)
3113 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3114 TRACE("(%p)->(%p)\n", This
, value
);
3115 return get_textfont_propl(This
, FONT_SUPERSCRIPT
, value
);
3118 static HRESULT WINAPI
TextFont_SetSuperscript(ITextFont
*iface
, LONG value
)
3120 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3121 TRACE("(%p)->(%d)\n", This
, value
);
3122 return set_textfont_propd(This
, FONT_SUPERSCRIPT
, value
);
3125 static HRESULT WINAPI
TextFont_GetUnderline(ITextFont
*iface
, LONG
*value
)
3127 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3128 TRACE("(%p)->(%p)\n", This
, value
);
3129 return get_textfont_propl(This
, FONT_UNDERLINE
, value
);
3132 static HRESULT WINAPI
TextFont_SetUnderline(ITextFont
*iface
, LONG value
)
3134 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3135 TRACE("(%p)->(%d)\n", This
, value
);
3136 return set_textfont_propd(This
, FONT_UNDERLINE
, value
);
3139 static HRESULT WINAPI
TextFont_GetWeight(ITextFont
*iface
, LONG
*value
)
3141 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3142 TRACE("(%p)->(%p)\n", This
, value
);
3143 return get_textfont_propl(This
, FONT_WEIGHT
, value
);
3146 static HRESULT WINAPI
TextFont_SetWeight(ITextFont
*iface
, LONG value
)
3148 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3149 TRACE("(%p)->(%d)\n", This
, value
);
3150 return set_textfont_propl(This
, FONT_WEIGHT
, value
);
3153 static ITextFontVtbl textfontvtbl
= {
3154 TextFont_QueryInterface
,
3157 TextFont_GetTypeInfoCount
,
3158 TextFont_GetTypeInfo
,
3159 TextFont_GetIDsOfNames
,
3161 TextFont_GetDuplicate
,
3162 TextFont_SetDuplicate
,
3168 TextFont_GetAllCaps
,
3169 TextFont_SetAllCaps
,
3170 TextFont_GetAnimation
,
3171 TextFont_SetAnimation
,
3172 TextFont_GetBackColor
,
3173 TextFont_SetBackColor
,
3178 TextFont_GetForeColor
,
3179 TextFont_SetForeColor
,
3182 TextFont_GetEngrave
,
3183 TextFont_SetEngrave
,
3186 TextFont_GetKerning
,
3187 TextFont_SetKerning
,
3188 TextFont_GetLanguageID
,
3189 TextFont_SetLanguageID
,
3192 TextFont_GetOutline
,
3193 TextFont_SetOutline
,
3194 TextFont_GetPosition
,
3195 TextFont_SetPosition
,
3196 TextFont_GetProtected
,
3197 TextFont_SetProtected
,
3202 TextFont_GetSmallCaps
,
3203 TextFont_SetSmallCaps
,
3204 TextFont_GetSpacing
,
3205 TextFont_SetSpacing
,
3206 TextFont_GetStrikeThrough
,
3207 TextFont_SetStrikeThrough
,
3208 TextFont_GetSubscript
,
3209 TextFont_SetSubscript
,
3210 TextFont_GetSuperscript
,
3211 TextFont_SetSuperscript
,
3212 TextFont_GetUnderline
,
3213 TextFont_SetUnderline
,
3218 static HRESULT
create_textfont(ITextRange
*range
, const ITextFontImpl
*src
, ITextFont
**ret
)
3220 ITextFontImpl
*font
;
3223 font
= heap_alloc(sizeof(*font
));
3225 return E_OUTOFMEMORY
;
3227 font
->ITextFont_iface
.lpVtbl
= &textfontvtbl
;
3232 font
->get_cache_enabled
= TRUE
;
3233 font
->set_cache_enabled
= TRUE
;
3234 memcpy(&font
->props
, &src
->props
, sizeof(font
->props
));
3235 if (font
->props
[FONT_NAME
].str
)
3236 font
->props
[FONT_NAME
].str
= SysAllocString(font
->props
[FONT_NAME
].str
);
3239 font
->range
= range
;
3240 ITextRange_AddRef(range
);
3242 /* cache current properties */
3243 font
->get_cache_enabled
= FALSE
;
3244 font
->set_cache_enabled
= FALSE
;
3245 textfont_cache_range_props(font
);
3248 *ret
= &font
->ITextFont_iface
;
3253 static HRESULT WINAPI
TextPara_QueryInterface(ITextPara
*iface
, REFIID riid
, void **ppv
)
3255 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3257 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
3259 if (IsEqualIID(riid
, &IID_ITextPara
) ||
3260 IsEqualIID(riid
, &IID_IDispatch
) ||
3261 IsEqualIID(riid
, &IID_IUnknown
))
3264 ITextPara_AddRef(iface
);
3269 return E_NOINTERFACE
;
3272 static ULONG WINAPI
TextPara_AddRef(ITextPara
*iface
)
3274 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3275 ULONG ref
= InterlockedIncrement(&This
->ref
);
3276 TRACE("(%p)->(%u)\n", This
, ref
);
3280 static ULONG WINAPI
TextPara_Release(ITextPara
*iface
)
3282 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3283 ULONG ref
= InterlockedDecrement(&This
->ref
);
3285 TRACE("(%p)->(%u)\n", This
, ref
);
3289 ITextRange_Release(This
->range
);
3296 static HRESULT WINAPI
TextPara_GetTypeInfoCount(ITextPara
*iface
, UINT
*pctinfo
)
3298 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3299 TRACE("(%p)->(%p)\n", This
, pctinfo
);
3304 static HRESULT WINAPI
TextPara_GetTypeInfo(ITextPara
*iface
, UINT iTInfo
, LCID lcid
,
3305 ITypeInfo
**ppTInfo
)
3307 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3310 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
3312 hr
= get_typeinfo(ITextPara_tid
, ppTInfo
);
3314 ITypeInfo_AddRef(*ppTInfo
);
3318 static HRESULT WINAPI
TextPara_GetIDsOfNames(ITextPara
*iface
, REFIID riid
,
3319 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3321 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3325 TRACE("(%p)->(%s, %p, %u, %d, %p)\n", This
, debugstr_guid(riid
), rgszNames
,
3326 cNames
, lcid
, rgDispId
);
3328 hr
= get_typeinfo(ITextPara_tid
, &ti
);
3330 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
3334 static HRESULT WINAPI
TextPara_Invoke(
3336 DISPID dispIdMember
,
3340 DISPPARAMS
*pDispParams
,
3341 VARIANT
*pVarResult
,
3342 EXCEPINFO
*pExcepInfo
,
3345 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3349 TRACE("(%p)->(%d, %s, %d, %u, %p, %p, %p, %p)\n", This
, dispIdMember
,
3350 debugstr_guid(riid
), lcid
, wFlags
, pDispParams
, pVarResult
,
3351 pExcepInfo
, puArgErr
);
3353 hr
= get_typeinfo(ITextPara_tid
, &ti
);
3355 hr
= ITypeInfo_Invoke(ti
, iface
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3359 static HRESULT WINAPI
TextPara_GetDuplicate(ITextPara
*iface
, ITextPara
**ret
)
3361 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3362 FIXME("(%p)->(%p)\n", This
, ret
);
3366 static HRESULT WINAPI
TextPara_SetDuplicate(ITextPara
*iface
, ITextPara
*para
)
3368 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3369 FIXME("(%p)->(%p)\n", This
, para
);
3373 static HRESULT WINAPI
TextPara_CanChange(ITextPara
*iface
, LONG
*ret
)
3375 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3376 FIXME("(%p)->(%p)\n", This
, ret
);
3380 static HRESULT WINAPI
TextPara_IsEqual(ITextPara
*iface
, ITextPara
*para
, LONG
*ret
)
3382 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3383 FIXME("(%p)->(%p %p)\n", This
, para
, ret
);
3387 static HRESULT WINAPI
TextPara_Reset(ITextPara
*iface
, LONG value
)
3389 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3390 FIXME("(%p)->(%d)\n", This
, value
);
3394 static HRESULT WINAPI
TextPara_GetStyle(ITextPara
*iface
, LONG
*value
)
3396 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3397 FIXME("(%p)->(%p)\n", This
, value
);
3401 static HRESULT WINAPI
TextPara_SetStyle(ITextPara
*iface
, LONG value
)
3403 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3404 FIXME("(%p)->(%d)\n", This
, value
);
3408 static HRESULT WINAPI
TextPara_GetAlignment(ITextPara
*iface
, LONG
*value
)
3410 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3411 FIXME("(%p)->(%p)\n", This
, value
);
3415 static HRESULT WINAPI
TextPara_SetAlignment(ITextPara
*iface
, LONG value
)
3417 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3418 FIXME("(%p)->(%d)\n", This
, value
);
3422 static HRESULT WINAPI
TextPara_GetHyphenation(ITextPara
*iface
, LONG
*value
)
3424 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3425 FIXME("(%p)->(%p)\n", This
, value
);
3429 static HRESULT WINAPI
TextPara_SetHyphenation(ITextPara
*iface
, LONG value
)
3431 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3432 FIXME("(%p)->(%d)\n", This
, value
);
3436 static HRESULT WINAPI
TextPara_GetFirstLineIndent(ITextPara
*iface
, FLOAT
*value
)
3438 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3439 FIXME("(%p)->(%p)\n", This
, value
);
3443 static HRESULT WINAPI
TextPara_GetKeepTogether(ITextPara
*iface
, LONG
*value
)
3445 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3446 FIXME("(%p)->(%p)\n", This
, value
);
3450 static HRESULT WINAPI
TextPara_SetKeepTogether(ITextPara
*iface
, LONG value
)
3452 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3453 FIXME("(%p)->(%d)\n", This
, value
);
3457 static HRESULT WINAPI
TextPara_GetKeepWithNext(ITextPara
*iface
, LONG
*value
)
3459 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3460 FIXME("(%p)->(%p)\n", This
, value
);
3464 static HRESULT WINAPI
TextPara_SetKeepWithNext(ITextPara
*iface
, LONG value
)
3466 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3467 FIXME("(%p)->(%d)\n", This
, value
);
3471 static HRESULT WINAPI
TextPara_GetLeftIndent(ITextPara
*iface
, FLOAT
*value
)
3473 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3474 FIXME("(%p)->(%p)\n", This
, value
);
3478 static HRESULT WINAPI
TextPara_GetLineSpacing(ITextPara
*iface
, FLOAT
*value
)
3480 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3481 FIXME("(%p)->(%p)\n", This
, value
);
3485 static HRESULT WINAPI
TextPara_GetLineSpacingRule(ITextPara
*iface
, LONG
*value
)
3487 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3488 FIXME("(%p)->(%p)\n", This
, value
);
3492 static HRESULT WINAPI
TextPara_GetListAlignment(ITextPara
*iface
, LONG
*value
)
3494 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3495 FIXME("(%p)->(%p)\n", This
, value
);
3499 static HRESULT WINAPI
TextPara_SetListAlignment(ITextPara
*iface
, LONG value
)
3501 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3502 FIXME("(%p)->(%d)\n", This
, value
);
3506 static HRESULT WINAPI
TextPara_GetListLevelIndex(ITextPara
*iface
, LONG
*value
)
3508 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3509 FIXME("(%p)->(%p)\n", This
, value
);
3513 static HRESULT WINAPI
TextPara_SetListLevelIndex(ITextPara
*iface
, LONG value
)
3515 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3516 FIXME("(%p)->(%d)\n", This
, value
);
3520 static HRESULT WINAPI
TextPara_GetListStart(ITextPara
*iface
, LONG
*value
)
3522 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3523 FIXME("(%p)->(%p)\n", This
, value
);
3527 static HRESULT WINAPI
TextPara_SetListStart(ITextPara
*iface
, LONG value
)
3529 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3530 FIXME("(%p)->(%d)\n", This
, value
);
3534 static HRESULT WINAPI
TextPara_GetListTab(ITextPara
*iface
, FLOAT
*value
)
3536 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3537 FIXME("(%p)->(%p)\n", This
, value
);
3541 static HRESULT WINAPI
TextPara_SetListTab(ITextPara
*iface
, FLOAT value
)
3543 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3544 FIXME("(%p)->(%.2f)\n", This
, value
);
3548 static HRESULT WINAPI
TextPara_GetListType(ITextPara
*iface
, LONG
*value
)
3550 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3551 FIXME("(%p)->(%p)\n", This
, value
);
3555 static HRESULT WINAPI
TextPara_SetListType(ITextPara
*iface
, LONG value
)
3557 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3558 FIXME("(%p)->(%d)\n", This
, value
);
3562 static HRESULT WINAPI
TextPara_GetNoLineNumber(ITextPara
*iface
, LONG
*value
)
3564 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3565 FIXME("(%p)->(%p)\n", This
, value
);
3569 static HRESULT WINAPI
TextPara_SetNoLineNumber(ITextPara
*iface
, LONG value
)
3571 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3572 FIXME("(%p)->(%d)\n", This
, value
);
3576 static HRESULT WINAPI
TextPara_GetPageBreakBefore(ITextPara
*iface
, LONG
*value
)
3578 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3579 FIXME("(%p)->(%p)\n", This
, value
);
3583 static HRESULT WINAPI
TextPara_SetPageBreakBefore(ITextPara
*iface
, LONG value
)
3585 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3586 FIXME("(%p)->(%d)\n", This
, value
);
3590 static HRESULT WINAPI
TextPara_GetRightIndent(ITextPara
*iface
, FLOAT
*value
)
3592 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3593 FIXME("(%p)->(%p)\n", This
, value
);
3597 static HRESULT WINAPI
TextPara_SetRightIndent(ITextPara
*iface
, FLOAT value
)
3599 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3600 FIXME("(%p)->(%.2f)\n", This
, value
);
3604 static HRESULT WINAPI
TextPara_SetIndents(ITextPara
*iface
, FLOAT StartIndent
, FLOAT LeftIndent
, FLOAT RightIndent
)
3606 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3607 FIXME("(%p)->(%.2f %.2f %.2f)\n", This
, StartIndent
, LeftIndent
, RightIndent
);
3611 static HRESULT WINAPI
TextPara_SetLineSpacing(ITextPara
*iface
, LONG LineSpacingRule
, FLOAT LineSpacing
)
3613 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3614 FIXME("(%p)->(%d %.2f)\n", This
, LineSpacingRule
, LineSpacing
);
3618 static HRESULT WINAPI
TextPara_GetSpaceAfter(ITextPara
*iface
, FLOAT
*value
)
3620 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3621 FIXME("(%p)->(%p)\n", This
, value
);
3625 static HRESULT WINAPI
TextPara_SetSpaceAfter(ITextPara
*iface
, FLOAT value
)
3627 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3628 FIXME("(%p)->(%.2f)\n", This
, value
);
3632 static HRESULT WINAPI
TextPara_GetSpaceBefore(ITextPara
*iface
, FLOAT
*value
)
3634 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3635 FIXME("(%p)->(%p)\n", This
, value
);
3639 static HRESULT WINAPI
TextPara_SetSpaceBefore(ITextPara
*iface
, FLOAT value
)
3641 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3642 FIXME("(%p)->(%.2f)\n", This
, value
);
3646 static HRESULT WINAPI
TextPara_GetWidowControl(ITextPara
*iface
, LONG
*value
)
3648 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3649 FIXME("(%p)->(%p)\n", This
, value
);
3653 static HRESULT WINAPI
TextPara_SetWidowControl(ITextPara
*iface
, LONG value
)
3655 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3656 FIXME("(%p)->(%d)\n", This
, value
);
3660 static HRESULT WINAPI
TextPara_GetTabCount(ITextPara
*iface
, LONG
*value
)
3662 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3663 FIXME("(%p)->(%p)\n", This
, value
);
3667 static HRESULT WINAPI
TextPara_AddTab(ITextPara
*iface
, FLOAT tbPos
, LONG tbAlign
, LONG tbLeader
)
3669 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3670 FIXME("(%p)->(%.2f %d %d)\n", This
, tbPos
, tbAlign
, tbLeader
);
3674 static HRESULT WINAPI
TextPara_ClearAllTabs(ITextPara
*iface
)
3676 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3677 FIXME("(%p)\n", This
);
3681 static HRESULT WINAPI
TextPara_DeleteTab(ITextPara
*iface
, FLOAT pos
)
3683 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3684 FIXME("(%p)->(%.2f)\n", This
, pos
);
3688 static HRESULT WINAPI
TextPara_GetTab(ITextPara
*iface
, LONG iTab
, FLOAT
*ptbPos
, LONG
*ptbAlign
, LONG
*ptbLeader
)
3690 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3691 FIXME("(%p)->(%d %p %p %p)\n", This
, iTab
, ptbPos
, ptbAlign
, ptbLeader
);
3695 static ITextParaVtbl textparavtbl
= {
3696 TextPara_QueryInterface
,
3699 TextPara_GetTypeInfoCount
,
3700 TextPara_GetTypeInfo
,
3701 TextPara_GetIDsOfNames
,
3703 TextPara_GetDuplicate
,
3704 TextPara_SetDuplicate
,
3710 TextPara_GetAlignment
,
3711 TextPara_SetAlignment
,
3712 TextPara_GetHyphenation
,
3713 TextPara_SetHyphenation
,
3714 TextPara_GetFirstLineIndent
,
3715 TextPara_GetKeepTogether
,
3716 TextPara_SetKeepTogether
,
3717 TextPara_GetKeepWithNext
,
3718 TextPara_SetKeepWithNext
,
3719 TextPara_GetLeftIndent
,
3720 TextPara_GetLineSpacing
,
3721 TextPara_GetLineSpacingRule
,
3722 TextPara_GetListAlignment
,
3723 TextPara_SetListAlignment
,
3724 TextPara_GetListLevelIndex
,
3725 TextPara_SetListLevelIndex
,
3726 TextPara_GetListStart
,
3727 TextPara_SetListStart
,
3728 TextPara_GetListTab
,
3729 TextPara_SetListTab
,
3730 TextPara_GetListType
,
3731 TextPara_SetListType
,
3732 TextPara_GetNoLineNumber
,
3733 TextPara_SetNoLineNumber
,
3734 TextPara_GetPageBreakBefore
,
3735 TextPara_SetPageBreakBefore
,
3736 TextPara_GetRightIndent
,
3737 TextPara_SetRightIndent
,
3738 TextPara_SetIndents
,
3739 TextPara_SetLineSpacing
,
3740 TextPara_GetSpaceAfter
,
3741 TextPara_SetSpaceAfter
,
3742 TextPara_GetSpaceBefore
,
3743 TextPara_SetSpaceBefore
,
3744 TextPara_GetWidowControl
,
3745 TextPara_SetWidowControl
,
3746 TextPara_GetTabCount
,
3748 TextPara_ClearAllTabs
,
3753 static HRESULT
create_textpara(ITextRange
*range
, ITextPara
**ret
)
3755 ITextParaImpl
*para
;
3758 para
= heap_alloc(sizeof(*para
));
3760 return E_OUTOFMEMORY
;
3762 para
->ITextPara_iface
.lpVtbl
= &textparavtbl
;
3764 para
->range
= range
;
3765 ITextRange_AddRef(range
);
3767 *ret
= ¶
->ITextPara_iface
;
3772 static HRESULT WINAPI
3773 ITextDocument_fnQueryInterface(ITextDocument
* me
, REFIID riid
,
3776 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3777 return IRichEditOle_QueryInterface(&This
->IRichEditOle_iface
, riid
, ppvObject
);
3781 ITextDocument_fnAddRef(ITextDocument
* me
)
3783 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3784 return IRichEditOle_AddRef(&This
->IRichEditOle_iface
);
3788 ITextDocument_fnRelease(ITextDocument
* me
)
3790 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3791 return IRichEditOle_Release(&This
->IRichEditOle_iface
);
3794 static HRESULT WINAPI
3795 ITextDocument_fnGetTypeInfoCount(ITextDocument
* me
,
3798 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3799 TRACE("(%p)->(%p)\n", This
, pctinfo
);
3804 static HRESULT WINAPI
3805 ITextDocument_fnGetTypeInfo(ITextDocument
* me
, UINT iTInfo
, LCID lcid
,
3806 ITypeInfo
** ppTInfo
)
3808 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3811 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
3813 hr
= get_typeinfo(ITextDocument_tid
, ppTInfo
);
3815 ITypeInfo_AddRef(*ppTInfo
);
3819 static HRESULT WINAPI
3820 ITextDocument_fnGetIDsOfNames(ITextDocument
* me
, REFIID riid
,
3821 LPOLESTR
* rgszNames
, UINT cNames
, LCID lcid
, DISPID
* rgDispId
)
3823 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3827 TRACE("(%p)->(%s, %p, %u, %d, %p)\n", This
, debugstr_guid(riid
),
3828 rgszNames
, cNames
, lcid
, rgDispId
);
3830 hr
= get_typeinfo(ITextDocument_tid
, &ti
);
3832 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
3836 static HRESULT WINAPI
3837 ITextDocument_fnInvoke(ITextDocument
* me
, DISPID dispIdMember
,
3838 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
* pDispParams
,
3839 VARIANT
* pVarResult
, EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
)
3841 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3845 TRACE("(%p)->(%d, %s, %d, %u, %p, %p, %p, %p)\n", This
, dispIdMember
,
3846 debugstr_guid(riid
), lcid
, wFlags
, pDispParams
, pVarResult
,
3847 pExcepInfo
, puArgErr
);
3849 hr
= get_typeinfo(ITextDocument_tid
, &ti
);
3851 hr
= ITypeInfo_Invoke(ti
, me
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3855 static HRESULT WINAPI
3856 ITextDocument_fnGetName(ITextDocument
* me
, BSTR
* pName
)
3858 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3859 FIXME("stub %p\n",This
);
3863 static HRESULT WINAPI
3864 ITextDocument_fnGetSelection(ITextDocument
*me
, ITextSelection
**selection
)
3866 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3868 TRACE("(%p)->(%p)\n", me
, selection
);
3871 return E_INVALIDARG
;
3873 if (!This
->txtSel
) {
3874 This
->txtSel
= CreateTextSelection(This
);
3875 if (!This
->txtSel
) {
3877 return E_OUTOFMEMORY
;
3881 *selection
= &This
->txtSel
->ITextSelection_iface
;
3882 ITextSelection_AddRef(*selection
);
3886 static HRESULT WINAPI
3887 ITextDocument_fnGetStoryCount(ITextDocument
* me
, LONG
* pCount
)
3889 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3890 FIXME("stub %p\n",This
);
3894 static HRESULT WINAPI
3895 ITextDocument_fnGetStoryRanges(ITextDocument
* me
,
3896 ITextStoryRanges
** ppStories
)
3898 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3899 FIXME("stub %p\n",This
);
3903 static HRESULT WINAPI
3904 ITextDocument_fnGetSaved(ITextDocument
* me
, LONG
* pValue
)
3906 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3907 FIXME("stub %p\n",This
);
3911 static HRESULT WINAPI
3912 ITextDocument_fnSetSaved(ITextDocument
* me
, LONG Value
)
3914 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3915 FIXME("stub %p\n",This
);
3919 static HRESULT WINAPI
3920 ITextDocument_fnGetDefaultTabStop(ITextDocument
* me
, float* pValue
)
3922 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3923 FIXME("stub %p\n",This
);
3927 static HRESULT WINAPI
3928 ITextDocument_fnSetDefaultTabStop(ITextDocument
* me
, float Value
)
3930 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3931 FIXME("stub %p\n",This
);
3935 static HRESULT WINAPI
3936 ITextDocument_fnNew(ITextDocument
* me
)
3938 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3939 FIXME("stub %p\n",This
);
3943 static HRESULT WINAPI
3944 ITextDocument_fnOpen(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
3947 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3948 FIXME("stub %p\n",This
);
3952 static HRESULT WINAPI
3953 ITextDocument_fnSave(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
3956 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3957 FIXME("stub %p\n",This
);
3961 static HRESULT WINAPI
3962 ITextDocument_fnFreeze(ITextDocument
* me
, LONG
* pCount
)
3964 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3965 FIXME("stub %p\n",This
);
3969 static HRESULT WINAPI
3970 ITextDocument_fnUnfreeze(ITextDocument
* me
, LONG
* pCount
)
3972 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3973 FIXME("stub %p\n",This
);
3977 static HRESULT WINAPI
3978 ITextDocument_fnBeginEditCollection(ITextDocument
* me
)
3980 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3981 FIXME("stub %p\n",This
);
3985 static HRESULT WINAPI
3986 ITextDocument_fnEndEditCollection(ITextDocument
* me
)
3988 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3989 FIXME("stub %p\n",This
);
3993 static HRESULT WINAPI
3994 ITextDocument_fnUndo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
3996 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3997 FIXME("stub %p\n",This
);
4001 static HRESULT WINAPI
4002 ITextDocument_fnRedo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
4004 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
4005 FIXME("stub %p\n",This
);
4009 static HRESULT
CreateITextRange(IRichEditOleImpl
*reOle
, LONG start
, LONG end
, ITextRange
** ppRange
)
4011 ITextRangeImpl
*txtRge
= heap_alloc(sizeof(ITextRangeImpl
));
4014 return E_OUTOFMEMORY
;
4015 txtRge
->ITextRange_iface
.lpVtbl
= &trvt
;
4017 txtRge
->child
.reole
= reOle
;
4018 txtRge
->start
= start
;
4020 list_add_head(&reOle
->rangelist
, &txtRge
->child
.entry
);
4021 *ppRange
= &txtRge
->ITextRange_iface
;
4025 static HRESULT WINAPI
4026 ITextDocument_fnRange(ITextDocument
* me
, LONG cp1
, LONG cp2
,
4027 ITextRange
** ppRange
)
4029 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
4030 const int len
= ME_GetTextLength(This
->editor
) + 1;
4032 TRACE("%p %p %d %d\n", This
, ppRange
, cp1
, cp2
);
4034 return E_INVALIDARG
;
4038 cp1
= min(cp1
, len
);
4039 cp2
= min(cp2
, len
);
4048 cp1
= cp2
= len
- 1;
4050 return CreateITextRange(This
, cp1
, cp2
, ppRange
);
4053 static HRESULT WINAPI
4054 ITextDocument_fnRangeFromPoint(ITextDocument
* me
, LONG x
, LONG y
,
4055 ITextRange
** ppRange
)
4057 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
4058 FIXME("stub %p\n",This
);
4062 static const ITextDocumentVtbl tdvt
= {
4063 ITextDocument_fnQueryInterface
,
4064 ITextDocument_fnAddRef
,
4065 ITextDocument_fnRelease
,
4066 ITextDocument_fnGetTypeInfoCount
,
4067 ITextDocument_fnGetTypeInfo
,
4068 ITextDocument_fnGetIDsOfNames
,
4069 ITextDocument_fnInvoke
,
4070 ITextDocument_fnGetName
,
4071 ITextDocument_fnGetSelection
,
4072 ITextDocument_fnGetStoryCount
,
4073 ITextDocument_fnGetStoryRanges
,
4074 ITextDocument_fnGetSaved
,
4075 ITextDocument_fnSetSaved
,
4076 ITextDocument_fnGetDefaultTabStop
,
4077 ITextDocument_fnSetDefaultTabStop
,
4078 ITextDocument_fnNew
,
4079 ITextDocument_fnOpen
,
4080 ITextDocument_fnSave
,
4081 ITextDocument_fnFreeze
,
4082 ITextDocument_fnUnfreeze
,
4083 ITextDocument_fnBeginEditCollection
,
4084 ITextDocument_fnEndEditCollection
,
4085 ITextDocument_fnUndo
,
4086 ITextDocument_fnRedo
,
4087 ITextDocument_fnRange
,
4088 ITextDocument_fnRangeFromPoint
4091 /* ITextSelection */
4092 static HRESULT WINAPI
ITextSelection_fnQueryInterface(
4097 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4100 if (IsEqualGUID(riid
, &IID_IUnknown
)
4101 || IsEqualGUID(riid
, &IID_IDispatch
)
4102 || IsEqualGUID(riid
, &IID_ITextRange
)
4103 || IsEqualGUID(riid
, &IID_ITextSelection
))
4106 ITextSelection_AddRef(me
);
4109 else if (IsEqualGUID(riid
, &IID_Igetrichole
))
4111 *ppvObj
= This
->reOle
;
4115 return E_NOINTERFACE
;
4118 static ULONG WINAPI
ITextSelection_fnAddRef(ITextSelection
*me
)
4120 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4121 return InterlockedIncrement(&This
->ref
);
4124 static ULONG WINAPI
ITextSelection_fnRelease(ITextSelection
*me
)
4126 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4127 ULONG ref
= InterlockedDecrement(&This
->ref
);
4133 static HRESULT WINAPI
ITextSelection_fnGetTypeInfoCount(ITextSelection
*me
, UINT
*pctinfo
)
4135 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4136 TRACE("(%p)->(%p)\n", This
, pctinfo
);
4141 static HRESULT WINAPI
ITextSelection_fnGetTypeInfo(ITextSelection
*me
, UINT iTInfo
, LCID lcid
,
4142 ITypeInfo
**ppTInfo
)
4144 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4147 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
4149 hr
= get_typeinfo(ITextSelection_tid
, ppTInfo
);
4151 ITypeInfo_AddRef(*ppTInfo
);
4155 static HRESULT WINAPI
ITextSelection_fnGetIDsOfNames(ITextSelection
*me
, REFIID riid
,
4156 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4158 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4162 TRACE("(%p)->(%s, %p, %u, %d, %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
,
4165 hr
= get_typeinfo(ITextSelection_tid
, &ti
);
4167 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
4171 static HRESULT WINAPI
ITextSelection_fnInvoke(
4173 DISPID dispIdMember
,
4177 DISPPARAMS
*pDispParams
,
4178 VARIANT
*pVarResult
,
4179 EXCEPINFO
*pExcepInfo
,
4182 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4186 TRACE("(%p)->(%d, %s, %d, %u, %p, %p, %p, %p)\n", This
, dispIdMember
, debugstr_guid(riid
), lcid
,
4187 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4189 hr
= get_typeinfo(ITextSelection_tid
, &ti
);
4191 hr
= ITypeInfo_Invoke(ti
, me
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4195 /*** ITextRange methods ***/
4196 static HRESULT WINAPI
ITextSelection_fnGetText(ITextSelection
*me
, BSTR
*pbstr
)
4198 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4199 ME_Cursor
*start
= NULL
, *end
= NULL
;
4203 TRACE("(%p)->(%p)\n", This
, pbstr
);
4206 return CO_E_RELEASED
;
4209 return E_INVALIDARG
;
4211 ME_GetSelection(This
->reOle
->editor
, &start
, &end
);
4212 endOfs
= ME_GetCursorOfs(end
);
4213 nChars
= endOfs
- ME_GetCursorOfs(start
);
4220 *pbstr
= SysAllocStringLen(NULL
, nChars
);
4222 return E_OUTOFMEMORY
;
4224 bEOP
= (end
->pRun
->next
->type
== diTextEnd
&& endOfs
> ME_GetTextLength(This
->reOle
->editor
));
4225 ME_GetTextW(This
->reOle
->editor
, *pbstr
, nChars
, start
, nChars
, FALSE
, bEOP
);
4226 TRACE("%s\n", wine_dbgstr_w(*pbstr
));
4231 static HRESULT WINAPI
ITextSelection_fnSetText(ITextSelection
*me
, BSTR str
)
4233 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4234 ME_TextEditor
*editor
;
4237 TRACE("(%p)->(%s)\n", This
, debugstr_w(str
));
4240 return CO_E_RELEASED
;
4242 editor
= This
->reOle
->editor
;
4244 ME_GetSelectionOfs(editor
, &from
, &to
);
4245 ME_ReplaceSel(editor
, FALSE
, str
, len
);
4247 if (len
< to
- from
)
4248 textranges_update_ranges(This
->reOle
, from
, len
, RANGE_UPDATE_DELETE
);
4253 static HRESULT WINAPI
ITextSelection_fnGetChar(ITextSelection
*me
, LONG
*pch
)
4255 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4256 ME_Cursor
*start
= NULL
, *end
= NULL
;
4258 TRACE("(%p)->(%p)\n", This
, pch
);
4261 return CO_E_RELEASED
;
4264 return E_INVALIDARG
;
4266 ME_GetSelection(This
->reOle
->editor
, &start
, &end
);
4267 return range_GetChar(This
->reOle
->editor
, start
, pch
);
4270 static HRESULT WINAPI
ITextSelection_fnSetChar(ITextSelection
*me
, LONG ch
)
4272 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4274 FIXME("(%p)->(%x): stub\n", This
, ch
);
4277 return CO_E_RELEASED
;
4282 static HRESULT WINAPI
ITextSelection_fnGetDuplicate(ITextSelection
*me
, ITextRange
**range
)
4284 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4287 TRACE("(%p)->(%p)\n", This
, range
);
4290 return CO_E_RELEASED
;
4293 return E_INVALIDARG
;
4295 ITextSelection_GetStart(me
, &start
);
4296 ITextSelection_GetEnd(me
, &end
);
4297 return CreateITextRange(This
->reOle
, start
, end
, range
);
4300 static HRESULT WINAPI
ITextSelection_fnGetFormattedText(ITextSelection
*me
, ITextRange
**range
)
4302 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4304 FIXME("(%p)->(%p): stub\n", This
, range
);
4307 return CO_E_RELEASED
;
4312 static HRESULT WINAPI
ITextSelection_fnSetFormattedText(ITextSelection
*me
, ITextRange
*range
)
4314 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4316 FIXME("(%p)->(%p): stub\n", This
, range
);
4319 return CO_E_RELEASED
;
4321 FIXME("not implemented\n");
4325 static HRESULT WINAPI
ITextSelection_fnGetStart(ITextSelection
*me
, LONG
*pcpFirst
)
4327 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4330 TRACE("(%p)->(%p)\n", This
, pcpFirst
);
4333 return CO_E_RELEASED
;
4336 return E_INVALIDARG
;
4337 ME_GetSelectionOfs(This
->reOle
->editor
, pcpFirst
, &lim
);
4341 static HRESULT WINAPI
ITextSelection_fnSetStart(ITextSelection
*me
, LONG value
)
4343 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4347 TRACE("(%p)->(%d)\n", This
, value
);
4350 return CO_E_RELEASED
;
4352 ME_GetSelectionOfs(This
->reOle
->editor
, &start
, &end
);
4353 hr
= textrange_setstart(This
->reOle
, value
, &start
, &end
);
4355 ME_SetSelection(This
->reOle
->editor
, start
, end
);
4360 static HRESULT WINAPI
ITextSelection_fnGetEnd(ITextSelection
*me
, LONG
*pcpLim
)
4362 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4365 TRACE("(%p)->(%p)\n", This
, pcpLim
);
4368 return CO_E_RELEASED
;
4371 return E_INVALIDARG
;
4372 ME_GetSelectionOfs(This
->reOle
->editor
, &first
, pcpLim
);
4376 static HRESULT WINAPI
ITextSelection_fnSetEnd(ITextSelection
*me
, LONG value
)
4378 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4382 TRACE("(%p)->(%d)\n", This
, value
);
4385 return CO_E_RELEASED
;
4387 ME_GetSelectionOfs(This
->reOle
->editor
, &start
, &end
);
4388 hr
= textrange_setend(This
->reOle
, value
, &start
, &end
);
4390 ME_SetSelection(This
->reOle
->editor
, start
, end
);
4395 static HRESULT WINAPI
ITextSelection_fnGetFont(ITextSelection
*me
, ITextFont
**font
)
4397 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4399 TRACE("(%p)->(%p)\n", This
, font
);
4402 return CO_E_RELEASED
;
4405 return E_INVALIDARG
;
4407 return create_textfont((ITextRange
*)me
, NULL
, font
);
4410 static HRESULT WINAPI
ITextSelection_fnSetFont(ITextSelection
*me
, ITextFont
*font
)
4412 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4414 TRACE("(%p)->(%p)\n", This
, font
);
4417 return E_INVALIDARG
;
4420 return CO_E_RELEASED
;
4422 textrange_set_font((ITextRange
*)me
, font
);
4426 static HRESULT WINAPI
ITextSelection_fnGetPara(ITextSelection
*me
, ITextPara
**para
)
4428 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4430 TRACE("(%p)->(%p)\n", This
, para
);
4433 return CO_E_RELEASED
;
4436 return E_INVALIDARG
;
4438 return create_textpara((ITextRange
*)me
, para
);
4441 static HRESULT WINAPI
ITextSelection_fnSetPara(ITextSelection
*me
, ITextPara
*para
)
4443 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4445 FIXME("(%p)->(%p): stub\n", This
, para
);
4448 return CO_E_RELEASED
;
4450 FIXME("not implemented\n");
4454 static HRESULT WINAPI
ITextSelection_fnGetStoryLength(ITextSelection
*me
, LONG
*length
)
4456 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4458 TRACE("(%p)->(%p)\n", This
, length
);
4461 return CO_E_RELEASED
;
4463 return textrange_get_storylength(This
->reOle
->editor
, length
);
4466 static HRESULT WINAPI
ITextSelection_fnGetStoryType(ITextSelection
*me
, LONG
*value
)
4468 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4470 TRACE("(%p)->(%p)\n", This
, value
);
4473 return CO_E_RELEASED
;
4476 return E_INVALIDARG
;
4478 *value
= tomUnknownStory
;
4482 static HRESULT WINAPI
ITextSelection_fnCollapse(ITextSelection
*me
, LONG bStart
)
4484 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4488 TRACE("(%p)->(%d)\n", This
, bStart
);
4491 return CO_E_RELEASED
;
4493 ME_GetSelectionOfs(This
->reOle
->editor
, &start
, &end
);
4494 hres
= range_Collapse(bStart
, &start
, &end
);
4495 if (SUCCEEDED(hres
))
4496 ME_SetSelection(This
->reOle
->editor
, start
, end
);
4500 static HRESULT WINAPI
ITextSelection_fnExpand(ITextSelection
*me
, LONG unit
, LONG
*delta
)
4502 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4504 TRACE("(%p)->(%d %p)\n", This
, unit
, delta
);
4507 return CO_E_RELEASED
;
4509 return textrange_expand((ITextRange
*)me
, unit
, delta
);
4512 static HRESULT WINAPI
ITextSelection_fnGetIndex(ITextSelection
*me
, LONG unit
, LONG
*index
)
4514 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4516 FIXME("(%p)->(%d %p): stub\n", This
, unit
, index
);
4519 return CO_E_RELEASED
;
4524 static HRESULT WINAPI
ITextSelection_fnSetIndex(ITextSelection
*me
, LONG unit
, LONG index
,
4527 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4529 FIXME("(%p)->(%d %d %d): stub\n", This
, unit
, index
, extend
);
4532 return CO_E_RELEASED
;
4537 static HRESULT WINAPI
ITextSelection_fnSetRange(ITextSelection
*me
, LONG anchor
, LONG active
)
4539 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4541 FIXME("(%p)->(%d %d): stub\n", This
, anchor
, active
);
4544 return CO_E_RELEASED
;
4549 static HRESULT WINAPI
ITextSelection_fnInRange(ITextSelection
*me
, ITextRange
*range
, LONG
*ret
)
4551 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4552 ITextSelection
*selection
= NULL
;
4555 TRACE("(%p)->(%p %p)\n", This
, range
, ret
);
4561 return CO_E_RELEASED
;
4566 ITextRange_QueryInterface(range
, &IID_ITextSelection
, (void**)&selection
);
4569 ITextSelection_Release(selection
);
4571 ITextSelection_GetStart(me
, &start
);
4572 ITextSelection_GetEnd(me
, &end
);
4573 return textrange_inrange(start
, end
, range
, ret
);
4576 static HRESULT WINAPI
ITextSelection_fnInStory(ITextSelection
*me
, ITextRange
*range
, LONG
*ret
)
4578 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4580 FIXME("(%p)->(%p %p): stub\n", This
, range
, ret
);
4583 return CO_E_RELEASED
;
4588 static HRESULT WINAPI
ITextSelection_fnIsEqual(ITextSelection
*me
, ITextRange
*range
, LONG
*ret
)
4590 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4591 ITextSelection
*selection
= NULL
;
4594 TRACE("(%p)->(%p %p)\n", This
, range
, ret
);
4600 return CO_E_RELEASED
;
4605 ITextRange_QueryInterface(range
, &IID_ITextSelection
, (void**)&selection
);
4608 ITextSelection_Release(selection
);
4610 ITextSelection_GetStart(me
, &start
);
4611 ITextSelection_GetEnd(me
, &end
);
4612 return textrange_isequal(start
, end
, range
, ret
);
4615 static HRESULT WINAPI
ITextSelection_fnSelect(ITextSelection
*me
)
4617 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4619 TRACE("(%p)\n", This
);
4622 return CO_E_RELEASED
;
4628 static HRESULT WINAPI
ITextSelection_fnStartOf(ITextSelection
*me
, LONG unit
, LONG extend
,
4631 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4633 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, extend
, delta
);
4636 return CO_E_RELEASED
;
4641 static HRESULT WINAPI
ITextSelection_fnEndOf(ITextSelection
*me
, LONG unit
, LONG extend
,
4644 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4646 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, extend
, delta
);
4649 return CO_E_RELEASED
;
4654 static HRESULT WINAPI
ITextSelection_fnMove(ITextSelection
*me
, LONG unit
, LONG count
, LONG
*delta
)
4656 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4658 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, count
, delta
);
4661 return CO_E_RELEASED
;
4666 static HRESULT WINAPI
ITextSelection_fnMoveStart(ITextSelection
*me
, LONG unit
, LONG count
,
4669 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4671 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, count
, delta
);
4674 return CO_E_RELEASED
;
4679 static HRESULT WINAPI
ITextSelection_fnMoveEnd(ITextSelection
*me
, LONG unit
, LONG count
,
4682 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4684 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, count
, delta
);
4687 return CO_E_RELEASED
;
4692 static HRESULT WINAPI
ITextSelection_fnMoveWhile(ITextSelection
*me
, VARIANT
*charset
, LONG count
,
4695 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4697 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
4700 return CO_E_RELEASED
;
4705 static HRESULT WINAPI
ITextSelection_fnMoveStartWhile(ITextSelection
*me
, VARIANT
*charset
, LONG count
,
4708 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4710 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
4713 return CO_E_RELEASED
;
4718 static HRESULT WINAPI
ITextSelection_fnMoveEndWhile(ITextSelection
*me
, VARIANT
*charset
, LONG count
,
4721 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4723 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
4726 return CO_E_RELEASED
;
4731 static HRESULT WINAPI
ITextSelection_fnMoveUntil(ITextSelection
*me
, VARIANT
*charset
, LONG count
,
4734 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4736 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
4739 return CO_E_RELEASED
;
4744 static HRESULT WINAPI
ITextSelection_fnMoveStartUntil(ITextSelection
*me
, VARIANT
*charset
, LONG count
,
4747 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4749 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
4752 return CO_E_RELEASED
;
4757 static HRESULT WINAPI
ITextSelection_fnMoveEndUntil(ITextSelection
*me
, VARIANT
*charset
, LONG count
,
4760 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4762 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
4765 return CO_E_RELEASED
;
4770 static HRESULT WINAPI
ITextSelection_fnFindText(ITextSelection
*me
, BSTR text
, LONG count
, LONG flags
,
4773 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4775 FIXME("(%p)->(%s %d %x %p): stub\n", This
, debugstr_w(text
), count
, flags
, length
);
4778 return CO_E_RELEASED
;
4780 FIXME("not implemented\n");
4784 static HRESULT WINAPI
ITextSelection_fnFindTextStart(ITextSelection
*me
, BSTR text
, LONG count
,
4785 LONG flags
, LONG
*length
)
4787 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4789 FIXME("(%p)->(%s %d %x %p): stub\n", This
, debugstr_w(text
), count
, flags
, length
);
4792 return CO_E_RELEASED
;
4797 static HRESULT WINAPI
ITextSelection_fnFindTextEnd(ITextSelection
*me
, BSTR text
, LONG count
,
4798 LONG flags
, LONG
*length
)
4800 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4802 FIXME("(%p)->(%s %d %x %p): stub\n", This
, debugstr_w(text
), count
, flags
, length
);
4805 return CO_E_RELEASED
;
4810 static HRESULT WINAPI
ITextSelection_fnDelete(ITextSelection
*me
, LONG unit
, LONG count
,
4813 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4815 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, count
, delta
);
4818 return CO_E_RELEASED
;
4823 static HRESULT WINAPI
ITextSelection_fnCut(ITextSelection
*me
, VARIANT
*v
)
4825 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4827 FIXME("(%p)->(%p): stub\n", This
, v
);
4830 return CO_E_RELEASED
;
4835 static HRESULT WINAPI
ITextSelection_fnCopy(ITextSelection
*me
, VARIANT
*v
)
4837 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4839 FIXME("(%p)->(%p): stub\n", This
, v
);
4842 return CO_E_RELEASED
;
4847 static HRESULT WINAPI
ITextSelection_fnPaste(ITextSelection
*me
, VARIANT
*v
, LONG format
)
4849 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4851 FIXME("(%p)->(%s %x): stub\n", This
, debugstr_variant(v
), format
);
4854 return CO_E_RELEASED
;
4859 static HRESULT WINAPI
ITextSelection_fnCanPaste(ITextSelection
*me
, VARIANT
*v
, LONG format
,
4862 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4864 FIXME("(%p)->(%s %x %p): stub\n", This
, debugstr_variant(v
), format
, ret
);
4867 return CO_E_RELEASED
;
4872 static HRESULT WINAPI
ITextSelection_fnCanEdit(ITextSelection
*me
, LONG
*ret
)
4874 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4876 FIXME("(%p)->(%p): stub\n", This
, ret
);
4879 return CO_E_RELEASED
;
4884 static HRESULT WINAPI
ITextSelection_fnChangeCase(ITextSelection
*me
, LONG type
)
4886 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4888 FIXME("(%p)->(%d): stub\n", This
, type
);
4891 return CO_E_RELEASED
;
4896 static HRESULT WINAPI
ITextSelection_fnGetPoint(ITextSelection
*me
, LONG type
, LONG
*cx
, LONG
*cy
)
4898 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4900 FIXME("(%p)->(%d %p %p): stub\n", This
, type
, cx
, cy
);
4903 return CO_E_RELEASED
;
4908 static HRESULT WINAPI
ITextSelection_fnSetPoint(ITextSelection
*me
, LONG x
, LONG y
, LONG type
,
4911 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4913 FIXME("(%p)->(%d %d %d %d): stub\n", This
, x
, y
, type
, extend
);
4916 return CO_E_RELEASED
;
4921 static HRESULT WINAPI
ITextSelection_fnScrollIntoView(ITextSelection
*me
, LONG value
)
4923 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4925 FIXME("(%p)->(%d): stub\n", This
, value
);
4928 return CO_E_RELEASED
;
4933 static HRESULT WINAPI
ITextSelection_fnGetEmbeddedObject(ITextSelection
*me
, IUnknown
**ppv
)
4935 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4937 FIXME("(%p)->(%p): stub\n", This
, ppv
);
4940 return CO_E_RELEASED
;
4945 /*** ITextSelection methods ***/
4946 static HRESULT WINAPI
ITextSelection_fnGetFlags(ITextSelection
*me
, LONG
*flags
)
4948 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4950 FIXME("(%p)->(%p): stub\n", This
, flags
);
4953 return CO_E_RELEASED
;
4958 static HRESULT WINAPI
ITextSelection_fnSetFlags(ITextSelection
*me
, LONG flags
)
4960 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4962 FIXME("(%p)->(%x): stub\n", This
, flags
);
4965 return CO_E_RELEASED
;
4970 static HRESULT WINAPI
ITextSelection_fnGetType(ITextSelection
*me
, LONG
*type
)
4972 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4974 FIXME("(%p)->(%p): stub\n", This
, type
);
4977 return CO_E_RELEASED
;
4982 static HRESULT WINAPI
ITextSelection_fnMoveLeft(ITextSelection
*me
, LONG unit
, LONG count
,
4983 LONG extend
, LONG
*delta
)
4985 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4987 FIXME("(%p)->(%d %d %d %p): stub\n", This
, unit
, count
, extend
, delta
);
4990 return CO_E_RELEASED
;
4995 static HRESULT WINAPI
ITextSelection_fnMoveRight(ITextSelection
*me
, LONG unit
, LONG count
,
4996 LONG extend
, LONG
*delta
)
4998 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5000 FIXME("(%p)->(%d %d %d %p): stub\n", This
, unit
, count
, extend
, delta
);
5003 return CO_E_RELEASED
;
5008 static HRESULT WINAPI
ITextSelection_fnMoveUp(ITextSelection
*me
, LONG unit
, LONG count
,
5009 LONG extend
, LONG
*delta
)
5011 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5013 FIXME("(%p)->(%d %d %d %p): stub\n", This
, unit
, count
, extend
, delta
);
5016 return CO_E_RELEASED
;
5021 static HRESULT WINAPI
ITextSelection_fnMoveDown(ITextSelection
*me
, LONG unit
, LONG count
,
5022 LONG extend
, LONG
*delta
)
5024 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5026 FIXME("(%p)->(%d %d %d %p): stub\n", This
, unit
, count
, extend
, delta
);
5029 return CO_E_RELEASED
;
5034 static HRESULT WINAPI
ITextSelection_fnHomeKey(ITextSelection
*me
, LONG unit
, LONG extend
,
5037 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5039 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, extend
, delta
);
5042 return CO_E_RELEASED
;
5047 static HRESULT WINAPI
ITextSelection_fnEndKey(ITextSelection
*me
, LONG unit
, LONG extend
,
5050 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5052 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, extend
, delta
);
5055 return CO_E_RELEASED
;
5060 static HRESULT WINAPI
ITextSelection_fnTypeText(ITextSelection
*me
, BSTR text
)
5062 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5064 FIXME("(%p)->(%s): stub\n", This
, debugstr_w(text
));
5067 return CO_E_RELEASED
;
5072 static const ITextSelectionVtbl tsvt
= {
5073 ITextSelection_fnQueryInterface
,
5074 ITextSelection_fnAddRef
,
5075 ITextSelection_fnRelease
,
5076 ITextSelection_fnGetTypeInfoCount
,
5077 ITextSelection_fnGetTypeInfo
,
5078 ITextSelection_fnGetIDsOfNames
,
5079 ITextSelection_fnInvoke
,
5080 ITextSelection_fnGetText
,
5081 ITextSelection_fnSetText
,
5082 ITextSelection_fnGetChar
,
5083 ITextSelection_fnSetChar
,
5084 ITextSelection_fnGetDuplicate
,
5085 ITextSelection_fnGetFormattedText
,
5086 ITextSelection_fnSetFormattedText
,
5087 ITextSelection_fnGetStart
,
5088 ITextSelection_fnSetStart
,
5089 ITextSelection_fnGetEnd
,
5090 ITextSelection_fnSetEnd
,
5091 ITextSelection_fnGetFont
,
5092 ITextSelection_fnSetFont
,
5093 ITextSelection_fnGetPara
,
5094 ITextSelection_fnSetPara
,
5095 ITextSelection_fnGetStoryLength
,
5096 ITextSelection_fnGetStoryType
,
5097 ITextSelection_fnCollapse
,
5098 ITextSelection_fnExpand
,
5099 ITextSelection_fnGetIndex
,
5100 ITextSelection_fnSetIndex
,
5101 ITextSelection_fnSetRange
,
5102 ITextSelection_fnInRange
,
5103 ITextSelection_fnInStory
,
5104 ITextSelection_fnIsEqual
,
5105 ITextSelection_fnSelect
,
5106 ITextSelection_fnStartOf
,
5107 ITextSelection_fnEndOf
,
5108 ITextSelection_fnMove
,
5109 ITextSelection_fnMoveStart
,
5110 ITextSelection_fnMoveEnd
,
5111 ITextSelection_fnMoveWhile
,
5112 ITextSelection_fnMoveStartWhile
,
5113 ITextSelection_fnMoveEndWhile
,
5114 ITextSelection_fnMoveUntil
,
5115 ITextSelection_fnMoveStartUntil
,
5116 ITextSelection_fnMoveEndUntil
,
5117 ITextSelection_fnFindText
,
5118 ITextSelection_fnFindTextStart
,
5119 ITextSelection_fnFindTextEnd
,
5120 ITextSelection_fnDelete
,
5121 ITextSelection_fnCut
,
5122 ITextSelection_fnCopy
,
5123 ITextSelection_fnPaste
,
5124 ITextSelection_fnCanPaste
,
5125 ITextSelection_fnCanEdit
,
5126 ITextSelection_fnChangeCase
,
5127 ITextSelection_fnGetPoint
,
5128 ITextSelection_fnSetPoint
,
5129 ITextSelection_fnScrollIntoView
,
5130 ITextSelection_fnGetEmbeddedObject
,
5131 ITextSelection_fnGetFlags
,
5132 ITextSelection_fnSetFlags
,
5133 ITextSelection_fnGetType
,
5134 ITextSelection_fnMoveLeft
,
5135 ITextSelection_fnMoveRight
,
5136 ITextSelection_fnMoveUp
,
5137 ITextSelection_fnMoveDown
,
5138 ITextSelection_fnHomeKey
,
5139 ITextSelection_fnEndKey
,
5140 ITextSelection_fnTypeText
5143 static ITextSelectionImpl
*
5144 CreateTextSelection(IRichEditOleImpl
*reOle
)
5146 ITextSelectionImpl
*txtSel
= heap_alloc(sizeof *txtSel
);
5150 txtSel
->ITextSelection_iface
.lpVtbl
= &tsvt
;
5152 txtSel
->reOle
= reOle
;
5156 LRESULT
CreateIRichEditOle(IUnknown
*outer_unk
, ME_TextEditor
*editor
, LPVOID
*ppvObj
)
5158 IRichEditOleImpl
*reo
;
5160 reo
= heap_alloc(sizeof(IRichEditOleImpl
));
5164 reo
->IUnknown_inner
.lpVtbl
= &reo_unk_vtbl
;
5165 reo
->IRichEditOle_iface
.lpVtbl
= &revt
;
5166 reo
->ITextDocument_iface
.lpVtbl
= &tdvt
;
5168 reo
->editor
= editor
;
5171 TRACE("Created %p\n",reo
);
5172 list_init(&reo
->rangelist
);
5173 list_init(&reo
->clientsites
);
5175 reo
->outer_unk
= outer_unk
;
5177 reo
->outer_unk
= &reo
->IUnknown_inner
;
5178 *ppvObj
= &reo
->IRichEditOle_iface
;
5183 static void convert_sizel(const ME_Context
*c
, const SIZEL
* szl
, SIZE
* sz
)
5185 /* sizel is in .01 millimeters, sz in pixels */
5186 sz
->cx
= MulDiv(szl
->cx
, c
->dpi
.cx
, 2540);
5187 sz
->cy
= MulDiv(szl
->cy
, c
->dpi
.cy
, 2540);
5190 /******************************************************************************
5191 * ME_GetOLEObjectSize
5193 * Sets run extent for OLE objects.
5195 void ME_GetOLEObjectSize(const ME_Context
*c
, ME_Run
*run
, SIZE
*pSize
)
5203 assert(run
->nFlags
& MERF_GRAPHICS
);
5204 assert(run
->ole_obj
);
5206 if (run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0)
5208 convert_sizel(c
, &run
->ole_obj
->sizel
, pSize
);
5209 if (c
->editor
->nZoomNumerator
!= 0)
5211 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5212 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5217 if (!run
->ole_obj
->poleobj
)
5219 pSize
->cx
= pSize
->cy
= 0;
5223 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
5225 FIXME("Query Interface IID_IDataObject failed!\n");
5226 pSize
->cx
= pSize
->cy
= 0;
5229 fmt
.cfFormat
= CF_BITMAP
;
5231 fmt
.dwAspect
= DVASPECT_CONTENT
;
5233 fmt
.tymed
= TYMED_GDI
;
5234 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
5236 fmt
.cfFormat
= CF_ENHMETAFILE
;
5237 fmt
.tymed
= TYMED_ENHMF
;
5238 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
5240 FIXME("unsupported format\n");
5241 pSize
->cx
= pSize
->cy
= 0;
5242 IDataObject_Release(ido
);
5246 IDataObject_Release(ido
);
5251 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
5252 pSize
->cx
= dibsect
.dsBm
.bmWidth
;
5253 pSize
->cy
= dibsect
.dsBm
.bmHeight
;
5256 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
5257 pSize
->cx
= emh
.rclBounds
.right
- emh
.rclBounds
.left
;
5258 pSize
->cy
= emh
.rclBounds
.bottom
- emh
.rclBounds
.top
;
5261 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
5264 ReleaseStgMedium(&stgm
);
5265 if (c
->editor
->nZoomNumerator
!= 0)
5267 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5268 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5272 void ME_DrawOLE(ME_Context
*c
, int x
, int y
, ME_Run
*run
, BOOL selected
)
5285 assert(run
->nFlags
& MERF_GRAPHICS
);
5286 assert(run
->ole_obj
);
5287 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
5289 FIXME("Couldn't get interface\n");
5292 has_size
= run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0;
5293 fmt
.cfFormat
= CF_BITMAP
;
5295 fmt
.dwAspect
= DVASPECT_CONTENT
;
5297 fmt
.tymed
= TYMED_GDI
;
5298 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
5300 fmt
.cfFormat
= CF_ENHMETAFILE
;
5301 fmt
.tymed
= TYMED_ENHMF
;
5302 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
5304 FIXME("Couldn't get storage medium\n");
5305 IDataObject_Release(ido
);
5309 IDataObject_Release(ido
);
5314 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
5315 hMemDC
= CreateCompatibleDC(c
->hDC
);
5316 old_bm
= SelectObject(hMemDC
, stgm
.u
.hBitmap
);
5319 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
5321 sz
.cx
= dibsect
.dsBm
.bmWidth
;
5322 sz
.cy
= dibsect
.dsBm
.bmHeight
;
5324 if (c
->editor
->nZoomNumerator
!= 0)
5326 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5327 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5329 StretchBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
,
5330 hMemDC
, 0, 0, dibsect
.dsBm
.bmWidth
, dibsect
.dsBm
.bmHeight
, SRCCOPY
);
5332 SelectObject(hMemDC
, old_bm
);
5336 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
5339 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
5341 sz
.cx
= emh
.rclBounds
.right
- emh
.rclBounds
.left
;
5342 sz
.cy
= emh
.rclBounds
.bottom
- emh
.rclBounds
.top
;
5344 if (c
->editor
->nZoomNumerator
!= 0)
5346 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5347 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5352 rc
.right
= x
+ sz
.cx
;
5354 PlayEnhMetaFile(c
->hDC
, stgm
.u
.hEnhMetaFile
, &rc
);
5357 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
5361 ReleaseStgMedium(&stgm
);
5363 if (selected
&& !c
->editor
->bHideSelection
)
5364 PatBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
, DSTINVERT
);
5367 void ME_DeleteReObject(REOBJECT
* reo
)
5369 if (reo
->poleobj
) IOleObject_Release(reo
->poleobj
);
5370 if (reo
->pstg
) IStorage_Release(reo
->pstg
);
5371 if (reo
->polesite
) IOleClientSite_Release(reo
->polesite
);
5375 void ME_CopyReObject(REOBJECT
* dst
, const REOBJECT
* src
)
5379 if (dst
->poleobj
) IOleObject_AddRef(dst
->poleobj
);
5380 if (dst
->pstg
) IStorage_AddRef(dst
->pstg
);
5381 if (dst
->polesite
) IOleClientSite_AddRef(dst
->polesite
);
5384 void ME_GetITextDocumentInterface(IRichEditOle
*iface
, LPVOID
*ppvObj
)
5386 IRichEditOleImpl
*This
= impl_from_IRichEditOle(iface
);
5387 *ppvObj
= &This
->ITextDocument_iface
;