diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-01-12 10:13:14 +0100 |
---|---|---|
committer | Xisco Fauli <xiscofauli@libreoffice.org> | 2021-01-13 08:53:38 +0100 |
commit | 21755f2ab58cc053f9555c3d77241689c225d233 (patch) | |
tree | e8d6c85597df5e61986946d4641dab4b11af54ef /oox | |
parent | tdf#83618 Make line spacing values agree crash fix (diff) | |
download | core-21755f2ab58cc053f9555c3d77241689c225d233.tar.gz core-21755f2ab58cc053f9555c3d77241689c225d233.zip |
oox smartart: fix crash in pyra algorithm with a single child shape
Regression from commit 14a56533ff2c9c859d22cd3039ada75b99e94bc0
(SmartArt Pyramid: Now lays out shapes, 2018-07-10), the added pyramid
algorithm by first centering the topmost children, then decrementing the
horizontal postion of each additional shape, with the end goal of having
0 horizontal position of the last children.
This means that simply avoiding the division in the 1-child case leads
to correct results, because in this case the only child is also the last
child at the sane time.
(cherry picked from commit f2e04fe98e313cffa3f98d55eae641415142a431)
Change-Id: Ifd0027e9616b0909dbfde43e1555427b50de4dad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109120
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx index 7f926cc9a5e8..24acaf176491 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx @@ -1286,7 +1286,10 @@ void AlgAtom::layoutShape(const ShapePtr& rShape, const std::vector<Constraint>& for (auto & aCurrShape : rShape->getChildren()) { aCurrShape->setPosition(aCurrPos); - aCurrPos.X -= aChildSize.Height/(nCount-1); + if (nCount > 1) + { + aCurrPos.X -= aChildSize.Height / (nCount - 1); + } aChildSize.Width += aChildSize.Height; aCurrShape->setSize(aChildSize); aCurrShape->setChildSize(aChildSize); |