Bug 124764 - Paste structured text without format but with styles
Summary: Paste structured text without format but with styles
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Matters-to-Caolan Paste-Special
  Show dependency treegraph
 
Reported: 2019-04-16 06:35 UTC by Eric L.
Modified: 2019-06-01 08:01 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 Eric L. 2019-04-16 06:35:04 UTC
In all tools, especially Writer and Impress, but also the others, if you cut&paste text or objects from one document to the next, you get each time new styles Default_1 etc, even if the two documents are actually different versions of the same document that you are merging back, and the styles are actually the same.

But even if you paste text from different documents/styles, you generally want the final text to look all the same and not want e.g. "body" text to look in 3 different ways in your text or presentation.

So the enhancement would be to have a special paste mode which keeps the style structure (i.e. a heading remains a heading, a list a list, etc) of the pasted text but it is being mapped to the style existing in the target document, so that the document is maximally homogeneous.

This is a feature that even MS Word doesn't have, which would be a great differentiator (how many Frankenstein texts have you seen in your life, and tried to fix, with bullet lists looking different depending on who wrote the original piece of text?).

Additionally, it would be nice if:

* this new pasting mode could be made the default mode, I rarely want something else
* also things like HTML would be pasted similarly (e.g. H1 mapped to "Heading 1")
* hard _character_ formatting would be kept (not hard formatting of whole paragraphs)

Last but not least:

* it's not the same as pasting as text, as you lose all kind of structure
* it's not the same approach as Bug #83102 which just takes the style of the one chapter it is being pasted into
Comment 1 V Stuart Foote 2019-04-16 15:30:58 UTC
There would rarely, if ever, be a 1-to-1 mapping so we would have to provide a UI to manually make the style assignments. 

Or if done more simply, i.e. import into target document with template default(s) for the element type(s), could ask user to validate the import to that style--or choose to make it unformatted text. More involved would be to offer import to a different style than template default(s).

But at least it could clear out the source document style(s) and not bloat the target document.
Comment 2 Heiko Tietze 2019-04-17 09:36:43 UTC
We have a similar discussion for Impress (bug 124764) where it's not so clear which master slide should be used when copying a slide. The same is true in Writer: you may want to override the existing style, eg. Heading, with what you paste but similarly you want to keep the target's style (see bug 98381). 

Ideally we have options in paste special, a) override target styles, b) override source styles, and c) add new styles. H1s (Heading 1 from source) with serif font pasted in H1t with sans serif makes a) H1 = serif (changing everything in this document that relates to H1), b) changes the source from serif to sans when pasted, and c) creates a "Heading 1_1". Today we do a) when the document is new and b) if it contains content.

An elaborated UI blocks the workflow and wouldn't be not a good option in my opinion. Another bad alternative is to have an undo stack (paste does insert text then apply style then direct formatting, or the like)- also not a good solution as very intransparent to the user.
Comment 3 Eric L. 2019-04-22 06:47:52 UTC
I wouldn't overdo it at first and simply merge styles with the same name and add styles with different names.

The use case (for me) is mainly a master document where I've spent time having the styles looking like I want them, and cut&pasting elements (text, slides, etc) from other similar documents, either:

1. because I write a document together with others and need to insert their stuff into my master document.
2. even more frequently, I just have a standard template, adapt it for my customers, write a cool thing I could reuse and want to bring it back into my initial template.

In both cases, the styles are more or less the same ones and the ones not matching are only a few.

For the use case of cut&pasting texts with wildly different style structures, I would rather suggest a separate "search & replace styles" dialog, which could also be used for other use cases, like cleaning up the styles of an already existing document. I would actually volunteer to create a separate ticket for this aspect.
Comment 4 Eric L. 2019-04-22 06:57:00 UTC
The search & replace styles topic already has its meta bug: https://bugs.documentfoundation.org/show_bug.cgi?id=106876 so I'd like to keep it out of this bug, if you don't mind.
Comment 5 Eric L. 2019-04-22 06:59:11 UTC
(In reply to Heiko Tietze from comment #2)
> We have a similar discussion for Impress (bug 124764) where it's not so

cut & paste issue I guess :-) this is the bug number of the current bug, not another one!
Comment 6 Cor Nouws 2019-04-22 19:49:50 UTC
Hi Eric,

(In reply to Eric L. from comment #0)
> In all tools, especially Writer and Impress, but also the others, if you
> cut&paste text or objects from one document to the next, you get each time
> new styles Default_1 etc, even if the two documents are actually different
> versions of the same document that you are merging back, and the styles are
> actually the same.

I do not recognize this.
In my experience:
Copy from B to A: text with style X gets the formatting that is has in document A íf the style is already in use.

> But even if you paste text from different documents/styles, you generally
> want the final text to look all the same and not want e.g. "body" text to
> look in 3 different ways in your text or presentation.

Can you give some sample documents?
version A and B of each in Writer and Impress please?

What version did you see this?

Greetings,
Cor
Comment 7 Heiko Tietze 2019-05-28 08:22:35 UTC
@Eric: Please reply to comment 6. Otherwise we have to resolve the issue due to insufficientdata.
Comment 8 Eric L. 2019-05-28 19:19:34 UTC
I'm quite flabbergasted: my experience was completely different and I've got plenty of documents with demultiplied styles, but I can't reproduce it with a clean document, neither with Writer nor with Impress.

I've still got one of those presentations at work, let me try it again with it.
Comment 9 QA Administrators 2019-05-29 02:53:55 UTC Comment hidden (obsolete)
Comment 10 Heiko Tietze 2019-06-01 08:01:54 UTC
(In reply to Eric L. from comment #8)
> I'm quite flabbergasted: my experience was completely different and I've got
> plenty of documents with demultiplied styles, but I can't reproduce it with
> a clean document, neither with Writer nor with Impress.
> 
> I've still got one of those presentations at work, let me try it again with
> it.

So let's close this for now and continue at the other issues (see c2). Feel free to reopen in case your workflow is different.