Update patches for riched20-IText_Interface.

This commit is contained in:
Sebastian Lackner 2014-08-11 05:04:55 +02:00
parent 4aa699f6ca
commit 43bba1b164
10 changed files with 163 additions and 301 deletions

View File

@ -503,10 +503,10 @@ quartz-MediaSeeking_Positions.ok:
# Patchset riched20-IText_Interface
# |
# | Included patches:
# | * Implement Stubs for ITextRange interface. [by Jactry Zeng]
# | * Implement Stubs for ITextRange interface. [rev 2, by Jactry Zeng]
# | * Implement IText{Range,Selection}::{GetChar,GetStart,GetEnd,GetDuplicate,Collapse,SetStart,SetEnd}. [by Jactry Zeng]
# | * Implement Stubs for ITextFont interface. [by Jactry Zeng]
# | * Implement Stubs for ITextPara interface. [by Jactry Zeng]
# | * Implement Stubs for ITextFont interface. [rev 2, by Jactry Zeng]
# | * Implement Stubs for ITextPara interface. [rev 2, by Jactry Zeng]
# |
# | This patchset fixes the following Wine bugs:
# | * [#12458] Multiple apps fail due to RichEdit ITextDocument_fnRange stub (MySQL Workbench, BlitzMaxDemo137)
@ -526,10 +526,10 @@ riched20-IText_Interface.ok:
$(call APPLY_FILE,riched20-IText_Interface/0007-riched20-Stub-for-ITextFont-interface-and-implement-.patch)
$(call APPLY_FILE,riched20-IText_Interface/0008-riched20-Stub-for-ITextPara-interface-and-implement-.patch)
@( \
echo '+ { "riched20-IText_Interface", "Jactry Zeng", "Implement Stubs for ITextRange interface." },'; \
echo '+ { "riched20-IText_Interface", "Jactry Zeng", "Implement Stubs for ITextRange interface. [rev 2]" },'; \
echo '+ { "riched20-IText_Interface", "Jactry Zeng", "Implement IText{Range,Selection}::{GetChar,GetStart,GetEnd,GetDuplicate,Collapse,SetStart,SetEnd}." },'; \
echo '+ { "riched20-IText_Interface", "Jactry Zeng", "Implement Stubs for ITextFont interface." },'; \
echo '+ { "riched20-IText_Interface", "Jactry Zeng", "Implement Stubs for ITextPara interface." },'; \
echo '+ { "riched20-IText_Interface", "Jactry Zeng", "Implement Stubs for ITextFont interface. [rev 2]" },'; \
echo '+ { "riched20-IText_Interface", "Jactry Zeng", "Implement Stubs for ITextPara interface. [rev 2]" },'; \
) > riched20-IText_Interface.ok
# Patchset server-ACL_Compat

View File

