Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexey Alyaev
wine
Commits
c48e0519
Commit
c48e0519
authored
9 years ago
by
Nikolay Sivov
Committed by
Alexandre Julliard
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
riched20: Implement GetSize().
parent
a5337149
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/riched20/richole.c
+82
-16
82 additions, 16 deletions
dlls/riched20/richole.c
dlls/riched20/tests/richole.c
+16
-1
16 additions, 1 deletion
dlls/riched20/tests/richole.c
with
98 additions
and
17 deletions
dlls/riched20/richole.c
+
82
−
16
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
);
FIXM
E
(
"(%p)->(%p)
: stub
\n
"
,
This
,
value
);
return
E_NOTIMPL
;
TRAC
E
(
"(%p)->(%p)
\n
"
,
This
,
value
);
return
get_textfont_propf
(
This
->
range
,
FONT_SIZE
,
value
)
;
}
static
HRESULT
WINAPI
TextFont_SetSize
(
ITextFont
*
iface
,
FLOAT
value
)
...
...
This diff is collapsed.
Click to expand it.
dlls/riched20/tests/richole.c
+
16
−
1
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
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment