Bug Hunting Session
Bug 82802 - conditional style with no conditions is displayed as un-conditional style after reloading document
Summary: conditional style with no conditions is displayed as un-conditional style aft...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.3.0.4 release
Hardware: x86-64 (AMD64) Linux (All)
: low minor
Assignee: Not Assigned
URL:
Whiteboard: BSA
Keywords:
Depends on:
Blocks: Writer-Styles-Paragraph
  Show dependency treegraph
 
Reported: 2014-08-19 08:02 UTC by Marcell Nemes
Modified: 2018-10-23 20:58 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
screenshot of conditional style setting (87.46 KB, image/png)
2014-08-19 13:10 UTC, sophie
Details
Conditional formatting made by AOO 4.1.2 (9.26 KB, application/vnd.oasis.opendocument.text)
2017-05-05 22:58 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marcell Nemes 2014-08-19 08:02:42 UTC
Problem description:

I have created a custom conditional style, to test its behaviour. After saving the document and reopening it, the style lost its conditional attribute, and it became a regular style.

Steps to reproduce:

1. create a new style
2. under the 'Condition' tab check 'Conditional Style'
3. write a paragraph and use the custom style
4. save the document
5. reopen it

Current behavior:

The conditional style reverts to normal style.

Expected behavior:

The style should keep its conditional attribute.

Operating System: other
Version: 4.3.0.4 release
Comment 1 Marcell Nemes 2014-08-19 08:12:44 UTC
Update:

The error occurs when at the time of saving the document, there are no styles applied to the custom style. 'Conditional Style' is still checked though.
Comment 2 sophie 2014-08-19 13:10:01 UTC
Created attachment 104887 [details]
screenshot of conditional style setting

Hi, I do not reproduce, even after saving and the style not applied in the document, the conditional style is still set, see the screenshot attached. 
I'm using 4.3.0.4 Ubuntu 14.04 x64. Sophie
Comment 3 Marcell Nemes 2014-08-19 13:19:38 UTC
(In reply to comment #2)
> Created attachment 104887 [details]
> screenshot of conditional style setting
> 
> Hi, I do not reproduce, even after saving and the style not applied in the
> document, the conditional style is still set, see the screenshot attached. 
> I'm using 4.3.0.4 Ubuntu 14.04 x64. Sophie

As I see, you're modifying the predefined style called 'Text Body' in english. I haven't encountered any problems with that. I created a new style, and set it as conditional.
Also, I meant the error was when there were no styles applied to any context inside the settings of the style, not wether it was used in the document.
Comment 4 sophie 2014-08-20 13:56:12 UTC
Hi Marcell, in my tests yesterday it works even with a custom style, but I applied the condition inside the dialog box. 
Now I understand what you said, in fact, if you do not apply a condition during the creation of the style, it's not possible to modify it after saving the document because the conditional possibility is lost. 
On one hand I find it normal that if you don't apply a condition, the conditional style doesn't exist, on the other hand, the possibility to modify it once created should be offered.
Set it as New - Sophie
Comment 5 Marcell Nemes 2014-08-20 17:12:06 UTC
Hi Sophie!
Yes, it's a bit confusing, that you can only modify it if it was saved with at least one style applied to the conditional style. Even if you create it with some styles applied, and removing them later causes the unability to modify. I can imagine some scenarios when this occurs, like you make up your mind with some formatting, and have it closed when there are no styles applied at the moment.
Styles should be able to be designed as conditional styles even after creating them. As I see this wouldn't cause any problem, because the conditional ones are still modifiable later, so why couldn't the normal ones be. More so, if you have the conditional style checked, it should mean that it's meant to be a conditional style, even if it has no styles applied to it.
/This time I tried it with LO version 4.2.4.2 under Ubuntu 14.04 LTS./
Marcell
Comment 6 QA Administrators 2015-09-04 02:47:54 UTC Comment hidden (obsolete)
Comment 7 QA Administrators 2016-09-20 10:28:56 UTC Comment hidden (obsolete)
Comment 8 Regina Henschel 2017-05-05 22:50:46 UTC
I see the problem even the condition is set immediately and works while first working on the document. After save and reload the condition is gone.

To reproduce:
Define a style "Red" from Default, that has a red font color.
Define a style "Blue" from Default, that has a blue font color.
Start defining a style "ConditionCaller" from Default. Go to tab Condition and mark "Conditional Style". Apply the style "Red" to the condition "Table Header" and the style "Blue" to "Table". OK
Insert a table e.g. 2 columns and 4 rows with table header and some dummy text.
Mark the whole table and apply your newly defined style "ConditionCaller".
Notice that the text in the first row of the table becomes red and in the other cells blue.
Save the document.
Reload.
Notice that the colors are lost.

If you look into the file, you will see, that there are no <style:map> elements, which would be needed for a conditional style.

This happens too, if you the set the conditions in the style "Text body".

I have used Version: 5.2.6.2
Build ID: a3100ed2409ebf1c212f5048fbe377c281438fdc
CPU Threads: 4; OS Version: Windows 6.1; UI Render: default; 
Locale: de-DE (de_DE); Calc: group
Comment 9 Regina Henschel 2017-05-05 22:58:20 UTC
Created attachment 133098 [details]
Conditional formatting made by AOO 4.1.2

Open attached file. Conditions are lost on opening too.
Comment 10 Regina Henschel 2017-05-05 23:22:05 UTC
In the meantime conditional formatting is broken totally, see bug 103091.
Comment 11 Troy Rollo 2017-06-05 06:26:13 UTC
*** Bug 103091 has been marked as a duplicate of this bug. ***
Comment 12 Troy Rollo 2017-06-05 06:28:26 UTC
There is currently no code in the master branch for saving or restoring paragraph style conditions.
Comment 13 Michael Stahl (CIB) 2017-06-15 20:11:11 UTC
there is no practical difference between a style that isn't conditional,
and a conditional style with no conditions.

as far as i can see there is no way to differentiate those
2 possibilities in an ODF document either; both cases
don't have any style:map element below style:style.

basically if anything this is an UI problem, we could just remove
this checkbox from the dialog without any loss of functionality.
Comment 14 Kaue 2018-10-23 20:58:56 UTC
(In reply to Regina Henschel from comment #8)
> I see the problem even the condition is set immediately and works while
> first working on the document. After save and reload the condition is gone.
> 
> To reproduce:
> Define a style "Red" from Default, that has a red font color.
> Define a style "Blue" from Default, that has a blue font color.
> Start defining a style "ConditionCaller" from Default. Go to tab Condition
> and mark "Conditional Style". Apply the style "Red" to the condition "Table
> Header" and the style "Blue" to "Table". OK
> Insert a table e.g. 2 columns and 4 rows with table header and some dummy
> text.
> Mark the whole table and apply your newly defined style "ConditionCaller".
> Notice that the text in the first row of the table becomes red and in the
> other cells blue.
> Save the document.
> Reload.
> Notice that the colors are lost.
> 
> If you look into the file, you will see, that there are no <style:map>
> elements, which would be needed for a conditional style.
> 
> This happens too, if you the set the conditions in the style "Text body".
> 
> I have used Version: 5.2.6.2
> Build ID: a3100ed2409ebf1c212f5048fbe377c281438fdc
> CPU Threads: 4; OS Version: Windows 6.1; UI Render: default; 
> Locale: de-DE (de_DE); Calc: group

The procedure described now works, but conditions set in the "Text body" style are still not working (they disappear after reloading the document) on 6.1.1.2 (x64, Windows 10).