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 WINAPI
IRichEditOleImpl_inner_fnQueryInterface(IUnknown
*iface
, REFIID riid
, LPVOID
*ppvObj
)
914 IRichEditOleImpl
*This
= impl_from_IUnknown(iface
);
916 TRACE("%p %s\n", This
, debugstr_guid(riid
));
919 if (IsEqualGUID(riid
, &IID_IUnknown
))
920 *ppvObj
= &This
->IUnknown_inner
;
921 else if (IsEqualGUID(riid
, &IID_IRichEditOle
))
922 *ppvObj
= &This
->IRichEditOle_iface
;
923 else if (IsEqualGUID(riid
, &IID_ITextDocument
))
924 *ppvObj
= &This
->ITextDocument_iface
;
927 IUnknown_AddRef((IUnknown
*)*ppvObj
);
930 FIXME("%p: unhandled interface %s\n", This
, debugstr_guid(riid
));
932 return E_NOINTERFACE
;
935 static ULONG WINAPI
IRichEditOleImpl_inner_fnAddRef(IUnknown
*iface
)
937 IRichEditOleImpl
*This
= impl_from_IUnknown(iface
);
938 ULONG ref
= InterlockedIncrement(&This
->ref
);
940 TRACE("%p ref = %u\n", This
, ref
);
945 static ULONG WINAPI
IRichEditOleImpl_inner_fnRelease(IUnknown
*iface
)
947 IRichEditOleImpl
*This
= impl_from_IUnknown(iface
);
948 ULONG ref
= InterlockedDecrement(&This
->ref
);
950 TRACE ("%p ref=%u\n", This
, ref
);
954 IOleClientSiteImpl
*clientsite
;
955 ITextRangeImpl
*txtRge
;
957 This
->editor
->reOle
= NULL
;
959 This
->txtSel
->reOle
= NULL
;
960 ITextSelection_Release(&This
->txtSel
->ITextSelection_iface
);
963 LIST_FOR_EACH_ENTRY(txtRge
, &This
->rangelist
, ITextRangeImpl
, child
.entry
)
964 txtRge
->child
.reole
= NULL
;
966 LIST_FOR_EACH_ENTRY(clientsite
, &This
->clientsites
, IOleClientSiteImpl
, child
.entry
)
967 clientsite
->child
.reole
= NULL
;
974 static const IUnknownVtbl reo_unk_vtbl
=
976 IRichEditOleImpl_inner_fnQueryInterface
,
977 IRichEditOleImpl_inner_fnAddRef
,
978 IRichEditOleImpl_inner_fnRelease
981 static HRESULT WINAPI
982 IRichEditOle_fnQueryInterface(IRichEditOle
*me
, REFIID riid
, LPVOID
*ppvObj
)
984 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
985 return IUnknown_QueryInterface(This
->outer_unk
, riid
, ppvObj
);
989 IRichEditOle_fnAddRef(IRichEditOle
*me
)
991 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
992 return IUnknown_AddRef(This
->outer_unk
);
996 IRichEditOle_fnRelease(IRichEditOle
*me
)
998 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
999 return IUnknown_Release(This
->outer_unk
);
1002 static HRESULT WINAPI
1003 IRichEditOle_fnActivateAs(IRichEditOle
*me
, REFCLSID rclsid
, REFCLSID rclsidAs
)
1005 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1006 FIXME("stub %p\n",This
);
1010 static HRESULT WINAPI
1011 IRichEditOle_fnContextSensitiveHelp(IRichEditOle
*me
, BOOL fEnterMode
)
1013 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1014 FIXME("stub %p\n",This
);
1018 static HRESULT WINAPI
1019 IRichEditOle_fnConvertObject(IRichEditOle
*me
, LONG iob
,
1020 REFCLSID rclsidNew
, LPCSTR lpstrUserTypeNew
)
1022 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1023 FIXME("stub %p\n",This
);
1027 static inline IOleClientSiteImpl
*impl_from_IOleClientSite(IOleClientSite
*iface
)
1029 return CONTAINING_RECORD(iface
, IOleClientSiteImpl
, IOleClientSite_iface
);
1032 static HRESULT WINAPI
1033 IOleClientSite_fnQueryInterface(IOleClientSite
*me
, REFIID riid
, LPVOID
*ppvObj
)
1035 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(me
);
1036 TRACE("%p %s\n", me
, debugstr_guid(riid
) );
1039 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
1040 IsEqualGUID(riid
, &IID_IOleClientSite
))
1042 else if (IsEqualGUID(riid
, &IID_IOleWindow
))
1043 *ppvObj
= &This
->IOleWindow_iface
;
1044 else if (IsEqualGUID(riid
, &IID_IOleInPlaceSite
))
1045 *ppvObj
= &This
->IOleInPlaceSite_iface
;
1048 IOleClientSite_AddRef(me
);
1051 FIXME("%p: unhandled interface %s\n", me
, debugstr_guid(riid
) );
1053 return E_NOINTERFACE
;
1056 static ULONG WINAPI
IOleClientSite_fnAddRef(IOleClientSite
*iface
)
1058 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1059 ULONG ref
= InterlockedIncrement(&This
->ref
);
1060 TRACE("(%p)->(%u)\n", This
, ref
);
1064 static ULONG WINAPI
IOleClientSite_fnRelease(IOleClientSite
*iface
)
1066 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1067 ULONG ref
= InterlockedDecrement(&This
->ref
);
1069 TRACE("(%p)->(%u)\n", This
, ref
);
1072 if (This
->child
.reole
) {
1073 list_remove(&This
->child
.entry
);
1074 This
->child
.reole
= NULL
;
1081 static HRESULT WINAPI
IOleClientSite_fnSaveObject(IOleClientSite
*iface
)
1083 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1084 if (!This
->child
.reole
)
1085 return CO_E_RELEASED
;
1087 FIXME("stub %p\n", iface
);
1091 static HRESULT WINAPI
IOleClientSite_fnGetMoniker(IOleClientSite
*iface
, DWORD dwAssign
,
1092 DWORD dwWhichMoniker
, IMoniker
**ppmk
)
1094 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1095 if (!This
->child
.reole
)
1096 return CO_E_RELEASED
;
1098 FIXME("stub %p\n", iface
);
1102 static HRESULT WINAPI
IOleClientSite_fnGetContainer(IOleClientSite
*iface
,
1103 IOleContainer
**ppContainer
)
1105 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1106 if (!This
->child
.reole
)
1107 return CO_E_RELEASED
;
1109 FIXME("stub %p\n", iface
);
1113 static HRESULT WINAPI
IOleClientSite_fnShowObject(IOleClientSite
*iface
)
1115 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1116 if (!This
->child
.reole
)
1117 return CO_E_RELEASED
;
1119 FIXME("stub %p\n", iface
);
1123 static HRESULT WINAPI
IOleClientSite_fnOnShowWindow(IOleClientSite
*iface
, BOOL fShow
)
1125 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1126 if (!This
->child
.reole
)
1127 return CO_E_RELEASED
;
1129 FIXME("stub %p\n", iface
);
1133 static HRESULT WINAPI
IOleClientSite_fnRequestNewObjectLayout(IOleClientSite
*iface
)
1135 IOleClientSiteImpl
*This
= impl_from_IOleClientSite(iface
);
1136 if (!This
->child
.reole
)
1137 return CO_E_RELEASED
;
1139 FIXME("stub %p\n", iface
);
1143 static const IOleClientSiteVtbl ocst
= {
1144 IOleClientSite_fnQueryInterface
,
1145 IOleClientSite_fnAddRef
,
1146 IOleClientSite_fnRelease
,
1147 IOleClientSite_fnSaveObject
,
1148 IOleClientSite_fnGetMoniker
,
1149 IOleClientSite_fnGetContainer
,
1150 IOleClientSite_fnShowObject
,
1151 IOleClientSite_fnOnShowWindow
,
1152 IOleClientSite_fnRequestNewObjectLayout
1155 /* IOleWindow interface */
1156 static HRESULT WINAPI
IOleWindow_fnQueryInterface(IOleWindow
*iface
, REFIID riid
, void **ppvObj
)
1158 IOleClientSiteImpl
*This
= impl_from_IOleWindow(iface
);
1159 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppvObj
);
1162 static ULONG WINAPI
IOleWindow_fnAddRef(IOleWindow
*iface
)
1164 IOleClientSiteImpl
*This
= impl_from_IOleWindow(iface
);
1165 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
1168 static ULONG WINAPI
IOleWindow_fnRelease(IOleWindow
*iface
)
1170 IOleClientSiteImpl
*This
= impl_from_IOleWindow(iface
);
1171 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
1174 static HRESULT WINAPI
IOleWindow_fnContextSensitiveHelp(IOleWindow
*iface
, BOOL fEnterMode
)
1176 IOleClientSiteImpl
*This
= impl_from_IOleWindow(iface
);
1177 FIXME("not implemented: (%p)->(%d)\n", This
, fEnterMode
);
1181 static HRESULT WINAPI
IOleWindow_fnGetWindow(IOleWindow
*iface
, HWND
*phwnd
)
1183 IOleClientSiteImpl
*This
= impl_from_IOleWindow(iface
);
1185 TRACE("(%p)->(%p)\n", This
, phwnd
);
1187 if (!This
->child
.reole
)
1188 return CO_E_RELEASED
;
1191 return E_INVALIDARG
;
1193 *phwnd
= This
->child
.reole
->editor
->hWnd
;
1197 static const IOleWindowVtbl olewinvt
= {
1198 IOleWindow_fnQueryInterface
,
1199 IOleWindow_fnAddRef
,
1200 IOleWindow_fnRelease
,
1201 IOleWindow_fnGetWindow
,
1202 IOleWindow_fnContextSensitiveHelp
1205 /* IOleInPlaceSite interface */
1206 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnQueryInterface(IOleInPlaceSite
*iface
, REFIID riid
, void **ppvObj
)
1208 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1209 return IOleClientSite_QueryInterface(&This
->IOleClientSite_iface
, riid
, ppvObj
);
1212 static ULONG STDMETHODCALLTYPE
IOleInPlaceSite_fnAddRef(IOleInPlaceSite
*iface
)
1214 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1215 return IOleClientSite_AddRef(&This
->IOleClientSite_iface
);
1218 static ULONG STDMETHODCALLTYPE
IOleInPlaceSite_fnRelease(IOleInPlaceSite
*iface
)
1220 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1221 return IOleClientSite_Release(&This
->IOleClientSite_iface
);
1224 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnGetWindow(IOleInPlaceSite
*iface
, HWND
*phwnd
)
1226 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1227 return IOleWindow_GetWindow(&This
->IOleWindow_iface
, phwnd
);
1230 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnContextSensitiveHelp(IOleInPlaceSite
*iface
, BOOL fEnterMode
)
1232 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1233 return IOleWindow_ContextSensitiveHelp(&This
->IOleWindow_iface
, fEnterMode
);
1236 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnCanInPlaceActivate(IOleInPlaceSite
*iface
)
1238 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1239 FIXME("not implemented: (%p)\n", This
);
1243 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnInPlaceActivate(IOleInPlaceSite
*iface
)
1245 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1246 FIXME("not implemented: (%p)\n", This
);
1250 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnUIActivate(IOleInPlaceSite
*iface
)
1252 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1253 FIXME("not implemented: (%p)\n", This
);
1257 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnGetWindowContext(IOleInPlaceSite
*iface
, IOleInPlaceFrame
**ppFrame
,
1258 IOleInPlaceUIWindow
**ppDoc
, LPRECT lprcPosRect
,
1259 LPRECT lprcClipRect
, LPOLEINPLACEFRAMEINFO lpFrameInfo
)
1261 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1262 FIXME("not implemented: (%p)->(%p %p %p %p %p)\n", This
, ppFrame
, ppDoc
, lprcPosRect
, lprcClipRect
, lpFrameInfo
);
1266 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnScroll(IOleInPlaceSite
*iface
, SIZE scrollExtent
)
1268 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1269 FIXME("not implemented: (%p)\n", This
);
1273 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnUIDeactivate(IOleInPlaceSite
*iface
, BOOL fUndoable
)
1275 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1276 FIXME("not implemented: (%p)->(%d)\n", This
, fUndoable
);
1280 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnInPlaceDeactivate(IOleInPlaceSite
*iface
)
1282 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1283 FIXME("not implemented: (%p)\n", This
);
1287 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnDiscardUndoState(IOleInPlaceSite
*iface
)
1289 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1290 FIXME("not implemented: (%p)\n", This
);
1294 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnDeactivateAndUndo(IOleInPlaceSite
*iface
)
1296 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1297 FIXME("not implemented: (%p)\n", This
);
1301 static HRESULT STDMETHODCALLTYPE
IOleInPlaceSite_fnOnPosRectChange(IOleInPlaceSite
*iface
, LPCRECT lprcPosRect
)
1303 IOleClientSiteImpl
*This
= impl_from_IOleInPlaceSite(iface
);
1304 FIXME("not implemented: (%p)->(%p)\n", This
, lprcPosRect
);
1308 static const IOleInPlaceSiteVtbl olestvt
=
1310 IOleInPlaceSite_fnQueryInterface
,
1311 IOleInPlaceSite_fnAddRef
,
1312 IOleInPlaceSite_fnRelease
,
1313 IOleInPlaceSite_fnGetWindow
,
1314 IOleInPlaceSite_fnContextSensitiveHelp
,
1315 IOleInPlaceSite_fnCanInPlaceActivate
,
1316 IOleInPlaceSite_fnOnInPlaceActivate
,
1317 IOleInPlaceSite_fnOnUIActivate
,
1318 IOleInPlaceSite_fnGetWindowContext
,
1319 IOleInPlaceSite_fnScroll
,
1320 IOleInPlaceSite_fnOnUIDeactivate
,
1321 IOleInPlaceSite_fnOnInPlaceDeactivate
,
1322 IOleInPlaceSite_fnDiscardUndoState
,
1323 IOleInPlaceSite_fnDeactivateAndUndo
,
1324 IOleInPlaceSite_fnOnPosRectChange
1327 static HRESULT
CreateOleClientSite(IRichEditOleImpl
*reOle
, IOleClientSite
**ret
)
1329 IOleClientSiteImpl
*clientSite
= heap_alloc(sizeof *clientSite
);
1332 return E_OUTOFMEMORY
;
1334 clientSite
->IOleClientSite_iface
.lpVtbl
= &ocst
;
1335 clientSite
->IOleWindow_iface
.lpVtbl
= &olewinvt
;
1336 clientSite
->IOleInPlaceSite_iface
.lpVtbl
= &olestvt
;
1337 clientSite
->ref
= 1;
1338 clientSite
->child
.reole
= reOle
;
1339 list_add_head(&reOle
->clientsites
, &clientSite
->child
.entry
);
1341 *ret
= &clientSite
->IOleClientSite_iface
;
1345 static HRESULT WINAPI
1346 IRichEditOle_fnGetClientSite(IRichEditOle
*me
, IOleClientSite
**clientsite
)
1348 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1350 TRACE("(%p)->(%p)\n", This
, clientsite
);
1353 return E_INVALIDARG
;
1355 return CreateOleClientSite(This
, clientsite
);
1358 static HRESULT WINAPI
1359 IRichEditOle_fnGetClipboardData(IRichEditOle
*me
, CHARRANGE
*lpchrg
,
1360 DWORD reco
, LPDATAOBJECT
*lplpdataobj
)
1362 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1366 TRACE("(%p,%p,%d)\n",This
, lpchrg
, reco
);
1368 return E_INVALIDARG
;
1370 int nFrom
, nTo
, nStartCur
= ME_GetSelectionOfs(This
->editor
, &nFrom
, &nTo
);
1371 start
= This
->editor
->pCursors
[nStartCur
];
1372 nChars
= nTo
- nFrom
;
1374 ME_CursorFromCharOfs(This
->editor
, lpchrg
->cpMin
, &start
);
1375 nChars
= lpchrg
->cpMax
- lpchrg
->cpMin
;
1377 return ME_GetDataObject(This
->editor
, &start
, nChars
, lplpdataobj
);
1380 static LONG WINAPI
IRichEditOle_fnGetLinkCount(IRichEditOle
*me
)
1382 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1383 FIXME("stub %p\n",This
);
1387 static HRESULT WINAPI
1388 IRichEditOle_fnGetObject(IRichEditOle
*me
, LONG iob
,
1389 REOBJECT
*lpreobject
, DWORD dwFlags
)
1391 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1392 FIXME("stub %p\n",This
);
1397 IRichEditOle_fnGetObjectCount(IRichEditOle
*me
)
1399 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1400 FIXME("stub %p\n",This
);
1404 static HRESULT WINAPI
1405 IRichEditOle_fnHandsOffStorage(IRichEditOle
*me
, LONG iob
)
1407 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1408 FIXME("stub %p\n",This
);
1412 static HRESULT WINAPI
1413 IRichEditOle_fnImportDataObject(IRichEditOle
*me
, LPDATAOBJECT lpdataobj
,
1414 CLIPFORMAT cf
, HGLOBAL hMetaPict
)
1416 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1417 FIXME("stub %p\n",This
);
1421 static HRESULT WINAPI
1422 IRichEditOle_fnInPlaceDeactivate(IRichEditOle
*me
)
1424 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1425 FIXME("stub %p\n",This
);
1429 static HRESULT WINAPI
1430 IRichEditOle_fnInsertObject(IRichEditOle
*me
, REOBJECT
*reo
)
1432 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1434 TRACE("(%p,%p)\n", This
, reo
);
1437 return E_INVALIDARG
;
1439 if (reo
->cbStruct
< sizeof(*reo
)) return STG_E_INVALIDPARAMETER
;
1441 ME_InsertOLEFromCursor(This
->editor
, reo
, 0);
1442 ME_CommitUndo(This
->editor
);
1443 ME_UpdateRepaint(This
->editor
, FALSE
);
1447 static HRESULT WINAPI
IRichEditOle_fnSaveCompleted(IRichEditOle
*me
, LONG iob
,
1450 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1451 FIXME("stub %p\n",This
);
1455 static HRESULT WINAPI
1456 IRichEditOle_fnSetDvaspect(IRichEditOle
*me
, LONG iob
, DWORD dvaspect
)
1458 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1459 FIXME("stub %p\n",This
);
1463 static HRESULT WINAPI
IRichEditOle_fnSetHostNames(IRichEditOle
*me
,
1464 LPCSTR lpstrContainerApp
, LPCSTR lpstrContainerObj
)
1466 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1467 FIXME("stub %p %s %s\n",This
, lpstrContainerApp
, lpstrContainerObj
);
1471 static HRESULT WINAPI
1472 IRichEditOle_fnSetLinkAvailable(IRichEditOle
*me
, LONG iob
, BOOL fAvailable
)
1474 IRichEditOleImpl
*This
= impl_from_IRichEditOle(me
);
1475 FIXME("stub %p\n",This
);
1479 static const IRichEditOleVtbl revt
= {
1480 IRichEditOle_fnQueryInterface
,
1481 IRichEditOle_fnAddRef
,
1482 IRichEditOle_fnRelease
,
1483 IRichEditOle_fnGetClientSite
,
1484 IRichEditOle_fnGetObjectCount
,
1485 IRichEditOle_fnGetLinkCount
,
1486 IRichEditOle_fnGetObject
,
1487 IRichEditOle_fnInsertObject
,
1488 IRichEditOle_fnConvertObject
,
1489 IRichEditOle_fnActivateAs
,
1490 IRichEditOle_fnSetHostNames
,
1491 IRichEditOle_fnSetLinkAvailable
,
1492 IRichEditOle_fnSetDvaspect
,
1493 IRichEditOle_fnHandsOffStorage
,
1494 IRichEditOle_fnSaveCompleted
,
1495 IRichEditOle_fnInPlaceDeactivate
,
1496 IRichEditOle_fnContextSensitiveHelp
,
1497 IRichEditOle_fnGetClipboardData
,
1498 IRichEditOle_fnImportDataObject
1501 /* ITextRange interface */
1502 static HRESULT WINAPI
ITextRange_fnQueryInterface(ITextRange
*me
, REFIID riid
, void **ppvObj
)
1504 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1507 if (IsEqualGUID(riid
, &IID_IUnknown
)
1508 || IsEqualGUID(riid
, &IID_IDispatch
)
1509 || IsEqualGUID(riid
, &IID_ITextRange
))
1512 ITextRange_AddRef(me
);
1515 else if (IsEqualGUID(riid
, &IID_Igetrichole
))
1517 *ppvObj
= This
->child
.reole
;
1521 return E_NOINTERFACE
;
1524 static ULONG WINAPI
ITextRange_fnAddRef(ITextRange
*me
)
1526 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1527 return InterlockedIncrement(&This
->ref
);
1530 static ULONG WINAPI
ITextRange_fnRelease(ITextRange
*me
)
1532 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1533 ULONG ref
= InterlockedDecrement(&This
->ref
);
1535 TRACE ("%p ref=%u\n", This
, ref
);
1538 if (This
->child
.reole
)
1540 list_remove(&This
->child
.entry
);
1541 This
->child
.reole
= NULL
;
1548 static HRESULT WINAPI
ITextRange_fnGetTypeInfoCount(ITextRange
*me
, UINT
*pctinfo
)
1550 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1551 TRACE("(%p)->(%p)\n", This
, pctinfo
);
1556 static HRESULT WINAPI
ITextRange_fnGetTypeInfo(ITextRange
*me
, UINT iTInfo
, LCID lcid
,
1557 ITypeInfo
**ppTInfo
)
1559 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1562 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
1564 hr
= get_typeinfo(ITextRange_tid
, ppTInfo
);
1566 ITypeInfo_AddRef(*ppTInfo
);
1570 static HRESULT WINAPI
ITextRange_fnGetIDsOfNames(ITextRange
*me
, REFIID riid
, LPOLESTR
*rgszNames
,
1571 UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
1573 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1577 TRACE("(%p)->(%p,%p,%u,%d,%p)\n", This
, riid
, rgszNames
, cNames
, lcid
,
1580 hr
= get_typeinfo(ITextRange_tid
, &ti
);
1582 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
1586 static HRESULT WINAPI
ITextRange_fnInvoke(ITextRange
*me
, DISPID dispIdMember
, REFIID riid
,
1587 LCID lcid
, WORD wFlags
, DISPPARAMS
*pDispParams
,
1588 VARIANT
*pVarResult
, EXCEPINFO
*pExcepInfo
,
1591 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1595 TRACE("(%p)->(%d,%p,%d,%u,%p,%p,%p,%p)\n", This
, dispIdMember
, riid
, lcid
,
1596 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1598 hr
= get_typeinfo(ITextRange_tid
, &ti
);
1600 hr
= ITypeInfo_Invoke(ti
, me
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
1604 static HRESULT WINAPI
ITextRange_fnGetText(ITextRange
*me
, BSTR
*str
)
1606 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1607 ME_TextEditor
*editor
;
1608 ME_Cursor start
, end
;
1612 TRACE("(%p)->(%p)\n", This
, str
);
1614 if (!This
->child
.reole
)
1615 return CO_E_RELEASED
;
1618 return E_INVALIDARG
;
1620 /* return early for degenerate range */
1621 if (This
->start
== This
->end
) {
1626 editor
= This
->child
.reole
->editor
;
1627 ME_CursorFromCharOfs(editor
, This
->start
, &start
);
1628 ME_CursorFromCharOfs(editor
, This
->end
, &end
);
1630 length
= This
->end
- This
->start
;
1631 *str
= SysAllocStringLen(NULL
, length
);
1633 return E_OUTOFMEMORY
;
1635 bEOP
= (end
.pRun
->next
->type
== diTextEnd
&& This
->end
> ME_GetTextLength(editor
));
1636 ME_GetTextW(editor
, *str
, length
, &start
, length
, FALSE
, bEOP
);
1640 static HRESULT WINAPI
ITextRange_fnSetText(ITextRange
*me
, BSTR str
)
1642 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1643 ME_TextEditor
*editor
;
1648 TRACE("(%p)->(%s)\n", This
, debugstr_w(str
));
1650 if (!This
->child
.reole
)
1651 return CO_E_RELEASED
;
1653 editor
= This
->child
.reole
->editor
;
1655 /* delete only where's something to delete */
1656 if (This
->start
!= This
->end
) {
1657 ME_CursorFromCharOfs(editor
, This
->start
, &cursor
);
1658 ME_InternalDeleteText(editor
, &cursor
, This
->end
- This
->start
, FALSE
);
1661 if (!str
|| !*str
) {
1662 /* will update this range as well */
1663 textranges_update_ranges(This
->child
.reole
, This
->start
, This
->end
, RANGE_UPDATE_DELETE
);
1667 /* it's safer not to rely on stored BSTR length */
1669 cursor
= editor
->pCursors
[0];
1670 ME_CursorFromCharOfs(editor
, This
->start
, &editor
->pCursors
[0]);
1671 style
= ME_GetInsertStyle(editor
, 0);
1672 ME_InsertTextFromCursor(editor
, 0, str
, len
, style
);
1673 ME_ReleaseStyle(style
);
1674 editor
->pCursors
[0] = cursor
;
1676 if (len
< This
->end
- This
->start
)
1677 textranges_update_ranges(This
->child
.reole
, This
->start
+ len
, This
->end
, RANGE_UPDATE_DELETE
);
1679 This
->end
= len
- This
->start
;
1684 static HRESULT
range_GetChar(ME_TextEditor
*editor
, ME_Cursor
*cursor
, LONG
*pch
)
1688 ME_GetTextW(editor
, wch
, 1, cursor
, 1, FALSE
, cursor
->pRun
->next
->type
== diTextEnd
);
1694 static HRESULT WINAPI
ITextRange_fnGetChar(ITextRange
*me
, LONG
*pch
)
1696 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1697 ME_TextEditor
*editor
;
1700 TRACE("(%p)->(%p)\n", This
, pch
);
1702 if (!This
->child
.reole
)
1703 return CO_E_RELEASED
;
1706 return E_INVALIDARG
;
1708 editor
= This
->child
.reole
->editor
;
1709 ME_CursorFromCharOfs(editor
, This
->start
, &cursor
);
1710 return range_GetChar(editor
, &cursor
, pch
);
1713 static HRESULT WINAPI
ITextRange_fnSetChar(ITextRange
*me
, LONG ch
)
1715 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1716 if (!This
->child
.reole
)
1717 return CO_E_RELEASED
;
1719 FIXME("not implemented %p\n", This
);
1723 static HRESULT
CreateITextRange(IRichEditOleImpl
*reOle
, LONG start
, LONG end
, ITextRange
** ppRange
);
1725 static HRESULT WINAPI
ITextRange_fnGetDuplicate(ITextRange
*me
, ITextRange
**ppRange
)
1727 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1729 TRACE("(%p)->(%p)\n", This
, ppRange
);
1731 if (!This
->child
.reole
)
1732 return CO_E_RELEASED
;
1735 return E_INVALIDARG
;
1737 return CreateITextRange(This
->child
.reole
, This
->start
, This
->end
, ppRange
);
1740 static HRESULT WINAPI
ITextRange_fnGetFormattedText(ITextRange
*me
, ITextRange
**ppRange
)
1742 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1743 if (!This
->child
.reole
)
1744 return CO_E_RELEASED
;
1746 FIXME("not implemented %p\n", This
);
1750 static HRESULT WINAPI
ITextRange_fnSetFormattedText(ITextRange
*me
, ITextRange
*pRange
)
1752 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1753 if (!This
->child
.reole
)
1754 return CO_E_RELEASED
;
1756 FIXME("not implemented %p\n", This
);
1760 static HRESULT WINAPI
ITextRange_fnGetStart(ITextRange
*me
, LONG
*start
)
1762 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1764 TRACE("(%p)->(%p)\n", This
, start
);
1766 if (!This
->child
.reole
)
1767 return CO_E_RELEASED
;
1770 return E_INVALIDARG
;
1772 *start
= This
->start
;
1776 static HRESULT
textrange_setstart(const IRichEditOleImpl
*reole
, LONG value
, LONG
*start
, LONG
*end
)
1783 if (value
== *start
)
1786 if (value
<= *end
) {
1791 len
= ME_GetTextLength(reole
->editor
);
1792 *start
= *end
= value
> len
? len
: value
;
1796 static HRESULT WINAPI
ITextRange_fnSetStart(ITextRange
*me
, LONG value
)
1798 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1800 TRACE("(%p)->(%d)\n", This
, value
);
1802 if (!This
->child
.reole
)
1803 return CO_E_RELEASED
;
1805 return textrange_setstart(This
->child
.reole
, value
, &This
->start
, &This
->end
);
1808 static HRESULT WINAPI
ITextRange_fnGetEnd(ITextRange
*me
, LONG
*end
)
1810 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1812 TRACE("(%p)->(%p)\n", This
, end
);
1814 if (!This
->child
.reole
)
1815 return CO_E_RELEASED
;
1818 return E_INVALIDARG
;
1824 static HRESULT
textrange_setend(const IRichEditOleImpl
*reole
, LONG value
, LONG
*start
, LONG
*end
)
1831 if (value
< *start
) {
1832 *start
= *end
= max(0, value
);
1836 len
= ME_GetTextLength(reole
->editor
);
1837 *end
= value
> len
? len
+ 1 : value
;
1841 static HRESULT WINAPI
ITextRange_fnSetEnd(ITextRange
*me
, LONG value
)
1843 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1845 TRACE("(%p)->(%d)\n", This
, value
);
1847 if (!This
->child
.reole
)
1848 return CO_E_RELEASED
;
1850 return textrange_setend(This
->child
.reole
, value
, &This
->start
, &This
->end
);
1853 static HRESULT WINAPI
ITextRange_fnGetFont(ITextRange
*me
, ITextFont
**font
)
1855 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1857 TRACE("(%p)->(%p)\n", This
, font
);
1859 if (!This
->child
.reole
)
1860 return CO_E_RELEASED
;
1863 return E_INVALIDARG
;
1865 return create_textfont(me
, NULL
, font
);
1868 static HRESULT WINAPI
ITextRange_fnSetFont(ITextRange
*me
, ITextFont
*font
)
1870 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1872 TRACE("(%p)->(%p)\n", This
, font
);
1875 return E_INVALIDARG
;
1877 if (!This
->child
.reole
)
1878 return CO_E_RELEASED
;
1880 textrange_set_font(me
, font
);
1884 static HRESULT WINAPI
ITextRange_fnGetPara(ITextRange
*me
, ITextPara
**para
)
1886 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1888 TRACE("(%p)->(%p)\n", This
, para
);
1890 if (!This
->child
.reole
)
1891 return CO_E_RELEASED
;
1894 return E_INVALIDARG
;
1896 return create_textpara(me
, para
);
1899 static HRESULT WINAPI
ITextRange_fnSetPara(ITextRange
*me
, ITextPara
*pPara
)
1901 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1903 if (!This
->child
.reole
)
1904 return CO_E_RELEASED
;
1906 FIXME("not implemented %p\n", This
);
1910 static HRESULT WINAPI
ITextRange_fnGetStoryLength(ITextRange
*me
, LONG
*length
)
1912 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1914 TRACE("(%p)->(%p)\n", This
, length
);
1916 if (!This
->child
.reole
)
1917 return CO_E_RELEASED
;
1919 return textrange_get_storylength(This
->child
.reole
->editor
, length
);
1922 static HRESULT WINAPI
ITextRange_fnGetStoryType(ITextRange
*me
, LONG
*value
)
1924 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1926 TRACE("(%p)->(%p)\n", This
, value
);
1928 if (!This
->child
.reole
)
1929 return CO_E_RELEASED
;
1932 return E_INVALIDARG
;
1934 *value
= tomUnknownStory
;
1938 static HRESULT
range_Collapse(LONG bStart
, LONG
*start
, LONG
*end
)
1943 if (bStart
== tomEnd
|| bStart
== tomFalse
)
1950 static HRESULT WINAPI
ITextRange_fnCollapse(ITextRange
*me
, LONG bStart
)
1952 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1954 TRACE("(%p)->(%d)\n", This
, bStart
);
1956 if (!This
->child
.reole
)
1957 return CO_E_RELEASED
;
1959 return range_Collapse(bStart
, &This
->start
, &This
->end
);
1962 static HRESULT WINAPI
ITextRange_fnExpand(ITextRange
*me
, LONG Unit
, LONG
*pDelta
)
1964 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1965 if (!This
->child
.reole
)
1966 return CO_E_RELEASED
;
1968 FIXME("not implemented %p\n", This
);
1972 static HRESULT WINAPI
ITextRange_fnGetIndex(ITextRange
*me
, LONG Unit
, LONG
*pIndex
)
1974 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1975 if (!This
->child
.reole
)
1976 return CO_E_RELEASED
;
1978 FIXME("not implemented %p\n", This
);
1982 static HRESULT WINAPI
ITextRange_fnSetIndex(ITextRange
*me
, LONG Unit
, LONG Index
,
1985 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1986 if (!This
->child
.reole
)
1987 return CO_E_RELEASED
;
1989 FIXME("not implemented %p\n", This
);
1993 static HRESULT WINAPI
ITextRange_fnSetRange(ITextRange
*me
, LONG cpActive
, LONG cpOther
)
1995 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
1996 if (!This
->child
.reole
)
1997 return CO_E_RELEASED
;
1999 FIXME("not implemented %p\n", This
);
2003 static HRESULT
textrange_inrange(LONG start
, LONG end
, ITextRange
*range
, LONG
*ret
)
2010 if (FAILED(ITextRange_GetStart(range
, &from
)) || FAILED(ITextRange_GetEnd(range
, &to
))) {
2014 *ret
= (start
>= from
&& end
<= to
) ? tomTrue
: tomFalse
;
2015 return *ret
== tomTrue
? S_OK
: S_FALSE
;
2018 static HRESULT WINAPI
ITextRange_fnInRange(ITextRange
*me
, ITextRange
*range
, LONG
*ret
)
2020 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2022 TRACE("(%p)->(%p %p)\n", This
, range
, ret
);
2027 if (!This
->child
.reole
)
2028 return CO_E_RELEASED
;
2033 return textrange_inrange(This
->start
, This
->end
, range
, ret
);
2036 static HRESULT WINAPI
ITextRange_fnInStory(ITextRange
*me
, ITextRange
*pRange
, LONG
*pb
)
2038 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2039 if (!This
->child
.reole
)
2040 return CO_E_RELEASED
;
2042 FIXME("not implemented %p\n", This
);
2046 static HRESULT
textrange_isequal(LONG start
, LONG end
, ITextRange
*range
, LONG
*ret
)
2053 if (FAILED(ITextRange_GetStart(range
, &from
)) || FAILED(ITextRange_GetEnd(range
, &to
))) {
2057 *ret
= (start
== from
&& end
== to
) ? tomTrue
: tomFalse
;
2058 return *ret
== tomTrue
? S_OK
: S_FALSE
;
2061 static HRESULT WINAPI
ITextRange_fnIsEqual(ITextRange
*me
, ITextRange
*range
, LONG
*ret
)
2063 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2065 TRACE("(%p)->(%p %p)\n", This
, range
, ret
);
2070 if (!This
->child
.reole
)
2071 return CO_E_RELEASED
;
2076 return textrange_isequal(This
->start
, This
->end
, range
, ret
);
2079 static HRESULT WINAPI
ITextRange_fnSelect(ITextRange
*me
)
2081 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2083 TRACE("(%p)\n", This
);
2085 if (!This
->child
.reole
)
2086 return CO_E_RELEASED
;
2088 ME_SetSelection(This
->child
.reole
->editor
, This
->start
, This
->end
);
2092 static HRESULT WINAPI
ITextRange_fnStartOf(ITextRange
*me
, LONG Unit
, LONG Extend
,
2095 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2096 if (!This
->child
.reole
)
2097 return CO_E_RELEASED
;
2099 FIXME("not implemented %p\n", This
);
2103 static HRESULT WINAPI
ITextRange_fnEndOf(ITextRange
*me
, LONG Unit
, LONG Extend
,
2106 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2107 if (!This
->child
.reole
)
2108 return CO_E_RELEASED
;
2110 FIXME("not implemented %p\n", This
);
2114 static HRESULT WINAPI
ITextRange_fnMove(ITextRange
*me
, LONG Unit
, LONG Count
, LONG
*pDelta
)
2116 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2117 if (!This
->child
.reole
)
2118 return CO_E_RELEASED
;
2120 FIXME("not implemented %p\n", This
);
2124 static HRESULT WINAPI
ITextRange_fnMoveStart(ITextRange
*me
, LONG Unit
, LONG Count
,
2127 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2128 if (!This
->child
.reole
)
2129 return CO_E_RELEASED
;
2131 FIXME("not implemented %p\n", This
);
2135 static HRESULT WINAPI
ITextRange_fnMoveEnd(ITextRange
*me
, LONG Unit
, LONG Count
,
2138 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2139 if (!This
->child
.reole
)
2140 return CO_E_RELEASED
;
2142 FIXME("not implemented %p\n", This
);
2146 static HRESULT WINAPI
ITextRange_fnMoveWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
2149 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2150 if (!This
->child
.reole
)
2151 return CO_E_RELEASED
;
2153 FIXME("not implemented %p\n", This
);
2157 static HRESULT WINAPI
ITextRange_fnMoveStartWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
2160 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2161 if (!This
->child
.reole
)
2162 return CO_E_RELEASED
;
2164 FIXME("not implemented %p\n", This
);
2168 static HRESULT WINAPI
ITextRange_fnMoveEndWhile(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
2171 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2172 if (!This
->child
.reole
)
2173 return CO_E_RELEASED
;
2175 FIXME("not implemented %p\n", This
);
2179 static HRESULT WINAPI
ITextRange_fnMoveUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
2182 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2183 if (!This
->child
.reole
)
2184 return CO_E_RELEASED
;
2186 FIXME("not implemented %p\n", This
);
2190 static HRESULT WINAPI
ITextRange_fnMoveStartUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
2193 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2194 if (!This
->child
.reole
)
2195 return CO_E_RELEASED
;
2197 FIXME("not implemented %p\n", This
);
2201 static HRESULT WINAPI
ITextRange_fnMoveEndUntil(ITextRange
*me
, VARIANT
*Cset
, LONG Count
,
2204 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2205 if (!This
->child
.reole
)
2206 return CO_E_RELEASED
;
2208 FIXME("not implemented %p\n", This
);
2212 static HRESULT WINAPI
ITextRange_fnFindText(ITextRange
*me
, BSTR bstr
, LONG cch
, LONG Flags
,
2215 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2216 if (!This
->child
.reole
)
2217 return CO_E_RELEASED
;
2219 FIXME("not implemented %p\n", This
);
2223 static HRESULT WINAPI
ITextRange_fnFindTextStart(ITextRange
*me
, BSTR bstr
, LONG cch
,
2224 LONG Flags
, LONG
*pLength
)
2226 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2227 if (!This
->child
.reole
)
2228 return CO_E_RELEASED
;
2230 FIXME("not implemented %p\n", This
);
2234 static HRESULT WINAPI
ITextRange_fnFindTextEnd(ITextRange
*me
, BSTR bstr
, LONG cch
,
2235 LONG Flags
, LONG
*pLength
)
2237 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2238 if (!This
->child
.reole
)
2239 return CO_E_RELEASED
;
2241 FIXME("not implemented %p\n", This
);
2245 static HRESULT WINAPI
ITextRange_fnDelete(ITextRange
*me
, LONG Unit
, LONG Count
,
2248 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2249 if (!This
->child
.reole
)
2250 return CO_E_RELEASED
;
2252 FIXME("not implemented %p\n", This
);
2256 static HRESULT WINAPI
ITextRange_fnCut(ITextRange
*me
, VARIANT
*pVar
)
2258 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2259 if (!This
->child
.reole
)
2260 return CO_E_RELEASED
;
2262 FIXME("not implemented %p\n", This
);
2266 static HRESULT WINAPI
ITextRange_fnCopy(ITextRange
*me
, VARIANT
*pVar
)
2268 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2269 if (!This
->child
.reole
)
2270 return CO_E_RELEASED
;
2272 FIXME("not implemented %p\n", This
);
2276 static HRESULT WINAPI
ITextRange_fnPaste(ITextRange
*me
, VARIANT
*pVar
, LONG Format
)
2278 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2279 if (!This
->child
.reole
)
2280 return CO_E_RELEASED
;
2282 FIXME("not implemented %p\n", This
);
2286 static HRESULT WINAPI
ITextRange_fnCanPaste(ITextRange
*me
, VARIANT
*pVar
, LONG Format
,
2289 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2290 if (!This
->child
.reole
)
2291 return CO_E_RELEASED
;
2293 FIXME("not implemented %p\n", This
);
2297 static HRESULT WINAPI
ITextRange_fnCanEdit(ITextRange
*me
, LONG
*pb
)
2299 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2300 if (!This
->child
.reole
)
2301 return CO_E_RELEASED
;
2303 FIXME("not implemented %p\n", This
);
2307 static HRESULT WINAPI
ITextRange_fnChangeCase(ITextRange
*me
, LONG Type
)
2309 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2310 if (!This
->child
.reole
)
2311 return CO_E_RELEASED
;
2313 FIXME("not implemented %p\n", This
);
2317 static HRESULT WINAPI
ITextRange_fnGetPoint(ITextRange
*me
, LONG Type
, LONG
*cx
, LONG
*cy
)
2319 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2320 if (!This
->child
.reole
)
2321 return CO_E_RELEASED
;
2323 FIXME("not implemented %p\n", This
);
2327 static HRESULT WINAPI
ITextRange_fnSetPoint(ITextRange
*me
, LONG x
, LONG y
, LONG Type
,
2330 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2331 if (!This
->child
.reole
)
2332 return CO_E_RELEASED
;
2334 FIXME("not implemented %p\n", This
);
2338 static HRESULT WINAPI
ITextRange_fnScrollIntoView(ITextRange
*me
, LONG Value
)
2340 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2341 if (!This
->child
.reole
)
2342 return CO_E_RELEASED
;
2344 FIXME("not implemented %p\n", This
);
2348 static HRESULT WINAPI
ITextRange_fnGetEmbeddedObject(ITextRange
*me
, IUnknown
**ppv
)
2350 ITextRangeImpl
*This
= impl_from_ITextRange(me
);
2351 if (!This
->child
.reole
)
2352 return CO_E_RELEASED
;
2354 FIXME("not implemented %p\n", This
);
2358 static const ITextRangeVtbl trvt
= {
2359 ITextRange_fnQueryInterface
,
2360 ITextRange_fnAddRef
,
2361 ITextRange_fnRelease
,
2362 ITextRange_fnGetTypeInfoCount
,
2363 ITextRange_fnGetTypeInfo
,
2364 ITextRange_fnGetIDsOfNames
,
2365 ITextRange_fnInvoke
,
2366 ITextRange_fnGetText
,
2367 ITextRange_fnSetText
,
2368 ITextRange_fnGetChar
,
2369 ITextRange_fnSetChar
,
2370 ITextRange_fnGetDuplicate
,
2371 ITextRange_fnGetFormattedText
,
2372 ITextRange_fnSetFormattedText
,
2373 ITextRange_fnGetStart
,
2374 ITextRange_fnSetStart
,
2375 ITextRange_fnGetEnd
,
2376 ITextRange_fnSetEnd
,
2377 ITextRange_fnGetFont
,
2378 ITextRange_fnSetFont
,
2379 ITextRange_fnGetPara
,
2380 ITextRange_fnSetPara
,
2381 ITextRange_fnGetStoryLength
,
2382 ITextRange_fnGetStoryType
,
2383 ITextRange_fnCollapse
,
2384 ITextRange_fnExpand
,
2385 ITextRange_fnGetIndex
,
2386 ITextRange_fnSetIndex
,
2387 ITextRange_fnSetRange
,
2388 ITextRange_fnInRange
,
2389 ITextRange_fnInStory
,
2390 ITextRange_fnIsEqual
,
2391 ITextRange_fnSelect
,
2392 ITextRange_fnStartOf
,
2395 ITextRange_fnMoveStart
,
2396 ITextRange_fnMoveEnd
,
2397 ITextRange_fnMoveWhile
,
2398 ITextRange_fnMoveStartWhile
,
2399 ITextRange_fnMoveEndWhile
,
2400 ITextRange_fnMoveUntil
,
2401 ITextRange_fnMoveStartUntil
,
2402 ITextRange_fnMoveEndUntil
,
2403 ITextRange_fnFindText
,
2404 ITextRange_fnFindTextStart
,
2405 ITextRange_fnFindTextEnd
,
2406 ITextRange_fnDelete
,
2410 ITextRange_fnCanPaste
,
2411 ITextRange_fnCanEdit
,
2412 ITextRange_fnChangeCase
,
2413 ITextRange_fnGetPoint
,
2414 ITextRange_fnSetPoint
,
2415 ITextRange_fnScrollIntoView
,
2416 ITextRange_fnGetEmbeddedObject
2420 static HRESULT WINAPI
TextFont_QueryInterface(ITextFont
*iface
, REFIID riid
, void **ppv
)
2422 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2424 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
2426 if (IsEqualIID(riid
, &IID_ITextFont
) ||
2427 IsEqualIID(riid
, &IID_IDispatch
) ||
2428 IsEqualIID(riid
, &IID_IUnknown
))
2431 ITextFont_AddRef(iface
);
2436 return E_NOINTERFACE
;
2439 static ULONG WINAPI
TextFont_AddRef(ITextFont
*iface
)
2441 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2442 ULONG ref
= InterlockedIncrement(&This
->ref
);
2443 TRACE("(%p)->(%u)\n", This
, ref
);
2447 static ULONG WINAPI
TextFont_Release(ITextFont
*iface
)
2449 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2450 ULONG ref
= InterlockedDecrement(&This
->ref
);
2452 TRACE("(%p)->(%u)\n", This
, ref
);
2457 ITextRange_Release(This
->range
);
2458 SysFreeString(This
->props
[FONT_NAME
].str
);
2465 static HRESULT WINAPI
TextFont_GetTypeInfoCount(ITextFont
*iface
, UINT
*pctinfo
)
2467 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2468 TRACE("(%p)->(%p)\n", This
, pctinfo
);
2473 static HRESULT WINAPI
TextFont_GetTypeInfo(ITextFont
*iface
, UINT iTInfo
, LCID lcid
,
2474 ITypeInfo
**ppTInfo
)
2476 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2479 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
2481 hr
= get_typeinfo(ITextFont_tid
, ppTInfo
);
2483 ITypeInfo_AddRef(*ppTInfo
);
2487 static HRESULT WINAPI
TextFont_GetIDsOfNames(ITextFont
*iface
, REFIID riid
,
2488 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
2490 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2494 TRACE("(%p)->(%p,%p,%u,%d,%p)\n", This
, riid
, rgszNames
, cNames
, lcid
,
2497 hr
= get_typeinfo(ITextFont_tid
, &ti
);
2499 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
2503 static HRESULT WINAPI
TextFont_Invoke(
2505 DISPID dispIdMember
,
2509 DISPPARAMS
*pDispParams
,
2510 VARIANT
*pVarResult
,
2511 EXCEPINFO
*pExcepInfo
,
2514 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2518 TRACE("(%p)->(%d,%p,%d,%u,%p,%p,%p,%p)\n", This
, dispIdMember
, riid
, lcid
,
2519 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2521 hr
= get_typeinfo(ITextFont_tid
, &ti
);
2523 hr
= ITypeInfo_Invoke(ti
, iface
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
2527 static HRESULT WINAPI
TextFont_GetDuplicate(ITextFont
*iface
, ITextFont
**ret
)
2529 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2531 TRACE("(%p)->(%p)\n", This
, ret
);
2534 return E_INVALIDARG
;
2537 if (This
->range
&& !get_range_reole(This
->range
))
2538 return CO_E_RELEASED
;
2540 return create_textfont(NULL
, This
, ret
);
2543 static HRESULT WINAPI
TextFont_SetDuplicate(ITextFont
*iface
, ITextFont
*pFont
)
2545 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2546 FIXME("(%p)->(%p): stub\n", This
, pFont
);
2550 static HRESULT WINAPI
TextFont_CanChange(ITextFont
*iface
, LONG
*ret
)
2552 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2553 FIXME("(%p)->(%p): stub\n", This
, ret
);
2557 static HRESULT WINAPI
TextFont_IsEqual(ITextFont
*iface
, ITextFont
*font
, LONG
*ret
)
2559 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2560 FIXME("(%p)->(%p %p): stub\n", This
, font
, ret
);
2564 static void textfont_reset_to_default(ITextFontImpl
*font
)
2566 enum textfont_prop_id id
;
2568 for (id
= FONT_PROPID_FIRST
; id
< FONT_PROPID_LAST
; id
++) {
2572 case FONT_ANIMATION
:
2579 case FONT_PROTECTED
:
2581 case FONT_SMALLCAPS
:
2582 case FONT_STRIKETHROUGH
:
2583 case FONT_SUBSCRIPT
:
2584 case FONT_SUPERSCRIPT
:
2585 case FONT_UNDERLINE
:
2586 font
->props
[id
].l
= tomFalse
;
2588 case FONT_BACKCOLOR
:
2589 case FONT_FORECOLOR
:
2590 font
->props
[id
].l
= tomAutoColor
;
2596 font
->props
[id
].f
= 0.0;
2599 font
->props
[id
].l
= GetSystemDefaultLCID();
2602 static const WCHAR sysW
[] = {'S','y','s','t','e','m',0};
2603 SysFreeString(font
->props
[id
].str
);
2604 font
->props
[id
].str
= SysAllocString(sysW
);
2608 font
->props
[id
].l
= FW_NORMAL
;
2611 FIXME("font property %d not handled\n", id
);
2616 static void textfont_reset_to_undefined(ITextFontImpl
*font
)
2618 enum textfont_prop_id id
;
2620 for (id
= FONT_PROPID_FIRST
; id
< FONT_PROPID_LAST
; id
++) {
2624 case FONT_ANIMATION
:
2631 case FONT_PROTECTED
:
2633 case FONT_SMALLCAPS
:
2634 case FONT_STRIKETHROUGH
:
2635 case FONT_SUBSCRIPT
:
2636 case FONT_SUPERSCRIPT
:
2637 case FONT_UNDERLINE
:
2638 case FONT_BACKCOLOR
:
2639 case FONT_FORECOLOR
:
2642 font
->props
[id
].l
= tomUndefined
;
2648 font
->props
[id
].f
= tomUndefined
;
2653 FIXME("font property %d not handled\n", id
);
2658 static void textfont_apply_range_props(ITextFontImpl
*font
)
2660 enum textfont_prop_id propid
;
2661 for (propid
= FONT_PROPID_FIRST
; propid
< FONT_PROPID_LAST
; propid
++)
2662 set_textfont_prop(font
, propid
, &font
->props
[propid
]);
2665 static HRESULT WINAPI
TextFont_Reset(ITextFont
*iface
, LONG value
)
2667 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2669 TRACE("(%p)->(%d)\n", This
, value
);
2671 /* If font is attached to a range, released or not, we can't
2672 reset to undefined */
2674 if (!get_range_reole(This
->range
))
2675 return CO_E_RELEASED
;
2680 return E_INVALIDARG
;
2682 textfont_cache_range_props(This
);
2683 This
->get_cache_enabled
= TRUE
;
2686 This
->get_cache_enabled
= FALSE
;
2689 This
->set_cache_enabled
= TRUE
;
2692 This
->set_cache_enabled
= FALSE
;
2693 textfont_apply_range_props(This
);
2697 return E_INVALIDARG
;
2699 FIXME("reset mode %d not supported\n", value
);
2707 /* reset to global defaults */
2709 textfont_reset_to_default(This
);
2711 /* all properties are set to tomUndefined, font name is retained */
2713 textfont_reset_to_undefined(This
);
2722 return E_INVALIDARG
;
2726 FIXME("reset mode %d not supported\n", value
);
2730 static HRESULT WINAPI
TextFont_GetStyle(ITextFont
*iface
, LONG
*value
)
2732 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2733 FIXME("(%p)->(%p): stub\n", This
, value
);
2737 static HRESULT WINAPI
TextFont_SetStyle(ITextFont
*iface
, LONG value
)
2739 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2740 FIXME("(%p)->(%d): stub\n", This
, value
);
2744 static HRESULT WINAPI
TextFont_GetAllCaps(ITextFont
*iface
, LONG
*value
)
2746 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2747 TRACE("(%p)->(%p)\n", This
, value
);
2748 return get_textfont_propl(This
, FONT_ALLCAPS
, value
);
2751 static HRESULT WINAPI
TextFont_SetAllCaps(ITextFont
*iface
, LONG value
)
2753 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2754 TRACE("(%p)->(%d)\n", This
, value
);
2755 return set_textfont_propd(This
, FONT_ALLCAPS
, value
);
2758 static HRESULT WINAPI
TextFont_GetAnimation(ITextFont
*iface
, LONG
*value
)
2760 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2761 TRACE("(%p)->(%p)\n", This
, value
);
2762 return get_textfont_propl(This
, FONT_ANIMATION
, value
);
2765 static HRESULT WINAPI
TextFont_SetAnimation(ITextFont
*iface
, LONG value
)
2767 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2769 TRACE("(%p)->(%d)\n", This
, value
);
2771 if (value
< tomNoAnimation
|| value
> tomAnimationMax
)
2772 return E_INVALIDARG
;
2774 return set_textfont_propl(This
, FONT_ANIMATION
, value
);
2777 static HRESULT WINAPI
TextFont_GetBackColor(ITextFont
*iface
, LONG
*value
)
2779 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2780 TRACE("(%p)->(%p)\n", This
, value
);
2781 return get_textfont_propl(This
, FONT_BACKCOLOR
, value
);
2784 static HRESULT WINAPI
TextFont_SetBackColor(ITextFont
*iface
, LONG value
)
2786 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2787 TRACE("(%p)->(%d)\n", This
, value
);
2788 return set_textfont_propl(This
, FONT_BACKCOLOR
, value
);
2791 static HRESULT WINAPI
TextFont_GetBold(ITextFont
*iface
, LONG
*value
)
2793 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2794 TRACE("(%p)->(%p)\n", This
, value
);
2795 return get_textfont_propl(This
, FONT_BOLD
, value
);
2798 static HRESULT WINAPI
TextFont_SetBold(ITextFont
*iface
, LONG value
)
2800 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2801 TRACE("(%p)->(%d)\n", This
, value
);
2802 return set_textfont_propd(This
, FONT_BOLD
, value
);
2805 static HRESULT WINAPI
TextFont_GetEmboss(ITextFont
*iface
, LONG
*value
)
2807 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2808 TRACE("(%p)->(%p)\n", This
, value
);
2809 return get_textfont_propl(This
, FONT_EMBOSS
, value
);
2812 static HRESULT WINAPI
TextFont_SetEmboss(ITextFont
*iface
, LONG value
)
2814 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2815 TRACE("(%p)->(%d)\n", This
, value
);
2816 return set_textfont_propd(This
, FONT_EMBOSS
, value
);
2819 static HRESULT WINAPI
TextFont_GetForeColor(ITextFont
*iface
, LONG
*value
)
2821 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2822 TRACE("(%p)->(%p)\n", This
, value
);
2823 return get_textfont_propl(This
, FONT_FORECOLOR
, value
);
2826 static HRESULT WINAPI
TextFont_SetForeColor(ITextFont
*iface
, LONG value
)
2828 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2829 TRACE("(%p)->(%d)\n", This
, value
);
2830 return set_textfont_propl(This
, FONT_FORECOLOR
, value
);
2833 static HRESULT WINAPI
TextFont_GetHidden(ITextFont
*iface
, LONG
*value
)
2835 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2836 TRACE("(%p)->(%p)\n", This
, value
);
2837 return get_textfont_propl(This
, FONT_HIDDEN
, value
);
2840 static HRESULT WINAPI
TextFont_SetHidden(ITextFont
*iface
, LONG value
)
2842 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2843 TRACE("(%p)->(%d)\n", This
, value
);
2844 return set_textfont_propd(This
, FONT_HIDDEN
, value
);
2847 static HRESULT WINAPI
TextFont_GetEngrave(ITextFont
*iface
, LONG
*value
)
2849 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2850 TRACE("(%p)->(%p)\n", This
, value
);
2851 return get_textfont_propl(This
, FONT_ENGRAVE
, value
);
2854 static HRESULT WINAPI
TextFont_SetEngrave(ITextFont
*iface
, LONG value
)
2856 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2857 TRACE("(%p)->(%d)\n", This
, value
);
2858 return set_textfont_propd(This
, FONT_ENGRAVE
, value
);
2861 static HRESULT WINAPI
TextFont_GetItalic(ITextFont
*iface
, LONG
*value
)
2863 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2864 TRACE("(%p)->(%p)\n", This
, value
);
2865 return get_textfont_propl(This
, FONT_ITALIC
, value
);
2868 static HRESULT WINAPI
TextFont_SetItalic(ITextFont
*iface
, LONG value
)
2870 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2871 TRACE("(%p)->(%d)\n", This
, value
);
2872 return set_textfont_propd(This
, FONT_ITALIC
, value
);
2875 static HRESULT WINAPI
TextFont_GetKerning(ITextFont
*iface
, FLOAT
*value
)
2877 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2878 TRACE("(%p)->(%p)\n", This
, value
);
2879 return get_textfont_propf(This
, FONT_KERNING
, value
);
2882 static HRESULT WINAPI
TextFont_SetKerning(ITextFont
*iface
, FLOAT value
)
2884 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2885 TRACE("(%p)->(%.2f)\n", This
, value
);
2886 return set_textfont_propf(This
, FONT_KERNING
, value
);
2889 static HRESULT WINAPI
TextFont_GetLanguageID(ITextFont
*iface
, LONG
*value
)
2891 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2892 TRACE("(%p)->(%p)\n", This
, value
);
2893 return get_textfont_propl(This
, FONT_LANGID
, value
);
2896 static HRESULT WINAPI
TextFont_SetLanguageID(ITextFont
*iface
, LONG value
)
2898 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2899 TRACE("(%p)->(%d)\n", This
, value
);
2900 return set_textfont_propl(This
, FONT_LANGID
, value
);
2903 static HRESULT WINAPI
TextFont_GetName(ITextFont
*iface
, BSTR
*value
)
2905 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2907 TRACE("(%p)->(%p)\n", This
, value
);
2910 return E_INVALIDARG
;
2915 if (This
->props
[FONT_NAME
].str
)
2916 *value
= SysAllocString(This
->props
[FONT_NAME
].str
);
2918 *value
= SysAllocStringLen(NULL
, 0);
2919 return *value
? S_OK
: E_OUTOFMEMORY
;
2922 return textfont_getname_from_range(This
->range
, value
);
2925 static HRESULT WINAPI
TextFont_SetName(ITextFont
*iface
, BSTR value
)
2927 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2928 textfont_prop_val v
;
2930 TRACE("(%p)->(%s)\n", This
, debugstr_w(value
));
2933 return set_textfont_prop(This
, FONT_NAME
, &v
);
2936 static HRESULT WINAPI
TextFont_GetOutline(ITextFont
*iface
, LONG
*value
)
2938 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2939 TRACE("(%p)->(%p)\n", This
, value
);
2940 return get_textfont_propl(This
, FONT_OUTLINE
, value
);
2943 static HRESULT WINAPI
TextFont_SetOutline(ITextFont
*iface
, LONG value
)
2945 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2946 TRACE("(%p)->(%d)\n", This
, value
);
2947 return set_textfont_propd(This
, FONT_OUTLINE
, value
);
2950 static HRESULT WINAPI
TextFont_GetPosition(ITextFont
*iface
, FLOAT
*value
)
2952 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2953 TRACE("(%p)->(%p)\n", This
, value
);
2954 return get_textfont_propf(This
, FONT_POSITION
, value
);
2957 static HRESULT WINAPI
TextFont_SetPosition(ITextFont
*iface
, FLOAT value
)
2959 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2960 TRACE("(%p)->(%.2f)\n", This
, value
);
2961 return set_textfont_propf(This
, FONT_POSITION
, value
);
2964 static HRESULT WINAPI
TextFont_GetProtected(ITextFont
*iface
, LONG
*value
)
2966 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2967 TRACE("(%p)->(%p)\n", This
, value
);
2968 return get_textfont_propl(This
, FONT_PROTECTED
, value
);
2971 static HRESULT WINAPI
TextFont_SetProtected(ITextFont
*iface
, LONG value
)
2973 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2974 TRACE("(%p)->(%d)\n", This
, value
);
2975 return set_textfont_propd(This
, FONT_PROTECTED
, value
);
2978 static HRESULT WINAPI
TextFont_GetShadow(ITextFont
*iface
, LONG
*value
)
2980 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2981 TRACE("(%p)->(%p)\n", This
, value
);
2982 return get_textfont_propl(This
, FONT_SHADOW
, value
);
2985 static HRESULT WINAPI
TextFont_SetShadow(ITextFont
*iface
, LONG value
)
2987 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2988 TRACE("(%p)->(%d)\n", This
, value
);
2989 return set_textfont_propd(This
, FONT_SHADOW
, value
);
2992 static HRESULT WINAPI
TextFont_GetSize(ITextFont
*iface
, FLOAT
*value
)
2994 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
2995 TRACE("(%p)->(%p)\n", This
, value
);
2996 return get_textfont_propf(This
, FONT_SIZE
, value
);
2999 static HRESULT WINAPI
TextFont_SetSize(ITextFont
*iface
, FLOAT value
)
3001 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3002 TRACE("(%p)->(%.2f)\n", This
, value
);
3003 return set_textfont_propf(This
, FONT_SIZE
, value
);
3006 static HRESULT WINAPI
TextFont_GetSmallCaps(ITextFont
*iface
, LONG
*value
)
3008 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3009 TRACE("(%p)->(%p)\n", This
, value
);
3010 return get_textfont_propl(This
, FONT_SMALLCAPS
, value
);
3013 static HRESULT WINAPI
TextFont_SetSmallCaps(ITextFont
*iface
, LONG value
)
3015 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3016 TRACE("(%p)->(%d)\n", This
, value
);
3017 return set_textfont_propd(This
, FONT_SMALLCAPS
, value
);
3020 static HRESULT WINAPI
TextFont_GetSpacing(ITextFont
*iface
, FLOAT
*value
)
3022 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3023 TRACE("(%p)->(%p)\n", This
, value
);
3024 return get_textfont_propf(This
, FONT_SPACING
, value
);
3027 static HRESULT WINAPI
TextFont_SetSpacing(ITextFont
*iface
, FLOAT value
)
3029 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3030 TRACE("(%p)->(%.2f)\n", This
, value
);
3031 return set_textfont_propf(This
, FONT_SPACING
, value
);
3034 static HRESULT WINAPI
TextFont_GetStrikeThrough(ITextFont
*iface
, LONG
*value
)
3036 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3037 TRACE("(%p)->(%p)\n", This
, value
);
3038 return get_textfont_propl(This
, FONT_STRIKETHROUGH
, value
);
3041 static HRESULT WINAPI
TextFont_SetStrikeThrough(ITextFont
*iface
, LONG value
)
3043 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3044 TRACE("(%p)->(%d)\n", This
, value
);
3045 return set_textfont_propd(This
, FONT_STRIKETHROUGH
, value
);
3048 static HRESULT WINAPI
TextFont_GetSubscript(ITextFont
*iface
, LONG
*value
)
3050 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3051 TRACE("(%p)->(%p)\n", This
, value
);
3052 return get_textfont_propl(This
, FONT_SUBSCRIPT
, value
);
3055 static HRESULT WINAPI
TextFont_SetSubscript(ITextFont
*iface
, LONG value
)
3057 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3058 TRACE("(%p)->(%d)\n", This
, value
);
3059 return set_textfont_propd(This
, FONT_SUBSCRIPT
, value
);
3062 static HRESULT WINAPI
TextFont_GetSuperscript(ITextFont
*iface
, LONG
*value
)
3064 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3065 TRACE("(%p)->(%p)\n", This
, value
);
3066 return get_textfont_propl(This
, FONT_SUPERSCRIPT
, value
);
3069 static HRESULT WINAPI
TextFont_SetSuperscript(ITextFont
*iface
, LONG value
)
3071 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3072 TRACE("(%p)->(%d)\n", This
, value
);
3073 return set_textfont_propd(This
, FONT_SUPERSCRIPT
, value
);
3076 static HRESULT WINAPI
TextFont_GetUnderline(ITextFont
*iface
, LONG
*value
)
3078 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3079 TRACE("(%p)->(%p)\n", This
, value
);
3080 return get_textfont_propl(This
, FONT_UNDERLINE
, value
);
3083 static HRESULT WINAPI
TextFont_SetUnderline(ITextFont
*iface
, LONG value
)
3085 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3086 TRACE("(%p)->(%d)\n", This
, value
);
3087 return set_textfont_propd(This
, FONT_UNDERLINE
, value
);
3090 static HRESULT WINAPI
TextFont_GetWeight(ITextFont
*iface
, LONG
*value
)
3092 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3093 TRACE("(%p)->(%p)\n", This
, value
);
3094 return get_textfont_propl(This
, FONT_WEIGHT
, value
);
3097 static HRESULT WINAPI
TextFont_SetWeight(ITextFont
*iface
, LONG value
)
3099 ITextFontImpl
*This
= impl_from_ITextFont(iface
);
3100 TRACE("(%p)->(%d)\n", This
, value
);
3101 return set_textfont_propl(This
, FONT_WEIGHT
, value
);
3104 static ITextFontVtbl textfontvtbl
= {
3105 TextFont_QueryInterface
,
3108 TextFont_GetTypeInfoCount
,
3109 TextFont_GetTypeInfo
,
3110 TextFont_GetIDsOfNames
,
3112 TextFont_GetDuplicate
,
3113 TextFont_SetDuplicate
,
3119 TextFont_GetAllCaps
,
3120 TextFont_SetAllCaps
,
3121 TextFont_GetAnimation
,
3122 TextFont_SetAnimation
,
3123 TextFont_GetBackColor
,
3124 TextFont_SetBackColor
,
3129 TextFont_GetForeColor
,
3130 TextFont_SetForeColor
,
3133 TextFont_GetEngrave
,
3134 TextFont_SetEngrave
,
3137 TextFont_GetKerning
,
3138 TextFont_SetKerning
,
3139 TextFont_GetLanguageID
,
3140 TextFont_SetLanguageID
,
3143 TextFont_GetOutline
,
3144 TextFont_SetOutline
,
3145 TextFont_GetPosition
,
3146 TextFont_SetPosition
,
3147 TextFont_GetProtected
,
3148 TextFont_SetProtected
,
3153 TextFont_GetSmallCaps
,
3154 TextFont_SetSmallCaps
,
3155 TextFont_GetSpacing
,
3156 TextFont_SetSpacing
,
3157 TextFont_GetStrikeThrough
,
3158 TextFont_SetStrikeThrough
,
3159 TextFont_GetSubscript
,
3160 TextFont_SetSubscript
,
3161 TextFont_GetSuperscript
,
3162 TextFont_SetSuperscript
,
3163 TextFont_GetUnderline
,
3164 TextFont_SetUnderline
,
3169 static HRESULT
create_textfont(ITextRange
*range
, const ITextFontImpl
*src
, ITextFont
**ret
)
3171 ITextFontImpl
*font
;
3174 font
= heap_alloc(sizeof(*font
));
3176 return E_OUTOFMEMORY
;
3178 font
->ITextFont_iface
.lpVtbl
= &textfontvtbl
;
3183 font
->get_cache_enabled
= TRUE
;
3184 font
->set_cache_enabled
= TRUE
;
3185 memcpy(&font
->props
, &src
->props
, sizeof(font
->props
));
3186 if (font
->props
[FONT_NAME
].str
)
3187 font
->props
[FONT_NAME
].str
= SysAllocString(font
->props
[FONT_NAME
].str
);
3190 font
->range
= range
;
3191 ITextRange_AddRef(range
);
3193 /* cache current properties */
3194 font
->get_cache_enabled
= FALSE
;
3195 font
->set_cache_enabled
= FALSE
;
3196 textfont_cache_range_props(font
);
3199 *ret
= &font
->ITextFont_iface
;
3204 static HRESULT WINAPI
TextPara_QueryInterface(ITextPara
*iface
, REFIID riid
, void **ppv
)
3206 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3208 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppv
);
3210 if (IsEqualIID(riid
, &IID_ITextPara
) ||
3211 IsEqualIID(riid
, &IID_IDispatch
) ||
3212 IsEqualIID(riid
, &IID_IUnknown
))
3215 ITextPara_AddRef(iface
);
3220 return E_NOINTERFACE
;
3223 static ULONG WINAPI
TextPara_AddRef(ITextPara
*iface
)
3225 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3226 ULONG ref
= InterlockedIncrement(&This
->ref
);
3227 TRACE("(%p)->(%u)\n", This
, ref
);
3231 static ULONG WINAPI
TextPara_Release(ITextPara
*iface
)
3233 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3234 ULONG ref
= InterlockedDecrement(&This
->ref
);
3236 TRACE("(%p)->(%u)\n", This
, ref
);
3240 ITextRange_Release(This
->range
);
3247 static HRESULT WINAPI
TextPara_GetTypeInfoCount(ITextPara
*iface
, UINT
*pctinfo
)
3249 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3250 TRACE("(%p)->(%p)\n", This
, pctinfo
);
3255 static HRESULT WINAPI
TextPara_GetTypeInfo(ITextPara
*iface
, UINT iTInfo
, LCID lcid
,
3256 ITypeInfo
**ppTInfo
)
3258 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3261 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
3263 hr
= get_typeinfo(ITextPara_tid
, ppTInfo
);
3265 ITypeInfo_AddRef(*ppTInfo
);
3269 static HRESULT WINAPI
TextPara_GetIDsOfNames(ITextPara
*iface
, REFIID riid
,
3270 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
3272 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3276 TRACE("(%p)->(%p,%p,%u,%d,%p)\n", This
, riid
, rgszNames
, cNames
, lcid
,
3279 hr
= get_typeinfo(ITextPara_tid
, &ti
);
3281 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
3285 static HRESULT WINAPI
TextPara_Invoke(
3287 DISPID dispIdMember
,
3291 DISPPARAMS
*pDispParams
,
3292 VARIANT
*pVarResult
,
3293 EXCEPINFO
*pExcepInfo
,
3296 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3300 TRACE("(%p)->(%d,%p,%d,%u,%p,%p,%p,%p)\n", This
, dispIdMember
, riid
, lcid
,
3301 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3303 hr
= get_typeinfo(ITextPara_tid
, &ti
);
3305 hr
= ITypeInfo_Invoke(ti
, iface
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3309 static HRESULT WINAPI
TextPara_GetDuplicate(ITextPara
*iface
, ITextPara
**ret
)
3311 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3312 FIXME("(%p)->(%p)\n", This
, ret
);
3316 static HRESULT WINAPI
TextPara_SetDuplicate(ITextPara
*iface
, ITextPara
*para
)
3318 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3319 FIXME("(%p)->(%p)\n", This
, para
);
3323 static HRESULT WINAPI
TextPara_CanChange(ITextPara
*iface
, LONG
*ret
)
3325 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3326 FIXME("(%p)->(%p)\n", This
, ret
);
3330 static HRESULT WINAPI
TextPara_IsEqual(ITextPara
*iface
, ITextPara
*para
, LONG
*ret
)
3332 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3333 FIXME("(%p)->(%p %p)\n", This
, para
, ret
);
3337 static HRESULT WINAPI
TextPara_Reset(ITextPara
*iface
, LONG value
)
3339 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3340 FIXME("(%p)->(%d)\n", This
, value
);
3344 static HRESULT WINAPI
TextPara_GetStyle(ITextPara
*iface
, LONG
*value
)
3346 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3347 FIXME("(%p)->(%p)\n", This
, value
);
3351 static HRESULT WINAPI
TextPara_SetStyle(ITextPara
*iface
, LONG value
)
3353 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3354 FIXME("(%p)->(%d)\n", This
, value
);
3358 static HRESULT WINAPI
TextPara_GetAlignment(ITextPara
*iface
, LONG
*value
)
3360 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3361 FIXME("(%p)->(%p)\n", This
, value
);
3365 static HRESULT WINAPI
TextPara_SetAlignment(ITextPara
*iface
, LONG value
)
3367 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3368 FIXME("(%p)->(%d)\n", This
, value
);
3372 static HRESULT WINAPI
TextPara_GetHyphenation(ITextPara
*iface
, LONG
*value
)
3374 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3375 FIXME("(%p)->(%p)\n", This
, value
);
3379 static HRESULT WINAPI
TextPara_SetHyphenation(ITextPara
*iface
, LONG value
)
3381 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3382 FIXME("(%p)->(%d)\n", This
, value
);
3386 static HRESULT WINAPI
TextPara_GetFirstLineIndent(ITextPara
*iface
, FLOAT
*value
)
3388 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3389 FIXME("(%p)->(%p)\n", This
, value
);
3393 static HRESULT WINAPI
TextPara_GetKeepTogether(ITextPara
*iface
, LONG
*value
)
3395 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3396 FIXME("(%p)->(%p)\n", This
, value
);
3400 static HRESULT WINAPI
TextPara_SetKeepTogether(ITextPara
*iface
, LONG value
)
3402 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3403 FIXME("(%p)->(%d)\n", This
, value
);
3407 static HRESULT WINAPI
TextPara_GetKeepWithNext(ITextPara
*iface
, LONG
*value
)
3409 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3410 FIXME("(%p)->(%p)\n", This
, value
);
3414 static HRESULT WINAPI
TextPara_SetKeepWithNext(ITextPara
*iface
, LONG value
)
3416 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3417 FIXME("(%p)->(%d)\n", This
, value
);
3421 static HRESULT WINAPI
TextPara_GetLeftIndent(ITextPara
*iface
, FLOAT
*value
)
3423 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3424 FIXME("(%p)->(%p)\n", This
, value
);
3428 static HRESULT WINAPI
TextPara_GetLineSpacing(ITextPara
*iface
, FLOAT
*value
)
3430 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3431 FIXME("(%p)->(%p)\n", This
, value
);
3435 static HRESULT WINAPI
TextPara_GetLineSpacingRule(ITextPara
*iface
, LONG
*value
)
3437 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3438 FIXME("(%p)->(%p)\n", This
, value
);
3442 static HRESULT WINAPI
TextPara_GetListAlignment(ITextPara
*iface
, LONG
*value
)
3444 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3445 FIXME("(%p)->(%p)\n", This
, value
);
3449 static HRESULT WINAPI
TextPara_SetListAlignment(ITextPara
*iface
, LONG value
)
3451 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3452 FIXME("(%p)->(%d)\n", This
, value
);
3456 static HRESULT WINAPI
TextPara_GetListLevelIndex(ITextPara
*iface
, LONG
*value
)
3458 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3459 FIXME("(%p)->(%p)\n", This
, value
);
3463 static HRESULT WINAPI
TextPara_SetListLevelIndex(ITextPara
*iface
, LONG value
)
3465 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3466 FIXME("(%p)->(%d)\n", This
, value
);
3470 static HRESULT WINAPI
TextPara_GetListStart(ITextPara
*iface
, LONG
*value
)
3472 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3473 FIXME("(%p)->(%p)\n", This
, value
);
3477 static HRESULT WINAPI
TextPara_SetListStart(ITextPara
*iface
, LONG value
)
3479 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3480 FIXME("(%p)->(%d)\n", This
, value
);
3484 static HRESULT WINAPI
TextPara_GetListTab(ITextPara
*iface
, FLOAT
*value
)
3486 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3487 FIXME("(%p)->(%p)\n", This
, value
);
3491 static HRESULT WINAPI
TextPara_SetListTab(ITextPara
*iface
, FLOAT value
)
3493 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3494 FIXME("(%p)->(%.2f)\n", This
, value
);
3498 static HRESULT WINAPI
TextPara_GetListType(ITextPara
*iface
, LONG
*value
)
3500 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3501 FIXME("(%p)->(%p)\n", This
, value
);
3505 static HRESULT WINAPI
TextPara_SetListType(ITextPara
*iface
, LONG value
)
3507 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3508 FIXME("(%p)->(%d)\n", This
, value
);
3512 static HRESULT WINAPI
TextPara_GetNoLineNumber(ITextPara
*iface
, LONG
*value
)
3514 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3515 FIXME("(%p)->(%p)\n", This
, value
);
3519 static HRESULT WINAPI
TextPara_SetNoLineNumber(ITextPara
*iface
, LONG value
)
3521 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3522 FIXME("(%p)->(%d)\n", This
, value
);
3526 static HRESULT WINAPI
TextPara_GetPageBreakBefore(ITextPara
*iface
, LONG
*value
)
3528 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3529 FIXME("(%p)->(%p)\n", This
, value
);
3533 static HRESULT WINAPI
TextPara_SetPageBreakBefore(ITextPara
*iface
, LONG value
)
3535 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3536 FIXME("(%p)->(%d)\n", This
, value
);
3540 static HRESULT WINAPI
TextPara_GetRightIndent(ITextPara
*iface
, FLOAT
*value
)
3542 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3543 FIXME("(%p)->(%p)\n", This
, value
);
3547 static HRESULT WINAPI
TextPara_SetRightIndent(ITextPara
*iface
, FLOAT value
)
3549 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3550 FIXME("(%p)->(%.2f)\n", This
, value
);
3554 static HRESULT WINAPI
TextPara_SetIndents(ITextPara
*iface
, FLOAT StartIndent
, FLOAT LeftIndent
, FLOAT RightIndent
)
3556 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3557 FIXME("(%p)->(%.2f %.2f %.2f)\n", This
, StartIndent
, LeftIndent
, RightIndent
);
3561 static HRESULT WINAPI
TextPara_SetLineSpacing(ITextPara
*iface
, LONG LineSpacingRule
, FLOAT LineSpacing
)
3563 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3564 FIXME("(%p)->(%d %.2f)\n", This
, LineSpacingRule
, LineSpacing
);
3568 static HRESULT WINAPI
TextPara_GetSpaceAfter(ITextPara
*iface
, FLOAT
*value
)
3570 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3571 FIXME("(%p)->(%p)\n", This
, value
);
3575 static HRESULT WINAPI
TextPara_SetSpaceAfter(ITextPara
*iface
, FLOAT value
)
3577 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3578 FIXME("(%p)->(%.2f)\n", This
, value
);
3582 static HRESULT WINAPI
TextPara_GetSpaceBefore(ITextPara
*iface
, FLOAT
*value
)
3584 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3585 FIXME("(%p)->(%p)\n", This
, value
);
3589 static HRESULT WINAPI
TextPara_SetSpaceBefore(ITextPara
*iface
, FLOAT value
)
3591 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3592 FIXME("(%p)->(%.2f)\n", This
, value
);
3596 static HRESULT WINAPI
TextPara_GetWidowControl(ITextPara
*iface
, LONG
*value
)
3598 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3599 FIXME("(%p)->(%p)\n", This
, value
);
3603 static HRESULT WINAPI
TextPara_SetWidowControl(ITextPara
*iface
, LONG value
)
3605 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3606 FIXME("(%p)->(%d)\n", This
, value
);
3610 static HRESULT WINAPI
TextPara_GetTabCount(ITextPara
*iface
, LONG
*value
)
3612 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3613 FIXME("(%p)->(%p)\n", This
, value
);
3617 static HRESULT WINAPI
TextPara_AddTab(ITextPara
*iface
, FLOAT tbPos
, LONG tbAlign
, LONG tbLeader
)
3619 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3620 FIXME("(%p)->(%.2f %d %d)\n", This
, tbPos
, tbAlign
, tbLeader
);
3624 static HRESULT WINAPI
TextPara_ClearAllTabs(ITextPara
*iface
)
3626 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3627 FIXME("(%p)\n", This
);
3631 static HRESULT WINAPI
TextPara_DeleteTab(ITextPara
*iface
, FLOAT pos
)
3633 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3634 FIXME("(%p)->(%.2f)\n", This
, pos
);
3638 static HRESULT WINAPI
TextPara_GetTab(ITextPara
*iface
, LONG iTab
, FLOAT
*ptbPos
, LONG
*ptbAlign
, LONG
*ptbLeader
)
3640 ITextParaImpl
*This
= impl_from_ITextPara(iface
);
3641 FIXME("(%p)->(%d %p %p %p)\n", This
, iTab
, ptbPos
, ptbAlign
, ptbLeader
);
3645 static ITextParaVtbl textparavtbl
= {
3646 TextPara_QueryInterface
,
3649 TextPara_GetTypeInfoCount
,
3650 TextPara_GetTypeInfo
,
3651 TextPara_GetIDsOfNames
,
3653 TextPara_GetDuplicate
,
3654 TextPara_SetDuplicate
,
3660 TextPara_GetAlignment
,
3661 TextPara_SetAlignment
,
3662 TextPara_GetHyphenation
,
3663 TextPara_SetHyphenation
,
3664 TextPara_GetFirstLineIndent
,
3665 TextPara_GetKeepTogether
,
3666 TextPara_SetKeepTogether
,
3667 TextPara_GetKeepWithNext
,
3668 TextPara_SetKeepWithNext
,
3669 TextPara_GetLeftIndent
,
3670 TextPara_GetLineSpacing
,
3671 TextPara_GetLineSpacingRule
,
3672 TextPara_GetListAlignment
,
3673 TextPara_SetListAlignment
,
3674 TextPara_GetListLevelIndex
,
3675 TextPara_SetListLevelIndex
,
3676 TextPara_GetListStart
,
3677 TextPara_SetListStart
,
3678 TextPara_GetListTab
,
3679 TextPara_SetListTab
,
3680 TextPara_GetListType
,
3681 TextPara_SetListType
,
3682 TextPara_GetNoLineNumber
,
3683 TextPara_SetNoLineNumber
,
3684 TextPara_GetPageBreakBefore
,
3685 TextPara_SetPageBreakBefore
,
3686 TextPara_GetRightIndent
,
3687 TextPara_SetRightIndent
,
3688 TextPara_SetIndents
,
3689 TextPara_SetLineSpacing
,
3690 TextPara_GetSpaceAfter
,
3691 TextPara_SetSpaceAfter
,
3692 TextPara_GetSpaceBefore
,
3693 TextPara_SetSpaceBefore
,
3694 TextPara_GetWidowControl
,
3695 TextPara_SetWidowControl
,
3696 TextPara_GetTabCount
,
3698 TextPara_ClearAllTabs
,
3703 static HRESULT
create_textpara(ITextRange
*range
, ITextPara
**ret
)
3705 ITextParaImpl
*para
;
3708 para
= heap_alloc(sizeof(*para
));
3710 return E_OUTOFMEMORY
;
3712 para
->ITextPara_iface
.lpVtbl
= &textparavtbl
;
3714 para
->range
= range
;
3715 ITextRange_AddRef(range
);
3717 *ret
= ¶
->ITextPara_iface
;
3722 static HRESULT WINAPI
3723 ITextDocument_fnQueryInterface(ITextDocument
* me
, REFIID riid
,
3726 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3727 return IRichEditOle_QueryInterface(&This
->IRichEditOle_iface
, riid
, ppvObject
);
3731 ITextDocument_fnAddRef(ITextDocument
* me
)
3733 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3734 return IRichEditOle_AddRef(&This
->IRichEditOle_iface
);
3738 ITextDocument_fnRelease(ITextDocument
* me
)
3740 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3741 return IRichEditOle_Release(&This
->IRichEditOle_iface
);
3744 static HRESULT WINAPI
3745 ITextDocument_fnGetTypeInfoCount(ITextDocument
* me
,
3748 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3749 TRACE("(%p)->(%p)\n", This
, pctinfo
);
3754 static HRESULT WINAPI
3755 ITextDocument_fnGetTypeInfo(ITextDocument
* me
, UINT iTInfo
, LCID lcid
,
3756 ITypeInfo
** ppTInfo
)
3758 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3761 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
3763 hr
= get_typeinfo(ITextDocument_tid
, ppTInfo
);
3765 ITypeInfo_AddRef(*ppTInfo
);
3769 static HRESULT WINAPI
3770 ITextDocument_fnGetIDsOfNames(ITextDocument
* me
, REFIID riid
,
3771 LPOLESTR
* rgszNames
, UINT cNames
, LCID lcid
, DISPID
* rgDispId
)
3773 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3777 TRACE("(%p)->(%p,%p,%u,%d,%p)\n", This
, riid
, rgszNames
, cNames
, lcid
,
3780 hr
= get_typeinfo(ITextDocument_tid
, &ti
);
3782 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
3786 static HRESULT WINAPI
3787 ITextDocument_fnInvoke(ITextDocument
* me
, DISPID dispIdMember
,
3788 REFIID riid
, LCID lcid
, WORD wFlags
, DISPPARAMS
* pDispParams
,
3789 VARIANT
* pVarResult
, EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
)
3791 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3795 TRACE("(%p)->(%d,%p,%d,%u,%p,%p,%p,%p)\n", This
, dispIdMember
, riid
, lcid
,
3796 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3798 hr
= get_typeinfo(ITextDocument_tid
, &ti
);
3800 hr
= ITypeInfo_Invoke(ti
, me
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
3804 static HRESULT WINAPI
3805 ITextDocument_fnGetName(ITextDocument
* me
, BSTR
* pName
)
3807 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3808 FIXME("stub %p\n",This
);
3812 static HRESULT WINAPI
3813 ITextDocument_fnGetSelection(ITextDocument
*me
, ITextSelection
**selection
)
3815 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3817 TRACE("(%p)->(%p)\n", me
, selection
);
3820 return E_INVALIDARG
;
3822 if (!This
->txtSel
) {
3823 This
->txtSel
= CreateTextSelection(This
);
3824 if (!This
->txtSel
) {
3826 return E_OUTOFMEMORY
;
3830 *selection
= &This
->txtSel
->ITextSelection_iface
;
3831 ITextSelection_AddRef(*selection
);
3835 static HRESULT WINAPI
3836 ITextDocument_fnGetStoryCount(ITextDocument
* me
, LONG
* pCount
)
3838 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3839 FIXME("stub %p\n",This
);
3843 static HRESULT WINAPI
3844 ITextDocument_fnGetStoryRanges(ITextDocument
* me
,
3845 ITextStoryRanges
** ppStories
)
3847 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3848 FIXME("stub %p\n",This
);
3852 static HRESULT WINAPI
3853 ITextDocument_fnGetSaved(ITextDocument
* me
, LONG
* pValue
)
3855 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3856 FIXME("stub %p\n",This
);
3860 static HRESULT WINAPI
3861 ITextDocument_fnSetSaved(ITextDocument
* me
, LONG Value
)
3863 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3864 FIXME("stub %p\n",This
);
3868 static HRESULT WINAPI
3869 ITextDocument_fnGetDefaultTabStop(ITextDocument
* me
, float* pValue
)
3871 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3872 FIXME("stub %p\n",This
);
3876 static HRESULT WINAPI
3877 ITextDocument_fnSetDefaultTabStop(ITextDocument
* me
, float Value
)
3879 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3880 FIXME("stub %p\n",This
);
3884 static HRESULT WINAPI
3885 ITextDocument_fnNew(ITextDocument
* me
)
3887 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3888 FIXME("stub %p\n",This
);
3892 static HRESULT WINAPI
3893 ITextDocument_fnOpen(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
3896 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3897 FIXME("stub %p\n",This
);
3901 static HRESULT WINAPI
3902 ITextDocument_fnSave(ITextDocument
* me
, VARIANT
* pVar
, LONG Flags
,
3905 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3906 FIXME("stub %p\n",This
);
3910 static HRESULT WINAPI
3911 ITextDocument_fnFreeze(ITextDocument
* me
, LONG
* pCount
)
3913 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3914 FIXME("stub %p\n",This
);
3918 static HRESULT WINAPI
3919 ITextDocument_fnUnfreeze(ITextDocument
* me
, LONG
* pCount
)
3921 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3922 FIXME("stub %p\n",This
);
3926 static HRESULT WINAPI
3927 ITextDocument_fnBeginEditCollection(ITextDocument
* me
)
3929 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3930 FIXME("stub %p\n",This
);
3934 static HRESULT WINAPI
3935 ITextDocument_fnEndEditCollection(ITextDocument
* me
)
3937 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3938 FIXME("stub %p\n",This
);
3942 static HRESULT WINAPI
3943 ITextDocument_fnUndo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
3945 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3946 FIXME("stub %p\n",This
);
3950 static HRESULT WINAPI
3951 ITextDocument_fnRedo(ITextDocument
* me
, LONG Count
, LONG
* prop
)
3953 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3954 FIXME("stub %p\n",This
);
3958 static HRESULT
CreateITextRange(IRichEditOleImpl
*reOle
, LONG start
, LONG end
, ITextRange
** ppRange
)
3960 ITextRangeImpl
*txtRge
= heap_alloc(sizeof(ITextRangeImpl
));
3963 return E_OUTOFMEMORY
;
3964 txtRge
->ITextRange_iface
.lpVtbl
= &trvt
;
3966 txtRge
->child
.reole
= reOle
;
3967 txtRge
->start
= start
;
3969 list_add_head(&reOle
->rangelist
, &txtRge
->child
.entry
);
3970 *ppRange
= &txtRge
->ITextRange_iface
;
3974 static HRESULT WINAPI
3975 ITextDocument_fnRange(ITextDocument
* me
, LONG cp1
, LONG cp2
,
3976 ITextRange
** ppRange
)
3978 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
3979 const int len
= ME_GetTextLength(This
->editor
) + 1;
3981 TRACE("%p %p %d %d\n", This
, ppRange
, cp1
, cp2
);
3983 return E_INVALIDARG
;
3987 cp1
= min(cp1
, len
);
3988 cp2
= min(cp2
, len
);
3997 cp1
= cp2
= len
- 1;
3999 return CreateITextRange(This
, cp1
, cp2
, ppRange
);
4002 static HRESULT WINAPI
4003 ITextDocument_fnRangeFromPoint(ITextDocument
* me
, LONG x
, LONG y
,
4004 ITextRange
** ppRange
)
4006 IRichEditOleImpl
*This
= impl_from_ITextDocument(me
);
4007 FIXME("stub %p\n",This
);
4011 static const ITextDocumentVtbl tdvt
= {
4012 ITextDocument_fnQueryInterface
,
4013 ITextDocument_fnAddRef
,
4014 ITextDocument_fnRelease
,
4015 ITextDocument_fnGetTypeInfoCount
,
4016 ITextDocument_fnGetTypeInfo
,
4017 ITextDocument_fnGetIDsOfNames
,
4018 ITextDocument_fnInvoke
,
4019 ITextDocument_fnGetName
,
4020 ITextDocument_fnGetSelection
,
4021 ITextDocument_fnGetStoryCount
,
4022 ITextDocument_fnGetStoryRanges
,
4023 ITextDocument_fnGetSaved
,
4024 ITextDocument_fnSetSaved
,
4025 ITextDocument_fnGetDefaultTabStop
,
4026 ITextDocument_fnSetDefaultTabStop
,
4027 ITextDocument_fnNew
,
4028 ITextDocument_fnOpen
,
4029 ITextDocument_fnSave
,
4030 ITextDocument_fnFreeze
,
4031 ITextDocument_fnUnfreeze
,
4032 ITextDocument_fnBeginEditCollection
,
4033 ITextDocument_fnEndEditCollection
,
4034 ITextDocument_fnUndo
,
4035 ITextDocument_fnRedo
,
4036 ITextDocument_fnRange
,
4037 ITextDocument_fnRangeFromPoint
4040 /* ITextSelection */
4041 static HRESULT WINAPI
ITextSelection_fnQueryInterface(
4046 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4049 if (IsEqualGUID(riid
, &IID_IUnknown
)
4050 || IsEqualGUID(riid
, &IID_IDispatch
)
4051 || IsEqualGUID(riid
, &IID_ITextRange
)
4052 || IsEqualGUID(riid
, &IID_ITextSelection
))
4055 ITextSelection_AddRef(me
);
4058 else if (IsEqualGUID(riid
, &IID_Igetrichole
))
4060 *ppvObj
= This
->reOle
;
4064 return E_NOINTERFACE
;
4067 static ULONG WINAPI
ITextSelection_fnAddRef(ITextSelection
*me
)
4069 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4070 return InterlockedIncrement(&This
->ref
);
4073 static ULONG WINAPI
ITextSelection_fnRelease(ITextSelection
*me
)
4075 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4076 ULONG ref
= InterlockedDecrement(&This
->ref
);
4082 static HRESULT WINAPI
ITextSelection_fnGetTypeInfoCount(ITextSelection
*me
, UINT
*pctinfo
)
4084 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4085 TRACE("(%p)->(%p)\n", This
, pctinfo
);
4090 static HRESULT WINAPI
ITextSelection_fnGetTypeInfo(ITextSelection
*me
, UINT iTInfo
, LCID lcid
,
4091 ITypeInfo
**ppTInfo
)
4093 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4096 TRACE("(%p)->(%u,%d,%p)\n", This
, iTInfo
, lcid
, ppTInfo
);
4098 hr
= get_typeinfo(ITextSelection_tid
, ppTInfo
);
4100 ITypeInfo_AddRef(*ppTInfo
);
4104 static HRESULT WINAPI
ITextSelection_fnGetIDsOfNames(ITextSelection
*me
, REFIID riid
,
4105 LPOLESTR
*rgszNames
, UINT cNames
, LCID lcid
, DISPID
*rgDispId
)
4107 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4111 TRACE("(%p)->(%p,%p,%u,%d,%p)\n", This
, riid
, rgszNames
, cNames
, lcid
,
4114 hr
= get_typeinfo(ITextSelection_tid
, &ti
);
4116 hr
= ITypeInfo_GetIDsOfNames(ti
, rgszNames
, cNames
, rgDispId
);
4120 static HRESULT WINAPI
ITextSelection_fnInvoke(
4122 DISPID dispIdMember
,
4126 DISPPARAMS
*pDispParams
,
4127 VARIANT
*pVarResult
,
4128 EXCEPINFO
*pExcepInfo
,
4131 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4135 TRACE("(%p)->(%d,%p,%d,%u,%p,%p,%p,%p)\n", This
, dispIdMember
, riid
, lcid
,
4136 wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4138 hr
= get_typeinfo(ITextSelection_tid
, &ti
);
4140 hr
= ITypeInfo_Invoke(ti
, me
, dispIdMember
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
4144 /*** ITextRange methods ***/
4145 static HRESULT WINAPI
ITextSelection_fnGetText(ITextSelection
*me
, BSTR
*pbstr
)
4147 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4148 ME_Cursor
*start
= NULL
, *end
= NULL
;
4152 TRACE("(%p)->(%p)\n", This
, pbstr
);
4155 return CO_E_RELEASED
;
4158 return E_INVALIDARG
;
4160 ME_GetSelection(This
->reOle
->editor
, &start
, &end
);
4161 endOfs
= ME_GetCursorOfs(end
);
4162 nChars
= endOfs
- ME_GetCursorOfs(start
);
4169 *pbstr
= SysAllocStringLen(NULL
, nChars
);
4171 return E_OUTOFMEMORY
;
4173 bEOP
= (end
->pRun
->next
->type
== diTextEnd
&& endOfs
> ME_GetTextLength(This
->reOle
->editor
));
4174 ME_GetTextW(This
->reOle
->editor
, *pbstr
, nChars
, start
, nChars
, FALSE
, bEOP
);
4175 TRACE("%s\n", wine_dbgstr_w(*pbstr
));
4180 static HRESULT WINAPI
ITextSelection_fnSetText(ITextSelection
*me
, BSTR str
)
4182 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4183 ME_TextEditor
*editor
;
4186 TRACE("(%p)->(%s)\n", This
, debugstr_w(str
));
4189 return CO_E_RELEASED
;
4191 editor
= This
->reOle
->editor
;
4193 ME_GetSelectionOfs(editor
, &from
, &to
);
4194 ME_ReplaceSel(editor
, FALSE
, str
, len
);
4196 if (len
< to
- from
)
4197 textranges_update_ranges(This
->reOle
, from
, len
, RANGE_UPDATE_DELETE
);
4202 static HRESULT WINAPI
ITextSelection_fnGetChar(ITextSelection
*me
, LONG
*pch
)
4204 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4205 ME_Cursor
*start
= NULL
, *end
= NULL
;
4207 TRACE("(%p)->(%p)\n", This
, pch
);
4210 return CO_E_RELEASED
;
4213 return E_INVALIDARG
;
4215 ME_GetSelection(This
->reOle
->editor
, &start
, &end
);
4216 return range_GetChar(This
->reOle
->editor
, start
, pch
);
4219 static HRESULT WINAPI
ITextSelection_fnSetChar(ITextSelection
*me
, LONG ch
)
4221 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4223 return CO_E_RELEASED
;
4225 FIXME("not implemented\n");
4229 static HRESULT WINAPI
ITextSelection_fnGetDuplicate(ITextSelection
*me
, ITextRange
**range
)
4231 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4234 TRACE("(%p)->(%p)\n", This
, range
);
4237 return CO_E_RELEASED
;
4240 return E_INVALIDARG
;
4242 ITextSelection_GetStart(me
, &start
);
4243 ITextSelection_GetEnd(me
, &end
);
4244 return CreateITextRange(This
->reOle
, start
, end
, range
);
4247 static HRESULT WINAPI
ITextSelection_fnGetFormattedText(ITextSelection
*me
, ITextRange
**ppRange
)
4249 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4251 return CO_E_RELEASED
;
4253 FIXME("not implemented\n");
4257 static HRESULT WINAPI
ITextSelection_fnSetFormattedText(ITextSelection
*me
, ITextRange
*pRange
)
4259 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4261 return CO_E_RELEASED
;
4263 FIXME("not implemented\n");
4267 static HRESULT WINAPI
ITextSelection_fnGetStart(ITextSelection
*me
, LONG
*pcpFirst
)
4269 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4272 return CO_E_RELEASED
;
4275 return E_INVALIDARG
;
4276 ME_GetSelectionOfs(This
->reOle
->editor
, pcpFirst
, &lim
);
4277 TRACE("%d\n", *pcpFirst
);
4281 static HRESULT WINAPI
ITextSelection_fnSetStart(ITextSelection
*me
, LONG value
)
4283 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4287 TRACE("(%p)->(%d)\n", This
, value
);
4290 return CO_E_RELEASED
;
4292 ME_GetSelectionOfs(This
->reOle
->editor
, &start
, &end
);
4293 hr
= textrange_setstart(This
->reOle
, value
, &start
, &end
);
4295 ME_SetSelection(This
->reOle
->editor
, start
, end
);
4300 static HRESULT WINAPI
ITextSelection_fnGetEnd(ITextSelection
*me
, LONG
*pcpLim
)
4302 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4305 return CO_E_RELEASED
;
4308 return E_INVALIDARG
;
4309 ME_GetSelectionOfs(This
->reOle
->editor
, &first
, pcpLim
);
4310 TRACE("%d\n", *pcpLim
);
4314 static HRESULT WINAPI
ITextSelection_fnSetEnd(ITextSelection
*me
, LONG value
)
4316 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4320 TRACE("(%p)->(%d)\n", This
, value
);
4323 return CO_E_RELEASED
;
4325 ME_GetSelectionOfs(This
->reOle
->editor
, &start
, &end
);
4326 hr
= textrange_setend(This
->reOle
, value
, &start
, &end
);
4328 ME_SetSelection(This
->reOle
->editor
, start
, end
);
4333 static HRESULT WINAPI
ITextSelection_fnGetFont(ITextSelection
*me
, ITextFont
**font
)
4335 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4337 TRACE("(%p)->(%p)\n", This
, font
);
4340 return CO_E_RELEASED
;
4343 return E_INVALIDARG
;
4345 return create_textfont((ITextRange
*)me
, NULL
, font
);
4348 static HRESULT WINAPI
ITextSelection_fnSetFont(ITextSelection
*me
, ITextFont
*font
)
4350 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4352 TRACE("(%p)->(%p)\n", This
, font
);
4355 return E_INVALIDARG
;
4358 return CO_E_RELEASED
;
4360 textrange_set_font((ITextRange
*)me
, font
);
4364 static HRESULT WINAPI
ITextSelection_fnGetPara(ITextSelection
*me
, ITextPara
**para
)
4366 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4368 TRACE("(%p)->(%p)\n", This
, para
);
4371 return CO_E_RELEASED
;
4374 return E_INVALIDARG
;
4376 return create_textpara((ITextRange
*)me
, para
);
4379 static HRESULT WINAPI
ITextSelection_fnSetPara(ITextSelection
*me
, ITextPara
*pPara
)
4381 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4383 return CO_E_RELEASED
;
4385 FIXME("not implemented\n");
4389 static HRESULT WINAPI
ITextSelection_fnGetStoryLength(ITextSelection
*me
, LONG
*length
)
4391 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4393 TRACE("(%p)->(%p)\n", This
, length
);
4396 return CO_E_RELEASED
;
4398 return textrange_get_storylength(This
->reOle
->editor
, length
);
4401 static HRESULT WINAPI
ITextSelection_fnGetStoryType(ITextSelection
*me
, LONG
*value
)
4403 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4405 TRACE("(%p)->(%p)\n", This
, value
);
4408 return CO_E_RELEASED
;
4411 return E_INVALIDARG
;
4413 *value
= tomUnknownStory
;
4417 static HRESULT WINAPI
ITextSelection_fnCollapse(ITextSelection
*me
, LONG bStart
)
4419 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4423 return CO_E_RELEASED
;
4425 ME_GetSelectionOfs(This
->reOle
->editor
, &start
, &end
);
4426 hres
= range_Collapse(bStart
, &start
, &end
);
4427 if (SUCCEEDED(hres
))
4428 ME_SetSelection(This
->reOle
->editor
, start
, end
);
4432 static HRESULT WINAPI
ITextSelection_fnExpand(ITextSelection
*me
, LONG Unit
, LONG
*pDelta
)
4434 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4436 return CO_E_RELEASED
;
4438 FIXME("not implemented\n");
4442 static HRESULT WINAPI
ITextSelection_fnGetIndex(ITextSelection
*me
, LONG Unit
, LONG
*pIndex
)
4444 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4446 return CO_E_RELEASED
;
4448 FIXME("not implemented\n");
4452 static HRESULT WINAPI
ITextSelection_fnSetIndex(ITextSelection
*me
, LONG Unit
, LONG Index
,
4455 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4457 return CO_E_RELEASED
;
4459 FIXME("not implemented\n");
4463 static HRESULT WINAPI
ITextSelection_fnSetRange(ITextSelection
*me
, LONG cpActive
, LONG cpOther
)
4465 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4467 return CO_E_RELEASED
;
4469 FIXME("not implemented\n");
4473 static HRESULT WINAPI
ITextSelection_fnInRange(ITextSelection
*me
, ITextRange
*range
, LONG
*ret
)
4475 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4476 ITextSelection
*selection
= NULL
;
4479 TRACE("(%p)->(%p %p)\n", This
, range
, ret
);
4485 return CO_E_RELEASED
;
4490 ITextRange_QueryInterface(range
, &IID_ITextSelection
, (void**)&selection
);
4493 ITextSelection_Release(selection
);
4495 ITextSelection_GetStart(me
, &start
);
4496 ITextSelection_GetEnd(me
, &end
);
4497 return textrange_inrange(start
, end
, range
, ret
);
4500 static HRESULT WINAPI
ITextSelection_fnInStory(ITextSelection
*me
, ITextRange
*pRange
, LONG
*pb
)
4502 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4504 return CO_E_RELEASED
;
4506 FIXME("not implemented\n");
4510 static HRESULT WINAPI
ITextSelection_fnIsEqual(ITextSelection
*me
, ITextRange
*range
, LONG
*ret
)
4512 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4513 ITextSelection
*selection
= NULL
;
4516 TRACE("(%p)->(%p %p)\n", This
, range
, ret
);
4522 return CO_E_RELEASED
;
4527 ITextRange_QueryInterface(range
, &IID_ITextSelection
, (void**)&selection
);
4530 ITextSelection_Release(selection
);
4532 ITextSelection_GetStart(me
, &start
);
4533 ITextSelection_GetEnd(me
, &end
);
4534 return textrange_isequal(start
, end
, range
, ret
);
4537 static HRESULT WINAPI
ITextSelection_fnSelect(ITextSelection
*me
)
4539 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4541 TRACE("(%p)\n", This
);
4544 return CO_E_RELEASED
;
4550 static HRESULT WINAPI
ITextSelection_fnStartOf(ITextSelection
*me
, LONG Unit
, LONG Extend
,
4553 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4555 return CO_E_RELEASED
;
4557 FIXME("not implemented\n");
4561 static HRESULT WINAPI
ITextSelection_fnEndOf(ITextSelection
*me
, LONG Unit
, LONG Extend
,
4564 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4566 return CO_E_RELEASED
;
4568 FIXME("not implemented\n");
4572 static HRESULT WINAPI
ITextSelection_fnMove(ITextSelection
*me
, LONG Unit
, LONG Count
, LONG
*pDelta
)
4574 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4576 return CO_E_RELEASED
;
4578 FIXME("not implemented\n");
4582 static HRESULT WINAPI
ITextSelection_fnMoveStart(ITextSelection
*me
, LONG Unit
, LONG Count
,
4585 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4587 return CO_E_RELEASED
;
4589 FIXME("not implemented\n");
4593 static HRESULT WINAPI
ITextSelection_fnMoveEnd(ITextSelection
*me
, LONG Unit
, LONG Count
,
4596 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4598 return CO_E_RELEASED
;
4600 FIXME("not implemented\n");
4604 static HRESULT WINAPI
ITextSelection_fnMoveWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
4607 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4609 return CO_E_RELEASED
;
4611 FIXME("not implemented\n");
4615 static HRESULT WINAPI
ITextSelection_fnMoveStartWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
4618 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4620 return CO_E_RELEASED
;
4622 FIXME("not implemented\n");
4626 static HRESULT WINAPI
ITextSelection_fnMoveEndWhile(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
4629 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4631 return CO_E_RELEASED
;
4633 FIXME("not implemented\n");
4637 static HRESULT WINAPI
ITextSelection_fnMoveUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
4640 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4642 return CO_E_RELEASED
;
4644 FIXME("not implemented\n");
4648 static HRESULT WINAPI
ITextSelection_fnMoveStartUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
4651 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4653 return CO_E_RELEASED
;
4655 FIXME("not implemented\n");
4659 static HRESULT WINAPI
ITextSelection_fnMoveEndUntil(ITextSelection
*me
, VARIANT
*Cset
, LONG Count
,
4662 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4664 return CO_E_RELEASED
;
4666 FIXME("not implemented\n");
4670 static HRESULT WINAPI
ITextSelection_fnFindText(ITextSelection
*me
, BSTR bstr
, LONG cch
, LONG Flags
,
4673 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4675 return CO_E_RELEASED
;
4677 FIXME("not implemented\n");
4681 static HRESULT WINAPI
ITextSelection_fnFindTextStart(ITextSelection
*me
, BSTR bstr
, LONG cch
,
4682 LONG Flags
, LONG
*pLength
)
4684 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4686 return CO_E_RELEASED
;
4688 FIXME("not implemented\n");
4692 static HRESULT WINAPI
ITextSelection_fnFindTextEnd(ITextSelection
*me
, BSTR bstr
, LONG cch
,
4693 LONG Flags
, LONG
*pLength
)
4695 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4697 return CO_E_RELEASED
;
4699 FIXME("not implemented\n");
4703 static HRESULT WINAPI
ITextSelection_fnDelete(ITextSelection
*me
, LONG Unit
, LONG Count
,
4706 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4708 return CO_E_RELEASED
;
4710 FIXME("not implemented\n");
4714 static HRESULT WINAPI
ITextSelection_fnCut(ITextSelection
*me
, VARIANT
*pVar
)
4716 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4718 return CO_E_RELEASED
;
4720 FIXME("not implemented\n");
4724 static HRESULT WINAPI
ITextSelection_fnCopy(ITextSelection
*me
, VARIANT
*pVar
)
4726 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4728 return CO_E_RELEASED
;
4730 FIXME("not implemented\n");
4734 static HRESULT WINAPI
ITextSelection_fnPaste(ITextSelection
*me
, VARIANT
*pVar
, LONG Format
)
4736 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4738 return CO_E_RELEASED
;
4740 FIXME("not implemented\n");
4744 static HRESULT WINAPI
ITextSelection_fnCanPaste(ITextSelection
*me
, VARIANT
*pVar
, LONG Format
,
4747 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4749 return CO_E_RELEASED
;
4751 FIXME("not implemented\n");
4755 static HRESULT WINAPI
ITextSelection_fnCanEdit(ITextSelection
*me
, LONG
*pb
)
4757 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4759 return CO_E_RELEASED
;
4761 FIXME("not implemented\n");
4765 static HRESULT WINAPI
ITextSelection_fnChangeCase(ITextSelection
*me
, LONG Type
)
4767 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4769 return CO_E_RELEASED
;
4771 FIXME("not implemented\n");
4775 static HRESULT WINAPI
ITextSelection_fnGetPoint(ITextSelection
*me
, LONG Type
, LONG
*cx
, LONG
*cy
)
4777 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4779 return CO_E_RELEASED
;
4781 FIXME("not implemented\n");
4785 static HRESULT WINAPI
ITextSelection_fnSetPoint(ITextSelection
*me
, LONG x
, LONG y
, LONG Type
,
4788 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4790 return CO_E_RELEASED
;
4792 FIXME("not implemented\n");
4796 static HRESULT WINAPI
ITextSelection_fnScrollIntoView(ITextSelection
*me
, LONG Value
)
4798 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4800 return CO_E_RELEASED
;
4802 FIXME("not implemented\n");
4806 static HRESULT WINAPI
ITextSelection_fnGetEmbeddedObject(ITextSelection
*me
, IUnknown
**ppv
)
4808 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4810 return CO_E_RELEASED
;
4812 FIXME("not implemented\n");
4816 /*** ITextSelection methods ***/
4817 static HRESULT WINAPI
ITextSelection_fnGetFlags(ITextSelection
*me
, LONG
*pFlags
)
4819 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4821 return CO_E_RELEASED
;
4823 FIXME("not implemented\n");
4827 static HRESULT WINAPI
ITextSelection_fnSetFlags(ITextSelection
*me
, LONG Flags
)
4829 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4831 return CO_E_RELEASED
;
4833 FIXME("not implemented\n");
4837 static HRESULT WINAPI
ITextSelection_fnGetType(ITextSelection
*me
, LONG
*pType
)
4839 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4841 return CO_E_RELEASED
;
4843 FIXME("not implemented\n");
4847 static HRESULT WINAPI
ITextSelection_fnMoveLeft(ITextSelection
*me
, LONG Unit
, LONG Count
,
4848 LONG Extend
, LONG
*pDelta
)
4850 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4852 return CO_E_RELEASED
;
4854 FIXME("not implemented\n");
4858 static HRESULT WINAPI
ITextSelection_fnMoveRight(ITextSelection
*me
, LONG Unit
, LONG Count
,
4859 LONG Extend
, LONG
*pDelta
)
4861 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4863 return CO_E_RELEASED
;
4865 FIXME("not implemented\n");
4869 static HRESULT WINAPI
ITextSelection_fnMoveUp(ITextSelection
*me
, LONG Unit
, LONG Count
,
4870 LONG Extend
, LONG
*pDelta
)
4872 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4874 return CO_E_RELEASED
;
4876 FIXME("not implemented\n");
4880 static HRESULT WINAPI
ITextSelection_fnMoveDown(ITextSelection
*me
, LONG Unit
, LONG Count
,
4881 LONG Extend
, LONG
*pDelta
)
4883 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4885 return CO_E_RELEASED
;
4887 FIXME("not implemented\n");
4891 static HRESULT WINAPI
ITextSelection_fnHomeKey(ITextSelection
*me
, LONG Unit
, LONG Extend
,
4894 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4896 return CO_E_RELEASED
;
4898 FIXME("not implemented\n");
4902 static HRESULT WINAPI
ITextSelection_fnEndKey(ITextSelection
*me
, LONG Unit
, LONG Extend
,
4905 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4907 return CO_E_RELEASED
;
4909 FIXME("not implemented\n");
4913 static HRESULT WINAPI
ITextSelection_fnTypeText(ITextSelection
*me
, BSTR bstr
)
4915 ITextSelectionImpl
*This
= impl_from_ITextSelection(me
);
4917 return CO_E_RELEASED
;
4919 FIXME("not implemented\n");
4923 static const ITextSelectionVtbl tsvt
= {
4924 ITextSelection_fnQueryInterface
,
4925 ITextSelection_fnAddRef
,
4926 ITextSelection_fnRelease
,
4927 ITextSelection_fnGetTypeInfoCount
,
4928 ITextSelection_fnGetTypeInfo
,
4929 ITextSelection_fnGetIDsOfNames
,
4930 ITextSelection_fnInvoke
,
4931 ITextSelection_fnGetText
,
4932 ITextSelection_fnSetText
,
4933 ITextSelection_fnGetChar
,
4934 ITextSelection_fnSetChar
,
4935 ITextSelection_fnGetDuplicate
,
4936 ITextSelection_fnGetFormattedText
,
4937 ITextSelection_fnSetFormattedText
,
4938 ITextSelection_fnGetStart
,
4939 ITextSelection_fnSetStart
,
4940 ITextSelection_fnGetEnd
,
4941 ITextSelection_fnSetEnd
,
4942 ITextSelection_fnGetFont
,
4943 ITextSelection_fnSetFont
,
4944 ITextSelection_fnGetPara
,
4945 ITextSelection_fnSetPara
,
4946 ITextSelection_fnGetStoryLength
,
4947 ITextSelection_fnGetStoryType
,
4948 ITextSelection_fnCollapse
,
4949 ITextSelection_fnExpand
,
4950 ITextSelection_fnGetIndex
,
4951 ITextSelection_fnSetIndex
,
4952 ITextSelection_fnSetRange
,
4953 ITextSelection_fnInRange
,
4954 ITextSelection_fnInStory
,
4955 ITextSelection_fnIsEqual
,
4956 ITextSelection_fnSelect
,
4957 ITextSelection_fnStartOf
,
4958 ITextSelection_fnEndOf
,
4959 ITextSelection_fnMove
,
4960 ITextSelection_fnMoveStart
,
4961 ITextSelection_fnMoveEnd
,
4962 ITextSelection_fnMoveWhile
,
4963 ITextSelection_fnMoveStartWhile
,
4964 ITextSelection_fnMoveEndWhile
,
4965 ITextSelection_fnMoveUntil
,
4966 ITextSelection_fnMoveStartUntil
,
4967 ITextSelection_fnMoveEndUntil
,
4968 ITextSelection_fnFindText
,
4969 ITextSelection_fnFindTextStart
,
4970 ITextSelection_fnFindTextEnd
,
4971 ITextSelection_fnDelete
,
4972 ITextSelection_fnCut
,
4973 ITextSelection_fnCopy
,
4974 ITextSelection_fnPaste
,
4975 ITextSelection_fnCanPaste
,
4976 ITextSelection_fnCanEdit
,
4977 ITextSelection_fnChangeCase
,
4978 ITextSelection_fnGetPoint
,
4979 ITextSelection_fnSetPoint
,
4980 ITextSelection_fnScrollIntoView
,
4981 ITextSelection_fnGetEmbeddedObject
,
4982 ITextSelection_fnGetFlags
,
4983 ITextSelection_fnSetFlags
,
4984 ITextSelection_fnGetType
,
4985 ITextSelection_fnMoveLeft
,
4986 ITextSelection_fnMoveRight
,
4987 ITextSelection_fnMoveUp
,
4988 ITextSelection_fnMoveDown
,
4989 ITextSelection_fnHomeKey
,
4990 ITextSelection_fnEndKey
,
4991 ITextSelection_fnTypeText
4994 static ITextSelectionImpl
*
4995 CreateTextSelection(IRichEditOleImpl
*reOle
)
4997 ITextSelectionImpl
*txtSel
= heap_alloc(sizeof *txtSel
);
5001 txtSel
->ITextSelection_iface
.lpVtbl
= &tsvt
;
5003 txtSel
->reOle
= reOle
;
5007 LRESULT
CreateIRichEditOle(IUnknown
*outer_unk
, ME_TextEditor
*editor
, LPVOID
*ppvObj
)
5009 IRichEditOleImpl
*reo
;
5011 reo
= heap_alloc(sizeof(IRichEditOleImpl
));
5015 reo
->IUnknown_inner
.lpVtbl
= &reo_unk_vtbl
;
5016 reo
->IRichEditOle_iface
.lpVtbl
= &revt
;
5017 reo
->ITextDocument_iface
.lpVtbl
= &tdvt
;
5019 reo
->editor
= editor
;
5022 TRACE("Created %p\n",reo
);
5023 list_init(&reo
->rangelist
);
5024 list_init(&reo
->clientsites
);
5026 reo
->outer_unk
= outer_unk
;
5028 reo
->outer_unk
= &reo
->IUnknown_inner
;
5029 *ppvObj
= &reo
->IRichEditOle_iface
;
5034 static void convert_sizel(const ME_Context
*c
, const SIZEL
* szl
, SIZE
* sz
)
5036 /* sizel is in .01 millimeters, sz in pixels */
5037 sz
->cx
= MulDiv(szl
->cx
, c
->dpi
.cx
, 2540);
5038 sz
->cy
= MulDiv(szl
->cy
, c
->dpi
.cy
, 2540);
5041 /******************************************************************************
5042 * ME_GetOLEObjectSize
5044 * Sets run extent for OLE objects.
5046 void ME_GetOLEObjectSize(const ME_Context
*c
, ME_Run
*run
, SIZE
*pSize
)
5054 assert(run
->nFlags
& MERF_GRAPHICS
);
5055 assert(run
->ole_obj
);
5057 if (run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0)
5059 convert_sizel(c
, &run
->ole_obj
->sizel
, pSize
);
5060 if (c
->editor
->nZoomNumerator
!= 0)
5062 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5063 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5068 if (!run
->ole_obj
->poleobj
)
5070 pSize
->cx
= pSize
->cy
= 0;
5074 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
5076 FIXME("Query Interface IID_IDataObject failed!\n");
5077 pSize
->cx
= pSize
->cy
= 0;
5080 fmt
.cfFormat
= CF_BITMAP
;
5082 fmt
.dwAspect
= DVASPECT_CONTENT
;
5084 fmt
.tymed
= TYMED_GDI
;
5085 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
5087 fmt
.cfFormat
= CF_ENHMETAFILE
;
5088 fmt
.tymed
= TYMED_ENHMF
;
5089 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
5091 FIXME("unsupported format\n");
5092 pSize
->cx
= pSize
->cy
= 0;
5093 IDataObject_Release(ido
);
5101 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
5102 pSize
->cx
= dibsect
.dsBm
.bmWidth
;
5103 pSize
->cy
= dibsect
.dsBm
.bmHeight
;
5104 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
5107 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
5108 pSize
->cx
= emh
.rclBounds
.right
- emh
.rclBounds
.left
;
5109 pSize
->cy
= emh
.rclBounds
.bottom
- emh
.rclBounds
.top
;
5110 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
5113 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
5116 IDataObject_Release(ido
);
5117 if (c
->editor
->nZoomNumerator
!= 0)
5119 pSize
->cx
= MulDiv(pSize
->cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5120 pSize
->cy
= MulDiv(pSize
->cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5124 void ME_DrawOLE(ME_Context
*c
, int x
, int y
, ME_Run
*run
,
5125 ME_Paragraph
*para
, BOOL selected
)
5136 assert(run
->nFlags
& MERF_GRAPHICS
);
5137 assert(run
->ole_obj
);
5138 if (IOleObject_QueryInterface(run
->ole_obj
->poleobj
, &IID_IDataObject
, (void**)&ido
) != S_OK
)
5140 FIXME("Couldn't get interface\n");
5143 has_size
= run
->ole_obj
->sizel
.cx
!= 0 || run
->ole_obj
->sizel
.cy
!= 0;
5144 fmt
.cfFormat
= CF_BITMAP
;
5146 fmt
.dwAspect
= DVASPECT_CONTENT
;
5148 fmt
.tymed
= TYMED_GDI
;
5149 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
5151 fmt
.cfFormat
= CF_ENHMETAFILE
;
5152 fmt
.tymed
= TYMED_ENHMF
;
5153 if (IDataObject_GetData(ido
, &fmt
, &stgm
) != S_OK
)
5155 FIXME("Couldn't get storage medium\n");
5156 IDataObject_Release(ido
);
5163 GetObjectW(stgm
.u
.hBitmap
, sizeof(dibsect
), &dibsect
);
5164 hMemDC
= CreateCompatibleDC(c
->hDC
);
5165 SelectObject(hMemDC
, stgm
.u
.hBitmap
);
5168 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
5170 sz
.cx
= MulDiv(dibsect
.dsBm
.bmWidth
, c
->dpi
.cx
, 96);
5171 sz
.cy
= MulDiv(dibsect
.dsBm
.bmHeight
, c
->dpi
.cy
, 96);
5173 if (c
->editor
->nZoomNumerator
!= 0)
5175 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5176 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5178 if (sz
.cx
== dibsect
.dsBm
.bmWidth
&& sz
.cy
== dibsect
.dsBm
.bmHeight
)
5180 BitBlt(c
->hDC
, x
, y
- sz
.cy
,
5181 dibsect
.dsBm
.bmWidth
, dibsect
.dsBm
.bmHeight
,
5182 hMemDC
, 0, 0, SRCCOPY
);
5184 StretchBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
,
5185 hMemDC
, 0, 0, dibsect
.dsBm
.bmWidth
,
5186 dibsect
.dsBm
.bmHeight
, SRCCOPY
);
5189 if (!stgm
.pUnkForRelease
) DeleteObject(stgm
.u
.hBitmap
);
5192 GetEnhMetaFileHeader(stgm
.u
.hEnhMetaFile
, sizeof(emh
), &emh
);
5195 convert_sizel(c
, &run
->ole_obj
->sizel
, &sz
);
5197 sz
.cy
= MulDiv(emh
.rclBounds
.bottom
- emh
.rclBounds
.top
, c
->dpi
.cx
, 96);
5198 sz
.cx
= MulDiv(emh
.rclBounds
.right
- emh
.rclBounds
.left
, c
->dpi
.cy
, 96);
5200 if (c
->editor
->nZoomNumerator
!= 0)
5202 sz
.cx
= MulDiv(sz
.cx
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5203 sz
.cy
= MulDiv(sz
.cy
, c
->editor
->nZoomNumerator
, c
->editor
->nZoomDenominator
);
5211 rc
.right
= x
+ sz
.cx
;
5213 PlayEnhMetaFile(c
->hDC
, stgm
.u
.hEnhMetaFile
, &rc
);
5215 if (!stgm
.pUnkForRelease
) DeleteEnhMetaFile(stgm
.u
.hEnhMetaFile
);
5218 FIXME("Unsupported tymed %d\n", stgm
.tymed
);
5222 if (selected
&& !c
->editor
->bHideSelection
)
5223 PatBlt(c
->hDC
, x
, y
- sz
.cy
, sz
.cx
, sz
.cy
, DSTINVERT
);
5224 IDataObject_Release(ido
);
5227 void ME_DeleteReObject(REOBJECT
* reo
)
5229 if (reo
->poleobj
) IOleObject_Release(reo
->poleobj
);
5230 if (reo
->pstg
) IStorage_Release(reo
->pstg
);
5231 if (reo
->polesite
) IOleClientSite_Release(reo
->polesite
);
5235 void ME_CopyReObject(REOBJECT
* dst
, const REOBJECT
* src
)
5239 if (dst
->poleobj
) IOleObject_AddRef(dst
->poleobj
);
5240 if (dst
->pstg
) IStorage_AddRef(dst
->pstg
);
5241 if (dst
->polesite
) IOleClientSite_AddRef(dst
->polesite
);
5244 void ME_GetITextDocumentInterface(IRichEditOle
*iface
, LPVOID
*ppvObj
)
5246 IRichEditOleImpl
*This
= impl_from_IRichEditOle(iface
);
5247 *ppvObj
= &This
->ITextDocument_iface
;