Bug 143476

Summary: FILEOPEN DOCX grouped shapes in lockedCanvas have wrong position
Product: LibreOffice Reporter: Regina Henschel <rb.henschel>
Component: WriterAssignee: Regina Henschel <rb.henschel>
Status: RESOLVED FIXED    
Severity: normal CC: libreoffice, xiscofauli
Priority: medium    
Version: 7.3.0.0 alpha0+   
Hardware: x86-64 (AMD64)   
OS: Windows (All)   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=143455
https://bugs.documentfoundation.org/show_bug.cgi?id=143808
Whiteboard: target:7.3.0
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 136328    
Attachments: The example document in Word and Writer
LockedCanvasTwoShapes.docx
lockedCanvas example, containing a small image and a straight line
lockedCanvas example, containing an object
lockedCanvas example, containing a table
lockedCanvas example, containing a chart

Description Regina Henschel 2021-07-21 13:07:43 UTC
Open attachment 129385 [details] from bug 104486. The three shapes in the first page have the same position, but should not.

This error was reported in bug 143455, but is unrelated to that bug.

I see the wrong position, but have not found the reason yet.

This is connected with commit 
https://cgit.freedesktop.org/libreoffice/core/commit/?id=3262fc5ef3bde5b158909d11ccb008161ea95519

author	Regina Henschel <rb.henschel@t-online.de>	2021-05-15 23:40:34 +0200
committer	Miklos Vajna <vmiklos@collabora.com>	2021-06-28 09:49:00 +0200
commit 3262fc5ef3bde5b158909d11ccb008161ea95519 (patch)
tree aa2b4926146eaddaa60878b920da77bd5871f67d
parent 2ffdd37067926ddb841c6055205f267b96706945 (diff)
tdf#142304 a.o. Improve wrap margins in docx filters
Comment 1 Xisco FaulĂ­ 2021-07-21 21:54:31 UTC
Moving to NEW
Comment 2 NISZ LibreOffice Team 2021-07-22 11:59:13 UTC
Created attachment 173771 [details]
The example document in Word and Writer

Version: 7.3.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 0d4cbdbc9cd4ab06056cec66cffd292b41615b6e
CPU threads: 4; OS: Windows 10.0 Build 18363; UI render: Skia/Raster; VCL: win
Locale: hu-HU (hu_HU); UI: en-US
Calc: CL
Comment 3 Regina Henschel 2021-07-26 00:00:39 UTC
The problem is, that that the group is in a lockedCanvas element. I could add a test to skip adaption of position for such shapes. That would give the same positions as in 7.1.

But I hesitate to do so, because in all versions saving the document gives a file, which has lost the groups. So I think, that there is a deeper problem with lockedCanvas and a fix might be needed at a different place.
Comment 4 Regina Henschel 2021-07-27 17:25:23 UTC
Created attachment 173889 [details]
LockedCanvasTwoShapes.docx

There is a deeper problem already in import. The import should create a group instead of the lockedCanvas element. But it imports only one shape.

Open the attachment in Word. You see a rounded rectangle and triangle.
Open the attachment in LO, e.g. in version 6.4.5. You get only the triangle and the triangle has wrong size.

"lockedCanvas" is a special feature of Word 2007, read discussion in thread https://lists.freedesktop.org/archives/libreoffice/2021-July/087658.html.

Using a newer version of Word and saving without "keep compatibility" results in a file, which LO can read and save without problems.
Comment 5 Miklos Vajna 2021-07-29 07:28:27 UTC
Created attachment 173939 [details]
lockedCanvas example, containing a small image and a straight line

As requested at https://www.mail-archive.com/search?l=mid&q=0c5a27de-e127-56a5-4297-59dabfd5ade2@t-online.de
Comment 6 Regina Henschel 2021-07-29 11:44:35 UTC
@Miklos: Thank you. The attached file shows indeed the problem, which I have suspected from reading the code: LibreOffice does neither show the image nor the line.

I'm working on a patch to improve import of lockedCanvas.
Comment 7 Commit Notification 2021-08-04 12:39:59 UTC
Regina Henschel committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/4fb5817ecb614bd0c83afb3627d7caadbfe8c082

tdf#143476 improve import of lockedCanvas

It will be available in 7.3.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 Miklos Vajna 2021-08-10 08:59:28 UTC
Created attachment 174171 [details]
lockedCanvas example, containing an object

In contrast to what I wrote at https://lists.freedesktop.org/archives/libreoffice/2021-August/087718.html, if both an object and a shape is selected and copied from powerpoint to word in MSO 2007, then it's possible to have ole objects in a locked canvas. I attach a sample.
Comment 9 Miklos Vajna 2021-08-10 09:00:02 UTC
Created attachment 174172 [details]
lockedCanvas example, containing a table

Table case: this looks non-interesting, the table is converted to a PNG
Comment 10 Miklos Vajna 2021-08-10 09:00:49 UTC
Created attachment 174173 [details]
lockedCanvas example, containing a chart

Finally a chart sample. Again, need to copy a chart and a shape together to Word, that creates the chart inside the locked canvas.
Comment 11 Regina Henschel 2021-08-10 12:38:11 UTC
Miklos, thank you for the examples. The OLE equation import is good, but the chart is lost. Considering that it is a very special case, I think fixing it has low priority. Nevertheless I have written bug 143808 for it.