Bug 50050 - Make LE (Link End) Index/Table Entry component character style match LS (Link Start) by default
Summary: Make LE (Link End) Index/Table Entry component character style match LS (Link...
Status: ASSIGNED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.4.5 release
Hardware: x86 (IA32) All
: medium enhancement
Assignee: Ekta
URL:
Whiteboard:
Keywords: difficultyInteresting, easyHack, skillCpp
Depends on:
Blocks: Writer-Styles-Character TableofContents-Indexes-Dialog
  Show dependency treegraph
 
Reported: 2012-05-17 06:49 UTC by ryan.jendoubi@gmail.com
Modified: 2024-04-20 13:48 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ryan.jendoubi@gmail.com 2012-05-17 06:49:27 UTC
As things stand, each time you click the "Hyperlink" button to add a link component to the Structure of an Entry in an Index/Table, the Character Style of that component defaults to "Internet Link".

Putting aside the fact that "Internet Link" is a silly default style in this context... the problem is that if you add an "LS" (Link Start) component to the Entry Structure, and change its Character Style to something sensible, the "LE" (Link End) component you then add will still default its Character Style to "Internet Link".

This in effect means that you have to change the Character Style *twice* per Entry Level, which is a bit silly. The logic should be "If LS exists, this.char_style = LE.char_style, else this.char_style = Internet Link". Or, you know, else "a plain style that makes sense for TOC links" :)

Could someone confirm this is still an issue in 3.5.x?
Comment 1 Florian Reisinger 2012-05-18 08:08:36 UTC
It is a easyhack now...
Comment 2 Björn Michaelsen 2013-10-04 18:47:32 UTC
adding LibreOffice developer list as CC to unresolved EasyHacks for better visibility.

see e.g. http://nabble.documentfoundation.org/minutes-of-ESC-call-td4076214.html for details
Comment 3 Robinson Tryon (qubit) 2013-10-29 03:17:57 UTC
whiteboard: standardize spelling 'easyhack' -> 'EasyHack'
Comment 4 Björn Michaelsen 2014-12-02 10:53:12 UTC
adding LibreOffice developer list as CC to unresolved Writer EasyHacks for better visibility.

see e.g. http://nabble.documentfoundation.org/minutes-of-ESC-call-td4076214.html for details
Comment 5 Robinson Tryon (qubit) 2015-12-10 11:50:46 UTC Comment hidden (obsolete)
Comment 6 Robinson Tryon (qubit) 2016-02-18 14:52:28 UTC Comment hidden (obsolete)
Comment 7 jani 2016-04-29 06:12:51 UTC
Code pointer is missing (mandatory for easy hacks)
Comment 8 Xisco Faulí 2016-09-27 10:36:13 UTC Comment hidden (obsolete)
Comment 9 Michael Stahl (allotropia) 2018-10-26 22:41:29 UTC
the dialog code is in sw/source/ui/index/cnttab.cxx

it works with instances of FormToken that have the sCharStyle member to represent the character style.

it appears to me that the character style set on the LE link-end token does not have a visible effect on the resulting entries; in ToxTextGenerator::GenerateText a formatting hint is inserted, but it is inserted with SetAttrMode::DONTEXPAND on an empty range, so it will not have a visible effect.

this is unique to the LE token, the other ones can at least sometime generate text to which the char style will be applied.

for the entire range between LS and LE, the sCharStyle of the LS token is applied, overwriting any style set on inner tokens.

so either the LE token's char style should be synced to the LS token in the UI so as to not confuse users, or the style widget should be disabled for the LE token.
Comment 10 Ekta 2023-04-18 18:30:23 UTC
I have looked into the file and I am trying to add a method m_xHyperLinkEndPB for TOKEN_END similar to m_xHyperLinkPB(For TOKEN_START) for setting the scharstyle of LE as to same as LS. But I am getting stuck at the point of how can I know the existence of LE. Either there might be a way to iterate over the tokens present so  I can iterate over them to check the LS presence and change LE charstyle to the same. I am somewhat trying to do this https://pastebin.com/fTbGjsrU 
Please help me out there.

Thank You.
Comment 11 Mohit Marathe 2024-04-20 07:08:49 UTC
I want to work on this easyhack. I'm trying to reproduce this issue, but I'm not sure how to create "Link Start" and "Link End" component. 

Can anyone provide steps to reproduce this bug? Or atleast how to create "Link Start" and "Link End" components?

Thanks.
Comment 12 sdc.blanco 2024-04-20 13:48:04 UTC
(In reply to Mohit Marathe from comment #11)
> Can anyone provide steps to reproduce this bug? Or atleast how to create
> "Link Start" and "Link End" components?
For 24.8.0.0

1. Insert > Table of Contents and Index > Table of Contents, Index, or Bibliography

2. (on Type tab) Type: anything except "Alphabetic Index" or "Bibliography"

3. Choose Entries tab.

4. Notice LE and LS in "Structure" line.  Select each one and press Del key (which will remove these entries).

5.  Place cursor at beginning of structure line, press "Hyperlink"

Result:  LS icon added to the structure list, and Character Style (shown under Structure line) is now "Index Link"

6.  Change this character style to anything else (e.g., Footnote Characters)

7.  Place the cursor in the Structure line again (after the LS icon), and click on "Hyperlink" again. 

Result:  LE icon added to Structure list, and notice Character Style is "Index Link".

iiuc, the OP would like the Character Style in this case to match the Character Style that was set for LS.  

Note also the end of comment 9.  iiuc, the Character Style for LE has no visible effect in the document, so the point in having the character style for LE to match LS is only a UI trick to reduce possible user confusion.