oox/source/drawingml/diagram/diagramlayoutatoms.cxx |   31 ++++++++++++++++++++
 1 file changed, 31 insertions(+)

New commits:
commit 14a56533ff2c9c859d22cd3039ada75b99e94bc0
Author:     ekuiitr <jhaekans...@gmail.com>
AuthorDate: Tue Jul 10 23:28:56 2018 +0530
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu Nov 15 10:31:21 2018 +0100

    SmartArt Pyramid: Now lays out shapes
    
    This algorithm was initially not implemented, because of that it was
    not able to show shapes which relates to pyramid, but with this patch,
    It rendered correctly except some minor adjustement values issues which
    can be fixed in upcoming patches.
    
    Change-Id: I298c812615956d67eb00e1b7544d7b171a4ac14a
    Reviewed-on: https://gerrit.libreoffice.org/57241
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx 
b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index 162cc32d12b1..c053aa4c441a 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -531,7 +531,38 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
         }
 
         case XML_pyra:
+        {
+            if (rShape->getChildren().empty() || rShape->getSize().Width == 0 
|| rShape->getSize().Height == 0)
+                break;
+
+            // const sal_Int32 nDir = maMap.count(XML_linDir) ? 
maMap.find(XML_linDir)->second : XML_fromT;
+            // const sal_Int32 npyraAcctPos = maMap.count(XML_pyraAcctPos) ? 
maMap.find(XML_pyraAcctPos)->second : XML_bef;
+            // const sal_Int32 ntxDir = maMap.count(XML_txDir) ? 
maMap.find(XML_txDir)->second : XML_fromT;
+            // const sal_Int32 npyraLvlNode = maMap.count(XML_pyraLvlNode) ? 
maMap.find(XML_pyraLvlNode)->second : XML_level;
+            // uncomment when use in code.
+
+            sal_Int32 nCount = rShape->getChildren().size();
+            double fAspectRatio = 0.32;
+
+            awt::Size aChildSize = rShape->getSize();
+                aChildSize.Width /= nCount;
+                aChildSize.Height /= nCount;
+
+            awt::Point aCurrPos(0, 0);
+                aCurrPos.X = fAspectRatio*aChildSize.Width*(nCount-1);
+                aCurrPos.Y = fAspectRatio*aChildSize.Height;
+
+            for (auto & aCurrShape : rShape->getChildren())
+            {
+                aCurrShape->setPosition(aCurrPos);
+                aCurrPos.X -=  aChildSize.Height/(nCount-1);
+                aChildSize.Width += aChildSize.Height;
+                aCurrShape->setSize(aChildSize);
+                aCurrShape->setChildSize(aChildSize);
+                aCurrPos.Y += (aChildSize.Height);
+            }
             break;
+        }
 
         case XML_snake:
         {
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to