There is a significant difference in how LibreOffice Writer handles images anchored to a paragraph when the parent paragraph is deleted, depending on the file format of the document:
– If the format of the document is DOCX, deleting the paragraph also deletes the image.
– If the format of the document is ODT, deleting the paragraph simply causes the image to move up one paragraph.
The issue is more apparent when the paragraph contains only one single character besides the anchor of image:
– If the format of the document is DOCX, selecting the only character in the paragraph also marks the image as selected.
– If the format of the document is ODT, selecting the only character in the paragraph doesn't mark the image as selected.
Steps to Reproduce:
1.Create a new text document in LibreOffice Writer, and add a few paragraphs of random text.
2.Create an empty paragraph somewhere in the document and insert an image by clicking on Insert > Image. Writer inserts the image anchored to paragraph by default, so there is no need to change that.
3.Save the document both as ODT and DOCX.
4.Close the document and reopen both the ODT and DOCX file in Writer.
5.Delete the paragraph containing the image in both versions of the document.
The image disappears from the DOCX document, and moves up one paragraph in the ODT document
The image should move up one paragraph both in the DOCX and the ODT document.
User Profile Reset: No
Created attachment 146475 [details]
The original document in ODT format.
Created attachment 146476 [details]
The same document saved as DOCX.
Created attachment 146477 [details]
A screenshot showcasing the issue.
I can't reproduce this in
Version: 126.96.36.199.alpha1+ (x64)
Build ID: 8274c4c62df5b937b3f0bec9e1eeca85f3b219d4
CPU threads: 4; OS: Windows 10.0; UI render: GL; VCL: win;
TinderBox: Win-x86_64@42, Branch:master, Time: 2018-10-22_01:47:50
Locale: en-US (de_DE); Calc: CL
And there is another observation: When I save the odt-file as docx and reopen, the image is anchered to character insted of paragrph (see attachment from comment 2); I couldn't find, that this bug is reported yet.
*** Bug 122103 has been marked as a duplicate of this bug. ***
I can not confirm with Version: 188.8.131.52.alpha0+
Build ID: 0ad2302cf6787cacbbaca081a890a0e356a55297
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3;
Image is still in docx file.
(In reply to raal from comment #6)
> I can not confirm with Version: 184.108.40.206.alpha0+
> Build ID: 0ad2302cf6787cacbbaca081a890a0e356a55297
> CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3;
> Image is still in docx file.
I can still reproduce, but it's a bit tricky.
There is another example file in the duplicate bug, with more straightforward steps.
Here, the paragraph you should delete is the one containing the number 5:
place the cursor at the beginning of the paragraph and press Del twice.
The image should disappear with a current-ish master.
Created attachment 147629 [details]
Video showing the odt and docx with the image disappearing
I can reproduce it
1. Open docx
2. Delete 5
2. Put cursor and the beginning of line "Sixth paragraph"
3. Press delete
Version: 220.127.116.11.beta1 (x64)
Build ID: d1b41307be3f8c19fe6f1938cf056e7ff1eb1d18
CPU threads: 4; OS: Windows 10.0; UI render: default; VCL: win;
Locale: en-US (de_DE); UI-Language: en-GB
see also bug 122103 comment 5
the DOCX vs ODT here is a bit incidental; the real difference is the at-character vs. at-paragraph anchor.
it's just that MS Word only supports 2 anchor types (as-character / at-character), so the at-paragraph anchor necessarily becomes at-character after a round-trip in Word formats.
we have thought already about the at-character case in editing operations (see commit 28b77c89dfcafae82cf2a6d85731b643ff9290e5) so probably the way to go is to adapt the at-paragraph case to work consistently with that.
clearly the current behavior where at-paragraph fly is shown as selected but then it survives a delete operation is a bug; i disagree with the Expected Results in the description and propose instead that the fly should be deleted in both cases.