diff options
-rw-r--r-- | oox/source/drawingml/diagram/diagram.cxx | 12 | ||||
-rw-r--r-- | oox/source/drawingml/diagram/diagramlayoutatoms.hxx | 15 | ||||
-rwxr-xr-x | oox/source/drawingml/diagram/layoutatomvisitors.cxx | 9 | ||||
-rw-r--r-- | oox/source/drawingml/diagram/layoutnodecontext.cxx | 2 |
4 files changed, 27 insertions, 11 deletions
diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx index 467d7005b534..533156bbfb86 100644 --- a/oox/source/drawingml/diagram/diagram.cxx +++ b/oox/source/drawingml/diagram/diagram.cxx @@ -317,13 +317,19 @@ void Diagram::addTo( const ShapePtr & pParentShape ) // collect data, init maps build( ); + if (pParentShape->getSize().Width == 0 || pParentShape->getSize().Height == 0) + SAL_WARN("oox.drawingml", "Diagram cannot be correctly laid out. Size: " + << pParentShape->getSize().Width << "x" << pParentShape->getSize().Height); + pParentShape->setChildSize(pParentShape->getSize()); - // create Shape hierarchy - ShapeCreationVisitor aCreationVisitor(pParentShape, *this); if( mpLayout->getNode() ) + { + // create Shape hierarchy + ShapeCreationVisitor aCreationVisitor(pParentShape, *this); + mpLayout->getNode()->setExistingShape(pParentShape); mpLayout->getNode()->accept( aCreationVisitor ); - + } pParentShape->setDiagramDoms( getDomsAsPropertyValues() ); } diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx index 2df1af060ec2..d5b9fcdf9e29 100644 --- a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx +++ b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx @@ -238,10 +238,14 @@ public: { msStyleLabel = sLabel; } void setChildOrder( sal_Int32 nOrder ) { mnChildOrder = nOrder; } - void setShape( const ShapePtr& pShape ) - { mpShape = pShape; } - const ShapePtr& getShape() const - { return mpShape; } + void setShapeTemplate( const ShapePtr& pShape ) + { mpShapeTemplate = pShape; } + void setExistingShape( const ShapePtr& pShape ) + { mpExistingShape = pShape; } + const ShapePtr& getShapeTemplate() const + { return mpShapeTemplate; } + const ShapePtr& getExistingShape() const + { return mpExistingShape; } bool setupShape( const ShapePtr& rShape, const Diagram& rDgm, @@ -251,7 +255,8 @@ private: VarMap mVariables; OUString msMoveWith; OUString msStyleLabel; - ShapePtr mpShape; + ShapePtr mpShapeTemplate; + ShapePtr mpExistingShape; sal_Int32 mnChildOrder; }; diff --git a/oox/source/drawingml/diagram/layoutatomvisitors.cxx b/oox/source/drawingml/diagram/layoutatomvisitors.cxx index a0c1609ba927..fd6e9d7b7e1b 100755 --- a/oox/source/drawingml/diagram/layoutatomvisitors.cxx +++ b/oox/source/drawingml/diagram/layoutatomvisitors.cxx @@ -94,8 +94,13 @@ void ShapeCreationVisitor::visit(ChooseAtom& rAtom) void ShapeCreationVisitor::visit(LayoutNode& rAtom) { ShapePtr pCurrParent(mpParentShape); - ShapePtr pCurrShape(rAtom.getShape()); - if( pCurrShape ) + ShapePtr pCurrShape(rAtom.getShapeTemplate()); + + if (rAtom.getExistingShape()) + { + rAtom.setupShape(rAtom.getExistingShape(), mrDgm, mnCurrIdx); + } + else if( pCurrShape ) { SAL_INFO( "oox.drawingml", diff --git a/oox/source/drawingml/diagram/layoutnodecontext.cxx b/oox/source/drawingml/diagram/layoutnodecontext.cxx index d96a49b0529e..5d66de142c96 100644 --- a/oox/source/drawingml/diagram/layoutnodecontext.cxx +++ b/oox/source/drawingml/diagram/layoutnodecontext.cxx @@ -263,7 +263,7 @@ LayoutNodeContext::onCreateContext( ::sal_Int32 aElement, pShape.reset( new Shape("com.sun.star.drawing.GroupShape") ); } - pNode->setShape( pShape ); + pNode->setShapeTemplate( pShape ); return new ShapeContext( *this, ShapePtr(), pShape ); } else |