https://bugs.documentfoundation.org/show_bug.cgi?id=104717
--- Comment #15 from Jan-Marek Glogowski <glo...@fbihome.de> ---
Since I'm currently reworking the Qt5 clipboard stuff to fix bug 122239
(testers wanted: https://gerrit.libreoffice.org/#/c/73288/), I have all the
debugging set up, so here is what is happening (all lines starting with debug:
are from LO):
m0 = clipboard (Ctr+C / Ctrl+V)
m1 = selection (what you can insert with the middle button)
If you want to "watch" clipboard changes do: watch -n 1 "xclip -selection
clipboard -out; echo; xclip -selection primary -out"
Ctr+C
debug:11537:11537: setContents m0 c1 o1
=> we set the contents of the clipboard (m0) with stuff (c1) we own (o1)
debug:11537:11537: handleChanged m0 qo1
=> we get the information that the content of the clipboard (m0) has change and
Qt knows we own it (qo1)
=> the clipboard has a lot of (potential) stuff in it, for a single cell:
debug:11537:11537:
application/x-openoffice-embed-source-xml;windows_formatname="Star Embed Source
(XML)"
debug:11537:11537:
application/x-openoffice-objectdescriptor-xml;windows_formatname="Star Object
Descriptor
(XML)";classname="47BBB4CB-CE4C-4E80-a591-42d9ae74950f";typename="LibreOffice
6.4
Tabellendokument";displayname="file:///tmp/bug.ods";viewaspect="1";width="2258";height="453";posx="0";posy="0"
debug:11537:11537:
application/x-openoffice-gdimetafile;windows_formatname="GDIMetaFile"
debug:11537:11537: application/x-openoffice-emf;windows_formatname="Image
EMF"
debug:11537:11537: application/x-openoffice-wmf;windows_formatname="Image
WMF"
debug:11537:11537: image/png
debug:11537:11537:
application/x-openoffice-bitmap;windows_formatname="Bitmap"
debug:11537:11537: image/bmp
debug:11537:11537: text/html
debug:11537:11537: application/x-openoffice-sylk;windows_formatname="Sylk"
debug:11537:11537: application/x-openoffice-link;windows_formatname="Link"
debug:11537:11537: application/x-openoffice-dif;windows_formatname="DIF"
debug:11537:11537: text/plain;charset=utf-16
debug:11537:11537: application/x-libreoffice-tsvc
debug:11537:11537: text/rtf
debug:11537:11537: text/richtext
debug:11537:11537: application/vnd.oasis.opendocument.text-flat-xml
debug:11537:11537: text/plain;charset=utf-8
debug:11537:11537: text/plain
Ctrl+V
debug:11537:11537: setContents m1 c1 o1
=> we set the current selection (m1) with our stuff
debug:11537:11537: handleChanged m1 qo1
=> selection (m1) has changed, we own it and it has a lot of stuff in it:
debug:11537:11537:
application/x-openoffice-embed-source-xml;windows_formatname="Star Embed Source
(XML)"
debug:11537:11537:
application/x-openoffice-objectdescriptor-xml;windows_formatname="Star Object
Descriptor (XML)"
debug:11537:11537:
application/x-openoffice-gdimetafile;windows_formatname="GDIMetaFile"
debug:11537:11537: application/x-openoffice-emf;windows_formatname="Image
EMF"
debug:11537:11537: application/x-openoffice-wmf;windows_formatname="Image
WMF"
debug:11537:11537: image/png
debug:11537:11537:
application/x-openoffice-bitmap;windows_formatname="Bitmap"
debug:11537:11537: image/bmp
debug:11537:11537: text/html
debug:11537:11537: application/x-openoffice-sylk;windows_formatname="Sylk"
debug:11537:11537: application/x-openoffice-link;windows_formatname="Link"
debug:11537:11537: application/x-openoffice-dif;windows_formatname="DIF"
debug:11537:11537: text/plain;charset=utf-16
debug:11537:11537: application/x-libreoffice-tsvc
debug:11537:11537: text/rtf
debug:11537:11537: text/richtext
debug:11537:11537: application/vnd.oasis.opendocument.text-flat-xml
debug:11537:11537: text/plain;charset=utf-8
debug:11537:11537: text/plain
debug:11537:11537: handleChanged m0 qo0
=> we get the information that someone has changed the clipboard (m0), Qt knows
we're not longer the owner (qo0)
=> there is just this left in it:
debug:11537:11537: text/plain
debug:11537:11537: TARGETS
debug:11537:11537: MULTIPLE
debug:11537:11537: TIMESTAMP
debug:11537:11537: SAVE_TARGETS
Consequently LO doesn't know anymore that a cell was copied, as text/plain is
just the "1".
As you already found, if you disable the "Synchronize contents of the clipboard
and the selection", no external "handleChanged m0 qo0" happens.
Now some additional background: nothing is normally in the clipboard or the
selection. There is a reason I wrote (potential). The clipboard is like a
client server connection, where the application that sets the clipboard becomes
it's server. Other applications can ask for the list of content and then
request what they prefer. The text editor prefers 'text/plain', the image
program the 'image/png'. Real content is most time just generated on request.
If the application shuts down it may really set the/some clipboard data, so
it's not lost.
So normally you don't want to copy the whole clipboard on every change. It can
get very expensive.
But there is a thing uncommon. On paste Calc creates a selection for the user,
which is uncommon behavior. Creating the selection inside Calc is totally fine,
but IMHO not the propagation to the system selection clipboard. After all the
user is pasting, not selecting. OTOH gnumeric already sets the selection on
copy, because it sets a selection.
BTW: here is what klipper is doing, when it creates an entry for the history
(real code
https://cgit.kde.org/plasma-workspace.git/tree/klipper/historyitem.cpp#n42)
HistoryItemPtr HistoryItem::create( const QMimeData* data )
{
if (data->hasUrls())
return urls
if (data->hasText())
return text
if (data->hasImage())
return image
return failed
}
That's it. All the nice additional mime-data is gone at this point.
So how to fix it:
1. Don't create a system selection when pasting in Calc (see
https://gerrit.libreoffice.org/73906).
2. Create a real copy off all the QMimeData in klipper (NOTOURBUG). Feel free
to open a KDE bug.
I'm not going to change Calc's behavior. But I'll add some Calc devs to the
patch. Maybe they can decide...
--
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs