Bug 128557 - List Styles can't be deleted in Custom Styles view
Summary: List Styles can't be deleted in Custom Styles view
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
5.2 all versions
Hardware: All All
: medium normal
Assignee: Jim Raykowski
URL:
Whiteboard: target:6.5.0 target:6.4.0.1
Keywords:
: 86061 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-11-02 18:20 UTC by Xisco Faulí
Modified: 2020-04-08 06:47 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
sample file (16.55 KB, application/vnd.oasis.opendocument.text)
2019-11-02 18:20 UTC, Xisco Faulí
Details
style list tooltips and delete menu item (1.24 MB, video/x-matroska)
2019-11-16 10:16 UTC, Jim Raykowski
Details
Tooltip with ellipsis (7.24 KB, image/png)
2019-11-20 07:42 UTC, Heiko Tietze
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Xisco Faulí 2019-11-02 18:20:46 UTC
Created attachment 155471 [details]
sample file

Steps to reproduce:
1. Open attached document
2. Go to the sidebar - Styles - List Styles
3. Change view ( bottom of the sidebar ) to Custom Styles
4. Right click on any of the styles - Delete

-> The style is not deleted. It doesn't happen with a paragraph or character style.

Reproduced in

Version: 6.4.0.0.alpha1+
Build ID: 2d0a4182712673d8f7a5abe919cd2a1d5ece4a77
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); UI-Language: en-US
Calc: threaded

and

Version: 5.2.0.0.alpha1+
Build ID: 5b168b3fa568e48e795234dc5fa454bf24c9805e
CPU Threads: 4; OS Version: Linux 4.15; UI Render: default; 
Locale: ca-ES (ca_ES.UTF-8)
Comment 1 Xisco Faulí 2019-11-02 18:21:10 UTC
@Jim, I thought you might be interested in this issue...
Comment 2 Julien Nabet 2019-11-02 18:43:25 UTC
On pc Debian x86-64 with master sources updated today, I could reproduce this.
Comment 3 Xavier Van Wijmeersch 2019-11-02 18:45:50 UTC
confirm with

Version: 6.4.0.0.alpha1+
Build ID: 80109586e6cb6d3e2e0a53a9079c3125ec9b8368
CPU threads: 8; OS: Linux 4.19; UI render: default; VCL: gtk3; 
Locale: nl-BE (en_US.UTF-8); UI-Language: en-US
Calc: threaded
Comment 4 Jim Raykowski 2019-11-04 08:10:19 UTC
Hi Xisco,

A quick glance at the code used to delete these types of styles shows:  

// We can only delete if the Rule is unused!
bool SwDoc::DelNumRule( const OUString& rName, bool bBroadcast )

I checked to see if the style can be deleted if it is not in use and indeed it can. 