@ -1,16 +1,16 @@
From 1fb42d0cc90d02df67dc117764f6352da0e40195 Mon Sep 17 00:00:00 2001
From 31fc24d0900889d69dcdba411420216ba15675c0 Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Fri, 8 Aug 2014 20:12:54 +0800
Date: Sun, 10 Aug 2014 21:50:03 +0800
Subject: riched20: Stub for ITextRange interface and implement
ITextDocument::Range.
---
dlls/riched20/richole.c | 773 ++++++++++++++++++++++++++++++++++++++++-
dlls/riched20/tests/richole.c | 36 +-
2 files changed, 806 insertions(+), 3 deletions(-)
dlls/riched20/richole.c | 726 ++++++++++++++++++++++++++++++++++++++++-
dlls/riched20/tests/richole.c | 35 +-
2 files changed, 758 insertions(+), 3 deletions(-)
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index 487fcda..314bc1e 100644
index 487fcda..8ec5314 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -49,6 +49,7 @@ DEFINE_GUID(IID_ITextSelection, 0x8cc497c1, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0x
@ -25,14 +25,14 @@ index 487fcda..314bc1e 100644
ME_TextEditor *editor;
ITextSelectionImpl *txtSel;
IOleClientSiteImpl *clientSite;
+ ITextRangeImpl *txtRgehead, *txtRgetail;
+ struct list rangelist;
} IRichEditOleImpl;
+struct ITextRangeImpl {
+ ITextRange ITextRange_iface;
+ LONG ref;
+ int start, end;
+ ITextRangeImpl *prev, *next;
+ LONG start, end;
+ struct list entry;
+
+ IRichEditOleImpl *reOle;
+};
@ -40,26 +40,21 @@ index 487fcda..314bc1e 100644
struct ITextSelectionImpl {
ITextSelection ITextSelection_iface;
LONG ref;
@@ -128,10 +139,18 @@ IRichEditOle_fnRelease(IRichEditOle *me)
@@ -128,10 +139,13 @@ IRichEditOle_fnRelease(IRichEditOle *me)
if (!ref)
{
+ ITextRangeImpl *txtRgeImpl = This->txtRgehead->next;
+ ITextRangeImpl *txtRge;
TRACE ("Destroying %p\n", This);
This->txtSel->reOle = NULL;
ITextSelection_Release(&This->txtSel->ITextSelection_iface);
IOleClientSite_Release(&This->clientSite->IOleClientSite_iface);
+ while (txtRgeImpl)
+ {
+ txtRgeImpl->reOle = NULL;
+ txtRgeImpl = txtRgeImpl->next;
+ }
+ heap_free(This->txtRgehead);
+ heap_free(This->txtRgetail);
+ LIST_FOR_EACH_ENTRY(txtRge, &This->rangelist, ITextRangeImpl, entry)
+ txtRge->reOle = NULL;
heap_free(This);
}
return ref;
@@ -443,6 +462,681 @@ static const IRichEditOleVtbl revt = {
@@ -443,6 +457,680 @@ static const IRichEditOleVtbl revt = {
IRichEditOle_fnImportDataObject
};
@ -99,8 +94,7 @@ index 487fcda..314bc1e 100644
+ if (ref == 0)
+ {
+ This->reOle = NULL;
+ This->prev->next = This->next;
+ This->next->prev = This->prev;
+ list_remove(&This->entry);
+ heap_free(This);
+ }
+ return ref;
@ -741,7 +735,25 @@ index 487fcda..314bc1e 100644
static HRESULT WINAPI
ITextDocument_fnQueryInterface(ITextDocument* me, REFIID riid,
void** ppvObject)
@@ -651,8 +1345,40 @@ ITextDocument_fnRange(ITextDocument* me, LONG cp1, LONG cp2,
@@ -646,13 +1334,46 @@ ITextDocument_fnRedo(ITextDocument* me, LONG Count, LONG* prop)
return E_NOTIMPL;
}
+static HRESULT CreateITextRange(IRichEditOleImpl *reOle, LONG start, LONG end,
+ ITextRangeImpl *txtRge, ITextRange** ppRange)
+{
+ txtRge->ITextRange_iface.lpVtbl = &trvt;
+ txtRge->ref = 1;
+ txtRge->reOle = reOle;
+ txtRge->start = start;
+ txtRge->end = end;
+ list_add_head(&reOle->rangelist, &txtRge->entry);
+ *ppRange = &txtRge->ITextRange_iface;
+ return S_OK;
+}
+
static HRESULT WINAPI
ITextDocument_fnRange(ITextDocument* me, LONG cp1, LONG cp2,
ITextRange** ppRange)
{
IRichEditOleImpl *This = impl_from_ITextDocument(me);
@ -758,91 +770,30 @@ index 487fcda..314bc1e 100644
+ cp2 = max(cp2, 0);
+ cp1 = min(cp1, len);
+ cp2 = min(cp2, len);
+ if (cp1 >= cp2)
+ if (cp1 > cp2)
+ {
+ int tmp;
+ tmp = cp1;
+ cp1 = cp2;
+ cp2 = tmp;
+ }
+
+ txtRge = heap_alloc(sizeof *txtRge);
+ txtRge = heap_alloc(sizeof(ITextRangeImpl));
+ if (!txtRge)
+ return E_OUTOFMEMORY;
+ txtRge->ITextRange_iface.lpVtbl = &trvt;
+ txtRge->ref = 1;
+ txtRge->reOle = This;
+ txtRge->start = cp1;
+ txtRge->end = cp2;
+ txtRge->next = This->txtRgehead->next;
+ This->txtRgehead->next->prev = txtRge;
+ This->txtRgehead->next = txtRge;
+ txtRge->prev = This->txtRgehead;
+ *ppRange = &txtRge->ITextRange_iface;
+
+ return S_OK;
+ return CreateITextRange(This, cp1, cp2, txtRge, ppRange);
}
static HRESULT WINAPI
@@ -1521,6 +2247,30 @@ CreateTextSelection(IRichEditOleImpl *reOle)
return txtSel;
}
+static void CreateEmptyITextRangeImpl(IRichEditOleImpl *reOle, int type)
+{
+ ITextRangeImpl *txtRgeImpl;
+ if (type)
+ {
+ txtRgeImpl = reOle->txtRgehead;
+ txtRgeImpl->prev = NULL;
+ txtRgeImpl->next = reOle->txtRgetail;
+ }
+ else
+ {
+ txtRgeImpl = reOle->txtRgetail;
+ txtRgeImpl->prev = reOle->txtRgehead;
+ txtRgeImpl->next = NULL;
+ }
+
+ txtRgeImpl->ITextRange_iface.lpVtbl = &trvt;
+ txtRgeImpl->ref = 1;
+ txtRgeImpl->reOle = NULL;
+ txtRgeImpl->start = 0;
+ txtRgeImpl->end = 0;
+
+}
+
LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *ppObj)
{
IRichEditOleImpl *reo;
@@ -1549,6 +2299,25 @@ LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *ppObj)
@@ -1548,6 +2269,7 @@ LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *ppObj)
}
TRACE("Created %p\n",reo);
*ppObj = reo;
+ list_init(&reo->rangelist);
+ reo->txtRgehead = heap_alloc(sizeof(ITextRangeImpl));
+ if (!reo->txtRgehead)
+ {
+ ITextSelection_Release(&reo->txtSel->ITextSelection_iface);
+ IOleClientSite_Release(&reo->clientSite->IOleClientSite_iface);
+ heap_free(reo);
+ return 0;
+ }
+ reo->txtRgetail = heap_alloc(sizeof(ITextRangeImpl));
+ if (!reo->txtRgetail)
+ {
+ ITextSelection_Release(&reo->txtSel->ITextSelection_iface);
+ IOleClientSite_Release(&reo->clientSite->IOleClientSite_iface);
+ heap_free(reo->txtRgehead);
+ heap_free(reo);
+ return 0;
+ }
+ CreateEmptyITextRangeImpl(reo, 1);
+ CreateEmptyITextRangeImpl(reo, 0);
return 1;
}
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index 571e5cd..417b68f 100644
index 571e5cd..f56a14a 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -86,10 +86,11 @@ static void create_interfaces(HWND *w, IRichEditOle **reOle, ITextDocument **txt
@ -858,7 +809,7 @@ index 571e5cd..417b68f 100644
}
static ULONG get_refcount(IUnknown *iface)
@@ -486,6 +487,38 @@ static void test_ITextSelection_GetText(void)
@@ -486,6 +487,37 @@ static void test_ITextSelection_GetText(void)
release_interfaces(&w, &reOle, &txtDoc, &txtSel);
}
@ -892,12 +843,11 @@ index 571e5cd..417b68f 100644
+ ok(hres == CO_E_RELEASED, "ITextRange after ITextDocument destroyed\n");
+ ITextRange_Release(txtRge);
+}
+
+
START_TEST(richole)
{
/* Must explicitly LoadLibrary(). The test has no references to functions in
@@ -496,4 +529,5 @@ START_TEST(richole)
@@ -496,4 +528,5 @@ START_TEST(richole)
test_Interfaces();
test_ITextDocument_Open();
test_ITextSelection_GetText();

View File

@ -1,18 +1,18 @@
From e62c0def4ec23fcbc74f217fe1f12458b2eb5225 Mon Sep 17 00:00:00 2001
From 880c4eeef11d2898a6ea5e66118429f862da9e2d Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Thu, 7 Aug 2014 13:50:08 +0800
Date: Sun, 10 Aug 2014 21:55:44 +0800
Subject: riched20: Implement ITextSelection::GetChar and ITextRange::GetChar.
---
dlls/riched20/richole.c | 28 ++++++++++++++---
dlls/riched20/tests/richole.c | 69 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 93 insertions(+), 4 deletions(-)
dlls/riched20/tests/richole.c | 70 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 94 insertions(+), 4 deletions(-)
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index 314bc1e..e93070a 100644
index 8ec5314..bfc5004 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -568,14 +568,29 @@ static HRESULT WINAPI ITextRange_fnSetText(ITextRange *me, BSTR bstr)
@@ -562,14 +562,29 @@ static HRESULT WINAPI ITextRange_fnSetText(ITextRange *me, BSTR bstr)
return E_NOTIMPL;
}
@ -44,7 +44,7 @@ index 314bc1e..e93070a 100644
}
static HRESULT WINAPI ITextRange_fnSetChar(ITextRange *me, LONG ch)
@@ -1552,11 +1567,16 @@ static HRESULT WINAPI ITextSelection_fnSetText(ITextSelection *me, BSTR bstr)
@@ -1547,11 +1562,16 @@ static HRESULT WINAPI ITextSelection_fnSetText(ITextSelection *me, BSTR bstr)
static HRESULT WINAPI ITextSelection_fnGetChar(ITextSelection *me, LONG *pch)
{
ITextSelectionImpl *This = impl_from_ITextSelection(me);
@ -64,10 +64,10 @@ index 314bc1e..e93070a 100644
static HRESULT WINAPI ITextSelection_fnSetChar(ITextSelection *me, LONG ch)
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index 417b68f..152d144 100644
index f56a14a..152d144 100644
--- a/dlls/riched20/tests/richole.c
+++ b/dlls/riched20/tests/richole.c
@@ -518,6 +518,73 @@ static void test_ITextDocument_Range(void)
@@ -518,6 +518,74 @@ static void test_ITextDocument_Range(void)
ITextRange_Release(txtRge);
}
@ -138,10 +138,11 @@ index 417b68f..152d144 100644
+ ITextRange_Release(txtRge);
+ release_interfaces(&w, &reOle, &txtDoc, NULL);
+}
+
START_TEST(richole)
{
@@ -529,5 +596,7 @@ START_TEST(richole)
/* Must explicitly LoadLibrary(). The test has no references to functions in
@@ -528,5 +596,7 @@ START_TEST(richole)
test_Interfaces();
test_ITextDocument_Open();
test_ITextSelection_GetText();

View File

@ -1,4 +1,4 @@
From 2ac5a6bc7f97a2179fcf566183d7a5f989ebe401 Mon Sep 17 00:00:00 2001
From 4e32169f71847a72ede19be796935c95848c079c Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Thu, 7 Aug 2014 14:59:13 +0800
Subject: riched20: Implement IText{Selection, Range}::Get{Start, End}.
@ -9,10 +9,10 @@ Subject: riched20: Implement IText{Selection, Range}::Get{Start, End}.
2 files changed, 72 insertions(+), 8 deletions(-)
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index e93070a..bd3dee8 100644
index bfc5004..d8382b7 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -639,8 +639,11 @@ static HRESULT WINAPI ITextRange_fnGetStart(ITextRange *me, LONG *pcpFirst)
@@ -633,8 +633,11 @@ static HRESULT WINAPI ITextRange_fnGetStart(ITextRange *me, LONG *pcpFirst)
if (!This->reOle)
return CO_E_RELEASED;
@ -26,7 +26,7 @@ index e93070a..bd3dee8 100644
}
static HRESULT WINAPI ITextRange_fnSetStart(ITextRange *me, LONG cpFirst)
@@ -659,8 +662,11 @@ static HRESULT WINAPI ITextRange_fnGetEnd(ITextRange *me, LONG *pcpLim)
@@ -653,8 +656,11 @@ static HRESULT WINAPI ITextRange_fnGetEnd(ITextRange *me, LONG *pcpLim)
if (!This->reOle)
return CO_E_RELEASED;
@ -40,7 +40,7 @@ index e93070a..bd3dee8 100644
}
static HRESULT WINAPI ITextRange_fnSetEnd(ITextRange *me, LONG cpLim)
@@ -1622,11 +1628,15 @@ static HRESULT WINAPI ITextSelection_fnSetFormattedText(ITextSelection *me, ITex
@@ -1617,11 +1623,15 @@ static HRESULT WINAPI ITextSelection_fnSetFormattedText(ITextSelection *me, ITex
static HRESULT WINAPI ITextSelection_fnGetStart(ITextSelection *me, LONG *pcpFirst)
{
ITextSelectionImpl *This = impl_from_ITextSelection(me);
@ -58,7 +58,7 @@ index e93070a..bd3dee8 100644
}
static HRESULT WINAPI ITextSelection_fnSetStart(ITextSelection *me, LONG cpFirst)
@@ -1642,11 +1652,15 @@ static HRESULT WINAPI ITextSelection_fnSetStart(ITextSelection *me, LONG cpFirst
@@ -1637,11 +1647,15 @@ static HRESULT WINAPI ITextSelection_fnSetStart(ITextSelection *me, LONG cpFirst
static HRESULT WINAPI ITextSelection_fnGetEnd(ITextSelection *me, LONG *pcpLim)
{
ITextSelectionImpl *This = impl_from_ITextSelection(me);

View File

@ -1,18 +1,24 @@
From 3cc40358e08460d01b43647844f260eafc670e28 Mon Sep 17 00:00:00 2001
From 98c934438ec14a885d07fd0caa220f244b13a5c2 Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Thu, 7 Aug 2014 15:11:07 +0800
Date: Sun, 10 Aug 2014 20:43:41 +0800
Subject: riched20: Implement ITextRange::GetDuplicate.
---
dlls/riched20/richole.c | 23 +++++++++++++++++++++--
dlls/riched20/richole.c | 14 ++++++++++++--
dlls/riched20/tests/richole.c | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+), 2 deletions(-)
2 files changed, 47 insertions(+), 2 deletions(-)
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index bd3dee8..229fb5d 100644
index d8382b7..e0e5417 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -606,11 +606,30 @@ static HRESULT WINAPI ITextRange_fnSetChar(ITextRange *me, LONG ch)
@@ -597,14 +597,24 @@ static HRESULT WINAPI ITextRange_fnSetChar(ITextRange *me, LONG ch)
return E_NOTIMPL;
}
+static HRESULT CreateITextRange(IRichEditOleImpl *reOle, LONG start, LONG end,
+ ITextRangeImpl *txtRge, ITextRange** ppRange);
+
static HRESULT WINAPI ITextRange_fnGetDuplicate(ITextRange *me, ITextRange **ppRange)
{
ITextRangeImpl *This = impl_from_ITextRange(me);
@ -29,19 +35,7 @@ index bd3dee8..229fb5d 100644
+ txtRge = heap_alloc(sizeof *txtRge);
+ if (!txtRge)
+ return E_FAIL;
+
+ txtRge->ITextRange_iface.lpVtbl = This->ITextRange_iface.lpVtbl;
+ txtRge->ref = 1;
+ txtRge->reOle = This->reOle;
+ txtRge->start = This->start;
+ txtRge->end = This->end;
+ txtRge->next = This->reOle->txtRgehead->next;
+ This->reOle->txtRgehead->next->prev = txtRge;
+ This->reOle->txtRgehead->next = txtRge;
+ txtRge->prev = This->reOle->txtRgehead;
+ *ppRange = &txtRge->ITextRange_iface;
+
+ return S_OK;
+ return CreateITextRange(This->reOle, This->start, This->end, txtRge, ppRange);
}
static HRESULT WINAPI ITextRange_fnGetFormattedText(ITextRange *me, ITextRange **ppRange)

View File

@ -1,22 +1,22 @@
From a1d0978ce36f81b0bc547e3a357bd985c3b16abe Mon Sep 17 00:00:00 2001
From 2661099a3f5936b20a46aef4c2114498bac68611 Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Sat, 9 Aug 2014 00:40:17 +0800
Date: Sun, 10 Aug 2014 06:02:02 +0800
Subject: riched20: Implement ITextRange::Collapse and
ITextSelection::Collapse.
---
dlls/riched20/richole.c | 26 +++++++++++---
dlls/riched20/richole.c | 27 +++++++++++---
dlls/riched20/tests/richole.c | 80 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 101 insertions(+), 5 deletions(-)
2 files changed, 102 insertions(+), 5 deletions(-)
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index 229fb5d..9a7e690 100644
index e0e5417..553a6b5 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -757,15 +757,26 @@ static HRESULT WINAPI ITextRange_fnGetStoryType(ITextRange *me, LONG *pValue)
FIXME("not implemented %p\n", This);
@@ -743,14 +743,26 @@ static HRESULT WINAPI ITextRange_fnGetStoryType(ITextRange *me, LONG *pValue)
return E_NOTIMPL;
}
+static HRESULT range_Collapse(LONG bStart, LONG *start, LONG *end)
+{
+ BOOL isdege = !(*end - *start);
@ -30,7 +30,7 @@ index 229fb5d..9a7e690 100644
+ *end = *start;
+ return S_OK;
+}
+
static HRESULT WINAPI ITextRange_fnCollapse(ITextRange *me, LONG bStart)
{
ITextRangeImpl *This = impl_from_ITextRange(me);
@ -43,7 +43,7 @@ index 229fb5d..9a7e690 100644
}
static HRESULT WINAPI ITextRange_fnExpand(ITextRange *me, LONG Unit, LONG *pDelta)
@@ -1755,11 +1766,16 @@ static HRESULT WINAPI ITextSelection_fnGetStoryType(ITextSelection *me, LONG *pV
@@ -1741,11 +1753,16 @@ static HRESULT WINAPI ITextSelection_fnGetStoryType(ITextSelection *me, LONG *pV
static HRESULT WINAPI ITextSelection_fnCollapse(ITextSelection *me, LONG bStart)
{
ITextSelectionImpl *This = impl_from_ITextSelection(me);

View File

@ -1,4 +1,4 @@
From e6d0113506679fc705bfd65f9ae759fce0152159 Mon Sep 17 00:00:00 2001
From 10f9009d2591fc867371a0e966225d562446387a Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Fri, 8 Aug 2014 21:32:57 +0800
Subject: riched20: Implement IText{Selection, Range}::Set{Start, End}.
@ -9,10 +9,10 @@ Subject: riched20: Implement IText{Selection, Range}::Set{Start, End}.
2 files changed, 179 insertions(+), 8 deletions(-)
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index 9a7e690..5a16d6d 100644
index 553a6b5..ca54cf5 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -665,14 +665,27 @@ static HRESULT WINAPI ITextRange_fnGetStart(ITextRange *me, LONG *pcpFirst)
@@ -650,14 +650,27 @@ static HRESULT WINAPI ITextRange_fnGetStart(ITextRange *me, LONG *pcpFirst)
return S_OK;
}
@ -42,7 +42,7 @@ index 9a7e690..5a16d6d 100644
}
static HRESULT WINAPI ITextRange_fnGetEnd(ITextRange *me, LONG *pcpLim)
@@ -688,14 +701,27 @@ static HRESULT WINAPI ITextRange_fnGetEnd(ITextRange *me, LONG *pcpLim)
@@ -673,14 +686,27 @@ static HRESULT WINAPI ITextRange_fnGetEnd(ITextRange *me, LONG *pcpLim)
return S_OK;
}
@ -72,7 +72,7 @@ index 9a7e690..5a16d6d 100644
}
static HRESULT WINAPI ITextRange_fnGetFont(ITextRange *me, ITextFont **pFont)
@@ -1672,11 +1698,16 @@ static HRESULT WINAPI ITextSelection_fnGetStart(ITextSelection *me, LONG *pcpFir
@@ -1659,11 +1685,16 @@ static HRESULT WINAPI ITextSelection_fnGetStart(ITextSelection *me, LONG *pcpFir
static HRESULT WINAPI ITextSelection_fnSetStart(ITextSelection *me, LONG cpFirst)
{
ITextSelectionImpl *This = impl_from_ITextSelection(me);
@ -91,7 +91,7 @@ index 9a7e690..5a16d6d 100644
}
static HRESULT WINAPI ITextSelection_fnGetEnd(ITextSelection *me, LONG *pcpLim)
@@ -1696,11 +1727,16 @@ static HRESULT WINAPI ITextSelection_fnGetEnd(ITextSelection *me, LONG *pcpLim)
@@ -1683,11 +1714,16 @@ static HRESULT WINAPI ITextSelection_fnGetEnd(ITextSelection *me, LONG *pcpLim)
static HRESULT WINAPI ITextSelection_fnSetEnd(ITextSelection *me, LONG cpLim)
{
ITextSelectionImpl *This = impl_from_ITextSelection(me);

View File

@ -1,16 +1,16 @@
From 16cb4e2704dc7f7226a3f82771139e0087f5f313 Mon Sep 17 00:00:00 2001
From b7fdf9c52e9ba093755f118d438910f0a10a77a5 Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Sat, 9 Aug 2014 00:41:58 +0800
Date: Sun, 10 Aug 2014 21:47:48 +0800
Subject: riched20: Stub for ITextFont interface and implement
ITextRange::GetFont and ITextSelection::GetFont.
---
dlls/riched20/richole.c | 835 ++++++++++++++++++++++++++++++++++++++++-
dlls/riched20/richole.c | 800 ++++++++++++++++++++++++++++++++++++++++-
dlls/riched20/tests/richole.c | 93 +++++
2 files changed, 924 insertions(+), 4 deletions(-)
2 files changed, 889 insertions(+), 4 deletions(-)
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index 5a16d6d..c1569b0 100644
index ca54cf5..d171963 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -46,10 +46,12 @@ DEFINE_GUID(IID_ITextHost2, 0x13e670f5,0x1a5a,0x11cf,0xab,0xeb,0x00,0xaa,0x00,0x
@ -26,54 +26,43 @@ index 5a16d6d..c1569b0 100644
typedef struct IRichEditOleImpl {
IRichEditOle IRichEditOle_iface;
@@ -60,6 +62,7 @@ typedef struct IRichEditOleImpl {
@@ -60,8 +62,19 @@ typedef struct IRichEditOleImpl {
ITextSelectionImpl *txtSel;
IOleClientSiteImpl *clientSite;
ITextRangeImpl *txtRgehead, *txtRgetail;
+ ITextFontImpl *txtFonthead, *txtFonttail;
struct list rangelist;
+ struct list fontlist;
} IRichEditOleImpl;
struct ITextRangeImpl {
@@ -71,6 +74,16 @@ struct ITextRangeImpl {
IRichEditOleImpl *reOle;
};
+struct ITextFontImpl {
+ ITextFont ITextFont_iface;
+ LONG ref;
+ ITextFontImpl *prev, *next;
+ struct list entry;
+
+ IRichEditOleImpl *reOle;
+ ITextRangeImpl *txtRge;
+ ITextSelectionImpl *txtSel;
+};
+
struct ITextSelectionImpl {
ITextSelection ITextSelection_iface;
struct ITextRangeImpl {
ITextRange ITextRange_iface;
LONG ref;
@@ -140,6 +153,7 @@ IRichEditOle_fnRelease(IRichEditOle *me)
@@ -140,12 +153,15 @@ IRichEditOle_fnRelease(IRichEditOle *me)
if (!ref)
{
ITextRangeImpl *txtRgeImpl = This->txtRgehead->next;
+ ITextFontImpl *txtFontImpl = This->txtFonthead->next;
ITextRangeImpl *txtRge;
+ ITextFontImpl *txtFont;
TRACE ("Destroying %p\n", This);
This->txtSel->reOle = NULL;
ITextSelection_Release(&This->txtSel->ITextSelection_iface);
@@ -151,6 +165,13 @@ IRichEditOle_fnRelease(IRichEditOle *me)
}
heap_free(This->txtRgehead);
heap_free(This->txtRgetail);
+ while (txtFontImpl)
+ {
+ txtFontImpl->reOle = NULL;
+ txtFontImpl = txtFontImpl->next;
+ }
+ heap_free(This->txtFonthead);
+ heap_free(This->txtFonttail);
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;
@@ -462,6 +483,741 @@ static const IRichEditOleVtbl revt = {
@@ -457,6 +473,740 @@ static const IRichEditOleVtbl revt = {
IRichEditOle_fnImportDataObject
};
@ -112,15 +101,14 @@ index 5a16d6d..c1569b0 100644
+ TRACE ("%p ref=%u\n", This, ref);
+ if (ref == 0)
+ {
+ if (!This->txtSel)
+ 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;
+ This->prev->next = This->next;
+ This->next->prev = This->prev;
+ list_remove(&This->entry);
+ heap_free(This);
+ }
+ return ref;
@ -815,11 +803,11 @@ index 5a16d6d..c1569b0 100644
/* ITextRange interface */
static inline ITextRangeImpl *impl_from_ITextRange(ITextRange *iface)
{
@@ -724,14 +1480,45 @@ static HRESULT WINAPI ITextRange_fnSetEnd(ITextRange *me, LONG cpLim)
@@ -709,14 +1459,42 @@ static HRESULT WINAPI ITextRange_fnSetEnd(ITextRange *me, LONG cpLim)
return range_SetEnd(This->reOle->editor, cpLim, &This->start, &This->end);
}
+static HRESULT range_GetFont(IRichEditOleImpl *reOle, ITextFontImpl **ptxtFont)
+static HRESULT CreateITextFont(IRichEditOleImpl *reOle, ITextFontImpl **ptxtFont)
+{
+ ITextFontImpl *txtFont = NULL;
+ txtFont = heap_alloc(sizeof(ITextFontImpl));
@ -829,10 +817,7 @@ index 5a16d6d..c1569b0 100644
+ txtFont->ITextFont_iface.lpVtbl = &tfvt;
+ txtFont->ref = 1;
+ txtFont->reOle = reOle;
+ txtFont->next = reOle->txtFonthead->next;
+ reOle->txtFonthead->next->prev = txtFont;
+ reOle->txtFonthead->next = txtFont;
+ txtFont->prev = reOle->txtFonthead;
+ list_add_head(&reOle->fontlist, &txtFont->entry);
+ *ptxtFont = txtFont;
+ return S_OK;
+}
@ -851,7 +836,7 @@ index 5a16d6d..c1569b0 100644
+ TRACE("%p\n", This);
+ if (!pFont)
+ return E_INVALIDARG;
+ hres = range_GetFont(This->reOle, &txtFont);
+ hres = CreateITextFont(This->reOle, &txtFont);
+ if (!hres)
+ {
+ txtFont->txtSel = NULL;
@ -863,7 +848,7 @@ index 5a16d6d..c1569b0 100644
}
static HRESULT WINAPI ITextRange_fnSetFont(ITextRange *me, ITextFont *pFont)
@@ -1742,11 +2529,24 @@ static HRESULT WINAPI ITextSelection_fnSetEnd(ITextSelection *me, LONG cpLim)
@@ -1729,11 +2507,24 @@ static HRESULT WINAPI ITextSelection_fnSetEnd(ITextSelection *me, LONG cpLim)
static HRESULT WINAPI ITextSelection_fnGetFont(ITextSelection *me, ITextFont **pFont)
{
ITextSelectionImpl *This = impl_from_ITextSelection(me);
@ -878,7 +863,7 @@ index 5a16d6d..c1569b0 100644
+ TRACE("%p\n", This);
+ if (!pFont)
+ return E_INVALIDARG;
+ hres = range_GetFont(This->reOle, &txtFont);
+ hres = CreateITextFont(This->reOle, &txtFont);
+ if (!hres)
+ {
+ txtFont->txtSel = This;
@ -890,40 +875,14 @@ index 5a16d6d..c1569b0 100644
}
static HRESULT WINAPI ITextSelection_fnSetFont(ITextSelection *me, ITextFont *pFont)
@@ -2423,6 +3223,33 @@ LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *ppObj)
}
CreateEmptyITextRangeImpl(reo, 1);
CreateEmptyITextRangeImpl(reo, 0);
+
+ reo->txtFonthead = heap_alloc(sizeof(ITextFontImpl));
+ if (!reo->txtFonthead)
+ {
+ ITextSelection_Release(&reo->txtSel->ITextSelection_iface);
+ IOleClientSite_Release(&reo->clientSite->IOleClientSite_iface);
+ heap_free(reo->txtRgehead);
+ heap_free(reo->txtRgetail);
+ heap_free(reo);
+ return 0;
+ }
+ reo->txtFonttail = heap_alloc(sizeof(ITextFontImpl));
+ if (!reo->txtFonttail)
+ {
+ ITextSelection_Release(&reo->txtSel->ITextSelection_iface);
+ IOleClientSite_Release(&reo->clientSite->IOleClientSite_iface);
+ heap_free(reo->txtRgehead);
+ heap_free(reo->txtRgetail);
+ heap_free(reo->txtFonthead);
+ heap_free(reo);
+ return 0;
+ }
+ reo->txtFonthead->next = reo->txtFonttail;
+ reo->txtFonthead->prev = NULL;
+ reo->txtFonttail->next = NULL;
+ reo->txtFonttail->prev = reo->txtFonthead;
+
@@ -2367,6 +3158,7 @@ LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *ppObj)
TRACE("Created %p\n",reo);
*ppObj = reo;
list_init(&reo->rangelist);
+ list_init(&reo->fontlist);
return 1;
}
diff --git a/dlls/riched20/tests/richole.c b/dlls/riched20/tests/richole.c
index 2916bc5..69d4453 100644
--- a/dlls/riched20/tests/richole.c

View File

@ -1,16 +1,16 @@
From dd0e81dcc531aff95bde3c121c6f108a32f8374c Mon Sep 17 00:00:00 2001
From 54ca28ec8417735f945883923a72893ff9e5363e Mon Sep 17 00:00:00 2001
From: Jactry Zeng <wine@jactry.com>
Date: Fri, 8 Aug 2014 23:41:22 +0800
Date: Sun, 10 Aug 2014 22:17:57 +0800
Subject: riched20: Stub for ITextPara interface and implement
ITextRange::GetPara.
---
dlls/riched20/richole.c | 721 ++++++++++++++++++++++++++++++++++++++++-
dlls/riched20/richole.c | 684 ++++++++++++++++++++++++++++++++++++++++-
dlls/riched20/tests/richole.c | 47 +++
2 files changed, 766 insertions(+), 2 deletions(-)
2 files changed, 729 insertions(+), 2 deletions(-)
diff --git a/dlls/riched20/richole.c b/dlls/riched20/richole.c
index c1569b0..0a80b8f 100644
index d171963..0897c4f 100644
--- a/dlls/riched20/richole.c
+++ b/dlls/riched20/richole.c
@@ -47,11 +47,13 @@ DEFINE_GUID(IID_ITextDocument, 0x8cc497c0, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0xa
@ -27,22 +27,17 @@ index c1569b0..0a80b8f 100644
typedef struct IRichEditOleImpl {
IRichEditOle IRichEditOle_iface;
@@ -63,6 +65,7 @@ typedef struct IRichEditOleImpl {
@@ -63,8 +65,19 @@ typedef struct IRichEditOleImpl {
IOleClientSiteImpl *clientSite;
ITextRangeImpl *txtRgehead, *txtRgetail;
ITextFontImpl *txtFonthead, *txtFonttail;
+ ITextParaImpl *txtParahead, *txtParatail;
struct list rangelist;
struct list fontlist;
+ struct list paralist;
} IRichEditOleImpl;
struct ITextRangeImpl {
@@ -74,6 +77,16 @@ struct ITextRangeImpl {
IRichEditOleImpl *reOle;
};
+struct ITextParaImpl {
+ ITextPara ITextPara_iface;
+ LONG ref;
+ ITextParaImpl *prev, *next;
+ struct list entry;
+
+ IRichEditOleImpl *reOle;
+ ITextRangeImpl *txtRge;
@ -54,27 +49,22 @@ index c1569b0..0a80b8f 100644
LONG ref;
@@ -154,6 +167,7 @@ IRichEditOle_fnRelease(IRichEditOle *me)
{
ITextRangeImpl *txtRgeImpl = This->txtRgehead->next;
ITextFontImpl *txtFontImpl = This->txtFonthead->next;
+ ITextParaImpl *txtParaImpl = This->txtParahead->next;
ITextRangeImpl *txtRge;
ITextFontImpl *txtFont;
+ ITextParaImpl *txtPara;
TRACE ("Destroying %p\n", This);
This->txtSel->reOle = NULL;
ITextSelection_Release(&This->txtSel->ITextSelection_iface);
@@ -172,6 +186,13 @@ IRichEditOle_fnRelease(IRichEditOle *me)
}
heap_free(This->txtFonthead);
heap_free(This->txtFonttail);
+ while (txtParaImpl)
+ {
+ txtParaImpl->reOle = NULL;
+ txtParaImpl = txtParaImpl->next;
+ }
+ heap_free(This->txtParahead);
+ heap_free(This->txtParatail);
@@ -162,6 +176,8 @@ IRichEditOle_fnRelease(IRichEditOle *me)
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);
}
return ref;
@@ -483,6 +504,642 @@ static const IRichEditOleVtbl revt = {
@@ -473,6 +489,641 @@ static const IRichEditOleVtbl revt = {
IRichEditOle_fnImportDataObject
};
@ -113,15 +103,14 @@ index c1569b0..0a80b8f 100644
+ TRACE ("%p ref=%u\n", This, ref);
+ if (ref == 0)
+ {
+ if (!This->txtSel)
+ 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;
+ This->prev->next = This->next;
+ This->next->prev = This->prev;
+ list_remove(&This->entry);
+ heap_free(This);
+ }
+ return ref;
@ -717,11 +706,11 @@ index c1569b0..0a80b8f 100644
/* ITextFont interface */
static inline ITextFontImpl *impl_from_ITextFont(ITextFont *iface)
{
@@ -1531,14 +2188,45 @@ static HRESULT WINAPI ITextRange_fnSetFont(ITextRange *me, ITextFont *pFont)
@@ -1507,14 +2158,42 @@ static HRESULT WINAPI ITextRange_fnSetFont(ITextRange *me, ITextFont *pFont)
return E_NOTIMPL;
}
+static HRESULT range_GetPara(IRichEditOleImpl *reOle, ITextParaImpl **ptxtPara)
+static HRESULT CreateITextPara(IRichEditOleImpl *reOle, ITextParaImpl **ptxtPara)
+{
+ ITextParaImpl *txtPara = NULL;
+ txtPara = heap_alloc(sizeof(ITextParaImpl));
@ -731,10 +720,7 @@ index c1569b0..0a80b8f 100644
+ txtPara->ITextPara_iface.lpVtbl = &tpvt;
+ txtPara->ref = 1;
+ txtPara->reOle = reOle;
+ txtPara->next = reOle->txtParahead->next;
+ reOle->txtParahead->next->prev = txtPara;
+ reOle->txtParahead->next = txtPara;
+ txtPara->prev = reOle->txtParahead;
+ list_add_head(&reOle->paralist, &txtPara->entry);
+ *ptxtPara = txtPara;
+ return S_OK;
+}
@ -753,7 +739,7 @@ index c1569b0..0a80b8f 100644
+ TRACE("%p\n", This);
+ if (!ppPara)
+ return E_INVALIDARG;
+ hres = range_GetPara(This->reOle, &txtPara);
+ hres = CreateITextPara(This->reOle, &txtPara);
+ if (!hres)
+ {
+ txtPara->txtSel = NULL;
@ -765,39 +751,11 @@ index c1569b0..0a80b8f 100644
}
static HRESULT WINAPI ITextRange_fnSetPara(ITextRange *me, ITextPara *pPara)
@@ -3249,6 +3937,35 @@ LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *ppObj)
reo->txtFonthead->prev = NULL;
reo->txtFonttail->next = NULL;
reo->txtFonttail->prev = reo->txtFonthead;
+ reo->txtParahead = heap_alloc(sizeof(ITextParaImpl));
+ if (!reo->txtParahead)
+ {
+ ITextSelection_Release(&reo->txtSel->ITextSelection_iface);
+ IOleClientSite_Release(&reo->clientSite->IOleClientSite_iface);
+ heap_free(reo->txtRgehead);
+ heap_free(reo->txtRgetail);
+ heap_free(reo->txtFonthead);
+ heap_free(reo->txtFonttail);
+ heap_free(reo);
+ return 0;
+ }
+ reo->txtParatail = heap_alloc(sizeof(ITextParaImpl));
+ if (!reo->txtParatail)
+ {
+ ITextSelection_Release(&reo->txtSel->ITextSelection_iface);
+ IOleClientSite_Release(&reo->clientSite->IOleClientSite_iface);
+ heap_free(reo->txtRgehead);
+ heap_free(reo->txtRgetail);
+ heap_free(reo->txtFonthead);
+ heap_free(reo->txtFonttail);
+ heap_free(reo->txtParahead);
+ heap_free(reo);
+ return 0;
+ }
+ reo->txtParahead->next = reo->txtParatail;
+ reo->txtParahead->prev = NULL;
+ reo->txtParatail->next = NULL;
+ reo->txtParatail->prev = reo->txtParahead;
@@ -3159,6 +3838,7 @@ LRESULT CreateIRichEditOle(ME_TextEditor *editor, LPVOID *ppObj)
*ppObj = reo;
list_init(&reo->rangelist);
list_init(&reo->fontlist);
+ list_init(&reo->paralist);
return 1;
}

View File

@ -1,6 +1,6 @@
Author: Jactry Zeng
Subject: Implement Stubs for ITextRange interface.
Revision: 1
Revision: 2
Author: Jactry Zeng
Subject: Implement IText{Range,Selection}::{GetChar,GetStart,GetEnd,GetDuplicate,Collapse,SetStart,SetEnd}.
@ -8,11 +8,11 @@ Revision: 1
Author: Jactry Zeng
Subject: Implement Stubs for ITextFont interface.
Revision: 1
Revision: 2
Author: Jactry Zeng
Subject: Implement Stubs for ITextPara interface.
Revision: 1
Revision: 2
Fixes: [12458] Implement ITextDocument_fnRange function
Fixes: [18303] Support for ITextRange, ITextFont and ITextPara