[REVIEW 3-5] calc import filters sometimes get shape positions badly wrong ( fdo##49430 )

Noel Power nopower at suse.com
Fri May 4 02:33:37 PDT 2012


The bug https://bugs.freedesktop.org/show_bug.cgi?id=49430 has lots of 
detail, screenshots, sample documents etc.

In summary the import filters seem to calculate the shape positions 
incorrectly, the further down the document the shape is, the more 
incorrect the position can be. In the case of the xlsx filter it seems 
the row height adjustment that is made at the end of the import makes a 
difference but additionally non-uniform row heights, document content 
and zoom factor all seem to affect the position error.
Worryingly there seems to be a rather bizarre effect present even in 
'normal' calc documents where depending on the document content we can 
find that the desired anchor position of a shape and the actual position 
it is drawn at are skewed. There seems to be some issue with how the 
drawing layer and the grid/view part calculate positions :/ they just 
don't agree. ( see attachments - note the actual cell anchoring position 
is indicated by the cell bordered in red ). This effect of course also 
has a bearing on the filter(s) because they also get the same error when 
attempting to calculate the position of the shape. The patch attempts to 
address this by an inglorious hack ( that works well ) where when the 
shapes ( which have an anchor ) are imported we save the anchor position 
by actually making the shapes cell anchored, then at the end of the 
import ( and after any strange resizing of rows or other things that may 
happen on import to affect things ) we remove the cell anchoring, 
recalculate the shape position ( but recalculate it the way the 
grid/view does ) and position the shapes absolutely. Ideally we would of 
course like to just keep the shapes cell anchored ( where appropriate ) 
but because of the pre-existing potential anchor skew this just isn't 
feasible.

Eike I cc you here as maybe you can shed some light on this weirdness ( 
I confess it confuses the hell out me )
otoh I think this patch is safe, it also addresses another issue ( see 
details in bug ) where sometimes ( like in the attached test document ) 
the shape size is imported incorrectly and the shape may not be visible.

Note: for the xlsx import ole controls are not 'corrected' I need to a 
little more effort to make that work ( binary import though handles them 
fine ) I will send a follow up patch for that.

thanks

Noel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SkewedAnchor-3.5.png
Type: image/png
Size: 13549 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20120504/2cf67c65/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: anotheranchorskew.ods
Type: application/vnd.oasis.opendocument.spreadsheet
Size: 8326 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20120504/2cf67c65/attachment-0001.ods>


More information about the LibreOffice mailing list