From 8638cc1b737195df16a160b148d2cd2c68131174 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 14 Jan 2019 15:10:19 +0100 Subject: oox smartart, org chart: fix height of manager nodes without employees Employees and/or assistants reduce the height of managers -- this effect is wanted even if there are no employees/assistants. Change-Id: I7bfcbf6819ee225aa2fbf21d4e064322912f8d5f Reviewed-on: https://gerrit.libreoffice.org/66304 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'oox') diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx index e768bebf362d..0e091da68b0e 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx @@ -552,6 +552,13 @@ void AlgAtom::layoutShape( const ShapePtr& rShape, sal_Int32 nCount = rShape->getChildren().size(); + // A manager node's height should be indepdenent from if it has + // assistants and employees, compensate for that. + bool bTop = mnType == XML_hierRoot && rShape->getInternalName() == "hierRoot1"; + double fHeightScale = 1.0; + if (mnType == XML_hierRoot && nCount < 3 && bTop) + fHeightScale = fHeightScale * nCount / 3; + if (mnType == XML_hierRoot && nCount == 3) { // Order assistant nodes above employee nodes. @@ -563,7 +570,10 @@ void AlgAtom::layoutShape( const ShapePtr& rShape, awt::Size aChildSize = rShape->getSize(); if (nDir == XML_fromT) + { aChildSize.Height /= nCount; + aChildSize.Height *= fHeightScale; + } else aChildSize.Width /= nCount; -- cgit