Bug 138786 - Paragraph Style formatting gets lost, if you paste text into an new document with same Paragraph Style name, but different settings (see comment 5)
Summary: Paragraph Style formatting gets lost, if you paste text into an new document ...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.5.7.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Writer-Styles-Paragraph
  Show dependency treegraph
 
Reported: 2020-12-09 19:13 UTC by Telesto
Modified: 2023-05-17 02:33 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file (131.84 KB, application/vnd.oasis.opendocument.text)
2020-12-30 10:07 UTC, Telesto
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Telesto 2020-12-09 19:13:41 UTC
Description:
Image caption frame size to small after copy/paste

Steps to Reproduce:
1. Open the attached file
2. Copy the image frame (containing image)
3. CTRL+N
4. CTRL+V -> Caption hidden

Actual Results:
Caption hidden 

Expected Results:
Not so


Reproducible: Always


User Profile Reset: No



Additional Info:
Found in
7.2

and in
4.4.7.2

and in
LibreOffice 3.5.0rc3 
Build ID: 7e68ba2-a744ebf-1f241b7-c506db1-7d53735
Comment 1 Dieter 2020-12-30 09:28:10 UTC
(In reply to Telesto from comment #0)
> Steps to Reproduce:
> 1. Open the attached file

Attachment is missing
=> NEDINFO
Comment 2 Telesto 2020-12-30 10:07:13 UTC
Created attachment 168572 [details]
Example file
Comment 3 Dieter 2020-12-30 10:46:13 UTC
I confirm it with

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

Additional information:
It does't happen, if you paste frame into the same document.
Comment 4 QA Administrators 2022-12-31 03:19:38 UTC Comment hidden (obsolete)
Comment 5 Dieter 2023-01-02 10:49:24 UTC
Still present in 

Version: 7.5.0.1 (X86_64) / LibreOffice Community
Build ID: 77cd3d7ad4445740a0c6cf977992dafd8ebad8df
CPU threads: 4; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL threaded

It happens because of different PS:
PS Caption in original document has spacing before and after paragraph 0 cm and font size 11. In new paragraph PS Caption has 0,21cm spacing before and after and font size 12.If you change all values to values of original document, it works as expected.

So I could narrow down the problem as follows
1. Open attachment 168572 [details]
2. Change PS of last paragraph to Caption or wirte a new paragraph with PS Caption (this makes it obvious, that problem isn't related to captions
3. Copy paragraph
4. Ctrl+N
5. Ctrl+V
6. Compare Settings of PS (font size and spacing)

Actual result:
Different settings

Expected result:
Not sure about it. Perhaps current result is expected or original formatting of PS should be retained.

=> I've changed bug summary

=> needUXEval
Comment 6 Heiko Tietze 2023-01-04 11:00:55 UTC
Similar topic in bug 112697 for Impress.

We can
a) silently apply the target style (current situation)
b) silently copy/rename of source style ("Caption_1", for example)
c) show a dialog to resolve the conflict 

In the case of Writer, the goal of styles is to create a consistent document. Therefore b) makes no sense to me. Showing a dialog would be a major nuisance for most users, so maybe some kind of paste special option where all attributes are taken from the source. In fact pasting as RTF does not work, likely since we do not copy every single attribute.

My take: NAB, aka a).
Comment 7 Dieter 2023-01-04 13:00:30 UTC
(In reply to Heiko Tietze from comment #6)
> In the case of Writer, the goal of styles is to create a consistent
> document. Therefore b) makes no sense to me. Showing a dialog would be a
> major nuisance for most users, so maybe some kind of paste special option
> where all attributes are taken from the source. In fact pasting as RTF does
> not work, likely since we do not copy every single attribute.
> 
> My take: NAB, aka a).

Heiko, I understand your arguments, but I don't agree with the conclusion. Original bug report shows, that it isn't always easy to figure out, why a pasted text doesn't look as expected.

So in the case you paste text from another document I would at least expect a message like: "You paste content from another document. Copied style formatting will be overwritten by styles with the same name." OK | Cancel | Don't show message again (Of course you can use a better English)
Comment 8 Mike Kaganski 2023-01-04 17:35:11 UTC
(In reply to Heiko Tietze from comment #6)
> We can
> a) silently apply the target style (current situation)
> b) silently copy/rename of source style ("Caption_1", for example)
> c) show a dialog to resolve the conflict 

