Bug 139049 - Copy image from left-to-right sheet and paste into right-to-left (RTL) sheet gives wrong image position
Summary: Copy image from left-to-right sheet and paste into right-to-left (RTL) sheet ...
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-12-18 23:07 UTC by Regina Henschel
Modified: 2023-01-12 13:18 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Spreadsheet with LTR and RTL sheet, to test copy&past between them (34.27 KB, application/vnd.oasis.opendocument.spreadsheet)
2020-12-18 23:07 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2020-12-18 23:07:59 UTC
Created attachment 168312 [details]
Spreadsheet with LTR and RTL sheet, to test copy&past between them

Open attached document.
Go to Sheet_LTR. It should have an image in the range D3:D6. If the image is outside that range, drag it to the range, so that its anchor is D3.
Copy the range D3:D6 including the image.
Go to Sheet_RTL.
Paste the clipboard to D3.
Notice, the image is not in range D3:D6.

The error is likely
1983 tools::Rectangle aObjRect = pObj->GetLogicRect();
https://opengrok.libreoffice.org/xref/core/sc/source/core/data/drwlayer.cxx?r=60ae45f5#1983
If I change it to 
1983 tools::Rectangle aObjRect = pObj->GetSnapRect();
paste uses the correct position.

But I have not tested, what impacts this change has in other places, that use ScDrawLayer::MirrorRTL().
Comment 1 Martin Srdoš 2020-12-19 15:36:55 UTC
Hello,

the pasting in RTL is depended which cell I select for paste. Bug, what I see is that, the anchor is always in cell, where is source.
For example, I copy cell C3 in LTR, where is the anchor and paste it into RTL. Then I click to cell F5 in RTL and the image was near this cell. But the anchor was pasted to the C3, as source is. It happens always, when I am copying between sheets, it is not important, if the sheet is left-to-right or right-to-left. When I copying in one sheet, it works good. And the anchor is in the cell, where I am pasting to.  When I copy between two documents, there is copying only text in the cell, not the picture.

That, immage is copied to different position is bug for me. I confirm that in master

Version: 7.2.0.0.alpha0+ (x64)
Build ID: 59301a1cadd87a63276650975252d14e8477e632
CPU threads: 4; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win
Locale: cs-CZ (cs_CZ); UI: en-US
Calc: threaded



UX Team -- I thing, someone from UX should look to this and to say how it should behave. Copy with img or without? And then we can say, where is the bug (copying bethween sheets or between files.
Comment 2 Regina Henschel 2020-12-19 22:22:25 UTC
I see problems too, when copy paste from one sheet to another. It goes wrong in case target and destination sheet have different column widths and row heights. But those errors happen with pure left-to-right spreadsheets too. Such problems should go into a new bug report, in case no suitable one exists already.

This issue is about copy&paste between left-to-right sheet and right-to-left sheet. To circumvent the above mentioned problems, my description for reproducing has sheets with identical column widths and row heights and source and destination ranges for copy&paste are equal.
Comment 3 Heiko Tietze 2021-01-11 04:19:19 UTC
I'd expect that the base point changes from top left to top right (if not set manually) and the position calculated as minus. For example, my image in LTR is at 9.6cm and becomes -14.92cm after pasting in RTL. If I set 'from right' and -9.6cm its position is mirrored according the source.

Samuel, you did some work around the anchoring. What's your take?
Comment 4 QA Administrators 2023-01-12 03:21:00 UTC Comment hidden (obsolete)
Comment 5 Regina Henschel 2023-01-12 13:18:19 UTC
I cannot reproduce the error in Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 12e8d57e791bb1befc0716d4d02af7d1d1ccb4ae
CPU threads: 8; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: de-DE (en_US); UI: en-US
Calc: CL threaded

So, I'll set it to "worksforme".