Bug 154005 - FILEOPEN ODS Dropdown form control becomes wider
Summary: FILEOPEN ODS Dropdown form control becomes wider
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.1.0.3 release
Hardware: All All
: medium normal
Assignee: Balázs Varga (allotropia)
URL:
Whiteboard: target:7.6.0 target:7.5.3
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2023-03-06 10:39 UTC by Gabor Kelemen (allotropia)
Modified: 2023-06-08 09:36 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Example file from Calc (14.77 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-03-06 10:39 UTC, Gabor Kelemen (allotropia)
Details
The example file in LO 6 and master (450.89 KB, image/png)
2023-03-06 10:39 UTC, Gabor Kelemen (allotropia)
Details
The same file with visible column C - is good (116.03 KB, image/png)
2023-03-06 10:40 UTC, Gabor Kelemen (allotropia)
Details
The same file with visible column C (15.83 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-03-06 10:44 UTC, Gabor Kelemen (allotropia)
Details
Button in group (11.36 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-05-11 23:55 UTC, Regina Henschel
Details
Patch intended for LO 7.5 (5.25 KB, patch)
2023-05-16 13:08 UTC, Regina Henschel
Details
The example files in 7.5 with the patch, after vertically grouping rows and save+reload (80.18 KB, image/png)
2023-05-23 15:52 UTC, Gabor Kelemen (allotropia)
Details
The first example file after vertically grouping rows and saving in 7.5 and 7.6, both reopened in 7.6 (59.32 KB, image/png)
2023-05-23 15:54 UTC, Gabor Kelemen (allotropia)
Details
Broken file saved with the patched 7.5 (15.22 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-05-23 16:03 UTC, Gabor Kelemen (allotropia)
Details
Correct file saved with current nightly (15.49 KB, application/vnd.oasis.opendocument.spreadsheet)
2023-05-23 16:04 UTC, Gabor Kelemen (allotropia)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Gabor Kelemen (allotropia) 2023-03-06 10:39:01 UTC
Created attachment 185784 [details]
Example file from Calc

Attached example file was minimized from user made document in LO 6.0.
When opened in master, the dropdown form control in cell B5 is wider than expected.
Worse: at saving this width is retained, and upon reopen it is again wider than before, making the problem accumulate.

1. Open attached file
2. Observe that the dropdown in B5 spans over to D5:E5 cells as well.

Observation: column C is hidden, but if it is unhidden in LO6, the dropdown opens fine in master.

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 288c0920a8475f9f2c537212e04aa7649192ad8c
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: hu-HU (hu_HU.UTF-8); UI: en-US
Calc: default 

Started in 7.1 with:
https://git.libreoffice.org/core/+/1f0b3c7a40edfa81bbc7a58d123a6a2dfd83e4ca

author	Regina Henschel <rb.henschel@t-online.de>	Sat Oct 10 17:55:31 2020 +0200
committer	Regina Henschel <rb.henschel@t-online.de>	Sat Oct 31 15:36:00 2020 +0100

Improve 'resize with cell' handling
Comment 1 Gabor Kelemen (allotropia) 2023-03-06 10:39:29 UTC
Created attachment 185785 [details]
The example file in LO 6 and master
Comment 2 Gabor Kelemen (allotropia) 2023-03-06 10:40:36 UTC
Created attachment 185786 [details]
The same file with visible column C - is good
Comment 3 Gabor Kelemen (allotropia) 2023-03-06 10:44:19 UTC
Created attachment 185788 [details]
The same file with visible column C
Comment 4 Gabor Kelemen (allotropia) 2023-03-06 10:44:46 UTC
Reserving :)
Comment 5 Commit Notification 2023-03-14 02:05:44 UTC
Balazs Varga committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/97a38dbfa998967c45efaf3303fedfa1a709a2bb

tdf#154005 sc ods fileopen: fix dropdown form control size

It will be available in 7.6.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 6 Commit Notification 2023-03-15 10:16:38 UTC
Balazs Varga committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/1de8c9f6bca64ce3e8cc7462dff4bf756868d732

tdf#154005 sc ods fileopen: fix dropdown form control size

It will be available in 7.5.3.

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 7 Commit Notification 2023-03-26 16:38:08 UTC
Balazs Varga committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/69cc8bdd5f9109804d912b52d5ee1040d6e1868f

Related: tdf#154005 sc ods fileopen: fix dropdown form control size

It will be available in 7.6.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 8 Commit Notification 2023-03-29 18:50:16 UTC
Balazs Varga committed a patch related to this issue.
It has been pushed to "libreoffice-7-5":

https://git.libreoffice.org/core/commit/8fec6c7f8cc24f10330d8ff9be0ef86e6974a52f

Related: tdf#154005 sc ods fileopen: fix dropdown form control size

It will be available in 7.5.3.

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 9 Regina Henschel 2023-05-11 23:55:14 UTC
Created attachment 187214 [details]
Button in group

The fix is not correct. It is not an import but an export problem. The fix introduces new other problems:
Open the attached file "Button in group"
Collapse the group and save.
Reload the file and open the group.
Error: The button is not visible.

There is no need to reopen this bug report. I will try to fix this correctly together with my work bug 154821, which is about fixing errors in export.
Comment 10 Regina Henschel 2023-05-15 14:18:58 UTC
The problem is the combination of "To Cell (resize with cell)" anchor with the "size is protected" property. LO version 6 and older had written the size as it would be needed for "To Cell" anchor, but had added an end address. The existence of an end address means, that "resize with cell" has to be used. Unfortunately the end address was not as it would have to be for "resize with cell". It would have to be the end address for the situation bHiddenAsZero=false, but actually bHiddenAsZero=true was used. In version 7 the import was changed to the ODF conform behavior, that end address has priority over size. Now the faulty address is taken, which leads to the problem in this bugreport.

My solution in fix for bug 154821 will be to handle the combination of "To Cell (resize with cell)" with the "size protect" property as if the "To Cell" anchor is used. So in export no longer an end address is written. The import has a special case to catch this combination. It uses the shape size and changes the anchor type to "To Cell".

Using "To Cell" anchor allows older versions to show the same size as in LO 7.6. And documents saved before your patch will be shown correctly in 7.6. The only problem are documents which were saved in versions with your patch applied will have different shape size in 7.6. Because the patch is not so long away, perhaps it would be possible to revert it for 7.5 and use a similar solution as in my proposed fix? https://gerrit.libreoffice.org/c/core/+/151717
Comment 11 Regina Henschel 2023-05-16 13:08:32 UTC
Created attachment 187330 [details]
Patch intended for LO 7.5

The patch suggests this more general solution: We treat the combination of "To Cell (resize with cell)" anchor with the "size protected" property as being "To Cell" anchor.
Advantages of this approach:
* It solves the problem not only for controls, but for all kind of shapes.
* Documents saved with this fix will stay correct when opened and saved with older LO versions.

The changes in this patch are part of https://gerrit.libreoffice.org/c/core/+/151717 for LO 7.6. So the attached patch is only for LO 7.5. But I have locally no 7.5 build to test it.

Gabor, Balázs: Please have a look and comment.
Comment 12 Gabor Kelemen (allotropia) 2023-05-23 15:50:33 UTC
Hi Regina

Thanks for the patch and a deeper insight into what's going on here.

I tested it in a 7.5 branch build and can confirm that without patching the button disappears from attachment 187214 [details] after a save and reload, but it is visible in 7.6 nightly.

With your patch this problem is fixed: the button survives saving and reloading in 7.5 and it is still visible in 7.6 nightly.

The problem is still there if I try with the original attachment 185784 [details] AND vertically group rows 4-10. 
Then the two dropdowns still disappear after save and reload, also in 7.6 nightly.
If I do the same in 7.6 then this issue is not present after reload or open in 7.5.

So the backport needs a bit more polishing.
Comment 13 Gabor Kelemen (allotropia) 2023-05-23 15:52:04 UTC
Created attachment 187461 [details]
The example files in 7.5 with the patch, after vertically grouping rows and save+reload
Comment 14 Gabor Kelemen (allotropia) 2023-05-23 15:54:56 UTC
Created attachment 187462 [details]
The first example file after vertically grouping rows and saving in 7.5 and 7.6, both reopened in 7.6
Comment 15 Gabor Kelemen (allotropia) 2023-05-23 16:03:29 UTC
Created attachment 187463 [details]
Broken file saved with the patched 7.5
Comment 16 Gabor Kelemen (allotropia) 2023-05-23 16:04:09 UTC
Created attachment 187464 [details]
Correct file saved with current nightly

Version: 7.6.0.0.alpha1+ (X86_64) / LibreOffice Community
Build ID: f4c24da1e7f11664e0d2f688d2531f068e4a3bc0
CPU threads: 14; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: en-US (hu_HU); UI: en-US
Calc: threaded
Comment 17 Regina Henschel 2023-05-23 23:25:31 UTC
(In reply to Gabor Kelemen (allotropia) from comment #15)
> Created attachment 187463 [details]
> Broken file saved with the patched 7.5
The file has two problems: The property "Visible" of the form control is 'false' and the y-position of the form control is too large.


(In reply to Gabor Kelemen (allotropia) from comment #12)
> So the backport needs a bit more polishing.

You could try whether the complete solution from bug 154821 will work for LO 7.5. It contains not only the change for the problem here (which I had extracted to the here attached patch) but it contains a new way size and position are calculated for the needs of ODF and hopefully fixes the problems with collapsed groups. It is commit https://git.libreoffice.org/core/+/800f9233513a45aa8f8950cf929fd44cb9381d72%5E%21

A problem is (and I have no solution for it), that LO 7.1 to 7.4 versions not only produce markup which is inconsistent, but they do it not in the same way. So 7.6 will not get all files correct, which were produced in LO 7.1 to 7.4. It might be necessary to open the document in a version, which keeps the controls in their size and position and change the anchor in that version to "To cell". Files produced in LO 6.4 should work in 7.6.

I'm sorry, that I did not considered when first working on the ODF import-export, that someone could make settings which contradict each other. Of cause that is not an error of the user but a shortcoming of the user interface.
Comment 18 Regina Henschel 2023-06-08 09:36:22 UTC
Have you tried to use the solution from bug 154821 instead of your commit?