suspicious member 'mnDiagramRotation' in class Shape in oox

Regina Henschel rb.henschel at t-online.de
Fri Jul 15 15:27:13 UTC 2022


Hi all,

The class Shape has a member 'mnDiagramRotation' (#376), which can be 
set by setDiagramRotation() (#164)
https://opengrok.libreoffice.org/xref/core/include/oox/drawingml/shape.hxx

It has a comment
    // rotates shape prior to sizing, does not affect text rotation

It is set in
https://opengrok.libreoffice.org/xref/core/oox/source/drawingml/diagram/layoutnodecontext.cxx?r=08489c21#242

And evaluated in CreateAndInsert() in
https://opengrok.libreoffice.org/xref/core/oox/source/drawingml/shape.cxx?r=79f3abc0
886      // Special for SmartArt import. Rotate diagram's shape around 
object's center before sizing.
887      if (bUseRotationTransform && mnDiagramRotation != 0)
888      {
889          aTransformation.translate(-0.5, -0.5);
890 
aTransformation.rotate(basegfx::deg2rad<60000>(mnDiagramRotation));
891          aTransformation.translate(0.5, 0.5);
892      }

and in
1693                  nTextRotateAngle -= mnDiagramRotation;


(1) The comment makes no sense to me. A shape rotation prior to sizing 
is unlikely, because it would introduce shearing of the shape.
(2) Isn't the rotation of the shapes on opening a diagram taken from 
drawing.xml not from layout.xml ?
(3) In all my tests the value of mnDiagramRotation was always zero in 
CreateAndInsert(). In which scenario is
pShape->setDiagramRotation(rAttribs.getInteger(XML_rot, 0) * PER_DEGREE);
in layoutnodecontext.cxx triggert?
(4) Do you have an example file, where mnDiagramRotation has a value 
different from zero?

Kind regards,
Regina











More information about the LibreOffice mailing list