Bug 154081 - Unnumbered headings influence the numbering of numbered headings
Summary: Unnumbered headings influence the numbering of numbered headings
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Heading-Numbering
  Show dependency treegraph
Reported: 2023-03-09 00:47 UTC by sdc.blanco
Modified: 2023-12-22 12:41 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:

demonstration of problem (10.79 KB, application/vnd.oasis.opendocument.text)
2023-03-09 00:47 UTC, sdc.blanco
Example (12.47 KB, application/vnd.oasis.opendocument.text)
2023-06-05 08:48 UTC, Heiko Tietze

Note You need to log in before you can comment on or make changes to this bug.
Description sdc.blanco 2023-03-09 00:47:49 UTC
Created attachment 185853 [details]
demonstration of problem

Attachment demonstrates the problem. 

1. Tools - Chapter (Heading) Numbering, assign:
Level  Numbering
1      1,2,3
2      A,B,C  show 2 sublevels
3      none   show 3 sublevels

(i.e., first two outline levels get numbering, third does not)

Test document w/ three paragraphs with following PS

1 Heading 1
Heading 3
1.A heading 2

Critical "test":  

   What numbering shown for outline level 2 (i.e., third paragraph)?


Actual and expected (in  1.A heading 2

Actual in  1.B heading 2
Expected: 1.A heading 2

Additional test:

Change unnumbered level 3 paragraph to "Text Body", then numbering on level 2 paragraph is as expected.

=> presence of unnumbered outline level 3 paragraph appears to increase the numbering for the outline level 2 paragraph.

=> seems like possible regression, because works as expected in

Version: (X86_64) / LibreOffice Community
Build ID: a179f6c91692076e7e17babf4890638caa398384
CPU threads: 8; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: da-DK (da_DK); UI: en-US
Calc: CL threaded
Comment 1 raal 2023-03-09 20:21:42 UTC
Confirm in Version: (X86_64) / LibreOffice Community
Build ID: 288c0920a8475f9f2c537212e04aa7649192ad8c
CPU threads: 4; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: cs-CZ (cs_CZ.UTF-8); UI: en-US
Calc: threaded

Works in Version (Build ID: efca6f15609322f62a35619619a6d5fe5c9bd5a)
Comment 2 raal 2023-03-09 20:28:10 UTC
This seems to have begun at the below commit in bibisect repository/OS linux-64-7.4.
Adding Cc: to Vasily Melenchuk ; Could you possibly take a look at this one?
 87717a6138e722571430832ad04ca1df38ddc017 is the first bad commit
commit 87717a6138e722571430832ad04ca1df38ddc017
Author: Jenkins Build User <tdf@pollux.tdf>
Date:   Wed Mar 16 04:58:33 2022 +0100

    source bcede3c0ed94d413fea18d2457b916a9f5f4346a

131410: tdf#146851: sw: even numbering=None is still a numbering | https://gerrit.libreoffice.org/c/core/+/131410
Comment 3 Vasily Melenchuk (CIB) 2023-04-26 14:07:20 UTC
Comparing behavior of Writer and Word I assume this as not a bug.

1) If you enable numbering for level 3, you will see "heading 2" having "1.B" numbering even in older Writer versions.

2) Numbering=None (like in given example for level 3) is not equal to "no numbering". It is still level 3 of numbering but numbers are not counted and not displayed.

I can't claim this is absolutely correct behavior, but it is closer to MS Word behavior and more logical to my mind: internally in Writer "heading 3" is still a part of the list and this information can be taken into account for deeper levels.

Meanwhile if you want to exclude "heading 3" from numbering, just remove it: [context menu] -> List -> No List (Ctrl+Shift+F12). If I got correctly, this is expected result.
Comment 4 sdc.blanco 2023-04-26 14:40:45 UTC
@Vasily -- it seems premature to resolve as NAB, when behavior in 7.2 and 4.1 corresponds to expected, while behavior after your patch does not. 

I will reopen this ticket and ask UXEval for an evaluation of the situation.
Comment 5 Heiko Tietze 2023-04-27 12:49:47 UTC
NEEDINFO from Vasily: The patch was about "The logic of Cross Reference representing Paragraph Numbering is different between MSOffice and LibreOffice" and apparently changed the way numbering works. Is it necessary? (I can follow comment 3).
Comment 6 Vasily Melenchuk (CIB) 2023-04-27 15:10:50 UTC
(In reply to Heiko Tietze from comment #5)
> NEEDINFO from Vasily: The patch was about "The logic of Cross Reference
> representing Paragraph Numbering is different between MSOffice and
> LibreOffice" and apparently changed the way numbering works. Is it
> necessary? (I can follow comment 3).

In my opinion - yes, it is required. That problem with cross-references (tdf#146851) actually was about related situation: paragraph is a list entry with numbering=none, Writer does display all prefix-suffix-followby, but cross-reference content is empty because referred list item has numbering=none. 

Behavior in this area was not consistent by itself: it is a list, but since it has numbering=none it is not a list, but we will display prefix/suffix/followby like in list, but we will not highlight numbering-outline button on toolbar because it is not a list. 

Very confusing logic and also causing compatibility problems to MS Word.
Comment 7 sdc.blanco 2023-04-27 20:01:12 UTC
(In reply to Vasily Melenchuk (CIB) from comment #6)
> we will not highlight  numbering-outline button on toolbar because
> it is not a list. 
See bug 148673.  

Headings are also  used for their outline levels, not only with numbering.

In that connection, why can't one have a document design where outline level 1 and 2 are numbered, but levels 3-5 are not (but they are still positioned, according to the settings in Tools - Heading Numbering) -- which motivated this bug report.
Comment 8 bugzilla 2023-06-02 15:52:50 UTC
I've just stumbled on this issue whilst creating a Writer document with mixed Chapter Numbering - numbered and unnumbered.
Like Blanco I was puzzled as to the unexpected numbering increments, but when you make the numbering levels visible it does show what is going on in the background. With no numbering OR all numbered, all is well. 

I'd be interested to know if there is any likely resolution for the 'mixed' use case since I would like to use the Demote/Promote controls to auto-position all the levels.
Comment 9 Heiko Tietze 2023-06-05 08:48:24 UTC
Created attachment 187725 [details]

Example showing the difference of H3 following a H1 without a H2 in between. If I open this document in MSO the first H2 is always 1.A - as expected by Seth.

Interestingly, switching the first H3 to Text Body and back to H3 keeps the modified H2 ("1.A"), at least as long nothing changes for this chapter.
Comment 10 Heiko Tietze 2023-06-05 08:52:10 UTC
Seth added an example, no need for more. The argument was to make outlines work like in MSO and in fact it should be changed as expected to comply.