diff options
author | Grzegorz Araminowicz <grzegorz.araminowicz@collabora.com> | 2019-07-07 11:31:22 +0200 |
---|---|---|
committer | Grzegorz Araminowicz <grzegorz.araminowicz@collabora.com> | 2019-07-07 12:47:58 +0200 |
commit | ce7398b028b8d7ef5c914d75d259a6a0979e4644 (patch) | |
tree | f30456e755d95af957804ffb362f37e35b4266ad | |
parent | 44182cd608a961377b3f60c902cf0df16b5a45d8 (diff) |
Revert "SmartArt: support multiple levels of shapes in LayoutNodes"
As we have presentation node - shape mapping, keeping shape level information is no longer needed.
This reverts commit 596a03b65e1b870be671ea1a44f4fba9fc66e4ae.
Change-Id: Ibde1b4afde41778304138253c1548422c5b173c3
Reviewed-on: https://gerrit.libreoffice.org/75173
Tested-by: Jenkins
Reviewed-by: Grzegorz Araminowicz <grzegorz.araminowicz@collabora.com>
5 files changed, 12 insertions, 24 deletions
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx index a981dd99138c..f3c3f52dce04 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx @@ -419,8 +419,7 @@ sal_Int32 AlgAtom::getConnectorType() } void AlgAtom::layoutShape( const ShapePtr& rShape, - const std::vector<Constraint>& rConstraints, - sal_Int32 /*nShapeLevel*/ ) + const std::vector<Constraint>& rConstraints ) { switch(mnType) { diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx index eafe8ce1f1ae..d77a98135c02 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx @@ -161,8 +161,7 @@ public: void addParam( sal_Int32 nType, sal_Int32 nVal ) { maMap[nType]=nVal; } void layoutShape( const ShapePtr& rShape, - const std::vector<Constraint>& rConstraints, - sal_Int32 nShapeLevel ); + const std::vector<Constraint>& rConstraints ); void setAspectRatio(double fAspectRatio) { mfAspectRatio = fAspectRatio; } @@ -237,7 +236,6 @@ class LayoutNode { public: typedef std::map<sal_Int32, OUString> VarMap; - typedef std::map<sal_Int32, std::vector<ShapePtr>> ShapeLevelMap; LayoutNode(const Diagram& rDgm) : LayoutAtom(*this), mrDgm(rDgm), mnChildOrder(0) {} const Diagram& getDiagram() const @@ -255,10 +253,10 @@ public: { mpExistingShape = pShape; } const ShapePtr& getExistingShape() const { return mpExistingShape; } - const ShapeLevelMap& getNodeShapes() const + const std::vector<ShapePtr> & getNodeShapes() const { return mpNodeShapes; } - void addNodeShape(const ShapePtr& pShape, sal_Int32 nLevel) - { mpNodeShapes[nLevel].push_back(pShape); } + void addNodeShape(const ShapePtr& pShape) + { mpNodeShapes.push_back(pShape); } bool setupShape( const ShapePtr& rShape, const dgm::Point* pPresNode ) const; @@ -271,7 +269,7 @@ private: OUString msMoveWith; OUString msStyleLabel; ShapePtr mpExistingShape; - ShapeLevelMap mpNodeShapes; + std::vector<ShapePtr> mpNodeShapes; sal_Int32 mnChildOrder; }; diff --git a/oox/source/drawingml/diagram/layoutatomvisitorbase.cxx b/oox/source/drawingml/diagram/layoutatomvisitorbase.cxx index c8761ffa3d67..98206433653a 100644 --- a/oox/source/drawingml/diagram/layoutatomvisitorbase.cxx +++ b/oox/source/drawingml/diagram/layoutatomvisitorbase.cxx @@ -131,11 +131,9 @@ void LayoutAtomVisitorBase::visit(LayoutNode& rAtom) const dgm::Point* pPreviousNode = mpCurrentNode; mpCurrentNode = pNewNode; - mnCurrLevel++; defaultVisit(rAtom); - mnCurrLevel--; mpCurrentNode = pPreviousNode; } diff --git a/oox/source/drawingml/diagram/layoutatomvisitorbase.hxx b/oox/source/drawingml/diagram/layoutatomvisitorbase.hxx index 25f2b4dea54b..7007cf283070 100644 --- a/oox/source/drawingml/diagram/layoutatomvisitorbase.hxx +++ b/oox/source/drawingml/diagram/layoutatomvisitorbase.hxx @@ -50,8 +50,7 @@ public: mpCurrentNode(pRootPoint), mnCurrIdx(0), mnCurrStep(0), - mnCurrCnt(0), - mnCurrLevel(0) + mnCurrCnt(0) {} void defaultVisit(LayoutAtom const& rAtom); @@ -68,7 +67,6 @@ protected: sal_Int32 mnCurrIdx; sal_Int32 mnCurrStep; sal_Int32 mnCurrCnt; - sal_Int32 mnCurrLevel; }; class ShallowPresNameVisitor : public LayoutAtomVisitorBase diff --git a/oox/source/drawingml/diagram/layoutatomvisitors.cxx b/oox/source/drawingml/diagram/layoutatomvisitors.cxx index b72133033470..31b853664577 100644 --- a/oox/source/drawingml/diagram/layoutatomvisitors.cxx +++ b/oox/source/drawingml/diagram/layoutatomvisitors.cxx @@ -69,7 +69,7 @@ void ShapeCreationVisitor::visit(LayoutNode& rAtom) if (rAtom.setupShape(pShape, pNewNode)) { pShape->setInternalName(rAtom.getName()); - rAtom.addNodeShape(pShape, mnCurrLevel); + rAtom.addNodeShape(pShape); mrDgm.getLayout()->getPresPointShapeMap()[pNewNode] = pShape; } } @@ -83,15 +83,14 @@ void ShapeCreationVisitor::visit(LayoutNode& rAtom) { SAL_INFO( "oox.drawingml", - "processing shape type " << (pShape->getCustomShapeProperties()->getShapePresetType()) - << " level " << mnCurrLevel); + "processing shape type " << (pShape->getCustomShapeProperties()->getShapePresetType())); if (rAtom.setupShape(pShape, pNewNode)) { pShape->setInternalName(rAtom.getName()); pCurrParent->addChild(pShape); pCurrParent = pShape; - rAtom.addNodeShape(pShape, mnCurrLevel); + rAtom.addNodeShape(pShape); mrDgm.getLayout()->getPresPointShapeMap()[pNewNode] = pShape; } } @@ -107,13 +106,11 @@ void ShapeCreationVisitor::visit(LayoutNode& rAtom) // set new parent for children ShapePtr pPreviousParent(mpParentShape); mpParentShape=pCurrParent; - mnCurrLevel++; // process children defaultVisit(rAtom); // restore parent - mnCurrLevel--; mpParentShape=pPreviousParent; mpCurrentNode = pPreviousNode; @@ -180,7 +177,7 @@ void ShapeLayoutingVisitor::visit(AlgAtom& rAtom) const PresPointShapeMap aMap = rAtom.getLayoutNode().getDiagram().getLayout()->getPresPointShapeMap(); auto pShape = aMap.find(mpCurrentNode); if (pShape != aMap.end()) - rAtom.layoutShape(pShape->second, maConstraints, mnCurrLevel); + rAtom.layoutShape(pShape->second, maConstraints); } } @@ -220,11 +217,9 @@ void ShapeLayoutingVisitor::visit(LayoutNode& rAtom) defaultVisit(rAtom); meLookFor = ALGORITHM; defaultVisit(rAtom); - - mnCurrLevel++; meLookFor = LAYOUT_NODE; defaultVisit(rAtom); - mnCurrLevel--; + mpCurrentNode = pPreviousNode; // delete added constraints, keep parent constraints |