Bug 86297 - Wrong Field reference when heading is in a frame
Summary: Wrong Field reference when heading is in a frame
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.3.4.1 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Fields-Cross-Reference
  Show dependency treegraph
 
Reported: 2014-11-14 21:57 UTC by Frank Berke
Modified: 2022-04-20 07:20 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
Wrong Field reference when heading is in a frame (10.72 KB, application/vnd.oasis.opendocument.text)
2014-11-14 21:57 UTC, Frank Berke
Details
Problems with Chapters in frames, added sub-chapters do demonstrate related Navigator issues (10.73 KB, application/vnd.oasis.opendocument.text)
2016-02-13 17:54 UTC, Frank Berke
Details
Example of wrong numbering when heading is in a frame (12.37 KB, application/vnd.oasis.opendocument.text)
2018-05-20 14:47 UTC, RGB
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Frank Berke 2014-11-14 21:57:06 UTC
Created attachment 109493 [details]
Wrong Field reference when heading is in a frame

If headings are in a frame, and you want the Chapter Name displayed in your page header, only the chapter name from the last frame's heading is displayed throughout the whole document.

Indexes however can be created with no problems, and in the Fields' Cross-References all the headings appear as well.

There is a document attached that helps you to understand the error.
Comment 1 Buovjaga 2014-11-20 12:53:24 UTC
Confirmed by opening the file on Windows -> NEW.

Win 7 64-bit Version: 4.4.0.0.alpha2+
Build ID: b021b5983c62e266b82d9f0c5c6d8d8900553827
TinderBox: Win-x86@39, Branch:master, Time: 2014-11-12_01:10:08
Comment 2 Frank Berke 2014-11-21 11:57:10 UTC
In addition to my initial report: if you use different levels of headings, and some of them are placed in a frame, they don't show up in a proper order in the Navigator. Sub-headings appear to be disconnected from their preceding level (e.g. chapter). The same goes for the Cross-References in the Fields dialog box.

Still, creating an index for your document works fine.

I didn't open a new bug for this because I think both issues are related.
Comment 3 QA Administrators 2015-12-20 16:09:55 UTC Comment hidden (obsolete)
Comment 4 Frank Berke 2016-02-13 17:54:37 UTC
Created attachment 122628 [details]
Problems with Chapters in frames, added sub-chapters do demonstrate related Navigator issues

Confirmation that the bug still exists.

I have added sub-chapters to the test document to demonstrate the issues in Navigator as described in an earlier post.

Version tested: 5.1 Linux AMD64
Comment 5 QA Administrators 2017-03-06 15:15:15 UTC Comment hidden (obsolete)
Comment 6 RGB 2018-05-20 14:47:25 UTC
Created attachment 142218 [details]
Example of wrong numbering when heading is in a frame

Problem is still present on 6.0.4. In addition to the original description, there is also a big problem if you use outline numbering.

For example, consider a document where you have

Heading 1 → numbered as #
Heading 2 → numbered as #.#
Heading 3 → numbered as #.#.#

And the content of your document is

1. First heading 1 (normal text)
2. Second heading 1 (normal text)
2.1 A heading 2 as normal text
2.1.1 A heading 3 as normal text
[1.1.1 A heading 3 inside a frame] ← wrong numbering!

See attached file.
Comment 7 QA Administrators 2021-02-05 04:11:52 UTC Comment hidden (obsolete)
Comment 8 RGB 2021-02-05 20:44:35 UTC
Problem still present in Version: 7.1.0.3. (see Comment 6, too)
Comment 9 sdc.blanco 2022-04-12 22:28:13 UTC
Repro with attachment 142218 [details]

Version: 7.4.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: d34d1db55978bdcff082af1e0f75b18fa6fc94f4
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: da-DK (da_DK); UI: en-US
Calc: CL

There are many different issues in this ticket, but no evaluation of whether headings inside of Frames should participate in the outline structure of the document.  Might be worth asking the Design Team to confirm that the expectations here are valid for Frames. To do that: 
  Add 'needsUXEval' to Keywords and  
  libreoffice-ux-advise@lists.freedesktop.org to CC list
Comment 10 Heiko Tietze 2022-04-13 08:11:41 UTC
Cannot wrap my mind around a frame with heading moved to some other position- neither to have it in the header/footer area. Why the heck would you do that? If the chapter needs to be present in the header a reference is the way to go.

So my first idea is to block outlines in special sections. But I see no clear way to do so as it requires to block applying a style linked to an outline - but no other style.

In respect to the sorting order at the Navigator we do wrong in either way. We show in the Navigator somehow what you see in the document. Somehow since "Chapter 1.1" comes before framed "Chapter One", which then contains 1.1.1 ff. 

Btw, use Tools > Chapter Numbering to get the true level.

Maike, Jim, what do you think?
Comment 11 Mike Kaganski 2022-04-13 15:30:55 UTC
It's a confusing concept: headings in frames. You can anchor several frames to a single paragraph; which chapter that paragraph belongs then? Or if the frame is anchored to a character or as character, which part of the paragraph belongs to which chapter? Or when you reorder chapters using Navigator, how should things move?

I don't know what would be sane here. I don't think we can disable some paragraph properties in some special areas; ignoring them there could be a reasonable options - but potentially breaking existing documents and creating much pushback (from users who consider current awkward partial state of correct index generation good enough, and maybe also helping interoperability).

CCing Miklos, maybe he has better ideas.
Comment 12 Jim Raykowski 2022-04-13 22:49:32 UTC
Referring to  attachment 'Problems with Chapters in frames, added sub-chapters do demonstrate related Navigator issues'

The reason for 'Chapter 1.1' showing in the Headings entries before 'Chapter One' is both are considered to have the same document Y position. The Y position of headings in a frame are determined by the frame's anchor position. The frame containing 'Chapter One' is paragraph anchored at 'Chapter 1.1' paragraph. In this case alphabetical sorting is used. Changing 'Chapter One' to 'Chapter 1' will show 'Chapter 1' before 'Chapter 1.1' in the Headings entries.  When the frame anchor is moved into the header paragraph 'Chapter One' is placed before 'Chapter 1.1'.

Currently chapters in a frame are ordered alphabetically because the frame anchor position is used to determine document position for these.

Why the frame is considered to be in the header when it is anchored to the first paragraph in the document body I do not know.
Comment 13 Heiko Tietze 2022-04-14 11:35:44 UTC
Many good reasons to keep the current state and the use case is far-fetched if not invalid. Unless Miklos has a better idea I resolve as NAB.
Comment 14 Miklos Vajna 2022-04-20 07:20:21 UTC
No better idea, putting headings inside frames sound like a garbage in -> garbage out case to me. :-)