Bug 142565 - Clipboard Managers in Windows 10 or MacOS don't seem to work in LibreOffice
Summary: Clipboard Managers in Windows 10 or MacOS don't seem to work in LibreOffice
Status: RESOLVED DUPLICATE of bug 143091
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.1.2.2 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-30 12:54 UTC by David
Modified: 2021-08-02 12:44 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
simple calc sheet with cells filled with random numbers, diagonal passes across the sheet adding cell content to MS Clipboard History--then pasted back by selection the MS Clipboard History stack (13.25 KB, application/vnd.oasis.opendocument.spreadsheet)
2021-05-30 19:57 UTC, V Stuart Foote
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David 2021-05-30 12:54:37 UTC
Description:
I tried using [Windows Key]+V to paste various items from the clipboard into a Calc document or Writer document.  This Windows 10 function does not seem to work properly in LibreOffice.  The same problem occurs in MacOS when trying to use a Clipboard Manager.  I have not found one that works correctly with LibreOffice in MacOS.

Steps to Reproduce:
1.Normal procedure for using a Clipboard Manager
2.
3.

Actual Results:
In Windows I get a message that 'Item can't be inserted'.  In MacOS, nothing happens.

Expected Results:
To be able to insert anything on the Clipboard at any location, as normally happens in other programs like Microsoft Office.


Reproducible: Always


User Profile Reset: No



Additional Info:
[Information automatically included from LibreOffice]
Locale: en-US
Module: SpreadsheetDocument
[Information guessed from browser]
OS: Windows (All)
OS is 64bit: no
Comment 1 V Stuart Foote 2021-05-30 16:50:26 UTC
Can not confirm.

Version: 7.2.0.0.alpha1+ (x64) / LibreOffice Community
Build ID: 75b6b7f66b6ff66f8d9945bccdef71952db2d966
CPU threads: 8; OS: Windows 10.0 Build 19042; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: threaded

With Writer ODF Text document open, the Windows 10 Clipboard History applet (Win 1809 onward) enabled (Win + v) and NirSoft's InsideClipbord (v 1.15) running the stack of clipboard items is populated in the Clipboard History applet.

A selection made from the list will paste application appropriate content into LibreOffice via system clipboard.

The 'current' selection made from the Windows Clipboard History are reflected on the InsideClipboard GUI and match what is available to paste into LibreOffice.

A selection made from history to system clipboard also responds to the LibreOffice 'paste special' actions to select alternate formats for the clipboard content.

Obvisously the Clipboard History GUI will not display within the LibreOffice UI, but its entries are available to place on current system clipboard by selection. The limited tests I did suggested all reasonable clipboard formats that LO can read are available.
Comment 2 David 2021-05-30 18:29:36 UTC
Hello,
Glad you were able to find a work-around in you experiments using Writer.  I would appreciate a step-by-step procedure in LibreOffice Calc to use the windows clipboard manager in Excel.
 
In Excel, I might copy a series of different cells, one at a time, to create a list on the clipboard to work from.  I would then move to a series of different cells within the spreadsheet and paste any one of the copied cells, in no particular order, using [Windows+V] until I have pasted all the copied cells from the list I created, at various places throughout the spreadsheet.  In other words,  I copy several cells, one at a time, from various places in the spreadsheet as step one, and then paste them as step two, one at a time, to various other places in the spreadsheet.  What are the steps in LibreOffice to do that?
Thanks,
David
Comment 3 V Stuart Foote 2021-05-30 19:57:00 UTC
Created attachment 172458 [details]
simple calc sheet with cells filled with random numbers, diagonal passes across the sheet adding cell content to MS Clipboard History--then pasted back by selection the MS Clipboard History stack

In attached ODF spreadsheet filled with random numbers, using the desired copy sequentially to the Microsoft Clipboard History app diagonally down and back across the whole sheet.

Then select and paste in sequence each from the Win10 History Clipboard pasting into the same pattern of cells, one-at-a-time.

On selection, the message 'Contents of the clipboard can not be pasted' does appear--but that has nothing to do with function of the Clipboard History and rather is manifestation that the system clipboard receives an unusable default format coming back from the Clipboard History app.

Despite the pop-up, the copied content is added to the system clipboard--and a simple <ctrl><alt><shift>+V will paste as plaintext. Or use the context menu to select 'Paste Special' dialog.

=> WFM

Not clear anything can be done with how the MS Clipboard History restores items from its stack to system clipboard.  That, seems NOTOURBUG

@Mike, any thoughts?
Comment 4 V Stuart Foote 2021-05-31 00:03:50 UTC
OP sent this note in PM:

