diff options
-rw-r--r-- | oox/source/drawingml/diagram/diagram.cxx | 8 | ||||
-rw-r--r-- | oox/source/drawingml/diagram/diagram.hxx | 8 | ||||
-rw-r--r-- | oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 11 | ||||
-rw-r--r-- | sd/qa/unit/data/pptx/smartart-cycle-matrix.pptx | bin | 61703 -> 56920 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests-smartart.cxx | 4 |
5 files changed, 19 insertions, 12 deletions
diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx index 64dc5dde6d91..97f967280631 100644 --- a/oox/source/drawingml/diagram/diagram.cxx +++ b/oox/source/drawingml/diagram/diagram.cxx @@ -271,8 +271,7 @@ void Diagram::build( ) if( connection.mnType == XML_presOf ) { DiagramData::StringMap::value_type::second_type& rVec=getData()->getPresOfNameMap()[connection.msDestId]; - rVec.emplace_back( - connection.msSourceId,sal_Int32(0)); + rVec[connection.mnDestOrder] = { connection.msSourceId, sal_Int32(0) }; } } @@ -282,9 +281,8 @@ void Diagram::build( ) { for (auto & elem : elemPresOf.second) { - const sal_Int32 nDepth=calcDepth(elem.first, - getData()->getConnections()); - elem.second = nDepth != 0 ? nDepth : -1; + const sal_Int32 nDepth = calcDepth(elem.second.msSourceId, getData()->getConnections()); + elem.second.mnDepth = nDepth != 0 ? nDepth : -1; if (nDepth > getData()->getMaxDepth()) getData()->setMaxDepth(nDepth); } diff --git a/oox/source/drawingml/diagram/diagram.hxx b/oox/source/drawingml/diagram/diagram.hxx index 242ff09fa152..a0955b124230 100644 --- a/oox/source/drawingml/diagram/diagram.hxx +++ b/oox/source/drawingml/diagram/diagram.hxx @@ -160,8 +160,14 @@ public: typedef std::map< OUString, std::vector<dgm::Point*> > PointsNameMap; typedef std::map< OUString, const dgm::Connection* > ConnectionNameMap; + struct SourceIdAndDepth + { + OUString msSourceId; + sal_Int32 mnDepth = 0; + }; + /// Tracks connections: destination id -> {destination order, details} map. typedef std::map< OUString, - std::vector<std::pair<OUString,sal_Int32> > > StringMap; + std::map<sal_Int32, SourceIdAndDepth > > StringMap; DiagramData(); FillPropertiesPtr & getFillProperties() diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx index e57a0115e129..b26c32b6fb4b 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx @@ -1168,11 +1168,12 @@ bool LayoutNode::setupShape( const ShapePtr& rShape, const dgm::Point* pPresNode pPresNode->msModelId); if( aNodeName != mrDgm.getData()->getPresOfNameMap().end() ) { - for( const auto& rItem : aNodeName->second ) + for (const auto& rPair : aNodeName->second) { + const DiagramData::SourceIdAndDepth& rItem = rPair.second; DiagramData::PointNameMap& rMap = mrDgm.getData()->getPointNameMap(); // pPresNode is the presentation node of the aDataNode2 data node. - DiagramData::PointNameMap::const_iterator aDataNode2 = rMap.find(rItem.first); + DiagramData::PointNameMap::const_iterator aDataNode2 = rMap.find(rItem.msSourceId); if (aDataNode2 == rMap.end()) { //busted, skip it @@ -1181,7 +1182,7 @@ bool LayoutNode::setupShape( const ShapePtr& rShape, const dgm::Point* pPresNode rShape->setDataNodeType(aDataNode2->second->mnType); - if( rItem.second == 0 ) + if (rItem.mnDepth == 0) { // grab shape attr from topmost element(s) rShape->getShapeProperties() = aDataNode2->second->mpShape->getShapeProperties(); @@ -1223,8 +1224,8 @@ bool LayoutNode::setupShape( const ShapePtr& rShape, const dgm::Point* pPresNode for (const auto& pSourceParagraph : rSourceParagraphs) { TextParagraph& rPara = pTextBody->addParagraph(); - if (rItem.second != -1) - rPara.getProperties().setLevel(rItem.second); + if (rItem.mnDepth != -1) + rPara.getProperties().setLevel(rItem.mnDepth); for (const auto& pRun : pSourceParagraph->getRuns()) rPara.addRun(pRun); diff --git a/sd/qa/unit/data/pptx/smartart-cycle-matrix.pptx b/sd/qa/unit/data/pptx/smartart-cycle-matrix.pptx Binary files differindex d154e7f64bc0..76b771644cbb 100644 --- a/sd/qa/unit/data/pptx/smartart-cycle-matrix.pptx +++ b/sd/qa/unit/data/pptx/smartart-cycle-matrix.pptx diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx index 29b8ae2d7469..2138b2ccf33b 100644 --- a/sd/qa/unit/import-tests-smartart.cxx +++ b/sd/qa/unit/import-tests-smartart.cxx @@ -853,7 +853,9 @@ void SdImportTestSmartArt::testCycleMatrix() uno::Reference<text::XText> xC2(getChildShape(getChildShape(getChildShape(xGroup, 0), 2), 1), uno::UNO_QUERY); CPPUNIT_ASSERT(xC2.is()); - CPPUNIT_ASSERT_EQUAL(OUString("C2"), xC2->getString()); + // Without the accompanying fix in place, this test would have failed, i.e. the order of the + // lines in the shape were wrong: C2-1\nC2-4\nC2-3\nC2-2. + CPPUNIT_ASSERT_EQUAL(OUString("C2-1\nC2-2\nC2-3\nC2-4"), xC2->getString()); uno::Reference<drawing::XShape> xC2Shape(xC2, uno::UNO_QUERY); CPPUNIT_ASSERT(xC2Shape.is()); |