oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 26 ++++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-)
New commits: commit 79b5d5037ba32f30ee383402314e12bfa965fb02 Author: Grzegorz Araminowicz <[email protected]> Date: Tue Aug 22 17:04:01 2017 +0200 SmartArt: grDir snake algorithm parameter Change-Id: I643ed981cc9d02e5118f09a3c04abcea2fc5ecd7 Reviewed-on: https://gerrit.libreoffice.org/41516 Tested-by: Jenkins <[email protected]> Reviewed-by: Jan Holesovsky <[email protected]> diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx index 791381ccda87..147790f9f5db 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx @@ -400,6 +400,17 @@ void AlgAtom::layoutShape( const ShapePtr& rShape, if (rShape->getChildren().empty() || rShape->getSize().Width == 0 || rShape->getSize().Height == 0) break; + const sal_Int32 nDir = maMap.count(XML_grDir) ? maMap.find(XML_grDir)->second : XML_tL; + sal_Int32 nIncX = 1; + sal_Int32 nIncY = 1; + switch (nDir) + { + case XML_tL: nIncX = 1; nIncY = 1; break; + case XML_tR: nIncX = -1; nIncY = 1; break; + case XML_bL: nIncX = 1; nIncY = -1; break; + case XML_bR: nIncX = -1; nIncY = -1; break; + } + // TODO: get values from constraints sal_Int32 nCount = rShape->getChildren().size(); double fSpace = 0.3; @@ -420,8 +431,13 @@ void AlgAtom::layoutShape( const ShapePtr& rShape, sal_Int32 nWidth = rShape->getSize().Width / (nCol + (nCol-1)*fSpace); const awt::Size aChildSize(nWidth, nWidth * fAspectRatio); - awt::Point aStartPos = rShape->getChildren().front()->getPosition(); - awt::Point aCurrPos = aStartPos; + awt::Point aCurrPos(0, 0); + if (nIncX == -1) + aCurrPos.X = rShape->getSize().Width - aChildSize.Width; + if (nIncY == -1) + aCurrPos.Y = rShape->getSize().Height - aChildSize.Height; + + sal_Int32 nStartX = aCurrPos.X; sal_Int32 nColIdx = 0; for (auto & aCurrShape : rShape->getChildren()) @@ -429,11 +445,11 @@ void AlgAtom::layoutShape( const ShapePtr& rShape, aCurrShape->setPosition(aCurrPos); aCurrShape->setSize(aChildSize); aCurrShape->setChildSize(aChildSize); - aCurrPos.X += aChildSize.Width + fSpace*aChildSize.Width; + aCurrPos.X += nIncX * (aChildSize.Width + fSpace*aChildSize.Width); if (++nColIdx == nCol) { - aStartPos.Y += aChildSize.Height + fSpace*aChildSize.Height; - aCurrPos = aStartPos; + aCurrPos.X = nStartX; + aCurrPos.Y += nIncY * (aChildSize.Height + fSpace*aChildSize.Height); nColIdx = 0; } } _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
