Bug Hunting Session
Bug 128058 - UI: Option to open all heading branches at once
Summary: UI: Option to open all heading branches at once
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Jim Raykowski
URL:
Whiteboard: target:6.4.0
Keywords:
Depends on:
Blocks: Navigator
  Show dependency treegraph
 
Reported: 2019-10-09 18:55 UTC by John
Modified: 2019-11-19 16:00 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Expand subheadings when heading is expanded (572.30 KB, video/x-matroska)
2019-10-15 09:52 UTC, Jim Raykowski
Details
headings test file (19.00 KB, application/vnd.oasis.opendocument.text)
2019-10-15 09:57 UTC, Jim Raykowski
Details
expand all menu item when on heading content type entry (98.64 KB, image/png)
2019-10-18 03:51 UTC, Jim Raykowski
Details
expand all menu item when on heading content entry (100.74 KB, image/png)
2019-10-18 03:52 UTC, Jim Raykowski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description John 2019-10-09 18:55:57 UTC
Description:
(This is a follow-up bug of https://bugs.documentfoundation.org/show_bug.cgi?id=36308.)

* * *

> The second part of the request wasn't filled: "An option to open all
> branches at once is highly desirable too". 
> This is highly necessary for someone that needs to navigate along long
> documents.

* https://bugs.documentfoundation.org/show_bug.cgi?id=36308#c19
* https://bugs.documentfoundation.org/show_bug.cgi?id=36308#c21

Currently, when you open a document (consider a document with a lot of headings from level 1 to level 4), all heading branches in Navigator will be collapsed. To have them visible - you need to expand them manually - each one. Of course, it could be tedious.

It will be very useful to have an option to quickly expand all these branches to specific level.

* * *

A possible way to implement such feature:

We already have "Heading Levels Shown" button in Navigator. Its behavior could be slightly changed: instead of simply limit the visible depth of the headings, it could automatically expand them to this level.

This (or similar) idea was already described by Christoph:

>> An option to open all branches at once is highly desirable too.

> The "Show heading levels" dropdown "filter" should be converted into
a command list. So if the user sets "5", then all the headings until
level 5 should be expanded. All further levels will still be expandable
by the user. If the user sets "1", then all headings are collapsed but
the main headings. Still, the user may expand them manually - there is
no hidden pre-filtering.

(https://bugs.documentfoundation.org/show_bug.cgi?id=36308#c1)

Steps to Reproduce:
1. Create a document with a lot of headings from level 1 to level 4.
2. Expand these heading in Navigator.
3. Close document and then open it again.
4. The headings in Navigator will be collapsed and you will be required to expand them one by one.

Actual Results:
-

Expected Results:
-


Reproducible: Always


User Profile Reset: No



Additional Info:
-
Comment 1 John 2019-10-10 01:49:36 UTC
This is a workaround I use for myself (Windows only, AutoHotkey):

```
#SingleInstance, Force
SendMode, Input

F1::
  Loop 100
    Send, {Right}{Down}
  Send, {Home}
Return
```
Comment 2 Dieter Praas 2019-10-10 19:23:47 UTC
(In reply to John from comment #0)
> We already have "Heading Levels Shown" button in Navigator. Its behavior
> could be slightly changed: instead of simply limit the visible depth of the
> headings, it could automatically expand them to this level.

I strongly support this proposal.
Comment 3 Heiko Tietze 2019-10-11 07:35:52 UTC
Yes, the filter of "Heading Levels Shown" is pointless but it's also not common to have a toolbar button that shows up tree items to a certain level. So while the proposal is a viable solution, I suggest to remove the toolbar button and to introduce a context menu with "Show all". We should also implement the standard shortcut * for it that opens all levels of the selected drive in MS explorer, at least. We could expand the context menu by another option "Show all at this level", which keeps H3..H10 collapsed when applied to H2, for example.
Comment 4 Dieter Praas 2019-10-11 07:47:27 UTC
Heiko, we also should consider bug 58129 (show headings expanded in Navigator when a text document is opened). Perhaps it is possible to integrate it into bug 128058.
Comment 5 Heiko Tietze 2019-10-11 08:08:22 UTC
Yes, bug 58192 is kind of a duplicate. We should perhaps expand the levels by default depending on the number of headings - and store the last view.
Comment 6 Jim Raykowski 2019-10-12 03:25:39 UTC
Hi all,

Here is a patch that expands all subheadings of heading when it is expanded.

https://gerrit.libreoffice.org/#/c/80702/
Comment 7 Jim Raykowski 2019-10-15 09:52:18 UTC
Created attachment 155014 [details]
Expand subheadings when heading is expanded

I have attached a demonstration video of the patch behavior. Is this what is wanted?
Comment 8 Jim Raykowski 2019-10-15 09:57:14 UTC
Created attachment 155015 [details]
headings test file
Comment 9 Dieter Praas 2019-10-15 10:09:58 UTC
(In reply to Jim Raykowski from comment #7)
> Created attachment 155014 [details]
> Expand subheadings when heading is expanded
> 
> I have attached a demonstration video of the patch behavior. Is this what is
> wanted?


Thank you, for the patch. I think, it could be an emprovement. But (as far as I understodd) the idea in comment 0 was to select the display of the heading levels with  "Outline level" from the heading context menu.

Steps:
1. Open headings in navigator
2. Open context menu in any heading
3. Select "Outline level" and choosea level
4. All headings until this level are expanded (that would be the desired result)
Comment 10 Jim Raykowski 2019-10-15 10:28:48 UTC
@Dieter - Thanks for the feedback. I will see about doing that.
Comment 11 Heiko Tietze 2019-10-15 11:16:40 UTC
(In reply to Jim Raykowski from comment #10)
> @Dieter - Thanks for the feedback. I will see about doing that.

Please also consider my comment 3 (expand functions via context menu).
Comment 12 Heiko Tietze 2019-10-17 12:28:52 UTC
Jim is implementing the * plus context menu solution.
Comment 13 Jim Raykowski 2019-10-17 21:03:48 UTC
Seems I have reinvented the wheel. While looking through the code that handles keyboard interaction for the Navigator content tree I found that 'ctrl +' expands all and 'ctrl -' collapses all.

So on to the content menu part of this request :-)
Comment 14 John 2019-10-17 22:14:57 UTC
> it's also not common to have a toolbar button that shows up tree
> items to a certain level. So while the proposal is a viable solution,
> I suggest to remove the toolbar button and to introduce a context
> menu with "Show all". 

When I wrote about the button I mean that it should work similar to quick filters in Calc and Excel. You _filter_ the levels which should be shown.

(It should be said that the most appropriate icon in this case will be the funnel. But it is already in use.)

Initially, when I proposed this idea, I mean that it should work for all headings in Navigator at once.

The advantage of context menu is that it is better suited for individual heading. I.e. consider the following document:

```
[-] Headings
  [-] Foo
        Aaa
        Bbb
        Ccc
  [-] Bar
        Ddd
        Eee
        Fff
```

* If you want to expand _all_ headings (there will be no difference with proposed button solution) - you should call this context menu from "Headings" item.

* If you want to expand only "Foo" heading - you should call context menu from "Foo". 

So, the context menu idea looks more flexible.
Comment 15 John 2019-10-17 22:26:25 UTC
(In reply to Jim Raykowski from comment #13)

A hidden gem? Yes! :-) Though it seems they work a little inconsistent.

* 'ctrl +' expands current heading.
* 'ctrl -' collapses all headings. Expected: should collapse only current heading.

I think it could be additional pair of shortcuts:  'ctrl shift +' and 'ctrl shift -'.

* 'ctrl +' and 'ctrl -' should expand/collapse current heading.
* 'ctrl shift +' and 'ctrl shift -' should expand/collapse all headings.
Comment 16 Jim Raykowski 2019-10-18 03:51:50 UTC
Created attachment 155105 [details]
expand all menu item when on heading content type entry
Comment 17 Jim Raykowski 2019-10-18 03:52:55 UTC
Created attachment 155106 [details]
expand all menu item when on heading content entry
Comment 18 Jim Raykowski 2019-10-18 03:53:20 UTC
Here is a patch that adds Expand All to the content tree context menu. It only appears for headings with children:

https://gerrit.libreoffice.org/#/c/81003/
Comment 19 Jim Raykowski 2019-10-18 06:27:18 UTC
I reworked the patch to make Ctrl * expand and collapse treelist entries. It address Johns concern of Ctrl - collapsing all parents to the root. Ctrl * will only collapse to the focused entry and like Ctrl + will expand all children.

https://gerrit.libreoffice.org/#/c/80702/https://gerrit.libreoffice.org/#/c/80702/
Comment 20 Heiko Tietze 2019-10-18 08:47:10 UTC
(In reply to Jim Raykowski from comment #19)
> https://gerrit.libreoffice.org/#/c/80702/https://gerrit.libreoffice.org/#/c/
> 80702/

Super cool, works like a charm. Now we should expose this easter egg to the users with the context menu.
Comment 21 Commit Notification 2019-10-18 23:23:01 UTC
Jim Raykowski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/888ac516aacbc30a8e9331f6aba7684228568871

tdf#128058 Make ctrl * expand/collapse tree list entries

It will be available in 6.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 22 John 2019-10-20 17:21:46 UTC
It is stated that the path was pushed to the master, but I cannot understand which build should be downloaded to test it: there are a lot of available ones. Also, I'm not sure that this build will be 32-bit.

So, instead of writing _after_ testing, I will simply write it right now.

From the current discussion it is follows that:

* 'ctrl *' will expand/collapse all headings from/to the current heading.
* There are no changes related to the 'ctrl +' and 'ctrl -'. 

Is it correct understanding?

In case the anser is "yes", isn't it better to use 

* 'ctrl +' and 'ctrl -' to expand/collapse all headings from/to the current heading.
* 'ctrl shift +' and 'ctrl shift -' to expand/collapse _all_ headings (all headings in the overall document).

?
Comment 23 John 2019-10-20 23:22:31 UTC
Slightly off-topic, but could be useful in the context of the current discussion:

as I discovered today, Ctrl-Enter will enable/disable "Content Navigation View" (CNV). 

Pre-requirements:

* The focus should be on some element inside the Navigator. E.g. if you want to enable CNV for headings, the focus should be either on "Headings" item or on some heading.
* To disable CNV, the focus should be on some element under the root element, but not on the root element itself. E.g. if you want to disable CNV for headings, the the focus should be on some heading, but not on the "Headings".

Tested with LO 6.2.7.1 on Windows 7.
Comment 24 John 2019-10-20 23:42:23 UTC
Update: the second pre-requirement isn't true, my fault. So, Ctrl-Enter works quite good.
Comment 25 Jim Raykowski 2019-10-21 03:12:26 UTC
(In reply to John from comment #22)
> It is stated that the path was pushed to the master, but I cannot understand
> which build should be downloaded to test it: there are a lot of available
> ones. Also, I'm not sure that this build will be 32-bit.

Hi John,

Daily builds for Win-x86 can be found here:
https://dev-builds.libreoffice.org/daily/master/Win-x86@39/

At the time of this post the newest daily build available is 2019-10-17. That is a day before the patch was merged. 

The Win-x86_64 version found here is 2019-10-20: 
https://dev-builds.libreoffice.org/daily/master/Win-x86_64@tb77-TDF/
Comment 26 Jim Raykowski 2019-10-21 03:38:05 UTC
(In reply to John from comment #23)
> Slightly off-topic, but could be useful in the context of the current
> discussion:
> 
> as I discovered today, Ctrl-Enter will enable/disable "Content Navigation
> View" (CNV). 

I saw that while looking in the code. Would be nice to add to the help document if it isn't already there along with the new ctrl * and other shortcuts and key uses available for tree lists, ctrl +, ctrl -, Home, End, Right and Left arrow expand and collapse, etc. These might also make good tips for the wonderful recently added tip of the day dialog, kudos to Heiko for that :-)

https://www.libreoffice.org/community/docs-team/
Comment 27 Jim Raykowski 2019-10-21 03:48:58 UTC
(In reply to John from comment #22)

> From the current discussion it is follows that:
> 
> * 'ctrl *' will expand/collapse all headings from/to the current heading.
> * There are no changes related to the 'ctrl +' and 'ctrl -'. 
> 
> Is it correct understanding?

yes

> 
> In case the anser is "yes", isn't it better to use 
> 
> * 'ctrl +' and 'ctrl -' to expand/collapse all headings from/to the current
> heading.
> * 'ctrl shift +' and 'ctrl shift -' to expand/collapse _all_ headings (all
> headings in the overall document).
> 

To make a + with my laptop keyboard I need to hold the shift key down. So ctrl shift + is the same as ctrl + for me and ctrl shift - is ctrl _.
Comment 28 Heiko Tietze 2019-10-21 08:19:55 UTC
Adding Olivier and Ilmari to keep four more eyes on the documentation part.

(In reply to Jim Raykowski from comment #27)
> To make a + with my laptop keyboard I need to hold the shift key down. 

In my first reviews of Jim's patch I tried the numpad * - it's not working because of the different keycode. Hard-coded shortcuts are not a good solution anyway.
Comment 29 John 2019-10-21 11:58:43 UTC
(In reply to Jim Raykowski from comment #27)

> To make a + with my laptop keyboard I need to hold the shift key down. So
> ctrl shift + is the same as ctrl + for me and ctrl shift - is ctrl _.

This is true for my keyboard as well. Of course, when I say 'ctrl+' and 'ctrl-' I mean that the shift is not required. So, technically, it will be 'ctrl=' and 'ctrl-'.
Comment 30 Commit Notification 2019-10-23 02:40:11 UTC
Jim Raykowski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/3ed56f407235feb97ee2565a613e5f1d2bb2d925

tdf#128058 Add Expand Collapse All to Navigator context menu

It will be available in 6.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 31 Dieter Praas 2019-10-27 13:32:00 UTC
Verified with

Version: 6.4.0.0.alpha1 (x64)
Build ID: cc57df8f942f239d29cb575ea5a7cb01405db787
CPU threads: 4; OS: Windows 10.0 Build 18362; UI render: GL; VCL: win; 
Locale: de-DE (de_DE); UI-Language: en-US
Calc: threaded

Jim, will you add an option to context menu, like Heiko proposes in comment 20?
Comment 32 Buovjaga 2019-10-27 14:29:20 UTC
(In reply to Dieter Praas from comment #31)
> Jim, will you add an option to context menu, like Heiko proposes in comment
> 20?

It was added, see comment 30
Comment 33 Dieter Praas 2019-10-27 16:13:04 UTC
(In reply to Buovjaga from comment #32)
> (In reply to Dieter Praas from comment #31)
> > Jim, will you add an option to context menu, like Heiko proposes in comment
> > 20?
> 
> It was added, see comment 30

You're right, sorry. I will test it with 6.4Beta1.
Comment 34 Dieter Praas 2019-11-19 16:00:12 UTC
> (In reply to Buovjaga from comment #32)
> > (In reply to Dieter Praas from comment #31)
> > > Jim, will you add an option to context menu, like Heiko proposes in comment
> > > 20?
> > 
> > It was added, see comment 30

Verified with

Version: 6.4.0.0.beta1 (x64)
Build ID: 4d7e5b0c40ed843384704eca3ce21981d4e98920
CPU threads: 4; OS: Windows 10.0 Build 18362; UI render: GL; VCL: win; 
Locale: de-DE (de_DE); UI-Language: en-US
Calc: threaded