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
fa8c384b
Commit
fa8c384b
authored
May 20, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 20, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Implement GetFont() for selection range.
parent
72ef3679
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
11 deletions
+55
-11
richole.c
dlls/riched20/richole.c
+35
-9
richole.c
dlls/riched20/tests/richole.c
+20
-2
No files found.
dlls/riched20/richole.c
View file @
fa8c384b
...
...
@@ -49,6 +49,9 @@ DEFINE_GUID(IID_ITextSelection, 0x8cc497c1, 0xa1df, 0x11ce, 0x80, 0x98, 0x00, 0x
DEFINE_GUID
(
IID_ITextFont
,
0x8cc497c3
,
0xa1df
,
0x11ce
,
0x80
,
0x98
,
0x00
,
0xaa
,
0x00
,
0x47
,
0xbe
,
0x5d
);
DEFINE_GUID
(
IID_ITextPara
,
0x8cc497c4
,
0xa1df
,
0x11ce
,
0x80
,
0x98
,
0x00
,
0xaa
,
0x00
,
0x47
,
0xbe
,
0x5d
);
/* private IID used to get back IRichEditOleImpl pointer */
DEFINE_GUID
(
IID_Igetrichole
,
0xe3ce5c7a
,
0x8247
,
0x4622
,
0x81
,
0xad
,
0x11
,
0x81
,
0x02
,
0xaa
,
0x01
,
0x30
);
typedef
struct
ITextSelectionImpl
ITextSelectionImpl
;
typedef
struct
IOleClientSiteImpl
IOleClientSiteImpl
;
typedef
struct
ITextRangeImpl
ITextRangeImpl
;
...
...
@@ -313,25 +316,29 @@ static HRESULT get_textfont_prop_for_pos(const IRichEditOleImpl *reole, int pos,
static
HRESULT
get_textfont_prop
(
ITextRange
*
range
,
enum
textfont_prop_id
propid
,
textfont_prop_val
*
value
)
{
I
TextRangeImpl
*
rng
=
impl_from_ITextRange
(
range
)
;
I
RichEditOleImpl
*
reole
;
textfont_prop_val
v
;
LONG
start
,
end
,
i
;
HRESULT
hr
;
int
i
;
if
(
!
rng
->
reOle
)
ITextRange_QueryInterface
(
range
,
&
IID_Igetrichole
,
(
void
**
)
&
reole
);
if
(
!
reole
)
return
CO_E_RELEASED
;
init_textfont_prop_value
(
propid
,
value
);
ITextRange_GetStart
(
range
,
&
start
);
ITextRange_GetEnd
(
range
,
&
end
);
/* iterate trough a range to see if property value is consistent */
hr
=
get_textfont_prop_for_pos
(
r
ng
->
reOle
,
rng
->
start
,
propid
,
&
v
);
hr
=
get_textfont_prop_for_pos
(
r
eole
,
start
,
propid
,
&
v
);
if
(
FAILED
(
hr
))
return
hr
;
for
(
i
=
rng
->
start
+
1
;
i
<
rng
->
end
;
i
++
)
{
for
(
i
=
start
+
1
;
i
<
end
;
i
++
)
{
textfont_prop_val
cur
;
hr
=
get_textfont_prop_for_pos
(
r
ng
->
reO
le
,
i
,
propid
,
&
cur
);
hr
=
get_textfont_prop_for_pos
(
r
eo
le
,
i
,
propid
,
&
cur
);
if
(
FAILED
(
hr
))
return
hr
;
...
...
@@ -937,6 +944,8 @@ static const IRichEditOleVtbl revt = {
/* ITextRange interface */
static
HRESULT
WINAPI
ITextRange_fnQueryInterface
(
ITextRange
*
me
,
REFIID
riid
,
void
**
ppvObj
)
{
ITextRangeImpl
*
This
=
impl_from_ITextRange
(
me
);
*
ppvObj
=
NULL
;
if
(
IsEqualGUID
(
riid
,
&
IID_IUnknown
)
||
IsEqualGUID
(
riid
,
&
IID_IDispatch
)
...
...
@@ -946,6 +955,11 @@ static HRESULT WINAPI ITextRange_fnQueryInterface(ITextRange *me, REFIID riid, v
ITextRange_AddRef
(
me
);
return
S_OK
;
}
else
if
(
IsEqualGUID
(
riid
,
&
IID_Igetrichole
))
{
*
ppvObj
=
This
->
reOle
;
return
S_OK
;
}
return
E_NOINTERFACE
;
}
...
...
@@ -3023,6 +3037,8 @@ static HRESULT WINAPI ITextSelection_fnQueryInterface(
REFIID
riid
,
void
**
ppvObj
)
{
ITextSelectionImpl
*
This
=
impl_from_ITextSelection
(
me
);
*
ppvObj
=
NULL
;
if
(
IsEqualGUID
(
riid
,
&
IID_IUnknown
)
||
IsEqualGUID
(
riid
,
&
IID_IDispatch
)
...
...
@@ -3033,6 +3049,11 @@ static HRESULT WINAPI ITextSelection_fnQueryInterface(
ITextSelection_AddRef
(
me
);
return
S_OK
;
}
else
if
(
IsEqualGUID
(
riid
,
&
IID_Igetrichole
))
{
*
ppvObj
=
This
->
reOle
;
return
S_OK
;
}
return
E_NOINTERFACE
;
}
...
...
@@ -3246,14 +3267,19 @@ static HRESULT WINAPI ITextSelection_fnSetEnd(ITextSelection *me, LONG cpLim)
return
E_NOTIMPL
;
}
static
HRESULT
WINAPI
ITextSelection_fnGetFont
(
ITextSelection
*
me
,
ITextFont
**
pF
ont
)
static
HRESULT
WINAPI
ITextSelection_fnGetFont
(
ITextSelection
*
me
,
ITextFont
**
f
ont
)
{
ITextSelectionImpl
*
This
=
impl_from_ITextSelection
(
me
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
font
);
if
(
!
This
->
reOle
)
return
CO_E_RELEASED
;
FIXME
(
"not implemented
\n
"
);
return
E_NOTIMPL
;
if
(
!
font
)
return
E_INVALIDARG
;
return
create_textfont
((
ITextRange
*
)
me
,
font
);
}
static
HRESULT
WINAPI
ITextSelection_fnSetFont
(
ITextSelection
*
me
,
ITextFont
*
pFont
)
...
...
dlls/riched20/tests/richole.c
View file @
fa8c384b
...
...
@@ -114,7 +114,7 @@ static void test_Interfaces(void)
{
IRichEditOle
*
reOle
=
NULL
,
*
reOle1
=
NULL
;
ITextDocument
*
txtDoc
=
NULL
;
ITextSelection
*
txtSel
=
NULL
;
ITextSelection
*
txtSel
=
NULL
,
*
txtSel2
;
IUnknown
*
punk
;
HRESULT
hres
;
LRESULT
res
;
...
...
@@ -147,7 +147,13 @@ static void test_Interfaces(void)
hres
=
ITextDocument_GetSelection
(
txtDoc
,
NULL
);
ok
(
hres
==
E_INVALIDARG
,
"ITextDocument_GetSelection: 0x%x
\n
"
,
hres
);
ITextDocument_GetSelection
(
txtDoc
,
&
txtSel
);
hres
=
ITextDocument_GetSelection
(
txtDoc
,
&
txtSel
);
ok
(
hres
==
S_OK
,
"got 0x%08x
\n
"
,
hres
);
hres
=
ITextDocument_GetSelection
(
txtDoc
,
&
txtSel2
);
ok
(
hres
==
S_OK
,
"got 0x%08x
\n
"
,
hres
);
ok
(
txtSel2
==
txtSel
,
"got %p, %p
\n
"
,
txtSel
,
txtSel2
);
ITextSelection_Release
(
txtSel2
);
punk
=
NULL
;
hres
=
ITextSelection_QueryInterface
(
txtSel
,
&
IID_ITextSelection
,
(
void
**
)
&
punk
);
...
...
@@ -1216,6 +1222,7 @@ static void test_GetFont(void)
IRichEditOle
*
reOle
=
NULL
;
ITextDocument
*
doc
=
NULL
;
ITextRange
*
range
=
NULL
;
ITextSelection
*
selection
;
ITextFont
*
font
,
*
font2
;
CHARFORMAT2A
cf
;
LONG
value
;
...
...
@@ -1227,6 +1234,17 @@ static void test_GetFont(void)
create_interfaces
(
&
hwnd
,
&
reOle
,
&
doc
,
NULL
);
SendMessageA
(
hwnd
,
WM_SETTEXT
,
0
,
(
LPARAM
)
test_text1
);
hr
=
ITextDocument_GetSelection
(
doc
,
&
selection
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
ITextSelection_GetFont
(
selection
,
&
font
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
hr
=
ITextSelection_GetFont
(
selection
,
&
font2
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
font
!=
font2
,
"got %p, %p
\n
"
,
font
,
font2
);
ITextFont_Release
(
font2
);
ITextFont_Release
(
font
);
ITextSelection_Release
(
selection
);
EXPECT_REF
(
reOle
,
3
);
EXPECT_REF
(
doc
,
3
);
...
...
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