Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
c48e0519
Commit
c48e0519
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 GetSize().
parent
a5337149
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
17 deletions
+98
-17
richole.c
dlls/riched20/richole.c
+82
-16
richole.c
dlls/riched20/tests/richole.c
+16
-1
No files found.
dlls/riched20/richole.c
View file @
c48e0519
...
...
@@ -208,7 +208,47 @@ static const DWORD textfont_prop_masks[] = {
CFM_WEIGHT
};
static
HRESULT
get_textfont_prop_for_pos
(
const
IRichEditOleImpl
*
reole
,
int
pos
,
enum
textfont_prop_id
propid
,
LONG
*
value
)
typedef
union
{
FLOAT
f
;
LONG
l
;
}
textfont_prop_val
;
static
inline
BOOL
is_equal_textfont_prop_value
(
enum
textfont_prop_id
propid
,
textfont_prop_val
*
left
,
textfont_prop_val
*
right
)
{
switch
(
propid
)
{
case
FONT_BOLD
:
case
FONT_ITALIC
:
return
left
->
l
==
right
->
l
;
case
FONT_SIZE
:
return
left
->
f
==
right
->
f
;
default:
FIXME
(
"unhandled font property %d
\n
"
,
propid
);
return
FALSE
;
}
}
static
inline
void
init_textfont_prop_value
(
enum
textfont_prop_id
propid
,
textfont_prop_val
*
v
)
{
switch
(
propid
)
{
case
FONT_BOLD
:
case
FONT_ITALIC
:
v
->
l
=
tomUndefined
;
return
;
case
FONT_SIZE
:
v
->
f
=
tomUndefined
;
return
;
default:
FIXME
(
"unhandled font property %d
\n
"
,
propid
);
v
->
l
=
tomUndefined
;
return
;
}
}
static
HRESULT
get_textfont_prop_for_pos
(
const
IRichEditOleImpl
*
reole
,
int
pos
,
enum
textfont_prop_id
propid
,
textfont_prop_val
*
value
)
{
ME_Cursor
from
,
to
;
CHARFORMAT2W
fmt
;
...
...
@@ -225,10 +265,13 @@ static HRESULT get_textfont_prop_for_pos(const IRichEditOleImpl *reole, int pos,
switch
(
propid
)
{
case
FONT_BOLD
:
*
value
=
fmt
.
dwEffects
&
CFE_BOLD
?
tomTrue
:
tomFalse
;
value
->
l
=
fmt
.
dwEffects
&
CFE_BOLD
?
tomTrue
:
tomFalse
;
break
;
case
FONT_ITALIC
:
*
value
=
fmt
.
dwEffects
&
CFE_ITALIC
?
tomTrue
:
tomFalse
;
value
->
l
=
fmt
.
dwEffects
&
CFE_ITALIC
?
tomTrue
:
tomFalse
;
break
;
case
FONT_SIZE
:
value
->
f
=
fmt
.
yHeight
;
break
;
default:
FIXME
(
"unhandled font property %d
\n
"
,
propid
);
...
...
@@ -238,34 +281,31 @@ 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
(
ITextRange
*
range
,
enum
textfont_prop_id
propid
,
textfont_prop_val
*
value
)
{
ITextRangeImpl
*
rng
=
impl_from_ITextRange
(
range
);
textfont_prop_val
v
;
HRESULT
hr
;
LONG
v
;
int
i
;
if
(
!
value
)
return
E_INVALIDARG
;
*
value
=
tomUndefined
;
if
(
!
rng
->
reOle
)
return
CO_E_RELEASED
;
init_textfont_prop_value
(
propid
,
value
);
/* iterate trough a range to see if property value is consistent */
hr
=
get_textfont_prop_for_pos
(
rng
->
reOle
,
rng
->
start
,
propid
,
&
v
);
if
(
FAILED
(
hr
))
return
hr
;
for
(
i
=
rng
->
start
+
1
;
i
<
rng
->
end
;
i
++
)
{
LONG
cur
;
textfont_prop_val
cur
;
hr
=
get_textfont_prop_for_pos
(
rng
->
reOle
,
i
,
propid
,
&
cur
);
if
(
FAILED
(
hr
))
return
hr
;
if
(
cur
!=
v
)
if
(
!
is_equal_textfont_prop_value
(
propid
,
&
v
,
&
cur
)
)
return
S_OK
;
}
...
...
@@ -273,6 +313,32 @@ static HRESULT get_textfont_prop(ITextRange *range, enum textfont_prop_id propid
return
S_OK
;
}
static
HRESULT
get_textfont_propf
(
ITextRange
*
range
,
enum
textfont_prop_id
propid
,
FLOAT
*
value
)
{
textfont_prop_val
v
;
HRESULT
hr
;
if
(
!
value
)
return
E_INVALIDARG
;
hr
=
get_textfont_prop
(
range
,
propid
,
&
v
);
*
value
=
v
.
f
;
return
hr
;
}
static
HRESULT
get_textfont_propl
(
ITextRange
*
range
,
enum
textfont_prop_id
propid
,
LONG
*
value
)
{
textfont_prop_val
v
;
HRESULT
hr
;
if
(
!
value
)
return
E_INVALIDARG
;
hr
=
get_textfont_prop
(
range
,
propid
,
&
v
);
*
value
=
v
.
l
;
return
hr
;
}
static
HRESULT
WINAPI
IRichEditOleImpl_inner_fnQueryInterface
(
IUnknown
*
iface
,
REFIID
riid
,
LPVOID
*
ppvObj
)
{
IRichEditOleImpl
*
This
=
impl_from_IUnknown
(
iface
);
...
...
@@ -1770,7 +1836,7 @@ 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
);
return
get_textfont_prop
l
(
This
->
range
,
FONT_BOLD
,
value
);
}
static
HRESULT
WINAPI
TextFont_SetBold
(
ITextFont
*
iface
,
LONG
value
)
...
...
@@ -1840,7 +1906,7 @@ 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
);
return
get_textfont_prop
l
(
This
->
range
,
FONT_ITALIC
,
value
);
}
static
HRESULT
WINAPI
TextFont_SetItalic
(
ITextFont
*
iface
,
LONG
value
)
...
...
@@ -1951,8 +2017,8 @@ static HRESULT WINAPI TextFont_SetShadow(ITextFont *iface, LONG value)
static
HRESULT
WINAPI
TextFont_GetSize
(
ITextFont
*
iface
,
FLOAT
*
value
)
{
ITextFontImpl
*
This
=
impl_from_ITextFont
(
iface
);
FIXME
(
"(%p)->(%p): stub
\n
"
,
This
,
value
);
return
E_NOTIMPL
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
value
);
return
get_textfont_propf
(
This
->
range
,
FONT_SIZE
,
value
)
;
}
static
HRESULT
WINAPI
TextFont_SetSize
(
ITextFont
*
iface
,
FLOAT
value
)
...
...
dlls/riched20/tests/richole.c
View file @
c48e0519
...
...
@@ -1219,6 +1219,7 @@ static void test_GetFont(void)
ITextFont
*
font
,
*
font2
;
CHARFORMAT2A
cf
;
LONG
value
;
float
size
;
HRESULT
hr
;
HWND
hwnd
;
BOOL
ret
;
...
...
@@ -1263,6 +1264,14 @@ static void test_GetFont(void)
hr
=
ITextFont_GetItalic
(
font
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
hr
=
ITextFont_GetSize
(
font
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"got 0x%08x
\n
"
,
hr
);
size
=
0
.
0
;
hr
=
ITextFont_GetSize
(
font
,
&
size
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
size
>
0
.
0
,
"size %.2f
\n
"
,
size
);
/* range is non-italic */
value
=
tomTrue
;
hr
=
ITextFont_GetItalic
(
font
,
&
value
);
...
...
@@ -1270,8 +1279,9 @@ static void test_GetFont(void)
ok
(
value
==
tomFalse
,
"got %d
\n
"
,
value
);
cf
.
cbSize
=
sizeof
(
CHARFORMAT2A
);
cf
.
dwMask
=
CFM_ITALIC
;
cf
.
dwMask
=
CFM_ITALIC
|
CFM_SIZE
;
cf
.
dwEffects
=
CFE_ITALIC
;
cf
.
yHeight
=
24
.
0
;
SendMessageA
(
hwnd
,
EM_SETSEL
,
2
,
3
);
ret
=
SendMessageA
(
hwnd
,
EM_SETCHARFORMAT
,
SCF_SELECTION
,
(
LPARAM
)
&
cf
);
...
...
@@ -1283,6 +1293,11 @@ static void test_GetFont(void)
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
value
==
tomUndefined
,
"got %d
\n
"
,
value
);
size
=
0
.
0
;
hr
=
ITextFont_GetSize
(
font
,
&
size
);
ok
(
hr
==
S_OK
,
"got 0x%08x
\n
"
,
hr
);
ok
(
size
==
tomUndefined
,
"size %.2f
\n
"
,
size
);
ITextFont_Release
(
font
);
ITextRange_Release
(
range
);
release_interfaces
(
&
hwnd
,
&
reOle
,
&
doc
,
NULL
);
...
...
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