summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--oox/source/drawingml/diagram/diagramlayoutatoms.cxx40
-rw-r--r--sd/qa/unit/import-tests-smartart.cxx4
2 files changed, 30 insertions, 14 deletions
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index 4495ae8a570d..f7da2cc03515 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -79,21 +79,32 @@ sal_Int32 getConnectorType(const oox::drawingml::LayoutNode* pNode)
if (!pAlgAtom)
continue;
- if (pAlgAtom->getType() != oox::XML_lin)
- continue;
-
- sal_Int32 nDir = oox::XML_fromL;
- if (pAlgAtom->getMap().count(oox::XML_linDir))
- nDir = pAlgAtom->getMap().find(oox::XML_linDir)->second;
-
- switch (nDir)
+ switch (pAlgAtom->getType())
{
- case oox::XML_fromL:
- nType = oox::XML_rightArrow;
+ case oox::XML_lin:
+ {
+ sal_Int32 nDir = oox::XML_fromL;
+ if (pAlgAtom->getMap().count(oox::XML_linDir))
+ nDir = pAlgAtom->getMap().find(oox::XML_linDir)->second;
+
+ switch (nDir)
+ {
+ case oox::XML_fromL:
+ nType = oox::XML_rightArrow;
+ break;
+ case oox::XML_fromR:
+ nType = oox::XML_leftArrow;
+ break;
+ }
break;
- case oox::XML_fromR:
- nType = oox::XML_leftArrow;
+ }
+ case oox::XML_hierChild:
+ {
+ // TODO <dgm:param type="connRout" val="..."/> should be able
+ // to customize this.
+ nType = oox::XML_bentConnector3;
break;
+ }
}
}
@@ -618,6 +629,7 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
break;
sal_Int32 nCount = rShape->getChildren().size();
+ double fSpace = 0.3;
if (mnType == XML_hierChild)
{
@@ -652,7 +664,7 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
awt::Size aChildSize = rShape->getSize();
if (nDir == XML_fromT)
{
- aChildSize.Height /= nCount;
+ aChildSize.Height /= (nCount + nCount * fSpace);
}
else
aChildSize.Width /= nCount;
@@ -672,7 +684,7 @@ void AlgAtom::layoutShape( const ShapePtr& rShape,
continue;
if (nDir == XML_fromT)
- aChildPos.Y += aChildSize.Height;
+ aChildPos.Y += aChildSize.Height + aChildSize.Height * fSpace;
else
aChildPos.X += aChildSize.Width;
}
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx
index 34b9ea439544..ee25c47fbd8e 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -796,6 +796,10 @@ void SdImportTestSmartArt::testOrgChart()
// manager2 has no assistants / employees.
CPPUNIT_ASSERT_GREATER(aManagerSize.Width, aEmployeeSize.Width + aEmployee2Size.Width);
+ // Without the accompanying fix in place, this test would have failed: an
+ // employee was exactly the third of the total height, without any spacing.
+ CPPUNIT_ASSERT_LESS(xGroup->getSize().Height / 3, aEmployeeSize.Height);
+
xDocShRef->DoClose();
}