diff options
author | Grzegorz Araminowicz <g.araminowicz@gmail.com> | 2017-08-22 17:04:01 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2017-08-30 13:55:36 +0200 |
commit | 79b5d5037ba32f30ee383402314e12bfa965fb02 (patch) | |
tree | af438495899e9c4b32a6baca29f95ea88f491c21 /oox | |
parent | 8ff306d81be73cedec940ae996d73f4e3a4a6422 (diff) |
SmartArt: grDir snake algorithm parameter
Change-Id: I643ed981cc9d02e5118f09a3c04abcea2fc5ecd7
Reviewed-on: https://gerrit.libreoffice.org/41516
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 26 |
1 files changed, 21 insertions, 5 deletions
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; } } |