[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
PSPP-BUG: [bug #65288] Copy&Paste of tables from output view does not co
From: |
Friedrich Beckmann |
Subject: |
PSPP-BUG: [bug #65288] Copy&Paste of tables from output view does not copy graphics but text |
Date: |
Sun, 2 Jun 2024 09:17:00 -0400 (EDT) |
Follow-up Comment #3, bug #65288 (group pspp):
My idea was to fix this in gdk such that mime types are translated to the
MacOS UTI style:
https://gitlab.gnome.org/fredowski/gtk/-/commit/f54f2f280827660e4360c9890beddb72c66e0b3e
This would also translate the mime "text/html" to uti "public.html". It turns
out that applications have different "preferred" formats from the clipboard.
You have switched off the image targets for tables with the patch mentioned
below to influence the libreoffice clipboard choice. If image targets like png
are available on the clipboard, then libreoffice prefers the image targets.
Libreoffice also allows to choose from other formats via "Paste Special" but
other applications do not have that option. So basically we decide via our
advertised formats how data is imported in different applications.
It turns out that some applications prefer "html" over "images". But our
"html" export for charts just mentions the image file. So we would need to
disable "html" from the announced formats on the clipboard for charts.
Currently advertised formats with my above gdk patch are
Charts:
* public.plain-text
* public.utf8-plain-text
* public.html
* public.jpeg
* public.png
* com.microsoft.bmp
* public.svg-image
* org.oasis-open.opendocument.text
The following applications import charts via clipboard as follows:
Libreoffice: png image
Apple Mail, Notes: A kind of empty box - I guess from the html with the link
to the local file system which is not safe)
Apple Keynote: The plain or utf8 text with the name of the file of the image
Inkscape: png image
This is interesting as inkscape imports as png but without my gdk patch, the
svg is advertised as "image/svg+xml" on the clipboard and inkscape imports svg
then. So at least inkscape needs the svg mime advertised and ignores the svg
uti. But inkscape is gtk/gdk based and would probably use the same method if
fixed in gdk.
Tables:
* public.plain-text
* public.utf8-plain-text
* public.html
* public.svg-image
* org.oasis-open.opendocument.text
The applications import the following format:
Libreoffice: html table
Apple Mail, Notes: html table
Apple Keynote: svg
Inkscape: nothing
So Apple Keynote prefers the svg for tables but not for charts. Strange.
Without my gdk patch, inkscape imports the svg.
Anyway, I think the mime to uti conversion for "text/html" should be done and
it should be done in gdk for all applications. Maybe with a less intrusive
patch such that just "text/html" is converted and not everything. Not sure.
For pspp I think the current implementation is based on wrong assumptions. We
make this target list
https://git.savannah.gnu.org/cgit/pspp.git/tree/src/ui/gui/psppire-output-view.c#n717
and later add text and image targets:
https://git.savannah.gnu.org/cgit/pspp.git/tree/src/ui/gui/psppire-output-view.c#n740
However, adding a target via gtk_target_list_add_text_targets is misleading as
this adds a bunch of text targets to the list:
https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/gtkselection.c#L383
what we have already done via the array. What we will receive as callback
identifier like "SELECT_FMT_UTF8" is not clear. I guess the list will be
searched from the beginning such that all "gtk_target_list_add_text_targets"
are obsolete.
The same holds for gtk_target_list_add_image_targets. This just adds all
targets which can be produced by a gdk_pixbuf. See:
https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/gtkselection.c#L454
This does not include svg, so we do in fact not add the svg target by that
call. It was already in the array.
But I think the idea is correct that we want different advertised targets
depending on our widget type, i.e. different targets for charts and tables.
(file #56128, file #56129)
_______________________________________________________
Additional Item Attachment:
File name: clipboard-chart-aftergdkpatch.jpg Size: 325KiB
<https://file.savannah.gnu.org/file/clipboard-chart-aftergdkpatch.jpg?file_id=56128>
File name: clipboard-table-aftergdkpatch.jpg Size: 852KiB
<https://file.savannah.gnu.org/file/clipboard-table-aftergdkpatch.jpg?file_id=56129>
AGPL NOTICE
These attachments are served by Savane. You can download the corresponding
source code of Savane at
https://git.savannah.nongnu.org/cgit/administration/savane.git/snapshot/savane-f7620e2e0717569c8f5c57249704ffa904525ffb.tar.gz
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?65288>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/