Bug 153710 - "Evaluate up to level" for Chapter Info for User-Defined Index shows only top level or all levels
Summary: "Evaluate up to level" for Chapter Info for User-Defined Index shows only top...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected) alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
Depends on: Clarify-Chapter-Heading-Outline-Level
Blocks: TableofContents-Indexes
  Show dependency treegraph
Reported: 2023-02-18 16:32 UTC by sdc.blanco
Modified: 2023-07-16 19:17 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:

Document for testing levels with user-defined index (56.34 KB, application/vnd.oasis.opendocument.text)
2023-02-18 16:32 UTC, sdc.blanco

Note You need to log in before you can comment on or make changes to this bug.
Description sdc.blanco 2023-02-18 16:32:24 UTC
Created attachment 185461 [details]
Document for testing levels with user-defined index


There does not seem to be any way to control how many levels are shown in a "Chapter Info" number range 

To see issue:

0. Attached document has a User-Defined Index at the end.

1. Edit the Index.  See in the "Type" tab that it is created from Tables, Frames, and Graphics (using "Use level from source chapter").

2. Select Entries tab and level 5.

3. Select CI icon (which introduces new options in the dialog window).

4. Note that "Evaluate up to level" is set to 6.  Change to "5"

5.  OK.

ACTUAL:  The number in front of "Second Table" changes from "" to "1"
EXPECTED: Number changes to ""

Any value for "Evaluate up to..." from 1-5 only shows "1", while any value greater than 5 shows ""  -- 

In short:  Cannot control the number of levels shown.

Additional Information:

1. Bug 153636 reports that levels do not work for Graphics and Frames, so if you use the attached file, then only Tables will change levels.

2. Have not tested other Indexes that use Chapter Info.

3. It is possible to control the number of levels shown in a ToC Index (using the "Evaluate up to..." option in the Entries tab).
Comment 1 sdc.blanco 2023-02-26 07:36:58 UTC
I believe that what is happening in the attachment is:

there are no headings with outline level (2-5) between the position of Table 1 and the top of the document, so it only uses the first heading that is encountered, which in the attachment is level 1.

If the outline level of the first heading is changed to a value between 2 and 5, then this is the heading number that will appear in the (updated index).

Or if a heading with outline level between 2 and 5 is inserted between the first (outline level 1) heading and the level 6 heading (before the table), then this heading number will be used.

In short, the rule between used by "Evaluate up to level" option is show the contents of the first immediately preceding paragraph that has an outline level less than or equal to (≤) the number entered in the "evaluate...level" spinbox.
Comment 2 Dieter 2023-03-12 10:37:14 UTC
I confirm it with

Version: (X86_64) / LibreOffice Community
Build ID: d7c609dbb1bd08865b43719d2fb7c316d30bcde5
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: en-US (de_DE); UI: en-GB
Calc: CL threaded

Help about "Show up to level": "Specify the number of levels of the heading number to show. For example, select '2' to show the first two levels of the heading number." [1]

[1] https://help.libreoffice.org/7.6/en-GB/text/swriter/01/04120225.html?&DbPAR=WRITER&System=WIN
Comment 3 Dieter 2023-03-12 10:37:56 UTC
(In reply to sdc.blanco from comment #1)
> In short, the rule between used by "Evaluate up to level" option is show the
> contents of the first immediately preceding paragraph that has an outline
> level less than or equal to (≤) the number entered in the "evaluate...level"
> spinbox.

So is it a bug or a docmentation issue?
Comment 4 sdc.blanco 2023-03-13 00:34:52 UTC
(In reply to Dieter from comment #3)
> So is it a bug or a docmentation issue?
(imo) both aspects are relevant -- and may be relevant for a few other tickets (e.g., bug 93904).  I will explain, so that you can decide on a way to proceed, and also to seek your feedback on the documentation part (because it is a little complicated).

The documentation part:
The current description cited in comment 2 was introduced recently (22 feb) as a resolution of bug 105628.

But after that change (26 feb), I got a new/different understanding (summarized in bug 153560 comment 10), which is what motivated comment 1.

Subsequently, it was decided (9 mar) to document actual behavior (see bug 147004, comment 20).

I just checked now and can see that I have not (yet) added the "latest" formulation for "user-defined", but was starting to work on it now, so I will take care of the documentation part of this ticket, following the (9 mar) decision.

Now the complicated part.

I have just done a similar updating for "Show up to level" for caption numbering (e.g., AutoCaption [1} (to appear soon in online help). And today a version was made for Alphabetical Index [2], which will also be used for this ticket ("User-defined"). I mention these two so that I can seek your opinion about how to handle the documentation. 

The issue is this:  If a document uses headings in a "typical" way [3], then 
the current online help (cited in comment 2) is pretty accurate. It is only when "non-typical" structures are used that seeming bugs appear (such as this ticket, as well as bug 147004 and bug 93904, which also involve fields.)

In AutoCaption [1], I tried to indicate a "rule" for typical heading structures, and then put the actual rule in a "note".  The "actual" rule seems a little too complicated to "think with", especially when it seems that most of us (as seen in BZ) are assuming that the "level" option is for specifying how many levels to show. And as noted, with a "typical" heading structure, it DOES work that way.

So I tried to find a way to give simple understandable help, but signal that this is in typical situations, but then also give the "actual rule" that can be used to explain/understand "atypical" cases. 

After the new versions in [1] and [2] appear, then let me know what you think. No doubt they can be improved. Perhaps a similar solution could work here?  At present, the version for Alphabetical Index [2] does not mention the actual rule, but maybe it should?   (there are also tooltips and extended tips)

The (maybe a) "bug" part. 
Both this ticket and attachment 185594 [details] from bug 153560 involve a situation where the search rule does not find any match, according to the selected level.  In that case, the field displays the first heading in the document (i.e., not following the rule anymore). In this one (corner) case, the expected behavior should be: "nothing is displayed"  
I consider the current behavior to be a bug. (the attachment gives a good/easy demonstration).

[1} https://help.libreoffice.org/7.6/en-US/text/shared/optionen/01041100.html
[2] https://help.libreoffice.org/7.6/en-US/text/swriter/01/04120222.html
[3] start with outline level 1, continue with outline 1 or outline level 2. With outline level 2, all subsequent headings have an outline level of -1, 0, or +1. In other words, no jumps or gaps in outline levels, each heading is preceded or followed by another heading that has the same outline level, or is one greater or one lesser.
Comment 5 sdc.blanco 2023-03-15 00:37:23 UTC
The updated help pages are online now.
See how Autocaption [1] in comment 4 gives a description of "typical" behavior, while the "note" gives the full picture. 
In contrast, "Alphabetical Index" [2] in comment 4 only gives "typical" behavior, with no indication of the complete rule. (The same text would be used for "User-defined", which is the focus of this ticket).  I can see arguments for both approaches, so would be happy to hear another opinion.