Bug 126051 - FORMATTING: Negative margins when boundary values are used between page and header/footer margins. (gen)
Summary: FORMATTING: Negative margins when boundary values are used between page and h...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.3 all versions
Hardware: All All
: medium minor
Assignee: Caolán McNamara
URL:
Whiteboard: target:6.4.0
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-22 23:33 UTC by Andreas N
Modified: 2019-07-18 09:56 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Short video that goes through the steps to reproduce the issue. (764.58 KB, image/gif)
2019-06-22 23:34 UTC, Andreas N
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas N 2019-06-22 23:33:12 UTC
Description:
Version: 6.2.4.2 (x64)
Build ID: 2412653d852ce75f65fbfa83fb7e7b669a126d64
CPU threads: 8; OS: Windows 10.0; UI render: default; VCL: win; 
Locale: en-US (en_US); UI-Language: en-US
Calc: CL

Setting the page margins to outside of the print range, and maximizing the header/footer margins, then switching between the tabs sets the fields to negative values. Applying the changes pushes the content off the page.

Using the replication steps, this issue can be repeated with the Footer tab (instead of Header), and you can use the right margin instead of the left as well (although the content will be pushed off to the other side of the page).

I’d consider this an edge case as it would be very unlikely that anyone with good intentions would go anywhere near those margin values.

Steps to Reproduce:
1. Open new LibreOffice document
2. Click on Format > Page … > Page tab
3. Set the Left Margin value to 0
4. Click on the Header tab
5. When prompted about margin being out of print range, click yes.
6. Toggle Header on.
7. Set the Left Margin to 9999 (anything beyond the current margin limit)
8. Click on the Page tab.
9. See the value for Left Margin is now negative.
10. Click on Header tab again.
11. See Left Margin now negative, and preview shows content area far off the page.
12. Click OK (to accept edits and close the window).
13. Try to type things in header or main content area. No text appears, but character count increases.

Actual Results:
Margins automatically got set to negative values. Text does not appear anywhere, but word count increases as you type.

Expected Results:
Margins should never be negative and cause text to appear outside of view.


Reproducible: Always


User Profile Reset: No



Additional Info:
I will attach a short video that goes through the steps and gives a visual overview of the issue.
Comment 1 Andreas N 2019-06-22 23:34:27 UTC
Created attachment 152354 [details]
Short video that goes through the steps to reproduce the issue.
Comment 2 Regina Henschel 2019-06-23 20:48:26 UTC
I see these problems here:
The dialog does not correct the input to a valid range, if you leave the tab. If you click in a different field to finish entering the new value, then the value will be restricted to a valid range.

The dialog produces this negative value too, if you click "Apply" in the Header-tab. At least at that point the value should be corrected.

The dialog goes into a faulty state, so that it is not possible at all, to set valid values.
Comment 3 Xisco Faulí 2019-06-28 14:21:26 UTC
I can reproduce it in

Version: 6.4.0.0.alpha0+
Build ID: a294457eb95e60028539b6783abac78b56561fe2
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: x11; 
Locale: ca-ES (ca_ES.UTF-8); UI-Language: en-US
Calc: threaded

but not in

Version: 6.4.0.0.alpha0+
Build ID: a294457eb95e60028539b6783abac78b56561fe2
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); UI-Language: en-US
Calc: threaded
Comment 4 Xisco Faulí 2019-06-28 14:23:01 UTC
Also reproduced in 

Version: 5.2.0.0.alpha1+
Build ID: 5b168b3fa568e48e795234dc5fa454bf24c9805e
CPU Threads: 4; OS Version: Linux 4.15; UI Render: default; 
Locale: ca-ES (ca_ES.UTF-8)

@Caolán, would it make sense to set the margin to 0 if it's negative ?
Comment 5 Caolán McNamara 2019-07-17 19:25:10 UTC
svx/source/dialog/hdft.cxx and cui/source/tabpages/page.cxx have two different values for MINBODY

before 9be17c52b7c565758088b8020a543d7b840e31a7 (2004) they had the same value
Comment 6 Caolán McNamara 2019-07-17 19:28:44 UTC
and another one in sw/source/uibase/sidebar/PageMarginControl.hxx
Comment 7 Caolán McNamara 2019-07-17 19:30:19 UTC
https://gerrit.libreoffice.org/#/c/75807/ to sync these to the same value would seem to give the right results
Comment 8 Commit Notification 2019-07-18 07:39:46 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/cefce1a247a4674c5726a31b61571eab16328a0b%5E%21

tdf#126051 sync MINBODY copies to same value

It will be available in 6.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 Caolán McNamara 2019-07-18 09:56:03 UTC
that seems to do the right thing