summaryrefslogtreecommitdiffstats
path: root/oox
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-12-01 17:51:11 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2018-12-01 16:52:52 +0100
commitaf843af4c816ef25246c815e187729ec25b2f000 (patch)
tree33d1d43ca64face4f0fb9e8668e7437776c6c44e /oox
parentloplugin:redundantfcast (diff)
downloadcore-af843af4c816ef25246c815e187729ec25b2f000.tar.gz
core-af843af4c816ef25246c815e187729ec25b2f000.zip
tdf#121844: properly implement autoTxRot support
... after commit cf7b97d1328ec2f2c8254abb9ce67d63d9c54c80 Change-Id: If46265f49a85d92254fedb719d76ff7319c092cc Reviewed-on: https://gerrit.libreoffice.org/64396 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/diagram/diagramlayoutatoms.cxx22
1 files changed, 18 insertions, 4 deletions
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index 74cd2ed7d06c..f99126be9bed 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -802,20 +802,34 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
break;
}
+ // ECMA-376-1:2016 21.4.7.5 ST_AutoTextRotation (Auto Text Rotation)
const sal_Int32 nautoTxRot = maMap.count(XML_autoTxRot) ? maMap.find(XML_autoTxRot)->second : XML_upr;
+ sal_Int32 nShapeRot = rShape->getRotation();
+ while (nShapeRot < 0)
+ nShapeRot += 360 * PER_DEGREE;
+ while (nShapeRot > 360 * PER_DEGREE)
+ nShapeRot -= 360 * PER_DEGREE;
switch(nautoTxRot)
{
case XML_upr:
{
- if (rShape->getRotation())
- pTextBody->getTextProperties().moRotation = -F_PI180*90*rShape->getRotation();
+ int n90x = 0;
+ if (nShapeRot >= 315 * PER_DEGREE)
+ /* keep 0 */;
+ else if (nShapeRot > 225 * PER_DEGREE)
+ n90x = -3;
+ else if (nShapeRot >= 135 * PER_DEGREE)
+ n90x = -2;
+ else if (nShapeRot > 45 * PER_DEGREE)
+ n90x = -1;
+ pTextBody->getTextProperties().moRotation = n90x * 90 * PER_DEGREE;
}
break;
case XML_grav:
{
- if (rShape->getRotation()==90*F_PI180 || rShape->getRotation()==180*F_PI180)
- pTextBody->getTextProperties().moRotation = 180*F_PI180;
+ if (nShapeRot > (90 * PER_DEGREE) && nShapeRot < (270 * PER_DEGREE))
+ pTextBody->getTextProperties().moRotation = -180 * PER_DEGREE;
}
break;
case XML_none: