diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2019-01-18 15:48:57 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-01-18 20:43:00 +0100 |
commit | 1791e08e9f27453ac5563ef400c715e30c791133 (patch) | |
tree | dbfd9aea494667ee8d95dc1f2c24c2da5f46f02e /oox/source/drawingml/diagram | |
parent | 102f42fa6398fa7e6bf8e9bcfa4c28c22473cd26 (diff) |
oox smartart, org chart: fix shape type of connectors
PowerPoint renders these as bent connectors, not as arrow shapes.
Also add a bit of vertical spacing between the nodes, otherwise the
connectors have no way to be visible. Their position is still incorrect,
though.
Change-Id: I995930c0bbc1bdb1014face2490be392571548a2
Reviewed-on: https://gerrit.libreoffice.org/66627
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'oox/source/drawingml/diagram')
-rw-r--r-- | oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx index 4495ae8a570d..f7da2cc03515 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx @@ -79,21 +79,32 @@ sal_Int32 getConnectorType(const oox::drawingml::LayoutNode* pNode) if (!pAlgAtom) continue; - if (pAlgAtom->getType() != oox::XML_lin) - continue; - - sal_Int32 nDir = oox::XML_fromL; - if (pAlgAtom->getMap().count(oox::XML_linDir)) - nDir = pAlgAtom->getMap().find(oox::XML_linDir)->second; - - switch (nDir) + switch (pAlgAtom->getType()) { - case oox::XML_fromL: - nType = oox::XML_rightArrow; + case oox::XML_lin: + { + sal_Int32 nDir = oox::XML_fromL; + if (pAlgAtom->getMap().count(oox::XML_linDir)) + nDir = pAlgAtom->getMap().find(oox::XML_linDir)->second; + + switch (nDir) + { + case oox::XML_fromL: + nType = oox::XML_rightArrow; + break; + case oox::XML_fromR: + nType = oox::XML_leftArrow; + break; + } break; - case oox::XML_fromR: - nType = oox::XML_leftArrow; + } + case oox::XML_hierChild: + { + // TODO <dgm:param type="connRout" val="..."/> should be able + // to customize this. + nType = oox::XML_bentConnector3; break; + } } } @@ -618,6 +629,7 @@ void AlgAtom::layoutShape( const ShapePtr& rShape, break; sal_Int32 nCount = rShape->getChildren().size(); + double fSpace = 0.3; if (mnType == XML_hierChild) { @@ -652,7 +664,7 @@ void AlgAtom::layoutShape( const ShapePtr& rShape, awt::Size aChildSize = rShape->getSize(); if (nDir == XML_fromT) { - aChildSize.Height /= nCount; + aChildSize.Height /= (nCount + nCount * fSpace); } else aChildSize.Width /= nCount; @@ -672,7 +684,7 @@ void AlgAtom::layoutShape( const ShapePtr& rShape, continue; if (nDir == XML_fromT) - aChildPos.Y += aChildSize.Height; + aChildPos.Y += aChildSize.Height + aChildSize.Height * fSpace; else aChildPos.X += aChildSize.Width; } |