diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2018-12-21 17:51:17 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2018-12-21 21:39:44 +0100 |
commit | 3103f9f9461f6eabb61a70be73862ef4be98010e (patch) | |
tree | 4198d488f26a88270e7b46f37a7dce8ea5a4b800 /oox/source | |
parent | 856ea829c948dc88aa43a496c2050c608fce3430 (diff) |
oox smartart, org chart: add initial hierChild/Root algorithms
hierChild is supposed to align and position its child layout nodes in a
linear path under the hierRoot layout node, so initially just use a
simple vertical layout algorithm.
Change-Id: Ie0090a724f8fbd2068fa2e08d8bc342290dcc2f0
Reviewed-on: https://gerrit.libreoffice.org/65554
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'oox/source')
-rw-r--r-- | oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx index 1aa8d6753a4a..6af12ed4d26f 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx @@ -523,7 +523,27 @@ void AlgAtom::layoutShape( const ShapePtr& rShape, case XML_hierChild: case XML_hierRoot: + { + if (rShape->getChildren().empty() || rShape->getSize().Width == 0 + || rShape->getSize().Height == 0) + break; + + sal_Int32 nCount = rShape->getChildren().size(); + + awt::Size aChildSize = rShape->getSize(); + aChildSize.Height /= nCount; + + awt::Point aChildPos(0, 0); + for (auto& pChild : rShape->getChildren()) + { + pChild->setPosition(aChildPos); + pChild->setSize(aChildSize); + pChild->setChildSize(aChildSize); + aChildPos.Y += aChildSize.Height; + } + break; + } case XML_lin: { |