summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorGrzegorz Araminowicz <grzegorz.araminowicz@collabora.com>2019-07-04 16:16:47 +0200
committerGrzegorz Araminowicz <grzegorz.araminowicz@collabora.com>2019-07-05 15:23:40 +0200
commit329c814d28c7773e64e5902ffb1aa4877e4131f1 (patch)
treedc5ce6b55b9490596bb36259d181993dfb4d4687 /oox
parent4b557c96597a9bbb51677fd83bac98a2edbb9db1 (diff)
SmartArt: remove calculateHierChildOffsetScale() from org chart algorithm
Its purpose was to center subtree if sibling parent has no children. It was not working correctly for complex charts causing shapes to overlap. Without it chart is still readable (just sometimes not centered). Remove it for now until more universal solution is found. Change-Id: I397bd4264d6ce0fadf5c5fa1352f22e72d5d163a Reviewed-on: https://gerrit.libreoffice.org/75092 Tested-by: Jenkins Reviewed-by: Grzegorz Araminowicz <grzegorz.araminowicz@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/diagram/diagramlayoutatoms.cxx55
1 files changed, 2 insertions, 53 deletions
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index 6a8ffd2c4b3e..a981dd99138c 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -105,51 +105,6 @@ bool containsDataNodeType(const oox::drawingml::ShapePtr& pShape, sal_Int32 nTyp
return false;
}
-/**
- * Calculates the offset and scaling for pShape (laid out with the hierChild
- * algorithm) based on the siblings of pParent.
- */
-void calculateHierChildOffsetScale(const oox::drawingml::ShapePtr& pShape,
- const oox::drawingml::LayoutNode* pParent, sal_Int32& rXOffset,
- double& rWidthScale, sal_Int32 nLevel)
-{
- if (!pParent)
- return;
-
- auto pShapes = pParent->getNodeShapes().find(nLevel - 1);
- if (pShapes == pParent->getNodeShapes().end())
- return;
-
- const std::vector<oox::drawingml::ShapePtr>& rParents = pShapes->second;
- for (size_t nParent = 0; nParent < rParents.size(); ++nParent)
- {
- const oox::drawingml::ShapePtr& pParentShape = rParents[nParent];
- const std::vector<oox::drawingml::ShapePtr>& rChildren = pParentShape->getChildren();
- if (std::none_of(rChildren.begin(), rChildren.end(),
- [pShape](const oox::drawingml::ShapePtr& pChild) { return pChild == pShape; }))
- // This is not our parent.
- continue;
-
- if (nParent > 0)
- {
- if (rParents[nParent - 1]->getChildren().size() == 1)
- {
- // Previous sibling of our parent has no children: can use that
- // space, so shift to the left and scale up.
- rWidthScale += 1.0;
- rXOffset -= pShape->getSize().Width;
- }
- }
- if (nParent < rParents.size() - 1)
- {
- if (rParents[nParent + 1]->getChildren().size() == 1)
- // Next sibling of our parent has no children: can use that
- // space, so scale up.
- rWidthScale += 1.0;
- }
- }
-}
-
/// Sets the position and size of a connector inside a hierChild algorithm.
void setHierChildConnPosSize(const oox::drawingml::ShapePtr& pShape)
{
@@ -465,7 +420,7 @@ sal_Int32 AlgAtom::getConnectorType()
void AlgAtom::layoutShape( const ShapePtr& rShape,
const std::vector<Constraint>& rConstraints,
- sal_Int32 nShapeLevel )
+ sal_Int32 /*nShapeLevel*/ )
{
switch(mnType)
{
@@ -750,11 +705,6 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
std::swap(rChildren[1], rChildren[2]);
}
- sal_Int32 nXOffset = 0;
- double fWidthScale = 1.0;
- if (mnType == XML_hierChild)
- calculateHierChildOffsetScale(rShape, getLayoutNode().getParentLayoutNode(), nXOffset, fWidthScale, nShapeLevel);
-
awt::Size aChildSize = rShape->getSize();
if (nDir == XML_fromT)
{
@@ -763,11 +713,10 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
else
aChildSize.Width /= nCount;
aChildSize.Height *= fHeightScale;
- aChildSize.Width *= fWidthScale;
awt::Size aConnectorSize = aChildSize;
aConnectorSize.Width = 1;
- awt::Point aChildPos(nXOffset, 0);
+ awt::Point aChildPos(0, 0);
for (auto& pChild : rShape->getChildren())
{
pChild->setPosition(aChildPos);