Regression: clipboard pastes value instead of formula within LibreOffice/OpenOffice
In OpenOffice and LibreOffice, on recent versions of XFCE, there is a catastrophic regression, where copying a formula cell and pasting it causes a value to be pasted instead of the formula about 50% of the time. Users unaware of this issue could delete the original cell with the formula ("I made a copy"), leading to DATA LOSS!
The cause is as follows. OpenOffice has an "internal" clipboard that allows direct access to its internal data, and a "system" clipboard with formats exported to the outside world. While OpenOffice is the clipboard owner, it will preferentially paste from the internal clipboard, falling back to the system clipboard when it's not the clipboard owner.
The regression began with commit 14361607. Before this commit, xfsettingsd never took clipboard ownership from OpenOffice, allowing formulas to be pasted from the internal clipboard, presumably because OpenOffice exports both text and image formats to the system clipboard and this was being done in libxfce4ui/xfce-clipboard-manager.c:
manager->is_image_available = gtk_targets_include_image (targets, n_targets, FALSE)
&& !gtk_targets_include_text (targets, n_targets)
&& !gtk_targets_include_uri (targets, n_targets);
Then starting with 14361607, that code got deleted, and the GTK clipboard came into play if any image formats were on the clipboard, regardless of what other clipboard formats were present. So xfsettingsd began taking clipboard ownership (on every 2nd copy or thereabout - another bug?), forcing OpenOffice to paste from the inferior system clipboard, which cannot store formulas.
As a workaround, the XFSETTINGSD_NO_CLIPBOARD=1 environment variable can be used for now to disable the clipboard manager completely. But this is a serious bug that should be fixed urgently.
And where is some documentation for this clipboard manager? How is it supposed to work?
Downstream OpenOffice bug: https://bz.apache.org/ooo/show_bug.cgi?id=128612