Questions about ScDrawLayer::RecalcPos

Regina Henschel rb.henschel at t-online.de
Sat Sep 26 16:50:33 UTC 2020


Hi all,

I want to fix tdf#137020 "FILEOPEN Vertical flipped, cell anchored 
shapes have wrong position on opening". The error happens in 
ScDrawLayer::RecalcPos in sc\source\core\data\drwlayer.cxx. Vertical 
flipped custom shapes have an additional 180deg rotation, which is not 
considered when calculating the rectangles.

But before I can start, I need to be sure, that I understand the context 
correctly. Therefore some questions.

(A) There is (#947) a condition "if (rData.getShapeRect().IsEmpty())". 
That condition is met, if the file is opened.
Is it always met on opening?
Are there other situations in which the condition is met?

(B) After ScDrawLayer::RecalcPos is finished, the UserDataList in 
PlusData of the shape will have two items of ScDrawObjData of kind 
SC_UD_OBJDATA. The first one corresponds to rData, the second one to 
rNoRotatedAnchor in method RecalcPos. Correct?

The member maShapeRect in the first item will be the same as maSnapRect 
of the shape, and maShapeRect in the second item will be the same as 
maRect of the shape. In both cases hidden row/col are treated as zero 
for maShapeRect. Correct?

But maStart, maEnd and their offsets in the first item will be taken 
from the snap rectangle of the shape, whereby hidden row/col are not 
treated as zero, whereas the second item has them taken from the logic 
rectangle of the shape and hidden row/col are treated as zero. Correct?

(C) In case XML has an attribute table:end-cell-address, the 
ScAnchorType is SCA_CELL_RESIZE. In that case XML-import has not 
produced valid values for maRect (logic rectangle) of the shape, because 
row/col size and hidden state are not known at that place. And more, ODF 
has the rule to ignore svg:width and svg:height in that case, and these 
size attributes need not exist at all. So I would expect as first action 
in RecalcPos in that case, that maRect gets current, valid values 
considering maStart, maEnd and their offsets in rData. That does not 
happen. Why?

(D) In case SCA_CELL, the XML-import has produced valid values for 
maRect and maSnapRect of the shape. They are overwritten with values 
generated from the anchor. Reason? I would expect, that at least 
rNoRotatedAnchor uses the values from the XML-import directly in this case.

Kind regards
Regina


More information about the LibreOffice mailing list