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-11 09:35:25 +0200
commit8eafe9d63e6c265f6104fba3c21fc404a118621d (patch)
tree21d264be5011321f708e613814d39b88b88e7620 /oox
parentf3e1a315cf95e6d798e031afdb9be879052f25f3 (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> Reviewed-on: https://gerrit.libreoffice.org/75392 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/diagram/diagramlayoutatoms.cxx57
1 files changed, 2 insertions, 55 deletions
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index 503f141a4fa7..eff192868c61 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -155,53 +155,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();
- auto it = std::find_if(
- rChildren.begin(), rChildren.end(),
- [pShape](const oox::drawingml::ShapePtr& pChild) { return pChild == pShape; });
- if (it == rChildren.end())
- // 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)
{
@@ -493,7 +446,7 @@ void AlgAtom::accept( LayoutAtomVisitor& rVisitor )
void AlgAtom::layoutShape( const ShapePtr& rShape,
const std::vector<Constraint>& rConstraints,
- sal_Int32 nShapeLevel )
+ sal_Int32 /*nShapeLevel*/ )
{
switch(mnType)
{
@@ -739,11 +692,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)
{
@@ -752,11 +700,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);