diff options
author | Grzegorz Araminowicz <g.araminowicz@gmail.com> | 2017-08-07 12:42:36 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2017-08-17 15:18:15 +0200 |
commit | f1d65b13ff6f0cd82ae36a3e6d58961d3c7273ac (patch) | |
tree | 8a9fb8b1308adaca8b5abf6b803c16f517cb7c56 | |
parent | 8cba023cbd8f1576d7f30855847a85d762b7b1fa (diff) |
SmartArt: support cnt function
it was necessary to introduce in LayoutAtoms reference to containing
LayoutNode passed by constructors, so that ConditionAtom can
access LayoutNode's name and diagram data
Change-Id: I35c9cb9061f23eb15e7a9372476530e2ead5d0dc
Reviewed-on: https://gerrit.libreoffice.org/41108
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r-- | oox/source/drawingml/diagram/constraintlistcontext.cxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/diagram/diagram.cxx | 4 | ||||
-rw-r--r-- | oox/source/drawingml/diagram/diagram.hxx | 5 | ||||
-rw-r--r-- | oox/source/drawingml/diagram/diagramdefinitioncontext.cxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 71 | ||||
-rw-r--r-- | oox/source/drawingml/diagram/diagramlayoutatoms.hxx | 33 | ||||
-rwxr-xr-x | oox/source/drawingml/diagram/layoutatomvisitors.cxx | 19 | ||||
-rwxr-xr-x | oox/source/drawingml/diagram/layoutatomvisitors.hxx | 2 | ||||
-rw-r--r-- | oox/source/drawingml/diagram/layoutnodecontext.cxx | 12 | ||||
-rwxr-xr-x | sd/qa/unit/data/pptx/smartart-cnt.pptx | bin | 0 -> 47360 bytes | |||
-rw-r--r-- | sd/qa/unit/import-tests.cxx | 19 |
11 files changed, 122 insertions, 47 deletions
diff --git a/oox/source/drawingml/diagram/constraintlistcontext.cxx b/oox/source/drawingml/diagram/constraintlistcontext.cxx index 4130cb6aea6d..f7a10f617406 100644 --- a/oox/source/drawingml/diagram/constraintlistcontext.cxx +++ b/oox/source/drawingml/diagram/constraintlistcontext.cxx @@ -50,7 +50,7 @@ ConstraintListContext::onCreateContext( ::sal_Int32 aElement, { case DGM_TOKEN( constr ): { - std::shared_ptr< ConstraintAtom > pNode( new ConstraintAtom() ); + std::shared_ptr< ConstraintAtom > pNode( new ConstraintAtom(mpNode->getLayoutNode()) ); mpNode->addChild( pNode ); pNode->setFor( rAttribs.getToken( XML_for, XML_none ) ); diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx index 4185dd01f15b..705a883e8fcd 100644 --- a/oox/source/drawingml/diagram/diagram.cxx +++ b/oox/source/drawingml/diagram/diagram.cxx @@ -419,7 +419,7 @@ void loadDiagram( ShapePtr const & pShape, DiagramDataPtr pData( new DiagramData() ); pDiagram->setData( pData ); - DiagramLayoutPtr pLayout( new DiagramLayout ); + DiagramLayoutPtr pLayout( new DiagramLayout(*pDiagram) ); pDiagram->setLayout( pLayout ); // data @@ -516,7 +516,7 @@ void loadDiagram( const ShapePtr& pShape, DiagramDataPtr pData( new DiagramData() ); pDiagram->setData( pData ); - DiagramLayoutPtr pLayout( new DiagramLayout ); + DiagramLayoutPtr pLayout( new DiagramLayout(*pDiagram) ); pDiagram->setLayout( pLayout ); // data diff --git a/oox/source/drawingml/diagram/diagram.hxx b/oox/source/drawingml/diagram/diagram.hxx index 914c421e1a6d..28db882b5f73 100644 --- a/oox/source/drawingml/diagram/diagram.hxx +++ b/oox/source/drawingml/diagram/diagram.hxx @@ -147,6 +147,7 @@ typedef std::vector< Point > Points; } +class Diagram; class LayoutNode; typedef std::shared_ptr< LayoutNode > LayoutNodePtr; @@ -197,6 +198,7 @@ typedef std::shared_ptr< DiagramData > DiagramDataPtr; class DiagramLayout { public: + DiagramLayout(const Diagram& rDgm) : mrDgm(rDgm) {} void setDefStyle( const OUString & sDefStyle ) { msDefStyle = sDefStyle; } void setMinVer( const OUString & sMinVer ) @@ -207,6 +209,8 @@ public: { msTitle = sTitle; } void setDesc( const OUString & sDesc ) { msDesc = sDesc; } + const Diagram& getDiagram() const + { return mrDgm; } LayoutNodePtr & getNode() { return mpNode; } const LayoutNodePtr & getNode() const @@ -221,6 +225,7 @@ public: { return mpStyleData; } private: + const Diagram& mrDgm; OUString msDefStyle; OUString msMinVer; OUString msUniqueId; diff --git a/oox/source/drawingml/diagram/diagramdefinitioncontext.cxx b/oox/source/drawingml/diagram/diagramdefinitioncontext.cxx index d3f1f362e35c..7b404761b441 100644 --- a/oox/source/drawingml/diagram/diagramdefinitioncontext.cxx +++ b/oox/source/drawingml/diagram/diagramdefinitioncontext.cxx @@ -67,7 +67,7 @@ DiagramDefinitionContext::onCreateContext( ::sal_Int32 aElement, break; case DGM_TOKEN( layoutNode ): { - LayoutNodePtr pNode( new LayoutNode() ); + LayoutNodePtr pNode( new LayoutNode(mpLayout->getDiagram()) ); mpLayout->getNode() = pNode; pNode->setChildOrder( rAttribs.getToken( XML_chOrder, XML_b ) ); pNode->setMoveWith( rAttribs.getString( XML_moveWith ).get() ); diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx index c3cc7a0dc977..8d690836b4b3 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx @@ -85,7 +85,8 @@ void LayoutAtom::dump(int level) pAtom->dump(level + 1); } -ForEachAtom::ForEachAtom(const Reference< XFastAttributeList >& xAttributes) +ForEachAtom::ForEachAtom(const LayoutNode& rLayoutNode, const Reference< XFastAttributeList >& xAttributes) : + LayoutAtom(rLayoutNode) { maIter.loadFromXAttr(xAttributes); } @@ -100,13 +101,55 @@ void ChooseAtom::accept( LayoutAtomVisitor& rVisitor ) rVisitor.visit(*this); } -ConditionAtom::ConditionAtom(const Reference< XFastAttributeList >& xAttributes) : +ConditionAtom::ConditionAtom(const LayoutNode& rLayoutNode, const Reference< XFastAttributeList >& xAttributes) : + LayoutAtom(rLayoutNode), mbElse( false ) { maIter.loadFromXAttr( xAttributes ); maCond.loadFromXAttr( xAttributes ); } +bool ConditionAtom::compareResult(sal_Int32 nOperator, sal_Int32 nFirst, sal_Int32 nSecond) +{ + switch (nOperator) + { + case XML_equ: return nFirst == nSecond; + case XML_gt: return nFirst > nSecond; + case XML_gte: return nFirst >= nSecond; + case XML_lt: return nFirst < nSecond; + case XML_lte: return nFirst <= nSecond; + case XML_neq: return nFirst != nSecond; + default: + SAL_WARN("oox.drawingml", "unsupported operator: " << nOperator); + return false; + } +} + +sal_Int32 ConditionAtom::getNodeCount() const +{ + sal_Int32 nCount = 0; + const DiagramData::PointsNameMap& rPoints = mrLayoutNode.getDiagram().getData()->getPointsPresNameMap(); + DiagramData::PointsNameMap::const_iterator aDataNode = rPoints.find(mrLayoutNode.getName()); + if (aDataNode != rPoints.end()) + { + SAL_WARN_IF(aDataNode->second.size() > 1, "oox.drawingml", "multiple nodes found; calculating cnt for first one"); + const dgm::Point* pPoint = aDataNode->second.front(); + OUString sNodeId = ""; + + for (const auto& aCxn : mrLayoutNode.getDiagram().getData()->getConnections()) + if (aCxn.mnType == XML_presOf && aCxn.msDestId == pPoint->msModelId) + sNodeId = aCxn.msSourceId; + + if (!sNodeId.isEmpty()) + { + for (const auto& aCxn : mrLayoutNode.getDiagram().getData()->getConnections()) + if (aCxn.mnType == XML_parOf && aCxn.msSourceId == sNodeId) + nCount++; + } + } + return nCount; +} + const std::vector<LayoutAtomPtr>& ConditionAtom::getChildren() const { bool bDecisionVar=true; @@ -114,6 +157,9 @@ const std::vector<LayoutAtomPtr>& ConditionAtom::getChildren() const if( maCond.mnFunc == XML_var && maCond.mnArg == XML_dir && maCond.mnOp == XML_equ && maCond.msVal != "norm" ) bDecisionVar=false; + if (maCond.mnFunc == XML_cnt) + bDecisionVar = compareResult(maCond.mnOp, getNodeCount(), maCond.msVal.toInt32()); + if( bDecisionVar ) return mpChildNodes; else @@ -143,8 +189,7 @@ void AlgAtom::accept( LayoutAtomVisitor& rVisitor ) rVisitor.visit(*this); } -void AlgAtom::layoutShape( const ShapePtr& rShape, - const OUString& rName ) const +void AlgAtom::layoutShape( const ShapePtr& rShape ) const { switch(mnType) { @@ -347,7 +392,7 @@ void AlgAtom::layoutShape( const ShapePtr& rShape, SAL_INFO( "oox.drawingml", - "Layouting shape " << rName << ", alg type: " << mnType << ", (" + "Layouting shape " << mrLayoutNode.getName() << ", alg type: " << mnType << ", (" << rShape->getPosition().X << "," << rShape->getPosition().Y << "," << rShape->getSize().Width << "," << rShape->getSize().Height << ")"); } @@ -357,7 +402,7 @@ void LayoutNode::accept( LayoutAtomVisitor& rVisitor ) rVisitor.visit(*this); } -bool LayoutNode::setupShape( const ShapePtr& rShape, const Diagram& rDgm, const dgm::Point* pPresNode ) const +bool LayoutNode::setupShape( const ShapePtr& rShape, const dgm::Point* pPresNode ) const { SAL_INFO( "oox.drawingml", @@ -365,15 +410,15 @@ bool LayoutNode::setupShape( const ShapePtr& rShape, const Diagram& rDgm, const << "\", modelId \"" << pPresNode->msModelId << "\""); // have the presentation node - now, need the actual data node: - const DiagramData::StringMap::const_iterator aNodeName = rDgm.getData()->getPresOfNameMap().find( + const DiagramData::StringMap::const_iterator aNodeName = mrDgm.getData()->getPresOfNameMap().find( pPresNode->msModelId); - if( aNodeName != rDgm.getData()->getPresOfNameMap().end() ) + if( aNodeName != mrDgm.getData()->getPresOfNameMap().end() ) { DiagramData::StringMap::value_type::second_type::const_iterator aVecIter=aNodeName->second.begin(); const DiagramData::StringMap::value_type::second_type::const_iterator aVecEnd=aNodeName->second.end(); while( aVecIter != aVecEnd ) { - DiagramData::PointNameMap& rMap = rDgm.getData()->getPointNameMap(); + DiagramData::PointNameMap& rMap = mrDgm.getData()->getPointNameMap(); DiagramData::PointNameMap::const_iterator aDataNode2 = rMap.find(aVecIter->first); if (aDataNode2 == rMap.end()) { @@ -451,8 +496,8 @@ bool LayoutNode::setupShape( const ShapePtr& rShape, const Diagram& rDgm, const aStyleLabel = msStyleLabel; if( !aStyleLabel.isEmpty() ) { - const DiagramQStyleMap::const_iterator aStyle = rDgm.getStyles().find(aStyleLabel); - if( aStyle != rDgm.getStyles().end() ) + const DiagramQStyleMap::const_iterator aStyle = mrDgm.getStyles().find(aStyleLabel); + if( aStyle != mrDgm.getStyles().end() ) { const DiagramStyle& rStyle = aStyle->second; rShape->getShapeStyleRefs()[XML_fillRef] = rStyle.maFillStyle; @@ -465,8 +510,8 @@ bool LayoutNode::setupShape( const ShapePtr& rShape, const Diagram& rDgm, const SAL_WARN("oox.drawingml", "Style " << aStyleLabel << " not found"); } - const DiagramColorMap::const_iterator aColor = rDgm.getColors().find(aStyleLabel); - if( aColor != rDgm.getColors().end() ) + const DiagramColorMap::const_iterator aColor = mrDgm.getColors().find(aStyleLabel); + if( aColor != mrDgm.getColors().end() ) { const DiagramColor& rColor=aColor->second; if( rColor.maFillColor.isUsed() ) diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx index 7414303bbdb1..f7a059d9b2d3 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx @@ -66,6 +66,7 @@ struct ConditionAttr struct LayoutAtomVisitor; class LayoutAtom; +class LayoutNode; typedef std::shared_ptr< LayoutAtom > LayoutAtomPtr; @@ -73,8 +74,12 @@ typedef std::shared_ptr< LayoutAtom > LayoutAtomPtr; class LayoutAtom { public: + LayoutAtom(const LayoutNode& rLayoutNode) : mrLayoutNode(rLayoutNode) {} virtual ~LayoutAtom() { } + const LayoutNode& getLayoutNode() const + { return mrLayoutNode; } + /** visitor acceptance */ virtual void accept( LayoutAtomVisitor& ) = 0; @@ -91,7 +96,9 @@ public: // dump for debug void dump(int level = 0); + protected: + const LayoutNode& mrLayoutNode; std::vector< LayoutAtomPtr > mpChildNodes; OUString msName; }; @@ -100,7 +107,7 @@ class ConstraintAtom : public LayoutAtom { public: - ConstraintAtom() : + ConstraintAtom(const LayoutNode& rLayoutNode) : LayoutAtom(rLayoutNode), mnFor(-1), msForName(), mnPointType(-1), mnType(-1), mnRefFor(-1), msRefForName(), mnRefType(-1), mnRefPointType(-1), mfFactor(1.0), mfValue(0.0), mnOperator(0) {} @@ -147,7 +154,7 @@ class AlgAtom : public LayoutAtom { public: - AlgAtom() : mnType(0), maMap() {} + AlgAtom(const LayoutNode& rLayoutNode) : LayoutAtom(rLayoutNode), mnType(0), maMap() {} typedef std::map<sal_Int32,sal_Int32> ParamMap; @@ -157,8 +164,7 @@ public: { mnType = nToken; } void addParam( sal_Int32 nType, sal_Int32 nVal ) { maMap[nType]=nVal; } - void layoutShape( const ShapePtr& rShape, - const OUString& rName ) const; + void layoutShape( const ShapePtr& rShape ) const; private: sal_Int32 mnType; ParamMap maMap; @@ -170,7 +176,7 @@ class ForEachAtom : public LayoutAtom { public: - explicit ForEachAtom(const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttributes); + explicit ForEachAtom(const LayoutNode& rLayoutNode, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttributes); IteratorAttr & iterator() { return maIter; } @@ -186,12 +192,14 @@ class ConditionAtom : public LayoutAtom { public: - explicit ConditionAtom(const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttributes); + explicit ConditionAtom(const LayoutNode& rLayoutNode, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttributes); virtual void accept( LayoutAtomVisitor& ) override; void readElseBranch() { mbElse=true; } virtual void addChild( const LayoutAtomPtr & pNode ) override; virtual const std::vector<LayoutAtomPtr>& getChildren() const override; + static bool compareResult(sal_Int32 nOperator, sal_Int32 nFirst, sal_Int32 nSecond); + sal_Int32 getNodeCount() const; private: bool mbElse; IteratorAttr maIter; @@ -206,6 +214,7 @@ class ChooseAtom : public LayoutAtom { public: + ChooseAtom(const LayoutNode& rLayoutNode) : LayoutAtom(rLayoutNode) {} virtual void accept( LayoutAtomVisitor& ) override; }; @@ -228,7 +237,9 @@ public: // the use of Any allow having empty values typedef std::array<css::uno::Any, 9> VarMap; - LayoutNode() : mnChildOrder(0) {} + LayoutNode(const Diagram& rDgm) : LayoutAtom(*this), mrDgm(rDgm), mnChildOrder(0) {} + const Diagram& getDiagram() const + { return mrDgm; } virtual void accept( LayoutAtomVisitor& ) override; VarMap & variables() { return mVariables; } @@ -242,14 +253,16 @@ public: { mpExistingShape = pShape; } const ShapePtr& getExistingShape() const { return mpExistingShape; } - std::vector<ShapePtr> & getNodeShapes() + const std::vector<ShapePtr> & getNodeShapes() const { return mpNodeShapes; } + void addNodeShape(const ShapePtr& pShape) + { mpNodeShapes.push_back(pShape); } bool setupShape( const ShapePtr& rShape, - const Diagram& rDgm, const dgm::Point* pPresNode ) const; private: + const Diagram& mrDgm; VarMap mVariables; OUString msMoveWith; OUString msStyleLabel; @@ -264,7 +277,7 @@ class ShapeAtom : public LayoutAtom { public: - ShapeAtom(const ShapePtr& pShape) : mpShapeTemplate(pShape) {} + ShapeAtom(const LayoutNode& rLayoutNode, const ShapePtr& pShape) : LayoutAtom(rLayoutNode), mpShapeTemplate(pShape) {} virtual void accept( LayoutAtomVisitor& ) override; const ShapePtr& getShapeTemplate() const { return mpShapeTemplate; } diff --git a/oox/source/drawingml/diagram/layoutatomvisitors.cxx b/oox/source/drawingml/diagram/layoutatomvisitors.cxx index c0b019a9019b..b9100241cc00 100755 --- a/oox/source/drawingml/diagram/layoutatomvisitors.cxx +++ b/oox/source/drawingml/diagram/layoutatomvisitors.cxx @@ -116,8 +116,8 @@ void ShapeCreationVisitor::visit(LayoutNode& rAtom) if (rAtom.getExistingShape()) { // reuse existing shape - if (rAtom.setupShape(rAtom.getExistingShape(), mrDgm, pNewNode)) - rAtom.getNodeShapes().push_back(rAtom.getExistingShape()); + if (rAtom.setupShape(rAtom.getExistingShape(), pNewNode)) + rAtom.addNodeShape(rAtom.getExistingShape()); } else { @@ -133,11 +133,11 @@ void ShapeCreationVisitor::visit(LayoutNode& rAtom) << (pShape->getCustomShapeProperties() ->getShapePresetType())); - if (rAtom.setupShape(pShape, mrDgm, pNewNode)) + if (rAtom.setupShape(pShape, pNewNode)) { pCurrParent->addChild(pShape); pCurrParent = pShape; - rAtom.getNodeShapes().push_back(pShape); + rAtom.addNodeShape(pShape); } } else @@ -238,10 +238,10 @@ void ShapeLayoutingVisitor::visit(ConstraintAtom& /*rAtom*/) void ShapeLayoutingVisitor::visit(AlgAtom& rAtom) { - if (mbLookForAlg && mpCurrentLayoutNode) + if (mbLookForAlg) { - for (const auto& pShape : mpCurrentLayoutNode->getNodeShapes()) - rAtom.layoutShape(pShape, mpCurrentLayoutNode->getName()); + for (const auto& pShape : rAtom.getLayoutNode().getNodeShapes()) + rAtom.layoutShape(pShape); } } @@ -265,16 +265,11 @@ void ShapeLayoutingVisitor::visit(LayoutNode& rAtom) if (mbLookForAlg) return; - LayoutNode* pPreviousLayoutNode = mpCurrentLayoutNode; - mpCurrentLayoutNode = &rAtom; - // process alg atoms first, nested layout nodes afterwards mbLookForAlg = true; defaultVisit(rAtom); mbLookForAlg = false; defaultVisit(rAtom); - - mpCurrentLayoutNode = pPreviousLayoutNode; } void ShapeLayoutingVisitor::visit(ShapeAtom& /*rAtom*/) diff --git a/oox/source/drawingml/diagram/layoutatomvisitors.hxx b/oox/source/drawingml/diagram/layoutatomvisitors.hxx index 28bdf7d855e6..3c514ec15ae4 100755 --- a/oox/source/drawingml/diagram/layoutatomvisitors.hxx +++ b/oox/source/drawingml/diagram/layoutatomvisitors.hxx @@ -74,7 +74,6 @@ public: class ShapeLayoutingVisitor : public LayoutAtomVisitor { - LayoutNode* mpCurrentLayoutNode; bool mbLookForAlg; void defaultVisit(LayoutAtom const & rAtom); @@ -88,7 +87,6 @@ class ShapeLayoutingVisitor : public LayoutAtomVisitor public: ShapeLayoutingVisitor() : - mpCurrentLayoutNode(nullptr), mbLookForAlg(false) {} }; diff --git a/oox/source/drawingml/diagram/layoutnodecontext.cxx b/oox/source/drawingml/diagram/layoutnodecontext.cxx index 70cd6c153f5f..57689958ae49 100644 --- a/oox/source/drawingml/diagram/layoutnodecontext.cxx +++ b/oox/source/drawingml/diagram/layoutnodecontext.cxx @@ -105,7 +105,7 @@ public: case DGM_TOKEN( if ): { // CT_When - mpConditionNode.reset( new ConditionAtom(rAttribs.getFastAttributeList()) ); + mpConditionNode.reset( new ConditionAtom(mpNode->getLayoutNode(), rAttribs.getFastAttributeList()) ); mpNode->addChild( mpConditionNode ); return new IfContext( *this, rAttribs, mpConditionNode ); } @@ -237,7 +237,7 @@ LayoutNodeContext::onCreateContext( ::sal_Int32 aElement, { case DGM_TOKEN( layoutNode ): { - LayoutNodePtr pNode( new LayoutNode() ); + LayoutNodePtr pNode( new LayoutNode(mpNode->getLayoutNode().getDiagram()) ); mpNode->addChild( pNode ); pNode->setChildOrder( rAttribs.getToken( XML_chOrder, XML_b ) ); pNode->setMoveWith( rAttribs.getString( XML_moveWith ).get() ); @@ -263,7 +263,7 @@ LayoutNodeContext::onCreateContext( ::sal_Int32 aElement, pShape.reset( new Shape("com.sun.star.drawing.GroupShape") ); } - ShapeAtomPtr pAtom( new ShapeAtom(pShape) ); + ShapeAtomPtr pAtom( new ShapeAtom(mpNode->getLayoutNode(), pShape) ); mpNode->addChild( pAtom ); return new ShapeContext( *this, ShapePtr(), pShape ); } @@ -272,21 +272,21 @@ LayoutNodeContext::onCreateContext( ::sal_Int32 aElement, case DGM_TOKEN( alg ): { // CT_Algorithm - AlgAtomPtr pAtom( new AlgAtom ); + AlgAtomPtr pAtom( new AlgAtom(mpNode->getLayoutNode()) ); mpNode->addChild( pAtom ); return new AlgorithmContext( *this, rAttribs, pAtom ); } case DGM_TOKEN( choose ): { // CT_Choose - LayoutAtomPtr pAtom( new ChooseAtom ); + LayoutAtomPtr pAtom( new ChooseAtom(mpNode->getLayoutNode()) ); mpNode->addChild( pAtom ); return new ChooseContext( *this, rAttribs, pAtom ); } case DGM_TOKEN( forEach ): { // CT_ForEach - ForEachAtomPtr pAtom( new ForEachAtom(rAttribs.getFastAttributeList()) ); + ForEachAtomPtr pAtom( new ForEachAtom(mpNode->getLayoutNode(), rAttribs.getFastAttributeList()) ); mpNode->addChild( pAtom ); return new ForEachContext( *this, rAttribs, pAtom ); } diff --git a/sd/qa/unit/data/pptx/smartart-cnt.pptx b/sd/qa/unit/data/pptx/smartart-cnt.pptx Binary files differnew file mode 100755 index 000000000000..4ab27d169a7b --- /dev/null +++ b/sd/qa/unit/data/pptx/smartart-cnt.pptx diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 47daa04cd3ce..a4de6d9b5978 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -166,6 +166,7 @@ public: void testSmartArt1(); void testSmartArtChildren(); void testSmartArtText(); + void testSmartArtCnt(); void testTdf109223(); void testTdf109187(); @@ -241,6 +242,7 @@ public: CPPUNIT_TEST(testSmartArt1); CPPUNIT_TEST(testSmartArtChildren); CPPUNIT_TEST(testSmartArtText); + CPPUNIT_TEST(testSmartArtCnt); CPPUNIT_TEST(testTdf109223); CPPUNIT_TEST(testTdf109187); @@ -2316,6 +2318,23 @@ void SdImportTest::testSmartArtText() xDocShRef->DoClose(); } +void SdImportTest::testSmartArtCnt() +{ + sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc("sd/qa/unit/data/pptx/smartart-cnt.pptx"), PPTX); + uno::Reference<drawing::XShapes> xShapeGroup(getShapeFromPage(0, 0, xDocShRef), uno::UNO_QUERY_THROW); + sal_Int32 nCount = xShapeGroup->getCount(); + sal_Int32 nCorrect = 0; + for (sal_Int32 i=0; i<nCount; i++) + { + uno::Reference<text::XText> xText(xShapeGroup->getByIndex(i), uno::UNO_QUERY); + if (xText.is() && !xText->getString().isEmpty()) + nCorrect++; + } + CPPUNIT_ASSERT_EQUAL(sal_Int32(3), nCorrect); + + xDocShRef->DoClose(); +} + void SdImportTest::testTdf109223() { // In the test document flipV attribute is defined for a group shape |