Perhaps the message box that is displayed saying the style is in use and text will revert to parent style needs to be different for custom styles like this?
Comment 5 Xisco Faulí 2019-11-04 09:24:27 UTC
(In reply to Jim Raykowski from comment #4)
> Hi Xisco,
> 
> A quick glance at the code used to delete these types of styles shows:  
> 
> // We can only delete if the Rule is unused!
> bool SwDoc::DelNumRule( const OUString& rName, bool bBroadcast )
> 
> I checked to see if the style can be deleted if it is not in use and indeed
> it can. 
> 
> Perhaps the message box that is displayed saying the style is in use and
> text will revert to parent style needs to be different for custom styles
> like this?

Yes, it can't be deleted when it's in used, but the same warning message is prompted with Paragraph and Character styles and they can be deleted if the user chooses 'Yes', so the behaviour isn't consistent among the different styles...
Comment 6 Jim Raykowski 2019-11-05 05:57:11 UTC
A bit more glancing leads me to believe list styles can't inherit from other list styles so they can't revert to the parent style if deleted. 

I vote to display a message box that explains the list style can't be deleted if  in use.
Comment 7 Xisco Faulí 2019-11-11 15:11:21 UTC
(In reply to Jim Raykowski from comment #6)
> A bit more glancing leads me to believe list styles can't inherit from other
> list styles so they can't revert to the parent style if deleted. 
> 
> I vote to display a message box that explains the list style can't be
> deleted if  in use.

+1.
Adding UX team
Comment 8 Heiko Tietze 2019-11-12 08:14:54 UTC
Function that just pretend to do something are bad usability. If you click Delete you don't want to see "I cannot do that now". We could make the confirmation box actionable and show options. Something like "This style is in use. Please select a substitute: [list of styles] [Cancel] [Okay] (disabled as long the selection is on the same item). Way too much fuss and very error-prone, IMHO.

Of course, feedback is needed but I would rather think about disabling commands that are temporarily not available (we hide way too much in general) and show the reason in a tooltip.

Quick and dirty solution is of course to remove yes/no and have just cancel in the dialog when it's triggered by list styles.
Comment 9 Jim Raykowski 2019-11-14 21:06:16 UTC
It wasn't easy for me to delete the Estilo 2 style. I deleted all text and header and footer from the document and still could not get Estilo 2 to delete. Estilo 2 is used by Chapter Styles; Subtitle and Title numbering style, set in Outline & Numbering tab. I was able to delete it after it was removed from these styles.

Is there currently a way to find this dependency? If not I have a patch ready that lists these dependencies in the delete message box. So for Estilo 2 the delete message box shows.

  One or more of the selected styles is in use in this document.
  If you delete these styles, text will revert to the parent style.
  Do you still wish to delete these styles?
  Styles in use: Estilo 2
  Used by: Title, Subtitle

Since Estilo 2 doesn't have a parent style, delete reverts to the parent style which is itself but at least the user can see what paragraphs styles use it so it can be removed from them to enable it to be deleted.
Comment 10 Jim Raykowski 2019-11-16 10:16:54 UTC
Created attachment 155870 [details]
style list tooltips and delete menu item

Instead of including style used by information in the delete dialog, as done in my previous post, this information can be conveyed in a tooltip as suggested by Heiko. 

The attached video demonstrates a tool tip showing the style name and if the style is used as a numbering style for other styles these styles follow the name. Estilo 2 is used in Title and SubTitle numbering style. This may provide hint enough to explain why delete doesn't show in the context menu for the style even when all text in the document is removed. For Estilo 1 delete appears in the context menu when all document text is removed.
Comment 11 Jim Raykowski 2019-11-17 08:52:29 UTC
Here is a link to a patch that implements my previous comment

https://gerrit.libreoffice.org/#/c/83008/

Comments, suggestions, code review welcomed
Comment 12 Heiko Tietze 2019-11-18 09:12:46 UTC
(In reply to Jim Raykowski from comment #9)
> Is there currently a way to find this dependency? 

There is a enhancement proposal https://design.blog.documentfoundation.org/2019/11/05/proposal-to-conveniently-highlight-and-inspect-styles-in-libreoffice-writer/

(In reply to Jim Raykowski from comment #10)
> Instead of including style used by information in the delete dialog, as done
> in my previous post, this information can be conveyed in a tooltip

Cool stuff! Design-wise it might look better with brackets, eg. "Estilo (used in: Titel, Subtitle)". Have you considered many references? I would cut the text with ellipsis after a certain number of characters though keeping the closing bracket.

Would also prefer to show the tooltip with the (disabled) Delete command.
Comment 13 Jim Raykowski 2019-11-20 00:42:36 UTC
(In reply to Heiko Tietze from comment #12)
> (In reply to Jim Raykowski from comment #9)
> > Is there currently a way to find this dependency? 
> 
> There is a enhancement proposal
> https://design.blog.documentfoundation.org/2019/11/05/proposal-to-
> conveniently-highlight-and-inspect-styles-in-libreoffice-writer/
> 

I have seen bits of this in enhancement requests on bugzilla or the mailing list.

> (In reply to Jim Raykowski from comment #10)
> > Instead of including style used by information in the delete dialog, as done
> > in my previous post, this information can be conveyed in a tooltip
> 
> Cool stuff! Design-wise it might look better with brackets, eg. "Estilo
> (used in: Titel, Subtitle)". Have you considered many references? I would
> cut the text with ellipsis after a certain number of characters though
> keeping the closing bracket.
> 

I have added the brackets and included ellipsis after 80 characters. What is a good maximum before ellipsis are shown?

https://gerrit.libreoffice.org/#/c/83152/

I noticed something is not right with where the tooltip is being displayed after a long tooltip message is displayed. Working on correcting that.

> Would also prefer to show the tooltip with the (disabled) Delete command.

MenuFlags::AlwaysShowDisabledEntries is used to do this but it doesn't work for gtk3. It works for SAL_USE_VCL=gen. I suspect it works for kf5 backend.

It can be tested using this patch:

https://gerrit.libreoffice.org/#/c/83252/
Comment 14 Heiko Tietze 2019-11-20 07:42:57 UTC
Created attachment 155965 [details]
Tooltip with ellipsis

Added some new PS (with long names= and assigned the list style - it wraps for me (running KDE, LibO is VCL=gtk3) and I'm not sure if that happens on all OS/DE. Neither I know if tooltips get cut by the OS. Let's see if users complain and make it shorter later.

The tooltip is formatted nicely but I still get the Delete option and cannot delete the LS by clicking on the Yes button. Second patch not applied yet.
Comment 15 Jim Raykowski 2019-11-20 08:02:12 UTC
(In reply to Jim Raykowski from comment #13)

> I noticed something is not right with where the tooltip is being displayed
> after a long tooltip message is displayed. Working on correcting that.

I think this is a bug in gtk3 handling of tooltips which is out of my scope.
Comment 16 Jim Raykowski 2019-11-20 08:14:54 UTC
(In reply to Heiko Tietze from comment #14)
> ...but I still get the Delete option and cannot
> delete the LS by clicking on the Yes button. Second patch not applied yet.

The initial patch was split into two patches. 

Enabling the delete item only when it is not in use or if it has a parent which it can revert to.
https://gerrit.libreoffice.org/#/c/83008/

Tooltips for styles lists
https://gerrit.libreoffice.org/#/c/83152/

The third patch for this bug fix/enhancement request shows disabled menu items
https://gerrit.libreoffice.org/#/c/83252/
Comment 17 Heiko Tietze 2019-11-20 08:27:25 UTC
(In reply to Jim Raykowski from comment #16)
> https://gerrit.libreoffice.org/#/c/83008/

And it works like a charm...

> The third patch for this bug fix/enhancement request shows disabled menu
> items
> https://gerrit.libreoffice.org/#/c/83252/

I'm building for gtk3 and gen doesn't start for some reason. So cannot test.
Comment 18 Commit Notification 2019-11-20 21:50:38 UTC
Jim Raykowski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/1906f3f2f7c39ea9a3e04f1081dbfc24a1de3212

tdf#128557 Show disabled menu items in style lists context menu

It will be available in 6.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 19 Commit Notification 2019-11-20 21:52:23 UTC
Jim Raykowski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/b8bbe9a3ca4758102ce6aa5d1e0fbb077eedbe64

tdf#128557 Add tooltips to styles lists

It will be available in 6.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 20 Commit Notification 2019-11-21 02:48:50 UTC
Jim Raykowski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/30c9bc76d0718f0c01d34f81845d88413645b42c

tdf#128557 Only show delete menu item when custom style is not in use

It will be available in 6.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 21 Xisco Faulí 2019-11-21 09:59:07 UTC
I can see the tooltips in

Version: 6.5.0.0.alpha0+
Build ID: 60b1a93a990a9978a30dee929526faf8db629a7f
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); UI-Language: en-US
Calc: threaded

and delete option is disabled if the style is in used.
@Jim, thank you very much for fixing this issue!!
Comment 22 Commit Notification 2019-11-26 13:10:18 UTC
Jim Raykowski committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

https://git.libreoffice.org/core/commit/9cbc55167301cefe9889ad8e604439e0118b627f

tdf#128557 Only show delete menu item when custom style is not in use

It will be available in 6.4.0.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 23 Commit Notification 2019-11-26 13:10:31 UTC
Jim Raykowski committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

https://git.libreoffice.org/core/commit/4613b32fc121f5f4e0e440837f94903ad361e89a

tdf#128557 Add tooltips to styles lists

It will be available in 6.4.0.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 24 Commit Notification 2019-11-26 13:12:02 UTC
Jim Raykowski committed a patch related to this issue.
It has been pushed to "libreoffice-6-4":

https://git.libreoffice.org/core/commit/fd212d59d7cf9fb8c46bb73f4c21148b61c5c53e

tdf#128557 Show disabled menu items in style lists context menu

It will be available in 6.4.0.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 25 Justin L 2020-04-08 06:47:48 UTC
*** Bug 86061 has been marked as a duplicate of this bug. ***