Bug Hunting Session
Bug 64626 - [FORMATTING] changing border does not work correctly
Summary: [FORMATTING] changing border does not work correctly
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.0.3.3 release
Hardware: Other All
: medium normal
Assignee: Winfried Donkers
URL:
Whiteboard: target:4.2.0 target:4.1.0.1
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-15 10:13 UTC by Winfried Donkers
Modified: 2013-06-24 09:04 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Winfried Donkers 2013-05-15 10:13:33 UTC
1. open spreadsheet, select any cell
2. set border to top-left-bottom-right
3. border of cell shows as set
4. change border to top-bottom
5. border of cell remains top-left-bottom-right, which is not as expected

User has to remove all borders before the wanted border can be set.

Other cases (e.g. change top-bottom border to bottom) also have this behaviour.

Possibly the new border setting is added (OR) to the old one and not replacing (AND or ignore previous value) the old one?
Comment 1 ign_christian 2013-05-15 16:05:39 UTC
set status to NEEDINFO -> can't set to UNCONFIRMED because we need confirmation from other users

not reproducible on LO 4.0.3.3 (Win 7 Home Premium 32bit)

Please mention your OS
Comment 2 Winfried Donkers 2013-05-16 05:47:17 UTC
(In reply to comment #1)
> set status to NEEDINFO -> can't set to UNCONFIRMED because we need
> confirmation from other users
> 
> not reproducible on LO 4.0.3.3 (Win 7 Home Premium 32bit)
> 
> Please mention your OS

Bugs reported by me get status NEW automatically, I suspect my credentials are good ;)

Indeed I forgot to mention OS versions, sorry for that:
-reproduced with version 4.0.3.3 on Windows 7-64 professional and Windows XP Professional
-reproduced with version 4.1.0.0alpha0+master on openSUSE 12.3

I am currently setting some traces in the code to find out what (does not) happen when 'switching off part of the border' of a cell or range.

Interesting you can't reproduce; perhaps my step by step process description is not clear:
In step 3 I mean set border to all (rectangle around cell), in step 4 I mean set border to less than all, but at least something (e.g. top only, or top and bottom)
Comment 3 ign_christian 2013-05-16 07:42:09 UTC
Sorry...I can't see the difference in a reporter's special credential on this page.. :)

Using some variations on cell(s) & border settings, still can't reproduce the problem.
Comment 4 Winfried Donkers 2013-05-17 09:35:38 UTC
(In reply to comment #3)
> Using some variations on cell(s) & border settings, still can't reproduce
> the problem.

Weird, as I think I even found the cause.
In /core/sc/source/core/data/attarray.cxx, ApplyFrame(...) changed border lines are rewritten (left, top, right, bottom seperately), but only if there is a changed border line to be written. Result: border lines are not removed. 
That the border lines are removed when 'no border lines' are selected, is because ApplyFrame(...) is treating 'no border lines at all' differently.

Back to reproducing:
The only difference I can think of is that I renewed my cell selection to examine the result, but I just checked with another method and that also shows to problem (to me, at least)
1. open a new calc document
2. select cells C3-D4 (4 cells) with the mouse
3. apply border with toolbar button 'Borders' and select 'borders everywhere' (borders inside and out, with me bottom right icon in list)
4. Don't change the cell selection. Border lines are visible within the selection, the border lines at th eoutside are hidden by the selection
5. apply border with toolbar button 'Borders' and select 'outside borders only' (with me rightmost icon in middle row in list)
5. border lines are visible within the selection, which should not be the case.

Tested both with LO4.0.3.3 on Windows XP Professional and with LO4.1.0.0alpha0+master on openSUSE 12.3
Comment 5 ign_christian 2013-05-17 14:31:23 UTC
Oh yes..with that method I can reproduce that bug. 
Strange that using right click > Format Cells > Borders generates different result.
Comment 6 ign_christian 2013-05-18 04:16:13 UTC
I also confirm reproducible on LO 3.6.6.2 (Ubuntu 12.04.2 32bit)
Comment 7 Winfried Donkers 2013-05-21 07:11:29 UTC
(In reply to comment #5)
> Oh yes..with that method I can reproduce that bug. 
> Strange that using right click > Format Cells > Borders generates different
> result.

Well, that solves one riddle.
With right click - Format cells - Borders I can remove inner/outer borders as offered with the 'standard options', but I cannot remove part of the outer/inner borders with 'user defined borders'.

I am now trying to find out how much of this behaviour is 'as designed'.
Next step will be fixing it.
Comment 8 Winfried Donkers 2013-05-31 10:59:57 UTC
status report:
I have a fix, but I want to spend some more time in getting a consistent and logical behaviour of both the toolbar button, the cel format dialog standard options and the cell dialog custom settings.
Especially the use of 3 states (set, clear and don't care) for each border line in combination with the above mentioned different ways to change the border lines needs some extra attention.
Comment 9 Commit Notification 2013-06-12 08:16:29 UTC
Winfried Donkers committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e2e0db8f2967d866cba5c5400617d97aceaeefe9

fdo#64626 clarify use of border line settings on toolbar



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 10 Winfried Donkers 2013-06-12 08:20:11 UTC
Finally it became clear that the code does not contain bugs, but that the user documentation lacks information.
Yhe toolbar button for cell borders can be used with and without the SHIFT key.
Without the shift-key, border lines of the selected pattern are added if needed.
With the shift-key, border lines are added and deleted to get the pattern as chosen.

My patch that enhances the hint-text at the button, so that the user knows what will happen.
Currently the patch is only on master (and so will be available starting with version 4.2); I will ask for the patch to be included with version 4.1.
Comment 11 ign_christian 2013-06-12 08:44:11 UTC
Thank you Winfried. Unfortunately I can't do testing now :)
Comment 12 Commit Notification 2013-06-13 08:49:14 UTC
Winfried Donkers committed a patch related to this issue.
It has been pushed to "libreoffice-4-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=866d14f815491635074d0c2e66f4332ba8e1f887&h=libreoffice-4-1

fdo#64626 clarify use of border line settings on toolbar


It will be available in LibreOffice 4.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.