Download it now!
Bug 130318 - Use the actual cursor position to create ToC "for chapter" beginning at the current level
Summary: Use the actual cursor position to create ToC "for chapter" beginning at the c...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL: https://help.libreoffice.org/6.4/en-U...
Whiteboard:
Keywords:
Depends on: 112301
Blocks: TableofContents-Indexes
  Show dependency treegraph
 
Reported: 2020-01-31 11:41 UTC by Emanuele Gissi
Modified: 2020-04-24 08:38 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Example case and proposal (87.80 KB, application/vnd.oasis.opendocument.text)
2020-01-31 11:46 UTC, Emanuele Gissi
Details
Example case and proposal (updated) (88.54 KB, application/vnd.oasis.opendocument.text)
2020-02-03 10:32 UTC, Emanuele Gissi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Emanuele Gissi 2020-01-31 11:41:39 UTC
Description:
Currently the Edit Index > Type > Create ToC for... menu is limited to "Entire document" or "Chapter". So it is not possible to create a ToC starting from any other level (eg. sub chapter, ...).

I suggest allowing table of contents starting from any level (1 to 10). The Edit Index > Type > Create ToC for... menu should be extended to "Level 1 (Entire document), Level 2 (Chapter), Level 3, Level 4, Level 5, ..."

I attach an example file where the problem is explained and showed. IMHO, this should not be to hard to add, as the code is already there for the first two levels.

Steps to Reproduce:
Currently the Edit Index > Type > Create ToC for... menu is limited to "Entire document" or "Chapter".

Actual Results:
It is not possible to create a table of contents for levels lower than 2 (chapter, Heading 2).

Expected Results:
I suggest allowing table of contents starting from any level (1 to 10). The Edit Index > Type > Create ToC for... menu should be extended to "Level 1 (Entire document), Level 2 (Chapter), Level 3, Level 4, Level 5, ..."


Reproducible: Always


User Profile Reset: No



Additional Info:
Comment 1 Emanuele Gissi 2020-01-31 11:46:12 UTC
Created attachment 157557 [details]
Example case and proposal
Comment 2 sdc.blanco 2020-01-31 14:36:28 UTC
Do you know about Create from "Additional Styles"?

On your Table of Contents:

1.  right-click, Edit Index, Type tab
2.  Click on Additional Styles  and Assign Styles

You can decide yourself which paragraph styles should be included in the table of contents.

Maybe that does what you want?
Comment 3 Emanuele Gissi 2020-01-31 17:18:05 UTC
No, this is not what I want.
Please, have a look at the attached example.
Comment 4 Dieter 2020-02-02 07:24:47 UTC
Looking at your document, it becomes clear to me: Your aim is to create a kind of TOC extract for the current level, but with the context (here: chapter). I agree, that this is not possible with "create from additional styles"

Would be a good enhancement I think for authors of scientific literature.

cc: Design-Team for further input.
Comment 5 Emanuele Gissi 2020-02-03 10:18:15 UTC
Yes, create a kind of TOC extract for the current level.

I left the upper levels in the subchapter ToC example, but I do *not* need them. In fact it would be very easy to remove them through "create from additional styles".
Comment 6 Emanuele Gissi 2020-02-03 10:32:52 UTC
Created attachment 157613 [details]
Example case and proposal (updated)
Comment 7 Emanuele Gissi 2020-02-03 10:39:13 UTC
Following your comments, I updated the attached proposal file.
Comment 8 Heiko Tietze 2020-02-05 11:27:41 UTC
I still don't get the use case. The option "For (Chapter)" allows to have a ToC restricted to the current chapter. For example

1. Heading A
 ToC
  1. 
   1.1
   1.2
   1.3
1.1 Heading Aa
1.2 Heading Ab
1.3 Heading Ab
2. Heading B
2.1. Heading Ba

and what I understand is that you want something like

1. Heading A
1.1 Heading Aa
 ToC
  1.1 
   1.1.1
   1.1.2
   1.1.3
