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
96170342
Commit
96170342
authored
Jan 13, 2017
by
Ken Thomases
Committed by
Alexandre Julliard
Jan 13, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemac: Export HTML Format clipboard data to the public.html pasteboard type.
Signed-off-by:
Ken Thomases
<
ken@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ed0de54f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
1 deletion
+67
-1
clipboard.c
dlls/winemac.drv/clipboard.c
+67
-1
No files found.
dlls/winemac.drv/clipboard.c
View file @
96170342
...
...
@@ -82,6 +82,7 @@ static CFDataRef export_bitmap_to_bmp(HANDLE data);
static
CFDataRef
export_dib_to_bmp
(
HANDLE
data
);
static
CFDataRef
export_enhmetafile
(
HANDLE
data
);
static
CFDataRef
export_hdrop_to_filenames
(
HANDLE
data
);
static
CFDataRef
export_html
(
HANDLE
data
);
static
CFDataRef
export_metafilepict
(
HANDLE
data
);
static
CFDataRef
export_text_to_utf8
(
HANDLE
data
);
static
CFDataRef
export_unicodetext_to_utf8
(
HANDLE
data
);
...
...
@@ -186,7 +187,7 @@ static const struct
{
wszJFIF
,
CFSTR
(
"public.jpeg"
),
import_clipboard_data
,
export_clipboard_data
},
{
wszPNG
,
CFSTR
(
"public.png"
),
import_clipboard_data
,
export_clipboard_data
},
{
wszHTMLFormat
,
NULL
,
import_clipboard_data
,
export_clipboard_data
},
{
wszHTMLFormat
,
CFSTR
(
"public.html"
),
import_html
,
NULL
,
TRUE
},
{
wszHTMLFormat
,
CFSTR
(
"public.html"
),
import_html
,
export_html
,
TRUE
},
{
CFSTR_SHELLURLW
,
CFSTR
(
"public.url"
),
import_utf8_to_text
,
export_text_to_utf8
},
};
...
...
@@ -522,6 +523,28 @@ static HANDLE create_bitmap_from_dib(HANDLE dib)
/**************************************************************************
* get_html_description_field
*
* Find the value of a field in an HTML Format description.
*/
static
const
char
*
get_html_description_field
(
const
char
*
data
,
const
char
*
keyword
)
{
const
char
*
pos
=
data
;
while
(
pos
&&
*
pos
&&
*
pos
!=
'<'
)
{
if
(
memcmp
(
pos
,
keyword
,
strlen
(
keyword
))
==
0
)
return
pos
+
strlen
(
keyword
);
pos
=
strchr
(
pos
,
'\n'
);
if
(
pos
)
pos
++
;
}
return
NULL
;
}
/**************************************************************************
* import_clipboard_data
*
* Generic import clipboard data routine.
...
...
@@ -1141,6 +1164,49 @@ done:
/**************************************************************************
* export_html
*
* Export HTML Format to public.html data.
*
* FIXME: We should attempt to add an <a base> tag and convert windows paths.
*/
static
CFDataRef
export_html
(
HANDLE
handle
)
{
CFDataRef
ret
;
const
char
*
data
,
*
field_value
;
int
fragmentstart
,
fragmentend
;
data
=
GlobalLock
(
handle
);
/* read the important fields */
field_value
=
get_html_description_field
(
data
,
"StartFragment:"
);
if
(
!
field_value
)
{
ERR
(
"Couldn't find StartFragment value
\n
"
);
goto
failed
;
}
fragmentstart
=
atoi
(
field_value
);
field_value
=
get_html_description_field
(
data
,
"EndFragment:"
);
if
(
!
field_value
)
{
ERR
(
"Couldn't find EndFragment value
\n
"
);
goto
failed
;
}
fragmentend
=
atoi
(
field_value
);
/* export only the fragment */
ret
=
CFDataCreate
(
NULL
,
(
const
UInt8
*
)
&
data
[
fragmentstart
],
fragmentend
-
fragmentstart
);
GlobalUnlock
(
handle
);
return
ret
;
failed:
GlobalUnlock
(
handle
);
return
NULL
;
}
/**************************************************************************
* export_metafilepict
*
* Export a metafile to data.
...
...
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