2 * RichEdit GUIDs and OLE interface
4 * Copyright 2004 by Krzysztof Foltman
5 * Copyright 2004 Aric Stewart
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 #define NONAMELESSUNION
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(richedit
);
40 /* there is no way to be consistent across different sets of headers - mingw, Wine, Win32 SDK*/
44 DEFINE_GUID(LIBID_tom
, 0x8cc497c9, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
45 DEFINE_GUID(IID_ITextServices
, 0x8d33f740, 0xcf58, 0x11ce, 0xa8, 0x9d, 0x00, 0xaa, 0x00, 0x6c, 0xad, 0xc5);
46 DEFINE_GUID(IID_ITextHost
, 0x13e670f4,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1);
47 DEFINE_GUID(IID_ITextHost2
, 0x13e670f5,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0xb6,0x5e,0xa1);
48 DEFINE_GUID(IID_ITextDocument
, 0x8cc497c0, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
49 DEFINE_GUID(IID_ITextRange
, 0x8cc497c2, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
50 DEFINE_GUID(IID_ITextSelection
, 0x8cc497c1, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
51 DEFINE_GUID(IID_ITextFont
, 0x8cc497c3, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
52 DEFINE_GUID(IID_ITextPara
, 0x8cc497c4, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0x00, 0x47, 0xbe, 0x5d);
54 static ITypeLib
*typelib
;
66 static const IID
* const tid_ids
[] =
75 static ITypeInfo
*typeinfos
[LAST_tid
];
77 static HRESULT
load_typelib(void)
82 hr
= LoadRegTypeLib(&LIBID_tom
, 1, 0, LOCALE_SYSTEM_DEFAULT
, &tl
);
84 ERR("LoadRegTypeLib failed: %08x\n", hr
);
88 if (InterlockedCompareExchangePointer((void**)&typelib
, tl
, NULL
))
93 void release_typelib(void)
100 for (i
= 0; i
< sizeof(typeinfos
)/sizeof(*typeinfos
); i
++)
102 ITypeInfo_Release(typeinfos
[i
]);
104 ITypeLib_Release(typelib
);
107 static HRESULT
get_typeinfo(enum tid_t tid
, ITypeInfo
**typeinfo
)
120 hr
= ITypeLib_GetTypeInfoOfGuid(typelib
, tid_ids
[tid
], &ti
);
123 ERR("GetTypeInfoOfGuid(%s) failed: %08x\n", debugstr_guid(tid_ids
[tid
]), hr
);
127 if (InterlockedCompareExchangePointer((void**)(typeinfos
+tid
), ti
, NULL
))
128 ITypeInfo_Release(ti
);
131 *typeinfo
= typeinfos
[tid
];
135 /* private IID used to get back IRichEditOleImpl pointer */
136 DEFINE_GUID(IID_Igetrichole
, 0xe3ce5c7a, 0x8247, 0x4622, 0x81, 0xad, 0x11, 0x81, 0x02, 0xaa, 0x01, 0x30);
138 typedef struct ITextSelectionImpl ITextSelectionImpl
;
139 typedef struct IOleClientSiteImpl IOleClientSiteImpl
;
140 typedef struct ITextRangeImpl ITextRangeImpl
;
142 enum textfont_prop_id
{
168 FONT_PROPID_FIRST
= FONT_ALLCAPS
171 static const DWORD textfont_prop_masks
[][2] = {
172 { CFM_ALLCAPS
, CFE_ALLCAPS
},
174 { CFM_BACKCOLOR
, CFE_AUTOBACKCOLOR
},
175 { CFM_BOLD
, CFE_BOLD
},
176 { CFM_EMBOSS
, CFE_EMBOSS
},
177 { CFM_COLOR
, CFE_AUTOCOLOR
},
178 { CFM_HIDDEN
, CFE_HIDDEN
},
179 { CFM_IMPRINT
, CFE_IMPRINT
},
180 { CFM_ITALIC
, CFE_ITALIC
},
184 { CFM_OUTLINE
, CFE_OUTLINE
},
186 { CFM_PROTECTED
, CFE_PROTECTED
},
187 { CFM_SHADOW
, CFE_SHADOW
},
189 { CFM_SMALLCAPS
, CFE_SMALLCAPS
},
191 { CFM_STRIKEOUT
, CFE_STRIKEOUT
},
192 { CFM_SUBSCRIPT
, CFE_SUBSCRIPT
},
193 { CFM_SUPERSCRIPT
, CFE_SUPERSCRIPT
},
194 { CFM_UNDERLINE
, CFE_UNDERLINE
},
204 enum range_update_op
{
208 typedef struct IRichEditOleImpl
{
209 IUnknown IUnknown_inner
;
210 IRichEditOle IRichEditOle_iface
;
211 ITextDocument ITextDocument_iface
;
215 ME_TextEditor
*editor
;
216 ITextSelectionImpl
*txtSel
;
218 struct list rangelist
;
219 struct list clientsites
;
224 IRichEditOleImpl
*reole
;
227 struct ITextRangeImpl
{
228 struct reole_child child
;
229 ITextRange ITextRange_iface
;
234 struct ITextSelectionImpl
{
235 ITextSelection ITextSelection_iface
;
238 IRichEditOleImpl
*reOle
;
241 typedef struct ITextFontImpl
{
242 ITextFont ITextFont_iface
;
246 textfont_prop_val props
[FONT_PROPID_LAST
];
247 BOOL get_cache_enabled
;
248 BOOL set_cache_enabled
;
251 typedef struct ITextParaImpl
{
252 ITextPara ITextPara_iface
;
258 struct IOleClientSiteImpl
{
259 struct reole_child child
;
260 IOleClientSite IOleClientSite_iface
;
261 IOleWindow IOleWindow_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_ITextDocument(ITextDocument
*iface
)
273 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, ITextDocument_iface
);
276 static inline IRichEditOleImpl
*impl_from_IUnknown(IUnknown
*iface
)
278 return CONTAINING_RECORD(iface
, IRichEditOleImpl
, IUnknown_inner
);
281 static inline IOleClientSiteImpl
*impl_from_IOleWindow(IOleWindow
*iface
)
283 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleWindow_iface
);
286 static inline IOleClientSiteImpl
*impl_from_IOleInPlaceSite(IOleInPlaceSite
*iface
)
288 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleInPlaceSite_iface
);
291 static inline ITextRangeImpl
*impl_from_ITextRange(ITextRange
*iface
)
293 return CONTAINING_RECORD(iface
, ITextRangeImpl
, ITextRange_iface
);
296 static inline ITextSelectionImpl
*impl_from_ITextSelection(ITextSelection
*iface
)
298 return CONTAINING_RECORD(iface
, ITextSelectionImpl
, ITextSelection_iface
);
301 static inline ITextFontImpl
*impl_from_ITextFont(ITextFont
*iface
)
303 return CONTAINING_RECORD(iface
, ITextFontImpl
, ITextFont_iface
);
306 static inline ITextParaImpl
*impl_from_ITextPara(ITextPara
*iface
)
308 return CONTAINING_RECORD(iface
, ITextParaImpl
, ITextPara_iface
);
311 static HRESULT
create_textfont(ITextRange
*, const ITextFontImpl
*, ITextFont
**);
312 static HRESULT
create_textpara(ITextRange
*, ITextPara
**);
313 static ITextSelectionImpl
*CreateTextSelection(IRichEditOleImpl
*);
315 static HRESULT
textrange_get_storylength(ME_TextEditor
*editor
, LONG
*length
)
320 *length
= ME_GetTextLength(editor
) + 1;
324 static void textranges_update_ranges(IRichEditOleImpl
*reole
, LONG start
, LONG end
, enum range_update_op op
)
326 ITextRangeImpl
*range
;
328 LIST_FOR_EACH_ENTRY(range
, &reole
->rangelist
, ITextRangeImpl
, child
.entry
) {
331 case RANGE_UPDATE_DELETE
:
332 /* range fully covered by deleted range - collapse to insertion point */
333 if (range
->start
>= start
&& range
->end
<= end
)
334 range
->start
= range
->end
= start
;
335 /* deleted range cuts from the right */
336 else if (range
->start
< start
&& range
->end
<= end
)
338 /* deleted range cuts from the left */
339 else if (range
->start
>= start
&& range
->end
> end
) {
340 range
->start
= start
;
341 range
->end
-= end
- start
;
343 /* deleted range cuts within */
345 range
->end
-= end
- start
;
348 FIXME("unknown update op, %d\n", op
);
353 static inline BOOL
is_equal_textfont_prop_value(enum textfont_prop_id propid
, textfont_prop_val
*left
,
354 textfont_prop_val
*right
)
373 case FONT_STRIKETHROUGH
:
375 case FONT_SUPERSCRIPT
:
378 return left
->l
== right
->l
;
380 return !strcmpW(left
->str
, right
->str
);
384 return left
->f
== right
->f
;
386 FIXME("unhandled font property %d\n", propid
);
391 static inline void init_textfont_prop_value(enum textfont_prop_id propid
, textfont_prop_val
*v
)
410 case FONT_STRIKETHROUGH
:
412 case FONT_SUPERSCRIPT
:
426 FIXME("unhandled font property %d\n", propid
);
432 static inline FLOAT
twips_to_points(LONG value
)
434 return value
* 72.0 / 1440;
437 static inline FLOAT
points_to_twips(FLOAT value
)
439 return value
* 1440 / 72.0;
442 static HRESULT
get_textfont_prop_for_pos(const IRichEditOleImpl
*reole
, int pos
, enum textfont_prop_id propid
,
443 textfont_prop_val
*value
)
448 memset(&fmt
, 0, sizeof(fmt
));
449 fmt
.cbSize
= sizeof(fmt
);
450 fmt
.dwMask
= textfont_prop_masks
[propid
][0];
452 ME_CursorFromCharOfs(reole
->editor
, pos
, &from
);
454 ME_MoveCursorChars(reole
->editor
, &to
, 1);
455 ME_GetCharFormat(reole
->editor
, &from
, &to
, &fmt
);
469 case FONT_STRIKETHROUGH
:
471 case FONT_SUPERSCRIPT
:
473 value
->l
= fmt
.dwEffects
& textfont_prop_masks
[propid
][1] ? tomTrue
: tomFalse
;
476 value
->l
= fmt
.bAnimation
;
479 value
->l
= fmt
.dwEffects
& CFE_AUTOBACKCOLOR
? GetSysColor(COLOR_WINDOW
) : fmt
.crBackColor
;
482 value
->l
= fmt
.dwEffects
& CFE_AUTOCOLOR
? GetSysColor(COLOR_WINDOWTEXT
) : fmt
.crTextColor
;
485 value
->f
= twips_to_points(fmt
.wKerning
);
491 /* this case is used exclusively by GetName() */
492 value
->str
= SysAllocString(fmt
.szFaceName
);
494 return E_OUTOFMEMORY
;
497 value
->f
= twips_to_points(fmt
.yOffset
);
500 value
->f
= twips_to_points(fmt
.yHeight
);
503 value
->f
= fmt
.sSpacing
;
506 value
->l
= fmt
.wWeight
;
509 FIXME("unhandled font property %d\n", propid
);
516 static inline const IRichEditOleImpl
*get_range_reole(ITextRange
*range
)
518 IRichEditOleImpl
*reole
= NULL
;
519 ITextRange_QueryInterface(range
, &IID_Igetrichole
, (void**)&reole
);
523 static void textrange_set_font(ITextRange
*range
, ITextFont
*font
)
531 #define CHARFORMAT_SET_B_FIELD(mask, value) \
532 if (hr == S_OK && value != tomUndefined) { \
533 fmt.dwMask |= CFM_##mask; \
534 if (value == tomTrue) fmt.dwEffects |= CFE_##mask; \
537 /* fill format data from font */
538 memset(&fmt
, 0, sizeof(fmt
));
539 fmt
.cbSize
= sizeof(fmt
);
541 value
= tomUndefined
;
542 hr
= ITextFont_GetAllCaps(font
, &value
);
543 CHARFORMAT_SET_B_FIELD(ALLCAPS
, value
);
545 value
= tomUndefined
;
546 hr
= ITextFont_GetBold(font
, &value
);
547 CHARFORMAT_SET_B_FIELD(BOLD
, value
);
549 value
= tomUndefined
;
550 hr
= ITextFont_GetEmboss(font
, &value
);
551 CHARFORMAT_SET_B_FIELD(EMBOSS
, value
);
553 value
= tomUndefined
;
554 hr
= ITextFont_GetHidden(font
, &value
);
555 CHARFORMAT_SET_B_FIELD(HIDDEN
, value
);
557 value
= tomUndefined
;
558 hr
= ITextFont_GetEngrave(font
, &value
);
559 CHARFORMAT_SET_B_FIELD(IMPRINT
, value
);
561 value
= tomUndefined
;
562 hr
= ITextFont_GetItalic(font
, &value
);
563 CHARFORMAT_SET_B_FIELD(ITALIC
, value
);
565 value
= tomUndefined
;
566 hr
= ITextFont_GetOutline(font
, &value
);
567 CHARFORMAT_SET_B_FIELD(OUTLINE
, value
);
569 value
= tomUndefined
;
570 hr
= ITextFont_GetProtected(font
, &value
);
571 CHARFORMAT_SET_B_FIELD(PROTECTED
, value
);
573 value
= tomUndefined
;
574 hr
= ITextFont_GetShadow(font
, &value
);
575 CHARFORMAT_SET_B_FIELD(SHADOW
, value
);
577 value
= tomUndefined
;
578 hr
= ITextFont_GetSmallCaps(font
, &value
);
579 CHARFORMAT_SET_B_FIELD(SMALLCAPS
, value
);
581 value
= tomUndefined
;
582 hr
= ITextFont_GetStrikeThrough(font
, &value
);
583 CHARFORMAT_SET_B_FIELD(STRIKEOUT
, value
);
585 value
= tomUndefined
;
586 hr
= ITextFont_GetSubscript(font
, &value
);
587 CHARFORMAT_SET_B_FIELD(SUBSCRIPT
, value
);
589 value
= tomUndefined
;
590 hr
= ITextFont_GetSuperscript(font
, &value
);
591 CHARFORMAT_SET_B_FIELD(SUPERSCRIPT
, value
);
593 value
= tomUndefined
;
594 hr
= ITextFont_GetUnderline(font
, &value
);
595 CHARFORMAT_SET_B_FIELD(UNDERLINE
, value
);
597 #undef CHARFORMAT_SET_B_FIELD
599 value
= tomUndefined
;
600 hr
= ITextFont_GetAnimation(font
, &value
);
601 if (hr
== S_OK
&& value
!= tomUndefined
) {
602 fmt
.dwMask
|= CFM_ANIMATION
;
603 fmt
.bAnimation
= value
;
606 value
= tomUndefined
;
607 hr
= ITextFont_GetBackColor(font
, &value
);
608 if (hr
== S_OK
&& value
!= tomUndefined
) {
609 fmt
.dwMask
|= CFM_BACKCOLOR
;
610 if (value
== tomAutoColor
)
611 fmt
.dwEffects
|= CFE_AUTOBACKCOLOR
;
613 fmt
.crBackColor
= value
;
616 value
= tomUndefined
;
617 hr
= ITextFont_GetForeColor(font
, &value
);
618 if (hr
== S_OK
&& value
!= tomUndefined
) {
619 fmt
.dwMask
|= CFM_COLOR
;
620 if (value
== tomAutoColor
)
621 fmt
.dwEffects
|= CFE_AUTOCOLOR
;
623 fmt
.crTextColor
= value
;
626 value
= tomUndefined
;
627 hr
= ITextFont_GetKerning(font
, &f
);
628 if (hr
== S_OK
&& f
!= tomUndefined
) {
629 fmt
.dwMask
|= CFM_KERNING
;
630 fmt
.wKerning
= points_to_twips(f
);
633 value
= tomUndefined
;
634 hr
= ITextFont_GetLanguageID(font
, &value
);
635 if (hr
== S_OK
&& value
!= tomUndefined
) {
636 fmt
.dwMask
|= CFM_LCID
;
640 if (ITextFont_GetName(font
, &str
) == S_OK
) {
641 fmt
.dwMask
|= CFM_FACE
;
642 lstrcpynW(fmt
.szFaceName
, str
, sizeof(fmt
.szFaceName
)/sizeof(WCHAR
));
646 hr
= ITextFont_GetPosition(font
, &f
);
647 if (hr
== S_OK
&& f
!= tomUndefined
) {
648 fmt
.dwMask
|= CFM_OFFSET
;
649 fmt
.yOffset
= points_to_twips(f
);
652 hr
= ITextFont_GetSize(font
, &f
);
653 if (hr
== S_OK
&& f
!= tomUndefined
) {
654 fmt
.dwMask
|= CFM_SIZE
;
655 fmt
.yHeight
= points_to_twips(f
);
658 hr
= ITextFont_GetSpacing(font
, &f
);
659 if (hr
== S_OK
&& f
!= tomUndefined
) {
660 fmt
.dwMask
|= CFM_SPACING
;
664 hr
= ITextFont_GetWeight(font
, &value
);
665 if (hr
== S_OK
&& value
!= tomUndefined
) {
666 fmt
.dwMask
|= CFM_WEIGHT
;
671 const IRichEditOleImpl
*reole
= get_range_reole(range
);
675 ITextRange_GetStart(range
, &start
);
676 ITextRange_GetEnd(range
, &end
);
678 ME_CursorFromCharOfs(reole
->editor
, start
, &from
);
679 ME_CursorFromCharOfs(reole
->editor
, end
, &to
);
680 ME_SetCharFormat(reole
->editor
, &from
, &to
, &fmt
);
684 static HRESULT
get_textfont_prop(const ITextFontImpl
*font
, enum textfont_prop_id propid
, textfont_prop_val
*value
)
686 const IRichEditOleImpl
*reole
;
691 /* when font is not attached to any range use cached values */
692 if (!font
->range
|| font
->get_cache_enabled
) {
693 *value
= font
->props
[propid
];
697 if (!(reole
= get_range_reole(font
->range
)))
698 return CO_E_RELEASED
;
700 init_textfont_prop_value(propid
, value
);
702 ITextRange_GetStart(font
->range
, &start
);
703 ITextRange_GetEnd(font
->range
, &end
);
705 /* iterate trough a range to see if property value is consistent */
706 hr
= get_textfont_prop_for_pos(reole
, start
, propid
, &v
);
710 for (i
= start
+ 1; i
< end
; i
++) {
711 textfont_prop_val cur
;
713 hr
= get_textfont_prop_for_pos(reole
, i
, propid
, &cur
);
717 if (!is_equal_textfont_prop_value(propid
, &v
, &cur
))
725 static HRESULT
get_textfont_propf(const ITextFontImpl
*font
, enum textfont_prop_id propid
, FLOAT
*value
)
733 hr
= get_textfont_prop(font
, propid
, &v
);
738 static HRESULT
get_textfont_propl(const ITextFontImpl
*font
, enum textfont_prop_id propid
, LONG
*value
)
746 hr
= get_textfont_prop(font
, propid
, &v
);
751 /* Value should already have a terminal value, for boolean properties it means tomToggle is not handled */
752 static HRESULT
set_textfont_prop(ITextFontImpl
*font
, enum textfont_prop_id propid
, const textfont_prop_val
*value
)
754 const IRichEditOleImpl
*reole
;
759 /* when font is not attached to any range use cache */
760 if (!font
->range
|| font
->set_cache_enabled
) {
761 if (propid
== FONT_NAME
) {
762 SysFreeString(font
->props
[propid
].str
);
763 font
->props
[propid
].str
= SysAllocString(value
->str
);
766 font
->props
[propid
] = *value
;
770 if (!(reole
= get_range_reole(font
->range
)))
771 return CO_E_RELEASED
;
773 memset(&fmt
, 0, sizeof(fmt
));
774 fmt
.cbSize
= sizeof(fmt
);
775 fmt
.dwMask
= textfont_prop_masks
[propid
][0];
789 case FONT_STRIKETHROUGH
:
791 case FONT_SUPERSCRIPT
:
793 fmt
.dwEffects
= value
->l
== tomTrue
? textfont_prop_masks
[propid
][1] : 0;
796 fmt
.bAnimation
= value
->l
;
800 if (value
->l
== tomAutoColor
)
801 fmt
.dwEffects
= textfont_prop_masks
[propid
][1];
802 else if (propid
== FONT_BACKCOLOR
)
803 fmt
.crBackColor
= value
->l
;
805 fmt
.crTextColor
= value
->l
;
808 fmt
.wKerning
= value
->f
;
814 fmt
.yOffset
= value
->f
;
817 fmt
.yHeight
= value
->f
;
820 fmt
.sSpacing
= value
->f
;
823 fmt
.wWeight
= value
->l
;
826 lstrcpynW(fmt
.szFaceName
, value
->str
, sizeof(fmt
.szFaceName
)/sizeof(WCHAR
));
829 FIXME("unhandled font property %d\n", propid
);
833 ITextRange_GetStart(font
->range
, &start
);
834 ITextRange_GetEnd(font
->range
, &end
);
836 ME_CursorFromCharOfs(reole
->editor
, start
, &from
);
837 ME_CursorFromCharOfs(reole
->editor
, end
, &to
);
838 ME_SetCharFormat(reole
->editor
, &from
, &to
, &fmt
);
843 static inline HRESULT
set_textfont_propl(ITextFontImpl
*font
, enum textfont_prop_id propid
, LONG value
)
847 return set_textfont_prop(font
, propid
, &v
);
850 static inline HRESULT
set_textfont_propf(ITextFontImpl
*font
, enum textfont_prop_id propid
, FLOAT value
)
854 return set_textfont_prop(font
, propid
, &v
);
857 static HRESULT
set_textfont_propd(ITextFontImpl
*font
, enum textfont_prop_id propid
, LONG value
)
867 get_textfont_propl(font
, propid
, &oldvalue
);
868 if (oldvalue
== tomFalse
)
870 else if (oldvalue
== tomTrue
)
879 return set_textfont_prop(font
, propid
, &v
);
885 static HRESULT
textfont_getname_from_range(ITextRange
*range
, BSTR
*ret
)
887 const IRichEditOleImpl
*reole
;
892 if (!(reole
= get_range_reole(range
)))
893 return CO_E_RELEASED
;
895 ITextRange_GetStart(range
, &start
);
896 hr
= get_textfont_prop_for_pos(reole
, start
, FONT_NAME
, &v
);
901 static void textfont_cache_range_props(ITextFontImpl
*font
)
903 enum textfont_prop_id propid
;
904 for (propid
= FONT_PROPID_FIRST
; propid
< FONT_PROPID_LAST
; propid
++) {
905 if (propid
== FONT_NAME
)
906 textfont_getname_from_range(font
->range
, &font
->props
[propid
].str
);
908 get_textfont_prop(font
, propid
, &font
->props
[propid
]);
912 static HRESULT
textrange_expand(ITextRange
*range
, LONG unit
, LONG
*delta
)
914 LONG expand_start
, expand_end
;
920 ITextRange_GetStoryLength(range
, &expand_end
);
923 FIXME("unit %d is not supported\n", unit
);
930 ITextRange_GetStart(range
, &start
);
931 ITextRange_GetEnd(range
, &end
);
932 *delta
= expand_end
- expand_start
- (end
- start
);
935 ITextRange_SetStart(range
, expand_start
);
936 ITextRange_SetEnd(range
, expand_end
);
941 static HRESULT WINAPI
IRichEditOleImpl_inner_fnQueryInterface(IUnknown
*iface
, REFIID riid
, LPVOID
*ppvObj
)
943 IRichEditOleImpl
*This
= impl_from_IUnknown(iface
);
945 TRACE("%p %s\n", This
, debugstr_guid(riid
));
948 if (IsEqualGUID(riid
, &IID_IUnknown
))
949 *ppvObj
= &This
->IUnknown_inner
;
950 else if (IsEqualGUID(riid
, &IID_IRichEditOle
))
951 *ppvObj
= &This
->IRichEditOle_iface
;
952 else if (IsEqualGUID(riid
, &IID_ITextDocument
))
953 *ppvObj
= &This
->ITextDocument_iface
;
956 IUnknown_AddRef((IUnknown
*)*ppvObj
);
959 FIXME("%p: unhandled interface %s\n", This
, debugstr_guid(riid
));
961 return E_NOINTERFACE
;
964 static ULONG WINAPI
IRichEditOleImpl_inner_fnAddRef(IUnknown
*iface
)
966 IRichEditOleImpl
*This
= impl_from_IUnknown(iface
);
967 ULONG ref
= InterlockedIncrement(&This
->ref
);
969 TRACE("%p ref = %u\n", This
, ref
);
974 static ULONG WINAPI
IRichEditOleImpl_inner_fnRelease(IUnknown
*iface
)
976 IRichEditOleImpl
*This
= impl_from_IUnknown(iface
);
977 ULONG ref
= InterlockedDecrement(&This
->ref
);
979 TRACE ("%p ref=%u\n", This
, ref
);
983 IOleClientSiteImpl
*clientsite
;
984 ITextRangeImpl
*txtRge
;
986 This
->editor
->reOle
= NULL
;
988 This
->txtSel
->reOle
= NULL
;
989 ITextSelection_Release(&This
->txtSel
->ITextSelection_iface
);
992 LIST_FOR_EACH_ENTRY(txtRge
, &This
->rangelist
, ITextRangeImpl
, child
.entry
)
993 txtRge
->child
.reole
= NULL
;
995 LIST_FOR_EACH_ENTRY(clientsite
, &This
->clientsites
, IOleClientSiteImpl
, child
.entry
)
996 clientsite
->child
.reole
= NULL
;
1003 static const IUnknownVtbl reo_unk_vtbl
=
1005 IRichEditOleImpl_inner_fnQueryInterface
,
1006 IRichEditOleImpl_inner_fnAddRef
,
1007 IRichEditOleImpl_inner_fnRelease
1010 static HRESULT WINAPI
1011 IRichEditOle_fnQueryInterface(IRichEditOle
*me
, REFIID riid
, LPVOID
*ppvObj
)
1013 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1014 return IUnknown_QueryInterface(This
->outer_unk
, riid
, ppvObj
);
1018 IRichEditOle_fnAddRef(IRichEditOle
*me
)
1020 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1021 return IUnknown_AddRef(This
->outer_unk
);
1025 IRichEditOle_fnRelease(IRichEditOle
*me
)
1027 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1028 return IUnknown_Release(This
->outer_unk
);
1031 static HRESULT WINAPI
1032 IRichEditOle_fnActivateAs(IRichEditOle
*me
, REFCLSID rclsid
, REFCLSID rclsidAs
)
1034 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1035 FIXME("stub %p\n",This
);
1039 static HRESULT WINAPI
1040 IRichEditOle_fnContextSensitiveHelp(IRichEditOle
*me
, BOOL fEnterMode
)
1042 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1043 FIXME("stub %p\n",This
);
1047 static HRESULT WINAPI
1048 IRichEditOle_fnConvertObject(IRichEditOle
*me
, LONG iob
,
1049 REFCLSID rclsidNew
, LPCSTR lpstrUserTypeNew
)
1051 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1052 FIXME("stub %p\n",This
);
1056 static inline IOleClientSiteImpl
*impl_from_IOleClientSite(IOleClientSite
*iface
)
1058 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleClientSite_iface
);
1061 static HRESULT WINAPI
1062 IOleClientSite_fnQueryInterface(IOleClientSite
*me
, REFIID riid
, LPVOID
*ppvObj
)
1064 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(me
);
1065 TRACE("%p %s\n", me
, debugstr_guid(riid
) );
1068 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
1069 IsEqualGUID(riid
, &IID_IOleClientSite
))
1071 else if (IsEqualGUID(riid
, &IID_IOleWindow
))
1072 *ppvObj
= &This
->IOleWindow_iface
;
1073 else if (IsEqualGUID(riid
, &IID_IOleInPlaceSite
))
1074 *ppvObj
= &This
->IOleInPlaceSite_iface
;
1077 IOleClientSite_AddRef(me
);
1080 FIXME("%p: unhandled interface %s\n", me
, debugstr_guid(riid
) );
1082 return E_NOINTERFACE
;
1085 static ULONG WINAPI
IOleClientSite_fnAddRef(IOleClientSite
*iface
)
1087 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1088 ULONG ref
= InterlockedIncrement(&This
->ref
);
1089 TRACE("(%p)->(%u)\n", This
, ref
);
1093 static ULONG WINAPI
IOleClientSite_fnRelease(IOleClientSite
*iface
)
1095 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1096 ULONG ref
= InterlockedDecrement(&This
->ref
);
1098 TRACE("(%p)->(%u)\n", This
, ref
);
1101 if (This
->child
.reole
) {
1102 list_remove(&This
->child
.entry
);
1103 This
->child
.reole
= NULL
;
1110 static HRESULT WINAPI
IOleClientSite_fnSaveObject(IOleClientSite
*iface
)
1112 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1113 if (!This
->child
.reole
)
1114 return CO_E_RELEASED
;
1116 FIXME("stub %p\n", iface
);
1120 static HRESULT WINAPI
IOleClientSite_fnGetMoniker(IOleClientSite
*iface
, DWORD dwAssign
,
1121 DWORD dwWhichMoniker
, IMoniker
**ppmk
)
1123 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1124 if (!This
->child
.reole
)
1125 return CO_E_RELEASED
;
1127 FIXME("stub %p\n", iface
);
1131 static HRESULT WINAPI
IOleClientSite_fnGetContainer(IOleClientSite
*iface
,
1132 IOleContainer
**ppContainer
)
1134 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1135 if (!This
->child
.reole
)
1136 return CO_E_RELEASED
;
1138 FIXME("stub %p\n", iface
);
1142 static HRESULT WINAPI
IOleClientSite_fnShowObject(IOleClientSite
*iface
)
1144 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1145 if (!This
->child
.reole
)
1146 return CO_E_RELEASED
;
1148 FIXME("stub %p\n", iface
);
1152 static HRESULT WINAPI
IOleClientSite_fnOnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
1154 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1155 if (!This
->child
.reole
)
1156 return CO_E_RELEASED
;
1158 FIXME("stub %p\n", iface
);
1162 static HRESULT WINAPI
IOleClientSite_fnRequestNewObjectLayout(IOleClientSite
*iface
)
1164 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1165 if (!This
->child
.reole
)
1166 return CO_E_RELEASED
;
1168 FIXME("stub %p\n", iface
);
1172 static const IOleClientSiteVtbl ocst
= {
1173 IOleClientSite_fnQueryInterface
,
1174 IOleClientSite_fnAddRef
,
1175 IOleClientSite_fnRelease
,
1176 IOleClientSite_fnSaveObject
,
1177 IOleClientSite_fnGetMoniker
,
1178 IOleClientSite_fnGetContainer
,
1179 IOleClientSite_fnShowObject
,
1180 IOleClientSite_fnOnShowWindow
,
1181 IOleClientSite_fnRequestNewObjectLayout
1184 /* IOleWindow interface */
1185 static HRESULT WINAPI
IOleWindow_fnQueryInterface(IOleWindow
*iface
, REFIID riid
, void **ppvObj
)
1187 IOleClientSiteImpl
*This
= impl_from_IOleWindow(iface
);
1188 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppvObj
);
1191 static ULONG WINAPI
IOleWindow_fnAddRef(IOleWindow
*iface
)
1193 IOleClientSiteImpl
*This
= impl_from_IOleWindow(iface
);
1194 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
1197 static ULONG WINAPI
IOleWindow_fnRelease(IOleWindow
*iface
)
1199 IOleClientSiteImpl
*This
= impl_from_IOleWindow(iface
);
1200 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
1203 static HRESULT WINAPI
IOleWindow_fnContextSensitiveHelp(IOleWindow
*iface
, BOOL fEnterMode
)
1205 IOleClientSiteImpl
*This
= impl_from_IOleWindow(iface
);
1206 FIXME("not implemented: (%p)->(%d)\n", This
, fEnterMode
);
1210 static HRESULT WINAPI
IOleWindow_fnGetWindow(IOleWindow
*iface
, HWND
*phwnd
)
1212 IOleClientSiteImpl
*This
= impl_from_IOleWindow(iface
);
1214 TRACE("(%p)->(%p)\n", This
, phwnd
);
1216 if (!This
->child
.reole
)
1217 return CO_E_RELEASED
;
1220 return E_INVALIDARG
;
1222 *phwnd
= This
->child
.reole
->editor
->hWnd
;
1226 static const IOleWindowVtbl olewinvt
= {
1227 IOleWindow_fnQueryInterface
,
1228 IOleWindow_fnAddRef
,
1229 IOleWindow_fnRelease
,
1230 IOleWindow_fnGetWindow
,
1231 IOleWindow_fnContextSensitiveHelp
1234 /* IOleInPlaceSite interface */
1235 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnQueryInterface(IOleInPlaceSite
*iface
, REFIID riid
, void **ppvObj
)
1237 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1238 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppvObj
);
1241 static ULONG STDMETHODCALLTYPE
IOleInPlaceSite_fnAddRef(IOleInPlaceSite
*iface
)
1243 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1244 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
1247 static ULONG STDMETHODCALLTYPE
IOleInPlaceSite_fnRelease(IOleInPlaceSite
*iface
)
1249 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1250 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
1253 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnGetWindow(IOleInPlaceSite
*iface
, HWND
*phwnd
)
1255 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1256 return IOleWindow_GetWindow(&This
->IOleWindow_iface
, phwnd
);
1259 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnContextSensitiveHelp(IOleInPlaceSite
*iface
, BOOL fEnterMode
)
1261 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1262 return IOleWindow_ContextSensitiveHelp(&This
->IOleWindow_iface
, fEnterMode
);
1265 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnCanInPlaceActivate(IOleInPlaceSite
*iface
)
1267 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1268 FIXME("not implemented: (%p)\n", This
);
1272 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnInPlaceActivate(IOleInPlaceSite
*iface
)
1274 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1275 FIXME("not implemented: (%p)\n", This
);
1279 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnUIActivate(IOleInPlaceSite
*iface
)
1281 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1282 FIXME("not implemented: (%p)\n", This
);
1286 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnGetWindowContext(IOleInPlaceSite
*iface
, IOleInPlaceFrame
**ppFrame
,
1287 IOleInPlaceUIWindow
**ppDoc
, LPRECT lprcPosRect
,
1288 LPRECT lprcClipRect
, LPOLEINPLACEFRAMEINFO lpFrameInfo
)
1290 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1291 FIXME("not implemented: (%p)->(%p %p %p %p %p)\n", This
, ppFrame
, ppDoc
, lprcPosRect
, lprcClipRect
, lpFrameInfo
);
1295 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnScroll(IOleInPlaceSite
*iface
, SIZE scrollExtent
)
1297 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1298 FIXME("not implemented: (%p)\n", This
);
1302 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnUIDeactivate(IOleInPlaceSite
*iface
, BOOL fUndoable
)
1304 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1305 FIXME("not implemented: (%p)->(%d)\n", This
, fUndoable
);
1309 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnInPlaceDeactivate(IOleInPlaceSite
*iface
)
1311 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1312 FIXME("not implemented: (%p)\n", This
);
1316 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnDiscardUndoState(IOleInPlaceSite
*iface
)
1318 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1319 FIXME("not implemented: (%p)\n", This
);
1323 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnDeactivateAndUndo(IOleInPlaceSite
*iface
)
1325 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1326 FIXME("not implemented: (%p)\n", This
);
1330 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnPosRectChange(IOleInPlaceSite
*iface
, LPCRECT lprcPosRect
)
1332 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1333 FIXME("not implemented: (%p)->(%p)\n", This
, lprcPosRect
);
1337 static const IOleInPlaceSiteVtbl olestvt
=
1339 IOleInPlaceSite_fnQueryInterface
,
1340 IOleInPlaceSite_fnAddRef
,
1341 IOleInPlaceSite_fnRelease
,
1342 IOleInPlaceSite_fnGetWindow
,
1343 IOleInPlaceSite_fnContextSensitiveHelp
,
1344 IOleInPlaceSite_fnCanInPlaceActivate
,
1345 IOleInPlaceSite_fnOnInPlaceActivate
,
1346 IOleInPlaceSite_fnOnUIActivate
,
1347 IOleInPlaceSite_fnGetWindowContext
,
1348 IOleInPlaceSite_fnScroll
,
1349 IOleInPlaceSite_fnOnUIDeactivate
,
1350 IOleInPlaceSite_fnOnInPlaceDeactivate
,
1351 IOleInPlaceSite_fnDiscardUndoState
,
1352 IOleInPlaceSite_fnDeactivateAndUndo
,
1353 IOleInPlaceSite_fnOnPosRectChange
1356 static HRESULT
CreateOleClientSite(IRichEditOleImpl
*reOle
, IOleClientSite
**ret
)
1358 IOleClientSiteImpl
*clientSite
= heap_alloc(sizeof *clientSite
);
1361 return E_OUTOFMEMORY
;
1363 clientSite
->IOleClientSite_iface
.lpVtbl
= &ocst
;
1364 clientSite
->IOleWindow_iface
.lpVtbl
= &olewinvt
;
1365 clientSite
->IOleInPlaceSite_iface
.lpVtbl
= &olestvt
;
1366 clientSite
->ref
= 1;
1367 clientSite
->child
.reole
= reOle
;
1368 list_add_head(&reOle
->clientsites
, &clientSite
->child
.entry
);
1370 *ret
= &clientSite
->IOleClientSite_iface
;
1374 static HRESULT WINAPI
1375 IRichEditOle_fnGetClientSite(IRichEditOle
*me
, IOleClientSite
**clientsite
)
1377 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1379 TRACE("(%p)->(%p)\n", This
, clientsite
);
1382 return E_INVALIDARG
;
1384 return CreateOleClientSite(This
, clientsite
);
1387 static HRESULT WINAPI
1388 IRichEditOle_fnGetClipboardData(IRichEditOle
*me
, CHARRANGE
*lpchrg
,
1389 DWORD reco
, LPDATAOBJECT
*lplpdataobj
)
1391 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1395 TRACE("(%p,%p,%d)\n",This
, lpchrg
, reco
);
1397 return E_INVALIDARG
;
1399 int nFrom
, nTo
, nStartCur
= ME_GetSelectionOfs(This
->editor
, &nFrom
, &nTo
);
1400 start
= This
->editor
->pCursors
[nStartCur
];
1401 nChars
= nTo
- nFrom
;
1403 ME_CursorFromCharOfs(This
->editor
, lpchrg
->cpMin
, &start
);
1404 nChars
= lpchrg
->cpMax
- lpchrg
->cpMin
;
1406 return ME_GetDataObject(This
->editor
, &start
, nChars
, lplpdataobj
);
1409 static LONG WINAPI
IRichEditOle_fnGetLinkCount(IRichEditOle
*me
)
1411 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1412 FIXME("stub %p\n",This
);
1416 static HRESULT WINAPI
1417 IRichEditOle_fnGetObject(IRichEditOle
*me
, LONG iob
,
1418 REOBJECT
*lpreobject
, DWORD dwFlags
)
1420 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1421 FIXME("stub %p\n",This
);
1426 IRichEditOle_fnGetObjectCount(IRichEditOle
*me
)
1428 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1429 FIXME("stub %p\n",This
);
1433 static HRESULT WINAPI
1434 IRichEditOle_fnHandsOffStorage(IRichEditOle
*me
, LONG iob
)
1436 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1437 FIXME("stub %p\n",This
);
1441 static HRESULT WINAPI
1442 IRichEditOle_fnImportDataObject(IRichEditOle
*me
, LPDATAOBJECT lpdataobj
,
1443 CLIPFORMAT cf
, HGLOBAL hMetaPict
)
1445 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1446 FIXME("stub %p\n",This
);
1450 static HRESULT WINAPI
1451 IRichEditOle_fnInPlaceDeactivate(IRichEditOle
*me
)
1453 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1454 FIXME("stub %p\n",This
);
1458 static HRESULT WINAPI
1459 IRichEditOle_fnInsertObject(IRichEditOle
*me
, REOBJECT
*reo
)
1461 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1463 TRACE("(%p,%p)\n", This
, reo
);
1466 return E_INVALIDARG
;
1468 if (reo
->cbStruct
< sizeof(*reo
)) return STG_E_INVALIDPARAMETER
;
1470 ME_InsertOLEFromCursor(This
->editor
, reo
, 0);
1471 ME_CommitUndo(This
->editor
);
1472 ME_UpdateRepaint(This
->editor
, FALSE
);
1476 static HRESULT WINAPI
IRichEditOle_fnSaveCompleted(IRichEditOle
*me
, LONG iob
,
1479 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1480 FIXME("stub %p\n",This
);
1484 static HRESULT WINAPI
1485 IRichEditOle_fnSetDvaspect(IRichEditOle
*me
, LONG iob
, DWORD dvaspect
)
1487 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1488 FIXME("stub %p\n",This
);
1492 static HRESULT WINAPI
IRichEditOle_fnSetHostNames(IRichEditOle
*me
,
1493 LPCSTR lpstrContainerApp
, LPCSTR lpstrContainerObj
)
1495 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1496 FIXME("stub %p %s %s\n",This
, lpstrContainerApp
, lpstrContainerObj
);
1500 static HRESULT WINAPI
1501 IRichEditOle_fnSetLinkAvailable(IRichEditOle
*me
, LONG iob
, BOOL fAvailable
)
1503 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1504 FIXME("stub %p\n",This
);
1508 static const IRichEditOleVtbl revt
= {
1509 IRichEditOle_fnQueryInterface
,
1510 IRichEditOle_fnAddRef
,
1511 IRichEditOle_fnRelease
,
1512 IRichEditOle_fnGetClientSite
,
1513 IRichEditOle_fnGetObjectCount
,
1514 IRichEditOle_fnGetLinkCount
,
1515 IRichEditOle_fnGetObject
,
1516 IRichEditOle_fnInsertObject
,
1517 IRichEditOle_fnConvertObject
,
1518 IRichEditOle_fnActivateAs
,
1519 IRichEditOle_fnSetHostNames
,
1520 IRichEditOle_fnSetLinkAvailable
,
1521 IRichEditOle_fnSetDvaspect
,
1522 IRichEditOle_fnHandsOffStorage
,
1523 IRichEditOle_fnSaveCompleted
,
1524 IRichEditOle_fnInPlaceDeactivate
,
1525 IRichEditOle_fnContextSensitiveHelp
,
1526 IRichEditOle_fnGetClipboardData
,
1527 IRichEditOle_fnImportDataObject
1530 /* ITextRange interface */
1531 static HRESULT WINAPI
ITextRange_fnQueryInterface(ITextRange
*me
, REFIID riid
, void **ppvObj
)
1533 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1536 if (IsEqualGUID(riid
, &IID_IUnknown
)
1537 || IsEqualGUID(riid
, &IID_IDispatch
)
1538 || IsEqualGUID(riid
, &IID_ITextRange
))
1541 ITextRange_AddRef(me
);
1544 else if (IsEqualGUID(riid
, &IID_Igetrichole
))
1546 *ppvObj
= This
->child
.reole
;
1550 return E_NOINTERFACE
;
1553 static ULONG WINAPI
ITextRange_fnAddRef(ITextRange
*me
)
1555 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1556 return InterlockedIncrement(&This
->ref
);
1559 static ULONG WINAPI
ITextRange_fnRelease(ITextRange
*me
)
1561 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1562 ULONG ref
= InterlockedDecrement(&This
->ref
);
1564 TRACE ("%p ref=%u\n", This
, ref
);
1567 if (This
->child
.reole
)
1569 list_remove(&This
->child
.entry
);
1570 This
->child
.reole
= NULL
;
1577 static HRESULT WINAPI
ITextRange_fnGetTypeInfoCount(ITextRange
*me
, UINT
*pctinfo
)
1579 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1580 TRACE("(%p)->(%p)\n", This
, pctinfo
);
1585 static HRESULT WINAPI
ITextRange_fnGetTypeInfo(ITextRange
*me
, UINT iTInfo
, LCID lcid
,
1586 ITypeInfo
**ppTInfo
)
1588 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1591 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
1593 hr
= get_typeinfo(ITextRange_tid
, ppTInfo
);
1595 ITypeInfo_AddRef(*ppTInfo
);
1599 static HRESULT WINAPI
ITextRange_fnGetIDsOfNames(ITextRange
*me
, REFIID riid
, LPOLESTR
*rgszNames
,
1600 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1602 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1606 TRACE("(%p)->(%p,%p,%u,%d,%p)\n", This
, riid
, rgszNames
, cNames
, lcid
,
1609 hr
= get_typeinfo(ITextRange_tid
, &ti
);
1611 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
1615 static HRESULT WINAPI
ITextRange_fnInvoke(ITextRange
*me
, DISPID dispIdMember
, REFIID riid
,
1616 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1617 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
1620 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1624 TRACE("(%p)->(%d,%p,%d,%u,%p,%p,%p,%p)\n", This
, dispIdMember
, riid
, lcid
,
1625 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1627 hr
= get_typeinfo(ITextRange_tid
, &ti
);
1629 hr
= ITypeInfo_Invoke(ti
, me
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1633 static HRESULT WINAPI
ITextRange_fnGetText(ITextRange
*me
, BSTR
*str
)
1635 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1636 ME_TextEditor
*editor
;
1637 ME_Cursor start
, end
;
1641 TRACE("(%p)->(%p)\n", This
, str
);
1643 if (!This
->child
.reole
)
1644 return CO_E_RELEASED
;
1647 return E_INVALIDARG
;
1649 /* return early for degenerate range */
1650 if (This
->start
== This
->end
) {
1655 editor
= This
->child
.reole
->editor
;
1656 ME_CursorFromCharOfs(editor
, This
->start
, &start
);
1657 ME_CursorFromCharOfs(editor
, This
->end
, &end
);
1659 length
= This
->end
- This
->start
;
1660 *str
= SysAllocStringLen(NULL
, length
);
1662 return E_OUTOFMEMORY
;
1664 bEOP
= (end
.pRun
->next
->type
== diTextEnd
&& This
->end
> ME_GetTextLength(editor
));
1665 ME_GetTextW(editor
, *str
, length
, &start
, length
, FALSE
, bEOP
);
1669 static HRESULT WINAPI
ITextRange_fnSetText(ITextRange
*me
, BSTR str
)
1671 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1672 ME_TextEditor
*editor
;
1677 TRACE("(%p)->(%s)\n", This
, debugstr_w(str
));
1679 if (!This
->child
.reole
)
1680 return CO_E_RELEASED
;
1682 editor
= This
->child
.reole
->editor
;
1684 /* delete only where's something to delete */
1685 if (This
->start
!= This
->end
) {
1686 ME_CursorFromCharOfs(editor
, This
->start
, &cursor
);
1687 ME_InternalDeleteText(editor
, &cursor
, This
->end
- This
->start
, FALSE
);
1690 if (!str
|| !*str
) {
1691 /* will update this range as well */
1692 textranges_update_ranges(This
->child
.reole
, This
->start
, This
->end
, RANGE_UPDATE_DELETE
);
1696 /* it's safer not to rely on stored BSTR length */
1698 cursor
= editor
->pCursors
[0];
1699 ME_CursorFromCharOfs(editor
, This
->start
, &editor
->pCursors
[0]);
1700 style
= ME_GetInsertStyle(editor
, 0);
1701 ME_InsertTextFromCursor(editor
, 0, str
, len
, style
);
1702 ME_ReleaseStyle(style
);
1703 editor
->pCursors
[0] = cursor
;
1705 if (len
< This
->end
- This
->start
)
1706 textranges_update_ranges(This
->child
.reole
, This
->start
+ len
, This
->end
, RANGE_UPDATE_DELETE
);
1708 This
->end
= len
- This
->start
;
1713 static HRESULT
range_GetChar(ME_TextEditor
*editor
, ME_Cursor
*cursor
, LONG
*pch
)
1717 ME_GetTextW(editor
, wch
, 1, cursor
, 1, FALSE
, cursor
->pRun
->next
->type
== diTextEnd
);
1723 static HRESULT WINAPI
ITextRange_fnGetChar(ITextRange
*me
, LONG
*pch
)
1725 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1726 ME_TextEditor
*editor
;
1729 TRACE("(%p)->(%p)\n", This
, pch
);
1731 if (!This
->child
.reole
)
1732 return CO_E_RELEASED
;
1735 return E_INVALIDARG
;
1737 editor
= This
->child
.reole
->editor
;
1738 ME_CursorFromCharOfs(editor
, This
->start
, &cursor
);
1739 return range_GetChar(editor
, &cursor
, pch
);
1742 static HRESULT WINAPI
ITextRange_fnSetChar(ITextRange
*me
, LONG ch
)
1744 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1746 FIXME("(%p)->(%x): stub\n", This
, ch
);
1748 if (!This
->child
.reole
)
1749 return CO_E_RELEASED
;
1754 static HRESULT
CreateITextRange(IRichEditOleImpl
*reOle
, LONG start
, LONG end
, ITextRange
** ppRange
);
1756 static HRESULT WINAPI
ITextRange_fnGetDuplicate(ITextRange
*me
, ITextRange
**ppRange
)
1758 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1760 TRACE("(%p)->(%p)\n", This
, ppRange
);
1762 if (!This
->child
.reole
)
1763 return CO_E_RELEASED
;
1766 return E_INVALIDARG
;
1768 return CreateITextRange(This
->child
.reole
, This
->start
, This
->end
, ppRange
);
1771 static HRESULT WINAPI
ITextRange_fnGetFormattedText(ITextRange
*me
, ITextRange
**range
)
1773 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1775 FIXME("(%p)->(%p): stub\n", This
, range
);
1777 if (!This
->child
.reole
)
1778 return CO_E_RELEASED
;
1783 static HRESULT WINAPI
ITextRange_fnSetFormattedText(ITextRange
*me
, ITextRange
*range
)
1785 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1787 FIXME("(%p)->(%p): stub\n", This
, range
);
1789 if (!This
->child
.reole
)
1790 return CO_E_RELEASED
;
1795 static HRESULT WINAPI
ITextRange_fnGetStart(ITextRange
*me
, LONG
*start
)
1797 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1799 TRACE("(%p)->(%p)\n", This
, start
);
1801 if (!This
->child
.reole
)
1802 return CO_E_RELEASED
;
1805 return E_INVALIDARG
;
1807 *start
= This
->start
;
1811 static HRESULT
textrange_setstart(const IRichEditOleImpl
*reole
, LONG value
, LONG
*start
, LONG
*end
)
1818 if (value
== *start
)
1821 if (value
<= *end
) {
1826 len
= ME_GetTextLength(reole
->editor
);
1827 *start
= *end
= value
> len
? len
: value
;
1831 static HRESULT WINAPI
ITextRange_fnSetStart(ITextRange
*me
, LONG value
)
1833 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1835 TRACE("(%p)->(%d)\n", This
, value
);
1837 if (!This
->child
.reole
)
1838 return CO_E_RELEASED
;
1840 return textrange_setstart(This
->child
.reole
, value
, &This
->start
, &This
->end
);
1843 static HRESULT WINAPI
ITextRange_fnGetEnd(ITextRange
*me
, LONG
*end
)
1845 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1847 TRACE("(%p)->(%p)\n", This
, end
);
1849 if (!This
->child
.reole
)
1850 return CO_E_RELEASED
;
1853 return E_INVALIDARG
;
1859 static HRESULT
textrange_setend(const IRichEditOleImpl
*reole
, LONG value
, LONG
*start
, LONG
*end
)
1866 if (value
< *start
) {
1867 *start
= *end
= max(0, value
);
1871 len
= ME_GetTextLength(reole
->editor
);
1872 *end
= value
> len
? len
+ 1 : value
;
1876 static HRESULT WINAPI
ITextRange_fnSetEnd(ITextRange
*me
, LONG value
)
1878 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1880 TRACE("(%p)->(%d)\n", This
, value
);
1882 if (!This
->child
.reole
)
1883 return CO_E_RELEASED
;
1885 return textrange_setend(This
->child
.reole
, value
, &This
->start
, &This
->end
);
1888 static HRESULT WINAPI
ITextRange_fnGetFont(ITextRange
*me
, ITextFont
**font
)
1890 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1892 TRACE("(%p)->(%p)\n", This
, font
);
1894 if (!This
->child
.reole
)
1895 return CO_E_RELEASED
;
1898 return E_INVALIDARG
;
1900 return create_textfont(me
, NULL
, font
);
1903 static HRESULT WINAPI
ITextRange_fnSetFont(ITextRange
*me
, ITextFont
*font
)
1905 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1907 TRACE("(%p)->(%p)\n", This
, font
);
1910 return E_INVALIDARG
;
1912 if (!This
->child
.reole
)
1913 return CO_E_RELEASED
;
1915 textrange_set_font(me
, font
);
1919 static HRESULT WINAPI
ITextRange_fnGetPara(ITextRange
*me
, ITextPara
**para
)
1921 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1923 TRACE("(%p)->(%p)\n", This
, para
);
1925 if (!This
->child
.reole
)
1926 return CO_E_RELEASED
;
1929 return E_INVALIDARG
;
1931 return create_textpara(me
, para
);
1934 static HRESULT WINAPI
ITextRange_fnSetPara(ITextRange
*me
, ITextPara
*para
)
1936 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1938 FIXME("(%p)->(%p): stub\n", This
, para
);
1940 if (!This
->child
.reole
)
1941 return CO_E_RELEASED
;
1946 static HRESULT WINAPI
ITextRange_fnGetStoryLength(ITextRange
*me
, LONG
*length
)
1948 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1950 TRACE("(%p)->(%p)\n", This
, length
);
1952 if (!This
->child
.reole
)
1953 return CO_E_RELEASED
;
1955 return textrange_get_storylength(This
->child
.reole
->editor
, length
);
1958 static HRESULT WINAPI
ITextRange_fnGetStoryType(ITextRange
*me
, LONG
*value
)
1960 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1962 TRACE("(%p)->(%p)\n", This
, value
);
1964 if (!This
->child
.reole
)
1965 return CO_E_RELEASED
;
1968 return E_INVALIDARG
;
1970 *value
= tomUnknownStory
;
1974 static HRESULT
range_Collapse(LONG bStart
, LONG
*start
, LONG
*end
)
1979 if (bStart
== tomEnd
|| bStart
== tomFalse
)
1986 static HRESULT WINAPI
ITextRange_fnCollapse(ITextRange
*me
, LONG bStart
)
1988 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1990 TRACE("(%p)->(%d)\n", This
, bStart
);
1992 if (!This
->child
.reole
)
1993 return CO_E_RELEASED
;
1995 return range_Collapse(bStart
, &This
->start
, &This
->end
);
1998 static HRESULT WINAPI
ITextRange_fnExpand(ITextRange
*me
, LONG unit
, LONG
*delta
)
2000 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2002 TRACE("(%p)->(%d %p)\n", This
, unit
, delta
);
2004 if (!This
->child
.reole
)
2005 return CO_E_RELEASED
;
2007 return textrange_expand(me
, unit
, delta
);
2010 static HRESULT WINAPI
ITextRange_fnGetIndex(ITextRange
*me
, LONG unit
, LONG
*index
)
2012 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2014 FIXME("(%p)->(%d %p): stub\n", This
, unit
, index
);
2016 if (!This
->child
.reole
)
2017 return CO_E_RELEASED
;
2022 static HRESULT WINAPI
ITextRange_fnSetIndex(ITextRange
*me
, LONG unit
, LONG index
,
2025 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2027 FIXME("(%p)->(%d %d %d): stub\n", This
, unit
, index
, extend
);
2029 if (!This
->child
.reole
)
2030 return CO_E_RELEASED
;
2035 static HRESULT WINAPI
ITextRange_fnSetRange(ITextRange
*me
, LONG anchor
, LONG active
)
2037 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2039 FIXME("(%p)->(%d %d): stub\n", This
, anchor
, active
);
2041 if (!This
->child
.reole
)
2042 return CO_E_RELEASED
;
2047 static HRESULT
textrange_inrange(LONG start
, LONG end
, ITextRange
*range
, LONG
*ret
)
2054 if (FAILED(ITextRange_GetStart(range
, &from
)) || FAILED(ITextRange_GetEnd(range
, &to
))) {
2058 *ret
= (start
>= from
&& end
<= to
) ? tomTrue
: tomFalse
;
2059 return *ret
== tomTrue
? S_OK
: S_FALSE
;
2062 static HRESULT WINAPI
ITextRange_fnInRange(ITextRange
*me
, ITextRange
*range
, LONG
*ret
)
2064 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2066 TRACE("(%p)->(%p %p)\n", This
, range
, ret
);
2071 if (!This
->child
.reole
)
2072 return CO_E_RELEASED
;
2077 return textrange_inrange(This
->start
, This
->end
, range
, ret
);
2080 static HRESULT WINAPI
ITextRange_fnInStory(ITextRange
*me
, ITextRange
*pRange
, LONG
*ret
)
2082 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2084 FIXME("(%p)->(%p): stub\n", This
, ret
);
2086 if (!This
->child
.reole
)
2087 return CO_E_RELEASED
;
2092 static HRESULT
textrange_isequal(LONG start
, LONG end
, ITextRange
*range
, LONG
*ret
)
2099 if (FAILED(ITextRange_GetStart(range
, &from
)) || FAILED(ITextRange_GetEnd(range
, &to
))) {
2103 *ret
= (start
== from
&& end
== to
) ? tomTrue
: tomFalse
;
2104 return *ret
== tomTrue
? S_OK
: S_FALSE
;
2107 static HRESULT WINAPI
ITextRange_fnIsEqual(ITextRange
*me
, ITextRange
*range
, LONG
*ret
)
2109 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2111 TRACE("(%p)->(%p %p)\n", This
, range
, ret
);
2116 if (!This
->child
.reole
)
2117 return CO_E_RELEASED
;
2122 return textrange_isequal(This
->start
, This
->end
, range
, ret
);
2125 static HRESULT WINAPI
ITextRange_fnSelect(ITextRange
*me
)
2127 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2129 TRACE("(%p)\n", This
);
2131 if (!This
->child
.reole
)
2132 return CO_E_RELEASED
;
2134 ME_SetSelection(This
->child
.reole
->editor
, This
->start
, This
->end
);
2138 static HRESULT WINAPI
ITextRange_fnStartOf(ITextRange
*me
, LONG unit
, LONG extend
,
2141 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2143 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, extend
, delta
);
2145 if (!This
->child
.reole
)
2146 return CO_E_RELEASED
;
2151 static HRESULT WINAPI
ITextRange_fnEndOf(ITextRange
*me
, LONG unit
, LONG extend
,
2154 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2156 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, extend
, delta
);
2158 if (!This
->child
.reole
)
2159 return CO_E_RELEASED
;
2164 static HRESULT WINAPI
ITextRange_fnMove(ITextRange
*me
, LONG unit
, LONG count
, LONG
*delta
)
2166 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2168 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, count
, delta
);
2170 if (!This
->child
.reole
)
2171 return CO_E_RELEASED
;
2176 static HRESULT WINAPI
ITextRange_fnMoveStart(ITextRange
*me
, LONG unit
, LONG count
,
2179 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2181 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, count
, delta
);
2183 if (!This
->child
.reole
)
2184 return CO_E_RELEASED
;
2189 static HRESULT WINAPI
ITextRange_fnMoveEnd(ITextRange
*me
, LONG unit
, LONG count
,
2192 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2194 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, count
, delta
);
2196 if (!This
->child
.reole
)
2197 return CO_E_RELEASED
;
2202 static HRESULT WINAPI
ITextRange_fnMoveWhile(ITextRange
*me
, VARIANT
*charset
, LONG count
,
2205 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2207 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
2209 if (!This
->child
.reole
)
2210 return CO_E_RELEASED
;
2215 static HRESULT WINAPI
ITextRange_fnMoveStartWhile(ITextRange
*me
, VARIANT
*charset
, LONG count
,
2218 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2220 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
2222 if (!This
->child
.reole
)
2223 return CO_E_RELEASED
;
2228 static HRESULT WINAPI
ITextRange_fnMoveEndWhile(ITextRange
*me
, VARIANT
*charset
, LONG count
,
2231 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2233 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
2235 if (!This
->child
.reole
)
2236 return CO_E_RELEASED
;
2241 static HRESULT WINAPI
ITextRange_fnMoveUntil(ITextRange
*me
, VARIANT
*charset
, LONG count
,
2244 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2246 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
2248 if (!This
->child
.reole
)
2249 return CO_E_RELEASED
;
2254 static HRESULT WINAPI
ITextRange_fnMoveStartUntil(ITextRange
*me
, VARIANT
*charset
, LONG count
,
2257 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2259 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
2261 if (!This
->child
.reole
)
2262 return CO_E_RELEASED
;
2267 static HRESULT WINAPI
ITextRange_fnMoveEndUntil(ITextRange
*me
, VARIANT
*charset
, LONG count
,
2270 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2272 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
2274 if (!This
->child
.reole
)
2275 return CO_E_RELEASED
;
2280 static HRESULT WINAPI
ITextRange_fnFindText(ITextRange
*me
, BSTR text
, LONG count
, LONG flags
,
2283 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2285 FIXME("(%p)->(%s %d %x %p): stub\n", This
, debugstr_w(text
), count
, flags
, length
);
2287 if (!This
->child
.reole
)
2288 return CO_E_RELEASED
;
2293 static HRESULT WINAPI
ITextRange_fnFindTextStart(ITextRange
*me
, BSTR text
, LONG count
,
2294 LONG flags
, LONG
*length
)
2296 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2298 FIXME("(%p)->(%s %d %x %p): stub\n", This
, debugstr_w(text
), count
, flags
, length
);
2300 if (!This
->child
.reole
)
2301 return CO_E_RELEASED
;
2306 static HRESULT WINAPI
ITextRange_fnFindTextEnd(ITextRange
*me
, BSTR text
, LONG count
,
2307 LONG flags
, LONG
*length
)
2309 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2311 FIXME("(%p)->(%s %d %x %p): stub\n", This
, debugstr_w(text
), count
, flags
, length
);
2313 if (!This
->child
.reole
)
2314 return CO_E_RELEASED
;
2319 static HRESULT WINAPI
ITextRange_fnDelete(ITextRange
*me
, LONG unit
, LONG count
, LONG
*delta
)
2321 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2323 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, count
, delta
);
2325 if (!This
->child
.reole
)
2326 return CO_E_RELEASED
;
2331 static HRESULT WINAPI
ITextRange_fnCut(ITextRange
*me
, VARIANT
*v
)
2333 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2335 FIXME("(%p)->(%p): stub\n", This
, v
);
2337 if (!This
->child
.reole
)
2338 return CO_E_RELEASED
;
2343 static HRESULT WINAPI
ITextRange_fnCopy(ITextRange
*me
, VARIANT
*v
)
2345 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2347 FIXME("(%p)->(%p): stub\n", This
, v
);
2349 if (!This
->child
.reole
)
2350 return CO_E_RELEASED
;
2355 static HRESULT WINAPI
ITextRange_fnPaste(ITextRange
*me
, VARIANT
*v
, LONG format
)
2357 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2359 FIXME("(%p)->(%s %x): stub\n", This
, debugstr_variant(v
), format
);
2361 if (!This
->child
.reole
)
2362 return CO_E_RELEASED
;
2367 static HRESULT WINAPI
ITextRange_fnCanPaste(ITextRange
*me
, VARIANT
*v
, LONG format
, LONG
*ret
)
2369 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2371 FIXME("(%p)->(%s %x %p): stub\n", This
, debugstr_variant(v
), format
, ret
);
2373 if (!This
->child
.reole
)
2374 return CO_E_RELEASED
;
2379 static HRESULT WINAPI
ITextRange_fnCanEdit(ITextRange
*me
, LONG
*ret
)
2381 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2383 FIXME("(%p)->(%p): stub\n", This
, ret
);
2385 if (!This
->child
.reole
)
2386 return CO_E_RELEASED
;
2391 static HRESULT WINAPI
ITextRange_fnChangeCase(ITextRange
*me
, LONG type
)
2393 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2395 FIXME("(%p)->(%d): stub\n", This
, type
);
2397 if (!This
->child
.reole
)
2398 return CO_E_RELEASED
;
2403 static HRESULT WINAPI
ITextRange_fnGetPoint(ITextRange
*me
, LONG type
, LONG
*cx
, LONG
*cy
)
2405 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2407 FIXME("(%p)->(%d %p %p): stub\n", This
, type
, cx
, cy
);
2409 if (!This
->child
.reole
)
2410 return CO_E_RELEASED
;
2415 static HRESULT WINAPI
ITextRange_fnSetPoint(ITextRange
*me
, LONG x
, LONG y
, LONG type
,
2418 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2420 FIXME("(%p)->(%d %d %d %d): stub\n", This
, x
, y
, type
, extend
);
2422 if (!This
->child
.reole
)
2423 return CO_E_RELEASED
;
2428 static HRESULT WINAPI
ITextRange_fnScrollIntoView(ITextRange
*me
, LONG value
)
2430 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2432 FIXME("(%p)->(%d): stub\n", This
, value
);
2434 if (!This
->child
.reole
)
2435 return CO_E_RELEASED
;
2440 static HRESULT WINAPI
ITextRange_fnGetEmbeddedObject(ITextRange
*me
, IUnknown
**ppv
)
2442 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2444 FIXME("(%p)->(%p): stub\n", This
, ppv
);
2446 if (!This
->child
.reole
)
2447 return CO_E_RELEASED
;
2452 static const ITextRangeVtbl trvt
= {
2453 ITextRange_fnQueryInterface
,
2454 ITextRange_fnAddRef
,
2455 ITextRange_fnRelease
,
2456 ITextRange_fnGetTypeInfoCount
,
2457 ITextRange_fnGetTypeInfo
,
2458 ITextRange_fnGetIDsOfNames
,
2459 ITextRange_fnInvoke
,
2460 ITextRange_fnGetText
,
2461 ITextRange_fnSetText
,
2462 ITextRange_fnGetChar
,
2463 ITextRange_fnSetChar
,
2464 ITextRange_fnGetDuplicate
,
2465 ITextRange_fnGetFormattedText
,
2466 ITextRange_fnSetFormattedText
,
2467 ITextRange_fnGetStart
,
2468 ITextRange_fnSetStart
,
2469 ITextRange_fnGetEnd
,
2470 ITextRange_fnSetEnd
,
2471 ITextRange_fnGetFont
,
2472 ITextRange_fnSetFont
,
2473 ITextRange_fnGetPara
,
2474 ITextRange_fnSetPara
,
2475 ITextRange_fnGetStoryLength
,
2476 ITextRange_fnGetStoryType
,
2477 ITextRange_fnCollapse
,
2478 ITextRange_fnExpand
,
2479 ITextRange_fnGetIndex
,
2480 ITextRange_fnSetIndex
,
2481 ITextRange_fnSetRange
,
2482 ITextRange_fnInRange
,
2483 ITextRange_fnInStory
,
2484 ITextRange_fnIsEqual
,
2485 ITextRange_fnSelect
,
2486 ITextRange_fnStartOf
,
2489 ITextRange_fnMoveStart
,
2490 ITextRange_fnMoveEnd
,
2491 ITextRange_fnMoveWhile
,
2492 ITextRange_fnMoveStartWhile
,
2493 ITextRange_fnMoveEndWhile
,
2494 ITextRange_fnMoveUntil
,
2495 ITextRange_fnMoveStartUntil
,
2496 ITextRange_fnMoveEndUntil
,
2497 ITextRange_fnFindText
,
2498 ITextRange_fnFindTextStart
,
2499 ITextRange_fnFindTextEnd
,
2500 ITextRange_fnDelete
,
2504 ITextRange_fnCanPaste
,
2505 ITextRange_fnCanEdit
,
2506 ITextRange_fnChangeCase
,
2507 ITextRange_fnGetPoint
,
2508 ITextRange_fnSetPoint
,
2509 ITextRange_fnScrollIntoView
,
2510 ITextRange_fnGetEmbeddedObject
2514 static HRESULT WINAPI
TextFont_QueryInterface(ITextFont
*iface
, REFIID riid
, void **ppv
)
2516 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2518 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
2520 if (IsEqualIID(riid
, &IID_ITextFont
) ||
2521 IsEqualIID(riid
, &IID_IDispatch
) ||
2522 IsEqualIID(riid
, &IID_IUnknown
))
2525 ITextFont_AddRef(iface
);
2530 return E_NOINTERFACE
;
2533 static ULONG WINAPI
TextFont_AddRef(ITextFont
*iface
)
2535 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2536 ULONG ref
= InterlockedIncrement(&This
->ref
);
2537 TRACE("(%p)->(%u)\n", This
, ref
);
2541 static ULONG WINAPI
TextFont_Release(ITextFont
*iface
)
2543 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2544 ULONG ref
= InterlockedDecrement(&This
->ref
);
2546 TRACE("(%p)->(%u)\n", This
, ref
);
2551 ITextRange_Release(This
->range
);
2552 SysFreeString(This
->props
[FONT_NAME
].str
);
2559 static HRESULT WINAPI
TextFont_GetTypeInfoCount(ITextFont
*iface
, UINT
*pctinfo
)
2561 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2562 TRACE("(%p)->(%p)\n", This
, pctinfo
);
2567 static HRESULT WINAPI
TextFont_GetTypeInfo(ITextFont
*iface
, UINT iTInfo
, LCID lcid
,
2568 ITypeInfo
**ppTInfo
)
2570 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2573 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
2575 hr
= get_typeinfo(ITextFont_tid
, ppTInfo
);
2577 ITypeInfo_AddRef(*ppTInfo
);
2581 static HRESULT WINAPI
TextFont_GetIDsOfNames(ITextFont
*iface
, REFIID riid
,
2582 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
2584 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2588 TRACE("(%p)->(%p,%p,%u,%d,%p)\n", This
, riid
, rgszNames
, cNames
, lcid
,
2591 hr
= get_typeinfo(ITextFont_tid
, &ti
);
2593 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
2597 static HRESULT WINAPI
TextFont_Invoke(
2599 DISPID dispIdMember
,
2603 DISPPARAMS
*pDispParams
,
2604 VARIANT
*pVarResult
,
2605 EXCEPINFO
*pExcepInfo
,
2608 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2612 TRACE("(%p)->(%d,%p,%d,%u,%p,%p,%p,%p)\n", This
, dispIdMember
, riid
, lcid
,
2613 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2615 hr
= get_typeinfo(ITextFont_tid
, &ti
);
2617 hr
= ITypeInfo_Invoke(ti
, iface
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2621 static HRESULT WINAPI
TextFont_GetDuplicate(ITextFont
*iface
, ITextFont
**ret
)
2623 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2625 TRACE("(%p)->(%p)\n", This
, ret
);
2628 return E_INVALIDARG
;
2631 if (This
->range
&& !get_range_reole(This
->range
))
2632 return CO_E_RELEASED
;
2634 return create_textfont(NULL
, This
, ret
);
2637 static HRESULT WINAPI
TextFont_SetDuplicate(ITextFont
*iface
, ITextFont
*pFont
)
2639 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2640 FIXME("(%p)->(%p): stub\n", This
, pFont
);
2644 static HRESULT WINAPI
TextFont_CanChange(ITextFont
*iface
, LONG
*ret
)
2646 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2647 FIXME("(%p)->(%p): stub\n", This
, ret
);
2651 static HRESULT WINAPI
TextFont_IsEqual(ITextFont
*iface
, ITextFont
*font
, LONG
*ret
)
2653 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2654 FIXME("(%p)->(%p %p): stub\n", This
, font
, ret
);
2658 static void textfont_reset_to_default(ITextFontImpl
*font
)
2660 enum textfont_prop_id id
;
2662 for (id
= FONT_PROPID_FIRST
; id
< FONT_PROPID_LAST
; id
++) {
2666 case FONT_ANIMATION
:
2673 case FONT_PROTECTED
:
2675 case FONT_SMALLCAPS
:
2676 case FONT_STRIKETHROUGH
:
2677 case FONT_SUBSCRIPT
:
2678 case FONT_SUPERSCRIPT
:
2679 case FONT_UNDERLINE
:
2680 font
->props
[id
].l
= tomFalse
;
2682 case FONT_BACKCOLOR
:
2683 case FONT_FORECOLOR
:
2684 font
->props
[id
].l
= tomAutoColor
;
2690 font
->props
[id
].f
= 0.0;
2693 font
->props
[id
].l
= GetSystemDefaultLCID();
2696 static const WCHAR sysW
[] = {'S','y','s','t','e','m',0};
2697 SysFreeString(font
->props
[id
].str
);
2698 font
->props
[id
].str
= SysAllocString(sysW
);
2702 font
->props
[id
].l
= FW_NORMAL
;
2705 FIXME("font property %d not handled\n", id
);
2710 static void textfont_reset_to_undefined(ITextFontImpl
*font
)
2712 enum textfont_prop_id id
;
2714 for (id
= FONT_PROPID_FIRST
; id
< FONT_PROPID_LAST
; id
++) {
2718 case FONT_ANIMATION
:
2725 case FONT_PROTECTED
:
2727 case FONT_SMALLCAPS
:
2728 case FONT_STRIKETHROUGH
:
2729 case FONT_SUBSCRIPT
:
2730 case FONT_SUPERSCRIPT
:
2731 case FONT_UNDERLINE
:
2732 case FONT_BACKCOLOR
:
2733 case FONT_FORECOLOR
:
2736 font
->props
[id
].l
= tomUndefined
;
2742 font
->props
[id
].f
= tomUndefined
;
2747 FIXME("font property %d not handled\n", id
);
2752 static void textfont_apply_range_props(ITextFontImpl
*font
)
2754 enum textfont_prop_id propid
;
2755 for (propid
= FONT_PROPID_FIRST
; propid
< FONT_PROPID_LAST
; propid
++)
2756 set_textfont_prop(font
, propid
, &font
->props
[propid
]);
2759 static HRESULT WINAPI
TextFont_Reset(ITextFont
*iface
, LONG value
)
2761 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2763 TRACE("(%p)->(%d)\n", This
, value
);
2765 /* If font is attached to a range, released or not, we can't
2766 reset to undefined */
2768 if (!get_range_reole(This
->range
))
2769 return CO_E_RELEASED
;
2774 return E_INVALIDARG
;
2776 textfont_cache_range_props(This
);
2777 This
->get_cache_enabled
= TRUE
;
2780 This
->get_cache_enabled
= FALSE
;
2783 This
->set_cache_enabled
= TRUE
;
2786 This
->set_cache_enabled
= FALSE
;
2787 textfont_apply_range_props(This
);
2791 return E_INVALIDARG
;
2793 FIXME("reset mode %d not supported\n", value
);
2801 /* reset to global defaults */
2803 textfont_reset_to_default(This
);
2805 /* all properties are set to tomUndefined, font name is retained */
2807 textfont_reset_to_undefined(This
);
2816 return E_INVALIDARG
;
2820 FIXME("reset mode %d not supported\n", value
);
2824 static HRESULT WINAPI
TextFont_GetStyle(ITextFont
*iface
, LONG
*value
)
2826 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2827 FIXME("(%p)->(%p): stub\n", This
, value
);
2831 static HRESULT WINAPI
TextFont_SetStyle(ITextFont
*iface
, LONG value
)
2833 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2834 FIXME("(%p)->(%d): stub\n", This
, value
);
2838 static HRESULT WINAPI
TextFont_GetAllCaps(ITextFont
*iface
, LONG
*value
)
2840 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2841 TRACE("(%p)->(%p)\n", This
, value
);
2842 return get_textfont_propl(This
, FONT_ALLCAPS
, value
);
2845 static HRESULT WINAPI
TextFont_SetAllCaps(ITextFont
*iface
, LONG value
)
2847 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2848 TRACE("(%p)->(%d)\n", This
, value
);
2849 return set_textfont_propd(This
, FONT_ALLCAPS
, value
);
2852 static HRESULT WINAPI
TextFont_GetAnimation(ITextFont
*iface
, LONG
*value
)
2854 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2855 TRACE("(%p)->(%p)\n", This
, value
);
2856 return get_textfont_propl(This
, FONT_ANIMATION
, value
);
2859 static HRESULT WINAPI
TextFont_SetAnimation(ITextFont
*iface
, LONG value
)
2861 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2863 TRACE("(%p)->(%d)\n", This
, value
);
2865 if (value
< tomNoAnimation
|| value
> tomAnimationMax
)
2866 return E_INVALIDARG
;
2868 return set_textfont_propl(This
, FONT_ANIMATION
, value
);
2871 static HRESULT WINAPI
TextFont_GetBackColor(ITextFont
*iface
, LONG
*value
)
2873 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2874 TRACE("(%p)->(%p)\n", This
, value
);
2875 return get_textfont_propl(This
, FONT_BACKCOLOR
, value
);
2878 static HRESULT WINAPI
TextFont_SetBackColor(ITextFont
*iface
, LONG value
)
2880 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2881 TRACE("(%p)->(%d)\n", This
, value
);
2882 return set_textfont_propl(This
, FONT_BACKCOLOR
, value
);
2885 static HRESULT WINAPI
TextFont_GetBold(ITextFont
*iface
, LONG
*value
)
2887 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2888 TRACE("(%p)->(%p)\n", This
, value
);
2889 return get_textfont_propl(This
, FONT_BOLD
, value
);
2892 static HRESULT WINAPI
TextFont_SetBold(ITextFont
*iface
, LONG value
)
2894 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2895 TRACE("(%p)->(%d)\n", This
, value
);
2896 return set_textfont_propd(This
, FONT_BOLD
, value
);
2899 static HRESULT WINAPI
TextFont_GetEmboss(ITextFont
*iface
, LONG
*value
)
2901 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2902 TRACE("(%p)->(%p)\n", This
, value
);
2903 return get_textfont_propl(This
, FONT_EMBOSS
, value
);
2906 static HRESULT WINAPI
TextFont_SetEmboss(ITextFont
*iface
, LONG value
)
2908 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2909 TRACE("(%p)->(%d)\n", This
, value
);
2910 return set_textfont_propd(This
, FONT_EMBOSS
, value
);
2913 static HRESULT WINAPI
TextFont_GetForeColor(ITextFont
*iface
, LONG
*value
)
2915 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2916 TRACE("(%p)->(%p)\n", This
, value
);
2917 return get_textfont_propl(This
, FONT_FORECOLOR
, value
);
2920 static HRESULT WINAPI
TextFont_SetForeColor(ITextFont
*iface
, LONG value
)
2922 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2923 TRACE("(%p)->(%d)\n", This
, value
);
2924 return set_textfont_propl(This
, FONT_FORECOLOR
, value
);
2927 static HRESULT WINAPI
TextFont_GetHidden(ITextFont
*iface
, LONG
*value
)
2929 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2930 TRACE("(%p)->(%p)\n", This
, value
);
2931 return get_textfont_propl(This
, FONT_HIDDEN
, value
);
2934 static HRESULT WINAPI
TextFont_SetHidden(ITextFont
*iface
, LONG value
)
2936 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2937 TRACE("(%p)->(%d)\n", This
, value
);
2938 return set_textfont_propd(This
, FONT_HIDDEN
, value
);
2941 static HRESULT WINAPI
TextFont_GetEngrave(ITextFont
*iface
, LONG
*value
)
2943 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2944 TRACE("(%p)->(%p)\n", This
, value
);
2945 return get_textfont_propl(This
, FONT_ENGRAVE
, value
);
2948 static HRESULT WINAPI
TextFont_SetEngrave(ITextFont
*iface
, LONG value
)
2950 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2951 TRACE("(%p)->(%d)\n", This
, value
);
2952 return set_textfont_propd(This
, FONT_ENGRAVE
, value
);
2955 static HRESULT WINAPI
TextFont_GetItalic(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_ITALIC
, value
);
2962 static HRESULT WINAPI
TextFont_SetItalic(ITextFont
*iface
, LONG value
)
2964 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2965 TRACE("(%p)->(%d)\n", This
, value
);
2966 return set_textfont_propd(This
, FONT_ITALIC
, value
);
2969 static HRESULT WINAPI
TextFont_GetKerning(ITextFont
*iface
, FLOAT
*value
)
2971 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2972 TRACE("(%p)->(%p)\n", This
, value
);
2973 return get_textfont_propf(This
, FONT_KERNING
, value
);
2976 static HRESULT WINAPI
TextFont_SetKerning(ITextFont
*iface
, FLOAT value
)
2978 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2979 TRACE("(%p)->(%.2f)\n", This
, value
);
2980 return set_textfont_propf(This
, FONT_KERNING
, value
);
2983 static HRESULT WINAPI
TextFont_GetLanguageID(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_LANGID
, value
);
2990 static HRESULT WINAPI
TextFont_SetLanguageID(ITextFont
*iface
, LONG value
)
2992 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2993 TRACE("(%p)->(%d)\n", This
, value
);
2994 return set_textfont_propl(This
, FONT_LANGID
, value
);
2997 static HRESULT WINAPI
TextFont_GetName(ITextFont
*iface
, BSTR
*value
)
2999 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3001 TRACE("(%p)->(%p)\n", This
, value
);
3004 return E_INVALIDARG
;
3009 if (This
->props
[FONT_NAME
].str
)
3010 *value
= SysAllocString(This
->props
[FONT_NAME
].str
);
3012 *value
= SysAllocStringLen(NULL
, 0);
3013 return *value
? S_OK
: E_OUTOFMEMORY
;
3016 return textfont_getname_from_range(This
->range
, value
);
3019 static HRESULT WINAPI
TextFont_SetName(ITextFont
*iface
, BSTR value
)
3021 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3022 textfont_prop_val v
;
3024 TRACE("(%p)->(%s)\n", This
, debugstr_w(value
));
3027 return set_textfont_prop(This
, FONT_NAME
, &v
);
3030 static HRESULT WINAPI
TextFont_GetOutline(ITextFont
*iface
, LONG
*value
)
3032 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3033 TRACE("(%p)->(%p)\n", This
, value
);
3034 return get_textfont_propl(This
, FONT_OUTLINE
, value
);
3037 static HRESULT WINAPI
TextFont_SetOutline(ITextFont
*iface
, LONG value
)
3039 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3040 TRACE("(%p)->(%d)\n", This
, value
);
3041 return set_textfont_propd(This
, FONT_OUTLINE
, value
);
3044 static HRESULT WINAPI
TextFont_GetPosition(ITextFont
*iface
, FLOAT
*value
)
3046 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3047 TRACE("(%p)->(%p)\n", This
, value
);
3048 return get_textfont_propf(This
, FONT_POSITION
, value
);
3051 static HRESULT WINAPI
TextFont_SetPosition(ITextFont
*iface
, FLOAT value
)
3053 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3054 TRACE("(%p)->(%.2f)\n", This
, value
);
3055 return set_textfont_propf(This
, FONT_POSITION
, value
);
3058 static HRESULT WINAPI
TextFont_GetProtected(ITextFont
*iface
, LONG
*value
)
3060 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3061 TRACE("(%p)->(%p)\n", This
, value
);
3062 return get_textfont_propl(This
, FONT_PROTECTED
, value
);
3065 static HRESULT WINAPI
TextFont_SetProtected(ITextFont
*iface
, LONG value
)
3067 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3068 TRACE("(%p)->(%d)\n", This
, value
);
3069 return set_textfont_propd(This
, FONT_PROTECTED
, value
);
3072 static HRESULT WINAPI
TextFont_GetShadow(ITextFont
*iface
, LONG
*value
)
3074 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3075 TRACE("(%p)->(%p)\n", This
, value
);
3076 return get_textfont_propl(This
, FONT_SHADOW
, value
);
3079 static HRESULT WINAPI
TextFont_SetShadow(ITextFont
*iface
, LONG value
)
3081 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3082 TRACE("(%p)->(%d)\n", This
, value
);
3083 return set_textfont_propd(This
, FONT_SHADOW
, value
);
3086 static HRESULT WINAPI
TextFont_GetSize(ITextFont
*iface
, FLOAT
*value
)
3088 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3089 TRACE("(%p)->(%p)\n", This
, value
);
3090 return get_textfont_propf(This
, FONT_SIZE
, value
);
3093 static HRESULT WINAPI
TextFont_SetSize(ITextFont
*iface
, FLOAT value
)
3095 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3096 TRACE("(%p)->(%.2f)\n", This
, value
);
3097 return set_textfont_propf(This
, FONT_SIZE
, value
);
3100 static HRESULT WINAPI
TextFont_GetSmallCaps(ITextFont
*iface
, LONG
*value
)
3102 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3103 TRACE("(%p)->(%p)\n", This
, value
);
3104 return get_textfont_propl(This
, FONT_SMALLCAPS
, value
);
3107 static HRESULT WINAPI
TextFont_SetSmallCaps(ITextFont
*iface
, LONG value
)
3109 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3110 TRACE("(%p)->(%d)\n", This
, value
);
3111 return set_textfont_propd(This
, FONT_SMALLCAPS
, value
);
3114 static HRESULT WINAPI
TextFont_GetSpacing(ITextFont
*iface
, FLOAT
*value
)
3116 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3117 TRACE("(%p)->(%p)\n", This
, value
);
3118 return get_textfont_propf(This
, FONT_SPACING
, value
);
3121 static HRESULT WINAPI
TextFont_SetSpacing(ITextFont
*iface
, FLOAT value
)
3123 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3124 TRACE("(%p)->(%.2f)\n", This
, value
);
3125 return set_textfont_propf(This
, FONT_SPACING
, value
);
3128 static HRESULT WINAPI
TextFont_GetStrikeThrough(ITextFont
*iface
, LONG
*value
)
3130 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3131 TRACE("(%p)->(%p)\n", This
, value
);
3132 return get_textfont_propl(This
, FONT_STRIKETHROUGH
, value
);
3135 static HRESULT WINAPI
TextFont_SetStrikeThrough(ITextFont
*iface
, LONG value
)
3137 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3138 TRACE("(%p)->(%d)\n", This
, value
);
3139 return set_textfont_propd(This
, FONT_STRIKETHROUGH
, value
);
3142 static HRESULT WINAPI
TextFont_GetSubscript(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_SUBSCRIPT
, value
);
3149 static HRESULT WINAPI
TextFont_SetSubscript(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_SUBSCRIPT
, value
);
3156 static HRESULT WINAPI
TextFont_GetSuperscript(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_SUPERSCRIPT
, value
);
3163 static HRESULT WINAPI
TextFont_SetSuperscript(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_SUPERSCRIPT
, value
);
3170 static HRESULT WINAPI
TextFont_GetUnderline(ITextFont
*iface
, LONG
*value
)
3172 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3173 TRACE("(%p)->(%p)\n", This
, value
);
3174 return get_textfont_propl(This
, FONT_UNDERLINE
, value
);
3177 static HRESULT WINAPI
TextFont_SetUnderline(ITextFont
*iface
, LONG value
)
3179 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3180 TRACE("(%p)->(%d)\n", This
, value
);
3181 return set_textfont_propd(This
, FONT_UNDERLINE
, value
);
3184 static HRESULT WINAPI
TextFont_GetWeight(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_WEIGHT
, value
);
3191 static HRESULT WINAPI
TextFont_SetWeight(ITextFont
*iface
, LONG value
)
3193 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3194 TRACE("(%p)->(%d)\n", This
, value
);
3195 return set_textfont_propl(This
, FONT_WEIGHT
, value
);
3198 static ITextFontVtbl textfontvtbl
= {
3199 TextFont_QueryInterface
,
3202 TextFont_GetTypeInfoCount
,
3203 TextFont_GetTypeInfo
,
3204 TextFont_GetIDsOfNames
,
3206 TextFont_GetDuplicate
,
3207 TextFont_SetDuplicate
,
3213 TextFont_GetAllCaps
,
3214 TextFont_SetAllCaps
,
3215 TextFont_GetAnimation
,
3216 TextFont_SetAnimation
,
3217 TextFont_GetBackColor
,
3218 TextFont_SetBackColor
,
3223 TextFont_GetForeColor
,
3224 TextFont_SetForeColor
,
3227 TextFont_GetEngrave
,
3228 TextFont_SetEngrave
,
3231 TextFont_GetKerning
,
3232 TextFont_SetKerning
,
3233 TextFont_GetLanguageID
,
3234 TextFont_SetLanguageID
,
3237 TextFont_GetOutline
,
3238 TextFont_SetOutline
,
3239 TextFont_GetPosition
,
3240 TextFont_SetPosition
,
3241 TextFont_GetProtected
,
3242 TextFont_SetProtected
,
3247 TextFont_GetSmallCaps
,
3248 TextFont_SetSmallCaps
,
3249 TextFont_GetSpacing
,
3250 TextFont_SetSpacing
,
3251 TextFont_GetStrikeThrough
,
3252 TextFont_SetStrikeThrough
,
3253 TextFont_GetSubscript
,
3254 TextFont_SetSubscript
,
3255 TextFont_GetSuperscript
,
3256 TextFont_SetSuperscript
,
3257 TextFont_GetUnderline
,
3258 TextFont_SetUnderline
,
3263 static HRESULT
create_textfont(ITextRange
*range
, const ITextFontImpl
*src
, ITextFont
**ret
)
3265 ITextFontImpl
*font
;
3268 font
= heap_alloc(sizeof(*font
));
3270 return E_OUTOFMEMORY
;
3272 font
->ITextFont_iface
.lpVtbl
= &textfontvtbl
;
3277 font
->get_cache_enabled
= TRUE
;
3278 font
->set_cache_enabled
= TRUE
;
3279 memcpy(&font
->props
, &src
->props
, sizeof(font
->props
));
3280 if (font
->props
[FONT_NAME
].str
)
3281 font
->props
[FONT_NAME
].str
= SysAllocString(font
->props
[FONT_NAME
].str
);
3284 font
->range
= range
;
3285 ITextRange_AddRef(range
);
3287 /* cache current properties */
3288 font
->get_cache_enabled
= FALSE
;
3289 font
->set_cache_enabled
= FALSE
;
3290 textfont_cache_range_props(font
);
3293 *ret
= &font
->ITextFont_iface
;
3298 static HRESULT WINAPI
TextPara_QueryInterface(ITextPara
*iface
, REFIID riid
, void **ppv
)
3300 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3302 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
3304 if (IsEqualIID(riid
, &IID_ITextPara
) ||
3305 IsEqualIID(riid
, &IID_IDispatch
) ||
3306 IsEqualIID(riid
, &IID_IUnknown
))
3309 ITextPara_AddRef(iface
);
3314 return E_NOINTERFACE
;
3317 static ULONG WINAPI
TextPara_AddRef(ITextPara
*iface
)
3319 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3320 ULONG ref
= InterlockedIncrement(&This
->ref
);
3321 TRACE("(%p)->(%u)\n", This
, ref
);
3325 static ULONG WINAPI
TextPara_Release(ITextPara
*iface
)
3327 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3328 ULONG ref
= InterlockedDecrement(&This
->ref
);
3330 TRACE("(%p)->(%u)\n", This
, ref
);
3334 ITextRange_Release(This
->range
);
3341 static HRESULT WINAPI
TextPara_GetTypeInfoCount(ITextPara
*iface
, UINT
*pctinfo
)
3343 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3344 TRACE("(%p)->(%p)\n", This
, pctinfo
);
3349 static HRESULT WINAPI
TextPara_GetTypeInfo(ITextPara
*iface
, UINT iTInfo
, LCID lcid
,
3350 ITypeInfo
**ppTInfo
)
3352 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3355 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
3357 hr
= get_typeinfo(ITextPara_tid
, ppTInfo
);
3359 ITypeInfo_AddRef(*ppTInfo
);
3363 static HRESULT WINAPI
TextPara_GetIDsOfNames(ITextPara
*iface
, REFIID riid
,
3364 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3366 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3370 TRACE("(%p)->(%p,%p,%u,%d,%p)\n", This
, riid
, rgszNames
, cNames
, lcid
,
3373 hr
= get_typeinfo(ITextPara_tid
, &ti
);
3375 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
3379 static HRESULT WINAPI
TextPara_Invoke(
3381 DISPID dispIdMember
,
3385 DISPPARAMS
*pDispParams
,
3386 VARIANT
*pVarResult
,
3387 EXCEPINFO
*pExcepInfo
,
3390 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3394 TRACE("(%p)->(%d,%p,%d,%u,%p,%p,%p,%p)\n", This
, dispIdMember
, riid
, lcid
,
3395 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3397 hr
= get_typeinfo(ITextPara_tid
, &ti
);
3399 hr
= ITypeInfo_Invoke(ti
, iface
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3403 static HRESULT WINAPI
TextPara_GetDuplicate(ITextPara
*iface
, ITextPara
**ret
)
3405 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3406 FIXME("(%p)->(%p)\n", This
, ret
);
3410 static HRESULT WINAPI
TextPara_SetDuplicate(ITextPara
*iface
, ITextPara
*para
)
3412 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3413 FIXME("(%p)->(%p)\n", This
, para
);
3417 static HRESULT WINAPI
TextPara_CanChange(ITextPara
*iface
, LONG
*ret
)
3419 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3420 FIXME("(%p)->(%p)\n", This
, ret
);
3424 static HRESULT WINAPI
TextPara_IsEqual(ITextPara
*iface
, ITextPara
*para
, LONG
*ret
)
3426 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3427 FIXME("(%p)->(%p %p)\n", This
, para
, ret
);
3431 static HRESULT WINAPI
TextPara_Reset(ITextPara
*iface
, LONG value
)
3433 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3434 FIXME("(%p)->(%d)\n", This
, value
);
3438 static HRESULT WINAPI
TextPara_GetStyle(ITextPara
*iface
, LONG
*value
)
3440 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3441 FIXME("(%p)->(%p)\n", This
, value
);
3445 static HRESULT WINAPI
TextPara_SetStyle(ITextPara
*iface
, LONG value
)
3447 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3448 FIXME("(%p)->(%d)\n", This
, value
);
3452 static HRESULT WINAPI
TextPara_GetAlignment(ITextPara
*iface
, LONG
*value
)
3454 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3455 FIXME("(%p)->(%p)\n", This
, value
);
3459 static HRESULT WINAPI
TextPara_SetAlignment(ITextPara
*iface
, LONG value
)
3461 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3462 FIXME("(%p)->(%d)\n", This
, value
);
3466 static HRESULT WINAPI
TextPara_GetHyphenation(ITextPara
*iface
, LONG
*value
)
3468 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3469 FIXME("(%p)->(%p)\n", This
, value
);
3473 static HRESULT WINAPI
TextPara_SetHyphenation(ITextPara
*iface
, LONG value
)
3475 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3476 FIXME("(%p)->(%d)\n", This
, value
);
3480 static HRESULT WINAPI
TextPara_GetFirstLineIndent(ITextPara
*iface
, FLOAT
*value
)
3482 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3483 FIXME("(%p)->(%p)\n", This
, value
);
3487 static HRESULT WINAPI
TextPara_GetKeepTogether(ITextPara
*iface
, LONG
*value
)
3489 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3490 FIXME("(%p)->(%p)\n", This
, value
);
3494 static HRESULT WINAPI
TextPara_SetKeepTogether(ITextPara
*iface
, LONG value
)
3496 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3497 FIXME("(%p)->(%d)\n", This
, value
);
3501 static HRESULT WINAPI
TextPara_GetKeepWithNext(ITextPara
*iface
, LONG
*value
)
3503 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3504 FIXME("(%p)->(%p)\n", This
, value
);
3508 static HRESULT WINAPI
TextPara_SetKeepWithNext(ITextPara
*iface
, LONG value
)
3510 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3511 FIXME("(%p)->(%d)\n", This
, value
);
3515 static HRESULT WINAPI
TextPara_GetLeftIndent(ITextPara
*iface
, FLOAT
*value
)
3517 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3518 FIXME("(%p)->(%p)\n", This
, value
);
3522 static HRESULT WINAPI
TextPara_GetLineSpacing(ITextPara
*iface
, FLOAT
*value
)
3524 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3525 FIXME("(%p)->(%p)\n", This
, value
);
3529 static HRESULT WINAPI
TextPara_GetLineSpacingRule(ITextPara
*iface
, LONG
*value
)
3531 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3532 FIXME("(%p)->(%p)\n", This
, value
);
3536 static HRESULT WINAPI
TextPara_GetListAlignment(ITextPara
*iface
, LONG
*value
)
3538 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3539 FIXME("(%p)->(%p)\n", This
, value
);
3543 static HRESULT WINAPI
TextPara_SetListAlignment(ITextPara
*iface
, LONG value
)
3545 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3546 FIXME("(%p)->(%d)\n", This
, value
);
3550 static HRESULT WINAPI
TextPara_GetListLevelIndex(ITextPara
*iface
, LONG
*value
)
3552 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3553 FIXME("(%p)->(%p)\n", This
, value
);
3557 static HRESULT WINAPI
TextPara_SetListLevelIndex(ITextPara
*iface
, LONG value
)
3559 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3560 FIXME("(%p)->(%d)\n", This
, value
);
3564 static HRESULT WINAPI
TextPara_GetListStart(ITextPara
*iface
, LONG
*value
)
3566 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3567 FIXME("(%p)->(%p)\n", This
, value
);
3571 static HRESULT WINAPI
TextPara_SetListStart(ITextPara
*iface
, LONG value
)
3573 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3574 FIXME("(%p)->(%d)\n", This
, value
);
3578 static HRESULT WINAPI
TextPara_GetListTab(ITextPara
*iface
, FLOAT
*value
)
3580 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3581 FIXME("(%p)->(%p)\n", This
, value
);
3585 static HRESULT WINAPI
TextPara_SetListTab(ITextPara
*iface
, FLOAT value
)
3587 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3588 FIXME("(%p)->(%.2f)\n", This
, value
);
3592 static HRESULT WINAPI
TextPara_GetListType(ITextPara
*iface
, LONG
*value
)
3594 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3595 FIXME("(%p)->(%p)\n", This
, value
);
3599 static HRESULT WINAPI
TextPara_SetListType(ITextPara
*iface
, LONG value
)
3601 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3602 FIXME("(%p)->(%d)\n", This
, value
);
3606 static HRESULT WINAPI
TextPara_GetNoLineNumber(ITextPara
*iface
, LONG
*value
)
3608 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3609 FIXME("(%p)->(%p)\n", This
, value
);
3613 static HRESULT WINAPI
TextPara_SetNoLineNumber(ITextPara
*iface
, LONG value
)
3615 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3616 FIXME("(%p)->(%d)\n", This
, value
);
3620 static HRESULT WINAPI
TextPara_GetPageBreakBefore(ITextPara
*iface
, LONG
*value
)
3622 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3623 FIXME("(%p)->(%p)\n", This
, value
);
3627 static HRESULT WINAPI
TextPara_SetPageBreakBefore(ITextPara
*iface
, LONG value
)
3629 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3630 FIXME("(%p)->(%d)\n", This
, value
);
3634 static HRESULT WINAPI
TextPara_GetRightIndent(ITextPara
*iface
, FLOAT
*value
)
3636 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3637 FIXME("(%p)->(%p)\n", This
, value
);
3641 static HRESULT WINAPI
TextPara_SetRightIndent(ITextPara
*iface
, FLOAT value
)
3643 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3644 FIXME("(%p)->(%.2f)\n", This
, value
);
3648 static HRESULT WINAPI
TextPara_SetIndents(ITextPara
*iface
, FLOAT StartIndent
, FLOAT LeftIndent
, FLOAT RightIndent
)
3650 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3651 FIXME("(%p)->(%.2f %.2f %.2f)\n", This
, StartIndent
, LeftIndent
, RightIndent
);
3655 static HRESULT WINAPI
TextPara_SetLineSpacing(ITextPara
*iface
, LONG LineSpacingRule
, FLOAT LineSpacing
)
3657 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3658 FIXME("(%p)->(%d %.2f)\n", This
, LineSpacingRule
, LineSpacing
);
3662 static HRESULT WINAPI
TextPara_GetSpaceAfter(ITextPara
*iface
, FLOAT
*value
)
3664 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3665 FIXME("(%p)->(%p)\n", This
, value
);
3669 static HRESULT WINAPI
TextPara_SetSpaceAfter(ITextPara
*iface
, FLOAT value
)
3671 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3672 FIXME("(%p)->(%.2f)\n", This
, value
);
3676 static HRESULT WINAPI
TextPara_GetSpaceBefore(ITextPara
*iface
, FLOAT
*value
)
3678 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3679 FIXME("(%p)->(%p)\n", This
, value
);
3683 static HRESULT WINAPI
TextPara_SetSpaceBefore(ITextPara
*iface
, FLOAT value
)
3685 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3686 FIXME("(%p)->(%.2f)\n", This
, value
);
3690 static HRESULT WINAPI
TextPara_GetWidowControl(ITextPara
*iface
, LONG
*value
)
3692 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3693 FIXME("(%p)->(%p)\n", This
, value
);
3697 static HRESULT WINAPI
TextPara_SetWidowControl(ITextPara
*iface
, LONG value
)
3699 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3700 FIXME("(%p)->(%d)\n", This
, value
);
3704 static HRESULT WINAPI
TextPara_GetTabCount(ITextPara
*iface
, LONG
*value
)
3706 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3707 FIXME("(%p)->(%p)\n", This
, value
);
3711 static HRESULT WINAPI
TextPara_AddTab(ITextPara
*iface
, FLOAT tbPos
, LONG tbAlign
, LONG tbLeader
)
3713 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3714 FIXME("(%p)->(%.2f %d %d)\n", This
, tbPos
, tbAlign
, tbLeader
);
3718 static HRESULT WINAPI
TextPara_ClearAllTabs(ITextPara
*iface
)
3720 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3721 FIXME("(%p)\n", This
);
3725 static HRESULT WINAPI
TextPara_DeleteTab(ITextPara
*iface
, FLOAT pos
)
3727 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3728 FIXME("(%p)->(%.2f)\n", This
, pos
);
3732 static HRESULT WINAPI
TextPara_GetTab(ITextPara
*iface
, LONG iTab
, FLOAT
*ptbPos
, LONG
*ptbAlign
, LONG
*ptbLeader
)
3734 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3735 FIXME("(%p)->(%d %p %p %p)\n", This
, iTab
, ptbPos
, ptbAlign
, ptbLeader
);
3739 static ITextParaVtbl textparavtbl
= {
3740 TextPara_QueryInterface
,
3743 TextPara_GetTypeInfoCount
,
3744 TextPara_GetTypeInfo
,
3745 TextPara_GetIDsOfNames
,
3747 TextPara_GetDuplicate
,
3748 TextPara_SetDuplicate
,
3754 TextPara_GetAlignment
,
3755 TextPara_SetAlignment
,
3756 TextPara_GetHyphenation
,
3757 TextPara_SetHyphenation
,
3758 TextPara_GetFirstLineIndent
,
3759 TextPara_GetKeepTogether
,
3760 TextPara_SetKeepTogether
,
3761 TextPara_GetKeepWithNext
,
3762 TextPara_SetKeepWithNext
,
3763 TextPara_GetLeftIndent
,
3764 TextPara_GetLineSpacing
,
3765 TextPara_GetLineSpacingRule
,
3766 TextPara_GetListAlignment
,
3767 TextPara_SetListAlignment
,
3768 TextPara_GetListLevelIndex
,
3769 TextPara_SetListLevelIndex
,
3770 TextPara_GetListStart
,
3771 TextPara_SetListStart
,
3772 TextPara_GetListTab
,
3773 TextPara_SetListTab
,
3774 TextPara_GetListType
,
3775 TextPara_SetListType
,
3776 TextPara_GetNoLineNumber
,
3777 TextPara_SetNoLineNumber
,
3778 TextPara_GetPageBreakBefore
,
3779 TextPara_SetPageBreakBefore
,
3780 TextPara_GetRightIndent
,
3781 TextPara_SetRightIndent
,
3782 TextPara_SetIndents
,
3783 TextPara_SetLineSpacing
,
3784 TextPara_GetSpaceAfter
,
3785 TextPara_SetSpaceAfter
,
3786 TextPara_GetSpaceBefore
,
3787 TextPara_SetSpaceBefore
,
3788 TextPara_GetWidowControl
,
3789 TextPara_SetWidowControl
,
3790 TextPara_GetTabCount
,
3792 TextPara_ClearAllTabs
,
3797 static HRESULT
create_textpara(ITextRange
*range
, ITextPara
**ret
)
3799 ITextParaImpl
*para
;
3802 para
= heap_alloc(sizeof(*para
));
3804 return E_OUTOFMEMORY
;
3806 para
->ITextPara_iface
.lpVtbl
= &textparavtbl
;
3808 para
->range
= range
;
3809 ITextRange_AddRef(range
);
3811 *ret
= ¶
->ITextPara_iface
;
3816 static HRESULT WINAPI
3817 ITextDocument_fnQueryInterface(ITextDocument
* me
, REFIID riid
,
3820 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3821 return IRichEditOle_QueryInterface(&This
->IRichEditOle_iface
, riid
, ppvObject
);
3825 ITextDocument_fnAddRef(ITextDocument
* me
)
3827 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3828 return IRichEditOle_AddRef(&This
->IRichEditOle_iface
);
3832 ITextDocument_fnRelease(ITextDocument
* me
)
3834 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3835 return IRichEditOle_Release(&This
->IRichEditOle_iface
);
3838 static HRESULT WINAPI
3839 ITextDocument_fnGetTypeInfoCount(ITextDocument
* me
,
3842 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3843 TRACE("(%p)->(%p)\n", This
, pctinfo
);
3848 static HRESULT WINAPI
3849 ITextDocument_fnGetTypeInfo(ITextDocument
* me
, UINT iTInfo
, LCID lcid
,
3850 ITypeInfo
** ppTInfo
)
3852 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3855 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
3857 hr
= get_typeinfo(ITextDocument_tid
, ppTInfo
);
3859 ITypeInfo_AddRef(*ppTInfo
);
3863 static HRESULT WINAPI
3864 ITextDocument_fnGetIDsOfNames(ITextDocument
* me
, REFIID riid
,
3865 LPOLESTR
* rgszNames
, UINT cNames
, LCID lcid
, DISPID
* rgDispId
)
3867 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3871 TRACE("(%p)->(%p,%p,%u,%d,%p)\n", This
, riid
, rgszNames
, cNames
, lcid
,
3874 hr
= get_typeinfo(ITextDocument_tid
, &ti
);
3876 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
3880 static HRESULT WINAPI
3881 ITextDocument_fnInvoke(ITextDocument
* me
, DISPID dispIdMember
,
3882 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
* pDispParams
,
3883 VARIANT
* pVarResult
, EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
)
3885 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3889 TRACE("(%p)->(%d,%p,%d,%u,%p,%p,%p,%p)\n", This
, dispIdMember
, riid
, lcid
,
3890 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3892 hr
= get_typeinfo(ITextDocument_tid
, &ti
);
3894 hr
= ITypeInfo_Invoke(ti
, me
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3898 static HRESULT WINAPI
3899 ITextDocument_fnGetName(ITextDocument
* me
, BSTR
* pName
)
3901 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3902 FIXME("stub %p\n",This
);
3906 static HRESULT WINAPI
3907 ITextDocument_fnGetSelection(ITextDocument
*me
, ITextSelection
**selection
)
3909 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3911 TRACE("(%p)->(%p)\n", me
, selection
);
3914 return E_INVALIDARG
;
3916 if (!This
->txtSel
) {
3917 This
->txtSel
= CreateTextSelection(This
);
3918 if (!This
->txtSel
) {
3920 return E_OUTOFMEMORY
;
3924 *selection
= &This
->txtSel
->ITextSelection_iface
;
3925 ITextSelection_AddRef(*selection
);
3929 static HRESULT WINAPI
3930 ITextDocument_fnGetStoryCount(ITextDocument
* me
, LONG
* pCount
)
3932 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3933 FIXME("stub %p\n",This
);
3937 static HRESULT WINAPI
3938 ITextDocument_fnGetStoryRanges(ITextDocument
* me
,
3939 ITextStoryRanges
** ppStories
)
3941 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3942 FIXME("stub %p\n",This
);
3946 static HRESULT WINAPI
3947 ITextDocument_fnGetSaved(ITextDocument
* me
, LONG
* pValue
)
3949 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3950 FIXME("stub %p\n",This
);
3954 static HRESULT WINAPI
3955 ITextDocument_fnSetSaved(ITextDocument
* me
, LONG Value
)
3957 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3958 FIXME("stub %p\n",This
);
3962 static HRESULT WINAPI
3963 ITextDocument_fnGetDefaultTabStop(ITextDocument
* me
, float* pValue
)
3965 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3966 FIXME("stub %p\n",This
);
3970 static HRESULT WINAPI
3971 ITextDocument_fnSetDefaultTabStop(ITextDocument
* me
, float Value
)
3973 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3974 FIXME("stub %p\n",This
);
3978 static HRESULT WINAPI
3979 ITextDocument_fnNew(ITextDocument
* me
)
3981 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3982 FIXME("stub %p\n",This
);
3986 static HRESULT WINAPI
3987 ITextDocument_fnOpen(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
3990 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3991 FIXME("stub %p\n",This
);
3995 static HRESULT WINAPI
3996 ITextDocument_fnSave(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
3999 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
4000 FIXME("stub %p\n",This
);
4004 static HRESULT WINAPI
4005 ITextDocument_fnFreeze(ITextDocument
* me
, LONG
* pCount
)
4007 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
4008 FIXME("stub %p\n",This
);
4012 static HRESULT WINAPI
4013 ITextDocument_fnUnfreeze(ITextDocument
* me
, LONG
* pCount
)
4015 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
4016 FIXME("stub %p\n",This
);
4020 static HRESULT WINAPI
4021 ITextDocument_fnBeginEditCollection(ITextDocument
* me
)
4023 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
4024 FIXME("stub %p\n",This
);
4028 static HRESULT WINAPI
4029 ITextDocument_fnEndEditCollection(ITextDocument
* me
)
4031 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
4032 FIXME("stub %p\n",This
);
4036 static HRESULT WINAPI
4037 ITextDocument_fnUndo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
4039 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
4040 FIXME("stub %p\n",This
);
4044 static HRESULT WINAPI
4045 ITextDocument_fnRedo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
4047 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
4048 FIXME("stub %p\n",This
);
4052 static HRESULT
CreateITextRange(IRichEditOleImpl
*reOle
, LONG start
, LONG end
, ITextRange
** ppRange
)
4054 ITextRangeImpl
*txtRge
= heap_alloc(sizeof(ITextRangeImpl
));
4057 return E_OUTOFMEMORY
;
4058 txtRge
->ITextRange_iface
.lpVtbl
= &trvt
;
4060 txtRge
->child
.reole
= reOle
;
4061 txtRge
->start
= start
;
4063 list_add_head(&reOle
->rangelist
, &txtRge
->child
.entry
);
4064 *ppRange
= &txtRge
->ITextRange_iface
;
4068 static HRESULT WINAPI
4069 ITextDocument_fnRange(ITextDocument
* me
, LONG cp1
, LONG cp2
,
4070 ITextRange
** ppRange
)
4072 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
4073 const int len
= ME_GetTextLength(This
->editor
) + 1;
4075 TRACE("%p %p %d %d\n", This
, ppRange
, cp1
, cp2
);
4077 return E_INVALIDARG
;
4081 cp1
= min(cp1
, len
);
4082 cp2
= min(cp2
, len
);
4091 cp1
= cp2
= len
- 1;
4093 return CreateITextRange(This
, cp1
, cp2
, ppRange
);
4096 static HRESULT WINAPI
4097 ITextDocument_fnRangeFromPoint(ITextDocument
* me
, LONG x
, LONG y
,
4098 ITextRange
** ppRange
)
4100 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
4101 FIXME("stub %p\n",This
);
4105 static const ITextDocumentVtbl tdvt
= {
4106 ITextDocument_fnQueryInterface
,
4107 ITextDocument_fnAddRef
,
4108 ITextDocument_fnRelease
,
4109 ITextDocument_fnGetTypeInfoCount
,
4110 ITextDocument_fnGetTypeInfo
,
4111 ITextDocument_fnGetIDsOfNames
,
4112 ITextDocument_fnInvoke
,
4113 ITextDocument_fnGetName
,
4114 ITextDocument_fnGetSelection
,
4115 ITextDocument_fnGetStoryCount
,
4116 ITextDocument_fnGetStoryRanges
,
4117 ITextDocument_fnGetSaved
,
4118 ITextDocument_fnSetSaved
,
4119 ITextDocument_fnGetDefaultTabStop
,
4120 ITextDocument_fnSetDefaultTabStop
,
4121 ITextDocument_fnNew
,
4122 ITextDocument_fnOpen
,
4123 ITextDocument_fnSave
,
4124 ITextDocument_fnFreeze
,
4125 ITextDocument_fnUnfreeze
,
4126 ITextDocument_fnBeginEditCollection
,
4127 ITextDocument_fnEndEditCollection
,
4128 ITextDocument_fnUndo
,
4129 ITextDocument_fnRedo
,
4130 ITextDocument_fnRange
,
4131 ITextDocument_fnRangeFromPoint
4134 /* ITextSelection */
4135 static HRESULT WINAPI
ITextSelection_fnQueryInterface(
4140 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4143 if (IsEqualGUID(riid
, &IID_IUnknown
)
4144 || IsEqualGUID(riid
, &IID_IDispatch
)
4145 || IsEqualGUID(riid
, &IID_ITextRange
)
4146 || IsEqualGUID(riid
, &IID_ITextSelection
))
4149 ITextSelection_AddRef(me
);
4152 else if (IsEqualGUID(riid
, &IID_Igetrichole
))
4154 *ppvObj
= This
->reOle
;
4158 return E_NOINTERFACE
;
4161 static ULONG WINAPI
ITextSelection_fnAddRef(ITextSelection
*me
)
4163 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4164 return InterlockedIncrement(&This
->ref
);
4167 static ULONG WINAPI
ITextSelection_fnRelease(ITextSelection
*me
)
4169 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4170 ULONG ref
= InterlockedDecrement(&This
->ref
);
4176 static HRESULT WINAPI
ITextSelection_fnGetTypeInfoCount(ITextSelection
*me
, UINT
*pctinfo
)
4178 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4179 TRACE("(%p)->(%p)\n", This
, pctinfo
);
4184 static HRESULT WINAPI
ITextSelection_fnGetTypeInfo(ITextSelection
*me
, UINT iTInfo
, LCID lcid
,
4185 ITypeInfo
**ppTInfo
)
4187 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4190 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
4192 hr
= get_typeinfo(ITextSelection_tid
, ppTInfo
);
4194 ITypeInfo_AddRef(*ppTInfo
);
4198 static HRESULT WINAPI
ITextSelection_fnGetIDsOfNames(ITextSelection
*me
, REFIID riid
,
4199 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4201 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4205 TRACE("(%p)->(%p,%p,%u,%d,%p)\n", This
, riid
, rgszNames
, cNames
, lcid
,
4208 hr
= get_typeinfo(ITextSelection_tid
, &ti
);
4210 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
4214 static HRESULT WINAPI
ITextSelection_fnInvoke(
4216 DISPID dispIdMember
,
4220 DISPPARAMS
*pDispParams
,
4221 VARIANT
*pVarResult
,
4222 EXCEPINFO
*pExcepInfo
,
4225 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4229 TRACE("(%p)->(%d,%p,%d,%u,%p,%p,%p,%p)\n", This
, dispIdMember
, riid
, lcid
,
4230 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4232 hr
= get_typeinfo(ITextSelection_tid
, &ti
);
4234 hr
= ITypeInfo_Invoke(ti
, me
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4238 /*** ITextRange methods ***/
4239 static HRESULT WINAPI
ITextSelection_fnGetText(ITextSelection
*me
, BSTR
*pbstr
)
4241 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4242 ME_Cursor
*start
= NULL
, *end
= NULL
;
4246 TRACE("(%p)->(%p)\n", This
, pbstr
);
4249 return CO_E_RELEASED
;
4252 return E_INVALIDARG
;
4254 ME_GetSelection(This
->reOle
->editor
, &start
, &end
);
4255 endOfs
= ME_GetCursorOfs(end
);
4256 nChars
= endOfs
- ME_GetCursorOfs(start
);
4263 *pbstr
= SysAllocStringLen(NULL
, nChars
);
4265 return E_OUTOFMEMORY
;
4267 bEOP
= (end
->pRun
->next
->type
== diTextEnd
&& endOfs
> ME_GetTextLength(This
->reOle
->editor
));
4268 ME_GetTextW(This
->reOle
->editor
, *pbstr
, nChars
, start
, nChars
, FALSE
, bEOP
);
4269 TRACE("%s\n", wine_dbgstr_w(*pbstr
));
4274 static HRESULT WINAPI
ITextSelection_fnSetText(ITextSelection
*me
, BSTR str
)
4276 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4277 ME_TextEditor
*editor
;
4280 TRACE("(%p)->(%s)\n", This
, debugstr_w(str
));
4283 return CO_E_RELEASED
;
4285 editor
= This
->reOle
->editor
;
4287 ME_GetSelectionOfs(editor
, &from
, &to
);
4288 ME_ReplaceSel(editor
, FALSE
, str
, len
);
4290 if (len
< to
- from
)
4291 textranges_update_ranges(This
->reOle
, from
, len
, RANGE_UPDATE_DELETE
);
4296 static HRESULT WINAPI
ITextSelection_fnGetChar(ITextSelection
*me
, LONG
*pch
)
4298 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4299 ME_Cursor
*start
= NULL
, *end
= NULL
;
4301 TRACE("(%p)->(%p)\n", This
, pch
);
4304 return CO_E_RELEASED
;
4307 return E_INVALIDARG
;
4309 ME_GetSelection(This
->reOle
->editor
, &start
, &end
);
4310 return range_GetChar(This
->reOle
->editor
, start
, pch
);
4313 static HRESULT WINAPI
ITextSelection_fnSetChar(ITextSelection
*me
, LONG ch
)
4315 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4317 FIXME("(%p)->(%x): stub\n", This
, ch
);
4320 return CO_E_RELEASED
;
4325 static HRESULT WINAPI
ITextSelection_fnGetDuplicate(ITextSelection
*me
, ITextRange
**range
)
4327 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4330 TRACE("(%p)->(%p)\n", This
, range
);
4333 return CO_E_RELEASED
;
4336 return E_INVALIDARG
;
4338 ITextSelection_GetStart(me
, &start
);
4339 ITextSelection_GetEnd(me
, &end
);
4340 return CreateITextRange(This
->reOle
, start
, end
, range
);
4343 static HRESULT WINAPI
ITextSelection_fnGetFormattedText(ITextSelection
*me
, ITextRange
**range
)
4345 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4347 FIXME("(%p)->(%p): stub\n", This
, range
);
4350 return CO_E_RELEASED
;
4355 static HRESULT WINAPI
ITextSelection_fnSetFormattedText(ITextSelection
*me
, ITextRange
*range
)
4357 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4359 FIXME("(%p)->(%p): stub\n", This
, range
);
4362 return CO_E_RELEASED
;
4364 FIXME("not implemented\n");
4368 static HRESULT WINAPI
ITextSelection_fnGetStart(ITextSelection
*me
, LONG
*pcpFirst
)
4370 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4373 TRACE("(%p)->(%p)\n", This
, pcpFirst
);
4376 return CO_E_RELEASED
;
4379 return E_INVALIDARG
;
4380 ME_GetSelectionOfs(This
->reOle
->editor
, pcpFirst
, &lim
);
4384 static HRESULT WINAPI
ITextSelection_fnSetStart(ITextSelection
*me
, LONG value
)
4386 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4390 TRACE("(%p)->(%d)\n", This
, value
);
4393 return CO_E_RELEASED
;
4395 ME_GetSelectionOfs(This
->reOle
->editor
, &start
, &end
);
4396 hr
= textrange_setstart(This
->reOle
, value
, &start
, &end
);
4398 ME_SetSelection(This
->reOle
->editor
, start
, end
);
4403 static HRESULT WINAPI
ITextSelection_fnGetEnd(ITextSelection
*me
, LONG
*pcpLim
)
4405 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4408 TRACE("(%p)->(%p)\n", This
, pcpLim
);
4411 return CO_E_RELEASED
;
4414 return E_INVALIDARG
;
4415 ME_GetSelectionOfs(This
->reOle
->editor
, &first
, pcpLim
);
4419 static HRESULT WINAPI
ITextSelection_fnSetEnd(ITextSelection
*me
, LONG value
)
4421 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4425 TRACE("(%p)->(%d)\n", This
, value
);
4428 return CO_E_RELEASED
;
4430 ME_GetSelectionOfs(This
->reOle
->editor
, &start
, &end
);
4431 hr
= textrange_setend(This
->reOle
, value
, &start
, &end
);
4433 ME_SetSelection(This
->reOle
->editor
, start
, end
);
4438 static HRESULT WINAPI
ITextSelection_fnGetFont(ITextSelection
*me
, ITextFont
**font
)
4440 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4442 TRACE("(%p)->(%p)\n", This
, font
);
4445 return CO_E_RELEASED
;
4448 return E_INVALIDARG
;
4450 return create_textfont((ITextRange
*)me
, NULL
, font
);
4453 static HRESULT WINAPI
ITextSelection_fnSetFont(ITextSelection
*me
, ITextFont
*font
)
4455 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4457 TRACE("(%p)->(%p)\n", This
, font
);
4460 return E_INVALIDARG
;
4463 return CO_E_RELEASED
;
4465 textrange_set_font((ITextRange
*)me
, font
);
4469 static HRESULT WINAPI
ITextSelection_fnGetPara(ITextSelection
*me
, ITextPara
**para
)
4471 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4473 TRACE("(%p)->(%p)\n", This
, para
);
4476 return CO_E_RELEASED
;
4479 return E_INVALIDARG
;
4481 return create_textpara((ITextRange
*)me
, para
);
4484 static HRESULT WINAPI
ITextSelection_fnSetPara(ITextSelection
*me
, ITextPara
*para
)
4486 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4488 FIXME("(%p)->(%p): stub\n", This
, para
);
4491 return CO_E_RELEASED
;
4493 FIXME("not implemented\n");
4497 static HRESULT WINAPI
ITextSelection_fnGetStoryLength(ITextSelection
*me
, LONG
*length
)
4499 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4501 TRACE("(%p)->(%p)\n", This
, length
);
4504 return CO_E_RELEASED
;
4506 return textrange_get_storylength(This
->reOle
->editor
, length
);
4509 static HRESULT WINAPI
ITextSelection_fnGetStoryType(ITextSelection
*me
, LONG
*value
)
4511 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4513 TRACE("(%p)->(%p)\n", This
, value
);
4516 return CO_E_RELEASED
;
4519 return E_INVALIDARG
;
4521 *value
= tomUnknownStory
;
4525 static HRESULT WINAPI
ITextSelection_fnCollapse(ITextSelection
*me
, LONG bStart
)
4527 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4531 TRACE("(%p)->(%d)\n", This
, bStart
);
4534 return CO_E_RELEASED
;
4536 ME_GetSelectionOfs(This
->reOle
->editor
, &start
, &end
);
4537 hres
= range_Collapse(bStart
, &start
, &end
);
4538 if (SUCCEEDED(hres
))
4539 ME_SetSelection(This
->reOle
->editor
, start
, end
);
4543 static HRESULT WINAPI
ITextSelection_fnExpand(ITextSelection
*me
, LONG unit
, LONG
*delta
)
4545 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4547 TRACE("(%p)->(%d %p)\n", This
, unit
, delta
);
4550 return CO_E_RELEASED
;
4552 return textrange_expand((ITextRange
*)me
, unit
, delta
);
4555 static HRESULT WINAPI
ITextSelection_fnGetIndex(ITextSelection
*me
, LONG unit
, LONG
*index
)
4557 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4559 FIXME("(%p)->(%d %p): stub\n", This
, unit
, index
);
4562 return CO_E_RELEASED
;
4567 static HRESULT WINAPI
ITextSelection_fnSetIndex(ITextSelection
*me
, LONG unit
, LONG index
,
4570 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4572 FIXME("(%p)->(%d %d %d): stub\n", This
, unit
, index
, extend
);
4575 return CO_E_RELEASED
;
4580 static HRESULT WINAPI
ITextSelection_fnSetRange(ITextSelection
*me
, LONG anchor
, LONG active
)
4582 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4584 FIXME("(%p)->(%d %d): stub\n", This
, anchor
, active
);
4587 return CO_E_RELEASED
;
4592 static HRESULT WINAPI
ITextSelection_fnInRange(ITextSelection
*me
, ITextRange
*range
, LONG
*ret
)
4594 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4595 ITextSelection
*selection
= NULL
;
4598 TRACE("(%p)->(%p %p)\n", This
, range
, ret
);
4604 return CO_E_RELEASED
;
4609 ITextRange_QueryInterface(range
, &IID_ITextSelection
, (void**)&selection
);
4612 ITextSelection_Release(selection
);
4614 ITextSelection_GetStart(me
, &start
);
4615 ITextSelection_GetEnd(me
, &end
);
4616 return textrange_inrange(start
, end
, range
, ret
);
4619 static HRESULT WINAPI
ITextSelection_fnInStory(ITextSelection
*me
, ITextRange
*range
, LONG
*ret
)
4621 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4623 FIXME("(%p)->(%p %p): stub\n", This
, range
, ret
);
4626 return CO_E_RELEASED
;
4631 static HRESULT WINAPI
ITextSelection_fnIsEqual(ITextSelection
*me
, ITextRange
*range
, LONG
*ret
)
4633 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4634 ITextSelection
*selection
= NULL
;
4637 TRACE("(%p)->(%p %p)\n", This
, range
, ret
);
4643 return CO_E_RELEASED
;
4648 ITextRange_QueryInterface(range
, &IID_ITextSelection
, (void**)&selection
);
4651 ITextSelection_Release(selection
);
4653 ITextSelection_GetStart(me
, &start
);
4654 ITextSelection_GetEnd(me
, &end
);
4655 return textrange_isequal(start
, end
, range
, ret
);
4658 static HRESULT WINAPI
ITextSelection_fnSelect(ITextSelection
*me
)
4660 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4662 TRACE("(%p)\n", This
);
4665 return CO_E_RELEASED
;
4671 static HRESULT WINAPI
ITextSelection_fnStartOf(ITextSelection
*me
, LONG unit
, LONG extend
,
4674 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4676 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, extend
, delta
);
4679 return CO_E_RELEASED
;
4684 static HRESULT WINAPI
ITextSelection_fnEndOf(ITextSelection
*me
, LONG unit
, LONG extend
,
4687 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4689 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, extend
, delta
);
4692 return CO_E_RELEASED
;
4697 static HRESULT WINAPI
ITextSelection_fnMove(ITextSelection
*me
, LONG unit
, LONG count
, LONG
*delta
)
4699 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4701 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, count
, delta
);
4704 return CO_E_RELEASED
;
4709 static HRESULT WINAPI
ITextSelection_fnMoveStart(ITextSelection
*me
, LONG unit
, LONG count
,
4712 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4714 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, count
, delta
);
4717 return CO_E_RELEASED
;
4722 static HRESULT WINAPI
ITextSelection_fnMoveEnd(ITextSelection
*me
, LONG unit
, LONG count
,
4725 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4727 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, count
, delta
);
4730 return CO_E_RELEASED
;
4735 static HRESULT WINAPI
ITextSelection_fnMoveWhile(ITextSelection
*me
, VARIANT
*charset
, LONG count
,
4738 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4740 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
4743 return CO_E_RELEASED
;
4748 static HRESULT WINAPI
ITextSelection_fnMoveStartWhile(ITextSelection
*me
, VARIANT
*charset
, LONG count
,
4751 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4753 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
4756 return CO_E_RELEASED
;
4761 static HRESULT WINAPI
ITextSelection_fnMoveEndWhile(ITextSelection
*me
, VARIANT
*charset
, LONG count
,
4764 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4766 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
4769 return CO_E_RELEASED
;
4774 static HRESULT WINAPI
ITextSelection_fnMoveUntil(ITextSelection
*me
, VARIANT
*charset
, LONG count
,
4777 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4779 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
4782 return CO_E_RELEASED
;
4787 static HRESULT WINAPI
ITextSelection_fnMoveStartUntil(ITextSelection
*me
, VARIANT
*charset
, LONG count
,
4790 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4792 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
4795 return CO_E_RELEASED
;
4800 static HRESULT WINAPI
ITextSelection_fnMoveEndUntil(ITextSelection
*me
, VARIANT
*charset
, LONG count
,
4803 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4805 FIXME("(%p)->(%s %d %p): stub\n", This
, debugstr_variant(charset
), count
, delta
);
4808 return CO_E_RELEASED
;
4813 static HRESULT WINAPI
ITextSelection_fnFindText(ITextSelection
*me
, BSTR text
, LONG count
, LONG flags
,
4816 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4818 FIXME("(%p)->(%s %d %x %p): stub\n", This
, debugstr_w(text
), count
, flags
, length
);
4821 return CO_E_RELEASED
;
4823 FIXME("not implemented\n");
4827 static HRESULT WINAPI
ITextSelection_fnFindTextStart(ITextSelection
*me
, BSTR text
, LONG count
,
4828 LONG flags
, LONG
*length
)
4830 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4832 FIXME("(%p)->(%s %d %x %p): stub\n", This
, debugstr_w(text
), count
, flags
, length
);
4835 return CO_E_RELEASED
;
4840 static HRESULT WINAPI
ITextSelection_fnFindTextEnd(ITextSelection
*me
, BSTR text
, LONG count
,
4841 LONG flags
, LONG
*length
)
4843 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4845 FIXME("(%p)->(%s %d %x %p): stub\n", This
, debugstr_w(text
), count
, flags
, length
);
4848 return CO_E_RELEASED
;
4853 static HRESULT WINAPI
ITextSelection_fnDelete(ITextSelection
*me
, LONG unit
, LONG count
,
4856 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4858 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, count
, delta
);
4861 return CO_E_RELEASED
;
4866 static HRESULT WINAPI
ITextSelection_fnCut(ITextSelection
*me
, VARIANT
*v
)
4868 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4870 FIXME("(%p)->(%p): stub\n", This
, v
);
4873 return CO_E_RELEASED
;
4878 static HRESULT WINAPI
ITextSelection_fnCopy(ITextSelection
*me
, VARIANT
*v
)
4880 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4882 FIXME("(%p)->(%p): stub\n", This
, v
);
4885 return CO_E_RELEASED
;
4890 static HRESULT WINAPI
ITextSelection_fnPaste(ITextSelection
*me
, VARIANT
*v
, LONG format
)
4892 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4894 FIXME("(%p)->(%s %x): stub\n", This
, debugstr_variant(v
), format
);
4897 return CO_E_RELEASED
;
4902 static HRESULT WINAPI
ITextSelection_fnCanPaste(ITextSelection
*me
, VARIANT
*v
, LONG format
,
4905 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4907 FIXME("(%p)->(%s %x %p): stub\n", This
, debugstr_variant(v
), format
, ret
);
4910 return CO_E_RELEASED
;
4915 static HRESULT WINAPI
ITextSelection_fnCanEdit(ITextSelection
*me
, LONG
*ret
)
4917 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4919 FIXME("(%p)->(%p): stub\n", This
, ret
);
4922 return CO_E_RELEASED
;
4927 static HRESULT WINAPI
ITextSelection_fnChangeCase(ITextSelection
*me
, LONG type
)
4929 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4931 FIXME("(%p)->(%d): stub\n", This
, type
);
4934 return CO_E_RELEASED
;
4939 static HRESULT WINAPI
ITextSelection_fnGetPoint(ITextSelection
*me
, LONG type
, LONG
*cx
, LONG
*cy
)
4941 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4943 FIXME("(%p)->(%d %p %p): stub\n", This
, type
, cx
, cy
);
4946 return CO_E_RELEASED
;
4951 static HRESULT WINAPI
ITextSelection_fnSetPoint(ITextSelection
*me
, LONG x
, LONG y
, LONG type
,
4954 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4956 FIXME("(%p)->(%d %d %d %d): stub\n", This
, x
, y
, type
, extend
);
4959 return CO_E_RELEASED
;
4964 static HRESULT WINAPI
ITextSelection_fnScrollIntoView(ITextSelection
*me
, LONG value
)
4966 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4968 FIXME("(%p)->(%d): stub\n", This
, value
);
4971 return CO_E_RELEASED
;
4976 static HRESULT WINAPI
ITextSelection_fnGetEmbeddedObject(ITextSelection
*me
, IUnknown
**ppv
)
4978 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4980 FIXME("(%p)->(%p): stub\n", This
, ppv
);
4983 return CO_E_RELEASED
;
4988 /*** ITextSelection methods ***/
4989 static HRESULT WINAPI
ITextSelection_fnGetFlags(ITextSelection
*me
, LONG
*flags
)
4991 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4993 FIXME("(%p)->(%p): stub\n", This
, flags
);
4996 return CO_E_RELEASED
;
5001 static HRESULT WINAPI
ITextSelection_fnSetFlags(ITextSelection
*me
, LONG flags
)
5003 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5005 FIXME("(%p)->(%x): stub\n", This
, flags
);
5008 return CO_E_RELEASED
;
5013 static HRESULT WINAPI
ITextSelection_fnGetType(ITextSelection
*me
, LONG
*type
)
5015 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5017 FIXME("(%p)->(%p): stub\n", This
, type
);
5020 return CO_E_RELEASED
;
5025 static HRESULT WINAPI
ITextSelection_fnMoveLeft(ITextSelection
*me
, LONG unit
, LONG count
,
5026 LONG extend
, LONG
*delta
)
5028 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5030 FIXME("(%p)->(%d %d %d %p): stub\n", This
, unit
, count
, extend
, delta
);
5033 return CO_E_RELEASED
;
5038 static HRESULT WINAPI
ITextSelection_fnMoveRight(ITextSelection
*me
, LONG unit
, LONG count
,
5039 LONG extend
, LONG
*delta
)
5041 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5043 FIXME("(%p)->(%d %d %d %p): stub\n", This
, unit
, count
, extend
, delta
);
5046 return CO_E_RELEASED
;
5051 static HRESULT WINAPI
ITextSelection_fnMoveUp(ITextSelection
*me
, LONG unit
, LONG count
,
5052 LONG extend
, LONG
*delta
)
5054 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5056 FIXME("(%p)->(%d %d %d %p): stub\n", This
, unit
, count
, extend
, delta
);
5059 return CO_E_RELEASED
;
5064 static HRESULT WINAPI
ITextSelection_fnMoveDown(ITextSelection
*me
, LONG unit
, LONG count
,
5065 LONG extend
, LONG
*delta
)
5067 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5069 FIXME("(%p)->(%d %d %d %p): stub\n", This
, unit
, count
, extend
, delta
);
5072 return CO_E_RELEASED
;
5077 static HRESULT WINAPI
ITextSelection_fnHomeKey(ITextSelection
*me
, LONG unit
, LONG extend
,
5080 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5082 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, extend
, delta
);
5085 return CO_E_RELEASED
;
5090 static HRESULT WINAPI
ITextSelection_fnEndKey(ITextSelection
*me
, LONG unit
, LONG extend
,
5093 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5095 FIXME("(%p)->(%d %d %p): stub\n", This
, unit
, extend
, delta
);
5098 return CO_E_RELEASED
;
5103 static HRESULT WINAPI
ITextSelection_fnTypeText(ITextSelection
*me
, BSTR text
)
5105 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
5107 FIXME("(%p)->(%s): stub\n", This
, debugstr_w(text
));
5110 return CO_E_RELEASED
;
5115 static const ITextSelectionVtbl tsvt
= {
5116 ITextSelection_fnQueryInterface
,
5117 ITextSelection_fnAddRef
,
5118 ITextSelection_fnRelease
,
5119 ITextSelection_fnGetTypeInfoCount
,
5120 ITextSelection_fnGetTypeInfo
,
5121 ITextSelection_fnGetIDsOfNames
,
5122 ITextSelection_fnInvoke
,
5123 ITextSelection_fnGetText
,
5124 ITextSelection_fnSetText
,
5125 ITextSelection_fnGetChar
,
5126 ITextSelection_fnSetChar
,
5127 ITextSelection_fnGetDuplicate
,
5128 ITextSelection_fnGetFormattedText
,
5129 ITextSelection_fnSetFormattedText
,
5130 ITextSelection_fnGetStart
,
5131 ITextSelection_fnSetStart
,
5132 ITextSelection_fnGetEnd
,
5133 ITextSelection_fnSetEnd
,
5134 ITextSelection_fnGetFont
,
5135 ITextSelection_fnSetFont
,
5136 ITextSelection_fnGetPara
,
5137 ITextSelection_fnSetPara
,
5138 ITextSelection_fnGetStoryLength
,
5139 ITextSelection_fnGetStoryType
,
5140 ITextSelection_fnCollapse
,
5141 ITextSelection_fnExpand
,
5142 ITextSelection_fnGetIndex
,
5143 ITextSelection_fnSetIndex
,
5144 ITextSelection_fnSetRange
,
5145 ITextSelection_fnInRange
,
5146 ITextSelection_fnInStory
,
5147 ITextSelection_fnIsEqual
,
5148 ITextSelection_fnSelect
,
5149 ITextSelection_fnStartOf
,
5150 ITextSelection_fnEndOf
,
5151 ITextSelection_fnMove
,
5152 ITextSelection_fnMoveStart
,
5153 ITextSelection_fnMoveEnd
,
5154 ITextSelection_fnMoveWhile
,
5155 ITextSelection_fnMoveStartWhile
,
5156 ITextSelection_fnMoveEndWhile
,
5157 ITextSelection_fnMoveUntil
,
5158 ITextSelection_fnMoveStartUntil
,
5159 ITextSelection_fnMoveEndUntil
,
5160 ITextSelection_fnFindText
,
5161 ITextSelection_fnFindTextStart
,
5162 ITextSelection_fnFindTextEnd
,
5163 ITextSelection_fnDelete
,
5164 ITextSelection_fnCut
,
5165 ITextSelection_fnCopy
,
5166 ITextSelection_fnPaste
,
5167 ITextSelection_fnCanPaste
,
5168 ITextSelection_fnCanEdit
,
5169 ITextSelection_fnChangeCase
,
5170 ITextSelection_fnGetPoint
,
5171 ITextSelection_fnSetPoint
,
5172 ITextSelection_fnScrollIntoView
,
5173 ITextSelection_fnGetEmbeddedObject
,
5174 ITextSelection_fnGetFlags
,
5175 ITextSelection_fnSetFlags
,
5176 ITextSelection_fnGetType
,
5177 ITextSelection_fnMoveLeft
,
5178 ITextSelection_fnMoveRight
,
5179 ITextSelection_fnMoveUp
,
5180 ITextSelection_fnMoveDown
,
5181 ITextSelection_fnHomeKey
,
5182 ITextSelection_fnEndKey
,
5183 ITextSelection_fnTypeText
5186 static ITextSelectionImpl
*
5187 CreateTextSelection(IRichEditOleImpl
*reOle
)
5189 ITextSelectionImpl
*txtSel
= heap_alloc(sizeof *txtSel
);
5193 txtSel
->ITextSelection_iface
.lpVtbl
= &tsvt
;
5195 txtSel
->reOle
= reOle
;
5199 LRESULT
CreateIRichEditOle(IUnknown
*outer_unk
, ME_TextEditor
*editor
, LPVOID
*ppvObj
)
5201 IRichEditOleImpl
*reo
;
5203 reo
= heap_alloc(sizeof(IRichEditOleImpl
));
5207 reo
->IUnknown_inner
.lpVtbl
= &reo_unk_vtbl
;
5208 reo
->IRichEditOle_iface
.lpVtbl
= &revt
;
5209 reo
->ITextDocument_iface
.lpVtbl
= &tdvt
;
5211 reo
->editor
= editor
;
5214 TRACE("Created %p\n",reo
);
5215 list_init(&reo
->rangelist
);
5216 list_init(&reo
->clientsites
);
5218 reo
->outer_unk
= outer_unk
;
5220 reo
->outer_unk
= &reo
->IUnknown_inner
;
5221 *ppvObj
= &reo
->IRichEditOle_iface
;
5226 static void convert_sizel(const ME_Context
*c
, const SIZEL
* szl
, SIZE
* sz
)
5228 /* sizel is in .01 millimeters, sz in pixels */
5229 sz
->cx
= MulDiv(szl
->cx
, c
->dpi
.cx
, 2540);
5230 sz
->cy
= MulDiv(szl
->cy
, c
->dpi
.cy
, 2540);
5233 /******************************************************************************
5234 * ME_GetOLEObjectSize
5236 * Sets run extent for OLE objects.
5238 void ME_GetOLEObjectSize(const ME_Context
*c
, ME_Run
*run
, SIZE
*pSize
)
5246 assert(run
->nFlags
& MERF_GRAPHICS
);
5247 assert(run
->ole_obj
);
5249 if (run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0)
5251 convert_sizel(c
, &run
->ole_obj
->sizel
, pSize
);
5252 if (c
->editor
->nZoomNumerator
!= 0)
5254 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5255 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5260 if (!run
->ole_obj
->poleobj
)
5262 pSize
->cx
= pSize
->cy
= 0;
5266 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
5268 FIXME("Query Interface IID_IDataObject failed!\n");
5269 pSize
->cx
= pSize
->cy
= 0;
5272 fmt
.cfFormat
= CF_BITMAP
;
5274 fmt
.dwAspect
= DVASPECT_CONTENT
;
5276 fmt
.tymed
= TYMED_GDI
;
5277 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
5279 fmt
.cfFormat
= CF_ENHMETAFILE
;
5280 fmt
.tymed
= TYMED_ENHMF
;
5281 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
5283 FIXME("unsupported format\n");
5284 pSize
->cx
= pSize
->cy
= 0;
5285 IDataObject_Release(ido
);
5293 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
5294 pSize
->cx
= dibsect
.dsBm
.bmWidth
;
5295 pSize
->cy
= dibsect
.dsBm
.bmHeight
;
5296 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
5299 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
5300 pSize
->cx
= emh
.rclBounds
.right
- emh
.rclBounds
.left
;
5301 pSize
->cy
= emh
.rclBounds
.bottom
- emh
.rclBounds
.top
;
5302 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
5305 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
5308 IDataObject_Release(ido
);
5309 if (c
->editor
->nZoomNumerator
!= 0)
5311 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5312 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5316 void ME_DrawOLE(ME_Context
*c
, int x
, int y
, ME_Run
*run
,
5317 ME_Paragraph
*para
, BOOL selected
)
5328 assert(run
->nFlags
& MERF_GRAPHICS
);
5329 assert(run
->ole_obj
);
5330 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
5332 FIXME("Couldn't get interface\n");
5335 has_size
= run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0;
5336 fmt
.cfFormat
= CF_BITMAP
;
5338 fmt
.dwAspect
= DVASPECT_CONTENT
;
5340 fmt
.tymed
= TYMED_GDI
;
5341 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
5343 fmt
.cfFormat
= CF_ENHMETAFILE
;
5344 fmt
.tymed
= TYMED_ENHMF
;
5345 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
5347 FIXME("Couldn't get storage medium\n");
5348 IDataObject_Release(ido
);
5355 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
5356 hMemDC
= CreateCompatibleDC(c
->hDC
);
5357 SelectObject(hMemDC
, stgm
.u
.hBitmap
);
5360 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
5362 sz
.cx
= MulDiv(dibsect
.dsBm
.bmWidth
, c
->dpi
.cx
, 96);
5363 sz
.cy
= MulDiv(dibsect
.dsBm
.bmHeight
, c
->dpi
.cy
, 96);
5365 if (c
->editor
->nZoomNumerator
!= 0)
5367 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5368 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5370 if (sz
.cx
== dibsect
.dsBm
.bmWidth
&& sz
.cy
== dibsect
.dsBm
.bmHeight
)
5372 BitBlt(c
->hDC
, x
, y
- sz
.cy
,
5373 dibsect
.dsBm
.bmWidth
, dibsect
.dsBm
.bmHeight
,
5374 hMemDC
, 0, 0, SRCCOPY
);
5376 StretchBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
,
5377 hMemDC
, 0, 0, dibsect
.dsBm
.bmWidth
,
5378 dibsect
.dsBm
.bmHeight
, SRCCOPY
);
5381 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
5384 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
5387 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
5389 sz
.cy
= MulDiv(emh
.rclBounds
.bottom
- emh
.rclBounds
.top
, c
->dpi
.cx
, 96);
5390 sz
.cx
= MulDiv(emh
.rclBounds
.right
- emh
.rclBounds
.left
, c
->dpi
.cy
, 96);
5392 if (c
->editor
->nZoomNumerator
!= 0)
5394 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5395 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5403 rc
.right
= x
+ sz
.cx
;
5405 PlayEnhMetaFile(c
->hDC
, stgm
.u
.hEnhMetaFile
, &rc
);
5407 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
5410 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
5414 if (selected
&& !c
->editor
->bHideSelection
)
5415 PatBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
, DSTINVERT
);
5416 IDataObject_Release(ido
);
5419 void ME_DeleteReObject(REOBJECT
* reo
)
5421 if (reo
->poleobj
) IOleObject_Release(reo
->poleobj
);
5422 if (reo
->pstg
) IStorage_Release(reo
->pstg
);
5423 if (reo
->polesite
) IOleClientSite_Release(reo
->polesite
);
5427 void ME_CopyReObject(REOBJECT
* dst
, const REOBJECT
* src
)
5431 if (dst
->poleobj
) IOleObject_AddRef(dst
->poleobj
);
5432 if (dst
->pstg
) IStorage_AddRef(dst
->pstg
);
5433 if (dst
->polesite
) IOleClientSite_AddRef(dst
->polesite
);
5436 void ME_GetITextDocumentInterface(IRichEditOle
*iface
, LPVOID
*ppvObj
)
5438 IRichEditOleImpl
*This
= impl_from_IRichEditOle(iface
);
5439 *ppvObj
= &This
->ITextDocument_iface
;