Bug 158838

Summary: UNO action to toggle applied styles like <emphasis> and <strong>
Product: LibreOffice Reporter: j.a.swami
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: NEW ---    
Severity: enhancement CC: heiko.tietze, momonasmon, rgb.mldc, vsfoote
Priority: medium Keywords: needsDevAdvice
Version: 7.6.4.1 release   
Hardware: All   
OS: All   
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 86899    

Description j.a.swami 2023-12-23 13:55:17 UTC
Since LO Writer is meant to be a style-based word processor, we should be able to use <emphasis> and <strong> as easily as italic and bold. 

But italic and bold are easier to use because the keys to invoke them toggle whereas keys assigned for styles do not. 

Suppose, for example, I assign Ctrl-I to "<emphasis>." If while typing I type Ctrl-I, the following text will be emphasized, as expected. But, contrary to expectations, typing Ctrl-I will not return me to non-emphasized text.

The same with selected text: Ctrl-I will emphasize it, but a second Ctrl-I will not remove the emphasis. 

I suggest that the keys assigned to these styles should toggle, so that (using the same example) Ctrl-I works with <emphasis> the same way it works with italic.
Comment 1 V Stuart Foote 2023-12-23 14:45:11 UTC
Applied char styles don't really toggle, rather we have .uno:DefaultCharStyle "No Character Style" to remove an applied Style from an active selection.

You can see this in use on the alternate View -> Toolbars 'Formatting (Styles)' toolbar, the "A" icon with tooltip "Remove applied character style". Likewise on the Styles menu.

It can also be assigned by Tools -> Customize... dialog  as a Keyboard or Context menu shortcut. Just note that it is held with other 'Style' -> 'Character' category functions.

Guess there could be benefit to implementing a style toggle (apply|remove) for the current TB buttons for users of the 'Formatting (Styles)' and if that provided a hook for keyboard, menu customization even better.

Throwing it in the UX-advise pool.
Comment 2 j.a.swami 2023-12-23 15:25:32 UTC
The approach of using "remove applied character style," if not ideal, seems like at least something. But "remove applied character style" has no effect on <emphasis> and <strong>. (When I made a word emphatic or strong and then clicked the "A" icon, nothing happened.)

And as I said, even if this approach would work it would be less than ideal. For italic I can toggle with Ctrl-I and Ctrl+!. For <emphasis> I'd need something like, say, Ctrl-I, Ctrl-R. Uninuitive.

Let's see what the UX people say.
Comment 3 Heiko Tietze 2024-01-03 10:57:47 UTC
Turning the .uno:StyleApply?<styles> command into toggle functions sounds reasonable. Any blocker, Maxim?