2 * RichEdit GUIDs and OLE interface
4 * Copyright 2004 by Krzysztof Foltman
5 * Copyright 2004 Aric Stewart
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #define NONAMELESSUNION
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(richedit
);
40 /* there is no way to be consistent across different sets of headers - mingw, Wine, Win32 SDK*/
44 DEFINE_GUID(LIBID_tom
, 0x8cc497c9, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
45 DEFINE_GUID(IID_ITextServices
, 0x8d33f740, 0xcf58, 0x11ce, 0xa8, 0x9d, 0x00, 0xaa, 0x00, 0x6c, 0xad, 0xc5);
46 DEFINE_GUID(IID_ITextHost
, 0x13e670f4,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1);
47 DEFINE_GUID(IID_ITextHost2
, 0x13e670f5,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1);
48 DEFINE_GUID(IID_ITextDocument
, 0x8cc497c0, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
49 DEFINE_GUID(IID_ITextDocument2Old
, 0x01c25500, 0x4268, 0x11d1, 0x88, 0x3a, 0x3c, 0x8b, 0x00, 0xc1, 0x00, 0x00);
50 DEFINE_GUID(IID_ITextRange
, 0x8cc497c2, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
51 DEFINE_GUID(IID_ITextSelection
, 0x8cc497c1, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
52 DEFINE_GUID(IID_ITextFont
, 0x8cc497c3, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
53 DEFINE_GUID(IID_ITextPara
, 0x8cc497c4, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
55 static ITypeLib
*typelib
;
67 static const IID
* const tid_ids
[] =
76 static ITypeInfo
*typeinfos
[LAST_tid
];
78 static HRESULT
load_typelib(void)
83 hr
= LoadRegTypeLib(&LIBID_tom
, 1, 0, LOCALE_SYSTEM_DEFAULT
, &tl
);
85 ERR("LoadRegTypeLib failed: %08x\n", hr
);
89 if (InterlockedCompareExchangePointer((void**)&typelib
, tl
, NULL
))
94 void release_typelib(void)
101 for (i
= 0; i
< ARRAY_SIZE(typeinfos
); i
++)
103 ITypeInfo_Release(typeinfos
[i
]);
105 ITypeLib_Release(typelib
);
108 static HRESULT
get_typeinfo(enum tid_t tid
, ITypeInfo
**typeinfo
)
121 hr
= ITypeLib_GetTypeInfoOfGuid(typelib
, tid_ids
[tid
], &ti
);
124 ERR("GetTypeInfoOfGuid(%s) failed: %08x\n", debugstr_guid(tid_ids
[tid
]), hr
);
128 if (InterlockedCompareExchangePointer((void**)(typeinfos
+tid
), ti
, NULL
))
129 ITypeInfo_Release(ti
);
132 *typeinfo
= typeinfos
[tid
];
136 /* private IID used to get back IRichEditOleImpl pointer */
137 DEFINE_GUID(IID_Igetrichole
, 0xe3ce5c7a, 0x8247, 0x4622, 0x81, 0xad, 0x11, 0x81, 0x02, 0xaa, 0x01, 0x30);
139 typedef struct ITextSelectionImpl ITextSelectionImpl
;
140 typedef struct IOleClientSiteImpl IOleClientSiteImpl
;
141 typedef struct ITextRangeImpl ITextRangeImpl
;
143 enum textfont_prop_id
{
169 FONT_PROPID_FIRST
= FONT_ALLCAPS
172 static const DWORD textfont_prop_masks
[][2] = {
173 { CFM_ALLCAPS
, CFE_ALLCAPS
},
175 { CFM_BACKCOLOR
, CFE_AUTOBACKCOLOR
},
176 { CFM_BOLD
, CFE_BOLD
},
177 { CFM_EMBOSS
, CFE_EMBOSS
},
178 { CFM_COLOR
, CFE_AUTOCOLOR
},
179 { CFM_HIDDEN
, CFE_HIDDEN
},
180 { CFM_IMPRINT
, CFE_IMPRINT
},
181 { CFM_ITALIC
, CFE_ITALIC
},
185 { CFM_OUTLINE
, CFE_OUTLINE
},
187 { CFM_PROTECTED
, CFE_PROTECTED
},
188 { CFM_SHADOW
, CFE_SHADOW
},
190 { CFM_SMALLCAPS
, CFE_SMALLCAPS
},
192 { CFM_STRIKEOUT
, CFE_STRIKEOUT
},
193 { CFM_SUBSCRIPT
, CFE_SUBSCRIPT
},
194 { CFM_SUPERSCRIPT
, CFE_SUPERSCRIPT
},
195 { CFM_UNDERLINE
, CFE_UNDERLINE
},
205 enum range_update_op
{
209 typedef struct IRichEditOleImpl
{
210 IUnknown IUnknown_inner
;
211 IRichEditOle IRichEditOle_iface
;
212 ITextDocument2Old ITextDocument2Old_iface
;
216 ME_TextEditor
*editor
;
217 ITextSelectionImpl
*txtSel
;
219 struct list rangelist
;
220 struct list clientsites
;
225 IRichEditOleImpl
*reole
;
228 struct ITextRangeImpl
{
229 struct reole_child child
;
230 ITextRange ITextRange_iface
;
235 struct ITextSelectionImpl
{
236 ITextSelection ITextSelection_iface
;
239 IRichEditOleImpl
*reOle
;
242 typedef struct ITextFontImpl
{
243 ITextFont ITextFont_iface
;
247 textfont_prop_val props
[FONT_PROPID_LAST
];
248 BOOL get_cache_enabled
;
249 BOOL set_cache_enabled
;
252 typedef struct ITextParaImpl
{
253 ITextPara ITextPara_iface
;
259 struct IOleClientSiteImpl
{
260 struct reole_child child
;
261 IOleClientSite IOleClientSite_iface
;
262 IOleInPlaceSite IOleInPlaceSite_iface
;
266 static inline IRichEditOleImpl
*impl_from_IRichEditOle(IRichEditOle
*iface
)
268 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, IRichEditOle_iface
);
271 static inline IRichEditOleImpl
*impl_from_ITextDocument2Old(ITextDocument2Old
*iface
)
273 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, ITextDocument2Old_iface
);
276 static inline IRichEditOleImpl
*impl_from_IUnknown(IUnknown
*iface
)
278 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, IUnknown_inner
);
281 static inline IOleClientSiteImpl
*impl_from_IOleInPlaceSite(IOleInPlaceSite
*iface
)
283 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleInPlaceSite_iface
);
286 static inline ITextRangeImpl
*impl_from_ITextRange(ITextRange
*iface
)
288 return CONTAINING_RECORD(iface
, ITextRangeImpl
, ITextRange_iface
);
291 static inline ITextSelectionImpl
*impl_from_ITextSelection(ITextSelection
*iface
)
293 return CONTAINING_RECORD(iface
, ITextSelectionImpl
, ITextSelection_iface
);
296 static inline ITextFontImpl
*impl_from_ITextFont(ITextFont
*iface
)
298 return CONTAINING_RECORD(iface
, ITextFontImpl
, ITextFont_iface
);
301 static inline ITextParaImpl
*impl_from_ITextPara(ITextPara
*iface
)
303 return CONTAINING_RECORD(iface
, ITextParaImpl
, ITextPara_iface
);
306 static HRESULT
create_textfont(ITextRange
*, const ITextFontImpl
*, ITextFont
**);
307 static HRESULT
create_textpara(ITextRange
*, ITextPara
**);
308 static ITextSelectionImpl
*CreateTextSelection(IRichEditOleImpl
*);
310 static HRESULT
textrange_get_storylength(ME_TextEditor
*editor
, LONG
*length
)
315 *length
= ME_GetTextLength(editor
) + 1;
319 static void textranges_update_ranges(IRichEditOleImpl
*reole
, LONG start
, LONG end
, enum range_update_op op
)
321 ITextRangeImpl
*range
;
323 LIST_FOR_EACH_ENTRY(range
, &reole
->rangelist
, ITextRangeImpl
, child
.entry
) {
326 case RANGE_UPDATE_DELETE
:
327 /* range fully covered by deleted range - collapse to insertion point */
328 if (range
->start
>= start
&& range
->end
<= end
)
329 range
->start
= range
->end
= start
;
330 /* deleted range cuts from the right */
331 else if (range
->start
< start
&& range
->end
<= end
)
333 /* deleted range cuts from the left */
334 else if (range
->start
>= start
&& range
->end
> end
) {
335 range
->start
= start
;
336 range
->end
-= end
- start
;
338 /* deleted range cuts within */
340 range
->end
-= end
- start
;
343 FIXME("unknown update op, %d\n", op
);
348 static inline BOOL
is_equal_textfont_prop_value(enum textfont_prop_id propid
, textfont_prop_val
*left
,
349 textfont_prop_val
*right
)
368 case FONT_STRIKETHROUGH
:
370 case FONT_SUPERSCRIPT
:
373 return left
->l
== right
->l
;
375 return !wcscmp(left
->str
, right
->str
);
379 return left
->f
== right
->f
;
381 FIXME("unhandled font property %d\n", propid
);
386 static inline void init_textfont_prop_value(enum textfont_prop_id propid
, textfont_prop_val
*v
)
405 case FONT_STRIKETHROUGH
:
407 case FONT_SUPERSCRIPT
:
421 FIXME("unhandled font property %d\n", propid
);
427 static inline FLOAT
twips_to_points(LONG value
)
429 return value
* 72.0 / 1440;
432 static inline FLOAT
points_to_twips(FLOAT value
)
434 return value
* 1440 / 72.0;
437 static HRESULT
get_textfont_prop_for_pos(const IRichEditOleImpl
*reole
, int pos
, enum textfont_prop_id propid
,
438 textfont_prop_val
*value
)
443 memset(&fmt
, 0, sizeof(fmt
));
444 fmt
.cbSize
= sizeof(fmt
);
445 fmt
.dwMask
= textfont_prop_masks
[propid
][0];
447 ME_CursorFromCharOfs(reole
->editor
, pos
, &from
);
449 ME_MoveCursorChars(reole
->editor
, &to
, 1, FALSE
);
450 ME_GetCharFormat(reole
->editor
, &from
, &to
, &fmt
);
464 case FONT_STRIKETHROUGH
:
466 case FONT_SUPERSCRIPT
:
468 value
->l
= fmt
.dwEffects
& textfont_prop_masks
[propid
][1] ? tomTrue
: tomFalse
;
471 value
->l
= fmt
.bAnimation
;
474 value
->l
= fmt
.dwEffects
& CFE_AUTOBACKCOLOR
? GetSysColor(COLOR_WINDOW
) : fmt
.crBackColor
;
477 value
->l
= fmt
.dwEffects
& CFE_AUTOCOLOR
? GetSysColor(COLOR_WINDOWTEXT
) : fmt
.crTextColor
;
480 value
->f
= twips_to_points(fmt
.wKerning
);
486 /* this case is used exclusively by GetName() */
487 value
->str
= SysAllocString(fmt
.szFaceName
);
489 return E_OUTOFMEMORY
;
492 value
->f
= twips_to_points(fmt
.yOffset
);
495 value
->f
= twips_to_points(fmt
.yHeight
);
498 value
->f
= fmt
.sSpacing
;
501 value
->l
= fmt
.wWeight
;
504 FIXME("unhandled font property %d\n", propid
);
511 static inline const IRichEditOleImpl
*get_range_reole(ITextRange
*range
)
513 IRichEditOleImpl
*reole
= NULL
;
514 ITextRange_QueryInterface(range
, &IID_Igetrichole
, (void**)&reole
);
518 static void textrange_set_font(ITextRange
*range
, ITextFont
*font
)
526 #define CHARFORMAT_SET_B_FIELD(mask, value) \
527 if (hr == S_OK && value != tomUndefined) { \
528 fmt.dwMask |= CFM_##mask; \
529 if (value == tomTrue) fmt.dwEffects |= CFE_##mask; \
532 /* fill format data from font */
533 memset(&fmt
, 0, sizeof(fmt
));
534 fmt
.cbSize
= sizeof(fmt
);
536 value
= tomUndefined
;
537 hr
= ITextFont_GetAllCaps(font
, &value
);
538 CHARFORMAT_SET_B_FIELD(ALLCAPS
, value
);
540 value
= tomUndefined
;
541 hr
= ITextFont_GetBold(font
, &value
);
542 CHARFORMAT_SET_B_FIELD(BOLD
, value
);
544 value
= tomUndefined
;
545 hr
= ITextFont_GetEmboss(font
, &value
);
546 CHARFORMAT_SET_B_FIELD(EMBOSS
, value
);
548 value
= tomUndefined
;
549 hr
= ITextFont_GetHidden(font
, &value
);
550 CHARFORMAT_SET_B_FIELD(HIDDEN
, value
);
552 value
= tomUndefined
;
553 hr
= ITextFont_GetEngrave(font
, &value
);
554 CHARFORMAT_SET_B_FIELD(IMPRINT
, value
);
556 value
= tomUndefined
;
557 hr
= ITextFont_GetItalic(font
, &value
);
558 CHARFORMAT_SET_B_FIELD(ITALIC
, value
);
560 value
= tomUndefined
;
561 hr
= ITextFont_GetOutline(font
, &value
);
562 CHARFORMAT_SET_B_FIELD(OUTLINE
, value
);
564 value
= tomUndefined
;
565 hr
= ITextFont_GetProtected(font
, &value
);
566 CHARFORMAT_SET_B_FIELD(PROTECTED
, value
);
568 value
= tomUndefined
;
569 hr
= ITextFont_GetShadow(font
, &value
);
570 CHARFORMAT_SET_B_FIELD(SHADOW
, value
);
572 value
= tomUndefined
;
573 hr
= ITextFont_GetSmallCaps(font
, &value
);
574 CHARFORMAT_SET_B_FIELD(SMALLCAPS
, value
);
576 value
= tomUndefined
;
577 hr
= ITextFont_GetStrikeThrough(font
, &value
);
578 CHARFORMAT_SET_B_FIELD(STRIKEOUT
, value
);
580 value
= tomUndefined
;
581 hr
= ITextFont_GetSubscript(font
, &value
);
582 CHARFORMAT_SET_B_FIELD(SUBSCRIPT
, value
);
584 value
= tomUndefined
;
585 hr
= ITextFont_GetSuperscript(font
, &value
);
586 CHARFORMAT_SET_B_FIELD(SUPERSCRIPT
, value
);
588 value
= tomUndefined
;
589 hr
= ITextFont_GetUnderline(font
, &value
);
590 CHARFORMAT_SET_B_FIELD(UNDERLINE
, value
);
592 #undef CHARFORMAT_SET_B_FIELD
594 value
= tomUndefined
;
595 hr
= ITextFont_GetAnimation(font
, &value
);
596 if (hr
== S_OK
&& value
!= tomUndefined
) {
597 fmt
.dwMask
|= CFM_ANIMATION
;
598 fmt
.bAnimation
= value
;
601 value
= tomUndefined
;
602 hr
= ITextFont_GetBackColor(font
, &value
);
603 if (hr
== S_OK
&& value
!= tomUndefined
) {
604 fmt
.dwMask
|= CFM_BACKCOLOR
;
605 if (value
== tomAutoColor
)
606 fmt
.dwEffects
|= CFE_AUTOBACKCOLOR
;
608 fmt
.crBackColor
= value
;
611 value
= tomUndefined
;
612 hr
= ITextFont_GetForeColor(font
, &value
);
613 if (hr
== S_OK
&& value
!= tomUndefined
) {
614 fmt
.dwMask
|= CFM_COLOR
;
615 if (value
== tomAutoColor
)
616 fmt
.dwEffects
|= CFE_AUTOCOLOR
;
618 fmt
.crTextColor
= value
;
621 value
= tomUndefined
;
622 hr
= ITextFont_GetKerning(font
, &f
);
623 if (hr
== S_OK
&& f
!= tomUndefined
) {
624 fmt
.dwMask
|= CFM_KERNING
;
625 fmt
.wKerning
= points_to_twips(f
);
628 value
= tomUndefined
;
629 hr
= ITextFont_GetLanguageID(font
, &value
);
630 if (hr
== S_OK
&& value
!= tomUndefined
) {
631 fmt
.dwMask
|= CFM_LCID
;
635 if (ITextFont_GetName(font
, &str
) == S_OK
) {
636 fmt
.dwMask
|= CFM_FACE
;
637 lstrcpynW(fmt
.szFaceName
, str
, ARRAY_SIZE(fmt
.szFaceName
));
641 hr
= ITextFont_GetPosition(font
, &f
);
642 if (hr
== S_OK
&& f
!= tomUndefined
) {
643 fmt
.dwMask
|= CFM_OFFSET
;
644 fmt
.yOffset
= points_to_twips(f
);
647 hr
= ITextFont_GetSize(font
, &f
);
648 if (hr
== S_OK
&& f
!= tomUndefined
) {
649 fmt
.dwMask
|= CFM_SIZE
;
650 fmt
.yHeight
= points_to_twips(f
);
653 hr
= ITextFont_GetSpacing(font
, &f
);
654 if (hr
== S_OK
&& f
!= tomUndefined
) {
655 fmt
.dwMask
|= CFM_SPACING
;
659 hr
= ITextFont_GetWeight(font
, &value
);
660 if (hr
== S_OK
&& value
!= tomUndefined
) {
661 fmt
.dwMask
|= CFM_WEIGHT
;
666 const IRichEditOleImpl
*reole
= get_range_reole(range
);
670 ITextRange_GetStart(range
, &start
);
671 ITextRange_GetEnd(range
, &end
);
673 ME_CursorFromCharOfs(reole
->editor
, start
, &from
);
674 ME_CursorFromCharOfs(reole
->editor
, end
, &to
);
675 ME_SetCharFormat(reole
->editor
, &from
, &to
, &fmt
);
679 static HRESULT
get_textfont_prop(const ITextFontImpl
*font
, enum textfont_prop_id propid
, textfont_prop_val
*value
)
681 const IRichEditOleImpl
*reole
;
686 /* when font is not attached to any range use cached values */
687 if (!font
->range
|| font
->get_cache_enabled
) {
688 *value
= font
->props
[propid
];
692 if (!(reole
= get_range_reole(font
->range
)))
693 return CO_E_RELEASED
;
695 init_textfont_prop_value(propid
, value
);
697 ITextRange_GetStart(font
->range
, &start
);
698 ITextRange_GetEnd(font
->range
, &end
);
700 /* iterate trough a range to see if property value is consistent */
701 hr
= get_textfont_prop_for_pos(reole
, start
, propid
, &v
);
705 for (i
= start
+ 1; i
< end
; i
++) {
706 textfont_prop_val cur
;
708 hr
= get_textfont_prop_for_pos(reole
, i
, propid
, &cur
);
712 if (!is_equal_textfont_prop_value(propid
, &v
, &cur
))
720 static HRESULT
get_textfont_propf(const ITextFontImpl
*font
, enum textfont_prop_id propid
, FLOAT
*value
)
728 hr
= get_textfont_prop(font
, propid
, &v
);
733 static HRESULT
get_textfont_propl(const ITextFontImpl
*font
, enum textfont_prop_id propid
, LONG
*value
)
741 hr
= get_textfont_prop(font
, propid
, &v
);
746 /* Value should already have a terminal value, for boolean properties it means tomToggle is not handled */
747 static HRESULT
set_textfont_prop(ITextFontImpl
*font
, enum textfont_prop_id propid
, const textfont_prop_val
*value
)
749 const IRichEditOleImpl
*reole
;
754 /* when font is not attached to any range use cache */
755 if (!font
->range
|| font
->set_cache_enabled
) {
756 if (propid
== FONT_NAME
) {
757 SysFreeString(font
->props
[propid
].str
);
758 font
->props
[propid
].str
= SysAllocString(value
->str
);
761 font
->props
[propid
] = *value
;
765 if (!(reole
= get_range_reole(font
->range
)))
766 return CO_E_RELEASED
;
768 memset(&fmt
, 0, sizeof(fmt
));
769 fmt
.cbSize
= sizeof(fmt
);
770 fmt
.dwMask
= textfont_prop_masks
[propid
][0];
784 case FONT_STRIKETHROUGH
:
786 case FONT_SUPERSCRIPT
:
788 fmt
.dwEffects
= value
->l
== tomTrue
? textfont_prop_masks
[propid
][1] : 0;
791 fmt
.bAnimation
= value
->l
;
795 if (value
->l
== tomAutoColor
)
796 fmt
.dwEffects
= textfont_prop_masks
[propid
][1];
797 else if (propid
== FONT_BACKCOLOR
)
798 fmt
.crBackColor
= value
->l
;
800 fmt
.crTextColor
= value
->l
;
803 fmt
.wKerning
= value
->f
;
809 fmt
.yOffset
= value
->f
;
812 fmt
.yHeight
= value
->f
;
815 fmt
.sSpacing
= value
->f
;
818 fmt
.wWeight
= value
->l
;
821 lstrcpynW(fmt
.szFaceName
, value
->str
, ARRAY_SIZE(fmt
.szFaceName
));
824 FIXME("unhandled font property %d\n", propid
);
828 ITextRange_GetStart(font
->range
, &start
);
829 ITextRange_GetEnd(font
->range
, &end
);
831 ME_CursorFromCharOfs(reole
->editor
, start
, &from
);
832 ME_CursorFromCharOfs(reole
->editor
, end
, &to
);
833 ME_SetCharFormat(reole
->editor
, &from
, &to
, &fmt
);
838 static inline HRESULT
set_textfont_propl(ITextFontImpl
*font
, enum textfont_prop_id propid
, LONG value
)
842 return set_textfont_prop(font
, propid
, &v
);
845 static inline HRESULT
set_textfont_propf(ITextFontImpl
*font
, enum textfont_prop_id propid
, FLOAT value
)
849 return set_textfont_prop(font
, propid
, &v
);
852 static HRESULT
set_textfont_propd(ITextFontImpl
*font
, enum textfont_prop_id propid
, LONG value
)
862 get_textfont_propl(font
, propid
, &oldvalue
);
863 if (oldvalue
== tomFalse
)
865 else if (oldvalue
== tomTrue
)
874 return set_textfont_prop(font
, propid
, &v
);
880 static HRESULT
textfont_getname_from_range(ITextRange
*range
, BSTR
*ret
)
882 const IRichEditOleImpl
*reole
;
887 if (!(reole
= get_range_reole(range
)))
888 return CO_E_RELEASED
;
890 ITextRange_GetStart(range
, &start
);
891 hr
= get_textfont_prop_for_pos(reole
, start
, FONT_NAME
, &v
);
896 static void textfont_cache_range_props(ITextFontImpl
*font
)
898 enum textfont_prop_id propid
;
899 for (propid
= FONT_PROPID_FIRST
; propid
< FONT_PROPID_LAST
; propid
++) {
900 if (propid
== FONT_NAME
)
901 textfont_getname_from_range(font
->range
, &font
->props
[propid
].str
);
903 get_textfont_prop(font
, propid
, &font
->props
[propid
]);
907 static HRESULT
textrange_expand(ITextRange
*range
, LONG unit
, LONG
*delta
)
909 LONG expand_start
, expand_end
;
915 ITextRange_GetStoryLength(range
, &expand_end
);
918 FIXME("unit %d is not supported\n", unit
);
925 ITextRange_GetStart(range
, &start
);
926 ITextRange_GetEnd(range
, &end
);
927 *delta
= expand_end
- expand_start
- (end
- start
);
930 ITextRange_SetStart(range
, expand_start
);
931 ITextRange_SetEnd(range
, expand_end
);
936 static HRESULT WINAPI
IRichEditOleImpl_inner_fnQueryInterface(IUnknown
*iface
, REFIID riid
, LPVOID
*ppvObj
)
938 IRichEditOleImpl
*This
= impl_from_IUnknown(iface
);
940 TRACE("%p %s\n", This
, debugstr_guid(riid
));
943 if (IsEqualGUID(riid
, &IID_IUnknown
))
944 *ppvObj
= &This
->IUnknown_inner
;
945 else if (IsEqualGUID(riid
, &IID_IRichEditOle
))
946 *ppvObj
= &This
->IRichEditOle_iface
;
947 else if (IsEqualGUID(riid
, &IID_ITextDocument
) || IsEqualGUID(riid
, &IID_ITextDocument2Old
))
948 *ppvObj
= &This
->ITextDocument2Old_iface
;
951 IUnknown_AddRef((IUnknown
*)*ppvObj
);
954 FIXME("%p: unhandled interface %s\n", This
, debugstr_guid(riid
));
956 return E_NOINTERFACE
;
959 static ULONG WINAPI
IRichEditOleImpl_inner_fnAddRef(IUnknown
*iface
)
961 IRichEditOleImpl
*This
= impl_from_IUnknown(iface
);
962 ULONG ref
= InterlockedIncrement(&This
->ref
);
964 TRACE("%p ref = %u\n", This
, ref
);
969 static ULONG WINAPI
IRichEditOleImpl_inner_fnRelease(IUnknown
*iface
)
971 IRichEditOleImpl
*This
= impl_from_IUnknown(iface
);
972 ULONG ref
= InterlockedDecrement(&This
->ref
);
974 TRACE ("%p ref=%u\n", This
, ref
);
978 IOleClientSiteImpl
*clientsite
;
979 ITextRangeImpl
*txtRge
;
981 This
->editor
->reOle
= NULL
;
983 This
->txtSel
->reOle
= NULL
;
984 ITextSelection_Release(&This
->txtSel
->ITextSelection_iface
);
987 LIST_FOR_EACH_ENTRY(txtRge
, &This
->rangelist
, ITextRangeImpl
, child
.entry
)
988 txtRge
->child
.reole
= NULL
;
990 LIST_FOR_EACH_ENTRY(clientsite
, &This
->clientsites
, IOleClientSiteImpl
, child
.entry
)
991 clientsite
->child
.reole
= NULL
;
998 static const IUnknownVtbl reo_unk_vtbl
=
1000 IRichEditOleImpl_inner_fnQueryInterface
,
1001 IRichEditOleImpl_inner_fnAddRef
,
1002 IRichEditOleImpl_inner_fnRelease
1005 static HRESULT WINAPI
1006 IRichEditOle_fnQueryInterface(IRichEditOle
*me
, REFIID riid
, LPVOID
*ppvObj
)
1008 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1009 return IUnknown_QueryInterface(This
->outer_unk
, riid
, ppvObj
);
1013 IRichEditOle_fnAddRef(IRichEditOle
*me
)
1015 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1016 return IUnknown_AddRef(This
->outer_unk
);
1020 IRichEditOle_fnRelease(IRichEditOle
*me
)
1022 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1023 return IUnknown_Release(This
->outer_unk
);
1026 static HRESULT WINAPI
1027 IRichEditOle_fnActivateAs(IRichEditOle
*me
, REFCLSID rclsid
, REFCLSID rclsidAs
)
1029 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1030 FIXME("stub %p\n",This
);
1034 static HRESULT WINAPI
1035 IRichEditOle_fnContextSensitiveHelp(IRichEditOle
*me
, BOOL fEnterMode
)
1037 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1038 FIXME("stub %p\n",This
);
1042 static HRESULT WINAPI
1043 IRichEditOle_fnConvertObject(IRichEditOle
*me
, LONG iob
,
1044 REFCLSID rclsidNew
, LPCSTR lpstrUserTypeNew
)
1046 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1047 FIXME("stub %p\n",This
);
1051 static inline IOleClientSiteImpl
*impl_from_IOleClientSite(IOleClientSite
*iface
)
1053 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleClientSite_iface
);
1056 static HRESULT WINAPI
1057 IOleClientSite_fnQueryInterface(IOleClientSite
*me
, REFIID riid
, LPVOID
*ppvObj
)
1059 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(me
);
1060 TRACE("%p %s\n", me
, debugstr_guid(riid
) );
1063 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
1064 IsEqualGUID(riid
, &IID_IOleClientSite
))
1066 else if (IsEqualGUID(riid
, &IID_IOleWindow
) ||
1067 IsEqualGUID(riid
, &IID_IOleInPlaceSite
))
1068 *ppvObj
= &This
->IOleInPlaceSite_iface
;
1071 IOleClientSite_AddRef(me
);
1074 FIXME("%p: unhandled interface %s\n", me
, debugstr_guid(riid
) );
1076 return E_NOINTERFACE
;
1079 static ULONG WINAPI
IOleClientSite_fnAddRef(IOleClientSite
*iface
)
1081 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1082 ULONG ref
= InterlockedIncrement(&This
->ref
);
1083 TRACE("(%p)->(%u)\n", This
, ref
);
1087 static ULONG WINAPI
IOleClientSite_fnRelease(IOleClientSite
*iface
)
1089 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1090 ULONG ref
= InterlockedDecrement(&This
->ref
);
1092 TRACE("(%p)->(%u)\n", This
, ref
);
1095 if (This
->child
.reole
) {
1096 list_remove(&This
->child
.entry
);
1097 This
->child
.reole
= NULL
;
1104 static HRESULT WINAPI
IOleClientSite_fnSaveObject(IOleClientSite
*iface
)
1106 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1107 if (!This
->child
.reole
)
1108 return CO_E_RELEASED
;
1110 FIXME("stub %p\n", iface
);
1114 static HRESULT WINAPI
IOleClientSite_fnGetMoniker(IOleClientSite
*iface
, DWORD dwAssign
,
1115 DWORD dwWhichMoniker
, IMoniker
**ppmk
)
1117 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1118 if (!This
->child
.reole
)
1119 return CO_E_RELEASED
;
1121 FIXME("stub %p\n", iface
);
1125 static HRESULT WINAPI
IOleClientSite_fnGetContainer(IOleClientSite
*iface
,
1126 IOleContainer
**ppContainer
)
1128 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1129 if (!This
->child
.reole
)
1130 return CO_E_RELEASED
;
1132 FIXME("stub %p\n", iface
);
1136 static HRESULT WINAPI
IOleClientSite_fnShowObject(IOleClientSite
*iface
)
1138 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1139 if (!This
->child
.reole
)
1140 return CO_E_RELEASED
;
1142 FIXME("stub %p\n", iface
);
1146 static HRESULT WINAPI
IOleClientSite_fnOnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
1148 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1149 if (!This
->child
.reole
)
1150 return CO_E_RELEASED
;
1152 FIXME("stub %p\n", iface
);
1156 static HRESULT WINAPI
IOleClientSite_fnRequestNewObjectLayout(IOleClientSite
*iface
)
1158 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1159 if (!This
->child
.reole
)
1160 return CO_E_RELEASED
;
1162 FIXME("stub %p\n", iface
);
1166 static const IOleClientSiteVtbl ocst
= {
1167 IOleClientSite_fnQueryInterface
,
1168 IOleClientSite_fnAddRef
,
1169 IOleClientSite_fnRelease
,
1170 IOleClientSite_fnSaveObject
,
1171 IOleClientSite_fnGetMoniker
,
1172 IOleClientSite_fnGetContainer
,
1173 IOleClientSite_fnShowObject
,
1174 IOleClientSite_fnOnShowWindow
,
1175 IOleClientSite_fnRequestNewObjectLayout
1178 /* IOleInPlaceSite interface */
1179 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnQueryInterface(IOleInPlaceSite
*iface
, REFIID riid
, void **ppvObj
)
1181 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1182 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppvObj
);
1185 static ULONG STDMETHODCALLTYPE
IOleInPlaceSite_fnAddRef(IOleInPlaceSite
*iface
)
1187 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1188 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
1191 static ULONG STDMETHODCALLTYPE
IOleInPlaceSite_fnRelease(IOleInPlaceSite
*iface
)
1193 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1194 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
1197 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnGetWindow(IOleInPlaceSite
*iface
, HWND
*phwnd
)
1199 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1201 TRACE("(%p)->(%p)\n", This
, phwnd
);
1203 if (!This
->child
.reole
)
1204 return CO_E_RELEASED
;
1207 return E_INVALIDARG
;
1209 *phwnd
= This
->child
.reole
->editor
->hWnd
;
1213 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnContextSensitiveHelp(IOleInPlaceSite
*iface
, BOOL fEnterMode
)
1215 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1216 FIXME("not implemented: (%p)->(%d)\n", This
, fEnterMode
);
1220 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnCanInPlaceActivate(IOleInPlaceSite
*iface
)
1222 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1223 FIXME("not implemented: (%p)\n", This
);
1227 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnInPlaceActivate(IOleInPlaceSite
*iface
)
1229 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1230 FIXME("not implemented: (%p)\n", This
);
1234 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnUIActivate(IOleInPlaceSite
*iface
)
1236 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1237 FIXME("not implemented: (%p)\n", This
);
1241 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnGetWindowContext(IOleInPlaceSite
*iface
, IOleInPlaceFrame
**ppFrame
,
1242 IOleInPlaceUIWindow
**ppDoc
, LPRECT lprcPosRect
,
1243 LPRECT lprcClipRect
, LPOLEINPLACEFRAMEINFO lpFrameInfo
)
1245 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1246 FIXME("not implemented: (%p)->(%p %p %p %p %p)\n", This
, ppFrame
, ppDoc
, lprcPosRect
, lprcClipRect
, lpFrameInfo
);
1250 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnScroll(IOleInPlaceSite
*iface
, SIZE scrollExtent
)
1252 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1253 FIXME("not implemented: (%p)\n", This
);
1257 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnUIDeactivate(IOleInPlaceSite
*iface
, BOOL fUndoable
)
1259 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1260 FIXME("not implemented: (%p)->(%d)\n", This
, fUndoable
);
1264 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnInPlaceDeactivate(IOleInPlaceSite
*iface
)
1266 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1267 FIXME("not implemented: (%p)\n", This
);
1271 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnDiscardUndoState(IOleInPlaceSite
*iface
)
1273 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1274 FIXME("not implemented: (%p)\n", This
);
1278 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnDeactivateAndUndo(IOleInPlaceSite
*iface
)
1280 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1281 FIXME("not implemented: (%p)\n", This
);
1285 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnPosRectChange(IOleInPlaceSite
*iface
, LPCRECT lprcPosRect
)
1287 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1288 FIXME("not implemented: (%p)->(%p)\n", This
, lprcPosRect
);
1292 static const IOleInPlaceSiteVtbl olestvt
=
1294 IOleInPlaceSite_fnQueryInterface
,
1295 IOleInPlaceSite_fnAddRef
,
1296 IOleInPlaceSite_fnRelease
,
1297 IOleInPlaceSite_fnGetWindow
,
1298 IOleInPlaceSite_fnContextSensitiveHelp
,
1299 IOleInPlaceSite_fnCanInPlaceActivate
,
1300 IOleInPlaceSite_fnOnInPlaceActivate
,
1301 IOleInPlaceSite_fnOnUIActivate
,
1302 IOleInPlaceSite_fnGetWindowContext
,
1303 IOleInPlaceSite_fnScroll
,
1304 IOleInPlaceSite_fnOnUIDeactivate
,
1305 IOleInPlaceSite_fnOnInPlaceDeactivate
,
1306 IOleInPlaceSite_fnDiscardUndoState
,
1307 IOleInPlaceSite_fnDeactivateAndUndo
,
1308 IOleInPlaceSite_fnOnPosRectChange
1311 static HRESULT
CreateOleClientSite(IRichEditOleImpl
*reOle
, IOleClientSite
**ret
)
1313 IOleClientSiteImpl
*clientSite
= heap_alloc(sizeof *clientSite
);
1316 return E_OUTOFMEMORY
;
1318 clientSite
->IOleClientSite_iface
.lpVtbl
= &ocst
;
1319 clientSite
->IOleInPlaceSite_iface
.lpVtbl
= &olestvt
;
1320 clientSite
->ref
= 1;
1321 clientSite
->child
.reole
= reOle
;
1322 list_add_head(&reOle
->clientsites
, &clientSite
->child
.entry
);
1324 *ret
= &clientSite
->IOleClientSite_iface
;
1328 static HRESULT WINAPI
1329 IRichEditOle_fnGetClientSite(IRichEditOle
*me
, IOleClientSite
**clientsite
)
1331 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1333 TRACE("(%p)->(%p)\n", This
, clientsite
);
1336 return E_INVALIDARG
;
1338 return CreateOleClientSite(This
, clientsite
);
1341 static HRESULT WINAPI
1342 IRichEditOle_fnGetClipboardData(IRichEditOle
*me
, CHARRANGE
*lpchrg
,
1343 DWORD reco
, LPDATAOBJECT
*lplpdataobj
)
1345 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1349 TRACE("(%p,%p,%d)\n",This
, lpchrg
, reco
);
1351 return E_INVALIDARG
;
1353 int nFrom
, nTo
, nStartCur
= ME_GetSelectionOfs(This
->editor
, &nFrom
, &nTo
);
1354 start
= This
->editor
->pCursors
[nStartCur
];
1355 nChars
= nTo
- nFrom
;
1357 ME_CursorFromCharOfs(This
->editor
, lpchrg
->cpMin
, &start
);
1358 nChars
= lpchrg
->cpMax
- lpchrg
->cpMin
;
1360 return ME_GetDataObject(This
->editor
, &start
, nChars
, lplpdataobj
);
1363 static LONG WINAPI
IRichEditOle_fnGetLinkCount(IRichEditOle
*me
)
1365 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1366 FIXME("stub %p\n",This
);
1370 static HRESULT WINAPI
1371 IRichEditOle_fnGetObject(IRichEditOle
*me
, LONG iob
,
1372 REOBJECT
*lpreobject
, DWORD dwFlags
)
1374 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1375 struct re_object
*reobj
= NULL
;
1378 TRACE("(%p)->(%x, %p, %x)\n", This
, iob
, lpreobject
, dwFlags
);
1380 if (!lpreobject
|| !lpreobject
->cbStruct
)
1381 return E_INVALIDARG
;
1383 if (iob
== REO_IOB_USE_CP
)
1387 TRACE("character offset: %d\n", lpreobject
->cp
);
1388 ME_CursorFromCharOfs(This
->editor
, lpreobject
->cp
, &cursor
);
1389 if (!cursor
.pRun
->member
.run
.reobj
)
1390 return E_INVALIDARG
;
1392 reobj
= cursor
.pRun
->member
.run
.reobj
;
1394 else if (iob
== REO_IOB_SELECTION
)
1396 ME_Cursor
*from
, *to
;
1398 ME_GetSelection(This
->editor
, &from
, &to
);
1399 if (!from
->pRun
->member
.run
.reobj
)
1400 return E_INVALIDARG
;
1402 reobj
= from
->pRun
->member
.run
.reobj
;
1406 if (iob
> IRichEditOle_GetObjectCount(me
))
1407 return E_INVALIDARG
;
1408 LIST_FOR_EACH_ENTRY(reobj
, &This
->editor
->reobj_list
, struct re_object
, entry
)
1415 ME_CopyReObject(lpreobject
, &reobj
->obj
, dwFlags
);
1420 IRichEditOle_fnGetObjectCount(IRichEditOle
*me
)
1422 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1423 TRACE("(%p)\n",This
);
1424 return list_count(&This
->editor
->reobj_list
);
1427 static HRESULT WINAPI
1428 IRichEditOle_fnHandsOffStorage(IRichEditOle
*me
, LONG iob
)
1430 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1431 FIXME("stub %p\n",This
);
1435 static HRESULT WINAPI
1436 IRichEditOle_fnImportDataObject(IRichEditOle
*me
, LPDATAOBJECT lpdataobj
,
1437 CLIPFORMAT cf
, HGLOBAL hMetaPict
)
1439 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1440 FIXME("stub %p\n",This
);
1444 static HRESULT WINAPI
1445 IRichEditOle_fnInPlaceDeactivate(IRichEditOle
*me
)
1447 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1448 FIXME("stub %p\n",This
);
1452 static HRESULT WINAPI
1453 IRichEditOle_fnInsertObject(IRichEditOle
*me
, REOBJECT
*reo
)
1455 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1457 TRACE("(%p,%p)\n", This
, reo
);
1460 return E_INVALIDARG
;
1462 if (reo
->cbStruct
< sizeof(*reo
)) return STG_E_INVALIDPARAMETER
;
1464 ME_InsertOLEFromCursor(This
->editor
, reo
, 0);
1465 ME_CommitUndo(This
->editor
);
1466 ME_UpdateRepaint(This
->editor
, FALSE
);
1470 static HRESULT WINAPI
IRichEditOle_fnSaveCompleted(IRichEditOle
*me
, LONG iob
,
1473 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1474 FIXME("stub %p\n",This
);
1478 static HRESULT WINAPI
1479 IRichEditOle_fnSetDvaspect(IRichEditOle
*me
, LONG iob
, DWORD dvaspect
)
1481 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1482 FIXME("stub %p\n",This
);
1486 static HRESULT WINAPI
IRichEditOle_fnSetHostNames(IRichEditOle
*me
,
1487 LPCSTR lpstrContainerApp
, LPCSTR lpstrContainerObj
)
1489 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1490 FIXME("stub %p %s %s\n",This
, lpstrContainerApp
, lpstrContainerObj
);
1494 static HRESULT WINAPI
1495 IRichEditOle_fnSetLinkAvailable(IRichEditOle
*me
, LONG iob
, BOOL fAvailable
)
1497 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1498 FIXME("stub %p\n",This
);
1502 static const IRichEditOleVtbl revt
= {
1503 IRichEditOle_fnQueryInterface
,
1504 IRichEditOle_fnAddRef
,
1505 IRichEditOle_fnRelease
,
1506 IRichEditOle_fnGetClientSite
,
1507 IRichEditOle_fnGetObjectCount
,
1508 IRichEditOle_fnGetLinkCount
,
1509 IRichEditOle_fnGetObject
,
1510 IRichEditOle_fnInsertObject
,
1511 IRichEditOle_fnConvertObject
,
1512 IRichEditOle_fnActivateAs
,
1513 IRichEditOle_fnSetHostNames
,
1514 IRichEditOle_fnSetLinkAvailable
,
1515 IRichEditOle_fnSetDvaspect
,
1516 IRichEditOle_fnHandsOffStorage
,
1517 IRichEditOle_fnSaveCompleted
,
1518 IRichEditOle_fnInPlaceDeactivate
,
1519 IRichEditOle_fnContextSensitiveHelp
,
1520 IRichEditOle_fnGetClipboardData
,
1521 IRichEditOle_fnImportDataObject
1524 /* ITextRange interface */
1525 static HRESULT WINAPI
ITextRange_fnQueryInterface(ITextRange
*me
, REFIID riid
, void **ppvObj
)
1527 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1530 if (IsEqualGUID(riid
, &IID_IUnknown
)
1531 || IsEqualGUID(riid
, &IID_IDispatch
)
1532 || IsEqualGUID(riid
, &IID_ITextRange
))
1535 ITextRange_AddRef(me
);
1538 else if (IsEqualGUID(riid
, &IID_Igetrichole
))
1540 *ppvObj
= This
->child
.reole
;
1544 return E_NOINTERFACE
;
1547 static ULONG WINAPI
ITextRange_fnAddRef(ITextRange
*me
)
1549 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1550 return InterlockedIncrement(&This
->ref
);
1553 static ULONG WINAPI
ITextRange_fnRelease(ITextRange
*me
)
1555 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1556 ULONG ref
= InterlockedDecrement(&This
->ref
);
1558 TRACE ("%p ref=%u\n", This
, ref
);
1561 if (This
->child
.reole
)
1563 list_remove(&This
->child
.entry
);
1564 This
->child
.reole
= NULL
;
1571 static HRESULT WINAPI
ITextRange_fnGetTypeInfoCount(ITextRange
*me
, UINT
*pctinfo
)
1573 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1574 TRACE("(%p)->(%p)\n", This
, pctinfo
);
1579 static HRESULT WINAPI
ITextRange_fnGetTypeInfo(ITextRange
*me
, UINT iTInfo
, LCID lcid
,
1580 ITypeInfo
**ppTInfo
)
1582 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1585 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
1587 hr
= get_typeinfo(ITextRange_tid
, ppTInfo
);
1589 ITypeInfo_AddRef(*ppTInfo
);
1593 static HRESULT WINAPI
ITextRange_fnGetIDsOfNames(ITextRange
*me
, REFIID riid
, LPOLESTR
*rgszNames
,
1594 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1596 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1600 TRACE("(%p)->(%s, %p, %u, %d, %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
,
1603 hr
= get_typeinfo(ITextRange_tid
, &ti
);
1605 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
1609 static HRESULT WINAPI
ITextRange_fnInvoke(ITextRange
*me
, DISPID dispIdMember
, REFIID riid
,
1610 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1611 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
1614 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1618 TRACE("(%p)->(%d, %s, %d, %u, %p, %p, %p, %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
1619 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1621 hr
= get_typeinfo(ITextRange_tid
, &ti
);
1623 hr
= ITypeInfo_Invoke(ti
, me
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1627 static HRESULT WINAPI
ITextRange_fnGetText(ITextRange
*me
, BSTR
*str
)
1629 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1630 ME_TextEditor
*editor
;
1631 ME_Cursor start
, end
;
1635 TRACE("(%p)->(%p)\n", This
, str
);
1637 if (!This
->child
.reole
)
1638 return CO_E_RELEASED
;
1641 return E_INVALIDARG
;
1643 /* return early for degenerate range */
1644 if (This
->start
== This
->end
) {
1649 editor
= This
->child
.reole
->editor
;
1650 ME_CursorFromCharOfs(editor
, This
->start
, &start
);
1651 ME_CursorFromCharOfs(editor
, This
->end
, &end
);
1653 length
= This
->end
- This
->start
;
1654 *str
= SysAllocStringLen(NULL
, length
);
1656 return E_OUTOFMEMORY
;
1658 bEOP
= (end
.pRun
->next
->type
== diTextEnd
&& This
->end
> ME_GetTextLength(editor
));
1659 ME_GetTextW(editor
, *str
, length
, &start
, length
, FALSE
, bEOP
);
1663 static HRESULT WINAPI
ITextRange_fnSetText(ITextRange
*me
, BSTR str
)
1665 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1666 ME_TextEditor
*editor
;
1671 TRACE("(%p)->(%s)\n", This
, debugstr_w(str
));
1673 if (!This
->child
.reole
)
1674 return CO_E_RELEASED
;
1676 editor
= This
->child
.reole
->editor
;
1678 /* delete only where's something to delete */
1679 if (This
->start
!= This
->end
) {
1680 ME_CursorFromCharOfs(editor
, This
->start
, &cursor
);
1681 ME_InternalDeleteText(editor
, &cursor
, This
->end
- This
->start
, FALSE
);
1684 if (!str
|| !*str
) {
1685 /* will update this range as well */
1686 textranges_update_ranges(This
->child
.reole
, This
->start
, This
->end
, RANGE_UPDATE_DELETE
);
1690 /* it's safer not to rely on stored BSTR length */
1691 len
= lstrlenW(str
);
1692 cursor
= editor
->pCursors
[0];
1693 ME_CursorFromCharOfs(editor
, This
->start
, &editor
->pCursors
[0]);
1694 style
= ME_GetInsertStyle(editor
, 0);
1695 ME_InsertTextFromCursor(editor
, 0, str
, len
, style
);
1696 ME_ReleaseStyle(style
);
1697 editor
->pCursors
[0] = cursor
;
1699 if (len
< This
->end
- This
->start
)
1700 textranges_update_ranges(This
->child
.reole
, This
->start
+ len
, This
->end
, RANGE_UPDATE_DELETE
);
1702 This
->end
= len
- This
->start
;
1707 static HRESULT
range_GetChar(ME_TextEditor
*editor
, ME_Cursor
*cursor
, LONG
*pch
)
1711 ME_GetTextW(editor
, wch
, 1, cursor
, 1, FALSE
, cursor
->pRun
->next
->type
== diTextEnd
);
1717 static HRESULT WINAPI
ITextRange_fnGetChar(ITextRange
*me
, LONG
*pch
)
1719 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1720 ME_TextEditor
*editor
;
1723 TRACE("(%p)->(%p)\n", This
, pch
);
1725 if (!This
->child
.reole
)
1726 return CO_E_RELEASED
;
1729 return E_INVALIDARG
;
1731 editor
= This
->child
.reole
->editor
;
1732 ME_CursorFromCharOfs(editor
, This
->start
, &cursor
);
1733 return range_GetChar(editor
, &cursor
, pch
);
1736 static HRESULT WINAPI
ITextRange_fnSetChar(ITextRange
*me
, LONG ch
)
1738 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1740 FIXME("(%p)->(%x): stub\n", This
, ch
);
1742 if (!This
->child
.reole
)
1743 return CO_E_RELEASED
;
1748 static HRESULT
CreateITextRange(IRichEditOleImpl
*reOle
, LONG start
, LONG end
, ITextRange
** ppRange
);
1750 static HRESULT WINAPI
ITextRange_fnGetDuplicate(ITextRange
*me
, ITextRange
**ppRange
)
1752 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1754 TRACE("(%p)->(%p)\n", This
, ppRange
);
1756 if (!This
->child
.reole
)
1757 return CO_E_RELEASED
;
1760 return E_INVALIDARG
;
1762 return CreateITextRange(This
->child
.reole
, This
->start
, This
->end
, ppRange
);
1765 static HRESULT WINAPI
ITextRange_fnGetFormattedText(ITextRange
*me
, ITextRange
**range
)
1767 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1769 FIXME("(%p)->(%p): stub\n", This
, range
);
1771 if (!This
->child
.reole
)
1772 return CO_E_RELEASED
;
1777 static HRESULT WINAPI
ITextRange_fnSetFormattedText(ITextRange
*me
, ITextRange
*range
)
1779 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1781 FIXME("(%p)->(%p): stub\n", This
, range
);
1783 if (!This
->child
.reole
)
1784 return CO_E_RELEASED
;
1789 static HRESULT WINAPI
ITextRange_fnGetStart(ITextRange
*me
, LONG
*start
)
1791 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1793 TRACE("(%p)->(%p)\n", This
, start
);
1795 if (!This
->child
.reole
)
1796 return CO_E_RELEASED
;
1799 return E_INVALIDARG
;
1801 *start
= This
->start
;
1805 static HRESULT
textrange_setstart(const IRichEditOleImpl
*reole
, LONG value
, LONG
*start
, LONG
*end
)
1812 if (value
== *start
)
1815 if (value
<= *end
) {
1820 len
= ME_GetTextLength(reole
->editor
);
1821 *start
= *end
= value
> len
? len
: value
;
1825 static HRESULT WINAPI
ITextRange_fnSetStart(ITextRange
*me
, LONG value
)
1827 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1829 TRACE("(%p)->(%d)\n", This
, value
);
1831 if (!This
->child
.reole
)
1832 return CO_E_RELEASED
;
1834 return textrange_setstart(This
->child
.reole
, value
, &This
->start
, &This
->end
);
1837 static HRESULT WINAPI
ITextRange_fnGetEnd(ITextRange
*me
, LONG
*end
)
1839 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1841 TRACE("(%p)->(%p)\n", This
, end
);
1843 if (!This
->child
.reole
)
1844 return CO_E_RELEASED
;
1847 return E_INVALIDARG
;
1853 static HRESULT
textrange_setend(const IRichEditOleImpl
*reole
, LONG value
, LONG
*start
, LONG
*end
)
1860 if (value
< *start
) {
1861 *start
= *end
= max(0, value
);
1865 len
= ME_GetTextLength(reole
->editor
);
1866 *end
= value
> len
? len
+ 1 : value
;
1870 static HRESULT WINAPI
ITextRange_fnSetEnd(ITextRange
*me
, LONG value
)
1872 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1874 TRACE("(%p)->(%d)\n", This
, value
);
1876 if (!This
->child
.reole
)
1877 return CO_E_RELEASED
;
1879 return textrange_setend(This
->child
.reole
, value
, &This
->start
, &This
->end
);
1882 static HRESULT WINAPI
ITextRange_fnGetFont(ITextRange
*me
, ITextFont
**font
)
1884 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1886 TRACE("(%p)->(%p)\n", This
, font
);
1888 if (!This
->child
.reole
)
1889 return CO_E_RELEASED
;
1892 return E_INVALIDARG
;
1894 return create_textfont(me
, NULL
, font
);
1897 static HRESULT WINAPI
ITextRange_fnSetFont(ITextRange
*me
, ITextFont
*font
)
1899 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1901 TRACE("(%p)->(%p)\n", This
, font
);
1904 return E_INVALIDARG
;
1906 if (!This
->child
.reole
)
1907 return CO_E_RELEASED
;
1909 textrange_set_font(me
, font
);
1913 static HRESULT WINAPI
ITextRange_fnGetPara(ITextRange
*me
, ITextPara
**para
)
1915 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1917 TRACE("(%p)->(%p)\n", This
, para
);
1919 if (!This
->child
.reole
)
1920 return CO_E_RELEASED
;
1923 return E_INVALIDARG
;
1925 return create_textpara(me
, para
);
1928 static HRESULT WINAPI
ITextRange_fnSetPara(ITextRange
*me
, ITextPara
*para
)
1930 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1932 FIXME("(%p)->(%p): stub\n", This
, para
);
1934 if (!This
->child
.reole
)
1935 return CO_E_RELEASED
;
1940 static HRESULT WINAPI
ITextRange_fnGetStoryLength(ITextRange
*me
, LONG
*length
)
1942 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1944 TRACE("(%p)->(%p)\n", This
, length
);
1946 if (!This
->child
.reole
)
1947 return CO_E_RELEASED
;
1949 return textrange_get_storylength(This
->child
.reole
->editor
, length
);
1952 static HRESULT WINAPI
ITextRange_fnGetStoryType(ITextRange
*me
, LONG
*value
)
1954 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1956 TRACE("(%p)->(%p)\n", This
, value
);
1958 if (!This
->child
.reole
)
1959 return CO_E_RELEASED
;
1962 return E_INVALIDARG
;
1964 *value
= tomUnknownStory
;
1968 static HRESULT
range_Collapse(LONG bStart
, LONG
*start
, LONG
*end
)
1973 if (bStart
== tomEnd
)
1980 static HRESULT WINAPI
ITextRange_fnCollapse(ITextRange
*me
, LONG bStart
)
1982 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1984 TRACE("(%p)->(%d)\n", This
, bStart
);
1986 if (!This
->child
.reole
)
1987 return CO_E_RELEASED
;
1989 return range_Collapse(bStart
, &This
->start
, &This
->end
);
1992 static HRESULT WINAPI
ITextRange_fnExpand(ITextRange
*me
, LONG unit
, LONG
*delta
)
1994 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1996 TRACE("(%p)->(%d %p)\n", This
, unit
, delta
);
1998 if (!This
->child
.reole
)
1999 return CO_E_RELEASED
;
2001 return textrange_expand(me
, unit
, delta
);
2004 static HRESULT WINAPI
ITextRange_fnGetIndex(ITextRange
*me
, LONG unit
, LONG
*index
)
2006 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2008 FIXME("(%p)->(%d %p): stub\n", This
, unit
, index
);
2010 if (!This
->child
.reole
)
2011 return CO_E_RELEASED
;
2016 static HRESULT WINAPI
ITextRange_fnSetIndex(ITextRange
*me
, LONG unit
, LONG index
,
2019 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2021 FIXME("(%p)->(%d %d %d): stub\n", This
, unit
, index
, extend
);
2023 if (!This
->child
.reole
)
2024 return CO_E_RELEASED
;
2029 static void cp2range(ME_TextEditor
*editor
, LONG
*cp1
, LONG
*cp2
)
2031 int len
= ME_GetTextLength(editor
) + 1;
2033 *cp1
= max(*cp1
, 0);
2034 *cp2
= max(*cp2
, 0);
2035 *cp1
= min(*cp1
, len
);
2036 *cp2
= min(*cp2
, len
);
2044 *cp1
= *cp2
= len
- 1;
2047 static HRESULT WINAPI
ITextRange_fnSetRange(ITextRange
*me
, LONG anchor
, LONG active
)
2049 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2051 TRACE("(%p)->(%d %d)\n", This
, anchor
, active
);
2053 if (!This
->child
.reole
)
2054 return CO_E_RELEASED
;
2056 cp2range(This
->child
.reole
->editor
, &anchor
, &active
);
2057 if (anchor
== This
->start
&& active
== This
->end
)
2060 This
->start
= anchor
;
2065 static HRESULT
textrange_inrange(LONG start
, LONG end
, ITextRange
*range
, LONG
*ret
)
2072 if (FAILED(ITextRange_GetStart(range
, &from
)) || FAILED(ITextRange_GetEnd(range
, &to
))) {
2076 *ret
= (start
>= from
&& end
<= to
) ? tomTrue
: tomFalse
;
2077 return *ret
== tomTrue
? S_OK
: S_FALSE
;
2080 static HRESULT WINAPI
ITextRange_fnInRange(ITextRange
*me
, ITextRange
*range
, LONG
*ret
)
2082 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2084 TRACE("(%p)->(%p %p)\n", This
, range
, ret
);
2089 if (!This
->child
.reole
)
2090 return CO_E_RELEASED
;
2095 return textrange_inrange(This
->start
, This
->end
, range
, ret
);
2098 static HRESULT WINAPI
ITextRange_fnInStory(ITextRange
*me
, ITextRange
*pRange
, LONG
*ret
)
2100 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2102 FIXME("(%p)->(%p): stub\n", This
, ret
);
2104 if (!This
->child
.reole
)
2105 return CO_E_RELEASED
;
2110 static HRESULT
textrange_isequal(LONG start
, LONG end
, ITextRange
*range
, LONG
*ret
)
2117 if (FAILED(ITextRange_GetStart(range
, &from
)) || FAILED(ITextRange_GetEnd(range
, &to
))) {
2121 *ret
= (start
== from
&& end
== to
) ? tomTrue
: tomFalse
;
2122 return *ret
== tomTrue
? S_OK
: S_FALSE
;
2125 static HRESULT WINAPI
ITextRange_fnIsEqual(ITextRange
*me
, ITextRange
*range
, LONG
*ret
)
2127 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2129 TRACE("(%p)->(%p %p)\n", This
, range
, ret
);
2134 if (!This
->child
.reole
)
2135 return CO_E_RELEASED
;
2140 return textrange_isequal(This
->start
, This
->end
, range
, ret
);
2143 static HRESULT WINAPI
ITextRange_fnSelect(ITextRange
*me
)
2145 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2147 TRACE("(%p)\n", This
);
2149 if (!This
->child
.reole
)
2150 return CO_E_RELEASED
;
2152 set_selection(This
->child
.reole
->editor
, This
->start
, This
->end
);
2156 static HRESULT WINAPI
ITextRange_fnStartOf(ITextRange
*me
, LONG unit
, LONG extend
,
2159 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2161 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, extend
, delta
);
2163 if (!This
->child
.reole
)
2164 return CO_E_RELEASED
;
2169 static HRESULT WINAPI
ITextRange_fnEndOf(ITextRange
*me
, LONG unit
, LONG extend
,
2172 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2174 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, extend
, delta
);
2176 if (!This
->child
.reole
)
2177 return CO_E_RELEASED
;
2182 static HRESULT WINAPI
ITextRange_fnMove(ITextRange
*me
, LONG unit
, LONG count
, LONG
*delta
)
2184 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2186 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, count
, delta
);
2188 if (!This
->child
.reole
)
2189 return CO_E_RELEASED
;
2194 static HRESULT WINAPI
ITextRange_fnMoveStart(ITextRange
*me
, LONG unit
, LONG count
,
2197 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2199 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, count
, delta
);
2201 if (!This
->child
.reole
)
2202 return CO_E_RELEASED
;
2207 static HRESULT
textrange_moveend(ITextRange
*range
, LONG unit
, LONG count
, LONG
*delta
)
2209 LONG old_start
, old_end
, new_start
, new_end
;
2219 ITextRange_GetStart(range
, &old_start
);
2220 ITextRange_GetEnd(range
, &old_end
);
2225 new_start
= new_end
= 0;
2228 new_start
= old_start
;
2229 ITextRange_GetStoryLength(range
, &new_end
);
2233 if (new_end
< old_end
)
2235 else if (new_end
== old_end
)
2242 FIXME("unit %d is not supported\n", unit
);
2245 if (new_end
== old_end
)
2247 ITextRange_SetStart(range
, new_start
);
2248 ITextRange_SetEnd(range
, new_end
);
2253 static HRESULT WINAPI
ITextRange_fnMoveEnd(ITextRange
*me
, LONG unit
, LONG count
,
2256 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2258 TRACE("(%p)->(%d %d %p)\n", This
, unit
, count
, delta
);
2260 if (!This
->child
.reole
)
2261 return CO_E_RELEASED
;
2263 return textrange_moveend(me
, unit
, count
, delta
);
2266 static HRESULT WINAPI
ITextRange_fnMoveWhile(ITextRange
*me
, VARIANT
*charset
, LONG count
,
2269 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2271 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
2273 if (!This
->child
.reole
)
2274 return CO_E_RELEASED
;
2279 static HRESULT WINAPI
ITextRange_fnMoveStartWhile(ITextRange
*me
, VARIANT
*charset
, LONG count
,
2282 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2284 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
2286 if (!This
->child
.reole
)
2287 return CO_E_RELEASED
;
2292 static HRESULT WINAPI
ITextRange_fnMoveEndWhile(ITextRange
*me
, VARIANT
*charset
, LONG count
,
2295 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2297 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
2299 if (!This
->child
.reole
)
2300 return CO_E_RELEASED
;
2305 static HRESULT WINAPI
ITextRange_fnMoveUntil(ITextRange
*me
, VARIANT
*charset
, LONG count
,
2308 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2310 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
2312 if (!This
->child
.reole
)
2313 return CO_E_RELEASED
;
2318 static HRESULT WINAPI
ITextRange_fnMoveStartUntil(ITextRange
*me
, VARIANT
*charset
, LONG count
,
2321 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2323 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
2325 if (!This
->child
.reole
)
2326 return CO_E_RELEASED
;
2331 static HRESULT WINAPI
ITextRange_fnMoveEndUntil(ITextRange
*me
, VARIANT
*charset
, LONG count
,
2334 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2336 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
2338 if (!This
->child
.reole
)
2339 return CO_E_RELEASED
;
2344 static HRESULT WINAPI
ITextRange_fnFindText(ITextRange
*me
, BSTR text
, LONG count
, LONG flags
,
2347 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2349 FIXME("(%p)->(%s %d %x %p): stub\n", This
, debugstr_w(text
), count
, flags
, length
);
2351 if (!This
->child
.reole
)
2352 return CO_E_RELEASED
;
2357 static HRESULT WINAPI
ITextRange_fnFindTextStart(ITextRange
*me
, BSTR text
, LONG count
,
2358 LONG flags
, LONG
*length
)
2360 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2362 FIXME("(%p)->(%s %d %x %p): stub\n", This
, debugstr_w(text
), count
, flags
, length
);
2364 if (!This
->child
.reole
)
2365 return CO_E_RELEASED
;
2370 static HRESULT WINAPI
ITextRange_fnFindTextEnd(ITextRange
*me
, BSTR text
, LONG count
,
2371 LONG flags
, LONG
*length
)
2373 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2375 FIXME("(%p)->(%s %d %x %p): stub\n", This
, debugstr_w(text
), count
, flags
, length
);
2377 if (!This
->child
.reole
)
2378 return CO_E_RELEASED
;
2383 static HRESULT WINAPI
ITextRange_fnDelete(ITextRange
*me
, LONG unit
, LONG count
, LONG
*delta
)
2385 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2387 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, count
, delta
);
2389 if (!This
->child
.reole
)
2390 return CO_E_RELEASED
;
2395 static HRESULT WINAPI
ITextRange_fnCut(ITextRange
*me
, VARIANT
*v
)
2397 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2399 FIXME("(%p)->(%p): stub\n", This
, v
);
2401 if (!This
->child
.reole
)
2402 return CO_E_RELEASED
;
2407 static HRESULT WINAPI
ITextRange_fnCopy(ITextRange
*me
, VARIANT
*v
)
2409 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2411 FIXME("(%p)->(%p): stub\n", This
, v
);
2413 if (!This
->child
.reole
)
2414 return CO_E_RELEASED
;
2419 static HRESULT WINAPI
ITextRange_fnPaste(ITextRange
*me
, VARIANT
*v
, LONG format
)
2421 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2423 FIXME("(%p)->(%s %x): stub\n", This
, debugstr_variant(v
), format
);
2425 if (!This
->child
.reole
)
2426 return CO_E_RELEASED
;
2431 static HRESULT WINAPI
ITextRange_fnCanPaste(ITextRange
*me
, VARIANT
*v
, LONG format
, LONG
*ret
)
2433 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2435 FIXME("(%p)->(%s %x %p): stub\n", This
, debugstr_variant(v
), format
, ret
);
2437 if (!This
->child
.reole
)
2438 return CO_E_RELEASED
;
2443 static HRESULT WINAPI
ITextRange_fnCanEdit(ITextRange
*me
, LONG
*ret
)
2445 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2447 FIXME("(%p)->(%p): stub\n", This
, ret
);
2449 if (!This
->child
.reole
)
2450 return CO_E_RELEASED
;
2455 static HRESULT WINAPI
ITextRange_fnChangeCase(ITextRange
*me
, LONG type
)
2457 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2459 FIXME("(%p)->(%d): stub\n", This
, type
);
2461 if (!This
->child
.reole
)
2462 return CO_E_RELEASED
;
2467 static HRESULT WINAPI
ITextRange_fnGetPoint(ITextRange
*me
, LONG type
, LONG
*cx
, LONG
*cy
)
2469 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2471 FIXME("(%p)->(%d %p %p): stub\n", This
, type
, cx
, cy
);
2473 if (!This
->child
.reole
)
2474 return CO_E_RELEASED
;
2479 static HRESULT WINAPI
ITextRange_fnSetPoint(ITextRange
*me
, LONG x
, LONG y
, LONG type
,
2482 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2484 FIXME("(%p)->(%d %d %d %d): stub\n", This
, x
, y
, type
, extend
);
2486 if (!This
->child
.reole
)
2487 return CO_E_RELEASED
;
2492 static HRESULT WINAPI
ITextRange_fnScrollIntoView(ITextRange
*me
, LONG value
)
2494 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2495 ME_TextEditor
*editor
;
2499 TRACE("(%p)->(%d)\n", This
, value
);
2501 if (!This
->child
.reole
)
2502 return CO_E_RELEASED
;
2504 editor
= This
->child
.reole
->editor
;
2509 ME_CursorFromCharOfs(editor
, This
->start
, &cursor
);
2510 ME_GetCursorCoordinates(editor
, &cursor
, &x
, &y
, &height
);
2513 ME_CursorFromCharOfs(editor
, This
->end
, &cursor
);
2514 ME_GetCursorCoordinates(editor
, &cursor
, &x
, &y
, &height
);
2517 FIXME("bStart value %d not handled\n", value
);
2520 ME_ScrollAbs(editor
, x
, y
);
2524 static HRESULT WINAPI
ITextRange_fnGetEmbeddedObject(ITextRange
*me
, IUnknown
**ppv
)
2526 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2528 FIXME("(%p)->(%p): stub\n", This
, ppv
);
2530 if (!This
->child
.reole
)
2531 return CO_E_RELEASED
;
2536 static const ITextRangeVtbl trvt
= {
2537 ITextRange_fnQueryInterface
,
2538 ITextRange_fnAddRef
,
2539 ITextRange_fnRelease
,
2540 ITextRange_fnGetTypeInfoCount
,
2541 ITextRange_fnGetTypeInfo
,
2542 ITextRange_fnGetIDsOfNames
,
2543 ITextRange_fnInvoke
,
2544 ITextRange_fnGetText
,
2545 ITextRange_fnSetText
,
2546 ITextRange_fnGetChar
,
2547 ITextRange_fnSetChar
,
2548 ITextRange_fnGetDuplicate
,
2549 ITextRange_fnGetFormattedText
,
2550 ITextRange_fnSetFormattedText
,
2551 ITextRange_fnGetStart
,
2552 ITextRange_fnSetStart
,
2553 ITextRange_fnGetEnd
,
2554 ITextRange_fnSetEnd
,
2555 ITextRange_fnGetFont
,
2556 ITextRange_fnSetFont
,
2557 ITextRange_fnGetPara
,
2558 ITextRange_fnSetPara
,
2559 ITextRange_fnGetStoryLength
,
2560 ITextRange_fnGetStoryType
,
2561 ITextRange_fnCollapse
,
2562 ITextRange_fnExpand
,
2563 ITextRange_fnGetIndex
,
2564 ITextRange_fnSetIndex
,
2565 ITextRange_fnSetRange
,
2566 ITextRange_fnInRange
,
2567 ITextRange_fnInStory
,
2568 ITextRange_fnIsEqual
,
2569 ITextRange_fnSelect
,
2570 ITextRange_fnStartOf
,
2573 ITextRange_fnMoveStart
,
2574 ITextRange_fnMoveEnd
,
2575 ITextRange_fnMoveWhile
,
2576 ITextRange_fnMoveStartWhile
,
2577 ITextRange_fnMoveEndWhile
,
2578 ITextRange_fnMoveUntil
,
2579 ITextRange_fnMoveStartUntil
,
2580 ITextRange_fnMoveEndUntil
,
2581 ITextRange_fnFindText
,
2582 ITextRange_fnFindTextStart
,
2583 ITextRange_fnFindTextEnd
,
2584 ITextRange_fnDelete
,
2588 ITextRange_fnCanPaste
,
2589 ITextRange_fnCanEdit
,
2590 ITextRange_fnChangeCase
,
2591 ITextRange_fnGetPoint
,
2592 ITextRange_fnSetPoint
,
2593 ITextRange_fnScrollIntoView
,
2594 ITextRange_fnGetEmbeddedObject
2598 static HRESULT WINAPI
TextFont_QueryInterface(ITextFont
*iface
, REFIID riid
, void **ppv
)
2600 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2602 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
2604 if (IsEqualIID(riid
, &IID_ITextFont
) ||
2605 IsEqualIID(riid
, &IID_IDispatch
) ||
2606 IsEqualIID(riid
, &IID_IUnknown
))
2609 ITextFont_AddRef(iface
);
2614 return E_NOINTERFACE
;
2617 static ULONG WINAPI
TextFont_AddRef(ITextFont
*iface
)
2619 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2620 ULONG ref
= InterlockedIncrement(&This
->ref
);
2621 TRACE("(%p)->(%u)\n", This
, ref
);
2625 static ULONG WINAPI
TextFont_Release(ITextFont
*iface
)
2627 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2628 ULONG ref
= InterlockedDecrement(&This
->ref
);
2630 TRACE("(%p)->(%u)\n", This
, ref
);
2635 ITextRange_Release(This
->range
);
2636 SysFreeString(This
->props
[FONT_NAME
].str
);
2643 static HRESULT WINAPI
TextFont_GetTypeInfoCount(ITextFont
*iface
, UINT
*pctinfo
)
2645 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2646 TRACE("(%p)->(%p)\n", This
, pctinfo
);
2651 static HRESULT WINAPI
TextFont_GetTypeInfo(ITextFont
*iface
, UINT iTInfo
, LCID lcid
,
2652 ITypeInfo
**ppTInfo
)
2654 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2657 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
2659 hr
= get_typeinfo(ITextFont_tid
, ppTInfo
);
2661 ITypeInfo_AddRef(*ppTInfo
);
2665 static HRESULT WINAPI
TextFont_GetIDsOfNames(ITextFont
*iface
, REFIID riid
,
2666 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
2668 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2672 TRACE("(%p)->(%s, %p, %u, %d, %p)\n", This
, debugstr_guid(riid
),
2673 rgszNames
, cNames
, lcid
, rgDispId
);
2675 hr
= get_typeinfo(ITextFont_tid
, &ti
);
2677 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
2681 static HRESULT WINAPI
TextFont_Invoke(
2683 DISPID dispIdMember
,
2687 DISPPARAMS
*pDispParams
,
2688 VARIANT
*pVarResult
,
2689 EXCEPINFO
*pExcepInfo
,
2692 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2696 TRACE("(%p)->(%d, %s, %d, %u, %p, %p, %p, %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
2697 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2699 hr
= get_typeinfo(ITextFont_tid
, &ti
);
2701 hr
= ITypeInfo_Invoke(ti
, iface
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2705 static HRESULT WINAPI
TextFont_GetDuplicate(ITextFont
*iface
, ITextFont
**ret
)
2707 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2709 TRACE("(%p)->(%p)\n", This
, ret
);
2712 return E_INVALIDARG
;
2715 if (This
->range
&& !get_range_reole(This
->range
))
2716 return CO_E_RELEASED
;
2718 return create_textfont(NULL
, This
, ret
);
2721 static HRESULT WINAPI
TextFont_SetDuplicate(ITextFont
*iface
, ITextFont
*pFont
)
2723 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2724 FIXME("(%p)->(%p): stub\n", This
, pFont
);
2728 static HRESULT WINAPI
TextFont_CanChange(ITextFont
*iface
, LONG
*ret
)
2730 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2731 FIXME("(%p)->(%p): stub\n", This
, ret
);
2735 static HRESULT WINAPI
TextFont_IsEqual(ITextFont
*iface
, ITextFont
*font
, LONG
*ret
)
2737 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2738 FIXME("(%p)->(%p %p): stub\n", This
, font
, ret
);
2742 static void textfont_reset_to_default(ITextFontImpl
*font
)
2744 enum textfont_prop_id id
;
2746 for (id
= FONT_PROPID_FIRST
; id
< FONT_PROPID_LAST
; id
++) {
2750 case FONT_ANIMATION
:
2757 case FONT_PROTECTED
:
2759 case FONT_SMALLCAPS
:
2760 case FONT_STRIKETHROUGH
:
2761 case FONT_SUBSCRIPT
:
2762 case FONT_SUPERSCRIPT
:
2763 case FONT_UNDERLINE
:
2764 font
->props
[id
].l
= tomFalse
;
2766 case FONT_BACKCOLOR
:
2767 case FONT_FORECOLOR
:
2768 font
->props
[id
].l
= tomAutoColor
;
2774 font
->props
[id
].f
= 0.0;
2777 font
->props
[id
].l
= GetSystemDefaultLCID();
2780 static const WCHAR sysW
[] = {'S','y','s','t','e','m',0};
2781 SysFreeString(font
->props
[id
].str
);
2782 font
->props
[id
].str
= SysAllocString(sysW
);
2786 font
->props
[id
].l
= FW_NORMAL
;
2789 FIXME("font property %d not handled\n", id
);
2794 static void textfont_reset_to_undefined(ITextFontImpl
*font
)
2796 enum textfont_prop_id id
;
2798 for (id
= FONT_PROPID_FIRST
; id
< FONT_PROPID_LAST
; id
++) {
2802 case FONT_ANIMATION
:
2809 case FONT_PROTECTED
:
2811 case FONT_SMALLCAPS
:
2812 case FONT_STRIKETHROUGH
:
2813 case FONT_SUBSCRIPT
:
2814 case FONT_SUPERSCRIPT
:
2815 case FONT_UNDERLINE
:
2816 case FONT_BACKCOLOR
:
2817 case FONT_FORECOLOR
:
2820 font
->props
[id
].l
= tomUndefined
;
2826 font
->props
[id
].f
= tomUndefined
;
2831 FIXME("font property %d not handled\n", id
);
2836 static void textfont_apply_range_props(ITextFontImpl
*font
)
2838 enum textfont_prop_id propid
;
2839 for (propid
= FONT_PROPID_FIRST
; propid
< FONT_PROPID_LAST
; propid
++)
2840 set_textfont_prop(font
, propid
, &font
->props
[propid
]);
2843 static HRESULT WINAPI
TextFont_Reset(ITextFont
*iface
, LONG value
)
2845 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2847 TRACE("(%p)->(%d)\n", This
, value
);
2849 /* If font is attached to a range, released or not, we can't
2850 reset to undefined */
2852 if (!get_range_reole(This
->range
))
2853 return CO_E_RELEASED
;
2858 return E_INVALIDARG
;
2860 textfont_cache_range_props(This
);
2861 This
->get_cache_enabled
= TRUE
;
2864 This
->get_cache_enabled
= FALSE
;
2867 This
->set_cache_enabled
= TRUE
;
2870 This
->set_cache_enabled
= FALSE
;
2871 textfont_apply_range_props(This
);
2875 return E_INVALIDARG
;
2877 FIXME("reset mode %d not supported\n", value
);
2885 /* reset to global defaults */
2887 textfont_reset_to_default(This
);
2889 /* all properties are set to tomUndefined, font name is retained */
2891 textfont_reset_to_undefined(This
);
2900 return E_INVALIDARG
;
2904 FIXME("reset mode %d not supported\n", value
);
2908 static HRESULT WINAPI
TextFont_GetStyle(ITextFont
*iface
, LONG
*value
)
2910 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2911 FIXME("(%p)->(%p): stub\n", This
, value
);
2915 static HRESULT WINAPI
TextFont_SetStyle(ITextFont
*iface
, LONG value
)
2917 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2918 FIXME("(%p)->(%d): stub\n", This
, value
);
2922 static HRESULT WINAPI
TextFont_GetAllCaps(ITextFont
*iface
, LONG
*value
)
2924 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2925 TRACE("(%p)->(%p)\n", This
, value
);
2926 return get_textfont_propl(This
, FONT_ALLCAPS
, value
);
2929 static HRESULT WINAPI
TextFont_SetAllCaps(ITextFont
*iface
, LONG value
)
2931 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2932 TRACE("(%p)->(%d)\n", This
, value
);
2933 return set_textfont_propd(This
, FONT_ALLCAPS
, value
);
2936 static HRESULT WINAPI
TextFont_GetAnimation(ITextFont
*iface
, LONG
*value
)
2938 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2939 TRACE("(%p)->(%p)\n", This
, value
);
2940 return get_textfont_propl(This
, FONT_ANIMATION
, value
);
2943 static HRESULT WINAPI
TextFont_SetAnimation(ITextFont
*iface
, LONG value
)
2945 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2947 TRACE("(%p)->(%d)\n", This
, value
);
2949 if (value
< tomNoAnimation
|| value
> tomAnimationMax
)
2950 return E_INVALIDARG
;
2952 return set_textfont_propl(This
, FONT_ANIMATION
, value
);
2955 static HRESULT WINAPI
TextFont_GetBackColor(ITextFont
*iface
, LONG
*value
)
2957 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2958 TRACE("(%p)->(%p)\n", This
, value
);
2959 return get_textfont_propl(This
, FONT_BACKCOLOR
, value
);
2962 static HRESULT WINAPI
TextFont_SetBackColor(ITextFont
*iface
, LONG value
)
2964 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2965 TRACE("(%p)->(%d)\n", This
, value
);
2966 return set_textfont_propl(This
, FONT_BACKCOLOR
, value
);
2969 static HRESULT WINAPI
TextFont_GetBold(ITextFont
*iface
, LONG
*value
)
2971 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2972 TRACE("(%p)->(%p)\n", This
, value
);
2973 return get_textfont_propl(This
, FONT_BOLD
, value
);
2976 static HRESULT WINAPI
TextFont_SetBold(ITextFont
*iface
, LONG value
)
2978 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2979 TRACE("(%p)->(%d)\n", This
, value
);
2980 return set_textfont_propd(This
, FONT_BOLD
, value
);
2983 static HRESULT WINAPI
TextFont_GetEmboss(ITextFont
*iface
, LONG
*value
)
2985 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2986 TRACE("(%p)->(%p)\n", This
, value
);
2987 return get_textfont_propl(This
, FONT_EMBOSS
, value
);
2990 static HRESULT WINAPI
TextFont_SetEmboss(ITextFont
*iface
, LONG value
)
2992 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2993 TRACE("(%p)->(%d)\n", This
, value
);
2994 return set_textfont_propd(This
, FONT_EMBOSS
, value
);
2997 static HRESULT WINAPI
TextFont_GetForeColor(ITextFont
*iface
, LONG
*value
)
2999 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3000 TRACE("(%p)->(%p)\n", This
, value
);
3001 return get_textfont_propl(This
, FONT_FORECOLOR
, value
);
3004 static HRESULT WINAPI
TextFont_SetForeColor(ITextFont
*iface
, LONG value
)
3006 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3007 TRACE("(%p)->(%d)\n", This
, value
);
3008 return set_textfont_propl(This
, FONT_FORECOLOR
, value
);
3011 static HRESULT WINAPI
TextFont_GetHidden(ITextFont
*iface
, LONG
*value
)
3013 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3014 TRACE("(%p)->(%p)\n", This
, value
);
3015 return get_textfont_propl(This
, FONT_HIDDEN
, value
);
3018 static HRESULT WINAPI
TextFont_SetHidden(ITextFont
*iface
, LONG value
)
3020 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3021 TRACE("(%p)->(%d)\n", This
, value
);
3022 return set_textfont_propd(This
, FONT_HIDDEN
, value
);
3025 static HRESULT WINAPI
TextFont_GetEngrave(ITextFont
*iface
, LONG
*value
)
3027 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3028 TRACE("(%p)->(%p)\n", This
, value
);
3029 return get_textfont_propl(This
, FONT_ENGRAVE
, value
);
3032 static HRESULT WINAPI
TextFont_SetEngrave(ITextFont
*iface
, LONG value
)
3034 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3035 TRACE("(%p)->(%d)\n", This
, value
);
3036 return set_textfont_propd(This
, FONT_ENGRAVE
, value
);
3039 static HRESULT WINAPI
TextFont_GetItalic(ITextFont
*iface
, LONG
*value
)
3041 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3042 TRACE("(%p)->(%p)\n", This
, value
);
3043 return get_textfont_propl(This
, FONT_ITALIC
, value
);
3046 static HRESULT WINAPI
TextFont_SetItalic(ITextFont
*iface
, LONG value
)
3048 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3049 TRACE("(%p)->(%d)\n", This
, value
);
3050 return set_textfont_propd(This
, FONT_ITALIC
, value
);
3053 static HRESULT WINAPI
TextFont_GetKerning(ITextFont
*iface
, FLOAT
*value
)
3055 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3056 TRACE("(%p)->(%p)\n", This
, value
);
3057 return get_textfont_propf(This
, FONT_KERNING
, value
);
3060 static HRESULT WINAPI
TextFont_SetKerning(ITextFont
*iface
, FLOAT value
)
3062 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3063 TRACE("(%p)->(%.2f)\n", This
, value
);
3064 return set_textfont_propf(This
, FONT_KERNING
, value
);
3067 static HRESULT WINAPI
TextFont_GetLanguageID(ITextFont
*iface
, LONG
*value
)
3069 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3070 TRACE("(%p)->(%p)\n", This
, value
);
3071 return get_textfont_propl(This
, FONT_LANGID
, value
);
3074 static HRESULT WINAPI
TextFont_SetLanguageID(ITextFont
*iface
, LONG value
)
3076 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3077 TRACE("(%p)->(%d)\n", This
, value
);
3078 return set_textfont_propl(This
, FONT_LANGID
, value
);
3081 static HRESULT WINAPI
TextFont_GetName(ITextFont
*iface
, BSTR
*value
)
3083 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3085 TRACE("(%p)->(%p)\n", This
, value
);
3088 return E_INVALIDARG
;
3093 if (This
->props
[FONT_NAME
].str
)
3094 *value
= SysAllocString(This
->props
[FONT_NAME
].str
);
3096 *value
= SysAllocStringLen(NULL
, 0);
3097 return *value
? S_OK
: E_OUTOFMEMORY
;
3100 return textfont_getname_from_range(This
->range
, value
);
3103 static HRESULT WINAPI
TextFont_SetName(ITextFont
*iface
, BSTR value
)
3105 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3106 textfont_prop_val v
;
3108 TRACE("(%p)->(%s)\n", This
, debugstr_w(value
));
3111 return set_textfont_prop(This
, FONT_NAME
, &v
);
3114 static HRESULT WINAPI
TextFont_GetOutline(ITextFont
*iface
, LONG
*value
)
3116 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3117 TRACE("(%p)->(%p)\n", This
, value
);
3118 return get_textfont_propl(This
, FONT_OUTLINE
, value
);
3121 static HRESULT WINAPI
TextFont_SetOutline(ITextFont
*iface
, LONG value
)
3123 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3124 TRACE("(%p)->(%d)\n", This
, value
);
3125 return set_textfont_propd(This
, FONT_OUTLINE
, value
);
3128 static HRESULT WINAPI
TextFont_GetPosition(ITextFont
*iface
, FLOAT
*value
)
3130 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3131 TRACE("(%p)->(%p)\n", This
, value
);
3132 return get_textfont_propf(This
, FONT_POSITION
, value
);
3135 static HRESULT WINAPI
TextFont_SetPosition(ITextFont
*iface
, FLOAT value
)
3137 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3138 TRACE("(%p)->(%.2f)\n", This
, value
);
3139 return set_textfont_propf(This
, FONT_POSITION
, value
);
3142 static HRESULT WINAPI
TextFont_GetProtected(ITextFont
*iface
, LONG
*value
)
3144 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3145 TRACE("(%p)->(%p)\n", This
, value
);
3146 return get_textfont_propl(This
, FONT_PROTECTED
, value
);
3149 static HRESULT WINAPI
TextFont_SetProtected(ITextFont
*iface
, LONG value
)
3151 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3152 TRACE("(%p)->(%d)\n", This
, value
);
3153 return set_textfont_propd(This
, FONT_PROTECTED
, value
);
3156 static HRESULT WINAPI
TextFont_GetShadow(ITextFont
*iface
, LONG
*value
)
3158 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3159 TRACE("(%p)->(%p)\n", This
, value
);
3160 return get_textfont_propl(This
, FONT_SHADOW
, value
);
3163 static HRESULT WINAPI
TextFont_SetShadow(ITextFont
*iface
, LONG value
)
3165 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3166 TRACE("(%p)->(%d)\n", This
, value
);
3167 return set_textfont_propd(This
, FONT_SHADOW
, value
);
3170 static HRESULT WINAPI
TextFont_GetSize(ITextFont
*iface
, FLOAT
*value
)
3172 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3173 TRACE("(%p)->(%p)\n", This
, value
);
3174 return get_textfont_propf(This
, FONT_SIZE
, value
);
3177 static HRESULT WINAPI
TextFont_SetSize(ITextFont
*iface
, FLOAT value
)
3179 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3180 TRACE("(%p)->(%.2f)\n", This
, value
);
3181 return set_textfont_propf(This
, FONT_SIZE
, value
);
3184 static HRESULT WINAPI
TextFont_GetSmallCaps(ITextFont
*iface
, LONG
*value
)
3186 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3187 TRACE("(%p)->(%p)\n", This
, value
);
3188 return get_textfont_propl(This
, FONT_SMALLCAPS
, value
);
3191 static HRESULT WINAPI
TextFont_SetSmallCaps(ITextFont
*iface
, LONG value
)
3193 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3194 TRACE("(%p)->(%d)\n", This
, value
);
3195 return set_textfont_propd(This
, FONT_SMALLCAPS
, value
);
3198 static HRESULT WINAPI
TextFont_GetSpacing(ITextFont
*iface
, FLOAT
*value
)
3200 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3201 TRACE("(%p)->(%p)\n", This
, value
);
3202 return get_textfont_propf(This
, FONT_SPACING
, value
);
3205 static HRESULT WINAPI
TextFont_SetSpacing(ITextFont
*iface
, FLOAT value
)
3207 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3208 TRACE("(%p)->(%.2f)\n", This
, value
);
3209 return set_textfont_propf(This
, FONT_SPACING
, value
);
3212 static HRESULT WINAPI
TextFont_GetStrikeThrough(ITextFont
*iface
, LONG
*value
)
3214 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3215 TRACE("(%p)->(%p)\n", This
, value
);
3216 return get_textfont_propl(This
, FONT_STRIKETHROUGH
, value
);
3219 static HRESULT WINAPI
TextFont_SetStrikeThrough(ITextFont
*iface
, LONG value
)
3221 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3222 TRACE("(%p)->(%d)\n", This
, value
);
3223 return set_textfont_propd(This
, FONT_STRIKETHROUGH
, value
);
3226 static HRESULT WINAPI
TextFont_GetSubscript(ITextFont
*iface
, LONG
*value
)
3228 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3229 TRACE("(%p)->(%p)\n", This
, value
);
3230 return get_textfont_propl(This
, FONT_SUBSCRIPT
, value
);
3233 static HRESULT WINAPI
TextFont_SetSubscript(ITextFont
*iface
, LONG value
)
3235 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3236 TRACE("(%p)->(%d)\n", This
, value
);
3237 return set_textfont_propd(This
, FONT_SUBSCRIPT
, value
);
3240 static HRESULT WINAPI
TextFont_GetSuperscript(ITextFont
*iface
, LONG
*value
)
3242 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3243 TRACE("(%p)->(%p)\n", This
, value
);
3244 return get_textfont_propl(This
, FONT_SUPERSCRIPT
, value
);
3247 static HRESULT WINAPI
TextFont_SetSuperscript(ITextFont
*iface
, LONG value
)
3249 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3250 TRACE("(%p)->(%d)\n", This
, value
);
3251 return set_textfont_propd(This
, FONT_SUPERSCRIPT
, value
);
3254 static HRESULT WINAPI
TextFont_GetUnderline(ITextFont
*iface
, LONG
*value
)
3256 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3257 TRACE("(%p)->(%p)\n", This
, value
);
3258 return get_textfont_propl(This
, FONT_UNDERLINE
, value
);
3261 static HRESULT WINAPI
TextFont_SetUnderline(ITextFont
*iface
, LONG value
)
3263 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3264 TRACE("(%p)->(%d)\n", This
, value
);
3265 return set_textfont_propd(This
, FONT_UNDERLINE
, value
);
3268 static HRESULT WINAPI
TextFont_GetWeight(ITextFont
*iface
, LONG
*value
)
3270 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3271 TRACE("(%p)->(%p)\n", This
, value
);
3272 return get_textfont_propl(This
, FONT_WEIGHT
, value
);
3275 static HRESULT WINAPI
TextFont_SetWeight(ITextFont
*iface
, LONG value
)
3277 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3278 TRACE("(%p)->(%d)\n", This
, value
);
3279 return set_textfont_propl(This
, FONT_WEIGHT
, value
);
3282 static ITextFontVtbl textfontvtbl
= {
3283 TextFont_QueryInterface
,
3286 TextFont_GetTypeInfoCount
,
3287 TextFont_GetTypeInfo
,
3288 TextFont_GetIDsOfNames
,
3290 TextFont_GetDuplicate
,
3291 TextFont_SetDuplicate
,
3297 TextFont_GetAllCaps
,
3298 TextFont_SetAllCaps
,
3299 TextFont_GetAnimation
,
3300 TextFont_SetAnimation
,
3301 TextFont_GetBackColor
,
3302 TextFont_SetBackColor
,
3307 TextFont_GetForeColor
,
3308 TextFont_SetForeColor
,
3311 TextFont_GetEngrave
,
3312 TextFont_SetEngrave
,
3315 TextFont_GetKerning
,
3316 TextFont_SetKerning
,
3317 TextFont_GetLanguageID
,
3318 TextFont_SetLanguageID
,
3321 TextFont_GetOutline
,
3322 TextFont_SetOutline
,
3323 TextFont_GetPosition
,
3324 TextFont_SetPosition
,
3325 TextFont_GetProtected
,
3326 TextFont_SetProtected
,
3331 TextFont_GetSmallCaps
,
3332 TextFont_SetSmallCaps
,
3333 TextFont_GetSpacing
,
3334 TextFont_SetSpacing
,
3335 TextFont_GetStrikeThrough
,
3336 TextFont_SetStrikeThrough
,
3337 TextFont_GetSubscript
,
3338 TextFont_SetSubscript
,
3339 TextFont_GetSuperscript
,
3340 TextFont_SetSuperscript
,
3341 TextFont_GetUnderline
,
3342 TextFont_SetUnderline
,
3347 static HRESULT
create_textfont(ITextRange
*range
, const ITextFontImpl
*src
, ITextFont
**ret
)
3349 ITextFontImpl
*font
;
3352 font
= heap_alloc(sizeof(*font
));
3354 return E_OUTOFMEMORY
;
3356 font
->ITextFont_iface
.lpVtbl
= &textfontvtbl
;
3361 font
->get_cache_enabled
= TRUE
;
3362 font
->set_cache_enabled
= TRUE
;
3363 memcpy(&font
->props
, &src
->props
, sizeof(font
->props
));
3364 if (font
->props
[FONT_NAME
].str
)
3365 font
->props
[FONT_NAME
].str
= SysAllocString(font
->props
[FONT_NAME
].str
);
3368 font
->range
= range
;
3369 ITextRange_AddRef(range
);
3371 /* cache current properties */
3372 font
->get_cache_enabled
= FALSE
;
3373 font
->set_cache_enabled
= FALSE
;
3374 textfont_cache_range_props(font
);
3377 *ret
= &font
->ITextFont_iface
;
3382 static HRESULT WINAPI
TextPara_QueryInterface(ITextPara
*iface
, REFIID riid
, void **ppv
)
3384 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3386 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
3388 if (IsEqualIID(riid
, &IID_ITextPara
) ||
3389 IsEqualIID(riid
, &IID_IDispatch
) ||
3390 IsEqualIID(riid
, &IID_IUnknown
))
3393 ITextPara_AddRef(iface
);
3398 return E_NOINTERFACE
;
3401 static ULONG WINAPI
TextPara_AddRef(ITextPara
*iface
)
3403 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3404 ULONG ref
= InterlockedIncrement(&This
->ref
);
3405 TRACE("(%p)->(%u)\n", This
, ref
);
3409 static ULONG WINAPI
TextPara_Release(ITextPara
*iface
)
3411 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3412 ULONG ref
= InterlockedDecrement(&This
->ref
);
3414 TRACE("(%p)->(%u)\n", This
, ref
);
3418 ITextRange_Release(This
->range
);
3425 static HRESULT WINAPI
TextPara_GetTypeInfoCount(ITextPara
*iface
, UINT
*pctinfo
)
3427 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3428 TRACE("(%p)->(%p)\n", This
, pctinfo
);
3433 static HRESULT WINAPI
TextPara_GetTypeInfo(ITextPara
*iface
, UINT iTInfo
, LCID lcid
,
3434 ITypeInfo
**ppTInfo
)
3436 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3439 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
3441 hr
= get_typeinfo(ITextPara_tid
, ppTInfo
);
3443 ITypeInfo_AddRef(*ppTInfo
);
3447 static HRESULT WINAPI
TextPara_GetIDsOfNames(ITextPara
*iface
, REFIID riid
,
3448 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3450 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3454 TRACE("(%p)->(%s, %p, %u, %d, %p)\n", This
, debugstr_guid(riid
), rgszNames
,
3455 cNames
, lcid
, rgDispId
);
3457 hr
= get_typeinfo(ITextPara_tid
, &ti
);
3459 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
3463 static HRESULT WINAPI
TextPara_Invoke(
3465 DISPID dispIdMember
,
3469 DISPPARAMS
*pDispParams
,
3470 VARIANT
*pVarResult
,
3471 EXCEPINFO
*pExcepInfo
,
3474 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3478 TRACE("(%p)->(%d, %s, %d, %u, %p, %p, %p, %p)\n", This
, dispIdMember
,
3479 debugstr_guid(riid
), lcid
, wFlags
, pDispParams
, pVarResult
,
3480 pExcepInfo
, puArgErr
);
3482 hr
= get_typeinfo(ITextPara_tid
, &ti
);
3484 hr
= ITypeInfo_Invoke(ti
, iface
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3488 static HRESULT WINAPI
TextPara_GetDuplicate(ITextPara
*iface
, ITextPara
**ret
)
3490 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3491 FIXME("(%p)->(%p)\n", This
, ret
);
3495 static HRESULT WINAPI
TextPara_SetDuplicate(ITextPara
*iface
, ITextPara
*para
)
3497 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3498 FIXME("(%p)->(%p)\n", This
, para
);
3502 static HRESULT WINAPI
TextPara_CanChange(ITextPara
*iface
, LONG
*ret
)
3504 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3505 FIXME("(%p)->(%p)\n", This
, ret
);
3509 static HRESULT WINAPI
TextPara_IsEqual(ITextPara
*iface
, ITextPara
*para
, LONG
*ret
)
3511 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3512 FIXME("(%p)->(%p %p)\n", This
, para
, ret
);
3516 static HRESULT WINAPI
TextPara_Reset(ITextPara
*iface
, LONG value
)
3518 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3519 FIXME("(%p)->(%d)\n", This
, value
);
3523 static HRESULT WINAPI
TextPara_GetStyle(ITextPara
*iface
, LONG
*value
)
3525 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3526 FIXME("(%p)->(%p)\n", This
, value
);
3530 static HRESULT WINAPI
TextPara_SetStyle(ITextPara
*iface
, LONG value
)
3532 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3533 FIXME("(%p)->(%d)\n", This
, value
);
3537 static HRESULT WINAPI
TextPara_GetAlignment(ITextPara
*iface
, LONG
*value
)
3539 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3540 FIXME("(%p)->(%p)\n", This
, value
);
3544 static HRESULT WINAPI
TextPara_SetAlignment(ITextPara
*iface
, LONG value
)
3546 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3547 FIXME("(%p)->(%d)\n", This
, value
);
3551 static HRESULT WINAPI
TextPara_GetHyphenation(ITextPara
*iface
, LONG
*value
)
3553 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3554 FIXME("(%p)->(%p)\n", This
, value
);
3558 static HRESULT WINAPI
TextPara_SetHyphenation(ITextPara
*iface
, LONG value
)
3560 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3561 FIXME("(%p)->(%d)\n", This
, value
);
3565 static HRESULT WINAPI
TextPara_GetFirstLineIndent(ITextPara
*iface
, FLOAT
*value
)
3567 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3568 FIXME("(%p)->(%p)\n", This
, value
);
3572 static HRESULT WINAPI
TextPara_GetKeepTogether(ITextPara
*iface
, LONG
*value
)
3574 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3575 FIXME("(%p)->(%p)\n", This
, value
);
3579 static HRESULT WINAPI
TextPara_SetKeepTogether(ITextPara
*iface
, LONG value
)
3581 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3582 FIXME("(%p)->(%d)\n", This
, value
);
3586 static HRESULT WINAPI
TextPara_GetKeepWithNext(ITextPara
*iface
, LONG
*value
)
3588 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3589 FIXME("(%p)->(%p)\n", This
, value
);
3593 static HRESULT WINAPI
TextPara_SetKeepWithNext(ITextPara
*iface
, LONG value
)
3595 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3596 FIXME("(%p)->(%d)\n", This
, value
);
3600 static HRESULT WINAPI
TextPara_GetLeftIndent(ITextPara
*iface
, FLOAT
*value
)
3602 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3603 FIXME("(%p)->(%p)\n", This
, value
);
3607 static HRESULT WINAPI
TextPara_GetLineSpacing(ITextPara
*iface
, FLOAT
*value
)
3609 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3610 FIXME("(%p)->(%p)\n", This
, value
);
3614 static HRESULT WINAPI
TextPara_GetLineSpacingRule(ITextPara
*iface
, LONG
*value
)
3616 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3617 FIXME("(%p)->(%p)\n", This
, value
);
3621 static HRESULT WINAPI
TextPara_GetListAlignment(ITextPara
*iface
, LONG
*value
)
3623 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3624 FIXME("(%p)->(%p)\n", This
, value
);
3628 static HRESULT WINAPI
TextPara_SetListAlignment(ITextPara
*iface
, LONG value
)
3630 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3631 FIXME("(%p)->(%d)\n", This
, value
);
3635 static HRESULT WINAPI
TextPara_GetListLevelIndex(ITextPara
*iface
, LONG
*value
)
3637 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3638 FIXME("(%p)->(%p)\n", This
, value
);
3642 static HRESULT WINAPI
TextPara_SetListLevelIndex(ITextPara
*iface
, LONG value
)
3644 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3645 FIXME("(%p)->(%d)\n", This
, value
);
3649 static HRESULT WINAPI
TextPara_GetListStart(ITextPara
*iface
, LONG
*value
)
3651 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3652 FIXME("(%p)->(%p)\n", This
, value
);
3656 static HRESULT WINAPI
TextPara_SetListStart(ITextPara
*iface
, LONG value
)
3658 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3659 FIXME("(%p)->(%d)\n", This
, value
);
3663 static HRESULT WINAPI
TextPara_GetListTab(ITextPara
*iface
, FLOAT
*value
)
3665 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3666 FIXME("(%p)->(%p)\n", This
, value
);
3670 static HRESULT WINAPI
TextPara_SetListTab(ITextPara
*iface
, FLOAT value
)
3672 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3673 FIXME("(%p)->(%.2f)\n", This
, value
);
3677 static HRESULT WINAPI
TextPara_GetListType(ITextPara
*iface
, LONG
*value
)
3679 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3680 FIXME("(%p)->(%p)\n", This
, value
);
3684 static HRESULT WINAPI
TextPara_SetListType(ITextPara
*iface
, LONG value
)
3686 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3687 FIXME("(%p)->(%d)\n", This
, value
);
3691 static HRESULT WINAPI
TextPara_GetNoLineNumber(ITextPara
*iface
, LONG
*value
)
3693 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3694 FIXME("(%p)->(%p)\n", This
, value
);
3698 static HRESULT WINAPI
TextPara_SetNoLineNumber(ITextPara
*iface
, LONG value
)
3700 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3701 FIXME("(%p)->(%d)\n", This
, value
);
3705 static HRESULT WINAPI
TextPara_GetPageBreakBefore(ITextPara
*iface
, LONG
*value
)
3707 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3708 FIXME("(%p)->(%p)\n", This
, value
);
3712 static HRESULT WINAPI
TextPara_SetPageBreakBefore(ITextPara
*iface
, LONG value
)
3714 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3715 FIXME("(%p)->(%d)\n", This
, value
);
3719 static HRESULT WINAPI
TextPara_GetRightIndent(ITextPara
*iface
, FLOAT
*value
)
3721 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3722 FIXME("(%p)->(%p)\n", This
, value
);
3726 static HRESULT WINAPI
TextPara_SetRightIndent(ITextPara
*iface
, FLOAT value
)
3728 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3729 FIXME("(%p)->(%.2f)\n", This
, value
);
3733 static HRESULT WINAPI
TextPara_SetIndents(ITextPara
*iface
, FLOAT StartIndent
, FLOAT LeftIndent
, FLOAT RightIndent
)
3735 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3736 FIXME("(%p)->(%.2f %.2f %.2f)\n", This
, StartIndent
, LeftIndent
, RightIndent
);
3740 static HRESULT WINAPI
TextPara_SetLineSpacing(ITextPara
*iface
, LONG LineSpacingRule
, FLOAT LineSpacing
)
3742 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3743 FIXME("(%p)->(%d %.2f)\n", This
, LineSpacingRule
, LineSpacing
);
3747 static HRESULT WINAPI
TextPara_GetSpaceAfter(ITextPara
*iface
, FLOAT
*value
)
3749 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3750 FIXME("(%p)->(%p)\n", This
, value
);
3754 static HRESULT WINAPI
TextPara_SetSpaceAfter(ITextPara
*iface
, FLOAT value
)
3756 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3757 FIXME("(%p)->(%.2f)\n", This
, value
);
3761 static HRESULT WINAPI
TextPara_GetSpaceBefore(ITextPara
*iface
, FLOAT
*value
)
3763 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3764 FIXME("(%p)->(%p)\n", This
, value
);
3768 static HRESULT WINAPI
TextPara_SetSpaceBefore(ITextPara
*iface
, FLOAT value
)
3770 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3771 FIXME("(%p)->(%.2f)\n", This
, value
);
3775 static HRESULT WINAPI
TextPara_GetWidowControl(ITextPara
*iface
, LONG
*value
)
3777 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3778 FIXME("(%p)->(%p)\n", This
, value
);
3782 static HRESULT WINAPI
TextPara_SetWidowControl(ITextPara
*iface
, LONG value
)
3784 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3785 FIXME("(%p)->(%d)\n", This
, value
);
3789 static HRESULT WINAPI
TextPara_GetTabCount(ITextPara
*iface
, LONG
*value
)
3791 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3792 FIXME("(%p)->(%p)\n", This
, value
);
3796 static HRESULT WINAPI
TextPara_AddTab(ITextPara
*iface
, FLOAT tbPos
, LONG tbAlign
, LONG tbLeader
)
3798 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3799 FIXME("(%p)->(%.2f %d %d)\n", This
, tbPos
, tbAlign
, tbLeader
);
3803 static HRESULT WINAPI
TextPara_ClearAllTabs(ITextPara
*iface
)
3805 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3806 FIXME("(%p)\n", This
);
3810 static HRESULT WINAPI
TextPara_DeleteTab(ITextPara
*iface
, FLOAT pos
)
3812 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3813 FIXME("(%p)->(%.2f)\n", This
, pos
);
3817 static HRESULT WINAPI
TextPara_GetTab(ITextPara
*iface
, LONG iTab
, FLOAT
*ptbPos
, LONG
*ptbAlign
, LONG
*ptbLeader
)
3819 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3820 FIXME("(%p)->(%d %p %p %p)\n", This
, iTab
, ptbPos
, ptbAlign
, ptbLeader
);
3824 static ITextParaVtbl textparavtbl
= {
3825 TextPara_QueryInterface
,
3828 TextPara_GetTypeInfoCount
,
3829 TextPara_GetTypeInfo
,
3830 TextPara_GetIDsOfNames
,
3832 TextPara_GetDuplicate
,
3833 TextPara_SetDuplicate
,
3839 TextPara_GetAlignment
,
3840 TextPara_SetAlignment
,
3841 TextPara_GetHyphenation
,
3842 TextPara_SetHyphenation
,
3843 TextPara_GetFirstLineIndent
,
3844 TextPara_GetKeepTogether
,
3845 TextPara_SetKeepTogether
,
3846 TextPara_GetKeepWithNext
,
3847 TextPara_SetKeepWithNext
,
3848 TextPara_GetLeftIndent
,
3849 TextPara_GetLineSpacing
,
3850 TextPara_GetLineSpacingRule
,
3851 TextPara_GetListAlignment
,
3852 TextPara_SetListAlignment
,
3853 TextPara_GetListLevelIndex
,
3854 TextPara_SetListLevelIndex
,
3855 TextPara_GetListStart
,
3856 TextPara_SetListStart
,
3857 TextPara_GetListTab
,
3858 TextPara_SetListTab
,
3859 TextPara_GetListType
,
3860 TextPara_SetListType
,
3861 TextPara_GetNoLineNumber
,
3862 TextPara_SetNoLineNumber
,
3863 TextPara_GetPageBreakBefore
,
3864 TextPara_SetPageBreakBefore
,
3865 TextPara_GetRightIndent
,
3866 TextPara_SetRightIndent
,
3867 TextPara_SetIndents
,
3868 TextPara_SetLineSpacing
,
3869 TextPara_GetSpaceAfter
,
3870 TextPara_SetSpaceAfter
,
3871 TextPara_GetSpaceBefore
,
3872 TextPara_SetSpaceBefore
,
3873 TextPara_GetWidowControl
,
3874 TextPara_SetWidowControl
,
3875 TextPara_GetTabCount
,
3877 TextPara_ClearAllTabs
,
3882 static HRESULT
create_textpara(ITextRange
*range
, ITextPara
**ret
)
3884 ITextParaImpl
*para
;
3887 para
= heap_alloc(sizeof(*para
));
3889 return E_OUTOFMEMORY
;
3891 para
->ITextPara_iface
.lpVtbl
= &textparavtbl
;
3893 para
->range
= range
;
3894 ITextRange_AddRef(range
);
3896 *ret
= ¶
->ITextPara_iface
;
3901 static HRESULT WINAPI
ITextDocument2Old_fnQueryInterface(ITextDocument2Old
* iface
, REFIID riid
,
3904 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
3905 return IRichEditOle_QueryInterface(&This
->IRichEditOle_iface
, riid
, ppvObject
);
3908 static ULONG WINAPI
ITextDocument2Old_fnAddRef(ITextDocument2Old
*iface
)
3910 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
3911 return IRichEditOle_AddRef(&This
->IRichEditOle_iface
);
3914 static ULONG WINAPI
ITextDocument2Old_fnRelease(ITextDocument2Old
*iface
)
3916 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
3917 return IRichEditOle_Release(&This
->IRichEditOle_iface
);
3920 static HRESULT WINAPI
ITextDocument2Old_fnGetTypeInfoCount(ITextDocument2Old
*iface
,
3923 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
3924 TRACE("(%p)->(%p)\n", This
, pctinfo
);
3929 static HRESULT WINAPI
ITextDocument2Old_fnGetTypeInfo(ITextDocument2Old
*iface
, UINT iTInfo
, LCID lcid
,
3930 ITypeInfo
**ppTInfo
)
3932 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
3935 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
3937 hr
= get_typeinfo(ITextDocument_tid
, ppTInfo
);
3939 ITypeInfo_AddRef(*ppTInfo
);
3943 static HRESULT WINAPI
ITextDocument2Old_fnGetIDsOfNames(ITextDocument2Old
*iface
, REFIID riid
,
3944 LPOLESTR
*rgszNames
, UINT cNames
,
3945 LCID lcid
, DISPID
*rgDispId
)
3947 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
3951 TRACE("(%p)->(%s, %p, %u, %d, %p)\n", This
, debugstr_guid(riid
),
3952 rgszNames
, cNames
, lcid
, rgDispId
);
3954 hr
= get_typeinfo(ITextDocument_tid
, &ti
);
3956 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
3960 static HRESULT WINAPI
ITextDocument2Old_fnInvoke(ITextDocument2Old
*iface
, DISPID dispIdMember
,
3961 REFIID riid
, LCID lcid
, WORD wFlags
,
3962 DISPPARAMS
*pDispParams
, VARIANT
*pVarResult
,
3963 EXCEPINFO
*pExcepInfo
, UINT
*puArgErr
)
3965 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
3969 TRACE("(%p)->(%d, %s, %d, %u, %p, %p, %p, %p)\n", This
, dispIdMember
,
3970 debugstr_guid(riid
), lcid
, wFlags
, pDispParams
, pVarResult
,
3971 pExcepInfo
, puArgErr
);
3973 hr
= get_typeinfo(ITextDocument_tid
, &ti
);
3975 hr
= ITypeInfo_Invoke(ti
, iface
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3979 static HRESULT WINAPI
ITextDocument2Old_fnGetName(ITextDocument2Old
*iface
, BSTR
*pName
)
3981 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
3982 FIXME("stub %p\n",This
);
3986 static HRESULT WINAPI
ITextDocument2Old_fnGetSelection(ITextDocument2Old
*iface
, ITextSelection
**selection
)
3988 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
3990 TRACE("(%p)->(%p)\n", iface
, selection
);
3993 return E_INVALIDARG
;
3995 if (!This
->txtSel
) {
3996 This
->txtSel
= CreateTextSelection(This
);
3997 if (!This
->txtSel
) {
3999 return E_OUTOFMEMORY
;
4003 *selection
= &This
->txtSel
->ITextSelection_iface
;
4004 ITextSelection_AddRef(*selection
);
4008 static HRESULT WINAPI
ITextDocument2Old_fnGetStoryCount(ITextDocument2Old
*iface
, LONG
*pCount
)
4010 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4011 FIXME("stub %p\n",This
);
4015 static HRESULT WINAPI
ITextDocument2Old_fnGetStoryRanges(ITextDocument2Old
*iface
,
4016 ITextStoryRanges
**ppStories
)
4018 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4019 FIXME("stub %p\n",This
);
4023 static HRESULT WINAPI
ITextDocument2Old_fnGetSaved(ITextDocument2Old
*iface
, LONG
*pValue
)
4025 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4026 FIXME("stub %p\n",This
);
4030 static HRESULT WINAPI
ITextDocument2Old_fnSetSaved(ITextDocument2Old
*iface
, LONG Value
)
4032 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4033 FIXME("stub %p\n",This
);
4037 static HRESULT WINAPI
ITextDocument2Old_fnGetDefaultTabStop(ITextDocument2Old
*iface
, float *pValue
)
4039 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4040 FIXME("stub %p\n",This
);
4044 static HRESULT WINAPI
ITextDocument2Old_fnSetDefaultTabStop(ITextDocument2Old
*iface
, float Value
)
4046 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4047 FIXME("stub %p\n",This
);
4051 static HRESULT WINAPI
ITextDocument2Old_fnNew(ITextDocument2Old
*iface
)
4053 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4054 FIXME("stub %p\n",This
);
4058 static HRESULT WINAPI
ITextDocument2Old_fnOpen(ITextDocument2Old
*iface
, VARIANT
*pVar
,
4059 LONG Flags
, LONG CodePage
)
4061 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4062 FIXME("stub %p\n",This
);
4066 static HRESULT WINAPI
ITextDocument2Old_fnSave(ITextDocument2Old
*iface
, VARIANT
*pVar
,
4067 LONG Flags
, LONG CodePage
)
4069 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4070 FIXME("stub %p\n",This
);
4074 static HRESULT WINAPI
ITextDocument2Old_fnFreeze(ITextDocument2Old
*iface
, LONG
*pCount
)
4076 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4077 FIXME("stub %p\n",This
);
4081 static HRESULT WINAPI
ITextDocument2Old_fnUnfreeze(ITextDocument2Old
*iface
, LONG
*pCount
)
4083 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4084 FIXME("stub %p\n",This
);
4088 static HRESULT WINAPI
ITextDocument2Old_fnBeginEditCollection(ITextDocument2Old
*iface
)
4090 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4091 FIXME("stub %p\n",This
);
4095 static HRESULT WINAPI
ITextDocument2Old_fnEndEditCollection(ITextDocument2Old
*iface
)
4097 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4098 FIXME("stub %p\n",This
);
4102 static HRESULT WINAPI
ITextDocument2Old_fnUndo(ITextDocument2Old
*iface
, LONG Count
, LONG
*prop
)
4104 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4105 FIXME("stub %p\n",This
);
4109 static HRESULT WINAPI
ITextDocument2Old_fnRedo(ITextDocument2Old
*iface
, LONG Count
, LONG
*prop
)
4111 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4112 FIXME("stub %p\n",This
);
4116 static HRESULT
CreateITextRange(IRichEditOleImpl
*reOle
, LONG start
, LONG end
, ITextRange
** ppRange
)
4118 ITextRangeImpl
*txtRge
= heap_alloc(sizeof(ITextRangeImpl
));
4121 return E_OUTOFMEMORY
;
4122 txtRge
->ITextRange_iface
.lpVtbl
= &trvt
;
4124 txtRge
->child
.reole
= reOle
;
4125 txtRge
->start
= start
;
4127 list_add_head(&reOle
->rangelist
, &txtRge
->child
.entry
);
4128 *ppRange
= &txtRge
->ITextRange_iface
;
4132 static HRESULT WINAPI
ITextDocument2Old_fnRange(ITextDocument2Old
*iface
, LONG cp1
, LONG cp2
,
4133 ITextRange
**ppRange
)
4135 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4137 TRACE("%p %p %d %d\n", This
, ppRange
, cp1
, cp2
);
4139 return E_INVALIDARG
;
4141 cp2range(This
->editor
, &cp1
, &cp2
);
4142 return CreateITextRange(This
, cp1
, cp2
, ppRange
);
4145 static HRESULT WINAPI
ITextDocument2Old_fnRangeFromPoint(ITextDocument2Old
*iface
, LONG x
, LONG y
,
4146 ITextRange
**ppRange
)
4148 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4149 FIXME("stub %p\n",This
);
4153 /* ITextDocument2Old methods */
4154 static HRESULT WINAPI
ITextDocument2Old_fnAttachMsgFilter(ITextDocument2Old
*iface
, IUnknown
*filter
)
4156 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4158 FIXME("(%p)->(%p): stub\n", This
, filter
);
4163 static HRESULT WINAPI
ITextDocument2Old_fnSetEffectColor(ITextDocument2Old
*iface
, LONG index
, COLORREF cr
)
4165 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4167 FIXME("(%p)->(%d, 0x%x): stub\n", This
, index
, cr
);
4172 static HRESULT WINAPI
ITextDocument2Old_fnGetEffectColor(ITextDocument2Old
*iface
, LONG index
, COLORREF
*cr
)
4174 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4176 FIXME("(%p)->(%d, %p): stub\n", This
, index
, cr
);
4181 static HRESULT WINAPI
ITextDocument2Old_fnGetCaretType(ITextDocument2Old
*iface
, LONG
*type
)
4183 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4185 FIXME("(%p)->(%p): stub\n", This
, type
);
4190 static HRESULT WINAPI
ITextDocument2Old_fnSetCaretType(ITextDocument2Old
*iface
, LONG type
)
4192 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4194 FIXME("(%p)->(%d): stub\n", This
, type
);
4199 static HRESULT WINAPI
ITextDocument2Old_fnGetImmContext(ITextDocument2Old
*iface
, LONG
*context
)
4201 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4203 FIXME("(%p)->(%p): stub\n", This
, context
);
4208 static HRESULT WINAPI
ITextDocument2Old_fnReleaseImmContext(ITextDocument2Old
*iface
, LONG context
)
4210 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4212 FIXME("(%p)->(%d): stub\n", This
, context
);
4217 static HRESULT WINAPI
ITextDocument2Old_fnGetPreferredFont(ITextDocument2Old
*iface
, LONG cp
, LONG charrep
,
4218 LONG options
, LONG current_charrep
, LONG current_fontsize
,
4219 BSTR
*bstr
, LONG
*pitch_family
, LONG
*new_fontsize
)
4221 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4223 FIXME("(%p)->(%d, %d, %d, %d, %d, %p, %p, %p): stub\n", This
, cp
, charrep
, options
, current_charrep
,
4224 current_fontsize
, bstr
, pitch_family
, new_fontsize
);
4229 static HRESULT WINAPI
ITextDocument2Old_fnGetNotificationMode(ITextDocument2Old
*iface
, LONG
*mode
)
4231 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4233 FIXME("(%p)->(%p): stub\n", This
, mode
);
4238 static HRESULT WINAPI
ITextDocument2Old_fnSetNotificationMode(ITextDocument2Old
*iface
, LONG mode
)
4240 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4242 FIXME("(%p)->(0x%x): stub\n", This
, mode
);
4247 static HRESULT WINAPI
ITextDocument2Old_fnGetClientRect(ITextDocument2Old
*iface
, LONG type
, LONG
*left
, LONG
*top
,
4248 LONG
*right
, LONG
*bottom
)
4250 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4252 FIXME("(%p)->(%d, %p, %p, %p, %p): stub\n", This
, type
, left
, top
, right
, bottom
);
4257 static HRESULT WINAPI
ITextDocument2Old_fnGetSelectionEx(ITextDocument2Old
*iface
, ITextSelection
**selection
)
4259 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4261 FIXME("(%p)->(%p): stub\n", This
, selection
);
4266 static HRESULT WINAPI
ITextDocument2Old_fnGetWindow(ITextDocument2Old
*iface
, LONG
*hwnd
)
4268 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4270 FIXME("(%p)->(%p): stub\n", This
, hwnd
);
4275 static HRESULT WINAPI
ITextDocument2Old_fnGetFEFlags(ITextDocument2Old
*iface
, LONG
*flags
)
4277 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4279 FIXME("(%p)->(%p): stub\n", This
, flags
);
4284 static HRESULT WINAPI
ITextDocument2Old_fnUpdateWindow(ITextDocument2Old
*iface
)
4286 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4288 FIXME("(%p): stub\n", This
);
4293 static HRESULT WINAPI
ITextDocument2Old_fnCheckTextLimit(ITextDocument2Old
*iface
, LONG cch
, LONG
*exceed
)
4295 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4297 FIXME("(%p)->(%d, %p): stub\n", This
, cch
, exceed
);
4302 static HRESULT WINAPI
ITextDocument2Old_fnIMEInProgress(ITextDocument2Old
*iface
, LONG mode
)
4304 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4306 FIXME("(%p)->(0x%x): stub\n", This
, mode
);
4311 static HRESULT WINAPI
ITextDocument2Old_fnSysBeep(ITextDocument2Old
*iface
)
4313 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4315 FIXME("(%p): stub\n", This
);
4320 static HRESULT WINAPI
ITextDocument2Old_fnUpdate(ITextDocument2Old
*iface
, LONG mode
)
4322 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4324 FIXME("(%p)->(0x%x): stub\n", This
, mode
);
4329 static HRESULT WINAPI
ITextDocument2Old_fnNotify(ITextDocument2Old
*iface
, LONG notify
)
4331 IRichEditOleImpl
*This
= impl_from_ITextDocument2Old(iface
);
4333 FIXME("(%p)->(%d): stub\n", This
, notify
);
4338 static const ITextDocument2OldVtbl tdvt
= {
4339 ITextDocument2Old_fnQueryInterface
,
4340 ITextDocument2Old_fnAddRef
,
4341 ITextDocument2Old_fnRelease
,
4342 ITextDocument2Old_fnGetTypeInfoCount
,
4343 ITextDocument2Old_fnGetTypeInfo
,
4344 ITextDocument2Old_fnGetIDsOfNames
,
4345 ITextDocument2Old_fnInvoke
,
4346 ITextDocument2Old_fnGetName
,
4347 ITextDocument2Old_fnGetSelection
,
4348 ITextDocument2Old_fnGetStoryCount
,
4349 ITextDocument2Old_fnGetStoryRanges
,
4350 ITextDocument2Old_fnGetSaved
,
4351 ITextDocument2Old_fnSetSaved
,
4352 ITextDocument2Old_fnGetDefaultTabStop
,
4353 ITextDocument2Old_fnSetDefaultTabStop
,
4354 ITextDocument2Old_fnNew
,
4355 ITextDocument2Old_fnOpen
,
4356 ITextDocument2Old_fnSave
,
4357 ITextDocument2Old_fnFreeze
,
4358 ITextDocument2Old_fnUnfreeze
,
4359 ITextDocument2Old_fnBeginEditCollection
,
4360 ITextDocument2Old_fnEndEditCollection
,
4361 ITextDocument2Old_fnUndo
,
4362 ITextDocument2Old_fnRedo
,
4363 ITextDocument2Old_fnRange
,
4364 ITextDocument2Old_fnRangeFromPoint
,
4365 /* ITextDocument2Old methods */
4366 ITextDocument2Old_fnAttachMsgFilter
,
4367 ITextDocument2Old_fnSetEffectColor
,
4368 ITextDocument2Old_fnGetEffectColor
,
4369 ITextDocument2Old_fnGetCaretType
,
4370 ITextDocument2Old_fnSetCaretType
,
4371 ITextDocument2Old_fnGetImmContext
,
4372 ITextDocument2Old_fnReleaseImmContext
,
4373 ITextDocument2Old_fnGetPreferredFont
,
4374 ITextDocument2Old_fnGetNotificationMode
,
4375 ITextDocument2Old_fnSetNotificationMode
,
4376 ITextDocument2Old_fnGetClientRect
,
4377 ITextDocument2Old_fnGetSelectionEx
,
4378 ITextDocument2Old_fnGetWindow
,
4379 ITextDocument2Old_fnGetFEFlags
,
4380 ITextDocument2Old_fnUpdateWindow
,
4381 ITextDocument2Old_fnCheckTextLimit
,
4382 ITextDocument2Old_fnIMEInProgress
,
4383 ITextDocument2Old_fnSysBeep
,
4384 ITextDocument2Old_fnUpdate
,
4385 ITextDocument2Old_fnNotify
4388 /* ITextSelection */
4389 static HRESULT WINAPI
ITextSelection_fnQueryInterface(
4394 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4397 if (IsEqualGUID(riid
, &IID_IUnknown
)
4398 || IsEqualGUID(riid
, &IID_IDispatch
)
4399 || IsEqualGUID(riid
, &IID_ITextRange
)
4400 || IsEqualGUID(riid
, &IID_ITextSelection
))
4403 ITextSelection_AddRef(me
);
4406 else if (IsEqualGUID(riid
, &IID_Igetrichole
))
4408 *ppvObj
= This
->reOle
;
4412 return E_NOINTERFACE
;
4415 static ULONG WINAPI
ITextSelection_fnAddRef(ITextSelection
*me
)
4417 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4418 return InterlockedIncrement(&This
->ref
);
4421 static ULONG WINAPI
ITextSelection_fnRelease(ITextSelection
*me
)
4423 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4424 ULONG ref
= InterlockedDecrement(&This
->ref
);
4430 static HRESULT WINAPI
ITextSelection_fnGetTypeInfoCount(ITextSelection
*me
, UINT
*pctinfo
)
4432 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4433 TRACE("(%p)->(%p)\n", This
, pctinfo
);
4438 static HRESULT WINAPI
ITextSelection_fnGetTypeInfo(ITextSelection
*me
, UINT iTInfo
, LCID lcid
,
4439 ITypeInfo
**ppTInfo
)
4441 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4444 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
4446 hr
= get_typeinfo(ITextSelection_tid
, ppTInfo
);
4448 ITypeInfo_AddRef(*ppTInfo
);
4452 static HRESULT WINAPI
ITextSelection_fnGetIDsOfNames(ITextSelection
*me
, REFIID riid
,
4453 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4455 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4459 TRACE("(%p)->(%s, %p, %u, %d, %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
, lcid
,
4462 hr
= get_typeinfo(ITextSelection_tid
, &ti
);
4464 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
4468 static HRESULT WINAPI
ITextSelection_fnInvoke(
4470 DISPID dispIdMember
,
4474 DISPPARAMS
*pDispParams
,
4475 VARIANT
*pVarResult
,
4476 EXCEPINFO
*pExcepInfo
,
4479 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4483 TRACE("(%p)->(%d, %s, %d, %u, %p, %p, %p, %p)\n", This
, dispIdMember
, debugstr_guid(riid
), lcid
,
4484 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4486 hr
= get_typeinfo(ITextSelection_tid
, &ti
);
4488 hr
= ITypeInfo_Invoke(ti
, me
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4492 /*** ITextRange methods ***/
4493 static HRESULT WINAPI
ITextSelection_fnGetText(ITextSelection
*me
, BSTR
*pbstr
)
4495 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4496 ME_Cursor
*start
= NULL
, *end
= NULL
;
4500 TRACE("(%p)->(%p)\n", This
, pbstr
);
4503 return CO_E_RELEASED
;
4506 return E_INVALIDARG
;
4508 ME_GetSelection(This
->reOle
->editor
, &start
, &end
);
4509 endOfs
= ME_GetCursorOfs(end
);
4510 nChars
= endOfs
- ME_GetCursorOfs(start
);
4517 *pbstr
= SysAllocStringLen(NULL
, nChars
);
4519 return E_OUTOFMEMORY
;
4521 bEOP
= (end
->pRun
->next
->type
== diTextEnd
&& endOfs
> ME_GetTextLength(This
->reOle
->editor
));
4522 ME_GetTextW(This
->reOle
->editor
, *pbstr
, nChars
, start
, nChars
, FALSE
, bEOP
);
4523 TRACE("%s\n", wine_dbgstr_w(*pbstr
));
4528 static HRESULT WINAPI
ITextSelection_fnSetText(ITextSelection
*me
, BSTR str
)
4530 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4531 ME_TextEditor
*editor
;
4534 TRACE("(%p)->(%s)\n", This
, debugstr_w(str
));
4537 return CO_E_RELEASED
;
4539 editor
= This
->reOle
->editor
;
4540 len
= lstrlenW(str
);
4541 ME_GetSelectionOfs(editor
, &from
, &to
);
4542 ME_ReplaceSel(editor
, FALSE
, str
, len
);
4544 if (len
< to
- from
)
4545 textranges_update_ranges(This
->reOle
, from
, len
, RANGE_UPDATE_DELETE
);
4550 static HRESULT WINAPI
ITextSelection_fnGetChar(ITextSelection
*me
, LONG
*pch
)
4552 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4553 ME_Cursor
*start
= NULL
, *end
= NULL
;
4555 TRACE("(%p)->(%p)\n", This
, pch
);
4558 return CO_E_RELEASED
;
4561 return E_INVALIDARG
;
4563 ME_GetSelection(This
->reOle
->editor
, &start
, &end
);
4564 return range_GetChar(This
->reOle
->editor
, start
, pch
);
4567 static HRESULT WINAPI
ITextSelection_fnSetChar(ITextSelection
*me
, LONG ch
)
4569 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4571 FIXME("(%p)->(%x): stub\n", This
, ch
);
4574 return CO_E_RELEASED
;
4579 static HRESULT WINAPI
ITextSelection_fnGetDuplicate(ITextSelection
*me
, ITextRange
**range
)
4581 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4584 TRACE("(%p)->(%p)\n", This
, range
);
4587 return CO_E_RELEASED
;
4590 return E_INVALIDARG
;
4592 ITextSelection_GetStart(me
, &start
);
4593 ITextSelection_GetEnd(me
, &end
);
4594 return CreateITextRange(This
->reOle
, start
, end
, range
);
4597 static HRESULT WINAPI
ITextSelection_fnGetFormattedText(ITextSelection
*me
, ITextRange
**range
)
4599 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4601 FIXME("(%p)->(%p): stub\n", This
, range
);
4604 return CO_E_RELEASED
;
4609 static HRESULT WINAPI
ITextSelection_fnSetFormattedText(ITextSelection
*me
, ITextRange
*range
)
4611 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4613 FIXME("(%p)->(%p): stub\n", This
, range
);
4616 return CO_E_RELEASED
;
4618 FIXME("not implemented\n");
4622 static HRESULT WINAPI
ITextSelection_fnGetStart(ITextSelection
*me
, LONG
*pcpFirst
)
4624 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4627 TRACE("(%p)->(%p)\n", This
, pcpFirst
);
4630 return CO_E_RELEASED
;
4633 return E_INVALIDARG
;
4634 ME_GetSelectionOfs(This
->reOle
->editor
, pcpFirst
, &lim
);
4638 static HRESULT WINAPI
ITextSelection_fnSetStart(ITextSelection
*me
, LONG value
)
4640 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4644 TRACE("(%p)->(%d)\n", This
, value
);
4647 return CO_E_RELEASED
;
4649 ME_GetSelectionOfs(This
->reOle
->editor
, &start
, &end
);
4650 hr
= textrange_setstart(This
->reOle
, value
, &start
, &end
);
4652 set_selection(This
->reOle
->editor
, start
, end
);
4657 static HRESULT WINAPI
ITextSelection_fnGetEnd(ITextSelection
*me
, LONG
*pcpLim
)
4659 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4662 TRACE("(%p)->(%p)\n", This
, pcpLim
);
4665 return CO_E_RELEASED
;
4668 return E_INVALIDARG
;
4669 ME_GetSelectionOfs(This
->reOle
->editor
, &first
, pcpLim
);
4673 static HRESULT WINAPI
ITextSelection_fnSetEnd(ITextSelection
*me
, LONG value
)
4675 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4679 TRACE("(%p)->(%d)\n", This
, value
);
4682 return CO_E_RELEASED
;
4684 ME_GetSelectionOfs(This
->reOle
->editor
, &start
, &end
);
4685 hr
= textrange_setend(This
->reOle
, value
, &start
, &end
);
4687 set_selection(This
->reOle
->editor
, start
, end
);
4692 static HRESULT WINAPI
ITextSelection_fnGetFont(ITextSelection
*me
, ITextFont
**font
)
4694 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4695 ITextRange
*range
= NULL
;
4698 TRACE("(%p)->(%p)\n", This
, font
);
4701 return CO_E_RELEASED
;
4704 return E_INVALIDARG
;
4706 ITextSelection_QueryInterface(me
, &IID_ITextRange
, (void**)&range
);
4707 hr
= create_textfont(range
, NULL
, font
);
4708 ITextRange_Release(range
);
4712 static HRESULT WINAPI
ITextSelection_fnSetFont(ITextSelection
*me
, ITextFont
*font
)
4714 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4715 ITextRange
*range
= NULL
;
4717 TRACE("(%p)->(%p)\n", This
, font
);
4720 return E_INVALIDARG
;
4723 return CO_E_RELEASED
;
4725 ITextSelection_QueryInterface(me
, &IID_ITextRange
, (void**)&range
);
4726 textrange_set_font(range
, font
);
4727 ITextRange_Release(range
);
4731 static HRESULT WINAPI
ITextSelection_fnGetPara(ITextSelection
*me
, ITextPara
**para
)
4733 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4734 ITextRange
*range
= NULL
;
4737 TRACE("(%p)->(%p)\n", This
, para
);
4740 return CO_E_RELEASED
;
4743 return E_INVALIDARG
;
4745 ITextSelection_QueryInterface(me
, &IID_ITextRange
, (void**)&range
);
4746 hr
= create_textpara(range
, para
);
4747 ITextRange_Release(range
);
4751 static HRESULT WINAPI
ITextSelection_fnSetPara(ITextSelection
*me
, ITextPara
*para
)
4753 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4755 FIXME("(%p)->(%p): stub\n", This
, para
);
4758 return CO_E_RELEASED
;
4760 FIXME("not implemented\n");
4764 static HRESULT WINAPI
ITextSelection_fnGetStoryLength(ITextSelection
*me
, LONG
*length
)
4766 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4768 TRACE("(%p)->(%p)\n", This
, length
);
4771 return CO_E_RELEASED
;
4773 return textrange_get_storylength(This
->reOle
->editor
, length
);
4776 static HRESULT WINAPI
ITextSelection_fnGetStoryType(ITextSelection
*me
, LONG
*value
)
4778 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4780 TRACE("(%p)->(%p)\n", This
, value
);
4783 return CO_E_RELEASED
;
4786 return E_INVALIDARG
;
4788 *value
= tomUnknownStory
;
4792 static HRESULT WINAPI
ITextSelection_fnCollapse(ITextSelection
*me
, LONG bStart
)
4794 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4798 TRACE("(%p)->(%d)\n", This
, bStart
);
4801 return CO_E_RELEASED
;
4803 ME_GetSelectionOfs(This
->reOle
->editor
, &start
, &end
);
4804 hres
= range_Collapse(bStart
, &start
, &end
);
4805 if (SUCCEEDED(hres
))
4806 set_selection(This
->reOle
->editor
, start
, end
);
4810 static HRESULT WINAPI
ITextSelection_fnExpand(ITextSelection
*me
, LONG unit
, LONG
*delta
)
4812 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4813 ITextRange
*range
= NULL
;
4816 TRACE("(%p)->(%d %p)\n", This
, unit
, delta
);
4819 return CO_E_RELEASED
;
4821 ITextSelection_QueryInterface(me
, &IID_ITextRange
, (void**)&range
);
4822 hr
= textrange_expand(range
, unit
, delta
);
4823 ITextRange_Release(range
);
4827 static HRESULT WINAPI
ITextSelection_fnGetIndex(ITextSelection
*me
, LONG unit
, LONG
*index
)
4829 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4831 FIXME("(%p)->(%d %p): stub\n", This
, unit
, index
);
4834 return CO_E_RELEASED
;
4839 static HRESULT WINAPI
ITextSelection_fnSetIndex(ITextSelection
*me
, LONG unit
, LONG index
,
4842 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4844 FIXME("(%p)->(%d %d %d): stub\n", This
, unit
, index
, extend
);
4847 return CO_E_RELEASED
;
4852 static HRESULT WINAPI
ITextSelection_fnSetRange(ITextSelection
*me
, LONG anchor
, LONG active
)
4854 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4856 FIXME("(%p)->(%d %d): stub\n", This
, anchor
, active
);
4859 return CO_E_RELEASED
;
4864 static HRESULT WINAPI
ITextSelection_fnInRange(ITextSelection
*me
, ITextRange
*range
, LONG
*ret
)
4866 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4867 ITextSelection
*selection
= NULL
;
4870 TRACE("(%p)->(%p %p)\n", This
, range
, ret
);
4876 return CO_E_RELEASED
;
4881 ITextRange_QueryInterface(range
, &IID_ITextSelection
, (void**)&selection
);
4884 ITextSelection_Release(selection
);
4886 ITextSelection_GetStart(me
, &start
);
4887 ITextSelection_GetEnd(me
, &end
);
4888 return textrange_inrange(start
, end
, range
, ret
);
4891 static HRESULT WINAPI
ITextSelection_fnInStory(ITextSelection
*me
, ITextRange
*range
, LONG
*ret
)
4893 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4895 FIXME("(%p)->(%p %p): stub\n", This
, range
, ret
);
4898 return CO_E_RELEASED
;
4903 static HRESULT WINAPI
ITextSelection_fnIsEqual(ITextSelection
*me
, ITextRange
*range
, LONG
*ret
)
4905 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4906 ITextSelection
*selection
= NULL
;
4909 TRACE("(%p)->(%p %p)\n", This
, range
, ret
);
4915 return CO_E_RELEASED
;
4920 ITextRange_QueryInterface(range
, &IID_ITextSelection
, (void**)&selection
);
4923 ITextSelection_Release(selection
);
4925 ITextSelection_GetStart(me
, &start
);
4926 ITextSelection_GetEnd(me
, &end
);
4927 return textrange_isequal(start
, end
, range
, ret
);
4930 static HRESULT WINAPI
ITextSelection_fnSelect(ITextSelection
*me
)
4932 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4934 TRACE("(%p)\n", This
);
4937 return CO_E_RELEASED
;
4943 static HRESULT WINAPI
ITextSelection_fnStartOf(ITextSelection
*me
, LONG unit
, LONG extend
,
4946 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4948 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, extend
, delta
);
4951 return CO_E_RELEASED
;
4956 static HRESULT WINAPI
ITextSelection_fnEndOf(ITextSelection
*me
, LONG unit
, LONG extend
,
4959 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4961 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, extend
, delta
);
4964 return CO_E_RELEASED
;
4969 static HRESULT WINAPI
ITextSelection_fnMove(ITextSelection
*me
, LONG unit
, LONG count
, LONG
*delta
)
4971 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4973 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, count
, delta
);
4976 return CO_E_RELEASED
;
4981 static HRESULT WINAPI
ITextSelection_fnMoveStart(ITextSelection
*me
, LONG unit
, LONG count
,
4984 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4986 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, count
, delta
);
4989 return CO_E_RELEASED
;
4994 static HRESULT WINAPI
ITextSelection_fnMoveEnd(ITextSelection
*me
, LONG unit
, LONG count
,
4997 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4998 ITextRange
*range
= NULL
;
5001 TRACE("(%p)->(%d %d %p)\n", This
, unit
, count
, delta
);
5004 return CO_E_RELEASED
;
5006 ITextSelection_QueryInterface(me
, &IID_ITextRange
, (void**)&range
);
5007 hr
= textrange_moveend(range
, unit
, count
, delta
);
5008 ITextRange_Release(range
);
5012 static HRESULT WINAPI
ITextSelection_fnMoveWhile(ITextSelection
*me
, VARIANT
*charset
, LONG count
,
5015 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5017 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
5020 return CO_E_RELEASED
;
5025 static HRESULT WINAPI
ITextSelection_fnMoveStartWhile(ITextSelection
*me
, VARIANT
*charset
, LONG count
,
5028 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5030 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
5033 return CO_E_RELEASED
;
5038 static HRESULT WINAPI
ITextSelection_fnMoveEndWhile(ITextSelection
*me
, VARIANT
*charset
, LONG count
,
5041 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5043 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
5046 return CO_E_RELEASED
;
5051 static HRESULT WINAPI
ITextSelection_fnMoveUntil(ITextSelection
*me
, VARIANT
*charset
, LONG count
,
5054 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5056 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
5059 return CO_E_RELEASED
;
5064 static HRESULT WINAPI
ITextSelection_fnMoveStartUntil(ITextSelection
*me
, VARIANT
*charset
, LONG count
,
5067 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5069 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
5072 return CO_E_RELEASED
;
5077 static HRESULT WINAPI
ITextSelection_fnMoveEndUntil(ITextSelection
*me
, VARIANT
*charset
, LONG count
,
5080 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5082 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
5085 return CO_E_RELEASED
;
5090 static HRESULT WINAPI
ITextSelection_fnFindText(ITextSelection
*me
, BSTR text
, LONG count
, LONG flags
,
5093 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5095 FIXME("(%p)->(%s %d %x %p): stub\n", This
, debugstr_w(text
), count
, flags
, length
);
5098 return CO_E_RELEASED
;
5100 FIXME("not implemented\n");
5104 static HRESULT WINAPI
ITextSelection_fnFindTextStart(ITextSelection
*me
, BSTR text
, LONG count
,
5105 LONG flags
, LONG
*length
)
5107 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5109 FIXME("(%p)->(%s %d %x %p): stub\n", This
, debugstr_w(text
), count
, flags
, length
);
5112 return CO_E_RELEASED
;
5117 static HRESULT WINAPI
ITextSelection_fnFindTextEnd(ITextSelection
*me
, BSTR text
, LONG count
,
5118 LONG flags
, LONG
*length
)
5120 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5122 FIXME("(%p)->(%s %d %x %p): stub\n", This
, debugstr_w(text
), count
, flags
, length
);
5125 return CO_E_RELEASED
;
5130 static HRESULT WINAPI
ITextSelection_fnDelete(ITextSelection
*me
, LONG unit
, LONG count
,
5133 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5135 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, count
, delta
);
5138 return CO_E_RELEASED
;
5143 static HRESULT WINAPI
ITextSelection_fnCut(ITextSelection
*me
, VARIANT
*v
)
5145 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5147 FIXME("(%p)->(%p): stub\n", This
, v
);
5150 return CO_E_RELEASED
;
5155 static HRESULT WINAPI
ITextSelection_fnCopy(ITextSelection
*me
, VARIANT
*v
)
5157 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5159 FIXME("(%p)->(%p): stub\n", This
, v
);
5162 return CO_E_RELEASED
;
5167 static HRESULT WINAPI
ITextSelection_fnPaste(ITextSelection
*me
, VARIANT
*v
, LONG format
)
5169 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5171 FIXME("(%p)->(%s %x): stub\n", This
, debugstr_variant(v
), format
);
5174 return CO_E_RELEASED
;
5179 static HRESULT WINAPI
ITextSelection_fnCanPaste(ITextSelection
*me
, VARIANT
*v
, LONG format
,
5182 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5184 FIXME("(%p)->(%s %x %p): stub\n", This
, debugstr_variant(v
), format
, ret
);
5187 return CO_E_RELEASED
;
5192 static HRESULT WINAPI
ITextSelection_fnCanEdit(ITextSelection
*me
, LONG
*ret
)
5194 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5196 FIXME("(%p)->(%p): stub\n", This
, ret
);
5199 return CO_E_RELEASED
;
5204 static HRESULT WINAPI
ITextSelection_fnChangeCase(ITextSelection
*me
, LONG type
)
5206 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5208 FIXME("(%p)->(%d): stub\n", This
, type
);
5211 return CO_E_RELEASED
;
5216 static HRESULT WINAPI
ITextSelection_fnGetPoint(ITextSelection
*me
, LONG type
, LONG
*cx
, LONG
*cy
)
5218 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5220 FIXME("(%p)->(%d %p %p): stub\n", This
, type
, cx
, cy
);
5223 return CO_E_RELEASED
;
5228 static HRESULT WINAPI
ITextSelection_fnSetPoint(ITextSelection
*me
, LONG x
, LONG y
, LONG type
,
5231 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5233 FIXME("(%p)->(%d %d %d %d): stub\n", This
, x
, y
, type
, extend
);
5236 return CO_E_RELEASED
;
5241 static HRESULT WINAPI
ITextSelection_fnScrollIntoView(ITextSelection
*me
, LONG value
)
5243 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5245 FIXME("(%p)->(%d): stub\n", This
, value
);
5248 return CO_E_RELEASED
;
5253 static HRESULT WINAPI
ITextSelection_fnGetEmbeddedObject(ITextSelection
*me
, IUnknown
**ppv
)
5255 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5257 FIXME("(%p)->(%p): stub\n", This
, ppv
);
5260 return CO_E_RELEASED
;
5265 /*** ITextSelection methods ***/
5266 static HRESULT WINAPI
ITextSelection_fnGetFlags(ITextSelection
*me
, LONG
*flags
)
5268 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5270 FIXME("(%p)->(%p): stub\n", This
, flags
);
5273 return CO_E_RELEASED
;
5278 static HRESULT WINAPI
ITextSelection_fnSetFlags(ITextSelection
*me
, LONG flags
)
5280 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5282 FIXME("(%p)->(%x): stub\n", This
, flags
);
5285 return CO_E_RELEASED
;
5290 static HRESULT WINAPI
ITextSelection_fnGetType(ITextSelection
*me
, LONG
*type
)
5292 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5294 FIXME("(%p)->(%p): stub\n", This
, type
);
5297 return CO_E_RELEASED
;
5302 static HRESULT WINAPI
ITextSelection_fnMoveLeft(ITextSelection
*me
, LONG unit
, LONG count
,
5303 LONG extend
, LONG
*delta
)
5305 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5307 FIXME("(%p)->(%d %d %d %p): stub\n", This
, unit
, count
, extend
, delta
);
5310 return CO_E_RELEASED
;
5315 static HRESULT WINAPI
ITextSelection_fnMoveRight(ITextSelection
*me
, LONG unit
, LONG count
,
5316 LONG extend
, LONG
*delta
)
5318 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5320 FIXME("(%p)->(%d %d %d %p): stub\n", This
, unit
, count
, extend
, delta
);
5323 return CO_E_RELEASED
;
5328 static HRESULT WINAPI
ITextSelection_fnMoveUp(ITextSelection
*me
, LONG unit
, LONG count
,
5329 LONG extend
, LONG
*delta
)
5331 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5333 FIXME("(%p)->(%d %d %d %p): stub\n", This
, unit
, count
, extend
, delta
);
5336 return CO_E_RELEASED
;
5341 static HRESULT WINAPI
ITextSelection_fnMoveDown(ITextSelection
*me
, LONG unit
, LONG count
,
5342 LONG extend
, LONG
*delta
)
5344 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5346 FIXME("(%p)->(%d %d %d %p): stub\n", This
, unit
, count
, extend
, delta
);
5349 return CO_E_RELEASED
;
5354 static HRESULT WINAPI
ITextSelection_fnHomeKey(ITextSelection
*me
, LONG unit
, LONG extend
,
5357 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5359 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, extend
, delta
);
5362 return CO_E_RELEASED
;
5367 static HRESULT WINAPI
ITextSelection_fnEndKey(ITextSelection
*me
, LONG unit
, LONG extend
,
5370 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5372 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, extend
, delta
);
5375 return CO_E_RELEASED
;
5380 static HRESULT WINAPI
ITextSelection_fnTypeText(ITextSelection
*me
, BSTR text
)
5382 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5384 FIXME("(%p)->(%s): stub\n", This
, debugstr_w(text
));
5387 return CO_E_RELEASED
;
5392 static const ITextSelectionVtbl tsvt
= {
5393 ITextSelection_fnQueryInterface
,
5394 ITextSelection_fnAddRef
,
5395 ITextSelection_fnRelease
,
5396 ITextSelection_fnGetTypeInfoCount
,
5397 ITextSelection_fnGetTypeInfo
,
5398 ITextSelection_fnGetIDsOfNames
,
5399 ITextSelection_fnInvoke
,
5400 ITextSelection_fnGetText
,
5401 ITextSelection_fnSetText
,
5402 ITextSelection_fnGetChar
,
5403 ITextSelection_fnSetChar
,
5404 ITextSelection_fnGetDuplicate
,
5405 ITextSelection_fnGetFormattedText
,
5406 ITextSelection_fnSetFormattedText
,
5407 ITextSelection_fnGetStart
,
5408 ITextSelection_fnSetStart
,
5409 ITextSelection_fnGetEnd
,
5410 ITextSelection_fnSetEnd
,
5411 ITextSelection_fnGetFont
,
5412 ITextSelection_fnSetFont
,
5413 ITextSelection_fnGetPara
,
5414 ITextSelection_fnSetPara
,
5415 ITextSelection_fnGetStoryLength
,
5416 ITextSelection_fnGetStoryType
,
5417 ITextSelection_fnCollapse
,
5418 ITextSelection_fnExpand
,
5419 ITextSelection_fnGetIndex
,
5420 ITextSelection_fnSetIndex
,
5421 ITextSelection_fnSetRange
,
5422 ITextSelection_fnInRange
,
5423 ITextSelection_fnInStory
,
5424 ITextSelection_fnIsEqual
,
5425 ITextSelection_fnSelect
,
5426 ITextSelection_fnStartOf
,
5427 ITextSelection_fnEndOf
,
5428 ITextSelection_fnMove
,
5429 ITextSelection_fnMoveStart
,
5430 ITextSelection_fnMoveEnd
,
5431 ITextSelection_fnMoveWhile
,
5432 ITextSelection_fnMoveStartWhile
,
5433 ITextSelection_fnMoveEndWhile
,
5434 ITextSelection_fnMoveUntil
,
5435 ITextSelection_fnMoveStartUntil
,
5436 ITextSelection_fnMoveEndUntil
,
5437 ITextSelection_fnFindText
,
5438 ITextSelection_fnFindTextStart
,
5439 ITextSelection_fnFindTextEnd
,
5440 ITextSelection_fnDelete
,
5441 ITextSelection_fnCut
,
5442 ITextSelection_fnCopy
,
5443 ITextSelection_fnPaste
,
5444 ITextSelection_fnCanPaste
,
5445 ITextSelection_fnCanEdit
,
5446 ITextSelection_fnChangeCase
,
5447 ITextSelection_fnGetPoint
,
5448 ITextSelection_fnSetPoint
,
5449 ITextSelection_fnScrollIntoView
,
5450 ITextSelection_fnGetEmbeddedObject
,
5451 ITextSelection_fnGetFlags
,
5452 ITextSelection_fnSetFlags
,
5453 ITextSelection_fnGetType
,
5454 ITextSelection_fnMoveLeft
,
5455 ITextSelection_fnMoveRight
,
5456 ITextSelection_fnMoveUp
,
5457 ITextSelection_fnMoveDown
,
5458 ITextSelection_fnHomeKey
,
5459 ITextSelection_fnEndKey
,
5460 ITextSelection_fnTypeText
5463 static ITextSelectionImpl
*
5464 CreateTextSelection(IRichEditOleImpl
*reOle
)
5466 ITextSelectionImpl
*txtSel
= heap_alloc(sizeof *txtSel
);
5470 txtSel
->ITextSelection_iface
.lpVtbl
= &tsvt
;
5472 txtSel
->reOle
= reOle
;
5476 LRESULT
CreateIRichEditOle(IUnknown
*outer_unk
, ME_TextEditor
*editor
, LPVOID
*ppvObj
)
5478 IRichEditOleImpl
*reo
;
5480 reo
= heap_alloc(sizeof(IRichEditOleImpl
));
5484 reo
->IUnknown_inner
.lpVtbl
= &reo_unk_vtbl
;
5485 reo
->IRichEditOle_iface
.lpVtbl
= &revt
;
5486 reo
->ITextDocument2Old_iface
.lpVtbl
= &tdvt
;
5488 reo
->editor
= editor
;
5491 TRACE("Created %p\n",reo
);
5492 list_init(&reo
->rangelist
);
5493 list_init(&reo
->clientsites
);
5495 reo
->outer_unk
= outer_unk
;
5497 reo
->outer_unk
= &reo
->IUnknown_inner
;
5498 *ppvObj
= &reo
->IUnknown_inner
;
5503 static void convert_sizel(const ME_Context
*c
, const SIZEL
* szl
, SIZE
* sz
)
5505 /* sizel is in .01 millimeters, sz in pixels */
5506 sz
->cx
= MulDiv(szl
->cx
, c
->dpi
.cx
, 2540);
5507 sz
->cy
= MulDiv(szl
->cy
, c
->dpi
.cy
, 2540);
5510 /******************************************************************************
5511 * ME_GetOLEObjectSize
5513 * Sets run extent for OLE objects.
5515 void ME_GetOLEObjectSize(const ME_Context
*c
, ME_Run
*run
, SIZE
*pSize
)
5523 assert(run
->nFlags
& MERF_GRAPHICS
);
5526 if (run
->reobj
->obj
.sizel
.cx
!= 0 || run
->reobj
->obj
.sizel
.cy
!= 0)
5528 convert_sizel(c
, &run
->reobj
->obj
.sizel
, pSize
);
5529 if (c
->editor
->nZoomNumerator
!= 0)
5531 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5532 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5537 if (!run
->reobj
->obj
.poleobj
)
5539 pSize
->cx
= pSize
->cy
= 0;
5543 if (IOleObject_QueryInterface(run
->reobj
->obj
.poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
5545 FIXME("Query Interface IID_IDataObject failed!\n");
5546 pSize
->cx
= pSize
->cy
= 0;
5549 fmt
.cfFormat
= CF_BITMAP
;
5551 fmt
.dwAspect
= DVASPECT_CONTENT
;
5553 fmt
.tymed
= TYMED_GDI
;
5554 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
5556 fmt
.cfFormat
= CF_ENHMETAFILE
;
5557 fmt
.tymed
= TYMED_ENHMF
;
5558 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
5560 FIXME("unsupported format\n");
5561 pSize
->cx
= pSize
->cy
= 0;
5562 IDataObject_Release(ido
);
5566 IDataObject_Release(ido
);
5571 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
5572 pSize
->cx
= dibsect
.dsBm
.bmWidth
;
5573 pSize
->cy
= dibsect
.dsBm
.bmHeight
;
5576 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
5577 pSize
->cx
= emh
.rclBounds
.right
- emh
.rclBounds
.left
;
5578 pSize
->cy
= emh
.rclBounds
.bottom
- emh
.rclBounds
.top
;
5581 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
5584 ReleaseStgMedium(&stgm
);
5585 if (c
->editor
->nZoomNumerator
!= 0)
5587 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5588 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5592 void ME_DrawOLE(ME_Context
*c
, int x
, int y
, ME_Run
*run
, BOOL selected
)
5605 assert(run
->nFlags
& MERF_GRAPHICS
);
5607 if (IOleObject_QueryInterface(run
->reobj
->obj
.poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
5609 FIXME("Couldn't get interface\n");
5612 has_size
= run
->reobj
->obj
.sizel
.cx
!= 0 || run
->reobj
->obj
.sizel
.cy
!= 0;
5613 fmt
.cfFormat
= CF_BITMAP
;
5615 fmt
.dwAspect
= DVASPECT_CONTENT
;
5617 fmt
.tymed
= TYMED_GDI
;
5618 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
5620 fmt
.cfFormat
= CF_ENHMETAFILE
;
5621 fmt
.tymed
= TYMED_ENHMF
;
5622 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
5624 FIXME("Couldn't get storage medium\n");
5625 IDataObject_Release(ido
);
5629 IDataObject_Release(ido
);
5634 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
5635 hMemDC
= CreateCompatibleDC(c
->hDC
);
5636 old_bm
= SelectObject(hMemDC
, stgm
.u
.hBitmap
);
5639 convert_sizel(c
, &run
->reobj
->obj
.sizel
, &sz
);
5641 sz
.cx
= dibsect
.dsBm
.bmWidth
;
5642 sz
.cy
= dibsect
.dsBm
.bmHeight
;
5644 if (c
->editor
->nZoomNumerator
!= 0)
5646 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5647 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5649 StretchBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
,
5650 hMemDC
, 0, 0, dibsect
.dsBm
.bmWidth
, dibsect
.dsBm
.bmHeight
, SRCCOPY
);
5652 SelectObject(hMemDC
, old_bm
);
5656 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
5659 convert_sizel(c
, &run
->reobj
->obj
.sizel
, &sz
);
5661 sz
.cx
= emh
.rclBounds
.right
- emh
.rclBounds
.left
;
5662 sz
.cy
= emh
.rclBounds
.bottom
- emh
.rclBounds
.top
;
5664 if (c
->editor
->nZoomNumerator
!= 0)
5666 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5667 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5672 rc
.right
= x
+ sz
.cx
;
5674 PlayEnhMetaFile(c
->hDC
, stgm
.u
.hEnhMetaFile
, &rc
);
5677 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
5681 ReleaseStgMedium(&stgm
);
5683 if (selected
&& !c
->editor
->bHideSelection
)
5684 PatBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
, DSTINVERT
);
5687 void ME_DeleteReObject(struct re_object
*reobj
)
5689 if (reobj
->obj
.poleobj
) IOleObject_Release(reobj
->obj
.poleobj
);
5690 if (reobj
->obj
.pstg
) IStorage_Release(reobj
->obj
.pstg
);
5691 if (reobj
->obj
.polesite
) IOleClientSite_Release(reobj
->obj
.polesite
);
5695 void ME_CopyReObject(REOBJECT
*dst
, const REOBJECT
*src
, DWORD flags
)
5698 dst
->poleobj
= NULL
;
5700 dst
->polesite
= NULL
;
5702 if ((flags
& REO_GETOBJ_POLEOBJ
) && src
->poleobj
)
5704 dst
->poleobj
= src
->poleobj
;
5705 IOleObject_AddRef(dst
->poleobj
);
5707 if ((flags
& REO_GETOBJ_PSTG
) && src
->pstg
)
5709 dst
->pstg
= src
->pstg
;
5710 IStorage_AddRef(dst
->pstg
);
5712 if ((flags
& REO_GETOBJ_POLESITE
) && src
->polesite
)
5714 dst
->polesite
= src
->polesite
;
5715 IOleClientSite_AddRef(dst
->polesite
);