summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-09-25 17:27:03 +0200
committerMiklos Vajna <vmiklos@collabora.com>2020-09-30 17:25:14 +0200
commit8e29b74a755ba9fd73d8b62667c70ce3d6552cf4 (patch)
tree8fee1932aa1f0e1a4a841cc72f80e8255c213572 /oox
parent9162014433f1c40b88e1093dfb458436e8ecf007 (diff)
oox smartart: snake algo: consider child's aspect ratio request for cols/rows
If the child's aspect ratio request will shrink the width, then take that into account when calculating how many rows / cols we need. This reduces the number of columns for the bugdoc from 4 to 3, which is needed, but not enough to render it correctly. (cherry picked from commit acc9aead3cc5162379d34a455aa15f7b13907cf1) Change-Id: I1d02df4834b8a2ce97d5e006db0e3135d3d42917 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103700 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/diagram/diagramlayoutatoms.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index 6175832a426d..3ab17ec6904a 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -1322,11 +1322,18 @@ void AlgAtom::layoutShape(const ShapePtr& rShape, const std::vector<Constraint>&
nRow = nCount;
else
{
+ double fShapeHeight = rShape->getSize().Height;
+ double fShapeWidth = rShape->getSize().Width;
+ // Check if we have a child aspect ratio. If so, need to shrink one dimension to
+ // achieve that ratio.
+ if (fChildAspectRatio && fShapeHeight && fChildAspectRatio < (fShapeWidth/fShapeHeight))
+ {
+ fShapeWidth = fShapeHeight * fChildAspectRatio;
+ }
+
for ( ; nRow<nCount; nRow++)
{
nCol = (nCount+nRow-1) / nRow;
- const double fShapeHeight = rShape->getSize().Height;
- const double fShapeWidth = rShape->getSize().Width;
if ((fShapeHeight / nCol) / (fShapeWidth / nRow) >= fAspectRatio)
break;
}