Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
a9491ec5
Commit
a9491ec5
authored
Oct 28, 2014
by
Jactry Zeng
Committed by
Alexandre Julliard
Oct 30, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Add IID_IRichEditOle and IID_ITextDocument support for ITextServices::QueryInterface.
parent
234310e7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
104 additions
and
13 deletions
+104
-13
editor.c
dlls/riched20/editor.c
+1
-1
editor.h
dlls/riched20/editor.h
+2
-0
richole.c
dlls/riched20/richole.c
+22
-11
txtsrv.c
dlls/riched20/tests/txtsrv.c
+69
-0
txtsrv.c
dlls/riched20/txtsrv.c
+10
-1
No files found.
dlls/riched20/editor.c
View file @
a9491ec5
...
...
@@ -2889,7 +2889,7 @@ void ME_DestroyEditor(ME_TextEditor *editor)
ITextHost_Release
(
editor
->
texthost
);
if
(
editor
->
reOle
)
{
IRichEditOle_Releas
e
(
editor
->
reOle
);
DestroyIRichEditOl
e
(
editor
->
reOle
);
editor
->
reOle
=
NULL
;
}
OleUninitialize
();
...
...
dlls/riched20/editor.h
View file @
a9491ec5
...
...
@@ -241,10 +241,12 @@ int ME_GetParaBorderWidth(const ME_Context *c, int flags) DECLSPEC_HIDDEN;
/* richole.c */
LRESULT
CreateIRichEditOle
(
IUnknown
*
outer_unk
,
ME_TextEditor
*
editor
,
LPVOID
*
ppvObj
)
DECLSPEC_HIDDEN
;
void
DestroyIRichEditOle
(
IRichEditOle
*
iface
)
DECLSPEC_HIDDEN
;
void
ME_DrawOLE
(
ME_Context
*
c
,
int
x
,
int
y
,
ME_Run
*
run
,
ME_Paragraph
*
para
,
BOOL
selected
)
DECLSPEC_HIDDEN
;
void
ME_GetOLEObjectSize
(
const
ME_Context
*
c
,
ME_Run
*
run
,
SIZE
*
pSize
)
DECLSPEC_HIDDEN
;
void
ME_CopyReObject
(
REOBJECT
*
dst
,
const
REOBJECT
*
src
)
DECLSPEC_HIDDEN
;
void
ME_DeleteReObject
(
REOBJECT
*
reo
)
DECLSPEC_HIDDEN
;
void
ME_GetITextDocumentInterface
(
IRichEditOle
*
iface
,
LPVOID
*
ppvObj
)
DECLSPEC_HIDDEN
;
/* editor.c */
ME_TextEditor
*
ME_MakeEditor
(
ITextHost
*
texthost
,
BOOL
bEmulateVersion10
)
DECLSPEC_HIDDEN
;
...
...
dlls/riched20/richole.c
View file @
a9491ec5
...
...
@@ -143,17 +143,7 @@ static ULONG WINAPI IRichEditOleImpl_inner_fnRelease(IUnknown *iface)
TRACE
(
"%p ref=%u
\n
"
,
This
,
ref
);
if
(
!
ref
)
{
ITextRangeImpl
*
txtRge
;
TRACE
(
"Destroying %p
\n
"
,
This
);
This
->
txtSel
->
reOle
=
NULL
;
This
->
editor
->
reOle
=
NULL
;
ITextSelection_Release
(
&
This
->
txtSel
->
ITextSelection_iface
);
IOleClientSite_Release
(
&
This
->
clientSite
->
IOleClientSite_iface
);
LIST_FOR_EACH_ENTRY
(
txtRge
,
&
This
->
rangelist
,
ITextRangeImpl
,
entry
)
txtRge
->
reOle
=
NULL
;
heap_free
(
This
);
}
DestroyIRichEditOle
(
&
This
->
IRichEditOle_iface
);
return
ref
;
}
...
...
@@ -2375,6 +2365,21 @@ LRESULT CreateIRichEditOle(IUnknown *outer_unk, ME_TextEditor *editor, LPVOID *p
return
1
;
}
void
DestroyIRichEditOle
(
IRichEditOle
*
iface
)
{
IRichEditOleImpl
*
This
=
impl_from_IRichEditOle
(
iface
);
ITextRangeImpl
*
txtRge
;
TRACE
(
"Destroying %p
\n
"
,
This
);
This
->
txtSel
->
reOle
=
NULL
;
This
->
editor
->
reOle
=
NULL
;
ITextSelection_Release
(
&
This
->
txtSel
->
ITextSelection_iface
);
IOleClientSite_Release
(
&
This
->
clientSite
->
IOleClientSite_iface
);
LIST_FOR_EACH_ENTRY
(
txtRge
,
&
This
->
rangelist
,
ITextRangeImpl
,
entry
)
txtRge
->
reOle
=
NULL
;
heap_free
(
This
);
}
static
void
convert_sizel
(
const
ME_Context
*
c
,
const
SIZEL
*
szl
,
SIZE
*
sz
)
{
/* sizel is in .01 millimeters, sz in pixels */
...
...
@@ -2578,3 +2583,9 @@ void ME_CopyReObject(REOBJECT* dst, const REOBJECT* src)
if
(
dst
->
pstg
)
IStorage_AddRef
(
dst
->
pstg
);
if
(
dst
->
polesite
)
IOleClientSite_AddRef
(
dst
->
polesite
);
}
void
ME_GetITextDocumentInterface
(
IRichEditOle
*
iface
,
LPVOID
*
ppvObj
)
{
IRichEditOleImpl
*
This
=
impl_from_IRichEditOle
(
iface
);
*
ppvObj
=
&
This
->
ITextDocument_iface
;
}
dlls/riched20/tests/txtsrv.c
View file @
a9491ec5
...
...
@@ -29,6 +29,8 @@
#include <winbase.h>
#include <objbase.h>
#include <richedit.h>
#include <tom.h>
#include <richole.h>
#include <initguid.h>
#include <imm.h>
#include <textserv.h>
...
...
@@ -862,6 +864,72 @@ static void test_COM(void)
IUnknown_Release
(
unk_obj
.
inner_unk
);
}
static
ULONG
get_refcount
(
IUnknown
*
iface
)
{
IUnknown_AddRef
(
iface
);
return
IUnknown_Release
(
iface
);
}
static
void
test_QueryInterface
(
void
)
{
HRESULT
hres
;
IRichEditOle
*
reole
,
*
txtsrv_reole
;
ITextDocument
*
txtdoc
,
*
txtsrv_txtdoc
;
ULONG
refcount
;
if
(
!
init_texthost
())
return
;
refcount
=
get_refcount
((
IUnknown
*
)
txtserv
);
ok
(
refcount
==
1
,
"got wrong ref count: %d
\n
"
,
refcount
);
/* IID_IRichEditOle */
hres
=
ITextServices_QueryInterface
(
txtserv
,
&
IID_IRichEditOle
,
(
void
**
)
&
txtsrv_reole
);
ok
(
hres
==
S_OK
,
"ITextServices_QueryInterface: 0x%08x
\n
"
,
hres
);
refcount
=
get_refcount
((
IUnknown
*
)
txtserv
);
ok
(
refcount
==
2
,
"got wrong ref count: %d
\n
"
,
refcount
);
refcount
=
get_refcount
((
IUnknown
*
)
txtsrv_reole
);
ok
(
refcount
==
2
,
"got wrong ref count: %d
\n
"
,
refcount
);
hres
=
IRichEditOle_QueryInterface
(
txtsrv_reole
,
&
IID_ITextDocument
,
(
void
**
)
&
txtdoc
);
ok
(
hres
==
S_OK
,
"IRichEditOle_QueryInterface: 0x%08x
\n
"
,
hres
);
refcount
=
get_refcount
((
IUnknown
*
)
txtserv
);
ok
(
refcount
==
3
,
"got wrong ref count: %d
\n
"
,
refcount
);
refcount
=
get_refcount
((
IUnknown
*
)
txtsrv_reole
);
ok
(
refcount
==
3
,
"got wrong ref count: %d
\n
"
,
refcount
);
ITextDocument_Release
(
txtdoc
);
refcount
=
get_refcount
((
IUnknown
*
)
txtserv
);
ok
(
refcount
==
2
,
"got wrong ref count: %d
\n
"
,
refcount
);
IRichEditOle_Release
(
txtsrv_reole
);
refcount
=
get_refcount
((
IUnknown
*
)
txtserv
);
ok
(
refcount
==
1
,
"got wrong ref count: %d
\n
"
,
refcount
);
/* IID_ITextDocument */
hres
=
ITextServices_QueryInterface
(
txtserv
,
&
IID_ITextDocument
,
(
void
**
)
&
txtsrv_txtdoc
);
ok
(
hres
==
S_OK
,
"ITextServices_QueryInterface: 0x%08x
\n
"
,
hres
);
refcount
=
get_refcount
((
IUnknown
*
)
txtserv
);
ok
(
refcount
==
2
,
"got wrong ref count: %d
\n
"
,
refcount
);
refcount
=
get_refcount
((
IUnknown
*
)
txtsrv_txtdoc
);
ok
(
refcount
==
2
,
"got wrong ref count: %d
\n
"
,
refcount
);
hres
=
ITextDocument_QueryInterface
(
txtsrv_txtdoc
,
&
IID_IRichEditOle
,
(
void
**
)
&
reole
);
ok
(
hres
==
S_OK
,
"ITextDocument_QueryInterface: 0x%08x
\n
"
,
hres
);
refcount
=
get_refcount
((
IUnknown
*
)
txtserv
);
ok
(
refcount
==
3
,
"got wrong ref count: %d
\n
"
,
refcount
);
refcount
=
get_refcount
((
IUnknown
*
)
txtsrv_txtdoc
);
ok
(
refcount
==
3
,
"got wrong ref count: %d
\n
"
,
refcount
);
IRichEditOle_Release
(
reole
);
refcount
=
get_refcount
((
IUnknown
*
)
txtserv
);
ok
(
refcount
==
2
,
"got wrong ref count: %d
\n
"
,
refcount
);
ITextDocument_Release
(
txtsrv_txtdoc
);
refcount
=
get_refcount
((
IUnknown
*
)
txtserv
);
ok
(
refcount
==
1
,
"got wrong ref count: %d
\n
"
,
refcount
);
free_texthost
();
}
START_TEST
(
txtsrv
)
{
setup_thiscall_wrappers
();
...
...
@@ -887,6 +955,7 @@ START_TEST( txtsrv )
test_TxSetText
();
test_TxGetNaturalSize
();
test_TxDraw
();
test_QueryInterface
();
}
if
(
wrapperCodeMem
)
VirtualFree
(
wrapperCodeMem
,
0
,
MEM_RELEASE
);
}
dlls/riched20/txtsrv.c
View file @
a9491ec5
...
...
@@ -29,6 +29,7 @@
#include "ole2.h"
#include "oleauto.h"
#include "richole.h"
#include "tom.h"
#include "imm.h"
#include "textserv.h"
#include "wine/debug.h"
...
...
@@ -79,7 +80,15 @@ static HRESULT WINAPI ITextServicesImpl_QueryInterface(IUnknown *iface, REFIID r
*
ppv
=
&
This
->
IUnknown_inner
;
else
if
(
IsEqualIID
(
riid
,
&
IID_ITextServices
))
*
ppv
=
&
This
->
ITextServices_iface
;
else
{
else
if
(
IsEqualIID
(
riid
,
&
IID_IRichEditOle
)
||
IsEqualIID
(
riid
,
&
IID_ITextDocument
))
{
if
(
!
This
->
editor
->
reOle
)
if
(
!
CreateIRichEditOle
(
This
->
outer_unk
,
This
->
editor
,
(
void
**
)(
&
This
->
editor
->
reOle
)))
return
E_OUTOFMEMORY
;
if
(
IsEqualIID
(
riid
,
&
IID_ITextDocument
))
ME_GetITextDocumentInterface
(
This
->
editor
->
reOle
,
ppv
);
else
*
ppv
=
This
->
editor
->
reOle
;
}
else
{
*
ppv
=
NULL
;
FIXME
(
"Unknown interface: %s
\n
"
,
debugstr_guid
(
riid
));
return
E_NOINTERFACE
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment