Bug 130719 - Overwriting Writer styles does not overwrite changes to Marginalia paragraph style
Summary: Overwriting Writer styles does not overwrite changes to Marginalia paragraph ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Documentation (show other bugs)
Version:
(earliest affected)
6.4.0.3 release
Hardware: All All
: medium enhancement
Assignee: sdc.blanco
URL:
Whiteboard: target:7.1.0
Keywords:
Depends on:
Blocks: Styles-Load
  Show dependency treegraph
 
Reported: 2020-02-16 20:35 UTC by Jamie Dimmel
Modified: 2020-11-11 09:35 UTC (History)
7 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 Jamie Dimmel 2020-02-16 20:35:28 UTC
Description:
If you make changes to the Marginalia paragraph style (along with other paragraph styles like Text Body and Heading 1), and you decide to revert back to the original default template styles, loading styles from the Default template and specifying Overwrite, does NOT actually overwrite the Marginalia style like it does the other styles.

Steps to Reproduce:
1. Change some paragraph styles in Writer (i.e. make default font Times New Roman & Text Body have 18 pt indent)
2. Change Marginalia paragraph style (in my initial case I changed the indent from 113.4 pt indent to 72 pt and gave it a colored Area of Light Gray 5)
3. Save the changes
4. Go to Styles, Load Styles, select Styles category and Default template, check the boxes for Text, Frame, Pages, Numbering, and (especially) Overwrite, then clock Ok

Actual Results:
The paragraph styles that you changed are reverted back to their settings in the Default template, EXCEPT for the Marginalia style, which retains the changes you made to the style in your document

Expected Results:
I expect that ALL the paragraph styles should revert back to their settings in the default template.


Reproducible: Always


User Profile Reset: No



Additional Info:
[Information automatically included from LibreOffice]
Locale: en-US
Module: TextDocument
[Information guessed from browser]
OS: Windows (All)
OS is 64bit: no

From Help - About:
Version: 6.4.0.3 (x64)
Build ID: b0a288ab3d2d4774cb44b62f04d5d28733ac6df8
CPU threads: 4; OS: Windows 10.0 Build 18362; UI render: default; VCL: win; 
Locale: en-US (en_US); UI-Language: en-US
Calc: threaded

I want to add that I'm not sure which version this first occurred in. I do frequently reload the default styles, but I haven't used the marginalia style too much before so never had a chance to notice before.

Also, I just completely reinstalled LibreOffice a few days ago (2020-02-12), completely uninstalling it and wiping it's user profile, so this is (minor some minor configuration changes I made) a new install.
Comment 1 Dieter 2020-03-15 09:37:30 UTC
I can't confirm it with

Version: 7.0.0.0.alpha0+ (x64)
Build ID: c63148ba139bd6b9ae7a0f9e24e51f29e5370963
CPU threads: 4; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win; 
Locale: de-DE (de_DE); UI-Language: en-GB
Calc: threaded

None of the customised styles have been overwritten.

Regarding to help [1] I think that's the expected behaviour: "Load Styles- Imports formatting styles from another document or template into the current document ... Overwrite - Replaces styles in the current document that have the same name as the styles you are loading. 

So for me NOTABUG. Do yu agree?

