Bug 103331 - Child styles not inheriting from parent
Summary: Child styles not inheriting from parent
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.3.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Kohei Yoshida
URL:
Whiteboard: target:7.4.0 target:7.3.0.0.beta2
Keywords:
Depends on:
Blocks: Calc-Styles orcus_bugs 90937
  Show dependency treegraph
 
Reported: 2016-10-19 13:12 UTC by Yousuf Philips (jay) (retired)
Modified: 2021-12-23 11:42 UTC (History)
5 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 Yousuf Philips (jay) (retired) 2016-10-19 13:12:09 UTC
Steps:
1) Open Calc with a git build
2) Open the sidebar's styles and formatting
3) Type some text and apply 'Accent 1' style to the cell
4) Notice that the text is not in bold

Here is the xml from https://cgit.freedesktop.org/libreoffice/core/tree/sc/res/xml/styles.xml

<style:style style:name="Accent" style:family="table-cell" style:parent-style-name="Default"> <style:text-properties fo:font-weight="bold"/> </style:style>

<style:style style:name="Accent1" style:family="table-cell" style:parent-style-name="Accent"> <style:table-cell-properties fo:background-color="#000000"/> <style:text-properties fo:color="#ffffff"/> </style:style>

Version: 5.3.0.0.alpha0+
Build ID: 55d028488580c5835682188cb8d23e5fe4dcb424
CPU Threads: 4; OS Version: Linux 4.4; UI Render: default; 
Locale: en-US (en_US.UTF-8); Calc: group
Comment 1 Buovjaga 2016-11-02 12:25:27 UTC
Not seeing the style in the list. I have experimental features enabled. How do I get them to display?

Win 7 Pro 64-bit Version: 5.3.0.0.alpha1+
Build ID: 4b4abb73fcd7f2802e73102b3e7c30face8d309c
CPU Threads: 4; OS Version: Windows 6.1; UI Render: default; Layout Engine: old; 
TinderBox: Win-x86@39, Branch:master, Time: 2016-10-31_02:54:50
Locale: fi-FI (fi_FI); Calc: group
Comment 2 Xisco Faulí 2016-11-02 13:02:50 UTC
Confirmed in

Version: 5.3.0.0.alpha1+
Build ID: 1b0aa768f2c5da65074a6eacfed5f61a121fb13d
CPU Threads: 4; OS Version: Linux 4.2; UI Render: default; VCL: gtk2; Layout Engine: old; 
Locale: ca-ES (ca_ES.UTF-8); Calc: group
Comment 3 Buovjaga 2017-10-22 15:46:05 UTC
Still repro.

Arch Linux 64-bit, KDE Plasma 5
Version: 6.0.0.0.alpha1+
Build ID: 2460e7637f635727f4596f3e3d799eed434df082
CPU threads: 8; OS: Linux 4.13; UI render: default; VCL: kde4; 
Locale: fi-FI (fi_FI.UTF-8); Calc: group
Built on October 22nd 2017
Comment 4 QA Administrators 2018-10-24 02:55:48 UTC Comment hidden (obsolete)
Comment 5 Roman Kuznetsov 2018-10-24 10:43:14 UTC
still repro in 

Version: 6.2.0.0.alpha0+
Build ID: cec31fdedd7c94f4ebf903a66456a75867db22b0
CPU threads: 4; OS: Windows 6.1; UI render: default; VCL: win; 
TinderBox: Win-x86@42, Branch:master, Time: 2018-10-21_22:54:44
Locale: ru-RU (ru_RU); Calc: threaded
Comment 6 QA Administrators 2019-10-25 02:39:49 UTC Comment hidden (obsolete)
Comment 7 Buovjaga 2020-11-11 19:04:20 UTC
Still repro

Arch Linux 64-bit
Version: 7.1.0.0.alpha1+
Build ID: 3d3180115be3b87e76189aea2031f0caa735dbb3
CPU threads: 8; OS: Linux 5.9; UI render: default; VCL: kf5
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded
Built on 11 November 2020
Comment 8 Kevin Suo 2021-11-01 16:29:49 UTC
See sc/source/filter/orcus/interface.cxx:1320:

ScOrcusStyles::font::font():
    mnSize(10),
    maColor(COL_BLACK),
    mbBold(false),
    mbItalic(false),
    mbHasFontAttr(false),
    mbHasUnderlineAttr(false),
    mbHasStrikeout(false),
    meUnderline(LINESTYLE_NONE),
    maUnderlineColor(COL_WHITE),
    meStrikeout(STRIKEOUT_NONE)
{
}

and

void ScOrcusStyles::set_font_bold(bool b)
{
    maCurrentFont.mbBold = b;
    maCurrentFont.mbHasFontAttr = true;
}

void ScOrcusStyles::set_font_italic(bool b)
{
    maCurrentFont.mbItalic = b;
    maCurrentFont.mbHasFontAttr = true;
}

The mbBold and mbItalic is set default to false (rather than unset). As a result, if a result, if a child style inherit from a parent and the child did not set a font weight bold attribute, then the font weight for the child is explicitly set to not-bold rather than inherited.

Not sure whether it is a bug in orcus or in libreoffice. One temporary solution is to set explicitly bold and italic attributes in the sc/res/xml/styles.xml for the child styles.
Comment 9 Kevin Suo 2021-11-02 09:36:13 UTC
Bug reported to upstream Orcus:
https://gitlab.com/orcus/orcus/-/issues/145
Comment 10 Commit Notification 2021-12-17 14:02:12 UTC
Kohei Yoshida committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/6b2da3ae3ea7f47dff3c807c151f88a9e1ae9964

tdf#103331: Make styles attributes optional.

It will be available in 7.4.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 11 Commit Notification 2021-12-18 17:09:21 UTC
Kohei Yoshida committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/9547114247c09a90f283e42c4db947ae57e9529c

tdf#103331: Add a test case for inherited font weight attributes.

It will be available in 7.4.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 12 Kohei Yoshida 2021-12-18 17:09:50 UTC
Fixed and a test case added.  I'm done.
Comment 13 Commit Notification 2021-12-20 15:12:27 UTC
Kohei Yoshida committed a patch related to this issue.
It has been pushed to "libreoffice-7-3":

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

tdf#103331: Make styles attributes optional.

It will be available in 7.3.0.0.beta2.

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 14 BogdanB 2021-12-23 11:42:18 UTC
it's ok now.
Thanks

Version: 7.3.0.1.0+ (x64) / LibreOffice Community
Build ID: 821e5733ce2149544fb6ff0b3d39923340f93fa7
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: ro-RO (ro_RO); UI: en-US
Calc: threaded