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

New commits:
commit 994cb67e02342a1548a4a77dd3a6a73a368a25ca
Author:     ekuiitr <jhaekans...@gmail.com>
AuthorDate: Tue Jul 10 23:28:56 2018 +0530
Commit:     Thorsten Behrens <thorsten.behr...@cib.de>
CommitDate: Tue Mar 12 04:13:34 2019 +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>
    Reviewed-on: https://gerrit.libreoffice.org/69051
    Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>
    Tested-by: Thorsten Behrens <thorsten.behr...@cib.de>

diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx 
b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index 13b327943159..876eb3d06c8d 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -821,7 +821,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