Bug 161652 - Impress RTF clipboard copy: lots of unnecessary styles
Summary: Impress RTF clipboard copy: lots of unnecessary styles
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Impress (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Miklos Vajna
URL:
Whiteboard: target:25.2.0 target:24.8.0.0.beta2
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-19 11:35 UTC by Miklos Vajna
Modified: 2024-07-24 17:15 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Impress template with a single word (25.56 KB, application/vnd.oasis.opendocument.presentation)
2024-06-19 11:35 UTC, Miklos Vajna
Details
Clipboard RTF doc with lots of styles. (11.66 KB, application/rtf)
2024-06-26 09:03 UTC, Miklos Vajna
Details
DOCX reproducer with a few bullets. (13.12 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2024-06-26 13:07 UTC, Miklos Vajna
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Miklos Vajna 2024-06-19 11:35:44 UTC
Created attachment 194820 [details]
Impress template with a single word

Steps to reproduce:

1) Open the attached Impress document, it's just an almost empty presentation based on the shipped Beehive template.

2) Double-click on the "beehive" string, Ctrl-C.

3) Create a new Writer document, check the number of styles (Basic macro: ThisComponent.StyleFamilies.ParagraphStyles.getCount()): 126

4) Paste that single word into Writer, and check the number of paragraph styles again.

Expected result: number of paragraph styles is 126 or 127 (+1 is OK if the source paragraph had a style and it's not yet in the Writer document).

Actual result: 221, 95 new paragraph styles for a single word.

When doing such copy&paste a lot, this can lead to hundreds of unnecessary styles, which slows down doc load, save, etc.
Comment 1 Commit Notification 2024-06-20 08:56:53 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

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

tdf#161652 editeng, RTF copy: only write used paragraph styles

It will be available in 25.2.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 2 Commit Notification 2024-06-20 11:05:13 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/70d1bd6ee0eba9d6661cd6280566f77a87f2d068

tdf#161652 editeng, RTF copy: only write used paragraph styles

It will be available in 24.8.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 3 Commit Notification 2024-06-24 17:09:42 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

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

Related: tdf#161652 sw, RTF paste: only keep used paragraph styles

It will be available in 25.2.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 4 Commit Notification 2024-06-25 14:12:33 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/211cc26639fcda194a888155344e52d49dba170f

Related: tdf#161652 sw, RTF paste: only keep used paragraph styles

It will be available in 24.8.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 5 Miklos Vajna 2024-06-26 09:03:25 UTC
Created attachment 194970 [details]
Clipboard RTF doc with lots of styles.
Comment 6 Miklos Vajna 2024-06-26 13:07:37 UTC
Created attachment 194978 [details]
DOCX reproducer with a few bullets.

Related problem: open this file in Writer, select-all, copy, paste as rtf in an other Writer document, then paste as rtf again. First the number of character styles goes from 27 to 55, then to 73. With enough RTF paste, this can lead to thousands of character styles, which slows down the document. It's also inconsistent with paragraph styles, where we don't create or update them if the target document has a paragraph style with a matching name.
Comment 7 Commit Notification 2024-06-27 08:11:48 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/8bc8f073e81d125a8e8f1adce966ddb2c7d6bacb

Related: tdf#161652 sw, RTF paste: avoid duplicated numbering styles

It will be available in 25.2.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 8 Commit Notification 2024-06-28 10:09:33 UTC
Miklos Vajna committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/5f447e9d4e3781c5950b1e5a50da358dc60b305d

Related: tdf#161652 sw, RTF paste: avoid duplicated numbering styles

It will be available in 24.8.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.