(In reply to Dieter from comment #7)
> So in the case you paste text from another document I would at least expect
> a message like: "You paste content from another document. Copied style
> formatting will be overwritten by styles with the same name." OK | Cancel |
> Don't show message again (Of course you can use a better English)

There are three actual cases usability-wise:

1. The user pastes as plain text - i.e., the current Ctrl+Alt+Shift+V behavior;
2. The user would want the pasted rich text to follow the styling of target document (i.e., the same-name styles get the meaning they have in the target document; absent styles are added; direct formatting is applied as in the source) - i.e., the current Ctrl+V behavior;
3. The user wants the pasted text to look as it looked in the source. This is what this issue is about.

The #3 indeed must *not* be implemented by modifying the existing styles (because that would re-format existing text); and I would tell that renaming styles would also be poor, because it would proliferate automatically generated styles - consider a document, into which you copy some text from other source many times - will it generate new style_1, style_2, ... style_N each time?

The reasonable implementation of "keep source formatting" paste option would be to use the target styles, *but* additionally apply direct formatting atop, to override any formatting in the target document which does not match what was in the source. The "I want the text to look the same as in the source" case is a clear sign of unstructured approach (at least locally), and DF is IMO absolutely fine.

And IMO, some improvement of the paste process would be nice. A dialog is a no-go; but we already have a drop-down paste toolbar button; and we could try to implement more convenience tools - see e.g. how MS Word does that, by displaying a floating toolbar on paste, with buttons allowing to change the formatting of the pasted text *retroactively*. I don't suggest to copy that approach, but I suppose that some improvement is possible without intrusive (blocking) UI (which is a dialog).
Comment 9 Dieter 2023-01-04 22:11:40 UTC
I agree with your reasoning, Mike.
Comment 10 Heiko Tietze 2023-01-05 09:02:32 UTC
What is the actual use case? Shouldn't the style "Text Body" or "Frame" be consistent across one document, exactly as implemented? And if a document has headings with blue text color I see no reason to keep that for another document with red headings.
Comment 11 Mike Kaganski 2023-01-05 09:29:08 UTC
(In reply to Heiko Tietze from comment #10)

Users may (and often do) *not* care about styles; they often cate about look.

And pasting some data from other sources, and wanting it to *look* exactly as it was in the other source, is a frequent request: people might want some look and feel of the original (in a form of "insertion", like "this is how it appeared in source Foo").

And they *really* don't care that someone had created the other source using the same styles that they are using in their new destination: both could use Heading N, but customized differently. Users might have valid reasons to expect *just copy something from a random document, paste into another random document, and have an option to make the result look exactly like in the source*, no matter what.
Comment 12 Heiko Tietze 2023-01-05 10:11:52 UTC
(In reply to Mike Kaganski from comment #11)
> Users may (and often do) *not* care about styles; they often care about look.

I think we talk about the Eve-users who properly format one document with styles and the other one too.
Comment 13 Mike Kaganski 2023-01-05 10:14:14 UTC
(In reply to Heiko Tietze from comment #12)

Who told you that? We talk about any use case. What is a rationale behind random limitation of this to a case when an advanced user works with documents that they authored themselves? Two artificial limitations in one sentence ;)
Comment 14 Cor Nouws 2023-01-12 12:56:47 UTC
(In reply to Heiko Tietze from comment #6)

> a) silently apply the target style (current situation)

This is true only if the particular paragraph style is not already used in the target document.

So this is a bug, since in the reported case, the frame incl caption is pasted in an empty document.
Comment 15 Cor Nouws 2023-01-12 12:58:27 UTC
and apart from #14:

(In reply to Mike Kaganski from comment #8)
> And IMO, some improvement of the paste process would be nice. A dialog is a
+ 1 - but different topic, IMO.
Comment 16 Mike Kaganski 2023-01-12 13:07:59 UTC
(In reply to Cor Nouws from comment #14)
> > a) silently apply the target style (current situation)
> 
> This is true only if the particular paragraph style is not already used in
> the target document.

I disagree.
This would be an additional, big and unmanageable source of problems. Styles in documents are *document content*, even when they are yet unused. If you ignore that, templates loose their meaning at all. I prepare templates for further reuse of styles (among other things); so when you paste and re-define my template styles, it is simply wrong.

Please don't introduce this "redefine if unused". I could agree with "redefine all if explicitly requested", but not that.
Comment 17 Heiko Tietze 2023-01-12 14:33:25 UTC
(In reply to Mike Kaganski from comment #16)
> Please don't introduce this "redefine if unused". I could agree with
> "redefine all if explicitly requested", but not that.

And I disagree with annoying confirmation dialogs.

So it turns out that we can only provide some special paste option where the formatting is kept (but existing styles are not overwritten, meaning it gets a the name).

Not worth the effort, IMO, since the use case is weak (comment 12).
Comment 18 Franklin Weng 2023-05-17 02:33:49 UTC
(In reply to Heiko Tietze from comment #17)
> (In reply to Mike Kaganski from comment #16)
> > Please don't introduce this "redefine if unused". I could agree with
> > "redefine all if explicitly requested", but not that.
> 
> And I disagree with annoying confirmation dialogs.
> 
> So it turns out that we can only provide some special paste option where the
> formatting is kept (but existing styles are not overwritten, meaning it gets
> a the name).
> 
> Not worth the effort, IMO, since the use case is weak (comment 12).

Honestly, such use case is frequently asked here.  I.e., they copied a paragraph from one text document and paste into another file (maybe new, maybe existing) and asked to keep the original paragraph style.  It seems to be a default behavior in Microsoft Word, as the users said.