Bug 114567 - HYPERLINK DIALOG: "Target in document" dialog should display the level of headings
Summary: HYPERLINK DIALOG: "Target in document" dialog should display the level of hea...
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
(earliest affected) release
Hardware: All All
: medium enhancement
Assignee: Not Assigned
Whiteboard: target:7.2.0
Depends on:
Blocks: Hyperlink-Dialog
  Show dependency treegraph
Reported: 2017-12-19 19:08 UTC by samik
Modified: 2022-11-18 23:37 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:

file for test (21.33 KB, application/vnd.oasis.opendocument.text)
2018-01-21 14:17 UTC, tagezi
Hyperlink Target in Document Headings expand collapse (455.11 KB, video/x-matroska)
2021-01-26 03:32 UTC, Jim Raykowski

Note You need to log in before you can comment on or make changes to this bug.
Description samik 2017-12-19 19:08:47 UTC
While editing document local hyperlinks, the "Target in document" window appears if browse button is pressed for target. This shows a list of headings, among other things. This list of headings is flat in the sense that all levels of headings are shown in a single list like manner, with the heading's outline numbers prefixed. This should be changed into a hierarchical tree like widget, such as in navigator, so that it can be navigated properly when there are many levels of headings in the document. 
Additionally, also available in navigator, there should be a way to change verbosity level of heading list. Such as upto which level the headings are shown.

Steps to Reproduce:
1. Create a document with many levels of headings
2. Right click on a hyperlink, select "Edit hyperlink..."
3. In the edit dialog, go to "Document" tab
4. Press the browse button beside "Target in Document" > "Target" textbox
5. A "Target in document" dialog opens with a flat list of headings in the document"

Actual Results:  
A flat list of headings is shown in "Target in document" dialog. There is no option to control the level of displayed headings.

Expected Results:
A hierarchical heading tree should be shown like navigator. There should be a way to control the level of headings displayed in that dialog

Reproducible: Always

User Profile Reset: No

Additional Info:
This is problematic for documents with many levels of headings, especially a particular level is more crowded that others, because then other levels are lost in the list; it's very hard to cherry-pick them from within.
This happened to me while numbering source code listing lines with the help of chapter numbering(so that it automatically restarts on each listing), but then it creates a heading out of each source code line and other levels are lost in them.
Build ID: 5.4.3-2
CPU threads: 2; OS: Linux 4.13; UI render: default; VCL: gtk3; 
Locale: en-IN (en_IN.UTF-8); Calc: group

User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0
Comment 1 Dieter 2017-12-19 19:26:10 UTC
I agree.
Comment 2 tagezi 2018-01-21 14:17:33 UTC
Created attachment 139243 [details]
file for test

This requires significant changes in the code to determine the level of the heading.

String of menu bar for translation:

Files where the tree is made:

I attach the file for test this issue.
Comment 3 Jim Raykowski 2021-01-26 03:32:10 UTC
Created attachment 169146 [details]
Hyperlink Target in Document Headings expand collapse

Here is a link to a patch that does this:

Continued effort is needed to preserve the tree state when the tree is refreshed.
Comment 4 Commit Notification 2021-03-02 21:50:06 UTC
Jim Raykowski committed a patch related to this issue.
It has been pushed to "master":


tdf#114567 tdf#138934 Hyperlink-Target in Doc Headings expand/collapse

It will be available in 7.2.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:

Affected users are encouraged to test the fix and report feedback.
Comment 5 Dieter 2021-03-13 18:04:06 UTC

Version: (x64) / LibreOffice Community
Build ID: 21c602913d98ef46b49fc9b6f9071db92a1597c6
CPU threads: 4; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL

Jim, thanks for fixing it!