From f09433417eb4d4a6644f35730449492f5dbf5fa7 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 20 May 2015 07:35:12 +0200 Subject: [PATCH] riched20-IText_Interface: Avoid additional linked lists for font/para interfaces. --- patches/patchinstall.sh | 6 +- ...r-ITextFont-interface-and-implement-.patch | 417 ++++++++---------- ...r-ITextPara-interface-and-implement-.patch | 348 +++++---------- ...alid-memory-access-when-parent-objec.patch | 49 -- ...repeated-FIXMEs-triggered-by-Adobe-.patch} | 80 ++-- ...ement-ITextSelection_fnGetDuplicate.patch} | 8 +- 6 files changed, 356 insertions(+), 552 deletions(-) delete mode 100644 patches/riched20-IText_Interface/0010-riched20-Fix-invalid-memory-access-when-parent-objec.patch rename patches/riched20-IText_Interface/{0011-riched20-Silence-repeated-FIXMEs-triggered-by-Adobe-.patch => 0010-riched20-Silence-repeated-FIXMEs-triggered-by-Adobe-.patch} (67%) rename patches/riched20-IText_Interface/{0012-riched20-Implement-ITextSelection_fnGetDuplicate.patch => 0011-riched20-Implement-ITextSelection_fnGetDuplicate.patch} (86%) diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 227e1ac2..de9b5b03 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -4612,9 +4612,8 @@ if test "$enable_riched20_IText_Interface" -eq 1; then patch_apply riched20-IText_Interface/0007-riched20-Implement-ITextRange-IsEqual.patch patch_apply riched20-IText_Interface/0008-riched20-Implement-ITextRange-GetStoryLength.patch patch_apply riched20-IText_Interface/0009-riched20-Implement-ITextSelection-GetStoryLength.patch - patch_apply riched20-IText_Interface/0010-riched20-Fix-invalid-memory-access-when-parent-objec.patch - patch_apply riched20-IText_Interface/0011-riched20-Silence-repeated-FIXMEs-triggered-by-Adobe-.patch - patch_apply riched20-IText_Interface/0012-riched20-Implement-ITextSelection_fnGetDuplicate.patch + patch_apply riched20-IText_Interface/0010-riched20-Silence-repeated-FIXMEs-triggered-by-Adobe-.patch + patch_apply riched20-IText_Interface/0011-riched20-Implement-ITextSelection_fnGetDuplicate.patch ( echo '+ { "Jactry Zeng", "riched20: Implement IText{Selection, Range}::Set{Start, End}.", 1 },'; echo '+ { "Jactry Zeng", "riched20: Stub for ITextFont interface and implement ITextRange::GetFont and ITextSelection::GetFont.", 1 },'; @@ -4625,7 +4624,6 @@ if test "$enable_riched20_IText_Interface" -eq 1; then echo '+ { "Jactry Zeng", "riched20: Implement ITextRange::IsEqual.", 1 },'; echo '+ { "Jactry Zeng", "riched20: Implement ITextRange::GetStoryLength.", 1 },'; echo '+ { "Jactry Zeng", "riched20: Implement ITextSelection::GetStoryLength.", 1 },'; - echo '+ { "Sebastian Lackner", "riched20: Fix invalid memory access when parent object was destroyed earlier than child object.", 1 },'; echo '+ { "Sebastian Lackner", "riched20: Silence repeated FIXMEs triggered by Adobe Reader.", 1 },'; echo '+ { "Sebastian Lackner", "riched20: Implement ITextSelection_fnGetDuplicate.", 1 },'; ) >> "$patchlist" diff --git a/patches/riched20-IText_Interface/0002-riched20-Stub-for-ITextFont-interface-and-implement-.patch b/patches/riched20-IText_Interface/0002-riched20-Stub-for-ITextFont-interface-and-implement-.patch index cdf83541..5b94baf8 100644 --- a/patches/riched20-IText_Interface/0002-riched20-Stub-for-ITextFont-interface-and-implement-.patch +++ b/patches/riched20-IText_Interface/0002-riched20-Stub-for-ITextFont-interface-and-implement-.patch @@ -1,16 +1,16 @@ -From db292bf18161a88ac2760aa6dcfb82a14906da67 Mon Sep 17 00:00:00 2001 +From 3dbb76ac15c52c9d190f7dc9c0ebf1aa9849d033 Mon Sep 17 00:00:00 2001 From: Jactry Zeng Date: Mon, 11 Aug 2014 13:51:55 +0800 Subject: riched20: Stub for ITextFont interface and implement ITextRange::GetFont and ITextSelection::GetFont. --- - dlls/riched20/richole.c | 362 +++++++++++++++++++++++++++++++++++++++--- + dlls/riched20/richole.c | 361 ++++++++++++++++++++++++++++++++++++++++-- dlls/riched20/tests/richole.c | 93 +++++++++++ - 2 files changed, 433 insertions(+), 22 deletions(-) + 2 files changed, 438 insertions(+), 16 deletions(-) diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c -index b3566e5..3623ec7 100644 +index b3566e5..54448f5 100644 --- a/dlls/riched20/richole.c +++ b/dlls/riched20/richole.c @@ -52,6 +52,7 @@ DEFINE_GUID(IID_ITextPara, 0x8cc497c4, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xaa, 0 @@ -21,128 +21,81 @@ index b3566e5..3623ec7 100644 typedef struct IRichEditOleImpl { IUnknown IUnknown_inner; -@@ -64,6 +65,7 @@ typedef struct IRichEditOleImpl { - ITextSelectionImpl *txtSel; - IOleClientSiteImpl *clientSite; - struct list rangelist; -+ struct list fontlist; - } IRichEditOleImpl; - - struct ITextRangeImpl { -@@ -85,8 +87,11 @@ struct ITextSelectionImpl { - typedef struct ITextFontImpl { - ITextFont ITextFont_iface; +@@ -87,6 +88,7 @@ typedef struct ITextFontImpl { LONG ref; -+ struct list entry; -- ITextRange *range; -+ IRichEditOleImpl *reOle; -+ ITextRangeImpl *txtRge; -+ ITextSelectionImpl *txtSel; + ITextRange *range; ++ ITextSelection *selection; } ITextFontImpl; typedef struct ITextParaImpl { -@@ -150,7 +155,7 @@ static inline ITextParaImpl *impl_from_ITextPara(ITextPara *iface) +@@ -150,7 +152,7 @@ static inline ITextParaImpl *impl_from_ITextPara(ITextPara *iface) return CONTAINING_RECORD(iface, ITextParaImpl, ITextPara_iface); } -static HRESULT create_textfont(ITextRange*, ITextFont**); -+static HRESULT create_textfont(IRichEditOleImpl *, ITextFontImpl **); ++static HRESULT create_textfont(ITextRange*, ITextSelection*, ITextFont**); static HRESULT create_textpara(ITextRange*, ITextPara**); enum textfont_prop_id { -@@ -238,9 +243,8 @@ static HRESULT get_textfont_prop_for_pos(const IRichEditOleImpl *reole, int pos, - return S_OK; - } - --static HRESULT get_textfont_prop(ITextRange *range, enum textfont_prop_id propid, LONG *value) -+static HRESULT get_textfont_prop(ITextRangeImpl *rng, enum textfont_prop_id propid, LONG *value) - { -- ITextRangeImpl *rng = impl_from_ITextRange(range); - HRESULT hr; - LONG v; - int i; -@@ -316,6 +320,7 @@ static ULONG WINAPI IRichEditOleImpl_inner_fnRelease(IUnknown *iface) - if (!ref) - { - ITextRangeImpl *txtRge; -+ ITextFontImpl *txtFont; - - TRACE("Destroying %p\n", This); - This->txtSel->reOle = NULL; -@@ -324,6 +329,8 @@ static ULONG WINAPI IRichEditOleImpl_inner_fnRelease(IUnknown *iface) - IOleClientSite_Release(&This->clientSite->IOleClientSite_iface); - LIST_FOR_EACH_ENTRY(txtRge, &This->rangelist, ITextRangeImpl, entry) - txtRge->reOle = NULL; -+ LIST_FOR_EACH_ENTRY(txtFont, &This->fontlist, ITextFontImpl, entry) -+ txtFont->reOle = NULL; - heap_free(This); - } - return ref; -@@ -1099,6 +1106,8 @@ static HRESULT WINAPI ITextRange_fnSetEnd(ITextRange *me, LONG end) - static HRESULT WINAPI ITextRange_fnGetFont(ITextRange *me, ITextFont **font) - { - ITextRangeImpl *This = impl_from_ITextRange(me); -+ ITextFontImpl *txtFont = NULL; -+ HRESULT hres; - - TRACE("(%p)->(%p)\n", This, font); - -@@ -1108,7 +1117,16 @@ static HRESULT WINAPI ITextRange_fnGetFont(ITextRange *me, ITextFont **font) +@@ -1108,7 +1110,7 @@ static HRESULT WINAPI ITextRange_fnGetFont(ITextRange *me, ITextFont **font) if (!font) return E_INVALIDARG; - return create_textfont(me, font); -+ *font = NULL; -+ hres = create_textfont(This->reOle, &txtFont); -+ if (!hres) -+ { -+ txtFont->txtSel = NULL; -+ txtFont->txtRge = This; -+ ITextRange_AddRef(me); -+ *font = &txtFont->ITextFont_iface; -+ } -+ return hres; ++ return create_textfont(me, NULL, font); } static HRESULT WINAPI ITextRange_fnSetFont(ITextRange *me, ITextFont *pFont) -@@ -1632,7 +1650,14 @@ static ULONG WINAPI TextFont_Release(ITextFont *iface) +@@ -1632,16 +1634,39 @@ static ULONG WINAPI TextFont_Release(ITextFont *iface) if (!ref) { - ITextRange_Release(This->range); -+ if (This->txtRge) -+ ITextRange_Release(&This->txtRge->ITextRange_iface); -+ else -+ ITextSelection_Release(&This->txtSel->ITextSelection_iface); -+ This->reOle = NULL; -+ This->txtRge = NULL; -+ This->txtSel = NULL; -+ list_remove(&This->entry); ++ if (This->range) ++ ITextRange_Release(This->range); ++ if (This->selection) ++ ITextSelection_Release(This->selection); heap_free(This); } -@@ -1641,7 +1666,12 @@ static ULONG WINAPI TextFont_Release(ITextFont *iface) + return ref; + } ++static IRichEditOleImpl *font_get_reole(ITextFontImpl *This) ++{ ++ if (This->range) ++ { ++ ITextRangeImpl *rng = impl_from_ITextRange(This->range); ++ return rng->reOle; ++ } ++ if (This->selection) ++ { ++ ITextSelectionImpl *sel = impl_from_ITextSelection(This->selection); ++ return sel->reOle; ++ } ++ return NULL; ++} ++ static HRESULT WINAPI TextFont_GetTypeInfoCount(ITextFont *iface, UINT *pctinfo) { + ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("stub\n"); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + *pctinfo = 0; return E_NOTIMPL; } -@@ -1649,14 +1679,24 @@ static HRESULT WINAPI TextFont_GetTypeInfoCount(ITextFont *iface, UINT *pctinfo) +@@ -1649,14 +1674,24 @@ static HRESULT WINAPI TextFont_GetTypeInfoCount(ITextFont *iface, UINT *pctinfo) static HRESULT WINAPI TextFont_GetTypeInfo(ITextFont *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) { + ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("stub\n"); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; @@ -154,185 +107,187 @@ index b3566e5..3623ec7 100644 + ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("stub\n"); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1671,7 +1711,12 @@ static HRESULT WINAPI TextFont_Invoke( +@@ -1671,7 +1706,12 @@ static HRESULT WINAPI TextFont_Invoke( EXCEPINFO *pExcepInfo, UINT *puArgErr) { + ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("stub\n"); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1679,6 +1724,10 @@ static HRESULT WINAPI TextFont_GetDuplicate(ITextFont *iface, ITextFont **ret) +@@ -1679,6 +1719,10 @@ static HRESULT WINAPI TextFont_GetDuplicate(ITextFont *iface, ITextFont **ret) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%p): stub\n", This, ret); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1686,6 +1735,10 @@ static HRESULT WINAPI TextFont_SetDuplicate(ITextFont *iface, ITextFont *pFont) +@@ -1686,6 +1730,10 @@ static HRESULT WINAPI TextFont_SetDuplicate(ITextFont *iface, ITextFont *pFont) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%p): stub\n", This, pFont); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1693,6 +1746,10 @@ static HRESULT WINAPI TextFont_CanChange(ITextFont *iface, LONG *ret) +@@ -1693,6 +1741,10 @@ static HRESULT WINAPI TextFont_CanChange(ITextFont *iface, LONG *ret) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%p): stub\n", This, ret); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1700,6 +1757,10 @@ static HRESULT WINAPI TextFont_IsEqual(ITextFont *iface, ITextFont *font, LONG * +@@ -1700,6 +1752,10 @@ static HRESULT WINAPI TextFont_IsEqual(ITextFont *iface, ITextFont *font, LONG * { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%p): stub\n", This, ret); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1707,6 +1768,10 @@ static HRESULT WINAPI TextFont_Reset(ITextFont *iface, LONG value) +@@ -1707,6 +1763,10 @@ static HRESULT WINAPI TextFont_Reset(ITextFont *iface, LONG value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p): stub\n", This); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1714,6 +1779,10 @@ static HRESULT WINAPI TextFont_GetStyle(ITextFont *iface, LONG *value) +@@ -1714,6 +1774,10 @@ static HRESULT WINAPI TextFont_GetStyle(ITextFont *iface, LONG *value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%p): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1721,6 +1790,10 @@ static HRESULT WINAPI TextFont_SetStyle(ITextFont *iface, LONG value) +@@ -1721,6 +1785,10 @@ static HRESULT WINAPI TextFont_SetStyle(ITextFont *iface, LONG value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%d): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1728,6 +1801,10 @@ static HRESULT WINAPI TextFont_GetAllCaps(ITextFont *iface, LONG *value) +@@ -1728,6 +1796,10 @@ static HRESULT WINAPI TextFont_GetAllCaps(ITextFont *iface, LONG *value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%p): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1735,6 +1812,10 @@ static HRESULT WINAPI TextFont_SetAllCaps(ITextFont *iface, LONG value) +@@ -1735,6 +1807,10 @@ static HRESULT WINAPI TextFont_SetAllCaps(ITextFont *iface, LONG value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%d): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1742,6 +1823,10 @@ static HRESULT WINAPI TextFont_GetAnimation(ITextFont *iface, LONG *value) +@@ -1742,6 +1818,10 @@ static HRESULT WINAPI TextFont_GetAnimation(ITextFont *iface, LONG *value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%p): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1749,6 +1834,10 @@ static HRESULT WINAPI TextFont_SetAnimation(ITextFont *iface, LONG value) +@@ -1749,6 +1829,10 @@ static HRESULT WINAPI TextFont_SetAnimation(ITextFont *iface, LONG value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%d): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1756,6 +1845,10 @@ static HRESULT WINAPI TextFont_GetBackColor(ITextFont *iface, LONG *value) +@@ -1756,6 +1840,10 @@ static HRESULT WINAPI TextFont_GetBackColor(ITextFont *iface, LONG *value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%p): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1763,6 +1856,10 @@ static HRESULT WINAPI TextFont_SetBackColor(ITextFont *iface, LONG value) +@@ -1763,6 +1851,10 @@ static HRESULT WINAPI TextFont_SetBackColor(ITextFont *iface, LONG value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%d): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1770,13 +1867,28 @@ static HRESULT WINAPI TextFont_GetBold(ITextFont *iface, LONG *value) +@@ -1770,13 +1862,30 @@ static HRESULT WINAPI TextFont_GetBold(ITextFont *iface, LONG *value) { ITextFontImpl *This = impl_from_ITextFont(iface); TRACE("(%p)->(%p)\n", This, value); - return get_textfont_prop(This->range, FONT_BOLD, value); + ++ if (This->range) ++ return get_textfont_prop(This->range, FONT_BOLD, value); ++ + if (!value) + return E_INVALIDARG; -+ if (!This->reOle) -+ return CO_E_RELEASED; -+ if (!This->txtRge) -+ { -+ FIXME("not implemented\n"); -+ return E_NOTIMPL; -+ } + -+ return get_textfont_prop(This->txtRge, FONT_BOLD, value); ++ *value = tomUndefined; ++ ++ if (!font_get_reole(This)) ++ return CO_E_RELEASED; ++ ++ FIXME("not implemented\n"); ++ return E_NOTIMPL; } static HRESULT WINAPI TextFont_SetBold(ITextFont *iface, LONG value) @@ -340,35 +295,35 @@ index b3566e5..3623ec7 100644 ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%d): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1784,6 +1896,10 @@ static HRESULT WINAPI TextFont_GetEmboss(ITextFont *iface, LONG *value) +@@ -1784,6 +1893,10 @@ static HRESULT WINAPI TextFont_GetEmboss(ITextFont *iface, LONG *value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%p): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1791,6 +1907,10 @@ static HRESULT WINAPI TextFont_SetEmboss(ITextFont *iface, LONG value) +@@ -1791,6 +1904,10 @@ static HRESULT WINAPI TextFont_SetEmboss(ITextFont *iface, LONG value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%d): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1798,13 +1918,24 @@ static HRESULT WINAPI TextFont_GetForeColor(ITextFont *iface, LONG *value) +@@ -1798,13 +1915,27 @@ static HRESULT WINAPI TextFont_GetForeColor(ITextFont *iface, LONG *value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%p): stub\n", This, value); @@ -376,7 +331,10 @@ index b3566e5..3623ec7 100644 + + if (!value) + return E_INVALIDARG; -+ if (!This->reOle) ++ ++ *value = tomUndefined; ++ ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + + *value = tomAutoColor; @@ -388,7 +346,7 @@ index b3566e5..3623ec7 100644 ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%d): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; @@ -399,7 +357,7 @@ index b3566e5..3623ec7 100644 ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%p): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; @@ -410,7 +368,7 @@ index b3566e5..3623ec7 100644 ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%d): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; @@ -421,7 +379,7 @@ index b3566e5..3623ec7 100644 ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%p): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; @@ -432,29 +390,31 @@ index b3566e5..3623ec7 100644 ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%d): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1840,13 +1987,28 @@ static HRESULT WINAPI TextFont_GetItalic(ITextFont *iface, LONG *value) +@@ -1840,13 +1987,30 @@ static HRESULT WINAPI TextFont_GetItalic(ITextFont *iface, LONG *value) { ITextFontImpl *This = impl_from_ITextFont(iface); TRACE("(%p)->(%p)\n", This, value); - return get_textfont_prop(This->range, FONT_ITALIC, value); + ++ if (This->range) ++ return get_textfont_prop(This->range, FONT_ITALIC, value); ++ + if (!value) + return E_INVALIDARG; -+ if (!This->reOle) -+ return CO_E_RELEASED; -+ if (!This->txtRge) -+ { -+ FIXME("not implemented\n"); -+ return E_NOTIMPL; -+ } + -+ return get_textfont_prop(This->txtRge, FONT_ITALIC, value); ++ *value = tomUndefined; ++ ++ if (!font_get_reole(This)) ++ return CO_E_RELEASED; ++ ++ FIXME("not implemented\n"); ++ return E_NOTIMPL; } static HRESULT WINAPI TextFont_SetItalic(ITextFont *iface, LONG value) @@ -462,51 +422,51 @@ index b3566e5..3623ec7 100644 ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%d): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1854,6 +2016,10 @@ static HRESULT WINAPI TextFont_GetKerning(ITextFont *iface, FLOAT *value) +@@ -1854,6 +2018,10 @@ static HRESULT WINAPI TextFont_GetKerning(ITextFont *iface, FLOAT *value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%p): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1861,6 +2027,10 @@ static HRESULT WINAPI TextFont_SetKerning(ITextFont *iface, FLOAT value) +@@ -1861,6 +2029,10 @@ static HRESULT WINAPI TextFont_SetKerning(ITextFont *iface, FLOAT value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%.2f): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1868,6 +2038,10 @@ static HRESULT WINAPI TextFont_GetLanguageID(ITextFont *iface, LONG *value) +@@ -1868,6 +2040,10 @@ static HRESULT WINAPI TextFont_GetLanguageID(ITextFont *iface, LONG *value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%p): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1875,20 +2049,37 @@ static HRESULT WINAPI TextFont_SetLanguageID(ITextFont *iface, LONG value) +@@ -1875,20 +2051,40 @@ static HRESULT WINAPI TextFont_SetLanguageID(ITextFont *iface, LONG value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%d): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; @@ -522,7 +482,10 @@ index b3566e5..3623ec7 100644 + + if (!value) + return E_INVALIDARG; -+ if (!This->reOle) ++ ++ *value = NULL; ++ ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + + *value = SysAllocString(font); @@ -534,101 +497,101 @@ index b3566e5..3623ec7 100644 ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%s): stub\n", This, debugstr_w(value)); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1896,6 +2087,10 @@ static HRESULT WINAPI TextFont_GetOutline(ITextFont *iface, LONG *value) +@@ -1896,6 +2092,10 @@ static HRESULT WINAPI TextFont_GetOutline(ITextFont *iface, LONG *value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%p): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1903,6 +2098,10 @@ static HRESULT WINAPI TextFont_SetOutline(ITextFont *iface, LONG value) +@@ -1903,6 +2103,10 @@ static HRESULT WINAPI TextFont_SetOutline(ITextFont *iface, LONG value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%d): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1910,6 +2109,10 @@ static HRESULT WINAPI TextFont_GetPosition(ITextFont *iface, FLOAT *value) +@@ -1910,6 +2114,10 @@ static HRESULT WINAPI TextFont_GetPosition(ITextFont *iface, FLOAT *value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%p): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1917,6 +2120,10 @@ static HRESULT WINAPI TextFont_SetPosition(ITextFont *iface, FLOAT value) +@@ -1917,6 +2125,10 @@ static HRESULT WINAPI TextFont_SetPosition(ITextFont *iface, FLOAT value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%.2f): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1924,6 +2131,10 @@ static HRESULT WINAPI TextFont_GetProtected(ITextFont *iface, LONG *value) +@@ -1924,6 +2136,10 @@ static HRESULT WINAPI TextFont_GetProtected(ITextFont *iface, LONG *value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%p): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1931,6 +2142,10 @@ static HRESULT WINAPI TextFont_SetProtected(ITextFont *iface, LONG value) +@@ -1931,6 +2147,10 @@ static HRESULT WINAPI TextFont_SetProtected(ITextFont *iface, LONG value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%d): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1938,6 +2153,10 @@ static HRESULT WINAPI TextFont_GetShadow(ITextFont *iface, LONG *value) +@@ -1938,6 +2158,10 @@ static HRESULT WINAPI TextFont_GetShadow(ITextFont *iface, LONG *value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%p): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1945,6 +2164,10 @@ static HRESULT WINAPI TextFont_SetShadow(ITextFont *iface, LONG value) +@@ -1945,6 +2169,10 @@ static HRESULT WINAPI TextFont_SetShadow(ITextFont *iface, LONG value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%d): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1952,13 +2175,24 @@ static HRESULT WINAPI TextFont_GetSize(ITextFont *iface, FLOAT *value) +@@ -1952,13 +2180,27 @@ static HRESULT WINAPI TextFont_GetSize(ITextFont *iface, FLOAT *value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%p): stub\n", This, value); @@ -636,7 +599,10 @@ index b3566e5..3623ec7 100644 + + if (!value) + return E_INVALIDARG; -+ if (!This->reOle) ++ ++ *value = 0.0; ++ ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + + *value = 12.0; @@ -648,57 +614,57 @@ index b3566e5..3623ec7 100644 ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%.2f): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1966,6 +2200,10 @@ static HRESULT WINAPI TextFont_GetSmallCaps(ITextFont *iface, LONG *value) +@@ -1966,6 +2208,10 @@ static HRESULT WINAPI TextFont_GetSmallCaps(ITextFont *iface, LONG *value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%p): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1973,6 +2211,10 @@ static HRESULT WINAPI TextFont_SetSmallCaps(ITextFont *iface, LONG value) +@@ -1973,6 +2219,10 @@ static HRESULT WINAPI TextFont_SetSmallCaps(ITextFont *iface, LONG value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%d): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1980,6 +2222,10 @@ static HRESULT WINAPI TextFont_GetSpacing(ITextFont *iface, FLOAT *value) +@@ -1980,6 +2230,10 @@ static HRESULT WINAPI TextFont_GetSpacing(ITextFont *iface, FLOAT *value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%p): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1987,6 +2233,10 @@ static HRESULT WINAPI TextFont_SetSpacing(ITextFont *iface, FLOAT value) +@@ -1987,6 +2241,10 @@ static HRESULT WINAPI TextFont_SetSpacing(ITextFont *iface, FLOAT value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%.2f): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -1994,13 +2244,24 @@ static HRESULT WINAPI TextFont_GetStrikeThrough(ITextFont *iface, LONG *value) +@@ -1994,13 +2252,27 @@ static HRESULT WINAPI TextFont_GetStrikeThrough(ITextFont *iface, LONG *value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%p): stub\n", This, value); @@ -706,7 +672,10 @@ index b3566e5..3623ec7 100644 + + if (!value) + return E_INVALIDARG; -+ if (!This->reOle) ++ ++ *value = tomUndefined; ++ ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + + *value = tomFalse; @@ -718,21 +687,24 @@ index b3566e5..3623ec7 100644 ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%d): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2008,13 +2269,24 @@ static HRESULT WINAPI TextFont_GetSubscript(ITextFont *iface, LONG *value) +@@ -2008,13 +2280,27 @@ static HRESULT WINAPI TextFont_GetSubscript(ITextFont *iface, LONG *value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%p): stub\n", This, value); - return E_NOTIMPL; + + if (!value) -+ return E_INVALIDARG; -+ if (!This->reOle) ++ return E_INVALIDARG; ++ ++ *value = tomUndefined; ++ ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + + *value = tomFalse; @@ -744,13 +716,13 @@ index b3566e5..3623ec7 100644 ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%d): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2022,13 +2294,24 @@ static HRESULT WINAPI TextFont_GetSuperscript(ITextFont *iface, LONG *value) +@@ -2022,13 +2308,27 @@ static HRESULT WINAPI TextFont_GetSuperscript(ITextFont *iface, LONG *value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%p): stub\n", This, value); @@ -758,7 +730,10 @@ index b3566e5..3623ec7 100644 + + if (value) + return E_INVALIDARG; -+ if (!This->reOle) ++ ++ *value = tomUndefined; ++ ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + + *value = tomFalse; @@ -770,13 +745,13 @@ index b3566e5..3623ec7 100644 ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%d): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2036,13 +2319,24 @@ static HRESULT WINAPI TextFont_GetUnderline(ITextFont *iface, LONG *value) +@@ -2036,13 +2336,27 @@ static HRESULT WINAPI TextFont_GetUnderline(ITextFont *iface, LONG *value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%p): stub\n", This, value); @@ -784,7 +759,10 @@ index b3566e5..3623ec7 100644 + + if (!value) + return E_INVALIDARG; -+ if (!This->reOle) ++ ++ *value = tomUndefined; ++ ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + + *value = tomNone; @@ -796,66 +774,58 @@ index b3566e5..3623ec7 100644 ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%d): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2050,6 +2344,10 @@ static HRESULT WINAPI TextFont_GetWeight(ITextFont *iface, LONG *value) +@@ -2050,6 +2364,10 @@ static HRESULT WINAPI TextFont_GetWeight(ITextFont *iface, LONG *value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%p): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2057,6 +2355,10 @@ static HRESULT WINAPI TextFont_SetWeight(ITextFont *iface, LONG value) +@@ -2057,6 +2375,10 @@ static HRESULT WINAPI TextFont_SetWeight(ITextFont *iface, LONG value) { ITextFontImpl *This = impl_from_ITextFont(iface); FIXME("(%p)->(%d): stub\n", This, value); + -+ if (!This->reOle) ++ if (!font_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2125,21 +2427,20 @@ static ITextFontVtbl textfontvtbl = { +@@ -2125,7 +2447,7 @@ static ITextFontVtbl textfontvtbl = { TextFont_SetWeight }; -static HRESULT create_textfont(ITextRange *range, ITextFont **ret) -+static HRESULT create_textfont(IRichEditOleImpl *reOle, ITextFontImpl **ret) ++static HRESULT create_textfont(ITextRange *range, ITextSelection *selection, ITextFont **ret) { ITextFontImpl *font; -- *ret = NULL; - font = heap_alloc(sizeof(*font)); - if (!font) - return E_OUTOFMEMORY; - +@@ -2137,7 +2459,9 @@ static HRESULT create_textfont(ITextRange *range, ITextFont **ret) font->ITextFont_iface.lpVtbl = &textfontvtbl; font->ref = 1; -- font->range = range; + font->range = range; - ITextRange_AddRef(range); -+ font->reOle = reOle; -+ list_add_head(&reOle->fontlist, &font->entry); ++ font->selection = selection; ++ if (range) ITextRange_AddRef(range); ++ if (selection) ITextSelection_AddRef(selection); -- *ret = &font->ITextFont_iface; -+ *ret = font; + *ret = &font->ITextFont_iface; return S_OK; - } - -@@ -3191,11 +3492,27 @@ static HRESULT WINAPI ITextSelection_fnSetEnd(ITextSelection *me, LONG cpLim) +@@ -3191,11 +3515,16 @@ static HRESULT WINAPI ITextSelection_fnSetEnd(ITextSelection *me, LONG cpLim) static HRESULT WINAPI ITextSelection_fnGetFont(ITextSelection *me, ITextFont **pFont) { ITextSelectionImpl *This = impl_from_ITextSelection(me); -+ ITextFontImpl *txtFont = NULL; -+ HRESULT hres; + + TRACE("(%p)->(%p)\n", This, pFont); + @@ -867,27 +837,10 @@ index b3566e5..3623ec7 100644 + if (!pFont) + return E_INVALIDARG; + -+ *pFont = NULL; -+ hres = create_textfont(This->reOle, &txtFont); -+ if (!hres) -+ { -+ txtFont->txtSel = This; -+ txtFont->txtRge = NULL; -+ ITextSelection_AddRef(me); -+ *pFont = &txtFont->ITextFont_iface; -+ } -+ return hres; ++ return create_textfont(NULL, me, pFont); } static HRESULT WINAPI ITextSelection_fnSetFont(ITextSelection *me, ITextFont *pFont) -@@ -3829,6 +4146,7 @@ LRESULT CreateIRichEditOle(IUnknown *outer_unk, ME_TextEditor *editor, LPVOID *p - } - TRACE("Created %p\n",reo); - list_init(&reo->rangelist); -+ list_init(&reo->fontlist); - if (outer_unk) - reo->outer_unk = outer_unk; - else diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c index e9ae68b..070b05a 100644 --- a/dlls/riched20/tests/richole.c diff --git a/patches/riched20-IText_Interface/0003-riched20-Stub-for-ITextPara-interface-and-implement-.patch b/patches/riched20-IText_Interface/0003-riched20-Stub-for-ITextPara-interface-and-implement-.patch index 79a087c0..7ececcb1 100644 --- a/patches/riched20-IText_Interface/0003-riched20-Stub-for-ITextPara-interface-and-implement-.patch +++ b/patches/riched20-IText_Interface/0003-riched20-Stub-for-ITextPara-interface-and-implement-.patch @@ -1,16 +1,16 @@ -From bc105d05c98bd8d4524ad67d9e95ab88bca4135b Mon Sep 17 00:00:00 2001 +From 41df8655376ce017e80ba6970a9400ff875f0ec5 Mon Sep 17 00:00:00 2001 From: Jactry Zeng Date: Sun, 10 Aug 2014 22:17:57 +0800 Subject: riched20: Stub for ITextPara interface and implement ITextRange::GetPara. --- - dlls/riched20/richole.c | 256 ++++++++++++++++++++++++++++++++++++++++-- - dlls/riched20/tests/richole.c | 47 ++++++++ - 2 files changed, 294 insertions(+), 9 deletions(-) + dlls/riched20/richole.c | 223 ++++++++++++++++++++++++++++++++++++++++++ + dlls/riched20/tests/richole.c | 47 +++++++++ + 2 files changed, 270 insertions(+) diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c -index 3623ec7..0e51c50 100644 +index 54448f5..6db9775 100644 --- a/dlls/riched20/richole.c +++ b/dlls/riched20/richole.c @@ -53,6 +53,7 @@ typedef struct ITextSelectionImpl ITextSelectionImpl; @@ -21,117 +21,39 @@ index 3623ec7..0e51c50 100644 typedef struct IRichEditOleImpl { IUnknown IUnknown_inner; -@@ -66,6 +67,7 @@ typedef struct IRichEditOleImpl { - IOleClientSiteImpl *clientSite; - struct list rangelist; - struct list fontlist; -+ struct list paralist; - } IRichEditOleImpl; - - struct ITextRangeImpl { -@@ -97,8 +99,11 @@ typedef struct ITextFontImpl { - typedef struct ITextParaImpl { - ITextPara ITextPara_iface; - LONG ref; -+ struct list entry; - -- ITextRange *range; -+ IRichEditOleImpl *reOle; -+ ITextRangeImpl *txtRge; -+ ITextSelectionImpl *txtSel; - } ITextParaImpl; - - struct IOleClientSiteImpl { -@@ -156,7 +161,7 @@ static inline ITextParaImpl *impl_from_ITextPara(ITextPara *iface) - } - - static HRESULT create_textfont(IRichEditOleImpl *, ITextFontImpl **); --static HRESULT create_textpara(ITextRange*, ITextPara**); -+static HRESULT create_textpara(IRichEditOleImpl *, ITextParaImpl **); - - enum textfont_prop_id { - FONT_ALLCAPS = 0, -@@ -321,6 +326,7 @@ static ULONG WINAPI IRichEditOleImpl_inner_fnRelease(IUnknown *iface) - { - ITextRangeImpl *txtRge; - ITextFontImpl *txtFont; -+ ITextParaImpl *txtPara; - - TRACE("Destroying %p\n", This); - This->txtSel->reOle = NULL; -@@ -331,6 +337,8 @@ static ULONG WINAPI IRichEditOleImpl_inner_fnRelease(IUnknown *iface) - txtRge->reOle = NULL; - LIST_FOR_EACH_ENTRY(txtFont, &This->fontlist, ITextFontImpl, entry) - txtFont->reOle = NULL; -+ LIST_FOR_EACH_ENTRY(txtPara, &This->paralist, ITextParaImpl, entry) -+ txtPara->reOle = NULL; - heap_free(This); - } +@@ -2511,9 +2512,24 @@ static ULONG WINAPI TextPara_Release(ITextPara *iface) return ref; -@@ -1142,6 +1150,8 @@ static HRESULT WINAPI ITextRange_fnSetFont(ITextRange *me, ITextFont *pFont) - static HRESULT WINAPI ITextRange_fnGetPara(ITextRange *me, ITextPara **para) - { - ITextRangeImpl *This = impl_from_ITextRange(me); -+ ITextParaImpl *txtPara = NULL; -+ HRESULT hres; - - TRACE("(%p)->(%p)\n", This, para); - -@@ -1151,7 +1161,16 @@ static HRESULT WINAPI ITextRange_fnGetPara(ITextRange *me, ITextPara **para) - if (!para) - return E_INVALIDARG; - -- return create_textpara(me, para); -+ *para = NULL; -+ hres = create_textpara(This->reOle, &txtPara); -+ if (!hres) -+ { -+ txtPara->txtSel = NULL; -+ txtPara->txtRge = This; -+ ITextRange_AddRef(me); -+ *para = &txtPara->ITextPara_iface; -+ } -+ return hres; } - static HRESULT WINAPI ITextRange_fnSetPara(ITextRange *me, ITextPara *pPara) -@@ -2481,7 +2500,14 @@ static ULONG WINAPI TextPara_Release(ITextPara *iface) - - if (!ref) - { -- ITextRange_Release(This->range); -+ if (This->txtRge) -+ ITextRange_Release(&This->txtRge->ITextRange_iface); -+ else -+ ITextSelection_Release(&This->txtSel->ITextSelection_iface); -+ This->reOle = NULL; -+ This->txtRge = NULL; -+ This->txtSel = NULL; -+ list_remove(&This->entry); - heap_free(This); - } - -@@ -2490,7 +2516,12 @@ static ULONG WINAPI TextPara_Release(ITextPara *iface) - ++static IRichEditOleImpl *para_get_reole(ITextParaImpl *This) ++{ ++ if (This->range) ++ { ++ ITextRangeImpl *rng = impl_from_ITextRange(This->range); ++ return rng->reOle; ++ } ++ return NULL; ++} ++ static HRESULT WINAPI TextPara_GetTypeInfoCount(ITextPara *iface, UINT *pctinfo) { + ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("stub\n"); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + *pctinfo = 0; return E_NOTIMPL; } -@@ -2498,14 +2529,24 @@ static HRESULT WINAPI TextPara_GetTypeInfoCount(ITextPara *iface, UINT *pctinfo) +@@ -2521,14 +2537,24 @@ static HRESULT WINAPI TextPara_GetTypeInfoCount(ITextPara *iface, UINT *pctinfo) static HRESULT WINAPI TextPara_GetTypeInfo(ITextPara *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) { + ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("stub\n"); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; @@ -143,587 +65,553 @@ index 3623ec7..0e51c50 100644 + ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("stub\n"); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2520,7 +2561,12 @@ static HRESULT WINAPI TextPara_Invoke( +@@ -2543,7 +2569,12 @@ static HRESULT WINAPI TextPara_Invoke( EXCEPINFO *pExcepInfo, UINT *puArgErr) { + ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("stub\n"); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2528,6 +2574,10 @@ static HRESULT WINAPI TextPara_GetDuplicate(ITextPara *iface, ITextPara **ret) +@@ -2551,6 +2582,10 @@ static HRESULT WINAPI TextPara_GetDuplicate(ITextPara *iface, ITextPara **ret) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%p)\n", This, ret); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2535,6 +2585,10 @@ static HRESULT WINAPI TextPara_SetDuplicate(ITextPara *iface, ITextPara *para) +@@ -2558,6 +2593,10 @@ static HRESULT WINAPI TextPara_SetDuplicate(ITextPara *iface, ITextPara *para) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%p)\n", This, para); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2542,6 +2596,10 @@ static HRESULT WINAPI TextPara_CanChange(ITextPara *iface, LONG *ret) +@@ -2565,6 +2604,10 @@ static HRESULT WINAPI TextPara_CanChange(ITextPara *iface, LONG *ret) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%p)\n", This, ret); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2549,6 +2607,10 @@ static HRESULT WINAPI TextPara_IsEqual(ITextPara *iface, ITextPara *para, LONG * +@@ -2572,6 +2615,10 @@ static HRESULT WINAPI TextPara_IsEqual(ITextPara *iface, ITextPara *para, LONG * { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%p %p)\n", This, para, ret); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2556,6 +2618,10 @@ static HRESULT WINAPI TextPara_Reset(ITextPara *iface, LONG value) +@@ -2579,6 +2626,10 @@ static HRESULT WINAPI TextPara_Reset(ITextPara *iface, LONG value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%d)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2563,6 +2629,10 @@ static HRESULT WINAPI TextPara_GetStyle(ITextPara *iface, LONG *value) +@@ -2586,6 +2637,10 @@ static HRESULT WINAPI TextPara_GetStyle(ITextPara *iface, LONG *value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%p)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2570,6 +2640,10 @@ static HRESULT WINAPI TextPara_SetStyle(ITextPara *iface, LONG value) +@@ -2593,6 +2648,10 @@ static HRESULT WINAPI TextPara_SetStyle(ITextPara *iface, LONG value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%d)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2577,6 +2651,10 @@ static HRESULT WINAPI TextPara_GetAlignment(ITextPara *iface, LONG *value) +@@ -2600,6 +2659,10 @@ static HRESULT WINAPI TextPara_GetAlignment(ITextPara *iface, LONG *value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%p)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2584,6 +2662,10 @@ static HRESULT WINAPI TextPara_SetAlignment(ITextPara *iface, LONG value) +@@ -2607,6 +2670,10 @@ static HRESULT WINAPI TextPara_SetAlignment(ITextPara *iface, LONG value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%d)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2591,6 +2673,10 @@ static HRESULT WINAPI TextPara_GetHyphenation(ITextPara *iface, LONG *value) +@@ -2614,6 +2681,10 @@ static HRESULT WINAPI TextPara_GetHyphenation(ITextPara *iface, LONG *value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%p)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2598,6 +2684,10 @@ static HRESULT WINAPI TextPara_SetHyphenation(ITextPara *iface, LONG value) +@@ -2621,6 +2692,10 @@ static HRESULT WINAPI TextPara_SetHyphenation(ITextPara *iface, LONG value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%d)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2605,6 +2695,10 @@ static HRESULT WINAPI TextPara_GetFirstLineIndent(ITextPara *iface, FLOAT *value +@@ -2628,6 +2703,10 @@ static HRESULT WINAPI TextPara_GetFirstLineIndent(ITextPara *iface, FLOAT *value { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%p)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2612,6 +2706,10 @@ static HRESULT WINAPI TextPara_GetKeepTogether(ITextPara *iface, LONG *value) +@@ -2635,6 +2714,10 @@ static HRESULT WINAPI TextPara_GetKeepTogether(ITextPara *iface, LONG *value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%p)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2619,6 +2717,10 @@ static HRESULT WINAPI TextPara_SetKeepTogether(ITextPara *iface, LONG value) +@@ -2642,6 +2725,10 @@ static HRESULT WINAPI TextPara_SetKeepTogether(ITextPara *iface, LONG value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%d)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2626,6 +2728,10 @@ static HRESULT WINAPI TextPara_GetKeepWithNext(ITextPara *iface, LONG *value) +@@ -2649,6 +2736,10 @@ static HRESULT WINAPI TextPara_GetKeepWithNext(ITextPara *iface, LONG *value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%p)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2633,6 +2739,10 @@ static HRESULT WINAPI TextPara_SetKeepWithNext(ITextPara *iface, LONG value) +@@ -2656,6 +2747,10 @@ static HRESULT WINAPI TextPara_SetKeepWithNext(ITextPara *iface, LONG value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%d)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2640,6 +2750,10 @@ static HRESULT WINAPI TextPara_GetLeftIndent(ITextPara *iface, FLOAT *value) +@@ -2663,6 +2758,10 @@ static HRESULT WINAPI TextPara_GetLeftIndent(ITextPara *iface, FLOAT *value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%p)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2647,6 +2761,10 @@ static HRESULT WINAPI TextPara_GetLineSpacing(ITextPara *iface, FLOAT *value) +@@ -2670,6 +2769,10 @@ static HRESULT WINAPI TextPara_GetLineSpacing(ITextPara *iface, FLOAT *value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%p)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2654,6 +2772,10 @@ static HRESULT WINAPI TextPara_GetLineSpacingRule(ITextPara *iface, LONG *value) +@@ -2677,6 +2780,10 @@ static HRESULT WINAPI TextPara_GetLineSpacingRule(ITextPara *iface, LONG *value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%p)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2661,6 +2783,10 @@ static HRESULT WINAPI TextPara_GetListAlignment(ITextPara *iface, LONG *value) +@@ -2684,6 +2791,10 @@ static HRESULT WINAPI TextPara_GetListAlignment(ITextPara *iface, LONG *value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%p)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2668,6 +2794,10 @@ static HRESULT WINAPI TextPara_SetListAlignment(ITextPara *iface, LONG value) +@@ -2691,6 +2802,10 @@ static HRESULT WINAPI TextPara_SetListAlignment(ITextPara *iface, LONG value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%d)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2675,6 +2805,10 @@ static HRESULT WINAPI TextPara_GetListLevelIndex(ITextPara *iface, LONG *value) +@@ -2698,6 +2813,10 @@ static HRESULT WINAPI TextPara_GetListLevelIndex(ITextPara *iface, LONG *value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%p)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2682,6 +2816,10 @@ static HRESULT WINAPI TextPara_SetListLevelIndex(ITextPara *iface, LONG value) +@@ -2705,6 +2824,10 @@ static HRESULT WINAPI TextPara_SetListLevelIndex(ITextPara *iface, LONG value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%d)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2689,6 +2827,10 @@ static HRESULT WINAPI TextPara_GetListStart(ITextPara *iface, LONG *value) +@@ -2712,6 +2835,10 @@ static HRESULT WINAPI TextPara_GetListStart(ITextPara *iface, LONG *value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%p)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2696,6 +2838,10 @@ static HRESULT WINAPI TextPara_SetListStart(ITextPara *iface, LONG value) +@@ -2719,6 +2846,10 @@ static HRESULT WINAPI TextPara_SetListStart(ITextPara *iface, LONG value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%d)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2703,6 +2849,10 @@ static HRESULT WINAPI TextPara_GetListTab(ITextPara *iface, FLOAT *value) +@@ -2726,6 +2857,10 @@ static HRESULT WINAPI TextPara_GetListTab(ITextPara *iface, FLOAT *value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%p)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2710,6 +2860,10 @@ static HRESULT WINAPI TextPara_SetListTab(ITextPara *iface, FLOAT value) +@@ -2733,6 +2868,10 @@ static HRESULT WINAPI TextPara_SetListTab(ITextPara *iface, FLOAT value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%.2f)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2717,6 +2871,10 @@ static HRESULT WINAPI TextPara_GetListType(ITextPara *iface, LONG *value) +@@ -2740,6 +2879,10 @@ static HRESULT WINAPI TextPara_GetListType(ITextPara *iface, LONG *value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%p)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2724,6 +2882,10 @@ static HRESULT WINAPI TextPara_SetListType(ITextPara *iface, LONG value) +@@ -2747,6 +2890,10 @@ static HRESULT WINAPI TextPara_SetListType(ITextPara *iface, LONG value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%d)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2731,6 +2893,10 @@ static HRESULT WINAPI TextPara_GetNoLineNumber(ITextPara *iface, LONG *value) +@@ -2754,6 +2901,10 @@ static HRESULT WINAPI TextPara_GetNoLineNumber(ITextPara *iface, LONG *value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%p)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2738,6 +2904,10 @@ static HRESULT WINAPI TextPara_SetNoLineNumber(ITextPara *iface, LONG value) +@@ -2761,6 +2912,10 @@ static HRESULT WINAPI TextPara_SetNoLineNumber(ITextPara *iface, LONG value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%d)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2745,6 +2915,10 @@ static HRESULT WINAPI TextPara_GetPageBreakBefore(ITextPara *iface, LONG *value) +@@ -2768,6 +2923,10 @@ static HRESULT WINAPI TextPara_GetPageBreakBefore(ITextPara *iface, LONG *value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%p)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2752,6 +2926,10 @@ static HRESULT WINAPI TextPara_SetPageBreakBefore(ITextPara *iface, LONG value) +@@ -2775,6 +2934,10 @@ static HRESULT WINAPI TextPara_SetPageBreakBefore(ITextPara *iface, LONG value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%d)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2759,6 +2937,10 @@ static HRESULT WINAPI TextPara_GetRightIndent(ITextPara *iface, FLOAT *value) +@@ -2782,6 +2945,10 @@ static HRESULT WINAPI TextPara_GetRightIndent(ITextPara *iface, FLOAT *value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%p)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2766,6 +2948,10 @@ static HRESULT WINAPI TextPara_SetRightIndent(ITextPara *iface, FLOAT value) +@@ -2789,6 +2956,10 @@ static HRESULT WINAPI TextPara_SetRightIndent(ITextPara *iface, FLOAT value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%.2f)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2773,6 +2959,10 @@ static HRESULT WINAPI TextPara_SetIndents(ITextPara *iface, FLOAT StartIndent, F +@@ -2796,6 +2967,10 @@ static HRESULT WINAPI TextPara_SetIndents(ITextPara *iface, FLOAT StartIndent, F { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%.2f %.2f %.2f)\n", This, StartIndent, LeftIndent, RightIndent); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2780,6 +2970,10 @@ static HRESULT WINAPI TextPara_SetLineSpacing(ITextPara *iface, LONG LineSpacing +@@ -2803,6 +2978,10 @@ static HRESULT WINAPI TextPara_SetLineSpacing(ITextPara *iface, LONG LineSpacing { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%d %.2f)\n", This, LineSpacingRule, LineSpacing); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2787,6 +2981,10 @@ static HRESULT WINAPI TextPara_GetSpaceAfter(ITextPara *iface, FLOAT *value) +@@ -2810,6 +2989,10 @@ static HRESULT WINAPI TextPara_GetSpaceAfter(ITextPara *iface, FLOAT *value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%p)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2794,6 +2992,10 @@ static HRESULT WINAPI TextPara_SetSpaceAfter(ITextPara *iface, FLOAT value) +@@ -2817,6 +3000,10 @@ static HRESULT WINAPI TextPara_SetSpaceAfter(ITextPara *iface, FLOAT value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%.2f)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2801,6 +3003,10 @@ static HRESULT WINAPI TextPara_GetSpaceBefore(ITextPara *iface, FLOAT *value) +@@ -2824,6 +3011,10 @@ static HRESULT WINAPI TextPara_GetSpaceBefore(ITextPara *iface, FLOAT *value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%p)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2808,6 +3014,10 @@ static HRESULT WINAPI TextPara_SetSpaceBefore(ITextPara *iface, FLOAT value) +@@ -2831,6 +3022,10 @@ static HRESULT WINAPI TextPara_SetSpaceBefore(ITextPara *iface, FLOAT value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%.2f)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2815,6 +3025,10 @@ static HRESULT WINAPI TextPara_GetWidowControl(ITextPara *iface, LONG *value) +@@ -2838,6 +3033,10 @@ static HRESULT WINAPI TextPara_GetWidowControl(ITextPara *iface, LONG *value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%p)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2822,6 +3036,10 @@ static HRESULT WINAPI TextPara_SetWidowControl(ITextPara *iface, LONG value) +@@ -2845,6 +3044,10 @@ static HRESULT WINAPI TextPara_SetWidowControl(ITextPara *iface, LONG value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%d)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2829,6 +3047,10 @@ static HRESULT WINAPI TextPara_GetTabCount(ITextPara *iface, LONG *value) +@@ -2852,6 +3055,10 @@ static HRESULT WINAPI TextPara_GetTabCount(ITextPara *iface, LONG *value) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%p)\n", This, value); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2836,6 +3058,10 @@ static HRESULT WINAPI TextPara_AddTab(ITextPara *iface, FLOAT tbPos, LONG tbAlig +@@ -2859,6 +3066,10 @@ static HRESULT WINAPI TextPara_AddTab(ITextPara *iface, FLOAT tbPos, LONG tbAlig { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%.2f %d %d)\n", This, tbPos, tbAlign, tbLeader); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2843,6 +3069,10 @@ static HRESULT WINAPI TextPara_ClearAllTabs(ITextPara *iface) +@@ -2866,6 +3077,10 @@ static HRESULT WINAPI TextPara_ClearAllTabs(ITextPara *iface) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)\n", This); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2850,6 +3080,10 @@ static HRESULT WINAPI TextPara_DeleteTab(ITextPara *iface, FLOAT pos) +@@ -2873,6 +3088,10 @@ static HRESULT WINAPI TextPara_DeleteTab(ITextPara *iface, FLOAT pos) { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%.2f)\n", This, pos); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2857,6 +3091,10 @@ static HRESULT WINAPI TextPara_GetTab(ITextPara *iface, LONG iTab, FLOAT *ptbPos +@@ -2880,6 +3099,10 @@ static HRESULT WINAPI TextPara_GetTab(ITextPara *iface, LONG iTab, FLOAT *ptbPos { ITextParaImpl *This = impl_from_ITextPara(iface); FIXME("(%p)->(%d %p %p %p)\n", This, iTab, ptbPos, ptbAlign, ptbLeader); + -+ if (!This->reOle) ++ if (!para_get_reole(This)) + return CO_E_RELEASED; + return E_NOTIMPL; } -@@ -2918,21 +3156,20 @@ static ITextParaVtbl textparavtbl = { - TextPara_GetTab - }; - --static HRESULT create_textpara(ITextRange *range, ITextPara **ret) -+static HRESULT create_textpara(IRichEditOleImpl *reOle, ITextParaImpl **ret) - { - ITextParaImpl *para; - -- *ret = NULL; - para = heap_alloc(sizeof(*para)); - if (!para) - return E_OUTOFMEMORY; - - para->ITextPara_iface.lpVtbl = &textparavtbl; - para->ref = 1; -- para->range = range; -- ITextRange_AddRef(range); -+ para->reOle = reOle; -+ list_add_head(&reOle->paralist, ¶->entry); - -- *ret = ¶->ITextPara_iface; -+ *ret = para; - return S_OK; - } - -@@ -4147,6 +4384,7 @@ LRESULT CreateIRichEditOle(IUnknown *outer_unk, ME_TextEditor *editor, LPVOID *p - TRACE("Created %p\n",reo); - list_init(&reo->rangelist); - list_init(&reo->fontlist); -+ list_init(&reo->paralist); - if (outer_unk) - reo->outer_unk = outer_unk; - else diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c index 070b05a..0fb5c98 100644 --- a/dlls/riched20/tests/richole.c diff --git a/patches/riched20-IText_Interface/0010-riched20-Fix-invalid-memory-access-when-parent-objec.patch b/patches/riched20-IText_Interface/0010-riched20-Fix-invalid-memory-access-when-parent-objec.patch deleted file mode 100644 index 74283cce..00000000 --- a/patches/riched20-IText_Interface/0010-riched20-Fix-invalid-memory-access-when-parent-objec.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 44c16f1f02bf269a595b914bcc55a37184fc1fa4 Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Sat, 13 Sep 2014 17:21:31 +0200 -Subject: riched20: Fix invalid memory access when parent object was destroyed - earlier than child object. - ---- - dlls/riched20/richole.c | 14 ++++++++++---- - 1 file changed, 10 insertions(+), 4 deletions(-) - -diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c -index d3ed501..7a07a84 100644 ---- a/dlls/riched20/richole.c -+++ b/dlls/riched20/richole.c -@@ -1618,10 +1618,13 @@ static ULONG WINAPI TextFont_Release(ITextFont *iface) - ITextRange_Release(&This->txtRge->ITextRange_iface); - else - ITextSelection_Release(&This->txtSel->ITextSelection_iface); -- This->reOle = NULL; - This->txtRge = NULL; - This->txtSel = NULL; -- list_remove(&This->entry); -+ if (This->reOle) -+ { -+ list_remove(&This->entry); -+ This->reOle = NULL; -+ } - heap_free(This); - } - -@@ -2441,10 +2444,13 @@ static ULONG WINAPI TextPara_Release(ITextPara *iface) - ITextRange_Release(&This->txtRge->ITextRange_iface); - else - ITextSelection_Release(&This->txtSel->ITextSelection_iface); -- This->reOle = NULL; - This->txtRge = NULL; - This->txtSel = NULL; -- list_remove(&This->entry); -+ if (This->reOle) -+ { -+ list_remove(&This->entry); -+ This->reOle = NULL; -+ } - heap_free(This); - } - --- -2.4.0 - diff --git a/patches/riched20-IText_Interface/0011-riched20-Silence-repeated-FIXMEs-triggered-by-Adobe-.patch b/patches/riched20-IText_Interface/0010-riched20-Silence-repeated-FIXMEs-triggered-by-Adobe-.patch similarity index 67% rename from patches/riched20-IText_Interface/0011-riched20-Silence-repeated-FIXMEs-triggered-by-Adobe-.patch rename to patches/riched20-IText_Interface/0010-riched20-Silence-repeated-FIXMEs-triggered-by-Adobe-.patch index edc735c8..53e7b30f 100644 --- a/patches/riched20-IText_Interface/0011-riched20-Silence-repeated-FIXMEs-triggered-by-Adobe-.patch +++ b/patches/riched20-IText_Interface/0010-riched20-Silence-repeated-FIXMEs-triggered-by-Adobe-.patch @@ -1,4 +1,4 @@ -From e0ae36a5cdcabb900a2e12a701990f4d0fcc7f7b Mon Sep 17 00:00:00 2001 +From 85ae581146a9791fd45006b273c19f822f1ccf4f Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 1 Nov 2014 22:51:34 +0100 Subject: riched20: Silence repeated FIXMEs triggered by Adobe Reader. @@ -9,10 +9,10 @@ Adobe Reader calls these functions very often while scrolling through a document 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c -index a2cdcf4..cb12e80 100644 +index b9213f6..6676d9a 100644 --- a/dlls/riched20/richole.c +++ b/dlls/riched20/richole.c -@@ -300,6 +300,14 @@ static HRESULT WINAPI IRichEditOleImpl_inner_fnQueryInterface(IUnknown *iface, R +@@ -294,6 +294,14 @@ static HRESULT WINAPI IRichEditOleImpl_inner_fnQueryInterface(IUnknown *iface, R IUnknown_AddRef((IUnknown *)*ppvObj); return S_OK; } @@ -27,17 +27,24 @@ index a2cdcf4..cb12e80 100644 FIXME("%p: unhandled interface %s\n", This, debugstr_guid(riid)); return E_NOINTERFACE; -@@ -1961,7 +1969,8 @@ static HRESULT WINAPI TextFont_GetBold(ITextFont *iface, LONG *value) - return CO_E_RELEASED; - if (!This->txtRge) - { -- FIXME("not implemented\n"); -+ static int once; -+ if (!once++) FIXME("not implemented\n"); - return E_NOTIMPL; - } +@@ -1927,6 +1935,7 @@ static HRESULT WINAPI TextFont_SetBackColor(ITextFont *iface, LONG value) + static HRESULT WINAPI TextFont_GetBold(ITextFont *iface, LONG *value) + { + ITextFontImpl *This = impl_from_ITextFont(iface); ++ static int once; + TRACE("(%p)->(%p)\n", This, value); -@@ -2004,7 +2013,9 @@ static HRESULT WINAPI TextFont_SetEmboss(ITextFont *iface, LONG value) + if (This->range) +@@ -1940,7 +1949,7 @@ static HRESULT WINAPI TextFont_GetBold(ITextFont *iface, LONG *value) + if (!font_get_reole(This)) + return CO_E_RELEASED; + +- FIXME("not implemented\n"); ++ if (!once++) FIXME("not implemented\n"); + return E_NOTIMPL; + } + +@@ -1980,7 +1989,9 @@ static HRESULT WINAPI TextFont_SetEmboss(ITextFont *iface, LONG value) static HRESULT WINAPI TextFont_GetForeColor(ITextFont *iface, LONG *value) { ITextFontImpl *This = impl_from_ITextFont(iface); @@ -48,17 +55,24 @@ index a2cdcf4..cb12e80 100644 if (!value) return E_INVALIDARG; -@@ -2081,7 +2092,8 @@ static HRESULT WINAPI TextFont_GetItalic(ITextFont *iface, LONG *value) - return CO_E_RELEASED; - if (!This->txtRge) - { -- FIXME("not implemented\n"); -+ static int once; -+ if (!once++) FIXME("not implemented\n"); - return E_NOTIMPL; - } +@@ -2052,6 +2063,7 @@ static HRESULT WINAPI TextFont_SetEngrave(ITextFont *iface, LONG value) + static HRESULT WINAPI TextFont_GetItalic(ITextFont *iface, LONG *value) + { + ITextFontImpl *This = impl_from_ITextFont(iface); ++ static int once; + TRACE("(%p)->(%p)\n", This, value); -@@ -2124,7 +2136,9 @@ static HRESULT WINAPI TextFont_SetKerning(ITextFont *iface, FLOAT value) + if (This->range) +@@ -2065,7 +2077,7 @@ static HRESULT WINAPI TextFont_GetItalic(ITextFont *iface, LONG *value) + if (!font_get_reole(This)) + return CO_E_RELEASED; + +- FIXME("not implemented\n"); ++ if (!once++) FIXME("not implemented\n"); + return E_NOTIMPL; + } + +@@ -2105,7 +2117,9 @@ static HRESULT WINAPI TextFont_SetKerning(ITextFont *iface, FLOAT value) static HRESULT WINAPI TextFont_GetLanguageID(ITextFont *iface, LONG *value) { ITextFontImpl *This = impl_from_ITextFont(iface); @@ -67,9 +81,9 @@ index a2cdcf4..cb12e80 100644 + + if (!once++) FIXME("(%p)->(%p): stub\n", This, value); - if (!This->reOle) + if (!font_get_reole(This)) return CO_E_RELEASED; -@@ -2261,7 +2275,9 @@ static HRESULT WINAPI TextFont_SetShadow(ITextFont *iface, LONG value) +@@ -2245,7 +2259,9 @@ static HRESULT WINAPI TextFont_SetShadow(ITextFont *iface, LONG value) static HRESULT WINAPI TextFont_GetSize(ITextFont *iface, FLOAT *value) { ITextFontImpl *This = impl_from_ITextFont(iface); @@ -80,7 +94,7 @@ index a2cdcf4..cb12e80 100644 if (!value) return E_INVALIDARG; -@@ -2330,7 +2346,9 @@ static HRESULT WINAPI TextFont_SetSpacing(ITextFont *iface, FLOAT value) +@@ -2317,7 +2333,9 @@ static HRESULT WINAPI TextFont_SetSpacing(ITextFont *iface, FLOAT value) static HRESULT WINAPI TextFont_GetStrikeThrough(ITextFont *iface, LONG *value) { ITextFontImpl *This = impl_from_ITextFont(iface); @@ -91,7 +105,7 @@ index a2cdcf4..cb12e80 100644 if (!value) return E_INVALIDARG; -@@ -2355,7 +2373,9 @@ static HRESULT WINAPI TextFont_SetStrikeThrough(ITextFont *iface, LONG value) +@@ -2345,7 +2363,9 @@ static HRESULT WINAPI TextFont_SetStrikeThrough(ITextFont *iface, LONG value) static HRESULT WINAPI TextFont_GetSubscript(ITextFont *iface, LONG *value) { ITextFontImpl *This = impl_from_ITextFont(iface); @@ -101,8 +115,8 @@ index a2cdcf4..cb12e80 100644 + if (!once++) FIXME("(%p)->(%p): stub\n", This, value); if (!value) - return E_INVALIDARG; -@@ -2405,7 +2425,9 @@ static HRESULT WINAPI TextFont_SetSuperscript(ITextFont *iface, LONG value) + return E_INVALIDARG; +@@ -2401,7 +2421,9 @@ static HRESULT WINAPI TextFont_SetSuperscript(ITextFont *iface, LONG value) static HRESULT WINAPI TextFont_GetUnderline(ITextFont *iface, LONG *value) { ITextFontImpl *This = impl_from_ITextFont(iface); @@ -113,7 +127,7 @@ index a2cdcf4..cb12e80 100644 if (!value) return E_INVALIDARG; -@@ -2430,7 +2452,9 @@ static HRESULT WINAPI TextFont_SetUnderline(ITextFont *iface, LONG value) +@@ -2429,7 +2451,9 @@ static HRESULT WINAPI TextFont_SetUnderline(ITextFont *iface, LONG value) static HRESULT WINAPI TextFont_GetWeight(ITextFont *iface, LONG *value) { ITextFontImpl *This = impl_from_ITextFont(iface); @@ -122,9 +136,9 @@ index a2cdcf4..cb12e80 100644 + + if (!once++) FIXME("(%p)->(%p): stub\n", This, value); - if (!This->reOle) + if (!font_get_reole(This)) return CO_E_RELEASED; -@@ -2721,7 +2745,9 @@ static HRESULT WINAPI TextPara_SetStyle(ITextPara *iface, LONG value) +@@ -2723,7 +2747,9 @@ static HRESULT WINAPI TextPara_SetStyle(ITextPara *iface, LONG value) static HRESULT WINAPI TextPara_GetAlignment(ITextPara *iface, LONG *value) { ITextParaImpl *This = impl_from_ITextPara(iface); @@ -133,7 +147,7 @@ index a2cdcf4..cb12e80 100644 + + if (!once++) FIXME("(%p)->(%p)\n", This, value); - if (!This->reOle) + if (!para_get_reole(This)) return CO_E_RELEASED; -- 2.4.0 diff --git a/patches/riched20-IText_Interface/0012-riched20-Implement-ITextSelection_fnGetDuplicate.patch b/patches/riched20-IText_Interface/0011-riched20-Implement-ITextSelection_fnGetDuplicate.patch similarity index 86% rename from patches/riched20-IText_Interface/0012-riched20-Implement-ITextSelection_fnGetDuplicate.patch rename to patches/riched20-IText_Interface/0011-riched20-Implement-ITextSelection_fnGetDuplicate.patch index 41f62604..80a45525 100644 --- a/patches/riched20-IText_Interface/0012-riched20-Implement-ITextSelection_fnGetDuplicate.patch +++ b/patches/riched20-IText_Interface/0011-riched20-Implement-ITextSelection_fnGetDuplicate.patch @@ -1,4 +1,4 @@ -From f5476c2bce17468ae3ca3e24248e76c8ca7a4fb9 Mon Sep 17 00:00:00 2001 +From acafb0f9fc1775ba95c3f5dfba08c15fd6678904 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 1 Nov 2014 23:07:09 +0100 Subject: riched20: Implement ITextSelection_fnGetDuplicate. @@ -9,10 +9,10 @@ Fixes a crash with Adobe Reader when entering a page number. 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c -index 9de460f..84c8be4 100644 +index 6676d9a..a7eb1d9 100644 --- a/dlls/riched20/richole.c +++ b/dlls/riched20/richole.c -@@ -3178,11 +3178,17 @@ static HRESULT WINAPI ITextSelection_fnSetChar(ITextSelection *me, LONG ch) +@@ -3681,11 +3681,17 @@ static HRESULT WINAPI ITextSelection_fnSetChar(ITextSelection *me, LONG ch) static HRESULT WINAPI ITextSelection_fnGetDuplicate(ITextSelection *me, ITextRange **ppRange) { ITextSelectionImpl *This = impl_from_ITextSelection(me); @@ -33,5 +33,5 @@ index 9de460f..84c8be4 100644 static HRESULT WINAPI ITextSelection_fnGetFormattedText(ITextSelection *me, ITextRange **ppRange) -- -2.1.2 +2.4.0