Bug 143569 - Headings outside the main body are out of order in Navigator and PDF
Summary: Headings outside the main body are out of order in Navigator and PDF
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Jim Raykowski
URL:
Whiteboard: target:7.4.0 target:7.3.0.0.beta2
Keywords:
Depends on:
Blocks: Navigator
  Show dependency treegraph
 
Reported: 2021-07-28 03:36 UTC by Alistair Saywell
Modified: 2023-02-09 16:34 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Writer document as described above (13.31 KB, application/vnd.oasis.opendocument.text)
2021-07-28 03:36 UTC, Alistair Saywell
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alistair Saywell 2021-07-28 03:36:01 UTC
Created attachment 173893 [details]
Writer document as described above

I create a new document and enter some sample text in Text Body. I add a Heading 1 and I add a Heading 2, I then insert a frame and add a Heading 4 and some text, such as a note that sits outside the main text. 
I create a Table of Contents using the default settings and the Headings are in page order.
I now see in Navigator that the lower level 4 Heading comes before the body of the document and before higher level Headings, although in the TOC they are in correct order. 
The incorrect order is reflected in Bookmarks when exported as PDF, where the level 4 headings are now shown at the same level as Heading 1 but coming before the main body of the text

Can the Headings in frames be ordered in Navigator according to their anchor points in the main body of the text?
Comment 1 Roman Kuznetsov 2021-07-28 10:16:08 UTC
Confirm the problem in

Version: 7.3.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 6805efdecb240fad8c82a5c1756a2a0e92f12b7d
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: Skia/Vulkan; VCL: win
Locale: ru-RU (ru_RU); UI: en-US
Calc: threaded
Comment 3 Jim Raykowski 2021-12-18 02:04:24 UTC
The fix for this is already in the code. The same function used to assign sort numbers to Sections can be used for Headings as well.

Link to proposed patch:
https://gerrit.libreoffice.org/c/core/+/127022
Comment 4 Commit Notification 2021-12-21 05:35:11 UTC
Jim Raykowski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/c8ac73daa670ab571c3d52541c67c28270ee6a08

tdf#143569 fix fly frame Headings out of order in Navigator

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 5 Commit Notification 2021-12-21 11:38:35 UTC
Jim Raykowski committed a patch related to this issue.
It has been pushed to "libreoffice-7-3":

https://git.libreoffice.org/core/commit/6c9f77e2f776f3a28764e423bbe42696c0b0627c

tdf#143569 fix fly frame Headings out of order in Navigator

It will be available in 7.3.0.0.beta2.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 6 Jim Raykowski 2021-12-22 09:14:19 UTC
The Navigator ordering seems to be fixed. I am unsure about the PDF part of the bug report. If there is more to do here please reopen.
Comment 7 Commit Notification 2021-12-22 18:22:45 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/dd073b6e2be32749333af25c160ea637c4a27e10

tdf#143569: sw: Add UItest

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Jim Raykowski 2022-04-24 20:10:11 UTC
Although the current fix places headings that are in a frame at the sort position of the node the frame is anchored, the headings within the frame are still sorted alphabetically. The approach used to make the Navigator list field and hyperlink content in frames in the order of document layout appearance[1][2] seems to also work to order outline headings in frames in the order of document layout appearance.

Here is a link to patch to make outline headings in frames list in the order of document layout appearance: 
https://gerrit.libreoffice.org/c/core/+/133359

[1] https://gerrit.libreoffice.org/c/core/+/133101
[2] https://gerrit.libreoffice.org/c/core/+/133342
Comment 9 Commit Notification 2022-04-29 20:45:01 UTC
Jim Raykowski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/c81f4a4ecbfa7dc97d8c28b5ec5f00d1d561b6bb

tdf#143569 SwNavigator: Make Headings entries from headings in frames

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 sdc.blanco 2023-02-09 16:23:35 UTC
Can verify that headings in frames are placed at top of Headings list in Navigator for 7.2.7.2, but for 7.6.0.0.alpha0+ (X86_64) these headings appear in the appropriate order in the headings list in Navigator.  Thanks for the fix Jim!

Did not test the PDF issue.