diff options
Diffstat (limited to 'oox/source/drawingml/diagram/layoutatomvisitors.cxx')
-rwxr-xr-x | oox/source/drawingml/diagram/layoutatomvisitors.cxx | 108 |
1 files changed, 88 insertions, 20 deletions
diff --git a/oox/source/drawingml/diagram/layoutatomvisitors.cxx b/oox/source/drawingml/diagram/layoutatomvisitors.cxx index fd6e9d7b7e1b..ade7e4ccfec9 100755 --- a/oox/source/drawingml/diagram/layoutatomvisitors.cxx +++ b/oox/source/drawingml/diagram/layoutatomvisitors.cxx @@ -94,34 +94,35 @@ void ShapeCreationVisitor::visit(ChooseAtom& rAtom) void ShapeCreationVisitor::visit(LayoutNode& rAtom) { ShapePtr pCurrParent(mpParentShape); - ShapePtr pCurrShape(rAtom.getShapeTemplate()); if (rAtom.getExistingShape()) { rAtom.setupShape(rAtom.getExistingShape(), mrDgm, mnCurrIdx); } - else if( pCurrShape ) + else { - SAL_INFO( - "oox.drawingml", - "processing shape type " - << (pCurrShape->getCustomShapeProperties() - ->getShapePresetType())); - - // TODO(F3): cloned shape shares all properties by reference, - // don't change them! - ShapePtr pClonedShape( - new Shape( pCurrShape )); - - if( rAtom.setupShape(pClonedShape, mrDgm, mnCurrIdx) ) + ShapeTemplateVisitor aTemplateVisitor; + aTemplateVisitor.defaultVisit(rAtom); + ShapePtr pShape = aTemplateVisitor.getShapeCopy(); + + if (pShape) { - pCurrParent->addChild(pClonedShape); - pCurrParent = pClonedShape; + SAL_INFO( + "oox.drawingml", + "processing shape type " + << (pShape->getCustomShapeProperties() + ->getShapePresetType())); + + if (rAtom.setupShape(pShape, mrDgm, mnCurrIdx)) + { + pCurrParent->addChild(pShape); + pCurrParent = pShape; + } + } + else + { + SAL_WARN("oox.drawingml", "ShapeCreationVisitor::visit: no shape set while processing layoutnode named " << rAtom.getName()); } - } - else - { - SAL_WARN("oox.drawingml", "ShapeCreationVisitor::visit: no shape set while processing layoutnode named " << rAtom.getName() ); } // set new parent for children @@ -140,6 +141,63 @@ void ShapeCreationVisitor::visit(LayoutNode& rAtom) aLayoutingVisitor.defaultVisit(rAtom); } +void ShapeCreationVisitor::visit(ShapeAtom& /*rAtom*/) +{ + // stop processing +} + +void ShapeTemplateVisitor::defaultVisit(LayoutAtom& rAtom) +{ + // visit all children, one of them needs to be the layout algorithm + for (const auto& pAtom : rAtom.getChildren()) + pAtom->accept(*this); +} + +void ShapeTemplateVisitor::visit(ConstraintAtom& /*rAtom*/) +{ + // stop processing +} + +void ShapeTemplateVisitor::visit(AlgAtom& /*rAtom*/) +{ + // stop processing +} + +void ShapeTemplateVisitor::visit(ForEachAtom& /*rAtom*/) +{ + // stop processing +} + +void ShapeTemplateVisitor::visit(ConditionAtom& rAtom) +{ + defaultVisit(rAtom); +} + +void ShapeTemplateVisitor::visit(ChooseAtom& rAtom) +{ + defaultVisit(rAtom); +} + +void ShapeTemplateVisitor::visit(LayoutNode& /*rAtom*/) +{ + // stop processing - only traverse Condition/Choose atoms +} + +void ShapeTemplateVisitor::visit(ShapeAtom& rAtom) +{ + if (mpShape) + { + SAL_WARN("oox.drawingml", "multiple shapes encountered inside LayoutNode"); + return; + } + + ShapePtr pCurrShape(rAtom.getShapeTemplate()); + + // TODO(F3): cloned shape shares all properties by reference, + // don't change them! + mpShape.reset(new Shape(pCurrShape)); +} + void ShapeLayoutingVisitor::defaultVisit(LayoutAtom& rAtom) { // visit all children, one of them needs to be the layout algorithm @@ -177,6 +235,11 @@ void ShapeLayoutingVisitor::visit(LayoutNode& /*rAtom*/) // stop processing - only traverse Condition/Choose atoms } +void ShapeLayoutingVisitor::visit(ShapeAtom& /*rAtom*/) +{ + // stop processing +} + void ShallowPresNameVisitor::defaultVisit(LayoutAtom& rAtom) { // visit all children, at least one of them needs to have proper @@ -219,6 +282,11 @@ void ShallowPresNameVisitor::visit(LayoutNode& rAtom) aDataNode->second.size()); } +void ShallowPresNameVisitor::visit(ShapeAtom& /*rAtom*/) +{ + // stop processing +} + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |