Bug 92805 - Field type "chapter" generates wrong text if its actual level has not been used yet
Summary: Field type "chapter" generates wrong text if its actual level has not been us...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.5.4 release
Hardware: All All
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Fields
  Show dependency treegraph
 
Reported: 2015-07-17 16:16 UTC by Michael Fiedler
Modified: 2023-02-26 00:03 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
minimal test case (9.00 KB, application/vnd.oasis.opendocument.text)
2015-07-17 16:16 UTC, Michael Fiedler
Details
real world example: Johann Wolfgang von Goethe: Faust. Eine Tragödie. (493.83 KB, application/x-octet-stream)
2015-07-17 16:17 UTC, Michael Fiedler
Details
simplified document (9.72 KB, application/vnd.oasis.opendocument.text)
2022-01-27 06:22 UTC, Dieter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Fiedler 2015-07-17 16:16:30 UTC
Created attachment 117302 [details]
minimal test case

Steps to reproduce:

Open the attached document: The header of a left page contains the current level 1 heading by using a field of type "chapter", e. g. "chapter name".  On the right page, it is the current level 2 heading.  On every page, a level 2 heading is used.  The field for current heading 1 uses the value of a heading 2 if there was no heading 1 yet.


Actual behaviour:

Go to page 4 or page 6: Although the current (level 2) heading is already at number 3, the heading 1 field still uses the heading (level 2) number 1 from the beginning of the document.


Expected behaviour:

The field for current heading level 1 should use the value of the current heading level 2, if there was no heading of level 1 yet.  It should NOT use a heading level 2 from the beginning which is not valid any more.


See the attached PDF file which shows a "real world" example (Goethe: Faust 1) that suffers from this problem.  E. g. on page 18 and 19, the headings should be the same: A level 1 heading has not occured yet (comes on page 22) and the current heading level 2 is "Prolog im Himmel".  However, on page 18 the header still contains "Zueignung" from the beginning.


Environment used:

LibreOffice 4.4.4.3-3
Debian GNU/Linux 7.8 (wheezy) (x86)
Comment 1 Michael Fiedler 2015-07-17 16:17:50 UTC
Created attachment 117303 [details]
real world example: Johann Wolfgang von Goethe: Faust. Eine Tragödie.
Comment 2 Michael Fiedler 2015-07-17 18:25:17 UTC
LibreOffice 3.5.4.2 (from Debian) is also affected.
Comment 3 Buovjaga 2015-07-29 19:47:52 UTC
I confirm what you describe, but I don't really understand the mechanism/logic behind it :(

I'll set to NEW anyways.

Win 7 Pro 64-bit Version: 5.1.0.0.alpha1+ (x64)
Build ID: e92a8b92072284fd7c37d7bb3e1e8fe72a185f35
TinderBox: Win-x86_64@62-TDF, Branch:MASTER, Time: 2015-07-22_21:46:26
Locale: fi-FI (fi_FI)
Comment 4 QA Administrators 2016-09-20 10:21:53 UTC Comment hidden (obsolete)
Comment 5 QA Administrators 2021-01-16 04:18:33 UTC Comment hidden (obsolete)
Comment 6 Nucleos 2022-01-21 14:39:59 UTC
This problem still exists.

Version: 7.2.5.2.0+ / LibreOffice Community
Build ID: 20(Build:2)
CPU threads: 4; OS: Linux 5.16; UI render: default; VCL: gtk3
Locale: fr-FR (en_US.UTF-8); UI: en-US
7.2.5-4
Calc: threaded
Comment 7 Dieter 2022-01-27 06:22:38 UTC Comment hidden (obsolete)
Comment 8 Dieter 2022-01-27 06:32:33 UTC
You can solve the problem if you assign first level of chapter numbering to PS "Heading 2" with Tools => Chapter Numbering. Update fileds (F9) and everything works as expected.

So expected result would be, that filed diesplays nothing, because filed is connected with chapter level 1 and headings are chapter level 2. Problem is described in bug 147004. Since description there is more concrete, I would treat bug 92805 as duplicate of bug 147004.
Comment 9 sdc.blanco 2023-02-26 00:03:33 UTC
(In reply to Dieter from comment #8)
> You can solve the problem if you assign first level of chapter numbering to
> PS "Heading 2" with Tools => Chapter Numbering. Update fileds (F9) and
> everything works as expected.
Cool solution -- but probably the preferred solution would be to use the "Level" control for the field.

Open "minimal test case" (attachment 117302 [details]), edit field in Header of "Left Page" Page Style.  Change "level" from "1" to "2". 

I believe this gives the expected result in the OP 
    => WFM (in 7.2.7.2) or NAB (if you can test with 4.4.4.3-3)