Bug 164370 - [Writer] Character styles hierarchy lost when deleting intermediate hierarchy level.
Summary: [Writer] Character styles hierarchy lost when deleting intermediate hierarchy...
Status: UNCONFIRMED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
24.2.6.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Writer-Styles-Character
  Show dependency treegraph
 
Reported: 2024-12-18 18:08 UTC by jeanmarczambon
Modified: 2024-12-26 21:30 UTC (History)
2 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 jeanmarczambon 2024-12-18 18:08:48 UTC
Description:
1. Given the following character styles hierarchy:

style1
 |__ style2
      |__ style3

2. When deleting style2, you'll get:

style1
style3

3. You should get instead:

style1
 |__ style3


Right behaviour (3) exists until LibreOffice 24.2.5.2.
Bad behaviour (2) appears with LibreOffice 24.2.6.1.

Steps to Reproduce:
Create the following character styles, respecting the hierarchy:

style1
 |__ style2
      |__ style3

2. Delete character style "style2".

Actual Results:
Hierarchy is lost:

style1
style3

Expected Results:
Hierarchy should be kept:

style1
 |__ style3


Reproducible: Always


User Profile Reset: No

Additional Info:
Observed from LibreOffice 24.2.6.1.
Comment 1 jeanmarczambon 2024-12-18 18:33:43 UTC
Maybe this can help.
Trying to retrieve by code the ParentStyle property of the character style "style3" after deleting "style2", we get these error messages:

[basic macro]
An exception occurred 
Type: com.sun.star.container.ElementExistException
Message: at /home/buildslave/source/libo-core/sw/source/core/unocore/unostyle.cxx:1082.

[python script]
'ooo_script_framework.com.sun.star.beans.UnknownPropertyException'>: cannot get value ParentStyle at /home/buildslave/source/libo-core/stoc/source/invocation/invocation.cxx:498
Comment 2 B. Antonio Fernández 2024-12-26 21:30:54 UTC
I think something is wrong with the inheritance of character styles.

According to previous versions, if a child style was in use, the parent style also appeared as the style in use, even if it was not used.

- This prevented deleting a parent style with dependent styles in use.

Now if the parent style is not in use but it does have child styles in use, the parent style appears as not used