Bug 122072 - Cut & paste image from TurboCad inserted in Writer doc is not correctly reproduced
Summary: Cut & paste image from TurboCad inserted in Writer doc is not correctly repro...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
(earliest affected) release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
Whiteboard: needs:TurboCad
Depends on:
Blocks: Clipboard
  Show dependency treegraph
Reported: 2018-12-13 12:15 UTC by Amjad Qazi
Modified: 2022-05-17 13:25 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:

Open Office Writer document containing comparable images (16.92 KB, application/vnd.oasis.opendocument.text)
2018-12-13 12:23 UTC, Amjad Qazi
Document with image of fault (33.90 KB, application/pdf)
2018-12-13 12:28 UTC, Amjad Qazi
InsideClipboard saved file (49.07 KB, application/octet-stream)
2019-01-23 23:38 UTC, Amjad Qazi
Output image of InsideClipboard copy/paste (1.38 KB, text/html)
2019-01-23 23:46 UTC, Amjad Qazi
Image being copy/pasted as stored in InsideClipboard (1.21 KB, image/png)
2019-01-23 23:52 UTC, Amjad Qazi

Note You need to log in before you can comment on or make changes to this bug.
Description Amjad Qazi 2018-12-13 12:15:51 UTC
I have been using Apache Open Office to create Writer documents with inserted images from TurboCad using cut and paste. The images retain their original appearance without any loss of resolution.

Inserting images in Libre Office Writer documents, as above, do not work.

Please see attached sample.

Steps to Reproduce:
1.Select and Copy an area of TurboCad Deluxe image
2.Paste into a Writer document

Actual Results:
The reproduced image is of an un-acceptable low quality and resolution.

Expected Results:
An image in it's original form is reproduced.

Reproducible: Always

User Profile Reset: No

Additional Info:
As in "Expected Results".
Comment 1 Amjad Qazi 2018-12-13 12:23:42 UTC
Created attachment 147496 [details]
Open Office Writer document containing comparable images
Comment 2 Amjad Qazi 2018-12-13 12:28:10 UTC
Created attachment 147497 [details]
Document with image of fault
Comment 3 V Stuart Foote 2018-12-13 16:49:17 UTC
The issue is going to be what clipboard content is being picked up for filter import into LibreOffice, to Writer as here or into Draw/Calc.

The Pictures folder of the ODF zip archive .ODT (from Apache Open Offic 4.1.6) in attachment 147496 [details] has two images:

The "Cut & Pasted" image as made in AOO

The resulting PNG of a cut/copy & paste into LibreOffice

What we will need to know is the format of the Windows system clipboard contents when you preform your cut (or copy) from TurboCad.

Please install a clipboard viewer, e.g. Nir Sofer's InsideClipboard [1] is my personal preference, and perform the cut or copy from TurboCad.

Then provide the listing of the FormatIDs, Names, Types and Index as held on the clipboard.

Resolving this may require adjusting the Default import filter for the "Paste" action, or for you to use a "Paste Special", or possibly a new import filter must be written.

We won't know until you can provide the clipboard details.

Comment 4 Amjad Qazi 2019-01-23 23:38:11 UTC
Created attachment 148573 [details]
InsideClipboard saved file
Comment 5 Amjad Qazi 2019-01-23 23:40:19 UTC
Please find attached output from “InsideClipboard”, you will notice this does not correspond to the output from nirsoft.net website. I have only been able to reproduce this output over several attempts.
Copy and paste from TurboCad into Libre Draw works correctly and the image can be correctly copy and pasted from Draw to Writer.
I also noticed that the image captured by InsideClipboard, attached, is enclosed by two lines at the right and the bottom edges of the image and is reproduced in this format in Libre Writer, any larger image is also compressed into this size.
Comment 6 Amjad Qazi 2019-01-23 23:46:39 UTC
Created attachment 148574 [details]
Output image of InsideClipboard copy/paste
Comment 7 Amjad Qazi 2019-01-23 23:52:11 UTC
Created attachment 148575 [details]
Image being copy/pasted as stored in InsideClipboard
Comment 8 V Stuart Foote 2019-01-24 00:16:55 UTC
So the Clipboard output shown in comment 148574 from TurboCad looks to only hold CF_DIB (Device Independent Bitmap). But, if I understand correctly, that is handled with ReadDIBBitmap(), so we should be able to filter it if it is plumbed correctly for a paste action.

This got some tweaking with https://gerrit.libreoffice.org/#/c/55160/ 

Will check if the Insideclipboard .clp lets me bibisect behavior, or if I have to scrounge a seat of TurboCad to test with.

But if this jumps out at any of you--Noel, Michael or Armin let me know...
Comment 9 V Stuart Foote 2019-01-24 00:19:40 UTC
attachment 148574 [details] not comment :(
Comment 10 V Stuart Foote 2019-01-24 01:30:54 UTC
So if I load the .CLP file from attachment 148573 [details] into the Windows clipboard using InsideClipboard I see the proprietary TC formats, but an empty CF_BITMAP a CF_DIB, and a CF_DIBV5

A paste special into LO offers "Bitmap Image (BMP)"; while a paste special into AOO 4.1.6 offers "Bitmap"

Both bitmap pastes look to be low resolution ~72dpi

And, paste special into CorelDraw X7 offers "Device Independent Bitmap" and as "Bitmap". Either renders the bitmap as RGB sized 128px x 128px at 72 x 72 dpi.

So, the handling of the DIB seems correct with the LibreOffice filters.  The question then becomes is there something in the Copy to Bitmap function of TurboCad that is no longer producing bitmap rasters of drawing elements at desired resolution?  Alternatively, is there a vector format (WMF, EMF, SVG, EPS) that was being provided but is now missing?

This is looking to be Not Our Bug as the ODF text document of attachment 147496 [details] for the AOO rendering of what you call a "cut & paste" from TurboCad image to be vector .SVM format--not a bitmap. 

So what does the Clipboard show when you've cut from TurboCad.  Could you post a similar InsideClipboard.CLP dump of the clipboard for the Cut action?
Comment 11 Noel Grandin 2019-01-24 07:49:18 UTC
I'm guessing that the CF_METAFILEPICT in the clipboard is what Apache Open Office is using, and converting to our SVM format.

That will contain vector drawing instructions, which will produce a better result (mostly, our metafile stuff has not always supported all of the nooks and crannies of WMF)

So perhaps we need to tweak our preferences somewhere, to prefer metafile data over bitmap data.
But that might mean checking with Thorsten Behrens and/or Bartosz Kosiorek, who have been working on our metafile support.
Comment 12 Katarina Behrens (Inactive) 2019-02-04 11:55:11 UTC
*** Bug 123140 has been marked as a duplicate of this bug. ***
Comment 13 QA Administrators 2019-08-04 05:49:47 UTC Comment hidden (obsolete)
Comment 14 Timur 2022-05-17 13:25:40 UTC
This bug was put to New but it's not testable. 
It can be with Turbocad trial and download of 1-2 GB but it should be easier. 
attachment 147496 [details]  doesn't correspond to InsideClipboard  attachment 148573 [details]
Bartosz, you put this to New, please explain.