1.1.1 HAa1
1.1.2 HAa2
1.1.3 HAa3
1.2 Heading Ab
1.3 Heading Ab
2. Heading B
2.1. Heading Ba

I would agree if this layout is needed in general or, even better, defined as a requirement for a layout. In other words: What scientific literature uses this style?
Comment 9 Dieter 2020-02-05 11:39:27 UTC
I understood the request as follows:

There is a "normal" TOC at the beginning or end of the book and an extract at the begionning of every subchapter, like

1. Heading A
1.1 Heading Aa
 ToC
  1.1 
   1.1.1
   1.1.2
   1.1.3

I remember that I saw this in scientific literature (not often), but I don't want to search within all my literature. But I hope, Emanuele can give an example.
Comment 10 Emanuele Gissi 2020-02-05 14:29:15 UTC
Here is the use case.

The Italian Ministry of Interior is using Libreoffice since 2015 to write the Fire Safety Code. See it the current revision at: bit.ly/codicepi2019

This is a 300 pages fire safety regulatory text, that has:
- sections (Heading level 1),
- each section is composed of chapters (Heading level 2),
- each chapter is made of paragraphs (Heading level 3),
- and each paragraph is made of sub-paragraphs (Heading level 4).

Like this:

Section G
  Chapter G.1
    G.1.1 Definitions
    G.1.2 Language
    ...
  Chapter G.2
    G.2.1 Structure
    G.2.2 Procedure
    ...

Section S
  Chapter S.1
    S.1.1 Preface
    S.1.2 Performance levels
    ...
  Chapter S.2
    S.1.1 Preface
    S.1.2 Performance levels
    ...

Section V
  ...

What we need is a general ToC at the beginning of the full book:
(obtained automatically with Edit Index > Type > Create ToC for Entire document)

*General ToC*
  Section G
    Chapter G.1
    Chapter G.2
    ...
  Section S
    Chapter S.1
    ...
  Section V
    ...

we also need Section ToCs at the beginning of each section:
(obtained automatically with Edit Index > Type > Create ToC for Chapter, that is for level 1)

*Section G ToC*
  Chapter G.1
  Chapter G.2
  ...

*Section S ToC*
  Chapter S.1
  Chapter S.2
  ...

and we also need Chapter ToCs at the beginning of each chapter:

*Chapter G.1 ToC*
  Paragraph G.1.1
  Paragraph G.1.2
  ...

*Chapter G.2 ToC*
  Paragraph G.2.1
  Paragraph G.2.2
  ...

In the example document (bit.ly/codicepi2019), this third type of ToC is currently handmade, because the Edit Index > Type > Create ToC for... menu is limited to "Entire document" or "Chapter".

This is why it is not possible to create a ToC starting from any other lower level.

This request of enhancement is similar to what is described in:
https://bugs.documentfoundation.org/show_bug.cgi?id=112301

I remain at disposal for further info/test.
Comment 11 Heiko Tietze 2020-02-05 14:50:15 UTC
Many thanks for sharing your use case. One last question: More options lead to more complexity and we should try to work with the existing functions. 

Would it solve your problem when the "For (Chapter)" option not start at level 1 but where the cursor is placed? Meaning you put the cursor after 2.1 and it adds 2, at 3.1.1 it takes 3.1. By doing this we don't need to change the UI or much on the help. 

The alternative is "For (level) (2)" bringing more (hopefully unnecessary) flexibility on cost of the parameter. Do you need to insert, for example, 2.2.2 after 2.1?
Comment 12 Emanuele Gissi 2020-02-05 15:02:24 UTC
Thank you for your immediate answer.

IMHO, taking the ToC level from the position of the cursor is fine, and should not break any existing document. It is indeed a great idea!
Comment 13 Heiko Tietze 2020-02-05 15:13:23 UTC
(In reply to Emanuele Gissi from comment #12)
> IMHO, taking the ToC level from the position of the cursor is fine, and
> should not break any existing document. It is indeed a great idea!

Sic fiat! Removing UX...
Comment 14 Emanuele Gissi 2020-04-24 08:38:32 UTC
Any news?