This may be related to a lot of other bugs, but I'm not sure.
There is a frame in the test file. Within the frame, there is a table with only one cell. Within this, there is a small image.
(The table is put into a frame, so you can move it around in LO Writer)
Steps to Reproduce:
1. open the test file in Writer
The image is outside the frame
The image should be in the frame (see attached PDF)
User Profile Reset: No
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0
Created attachment 139195 [details]
Created attachment 139196 [details]
LO Writer (current master) render
Created attachment 139197 [details]
MSO 2013 render
Build ID: 226804c8f7d2306562380283edfd919a88863807
CPU threads: 4; OS: Linux 4.10; UI render: default; VCL: gtk3;
Locale: ca-ES (ca_ES.UTF-8); Calc: group threaded
Build ID: 3ca42d8d51174010d5e8a32b96e9b4c0b3730a53
Threads 4; Ver: 4.10; Render: default;
Build ID: c15927f20d4727c3b8de68497b6949e72f9e6e9e
Version 184.108.40.206.alpha0+ (Build ID: efca6f15609322f62a35619619a6d5fe5c9bd5a)
Version: 220.127.116.11 (x64)
Build ID: 2524958677847fb3bb44820e40380acbe820f960
CPU threads: 4; OS: Windows 6.19; UI render: default;
Locale: bg-BG (bg_BG); Calc: group
Build ID: d28e10b095b4ee0986fbe86170928bf077da04b9
CPU threads: 4; OS: Windows 10.0; UI render: default;
TinderBox: Win-x86@62-TDF, Branch:MASTER, Time: 2018-01-13_22:59:50
Locale: bg-BG (bg_BG); Calc: group threaded
I investigated the problem but I couldn't find it's cause...
The anchor is set completely wrong. The absolute position "nTopOfAnch" in sw/layout is somewhere at 1700, but it has to be much more in the test file.
The option "layoutInCell" of the docx is somehow recognized because manipulating this value leads to an even worse rendering of the document ...
But then I get lost in the code and I think that some writer expert has to take a deeper look here.
Hi! A small update on this bug.
After import, the doc model dump (nodes.xml) indicates that the image is not located within the table at all. It is attached independ of the table at a separate (empty) node (Thanks to Miklos for the hint!). This seems like a reasonable conclusion, since the image is put at the very beginning of the page and it's anchor is somewhere off the page.
But this can be "fixed" by disabling the "SectionPropertyMap::FloatingTableConversion" in PropertyMap.cxx to avoid calling SwXText::convertToTextFrame. Then, the table layout gets lost (that's bad) but the image is put in context of the table in the nodes.xml. Additionally, the image is placed at the right position within the table!
So, import of all components seems right, but the floating talbe conversion breaks the bonding of table and image.
Disabling/removing line 1689 in sw/core/unocore/unotext.cxx:
-> aAnchor.SetAnchor(aMovePam.Start()); <-
in function SwXText::convertToTextFrame actually leads to a correct result. Then, the old anchor (at node 9) is not overwritten by the new anchor (at node 22). I have no idea where the node 22 comes from.
The content of nodes.xml and the resulting render looks good if the image is anchored at node 9.
So maybe this info helps for future work on this bug!
Created attachment 141194 [details]
Another test file
The second test file contains 2 images. They should be located within the table but appear to be outside