Bug 126269 - Diagonal lines are sticking out, Calc print range not kept--when printing, for print preview, or exporting PDF.
Summary: Diagonal lines are sticking out, Calc print range not kept--when printing, fo...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Printing and PDF export (show other bugs)
Version:
(earliest affected)
6.1.0.3 release
Hardware: All All
: medium normal
Assignee: Armin Le Grand (allotropia)
URL:
Whiteboard: target:7.4.0 target:7.3.0.2
Keywords: bibisected, bisected, regression
: 124496 (view as bug list)
Depends on:
Blocks: Regressions-borderline
  Show dependency treegraph
 
Reported: 2019-07-07 14:45 UTC by jun meguro
Modified: 2023-03-06 12:38 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
sample source file (19.56 KB, application/vnd.oasis.opendocument.spreadsheet)
2019-07-07 14:45 UTC, jun meguro
Details
sample pdf (34.52 KB, application/pdf)
2019-07-07 14:46 UTC, jun meguro
Details
Simplified sample showing more problems (8.22 KB, application/vnd.oasis.opendocument.spreadsheet)
2021-12-24 10:47 UTC, Armin Le Grand (allotropia)
Details
Another bugdoc with merged cells containing diagonal lines reaching over full pages (10.10 KB, application/vnd.oasis.opendocument.spreadsheet)
2021-12-29 15:26 UTC, Armin Le Grand (allotropia)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jun meguro 2019-07-07 14:45:34 UTC
Created attachment 152622 [details]
sample source file

In CALC, when printing, previewing, and creating PDF, diagonal lines are sticking out.
Please refer to the attached file.
Comment 1 jun meguro 2019-07-07 14:46:22 UTC
Created attachment 152623 [details]
sample pdf
Comment 2 V Stuart Foote 2019-07-09 04:34:59 UTC
Confirmed on Windows 10 Pro 64-bit en-US (1803) with
Version: 6.2.5.2 (x64)
Build ID: 1ec314fa52f458adc18c4f025c545a4e8b22c159
CPU threads: 8; OS: Windows 10.0; UI render: GL; VCL: win; 
Locale: en-US (en_US); UI-Language: en-US
Calc: threaded

An old 5.1.6. build on hand lays out columns & rows correctly matching the Print Ranges as set.
Comment 3 Buovjaga 2020-06-07 16:53:54 UTC
Bibisected with win32-6.2 to https://git.libreoffice.org/core/+/07609f3ae2890ace29c249fac2fb60b0f0332af6%5E!/
BorderlineFix: Fixed visual updates when scrolling

Adding Cc: to Armin Le Grand

Note: the callout shape marking the bottom range is in the wrong position, so I just looked at the right side.
Comment 4 Armin Le Grand (allotropia) 2021-12-22 16:04:00 UTC
Taking a look. Happens as described, have to debug into Array::SetClipRange stuff probably...
Comment 5 Armin Le Grand (allotropia) 2021-12-24 09:48:37 UTC
Digged into it. Main problem are merged cells, not directly mentioned here. For 'simple' cells it will be not too hard to repair.
Problem with merged cells is the creation principle of the borderlines itself: It loops over Array cell by cell, collecting the needed geometry info. Cell by cell means for merged cells that e.g. hor lines are made up of as many snippets as the merged cell has. This does not show due to these being 'merged' in a later step.
For diagonals this is not possible - these cannot be directly associated with a single cell e.g. when merged NxM with N!=M. The diagonals *have* to be created in one run, so will by principle *stick out* when crossing line borders.
I had added code to this in the mentioned commit, but will need to refine that further. Hard stuff due to working against the principle cell repaint. Need to think about this deeply...
Comment 6 Armin Le Grand (allotropia) 2021-12-24 10:47:44 UTC
Created attachment 177122 [details]
Simplified sample showing more problems
Comment 7 Armin Le Grand (allotropia) 2021-12-24 15:16:00 UTC
1st fix on gerrit (https://gerrit.libreoffice.org/c/core/+/127431), this works for non-merged cells and thus for the orig bugdoc for this task.
I will try to add needed geometry clipping for diagonal borderlines in merged cells that span page borders next.
Comment 8 Commit Notification 2021-12-27 10:42:58 UTC
Armin Le Grand (Allotropia) committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/e038ef76c1ef205143c853a3666fb56ca831750d

tdf#126269 Handle diagonal borderline better for merged cells

It will be available in 7.4.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 9 Armin Le Grand (allotropia) 2021-12-27 15:49:44 UTC
Checking now how to create needed clipping.

(1) On the one hand LO creates only visible segments of the cell borders (except diagonal on merged cells - argh - where this is not possible as described). That is in principle a good idea, adding clipping to visualization may be unknown expensive & weird e.g. for vector target data.

(2) On the other hand adding visualization clipping to created geometry as a whole maybe problematic since that 'group of connected edges with BorderStyle' as a whole may be clipped against page bounds, but maybe way bigger than needed (processing cost again). When just clipping diagonal lines that may prevent good 'merge' of associated edges with other borderlines.

Thus will try 1st to get in direction (1) and clip to page bounds directly. This is already not easy and unclear how that can influence the edge processing of associated CellBorder associated connections.
Comment 10 Commit Notification 2021-12-28 11:09:00 UTC
Armin Le Grand (Allotropia) committed a patch related to this issue.
It has been pushed to "libreoffice-7-3":

https://git.libreoffice.org/core/commit/487b2db4dffcc7894bd76fd2d77fe8051f89016e

tdf#126269 Handle diagonal borderline better for merged cells

It will be available in 7.3.0.2.

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 Armin Le Grand (allotropia) 2021-12-29 13:56:44 UTC
Getting closer but wrangling with inconsistencies - the borderline stuff uses massively CoordinateSystem/vector stuff. So to clip I first wanted to 'clip' the Cell coordine system, look for aOrigin/aX/aY stuff. These are the column vectors of the cell CS and thus define it.
Based on these TLBR and BLTR are created, plus connected vectors defined.

But when doing this the cretated geometry is not clipped against the visible part of the merged cell, but always ceated according to the reduced coordinate system -> that changes slope, start and end point.

To do it correct I will need to clip the prepared line geometry. Then I will have to think about if I also need to 'clip/correct' the vectors involved, connected to start/end of that geometry, if these also need to be corrected. These are the pre-requirement for correct borderLine creation/matcing of the line start/end parts...
Comment 12 Armin Le Grand (allotropia) 2021-12-29 15:26:37 UTC
Created attachment 177199 [details]
Another bugdoc with merged cells containing diagonal lines reaching over full pages
Comment 13 Commit Notification 2021-12-30 15:01:36 UTC
Armin Le Grand (Allotropia) committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/11dd4c918749839867568651f0c62db30fdda297

tdf#126269 Add clipping to diagonal border lines

It will be available in 7.4.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 14 Commit Notification 2022-01-04 13:47:30 UTC
Armin Le Grand (Allotropia) committed a patch related to this issue.
It has been pushed to "libreoffice-7-3":

https://git.libreoffice.org/core/commit/446ade2ac0023a322cd464911c62df440b6663af

tdf#126269 Add clipping to diagonal border lines

It will be available in 7.3.0.2.

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 15 Buovjaga 2022-01-05 11:13:03 UTC
Verified

Arch Linux 64-bit
Version: 7.4.0.0.alpha0+ / LibreOffice Community
Build ID: f0d42a5120b35981abed85185530ae4f966c2de6
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 4 January 2022
Comment 16 Stéphane Guillou (stragu) 2023-03-06 12:38:56 UTC
*** Bug 124496 has been marked as a duplicate of this bug. ***