Thanks for looking in to this.  Your suggested work-around is a solution, but would not be an easy to use operation for a person working on a spreadsheet in business.  It currently requires too many steps.  Could you pass on my request to make an addition to LibreOffice that allows the [windows+V] function, or something like it, to operate in at least Calc and Writer?  Also, if the clipboard manager function could be made to work in the MacOS version of Libreoffice, that would be great.  Thanks for your help.
Comment 5 Mike Kaganski 2021-05-31 06:25:14 UTC
Interesting issue.

MS has indeed implemented yet another awful "clipboard manager", which is unexpected, given that they are the owners of their own clipboard, and have all capabilities to create something proper. Specifically, their saved clipboard entry is not complete - it advertises a BITMAP format, and it's empty (0 bytes). So when they copy the current item to their history, they obviously do not render it properly. (But could that be our code that does not allow then rendering? The idea that it's MS code that doesn't render BITMAP properly is based on "gut feeling" actually.)

However, our code indeed does something strange here at least *when pasting*. When deciding which of the advertised formats to use, it first checks which user action to perform - using a ordered list of "default actions" (pEntry->aDefaultActions) in GetTransferableAction_Impl, where it first finds a match "HTML_NO_COMMENT" and its associated action "EXCHG_IN_ACTION_COPY". Then back in SotExchange::GetExchangeAction, it uses this action id to look inside *another* ordered list of actions - namely, pEntry->aCopyActions is passed to GetTransferableAction_Impl. This time it gets a match of BITMAP, and the action is EXCHG_OUT_ACTION_INSERT_BITMAP. I don't quite see how finding HTML_NO_COMMENT first could be a direction to look for another match in a different list. So in the end we try to paste the bitmap, and naturally fail, because the format is invalid in the manager.

(I do not plan to work on this; putting it here in hope that it could be useful to whoever wants to take this. My idea would be to test first what happens when the clipboard entry gets replaced by another entry: how is the rendering performed, and why does it end up invalid - if it's LibreOffice code fault.)
Comment 6 David 2021-05-31 17:46:29 UTC Comment hidden (obsolete)
Comment 7 V Stuart Foote 2021-05-31 18:07:42 UTC
(In reply to David from comment #6)
> It was suggested to me to add this additional information, here.  The
> ability to copy numerous items onto the clipboard and then paste them from
> the collection, one at a time, in any order does not work in LibreOffice
> using the Microsoft 10 [Windows key+V] or any aftermarket clipboard manager
> I have tried.  This ability is also not working with any of the MacOS
> clipboard managers I have tried. I have used all the same clipboard managers
> in MicroSoft Office and Google Docs and Sheets.  The clipboard managers I
> have tried all work correctly in MacOS and in Windows 10 in MS Office and in
> the Google programs.

I can not confirm that. 

Items added by <Ctrl>+C copy to the Windows Clipboard History app can be click selected from the app in any order to restore to system clipboard, and pasted into any component of LibreOffice.  The content restored to system clipboard may or maynot be a valid default to LibreOffice--but it functions as needed making the restored history clipboard content available to system clipboard, and can be manipulated as a LO Paste Special action.

I don't drive an Apple routinely, so can comment there.
Comment 8 steve 2021-06-02 09:47:09 UTC Comment hidden (off-topic)
Comment 9 Mike Kaganski 2021-06-02 09:52:59 UTC
(In reply to steve from comment #8)

tdf#62196 has nothing to do with macOS, or with this specific problem. It was filed against Windows (see its description), and any clipboard-related problem is always OS-specific (as any problem that involves details of communication of the program with OS features). And if some comments there (or here FWIW) mention macOS, it's irrelevant (macOS problems need their own issues). This is not about pasting previous content, but is about problems storing/retrieving of *previous* clipboard content as managers store in their memory.
Comment 10 steve 2021-06-02 10:02:52 UTC
Sorry - bugzilla is hard to use. Added see also bug which includes a fix available in LO 7.1.4 and 7.2.

@David: can you confirm your problem is persisting in 7.1.4 or 7.2 on windows, which you can find at the bottom under prerelease versions: https://www.libreoffice.org/download/download/

For me however clipboard issues are persisting in 7.2 main builds on macOS. The fix from #62196 is windows only, so guess that would be expected.

As the cause for the clipboard trouble may differ per OS I think it would be good to have separate bugs for remaining clipboard issues per OS.
Comment 11 V Stuart Foote 2021-08-02 12:42:02 UTC

*** This bug has been marked as a duplicate of bug 143091 ***