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
9bec53fb
Commit
9bec53fb
authored
Aug 21, 2017
by
Huw Davies
Committed by
Alexandre Julliard
Aug 24, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Add support for EM_PASTESPECIAL.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
417c80d6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
103 additions
and
1 deletion
+103
-1
editor.c
dlls/riched20/editor.c
+103
-1
No files found.
dlls/riched20/editor.c
View file @
9bec53fb
...
...
@@ -2209,6 +2209,106 @@ static DWORD CALLBACK ME_ReadFromHGLOBALRTF(DWORD_PTR dwCookie, LPBYTE lpBuff, L
return
0
;
}
static
const
WCHAR
rtfW
[]
=
{
'R'
,
'i'
,
'c'
,
'h'
,
' '
,
'T'
,
'e'
,
'x'
,
't'
,
' '
,
'F'
,
'o'
,
'r'
,
'm'
,
'a'
,
't'
,
0
};
static
HRESULT
paste_rtf
(
ME_TextEditor
*
editor
,
FORMATETC
*
fmt
,
STGMEDIUM
*
med
)
{
EDITSTREAM
es
;
ME_GlobalDestStruct
gds
;
HRESULT
hr
;
gds
.
hData
=
med
->
u
.
hGlobal
;
gds
.
nLength
=
0
;
es
.
dwCookie
=
(
DWORD_PTR
)
&
gds
;
es
.
pfnCallback
=
ME_ReadFromHGLOBALRTF
;
hr
=
ME_StreamIn
(
editor
,
SF_RTF
|
SFF_SELECTION
,
&
es
,
FALSE
)
==
0
?
E_FAIL
:
S_OK
;
ReleaseStgMedium
(
med
);
return
hr
;
}
static
HRESULT
paste_text
(
ME_TextEditor
*
editor
,
FORMATETC
*
fmt
,
STGMEDIUM
*
med
)
{
EDITSTREAM
es
;
ME_GlobalDestStruct
gds
;
HRESULT
hr
;
gds
.
hData
=
med
->
u
.
hGlobal
;
gds
.
nLength
=
0
;
es
.
dwCookie
=
(
DWORD_PTR
)
&
gds
;
es
.
pfnCallback
=
ME_ReadFromHGLOBALUnicode
;
hr
=
ME_StreamIn
(
editor
,
SF_TEXT
|
SF_UNICODE
|
SFF_SELECTION
,
&
es
,
FALSE
)
==
0
?
E_FAIL
:
S_OK
;
ReleaseStgMedium
(
med
);
return
hr
;
}
static
struct
paste_format
{
FORMATETC
fmt
;
HRESULT
(
*
paste
)(
ME_TextEditor
*
,
FORMATETC
*
,
STGMEDIUM
*
);
const
WCHAR
*
name
;
}
paste_formats
[]
=
{
{{
-
1
,
NULL
,
DVASPECT_CONTENT
,
-
1
,
TYMED_HGLOBAL
},
paste_rtf
,
rtfW
},
{{
CF_UNICODETEXT
,
NULL
,
DVASPECT_CONTENT
,
-
1
,
TYMED_HGLOBAL
},
paste_text
},
{{
0
}}
};
static
void
init_paste_formats
(
void
)
{
struct
paste_format
*
format
;
static
int
done
;
if
(
!
done
)
{
for
(
format
=
paste_formats
;
format
->
fmt
.
cfFormat
;
format
++
)
{
if
(
format
->
name
)
format
->
fmt
.
cfFormat
=
RegisterClipboardFormatW
(
format
->
name
);
}
done
=
1
;
}
}
static
BOOL
paste_special
(
ME_TextEditor
*
editor
,
UINT
cf
,
REPASTESPECIAL
*
ps
,
BOOL
check_only
)
{
HRESULT
hr
;
STGMEDIUM
med
;
struct
paste_format
*
format
;
IDataObject
*
data
;
init_paste_formats
();
if
(
ps
&&
ps
->
dwAspect
!=
DVASPECT_CONTENT
)
FIXME
(
"Ignoring aspect %x
\n
"
,
ps
->
dwAspect
);
hr
=
OleGetClipboard
(
&
data
);
if
(
hr
!=
S_OK
)
return
FALSE
;
if
(
cf
==
CF_TEXT
)
cf
=
CF_UNICODETEXT
;
hr
=
S_FALSE
;
for
(
format
=
paste_formats
;
format
->
fmt
.
cfFormat
;
format
++
)
{
if
(
cf
&&
cf
!=
format
->
fmt
.
cfFormat
)
continue
;
hr
=
IDataObject_QueryGetData
(
data
,
&
format
->
fmt
);
if
(
hr
==
S_OK
)
{
if
(
!
check_only
)
{
hr
=
IDataObject_GetData
(
data
,
&
format
->
fmt
,
&
med
);
if
(
hr
!=
S_OK
)
goto
done
;
hr
=
format
->
paste
(
editor
,
&
format
->
fmt
,
&
med
);
}
break
;
}
}
done:
IDataObject_Release
(
data
);
return
hr
==
S_OK
;
}
static
BOOL
ME_Paste
(
ME_TextEditor
*
editor
)
{
DWORD
dwFormat
=
0
;
...
...
@@ -3410,7 +3510,6 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
UNSUPPORTED_MSG
(
EM_GETTYPOGRAPHYOPTIONS
)
UNSUPPORTED_MSG
(
EM_GETUNDONAME
)
UNSUPPORTED_MSG
(
EM_GETWORDBREAKPROCEX
)
UNSUPPORTED_MSG
(
EM_PASTESPECIAL
)
UNSUPPORTED_MSG
(
EM_SELECTIONTYPE
)
UNSUPPORTED_MSG
(
EM_SETBIDIOPTIONS
)
UNSUPPORTED_MSG
(
EM_SETEDITSTYLE
)
...
...
@@ -3979,6 +4078,9 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
case
WM_MBUTTONDOWN
:
ME_Paste
(
editor
);
return
0
;
case
EM_PASTESPECIAL
:
paste_special
(
editor
,
wParam
,
(
REPASTESPECIAL
*
)
lParam
,
FALSE
);
return
0
;
case
WM_CUT
:
case
WM_COPY
:
{
...
...
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