Bug 86628 - Add new undo / reset / un- crop function to context menu and dialog
Summary: Add new undo / reset / un- crop function to context menu and dialog
Status: REOPENED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
4.4.0.0.alpha2
Hardware: All All
: medium enhancement
Assignee: andreamassimo03
URL:
Whiteboard: reviewed:2022 target:24.2.0
Keywords: difficultyMedium, easyHack, skillCpp, topicUI
: 138812 (view as bug list)
Depends on:
Blocks: Context-Menu UNO-Command-New Image-Dialog Image-Crop
  Show dependency treegraph
 
Reported: 2014-11-23 14:12 UTC by Yousuf Philips (jay) (retired)
Modified: 2024-01-03 11:07 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
sample ODT with image to crop and reset (98.13 KB, application/vnd.oasis.opendocument.text)
2023-12-22 19:21 UTC, Stéphane Guillou (stragu)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yousuf Philips (jay) (retired) 2014-11-23 14:12:42 UTC
As it is easy to crop an image with .uno:Crop, it would be good to have an easy means of resetting the image to its uncropped state. In order not to expand the menu, a Crop/Uncrop submenu could be created to house both entries. It might also be useful to house .uno:GrafAttrCrop (crop in a dialog) as well.
Comment 1 tommy27 2014-11-23 16:17:04 UTC
I agree. status NEW
Comment 2 Yousuf Philips (jay) (retired) 2014-12-24 06:34:34 UTC
The uno command can be .uno:Uncrop and it should check if an image's left, right, top or bottom values are not 0.00 and if so the command should reset them all to 0.00 else the command should be disabled.
Comment 3 andreas_k 2019-04-18 07:52:46 UTC
would be also useable in the image dialog window in the crop tab to say uncrop image to default setting.
Comment 4 Xisco Faulí 2020-03-09 13:28:28 UTC
Please add keyword 'needsUXEval' and CC 'libreoffice-ux-advise@lists.freedesktop.org' if input from UX is needed.
Comment 5 Verbersde 2022-08-23 11:06:48 UTC Comment hidden (spam)
Comment 6 Stéphane Guillou (stragu) 2023-04-21 17:19:06 UTC
Moving keywords from duplicate.
See also more general suggested UNO command in bug 100344.
Comment 7 Stéphane Guillou (stragu) 2023-04-21 17:19:56 UTC
*** Bug 138812 has been marked as a duplicate of this bug. ***
Comment 8 Stéphane Guillou (stragu) 2023-04-21 17:24:24 UTC Comment hidden (obsolete)
Comment 9 Stéphane Guillou (stragu) 2023-04-21 17:27:08 UTC
Important comments from duplicate:

---- Heiko in bug 138812 comment 4:

Let's realize the uncrop function, add a button to the dialog and a UNO command
for customization. I tend to agree with Telesto that uncrop in the context menu
is desirable - but please only if crop has been applied.

The dialog is cui/uiconfig/ui/croppage.ui, for code inspiration search for SID_ATTR_GRAF_CROP

---- Hossein in bug 138812 comment 11:

Re-evaluating the EasyHack in 2022.
This enhancement is still relevant. As per comment 2 and comment 3, I think it would be good to have "Reset Crop" both in the dialog and right click context menu.
Comment 10 Commit Notification 2023-08-25 05:38:04 UTC
Andrea Rosetti committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/826300d55b8f18593c4b56fb448d09fac52820bd

tdf#86628 Add reset crop function to dialog

It will be available in 24.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Stéphane Guillou (stragu) 2023-08-29 15:18:34 UTC
Thanks Andrea for this. I tested in:

Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 16d43b7c5396d6382926d514dc9ce10b3ce94cba
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded

However, I think there is an issue with it. In my opinion, it should restore the original size as well.

I am aware your commit message says the Oiginal Size button should be used if we also want to restore the size, but it restores the original size _of the file_, not the size the image had before cropping.
Furthermore, I think most users' expectation will be that undoing a crop does not keep the cropped size and affect the aspect ratio.

Heiko, do you agree this needs fixing?
Comment 12 Stéphane Guillou (stragu) 2023-08-29 15:20:30 UTC
(also note that there is support for removing size and scale controls from the overcrowded Crop tab: bug 143037)
Comment 13 Heiko Tietze 2023-12-18 14:03:41 UTC
(In reply to Stéphane Guillou (stragu) from comment #11)
> ...it should restore the original size as well.

The patch is very simple and just resets the left/right/top/bottom values to zero. Not sure what exactly you have in mind with resize, could be after compress/save where maybe the original size is not available or you mean the spin edits in the same tab- which is, IMO, clearly unrelated to "reset crop" at the "Crop" frame.
Comment 14 Stéphane Guillou (stragu) 2023-12-22 19:21:16 UTC
Created attachment 191572 [details]
sample ODT with image to crop and reset

(In reply to Heiko Tietze from comment #13)
> The patch is very simple and just resets the left/right/top/bottom values to
> zero. Not sure what exactly you have in mind with resize

1. Open sample ODT
2. Crop the image horizontally to about half
3. Right-click > Properties > Crop > Reset Crop > OK
Result A: squished picture.
4. Undo
5. Right-click > Properties > Crop > Reset Crop AND Reset Size > OK
Result B: because the picture was scaled automatically to fit the page when imported, this workaround still doesn't work. (It _would_ work for a smaller picture that could fit on the page without scaling when it was imported.)

Version: 24.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 0cd74b5be297f638d455b9b267462192f2e6620c
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded
Comment 15 Heiko Tietze 2024-01-03 11:07:26 UTC
Andrea, changing the individual crop parameters trigger the CropModifyHdl (and adjust the original size by that). Please have a look and perhaps just call this method in UncropHdl.