summaryrefslogtreecommitdiffstats
path: root/oox
diff options
context:
space:
mode:
authorekuiitr <jhaekansh80@gmail.com>2018-07-10 23:28:56 +0530
committerMiklos Vajna <vmiklos@collabora.com>2018-11-15 10:31:21 +0100
commit14a56533ff2c9c859d22cd3039ada75b99e94bc0 (patch)
treed683a9676dbe5a7b544daaa0d12c1fcbce1c7171 /oox
parentgtktiledviewer: Handle LOK_CALLBACK_SIGNATURE_STATUS to avoid an assert. (diff)
downloadcore-14a56533ff2c9c859d22cd3039ada75b99e94bc0.tar.gz
core-14a56533ff2c9c859d22cd3039ada75b99e94bc0.zip
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 <vmiklos@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/diagram/diagramlayoutatoms.cxx31
1 files changed, 31 insertions, 0 deletions
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:
{