cc: Design-Team (perhaps I'm wrong with NOTABUG)


[1] https://help.libreoffice.org/7.0/en-GB/text/swriter/01/05170000.html?System=WIN&DbPAR=WRITER&HID=sfx/ui/loadtemplatedialog/dialog-action_area1#@@nowidget@@
Comment 2 Jamie Dimmel 2020-03-15 14:17:37 UTC
I'm afraid I am confused. Isn't that the opposite of what help says?

The way that I would understand:

"Overwrite.
Replaces styles in the current document that have the same name as the styles you are loading.
Styles with identical names are automatically overwritten."

would be that any style in the current document, that has the same name as a style in the document (or template) that you are loading, would be automatically overwritten.

So if I changed the Marginalia paragraph style, it would automatically get overwritten by the Marginalia paragraph style in the importing template.

If that's NOT the case, why would it be labeled as "overwrite" then? I just don't understand that.
Comment 3 Heiko Tietze 2020-03-16 08:06:51 UTC
(In reply to Jamie Dimmel from comment #0)
> Steps to Reproduce:
> 1. Change some paragraph styles...
> 4. Styles > Load Styles... (check) Overwrite

In fact the style Marginalia is not overridden likewise Text Body Indent. But the function affects Default, Heading, and Text Body, for instance. 

If the template document has not defined the style it will consequently not affect the current document. See also https://opengrok.libreoffice.org/xref/core/extras/source/templates/styles/Default/styles.xml (it contains Standard, Heading, Text body, List, Caption, Index, Quotations, Title, Subtitle, Heading 1 .. Heading 7; and I'm pretty sure LBP took what was defined before in the effort of solving bug 114749).

So the question boils down to "Can you expect the template 'Style > Default' to reset the default"? Wouldn't say so as it is some "random" template and not meant as a style reset tool. But opposite opinions are welcome and the solution would be to define all internal styles in this template.


The immediate solution for your workflow is to create a template with all styles you want to use and take this instead of the shipped.
Comment 4 Mike Kaganski 2020-03-16 08:23:12 UTC
So the problem is: a template shipped with LibreOffice (named "Default"?) does not include an explicit definition of a standard style in it, thus any document created from it has that style auto-generated from the hardcoded defaults; and of course, overwriting styled of a specific document with styles of that template does not affect any styles absent in the template definition?

Possibilities:

1. Make sure to define all the styles in shipped templates
   - maintenance burden: in case a default is changed in code, the templates need to be edited to comply (it would be a shame if shipped templates don't do what is considered good for a default case without a reason).
   - possible implementation problem (not checked): doesn't LO strips out a definition that fully matches the default?

2. Make the Load Styles to always load full set of standard styles - from defaults if absent
   + would not need maintenance of templates
   - would disallow the opposite need: if someone wants to not include some of the standard style in the hope that it does *not* get updated (no idea if that is a real case, just speculating)

2.1. Make it ("[x] Overwrite standard styles absent in the template with defaults") optional in Load Styles dialog
   + keeps flexibility

3. NOTABUG/WONTFIX
Comment 5 Jamie Dimmel 2020-03-16 18:46:34 UTC
Thank you for the explanation.

I wasn't thinking about styles being hardcoded and not appearing in a 'default' template. I just assumed all styles were in the default templates, and thus could overwrite any non-custom styles back to template (or program) defaults.

As an end user I do (or would) find it useful to be able to reset all styles in a doc back to their original (whether program or template) defaults, rather than saving a file to plain text, then save back to odt, since if you use the latter method you lose the link between blocks of text and styling.

I guess this becomes an issue for the user interface or design group then. In the meantime, I'll just create my own template with all standard styles so I can use it to overwrite something if I need to.
Comment 6 Cor Nouws 2020-03-18 20:19:47 UTC
Hi !

Only looking into this now. Sorry..


(In reply to Jamie Dimmel from comment #2)
> The way that I would understand:
> "Overwrite.
> Replaces styles in the current document that have the same name as the
> styles you are loading.
> Styles with identical names are automatically overwritten."
> 
> would be that any style in the current document, that has the same name as a
> style in the document (or template) that you are loading, would be
> automatically overwritten.
> 
> So if I changed the Marginalia paragraph style, it would automatically get
> overwritten by the Marginalia paragraph style in the importing template.
That is fully correct and how it always worked.

Pick any template/document to load styles from, and all style types that you mark and of which the names are the same in active document and document to load, are overwritten. That is how it is designed.

> If that's NOT the case, why would it be labeled as "overwrite" then? I just
> don't understand that.
If (will check) it's a bug.
Comment 7 Cor Nouws 2020-03-18 20:32:49 UTC
I just tried in Versie: 6.4.0.3
Build ID: b0a288ab3d2d4774cb44b62f04d5d28733ac6df8
CPU-threads: 8; Besturingssysteem: Linux 5.3; UI-render: standaard; VCL: gtk3; 
Locale: nl-NL (en_US.UTF-8); UI-taal: nl-NL
Calc: threaded

It works as expected. Existing styles are overwritten by styles in the selected document/template.
Also Marginalia.

So maybe a bug on Windows only ?
Comment 8 Cor Nouws 2020-03-18 20:34:01 UTC
(In reply to Dieter from comment #1)

> Version: 7.0.0.0.alpha0+ (x64)
> Build ID: c63148ba139bd6b9ae7a0f9e24e51f29e5370963
> CPU threads: 4; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL:
Can you maybe test 6.4.0 on Windows, Dieter?
thnx!
Comment 9 Heiko Tietze 2020-03-19 10:27:56 UTC
We discussed the topic in the design meeting. There is a tendency for #3 (resolve as NAB) but rename (foe example "Load Styles from Template") and double-check the documentation. 

Code pointer 

https://opengrok.libreoffice.org/xref/core/officecfg/registry/data/org/openoffice/Office/UI/WriterCommands.xcu?r=e24585ec#1163
https://opengrok.libreoffice.org/xref/core/sfx2/uiconfig/ui/loadtemplatedialog.ui?r=0a66deda#344

(In reply to Cor Nouws from comment #7)
> Also Marginalia.

See my comment 3 with reference to master.
Comment 10 Cor Nouws 2020-03-19 20:37:13 UTC
(In reply to Heiko Tietze from comment #9)
> We discussed the topic in the design meeting. There is a tendency for #3
> (resolve as NAB) but rename (foe example "Load Styles from Template") and
> double-check the documentation. 

Wait, sorry, missed this.
The function allows to load styles. Full stop.
No distinction between templates and documents.
What is the reason for this change?


> (In reply to Cor Nouws from comment #7)
> > Also Marginalia.
> 
> See my comment 3 with reference to master.

(In reply to Heiko Tietze from comment #3)
> (In reply to Jamie Dimmel from comment #0)
> > Steps to Reproduce:
> > 1. Change some paragraph styles...
> > 4. Styles > Load Styles... (check) Overwrite
> 
> In fact the style Marginalia is not overridden likewise Text Body Indent.
> But the function affects Default, Heading, and Text Body, for instance. 

Create a document, change style Marginalia, save.
Create new document, use style Marginalia, F11>Load Styles> chose 1st document..
  > Marginalia in second document is changed to what is defined in 1st doc.

Who is missing what :) ?
Comment 11 Mike Kaganski 2020-03-20 04:49:01 UTC
(In reply to Cor Nouws from comment #10)
> (In reply to Heiko Tietze from comment #9)
> > We discussed the topic in the design meeting. There is a tendency for #3
> > (resolve as NAB) but rename (foe example "Load Styles from Template") and
> > double-check the documentation. 
> 
> Wait, sorry, missed this.
> The function allows to load styles. Full stop.
> No distinction between templates and documents.
> What is the reason for this change?

I also fail to see how this change (making the name less correct) help user realize that some styles (that user expects to be present in the template) are missing in it? IIUC, OP didn't misunderstand the function, only didn't know that some standard styles may be missing and generated from defaults.

> Create a document, change style Marginalia, save.
> Create new document, use style Marginalia, F11>Load Styles> chose 1st
> document..
>   > Marginalia in second document is changed to what is defined in 1st doc.

As we discovered (see comment 3, comment 4, comment 5), the problem is not with some special Marginalia processing, but in the specific content of Default template. If you load the styles *from it*, Marginalia is not reset (i.e., it will be different from what a new document gets when created from that template), and there's nothing user-visible to indicate that Marginalia is not in the Default, hence the issue.
Comment 12 Cor Nouws 2020-03-21 19:58:28 UTC
(In reply to Mike Kaganski from comment #11)
> As we discovered (see comment 3, comment 4, comment 5), the problem is not
> with some special Marginalia processing, but in the specific content of
> Default template. If you load the styles *from it*, Marginalia is not reset
Ah - missed that.
Thanks!
Comment 13 Jamie Dimmel 2020-03-21 20:25:33 UTC
I'm sorry, but I fail to see how renaming this function solves either of the two original problems, which were: 1) wanting to return all styles back to their original settings on opening/creating the document; and 2) believing that the LibreOffice provided templates (Default & Modern) contained ALL the styles defined by the program. In fact, this just confuses the issue more, as you can load styles from a document, not just a template.

Perhaps the situation would be to 1) add a note or popup when someone chooses to overwrite styles that only the styles in the template will be overwritten and that the template might not contain all defined styles; or 2) add all styles to the LibreOffice provided templates; or 3) provide an option that on choosing to overwrite styles the program default styles are loaded first, then overwritten by the template styles.

Any of the above three would have prevented me from filing this bug, but renaming the function would not have, so I really don't think it resolves the underlying issue.
Comment 14 Buovjaga 2020-03-21 21:19:30 UTC Comment hidden (obsolete)
Comment 15 Cor Nouws 2020-03-21 21:52:25 UTC
Hi Jamie,

To me, this seems perfect for a *Note! in the Help..
So if users see add behavior, read the Help.. that should .. eh help?
What do you think?
Comment 16 Cor Nouws 2020-03-21 21:52:38 UTC
s/add/odd
Comment 17 Jamie Dimmel 2020-03-21 22:33:51 UTC
(In reply to Cor Nouws from comment #15)
> Hi Jamie,
> 
> To me, this seems perfect for a *Note! in the Help..
> So if users see add behavior, read the Help.. that should .. eh help?
> What do you think?

Yes, short of adding an explanation in the dialog itself, that would be a solution. That is, indeed, what I did when I saw the outcome was not what I expected, look in the Help. Since there wasn't anything there that explained what was going on, I filed this bug report.
Comment 18 QA Administrators 2020-03-22 02:40:22 UTC Comment hidden (obsolete)
Comment 19 Heiko Tietze 2020-03-22 08:04:07 UTC
(In reply to Jamie Dimmel from comment #17)
> (In reply to Cor Nouws from comment #15)
> > To me, this seems perfect for a *Note! in the Help..
> 
> Yes, short of adding an explanation in the dialog itself, that would be a
> solution.

So let's forward this issue to documentation.
Comment 20 sdc.blanco 2020-11-07 12:09:02 UTC
I am willing to add the note -- but after reading the comments twice, I am not able to decide/understand what exactly needs to (or should) be added to address this case.

If someone can give a "proposed text" or a list of "important facts" to know, then I should be able to do the rest.

I assume it should appear in:  https://help.libreoffice.org/7.1/en-GB/text/swriter/01/05170000.html
Comment 21 Mike Kaganski 2020-11-07 13:43:46 UTC
(In reply to sdc.blanco from comment #20)
> I am willing to add the note -- but after reading the comments twice, I am
> not able to decide/understand what exactly needs to (or should) be added to
> address this case.

I'd suggest something like: "The function will not change styles of current document, that are absent in the source document. Note that documents, including templates, may not have definitions of some standard styles, even though documents created from those templates show those styles; such styles in new documents are generated from defaults - and loading styles from those templates missing such style definitions will not reset these styles."

(yes, clumsy, but its just the first idea to polish by people with better skills :-))

> I assume it should appear in: 
> https://help.libreoffice.org/7.1/en-GB/text/swriter/01/05170000.html

Yes, I agree. By the way: what could that strange thing possibly mean there:

> **Overwrite**
> 
> Replaces styles in the current document that have the same name as the
> styles you are loading.
> 
> [!] Styles with identical names are automatically overwritten.

What does that exclamation mean? That styles with "identical names" will be overwritten regardless of the checkbox? Then how those styles differ from styles with "same name"? Or does that mean something like "Beware that using this checkbox will automatically do what it tells it will do!"?
Comment 22 sdc.blanco 2020-11-07 15:00:50 UTC
(In reply to Mike Kaganski from comment #21)
> > **Overwrite**
> > 
> > Replaces styles in the current document that have the same name as the
> > styles you are loading.
> > 
> > [!] Styles with identical names are automatically overwritten.
> 
> What does that exclamation mean? That styles with "identical names" will be 
> overwritten regardless of the checkbox?  Then how those styles differ from 
> styles with "same name"? Or does that mean something like "Beware that 
> using  this checkbox will automatically do what it tells it will do!"
Both the "overwrite" description and the warning sentence were present in the initial 2004 checkin of the help page (and unchanged since then.) 

I agree with you.  It seems unnecessary to "warn" that choosing "overwrite" will overwrite.  Perhaps this warning should be dropped? ...

... and presumably replaced with new "warning" or "note".
Comment 23 sdc.blanco 2020-11-07 15:13:56 UTC
As for the new note.

How about something as simple as:

1. "Default templates have only a subset of the styles shown in a new document."

or slightly more specific (but still ambiguous)

2. "Default templates have only a limited subset of the styles shown in a new document."

or exhaustively specific (in good "reference manual" style)

3. "Default templates only provide only the following styles:  Text body, List, Caption, Quotations, Heading, Heading 1 to Heading 7, Index, Title, and Subtitle"

(if I have read comment 3 correctly -- but was uncertain about "Standard").

But maybe it is more complicated than templates alone.  Consider the following:

1. Open and save an empty new document. 
2. Open second new document, modify Marginalia Style (in sidebar), then load Styles (with Overwrite checked) from first saved empty document.

Result: modified Marginalia is not changed -- which implies that my proposed note needs to be expanded or modified, because the scope is broader than templates alone.

Is the idea that beyond that special list (from comment 3), styles have to be explicitly modified to have an overwrite effect when they are loaded? 

(in yes, then this also seems relevant (necessary) to provide.)
Comment 24 Mike Kaganski 2020-11-07 17:01:15 UTC
(In reply to sdc.blanco from comment #23)
> As for the new note.
> 
> How about something as simple as:
> 
> ...
> 
> or exhaustively specific (in good "reference manual" style)
> 
> 3. "Default templates only provide only the following styles:  Text body,
> List, Caption, Quotations, Heading, Heading 1 to Heading 7, Index, Title,
> and Subtitle"

Please no explicit listings. They may change tomorrow with some new LO8.0 style change. Also this is not limited to "Default", and different templates shipped in LO may have different set of explicitly defined styles.

> But maybe it is more complicated than templates alone.  Consider the
> following:
> 
> 1. Open and save an empty new document. 
> 2. Open second new document, modify Marginalia Style (in sidebar), then load
> Styles (with Overwrite checked) from first saved empty document.
> 
> Result: modified Marginalia is not changed -- which implies that my proposed
> note needs to be expanded or modified, because the scope is broader than
> templates alone.
> 
> Is the idea that beyond that special list (from comment 3), styles have to
> be explicitly modified to have an overwrite effect when they are loaded? 
> 
> (in yes, then this also seems relevant (necessary) to provide.)

Of course, it's true - because a style should be either used, or modified compared to defaults, to get into the document (of any nature - both normal documents, and templates)...
Comment 25 sdc.blanco 2020-11-07 17:25:02 UTC
(In reply to Mike Kaganski from comment #24)
> Please no explicit listings. They may change tomorrow with some new LO8.0
OK

> Of course, it's true - because a style should be either used, or modified
> compared to defaults, to get into the document (of any nature - both normal
> documents, and templates)...
Of course?   And I suppose you read this in a manual?  (-:

Anyway, this seems to be the "key" bit of (missing) information that should be provided, no?

(along with a mention of a limited subset of styles in a default template)
Comment 26 Mike Kaganski 2020-11-07 18:29:49 UTC
(In reply to sdc.blanco from comment #25)
> > Of course, it's true - because a style should be either used, or modified
> > compared to defaults, to get into the document (of any nature - both normal
> > documents, and templates)...
> Of course?   And I suppose you read this in a manual?  (-:

I am sorry if that was something ... inappropriate from my side - I only meant to confirm your findings, to say that they are absolutely correct.

> 
> Anyway, this seems to be the "key" bit of (missing) information that should
> be provided, no?

Likely :-)
Comment 27 sdc.blanco 2020-11-07 22:01:32 UTC
(In reply to Mike Kaganski from comment #26)
> (In reply to sdc.blanco from comment #25)
> > Of course?   And I suppose you read this in a manual?  (-:
> 
> I am sorry if that was something ... inappropriate from my side - I only
> meant to confirm your findings, to say that they are absolutely correct.
Nothing inappropriate.  On the contrary, very useful.
I hope you saw the smiley at the end of my comment.
My point was, of course, that it was "of course" for you, because you know how it works!  And in this case, where we are trying to discover/add useful information about how "load styles" works, I was asking (as a joke) if knew that this "useful information" was "of course" because you had read it in the manual (or help pages) -- which of course we know do not exist -- until this patch is made. (-: 

> > Anyway, this seems to be the "key" bit of (missing) information that
> > should be provided, no?
> 
> Likely :-)
So now, in all seriousness, thanks for the confirmation.  Useful to know.

Here is my proposal:

    For documents, only applied styles, styles modified from a default, and a 
    limited subset of common styles from a default template will be loaded. 
    For templates, only a limited subset of common styles and/or styles 
    modified from a default will be loaded. The styles shown in the sidebar
    cannot be used as a guide.


Please evaluate especially the end of the first sentence. While I understand that there is no "default" template (from an LO PoV), I was trying to find a way to say that in addition to applied and modified styles, one has to know that some (but not all) styles from a (vaguely specified) template will be loaded. No problem to drop "default template" (but it seemed to be a way to convey a sense of "standard" or "factory" default).

And one more thing about that sentence. I want to check that I have understood correctly (because "documents" and "templates" seem like slightly different cases, which is why I decided to write separate sentences for them.)

To illustrate that first sentence, I tried the following:

1.  Open new file1.
2.  Modify Heading 1 and 3, and Marginalia
3.  Apply Marginalia in file1
3.  Save file1.
4.  Open new file2, and Modify Heading 2 style.
5.  "load styles" to file2 from file1 (with overwrite)

I got the impression -- from the discussions -- that the result should be:
Heading 1, 3, and Marginalia styles (from file1) are loaded, while Heading 2 (from file1) will overwrite the modified Heading 2 in file2.

In my experiments, Heading 1, 3, and Marginalia are loaded, but Heading 2 (in file2) is unchanged. Is that how it is supposed to work? according to design?  

(If so, then my proposal for sentence 1 is not accurate.  Does the "default template" (or however one should refer to that list in comment 3) ever "overwrite"? ) That is what I was trying to test with this example -- 

And one final thought.  Maybe this text does not apply only to "overwrite"?
The help page (and checkboxes) also offer "Text", "Frames", "Page", and "Numbering".  Is it correct to assume that the same "playing rules" (in the proposal) apply for these different categories?

If the answer is yes, then perhaps there should be a little introduction/explanation after "How to access.." and before "Categories" that says what is in the "proposal" -- but in a more narrative form -- instead of a than a "note" or "warning" after "overwrite"?

I am not promoting any solution, just trying to get an accurate (comprehensive) understanding of the situation, so that it can be communicated appropriately. 

Happy to receive comments, criticisms, etc. on the proposals and example.
Comment 28 Mike Kaganski 2020-11-08 11:08:45 UTC
(In reply to sdc.blanco from comment #27)
> 1.  Open new file1.
> 2.  Modify Heading 1 and 3, and Marginalia
> 3.  Apply Marginalia in file1
> 3.  Save file1.
> 4.  Open new file2, and Modify Heading 2 style.
> 5.  "load styles" to file2 from file1 (with overwrite)
> 
> I got the impression -- from the discussions -- that the result should be:
> Heading 1, 3, and Marginalia styles (from file1) are loaded, while Heading 2
> (from file1) will overwrite the modified Heading 2 in file2.
> 
> In my experiments, Heading 1, 3, and Marginalia are loaded, but Heading 2
> (in file2) is unchanged. Is that how it is supposed to work? according to
> design?  

1-3. This produces a file1 which has "Heading 1", "Heading 3", and "Marginalia" styles (3 styles in total) explicitly defined in it for sure. All 3 are modified from defaults; and "Marginalia" is additionally used (so it has two reasons to be in the files). Other styles (including "Heading 2") are not changed from initial state; by default, if you have created the file1 from a default template or from no template, it will mean that "Heading 2" is not different from program built-in defaults, not used in the file1, and thus not explicitly defined in the file1.

4. This made file2 with a single modified style "Heading 2".

5. When loading styles from file1, those styles that were in it ("Heading 1", "Heading 3", and "Marginalia", but *not* "Heading 2" which was absent in file1) got (re-)defined in file2.

I don't wee where is the difference wrt what we discussed previously.

===

There should no difference between template and normal document IIUC. I don't think that word "limited" is correct in your sentence "only a limited subset of common styles and/or styles modified from a default will be loaded". Limited by what or whom? It's naturally limited by the list of styles explicitly present in the source file, but "limited" in your sentence doesn't sound like referring to that natural limit (which doesn't need that qualification). Then, "a" in "a default" - we actually are talking about *the* default in the program, not "a" default in unknown place. And this makes it necessary to keep clear distinction between *the defaults built in the program* (*not* related to *any* template), and *a template* (just another kind of document which may contain arbitrary definitions of some styles).

The overwriting applies to the cases when both source and destination contains a style with the same name. Any kind of style - from the categories checked in the dialog.
Comment 29 sdc.blanco 2020-11-08 15:34:45 UTC
@Mike, I am grateful for your willingness to help me overcome my handicap of not understanding what is going on here, which of course is also the point of OP -- to give a clear "note" about what is going on...

From your answers, it seems that I am close, but the "showstopper" is inadequate grasp of the "built-in program defaults" and their consequences in "overwrite".

So ... continuing....by concentrating on your latest formulation.

> There should no difference between template and normal document IIUC. 
Until I hear otherwise, I will work with this ‟fact.” 

This fact implies no need for separate sentences for ‟document” and ‟template”.

> I don't think that word "limited" is correct in your sentence 
> "only a limited subset of common styles and/or styles modified 
> from a default will be loaded". Limited by what or whom? 
Might be my misunderstanding. I had interpreted the discussion in relation to comment 3 to mean that the (limited) list of styles named there would be loaded and ‟overwrite”. (That is what motivated the file1/file2 experiment.) But I have apparently misunderstood that discussion.  I had assumed that list of styles in comment 3 were always loaded (i.e., "limited set of a default"), whether modified and not, and therefore "overwriting". 

> It's naturally limited by the list of styles explicitly present 
> in the source file, 
Yes.  Covered by mention of ‟applied” and ‟modified” styles.

> but "limited" in your sentence doesn't sound like referring to 
> that natural limit (which doesn't need that qualification). 
Agree:  so-called ‟natural limit” does not need qualification.
Confirm: ‟limited” was meant to refer to something else, what you
called ‟the defaults built in the program”  (– but it appears that 
I have not grasped this adequately yet).

> Then, "a" in "a default" - we actually are talking about *the* default 
> in the program, not "a" default in unknown place. 
Ok.  I was uncertain here.  For example, in 7.1, there is a ‟Simple” template and a ‟Default” template. (When I open a document with ‟Simple”, then only about 10 Styles are loaded). But in this case, maybe no need to refer to ‟default template” at all (given: (a) different templates available and (b) initial point that no difference between ‟template” and ‟document”).

> And this makes it necessary to keep clear distinction between *the defaults
> built in the program* (*not* related to *any* template), and *a template* 
> (just another kind of document which may contain arbitrary definitions of 
> some styles).
I’m trying. (-:  This seems to be where my understanding is inadequate. And also seems to be the only point that is not under control yet. If I could understand ‟the defaults” and their consequences/implications in the overwrite situation, then I should be able to find a way to express it clearly (with the other points).  

> The overwriting applies to the cases when both source and destination 
> contains a style with the same name. Any kind of style - from the 
> categories checked in the dialog.
Understood about overwrite.  My query was more general, but will return to this later (if necessary), after I understand the ‟default” issue.
Comment 30 sdc.blanco 2020-11-08 21:58:46 UTC
@Mike, is it as simple as this:

   Only styles that were applied or modified are loaded.  

   This principle applies both to documents and templates, 

If this is correct, then please ignore previous message (comment 29).
Comment 31 Mike Kaganski 2020-11-09 06:14:06 UTC
(In reply to sdc.blanco from comment #30)
> @Mike, is it as simple as this:
> 
>    Only styles that were applied or modified are loaded.  
> 
>    This principle applies both to documents and templates, 
> 
> If this is correct, then please ignore previous message (comment 29).

This is formally correct, *if* you (a user reading the help article) realizes what "modified" means - specifically, modified relative to what (and here those built-in defaults come into play). Because otherwise what "modified" might mean for a "standard" (= shipped with application) templates? They are "unmodified", aren't they? they are considered the starting point, so what "modified" has to do with those?...

The "global application default" concept is itself something not very well-defined. There's nothing in *ODF* standard that tells about what, say, "Heading 2" looks like by default in text documents. So LibreOffice has some arbitrary defaults built-in, which may accidentally differ from the defaults in OOo or other implementations...

The user-visible behaviour is like this:

Opening any document, LibreOffice loads all styles defined in the document. They are listed in style manager. Every such style contains maybe hundreds of simple properties, but ~no document ever includes all those simple property defined in any single style.

So let's say, we have two paragraph styles defined in a document (for simplicity), "Default" and "Heading 1". The "Default" is the root of the style hierarchy; in this document, it has just two properties defined: font face and font size. "Heading 1" in this document inherits from "Default", and has only two properties defined: font size and paragraph alignment. But both styles have many other properties, like line spacing, borders, etc. Every property not defined in "Heading 1" is taken from "Default"; any property not defined in "Default" it taken from some hard-coded global program default. Here we meet the program defaults for the first time. This time, to complicate things, the defaults are format-specific: e.g., for styles loaded from ODT, they will have values different from defaults for a DOCX. And if it happens that a future version of the program has different defaults, then the document may appear different (which would be a regression, so for a changed default, we usually introduce a compatibility option, but not always - e.g., László had not introduced one for page backgrounds that fill the whole page opposed to older behavior filling only area inside page margins).

But after loading all the styles from the document, LibreOffice does the next step: it adds some pre-defined style names to the list. Those are styles like "Text Body", "Heading 2", etc. which are *absent* in the loaded document, but hard-coded in the program. They are listed in the style list, but they are initially only there, not in the actual document. It would be nice if they be marked somehow - say, "greyed out", as "possible to insert into this document", to highlight that they are not yet there ... but ATM there's no such highlight. Unless you do something with those "not yet existing" styles (and you don't know which in list are those), they will also not get into the file on disk when you press "save" ... so they are just something in the style list, neither read from file nor written back. They have their respective settings - and those settings are also taken from the built-in program defaults defined for each of those styles separately. *If* you open such style and modify anything, it will become modified *respective to those internal program defaults*, and then it will become part of the document. Or yo may not modify it, and instead just apply the style to anything in the document (e.g. to a paragraph). Then the style also gets into the file on save.

I don't know how to describe this to a user in unambiguous and not too technical way; and there's definitely a UX problem with absence of user-visible indication which of the styles in the list are part of the document, and which are just added by the program; which settings of a style are defined in the file, and which are taken from the program defaults ...
Comment 32 sdc.blanco 2020-11-09 11:00:39 UTC
(In reply to Mike Kaganski from comment #31)

Many thanks for detailed explanation. Much appreciated.

> I don't know how to describe this to a user in unambiguous and not too
> technical way; 
Neither do I. (see failed attempt in comment 27).

> This is formally correct, *if* you (a user reading the help article) 
> realizes what "modified" means 
Speaking presumptively on behalf of users:  I would understand "modified" to mean that I used "Format - Edit Style" or "context menu in Side bar - Modify" to make a change in a style (either in a document or in a template that I made). 

IIUC, this meaning of "modify" is a sufficient condition for the style to be loaded. And if the presumption is correct, then the "meaning" of modified would be understood in context.

Which leads to the bold decision:  Give the correct information, without trying to explain what "modified" means. 

Proposal for "note":

     Only applied styles and modified styles are loaded from a document or
     template. The styles shown in the sidebar cannot be used as a guide.


Reasoning:

     AFAIK, this description will always be valid, with no unexpected surprises (if I use the meaning of "modified" given above and also know about "applied styles).

IOW no practical advantage to know about the built-in defaults (and therefore no need to open that Pandora's box).


@Jamie - do you think the proposed note would been useful/helpful (in the original situation where you were surprised)?  

And any comments from others are welcome.
Comment 33 sdc.blanco 2020-11-09 11:05:59 UTC
(In reply to Mike Kaganski from comment #31)

> there's definitely a UX problem with absence of
> user-visible indication which of the styles in the list are part of the
> document, and which are just added by the program; which settings of a style
> are defined in the file, and which are taken from the program defaults ...
Had the same thought along the way.  
There is already an ‟Applied Styles” group in the Sidebar.  
If there was also a ‟Modified Styles” group, then...
one could look at these two groups and know exactly what would be loaded (IIUC).
Comment 34 Mike Kaganski 2020-11-09 11:10:15 UTC
(In reply to sdc.blanco from comment #32)
> Speaking presumptively on behalf of users:  I would understand "modified" to
> mean that I used "Format - Edit Style" or "context menu in Side bar -
> Modify" to make a change in a style (either in a document or in a template
> that I made). 

The problem for a user that I expect here would be:

"I created a document from a template. I had *not* touched any of the styles in my new document; I *only* used "Text Body" in the document, so I expected my document to only contain one "Text Body" style; yet, when I imported the styles from that document into another one I'm working on, a lot of other styles were also created/modified"... because the template that user was using to create the initial document already had lots of styles modified from the application defaults - so they were technically modified, but possibly not modified from a user's PoV.

But I *don't* oppose the proposal. It's much better than nothing; and it's better to start with it, and later to get some new proposal to improve (e.g. from people having new ideas how to describe this), than to continue having nothing.
Comment 35 sdc.blanco 2020-11-10 14:16:51 UTC
(In reply to Mike Kaganski from comment #34)
> The problem for a user that I expect here would be:
> 
> "I created a document from a template. I had *not* touched any of the styles
> in my new document; I *only* used "Text Body" in the document, so I expected
> my document to only contain one "Text Body" style; yet, when I imported the
> styles from that document into another one I'm working on, a lot of other...
Time will tell whether this case arises in a bug report. (And if that case arises, then the proposed note gives some critically relevant information that could motivate a sensible hypothesis about what might have happened.)

Meanwhile, OP is the opposite case, namely, why didn’t some some styles get loaded/overwritten!

So, in conclusion, if I may be humourous again, the proposed ‟note” (in comment 32) will fix (correctly) what was broken.  And what is not (yet) broken, we won’t fix.
Comment 36 Commit Notification 2020-11-11 08:51:43 UTC
Seth Chaiklin committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/help/commit/8539d61c5ecca6748e4734671a86783de5fdd4b2

Resolves: tdf#130719 add "note" about loading and overwriting styles
Comment 37 sdc.blanco 2020-11-11 09:35:02 UTC
(In reply to Mike Kaganski from comment #21)
> Or does that mean something like "Beware that using
> this checkbox will automatically do what it tells it will do!"?
Have moved this "warning" into the description for Overwrite, so that it now says. "No warning message is given."  (without ! )

For the curious, it takes a few days for the online help to be updated from master, then the result can be seen at:
https://help.libreoffice.org/7.1/en-US/text/swriter/01/05170000.html

Closing as FIXED.