Bug 151728 - Pasting text from various programs silently changes various compatibility settings in Writer without the possibility of undoing it
Summary: Pasting text from various programs silently changes various compatibility set...
Status: RESOLVED DUPLICATE of bug 151974
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.4.1.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Formula-Object
  Show dependency treegraph
 
Reported: 2022-10-24 09:14 UTC by Panos Stokas
Modified: 2024-02-07 04:54 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Flat XML documents before and after pasting to compare the changes to ooo:configuration-settings (5.40 KB, application/x-7z-compressed)
2023-01-10 08:01 UTC, Panos Stokas
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Panos Stokas 2022-10-24 09:14:20 UTC
Description:
At some point I noticed that my book's heading styles were broken with an indent that I couldn't remove. I reverted to an earlier backup, losing half an hour of work and then I noticed it happened again: when I pasted the code of a formula under a heading, the heading's style gets irreparably broken. This affects all heading-derivative styles as well. This isn't an issue in LO 7.3.6 but affects 7.4.1 and 7.4.2. I can't test earlier 7.4.x versions.

Steps to Reproduce:
1. Start a new document
2. Type some text and mark it as Heading 1
3. Press enter twice (this will insert 2 text body lines)
4. Insert a formula object and type some text on the formula editor
5. Copy your text from the formula editor
6. Click on the empty line between the heading and the formula
7. Paste your text

Actual Results:
An indent has been added to the Heading 1 style (the STYLE, not some manual formatting that can be cleaned) and cannot be removed from the standard style dialogs. All heading-1 derivative styles are affected.

Undo doesn't work.

Expected Results:
Neither the heading, nor its style should have not been affected in any way.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Please consider giving this bug a very high priority as it may go unnoticed by users until its too late.

If you can fix this by copying formula code as plain text, so much the better! There's absolutely no reason to use the style of the formula editor on content that is meant to be copied on the document itself.
Comment 1 Dieter 2022-11-07 10:15:17 UTC
I confirm it with

Version: 7.4.3.1 (x64) / LibreOffice Community
Build ID: 3793858a34d8fef5b92f8fee233f97766f05e281
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

Result
a) Indent has been added to Heading 1 paragraph. You can delete it manually
b) If you apply PS "Heading 1" to a paragraph, indent is also present, although there is no intend in paragraph style settings

Doesn't happen with

Version: 7.3.6.2 (x86) / LibreOffice Community
Build ID: c28ca90fd6e1a19e189fc16c05f8f8924961e12e
CPU threads: 8; OS: Windows 10.0 Build 14393; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: de-DE
Calc: threaded
Comment 2 Panos Stokas 2023-01-10 08:01:30 UTC
Created attachment 184552 [details]
Flat XML documents before and after pasting to compare the changes to ooo:configuration-settings

This should be helpful:

