Bug 147612 - FILESAVE PDF Checkbox Z-order not respected when saving with Create form off
Summary: FILESAVE PDF Checkbox Z-order not respected when saving with Create form off
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Printing and PDF export (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: PDF-Export Form-Controls Z-Order
  Show dependency treegraph
 
Reported: 2022-02-23 12:58 UTC by Gabor Kelemen (allotropia)
Modified: 2024-01-12 13:05 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file with overlapping checkboxes (12.51 KB, application/vnd.oasis.opendocument.text)
2022-02-23 12:58 UTC, Gabor Kelemen (allotropia)
Details
The example file exported with the Create PDF form option enabled (17.52 KB, application/pdf)
2022-02-23 12:58 UTC, Gabor Kelemen (allotropia)
Details
The example file exported with the Create PDF form option disabled (14.07 KB, application/pdf)
2022-02-23 13:02 UTC, Gabor Kelemen (allotropia)
Details
Screenshot of the example file and the two differently looking PDF exports (131.29 KB, image/png)
2022-02-23 13:03 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) 2022-02-23 12:58:01 UTC
Created attachment 178478 [details]
Example file with overlapping checkboxes

Attached example file contains some checkboxes, the first two of them being on top of each other, also different in checked/unchecked state.
When this file is exported to PDF with the "Create PDF Form" option enabled, the Z-order of the checkboxes is respected. Turning off the "Create PDF Form" however creates a PDF file with the unchecked checkbox on top.

1, Open attached file
2, Notice there are two checkboxes in the first paragraph: one is Shape 13 in the Navigator and unchecked, with the Label "uncheck". Other is Shape 12 in the Navigator, checked and Label is "------------CHECKED" with orange background color. Enable Form - Edit Mode to inspect them.
3, File - Export As - Export as PDF
4A, In the dialog make sure to have the "Create PDF form" box checked. 
The resulting PDF has the checkbox checked, with the "uncheck" word visible, semi-matching the layout in the editor: the "------------CHECKED" with orange background color should be visible.
4B, In the dialog make sure to have the "Create PDF form" box empty.
The resulting PDF has the unchecked checkbox visible, and both the "uncheck" and "------------CHECKED" labels overlaid on top of each other.

Expected result: 
In both cases the checked box with the label  "------------CHECKED" should be visible on top.

As these are considered shapes by Navigator, I added some overlapping shapes: those are handled correctly in both cases: Z-order matches the one visible in the editor.

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

and in older versions way back to 3.5.
Comment 1 Gabor Kelemen (allotropia) 2022-02-23 12:58:41 UTC
Created attachment 178479 [details]
The example file exported with the Create PDF form option enabled
Comment 2 Gabor Kelemen (allotropia) 2022-02-23 13:02:30 UTC
Created attachment 178480 [details]
The example file exported with the Create PDF form option disabled
Comment 3 Gabor Kelemen (allotropia) 2022-02-23 13:03:08 UTC
Created attachment 178481 [details]
Screenshot of the example file and the two differently looking PDF exports
Comment 4 Armin Le Grand 2022-03-04 10:49:58 UTC
Took a look.
After loading and to see in which tab-order (Z-Order) these shapes are I started with selecting blue one (Shape 1). Tab travels over 2,3 and back to 1 due to FormControls not in design mode.
In design mode it's 1,2,12,17,3. While 12 is '--checked', 13 is not visited at all (what maybe another error by itself) what makes it impossible that way to see z-order in just DrawingLayer.
Klicking on the overlaying ones selects uncheck (12) so that seems to be on top. Sending to back makes correctly (12) on top then, also covering (12).

So initially:
- (c) in non-design-mode (13, checked) is on top of (12, uncheck), also optically
- (d) in design-mode (12, uncheck) is on top of (13, checked)

So already different, dependent on design-mode.

If we imply that the option "Create PDF Form" in PDF export decides if the order in design-mode or not-design-mode is used, we get

- (a) Create PDF Form == true -> non-design-mode (13, checked) is on top of (12, uncheck)
- (b) Create PDF Form == false -> design-mode (12, uncheck) is on top of (13, checked)

(a) is lower left of overview in comment 3, (b) is top left. Thus, (b) seems correct while (a) seems to have problems.

NOTE: There is another additional Z-Order definition exclusively for FormControls, see "Control Properties" and 'Tab order' there, all three controls have the label "Markerfield 1" here, so not really decidable without changing that.
If I rename those to see what's going on we get a order of (12, 17, 13) in the list box, (12) on top.
Question is now if that defines the order from top to bottom (what would mean 12 draws 1st, then 13, so (c)), OR if it means that top covers the others (would be (d)) AND if that defines the order only for non-design-mode (which I would imply)

Initially we have non-design-mode, so it *should* define paint order.

Test: Change order in design-mode in dialog "Control Properties" in TabOrder popup window to (13, 12, 17). Then back to non-design-mode, order did change to (d) in non-design-mode.

(b) does not change, so indeed that influences only order for non-design-mode
(a) changes slightly, but only in the sense that at the right edge, 'checked' in orange does no longer stick out, the CheckBox itself is still is checked.

Would need to debug deeper, but my guess is that with "Create PDF Form" active the CheckBox is just checked because from the paint the "checked' one behind it is visible. Or in other words: The unchecked one does not paint a white area to cover the checked one behind it.

That is a guess from looking at what happens, to verify would need debugging deeper into it. If that is he cause, fixing would imply to create a 'background' for FormControls in PaperColor to cover FormControls 'behind' the current one.

Just my 2ct...
Comment 5 Armin Le Grand 2022-03-04 11:00:29 UTC
Ah, found a proof for my suspicion of comment 4:
Load, move 'checked' control slightly to the right, export -> you can see that he Check itself is lo longer centered at the CheckBox, but moved to the right, too. Thus the Check is shining through from the 'checked' to the 'non-checked' :-)
Comment 6 Armin Le Grand 2022-05-02 13:02:07 UTC
Taking a deeper look...
Comment 7 Armin Le Grand 2022-05-13 08:54:43 UTC
Back to new - no timeslots currenly. To keep in sight, tagging in PersonalTags