Bug 87604 - Add option to retain direct formatting (and character style) in indices like Table of Contents
Summary: Add option to retain direct formatting (and character style) in indices like ...
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:
Whiteboard:
Keywords:
: 157414 (view as bug list)
Depends on:
Blocks: TableofContents-Indexes Writer-Styles-Character
  Show dependency treegraph
 
Reported: 2014-12-22 18:04 UTC by Walter
Modified: 2024-03-27 22:25 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
TOC eliminates formatting of headers (13.95 KB, application/vnd.oasis.opendocument.text)
2014-12-22 18:04 UTC, Walter
Details
MS Word (11.06 KB, image/png)
2017-08-09 11:44 UTC, Heiko Tietze
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Walter 2014-12-22 18:04:17 UTC
Created attachment 111185 [details]
TOC eliminates formatting of headers

When the TOC is generated it filtres out any formatting present in the Headings

To Reproduce:
1. Write «1st Heading»
2. Format as Heading 1
3. Insert → Index and Tables

Current Behaviour:
All the text is cleared of the formatting

Expected behaviour:
The TOC should also contain the formatting of the headings.
Comment 1 Robinson Tryon (qubit) 2014-12-24 03:07:26 UTC
Comment on attachment 111185 [details]
TOC eliminates formatting of headers

Fix mimetype
Comment 2 Robinson Tryon (qubit) 2014-12-24 03:35:38 UTC
TESTING with LO 4.4.0.1 + Ubuntu 14.04