When pasting the formula code (from LO's own formula editor to Writer), LibreOffice changes several settings under <config:config-item-set config:name="ooo:configuration-settings">.

Specifically, it changes the following to TRUE:

AddFrameOffsets
HeaderSpacingBelowLastPara
TabsRelativeToIndent
TableRowKeep
MsWordCompTrailingBlanks
MsWordCompMinLineHeightByFly
TabOverMargin
ApplyParagraphMarkFormatToNumbering
SurroundTextWrapSmall
FrameAutowidthWithMorePara
NoNumberingShowFollowBy

When I manually reverted (by editing the fodt file) these to FALSE, the problem was fixed.

I'm pretty certain that this settings change may be caused by other reasons, not just pasting formula code.

I must point to the severity of this bug: unless the author notices the issue early, there is no way to revert these settings except through manual editing of the flat XML file. Book authors using LO may have to waste several hours to do manual reverting of each and every instance of styled text.

BTW, I noticed that after pasting the formula code LO also adds the following markup to the document (although this may be normal behavior):

<style:default-page-layout>
   <style:page-layout-properties style:layout-grid-standard-mode="true"/>
</style:default-page-layout>

Anyway, I'm attaching two documents (before and after the paste) for diff comparison to anyone who would try to fix the issue.
Comment 3 Mike Kaganski 2023-01-29 11:59:27 UTC
Regression after commit a7d9837a8aa6d1233f4c21e4db5d32428a3ffc58

Author Vasily Melenchuk <vasily.melenchuk@cib.de>
Date   Thu May 26 12:05:58 2022 +0300
tdf#148360: sw: do not ignore list label followed by
...even if numbering is empty.

However, this change only caused the visible effect (introducing the new NoNumberingShowFollowBy setting), but by itself, did not cause the unexpected change of document compatibility options in general (i.e., even before it, all the other compatibility options did change after the paste). This happened even in the oldest revision of bibisect-win32-4.4 (Build ID: dea4a3b9d7182700abeb4dc756a24a9e8dea8474), changing TabsRelativeToIndent from true to false.
Comment 4 Mike Kaganski 2023-01-29 12:20:27 UTC
(In reply to Mike Kaganski from comment #3)
> This happened even in the oldest revision of bibisect-win32-4.4 (Build ID:
> dea4a3b9d7182700abeb4dc756a24a9e8dea8474), changing TabsRelativeToIndent
> from true to false.

And at least for the mentioned TabsRelativeToIndent, it kept the value 'true' in 3.6, but started to change it to 'false' in 4.0.
Comment 5 lomacar 2023-04-15 02:35:54 UTC
There are strange similarities to bug 147953 which I am waiting to get fixed. https://bugs.documentfoundation.org/show_bug.cgi?id=147953

This bug and 147953 can both be triggered by pasting in any text from MS Word or the Windows character map.

I found this bug on Google by searching for "FrameAutowidthWithMorePara" which seems to be the culprit in 147953. Not sure why it would be applicable here though, since this is an issue with headings and indents, not frames.
Comment 6 Panos Stokas 2023-04-15 04:55:23 UTC
(In reply to lomacar from comment #5)
> There are strange similarities to bug 147953 which I am waiting to get
> fixed. https://bugs.documentfoundation.org/show_bug.cgi?id=147953
> 
> This bug and 147953 can both be triggered by pasting in any text from MS
> Word or the Windows character map.

It's the same issue. I've just copied a character from charmap.exe and my headings broke the same way.
Comment 7 Panos Stokas 2023-04-15 05:05:16 UTC
The issue in the description can be reproduced by replacing LO's formula editor with:

Word
Character Map
an old 8085 emulator
Sticky Notes

The only way to fix the broken format is save the document as a flat XML file and manually edit the settings specified in my previous post: https://bugs.documentfoundation.org/show_bug.cgi?id=151728#c2

It's a pretty big issue I think.
Comment 8 bombjack 2023-06-21 15:36:51 UTC
I can also confirm this bug. "Something" happend to a pretty big document of my documentation. I think I recently copied something over from MS Word.
After that I noticed the indented headings everywhere in my document.

I just tracked that down to the following statement in my ODT file (which is just a ZIP file) in the settings.xml:

<config:config-item config:name="NoNumberingShowFollowBy" config:type="boolean">true</config:config-item>

If I change this to >false< my ODT file seems to show up in normal condition. At least the headings are no longer indented.
As this corruption was introduced some weeks or months ago, when I had no time to care about it, I can not say for sure, if something else is displayed in the wrong way.
Comment 9 Panos Stokas 2023-07-06 08:53:41 UTC
I think the bug has been fixed in version 7.6.0.0.beta1.

I'm following my steps an I can no longer reproduce it.
Comment 10 Vasily Melenchuk (CIB) 2023-07-06 08:57:26 UTC
For me this problem looks very similar to tdf#151974 which is already resolved.
Comment 11 Mike Kaganski 2023-07-06 09:24:51 UTC
Thank you Vasily!

(In reply to Mike Kaganski from comment #4)
> at least for the mentioned TabsRelativeToIndent, it kept the value
> 'true' in 3.6, but started to change it to 'false' in 4.0.

I now think, that this *could* be related to some changes with new RTF parser started to be used for clipboard paste around that time. The code to set the property in DomainMapper ctor was assed earlier, in commit 009e3f4841378f13a2764a2c84e147e401b70525.

*** This bug has been marked as a duplicate of bug 151974 ***
Comment 12 Mike Kaganski 2024-02-07 04:54:49 UTC Comment hidden (obsolete)