Bug 138546 - Writer: multi-column page formating reset when editing page style.
Summary: Writer: multi-column page formating reset when editing page style.
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:7.2.0
Keywords: preBibisect
Depends on:
Blocks:
 
Reported: 2020-11-29 11:49 UTC by Renaud
Modified: 2021-01-22 04:31 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Column glitch test case (9.38 MB, application/vnd.oasis.opendocument.text)
2020-11-29 11:51 UTC, Renaud
Details
modified page style (custom page style 5) (9.39 MB, application/vnd.oasis.opendocument.text)
2020-11-29 22:37 UTC, Jean-Baptiste Faure
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Renaud 2020-11-29 11:49:45 UTC
Description:
I have a complex document with multiple page formats. Some of these page formats use multi-column page formating, some with 2 columns, some with 3 columns. Size and spacing of columns are different from one page style to another.

Then I enter page formating, my column formating is reset to some kind of default value.


Steps to Reproduce:
1. Open document
2. Go to page 6 ("Les Asari")
3. Edit page style named "Costum Page Style 5"
4. Go to "Columns" tab.
5. Do not change anything.
6. Click on "Apply"

Actual Results:
The column formating changes on the page.

Before clicking on "Apply", you can see that the column formating fields on the "columns" tab does not reflect what you can see on the page (these values are not the one I set, but some kind of "default" values.
So when you click on "apply", these values are used to reformat the page. So, the issue is not really on the apply button, but on formating fields which looks to be reset to "default" values.

Expected Results:
No change in column formating on the page since we did not change anything.


Reproducible: Always


User Profile Reset: Yes



Additional Info:
Version : 6.4.7.2 (x64)
Build ID : 639b8ac485750d5696d7590a72ef1b496725cfb5
Threads CPU : 8; OS : Windows 10.0 Build 18363; UI Render : par défaut; VCL: win; 
Locale : fr-FR (fr_FR); Langue IHM : fr-FR
Calc: CL
Comment 1 Renaud 2020-11-29 11:51:21 UTC
Created attachment 167642 [details]
Column glitch test case

The file to use to produce the bug.
Comment 2 Jean-Baptiste Faure 2020-11-29 22:35:32 UTC
For me there is no bug here. When you click the Apply button you ask to apply the page style, including the column width it defines. The columns have probably been resized so that their widths no longer correspond to what is defined by the page style.

I tested on a new document and the default width for a 2 columns page with 0 margins is not the column width of your page style.

That said if I try to change the column widths in the page style to match what they should be, the values are lost when I reopen the page style dialog.

I think your problem comes from the use of border (right) instead of margin. In the attached file, I modified the page style :
- right border : 0
- right margin : 2,3 cm
- size of the background image set to the page size
- columns 2 (left < right), size 7,6 cm , 11,69 cm
with these settings, I have a page style with stable column widths.

Note: I suggest you to ask on users@fr.libreoffice.org mailing list for help to improve the layout of your document. For example, defining multiple columns when you use only one, is not a good idea.

Best regards. JBF
Comment 3 Jean-Baptiste Faure 2020-11-29 22:37:58 UTC
Created attachment 167660 [details]
modified page style (custom page style 5)
Comment 4 Renaud 2020-11-30 05:46:50 UTC
Thanks for your reply.

I agree on the strange layout of my page, coming from difficulty I had to set a full page backgroung image with large page borders. Your tips help me to fix this.

However, whatever the page layout, I think loosing the column values when I reopen the style dialog is still a bug :)
Comment 5 Mike Kaganski 2020-11-30 12:21:20 UTC
There is indeed a problem here; it is a bug IMO. I don't know exactly how to reproduce this from scratch, but e.g. one interesting part to note is padding from right set on Borders tab.
Also worth noting that the page style dialog behavior differs when applying, depending if the Columns tab was or wasn't opened.
Comment 6 Justin L 2020-12-21 14:18:55 UTC
The reason it is resetting to equivalent widths is because the total column size is not the same as the page width size. So it resets to nActWidth, since it is much wider.

    nActWidth = rSize.GetSize().Width() - rLRSpace.GetLeft() - rLRSpace.GetRight() - rBox.GetSmallestDistance();
    if( m_xColMgr->GetActualSize() != nActWidth)

The problem is with GetSmallestDistance - which ends up being the right border padding because // The smallest distance that is not 0 will be returned.
Comment 7 Justin L 2020-12-22 06:14:44 UTC
(In reply to Justin L from comment #6)
> The reason it is resetting to equivalent widths is because the total column
> size is not the same as the page width size.
Not quite accurate. Resetting the total width doesn't break things (although it does seem like a back and forth), it is the call to ColModify( nullptr ) that resets to default.
Comment 8 Justin L 2020-12-22 17:05:57 UTC
http://gerrit.libreoffice.org/c/core/+/108210
Comment 9 Commit Notification 2021-01-22 04:26:33 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

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

tdf#138546 sw PageDialog: fix bad reset of colwidth

It will be available in 7.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.