(In reply to Walter from comment #0)
> To Reproduce:
> 1. Write «1st Heading»
> 2. Format as Heading 1
> 3. Insert → Index and Tables

Insert -> Index and Tables -> Index and Tables -> (click the OK button)

> Current Behaviour:
> All the text is cleared of the formatting

CONFIRMED: The text is cleared of the formatting, however this makes some sense.

> Expected behaviour:
> The TOC should also contain the formatting of the headings.

If different headers have different sizes, colors, etc., I'm not sure that such formatting should be included in the ToC. Why would we want to retain such formatting inside the ToC?

(after you reply, please change Status back to UNCONFIRMED. Thanks!)
Comment 3 Walter 2014-12-26 21:44:38 UTC
If the user applies direct formatting I think it reasonable to assume that he would want it to appear in the TOC. When I format a title I intend to give emphasis to some particular word and I do want it to appear in the TOC. Eg:
1. 1st, 2nd, ecc.
2. A TITLE WITH A FOREIGN WORD. I write foreign words in italics and I would like it to be in italics also in the TOC
3. I think it would apply also to color. There is a reason why the user choses to use color.

What I intend is to retain the DIRECT FORMATTING and not the formatting of the style used. I agree that the formatting of the Heading style should be stripped out.

Thanks
Comment 4 Robinson Tryon (qubit) 2014-12-26 23:56:34 UTC
(In reply to Walter from comment #3)
> If the user applies direct formatting I think it reasonable to assume that
> he would want it to appear in the TOC. When I format a title I intend to
> give emphasis to some particular word and I do want it to appear in the TOC.
> Eg:
> 1. 1st, 2nd, ecc.
> 2. A TITLE WITH A FOREIGN WORD. I write foreign words in italics and I would
> like it to be in italics also in the TOC

Hmm...italics could be a desirable piece of formatting to include.

> 3. I think it would apply also to color. There is a reason why the user
> choses to use color.

Possibly, although what if the text is formatted white on a black page, and the ToC has a white page bg?

> What I intend is to retain the DIRECT FORMATTING and not the formatting of
> the style used. I agree that the formatting of the Heading style should be
> stripped out.

What about size of text? I think that the text in the ToC should all be (roughly) the same size, height, etc, otherwise you'll have 36pt text next to 10pt text.

I'm going to toss this one over to the UX Team to see if they have some good suggestions for what kind of formatting should (and shouldn't) be scrubbed before being displayed in the ToC.

Status -> NEW
OS/Arch -> (Generalize)
Comment 5 Jean-Francois Nifenecker 2014-12-31 06:37:04 UTC
Perhaps the TOC creation could only take into account the characters when they are formatted using character styles? 
I do use italics (char style Italics) to denote foreign words or brand names and having this automatically set into the TOC would be appreciated.
Comment 6 Robinson Tryon (qubit) 2016-08-25 04:21:38 UTC Comment hidden (obsolete)
Comment 7 Heiko Tietze 2017-08-09 11:43:00 UTC
ToC's have own styles and do not allow direct formatting/character styles. Not sure if the format permits this at all. Regina?

(Summary changed from "FORMATTING: Table of Contents removes formatting of the Headings")
Comment 8 Heiko Tietze 2017-08-09 11:44:04 UTC
Created attachment 135339 [details]
MS Word

MS Word 2010 ignores alignment and font size but takes the italics or bold as well as background color and font name but neither font color, font size nor underlined. Makes no sense to me to pick some properties.
Comment 9 Regina Henschel 2017-08-09 16:07:15 UTC
A TOC-item is a simple <text:p> element, without any attribute or child element specific to an index. I find no reason in the specification, that would prevent copying the <tspan> elements from a heading to a TOC-item.
Comment 10 Cor Nouws 2017-08-15 19:38:16 UTC
(In reply to Heiko Tietze from comment #7)
> ToC's have own styles and do not allow direct formatting/character styles.

The TOC dialog allows to set the index read only - or not.
When it's not, direct formatting, or applying character styles, is easily done.
And some TOC designs ask for it. And that of course would be easiest if direct formatting/character styles in headings are retained.
Prolly not an easy hack, but .. ;)
Comment 11 Walter 2017-08-19 08:41:03 UTC
May I suggest this workaround: That the TOC maintains any character styles present in the paragraph styles used to generate the TOC.

This would enable the user to specify which particular character formatting he/she wants to be visible in the TOC and discrimination between desired and undesired formatting would be easier.
Comment 12 Heiko Tietze 2017-08-19 09:17:24 UTC
(In reply to Walter from comment #11)
> May I suggest this workaround: That the TOC maintains any character styles
> present in the paragraph styles used to generate the TOC.

That's not a workaround but the enhancement request :-)

Taking the character style/direct formatting from the headings we have to discuss the scope, meaning to accept all properties font name, size, color, background... or to restrict like Microsoft does. 

(The topic is on the agenda for the design meeting.)
Comment 13 Regina Henschel 2017-08-19 11:43:21 UTC
(In reply to Walter from comment #11)
> May I suggest this workaround: That the TOC maintains any character styles
> present in the paragraph styles used to generate the TOC.
> 
> This would enable the user to specify which particular character formatting
> he/she wants to be visible in the TOC and discrimination between desired and
> undesired formatting would be easier.

No, that is not the problem. You can already determine a character style in the paragraph style of a TOC line. The request here is, that <text:span> elements, which hold the direct formatting or formatting by character style for a portion of the text in the heading, are retained in the TOC, so that such portion of text can get a different styling then the rest of the line.
Comment 14 Miklos Vajna 2017-08-24 14:56:10 UTC
FWIW, there are a few bugreports related to this bug, not sure if they were already mentioned:

- bug 30732 already implements some support for formatting in ToC
- bug 99689 requests to have the same for figures/tables as well

The bug title sounds like not knowing about the first; so perhaps first define what is still wanted on top of the first bug?
Comment 15 Heiko Tietze 2017-08-31 14:40:22 UTC
We talked about this topic in the design meeting today. The decision was to not recommend this enhancement because a) ToC should remain plain, b) taking all or some properties may end up in a mess, c) the formatting in the ToC can't be removed or error-prone features need to added.

If someone wants to implement this feature it should be optional and at least not take font size.

(removing needsUX)
Comment 16 Stéphane Guillou (stragu) 2023-10-11 14:12:00 UTC
*** Bug 157414 has been marked as a duplicate of this bug. ***
Comment 17 David Werier 2023-10-12 01:23:27 UTC
Perhaps allow for a check box to select or unselect whether the formatting from the character style or direct formatting gets brought into the TOC or other items. This way one can choose whether they want this to happen or not.