diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-02-28 15:00:01 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-02-28 20:27:12 +0100 |
commit | f4fbb127897ea6afe27055d3b6cfcb0441080902 (patch) | |
tree | 5949d20ae0d64709ffa629405542abf783ddcb5d /oox/source | |
parent | 609ea85b530185910bf326201f785fd32bcbad2b (diff) |
oox smartart, picture strip: fix too wide child shapes
Once the constraints determine the size, the aspect ratio may shrink one
dimension to achieve the requested ratio. Implement the case where a >1
ratio shrinks the width, so the container of the image-text shape pair
has correct aspect ratio.
Change-Id: I7bac764c031e80bac532c4f97ebd5b5096401096
Reviewed-on: https://gerrit.libreoffice.org/68510
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'oox/source')
-rw-r--r-- | oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx index 7dc6e7622cb0..336760575339 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx @@ -985,7 +985,14 @@ void AlgAtom::layoutShape( const ShapePtr& rShape, nNumSpaces += 4; sal_Int32 nHeight = rShape->getSize().Height / (nRow + (nRow + nNumSpaces) * fSpace); - aChildSize = awt::Size(rShape->getSize().Width, nHeight); + + if (fChildAspectRatio > 1) + { + // Shrink width if the aspect ratio requires it. + nWidth = std::min(rShape->getSize().Width, + static_cast<sal_Int32>(nHeight * fChildAspectRatio)); + aChildSize = awt::Size(nWidth, nHeight); + } } awt::Point aCurrPos(0, 0); |