diff options
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 30 | ||||
-rw-r--r-- | oox/source/drawingml/shape.cxx | 1 |
2 files changed, 31 insertions, 0 deletions
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx index 056164276283..dd762a9bc77a 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx @@ -99,6 +99,24 @@ sal_Int32 getConnectorType(const oox::drawingml::LayoutNode* pNode) return nType; } + +/** + * Determines if pShape is (or contains) a presentation of a data node of type + * nType. + */ +bool containsDataNodeType(const oox::drawingml::ShapePtr& pShape, sal_Int32 nType) +{ + if (pShape->getDataNodeType() == nType) + return true; + + for (const auto& pChild : pShape->getChildren()) + { + if (containsDataNodeType(pChild, nType)) + return true; + } + + return false; +} } namespace oox { namespace drawingml { @@ -534,6 +552,15 @@ void AlgAtom::layoutShape( const ShapePtr& rShape, sal_Int32 nCount = rShape->getChildren().size(); + if (mnType == XML_hierRoot && nCount == 3) + { + // Order assistant nodes above employee nodes. + std::vector<ShapePtr>& rChildren = rShape->getChildren(); + if (!containsDataNodeType(rChildren[1], XML_asst) + && containsDataNodeType(rChildren[2], XML_asst)) + std::swap(rChildren[1], rChildren[2]); + } + awt::Size aChildSize = rShape->getSize(); if (nDir == XML_fromT) aChildSize.Height /= nCount; @@ -972,6 +999,7 @@ bool LayoutNode::setupShape( const ShapePtr& rShape, const dgm::Point* pPresNode while( aVecIter != aVecEnd ) { DiagramData::PointNameMap& rMap = mrDgm.getData()->getPointNameMap(); + // pPresNode is the presentation node of the aDataNode2 data node. DiagramData::PointNameMap::const_iterator aDataNode2 = rMap.find(aVecIter->first); if (aDataNode2 == rMap.end()) { @@ -980,6 +1008,8 @@ bool LayoutNode::setupShape( const ShapePtr& rShape, const dgm::Point* pPresNode continue; } + rShape->setDataNodeType(aDataNode2->second->mnType); + if( aVecIter->second == 0 ) { // grab shape attr from topmost element(s) diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 8449082bc774..a3891cb44746 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -178,6 +178,7 @@ Shape::Shape( const ShapePtr& pSourceShape ) , maDiagramDoms( pSourceShape->maDiagramDoms ) , mnZOrder(pSourceShape->mnZOrder) , mnZOrderOff(pSourceShape->mnZOrderOff) +, mnDataNodeType(pSourceShape->mnDataNodeType) {} Shape::~Shape() |