Bug 147779 - Ability to select or to delete unused styles
Summary: Ability to select or to delete unused styles
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:
: 156456 (view as bug list)
Depends on:
Blocks: Sidebar-Styles
  Show dependency treegraph
 
Reported: 2022-03-05 09:16 UTC by Eyal Rozenberg
Modified: 2023-07-24 22:08 UTC (History)
3 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 Eyal Rozenberg 2022-03-05 09:16:42 UTC
The styles sidebar has the ability to only show styles that are in use. However, you might actually want to _delete_ those styles which are defined in the document but are not (any longer) in use.

At the moment, this is exceedingly difficult, since when all styles are visible, you can't tell which are the unused, and when you only see the ones in use, you can't select any of the others. Plus, if there are many of them, interspersed with styles in use, selecting them is a hassle.

So, it would be useful if one could select all styles not in use from within the current kind of styles (whether Par, Char, List, etc.). An alternative which I like less would be at least to be able to delete all of them in one action.
Comment 1 Heiko Tietze 2022-03-07 12:19:15 UTC
If we add a filter for "Document styles not in use" it would be per style family. But why would you create a bunch of styles in first place when you never use it again? Maybe you temporarily don't use a style but switch between two.

Mike, what's you take on this idea?
Comment 2 Mike Kaganski 2022-03-07 12:24:59 UTC
Having a "unused styles" filter is a nice idea. "Why would yo do that" is a wrong question; you may arrive at a situation where you have lots of unused styles e.g. after a copy+paste and following re-styling; or you may have a legacy document. Cleaning up styles is almost as important as ability to create styles.

Of course, it's up to user to decide if they want to use a style later or not. Also it would be important to deal somehow with situations where a style is not applied to anything in the document body at the moment, but is used in a "next style" chain - I don't know how it's dealt with currently - is that style included in applied list?
Comment 3 Mike Kaganski 2022-03-07 12:37:57 UTC
(In reply to Mike Kaganski from comment #2)
> Also it would be important to deal somehow with situations where a
> style is not applied to anything in the document body at the moment, but is
> used in a "next style" chain - I don't know how it's dealt with currently -
> is that style included in applied list?

Obviously this case is not handled properly in current "Applied" filter - when I have a style in my "Next style" chain for a currently used style, the not-yet-used style isn't listed as applied (which is *possibly* OK). However, if we simply list it in the "Unused styles", it would be wrong: Not Applied is not the same as Unused. Listing it as unused would allow users to delete it, without realizing that it would modify the Next Style chain (by the way, removing it from All Styles filter is possible without any warnings, so this aspect maybe needs own handling, and then my concern will be moot, because attempting to remove such style would give a warning).
Comment 4 Heiko Tietze 2022-03-07 12:46:41 UTC
Hm, copy/paste sounds reasonable. Still wouldn't use the filter for this task. Trees can transport more information and having the number of items next to the item could be nice. Or some other feedback on the particular item- thinking of disabled appearance, which would be not correct.

Using "Custom Styles not in use" to have the recommended filter item next to the current "Custom Styles" option.
Comment 5 Eyal Rozenberg 2022-03-07 14:03:35 UTC
(In reply to Heiko Tietze from comment #1)
> why would you create a bunch of styles in first place when you
> never use it again?

Two possible scenarios:

1. Import of a .doc document generates lots of styles.
2. Updating a document which used to have a bunch of custom styles for some content, but now that content is going away so the custom styles are not needed anymore.

> Using "Custom Styles not in use" to have the recommended filter item next to the current "Custom Styles" option.

I like the idea of adding such an item to the filter menubutton.
Comment 6 Eyal Rozenberg 2022-03-07 14:12:00 UTC
(In reply to Mike Kaganski)
> Also it would be important to deal somehow with situations where a
> style is not applied to anything in the document body at the moment, but is
> used in a "next style" chain - I don't know how it's dealt with currently
>
> ...
>
> Listing it as unused would allow users to delete it, without realizing that 
> it would modify the Next Style chain (by the way, removing it from All Styles
> filter is possible without any warnings, so this aspect maybe needs own 
> handling)

This secondary issue merits a new bug page. Shall I open it or would you like to? 

Anyway, adding a "Currently styles not in use" or "Custom styles not applied" is an improvement over the current state of affairs, as handling of deletion of unapplied-but-used-as-Next styles should IMHO be handled independently of that.
Comment 7 Jean-Francois Nifenecker 2022-03-07 21:29:44 UTC
What about the StyleReporter extension: https://extensions.libreoffice.org/en/extensions/show/875
Comment 8 Stéphane Guillou (stragu) 2023-07-24 22:08:08 UTC
*** Bug 156456 has been marked as a duplicate of this bug. ***