diff options
Diffstat (limited to 'oox')
-rw-r--r-- | oox/inc/oox/vml/vmlshapecontainer.hxx | 6 | ||||
-rw-r--r-- | oox/source/shape/ShapeContextHandler.cxx | 5 | ||||
-rw-r--r-- | oox/source/vml/vmlshapecontainer.cxx | 11 |
3 files changed, 10 insertions, 12 deletions
diff --git a/oox/inc/oox/vml/vmlshapecontainer.hxx b/oox/inc/oox/vml/vmlshapecontainer.hxx index 288062566a00..9b11c6ca5a0b 100644 --- a/oox/inc/oox/vml/vmlshapecontainer.hxx +++ b/oox/inc/oox/vml/vmlshapecontainer.hxx @@ -92,16 +92,14 @@ public: template< typename Functor > const ShapeBase* findShape( const Functor& rFunctor ) const; - /** Returns the first shape in the collection (Word only). */ - const ShapeBase* getFirstShape() const; + /** Returns and removes the last shape in the collection (Word only). */ + const ShapeBase* takeLastShape(); /** Creates and inserts all UNO shapes into the passed container. */ void convertAndInsert( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, const ShapeParentAnchor* pParentAnchor = 0 ) const; - inline void clearShapes( ) { maShapes.clear( ); } - private: typedef RefVector< ShapeType > ShapeTypeVector; typedef RefVector< ShapeBase > ShapeVector; diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx index de27734a89d8..32342380e2f6 100644 --- a/oox/source/shape/ShapeContextHandler.cxx +++ b/oox/source/shape/ShapeContextHandler.cxx @@ -244,11 +244,8 @@ ShapeContextHandler::getShape() throw (uno::RuntimeException) if ( getContextHandler() == getDrawingShapeContext() ) { mpDrawing->finalizeFragmentImport(); - if( const ::oox::vml::ShapeBase* pShape = mpDrawing->getShapes().getFirstShape() ) - { + if( const ::oox::vml::ShapeBase* pShape = mpDrawing->getShapes().takeLastShape() ) xResult = pShape->convertAndInsert( xShapes ); - mpDrawing->getShapes( ).clearShapes( ); - } } else if (mpShape.get() != NULL) { diff --git a/oox/source/vml/vmlshapecontainer.cxx b/oox/source/vml/vmlshapecontainer.cxx index 0309839a9817..144aa78f7c28 100644 --- a/oox/source/vml/vmlshapecontainer.cxx +++ b/oox/source/vml/vmlshapecontainer.cxx @@ -118,11 +118,14 @@ const ShapeBase* ShapeContainer::getShapeById( const OUString& rShapeId, bool bD return 0; } -const ShapeBase* ShapeContainer::getFirstShape() const +const ShapeBase* ShapeContainer::takeLastShape() { - OSL_ENSURE( mrDrawing.getType() == VMLDRAWING_WORD, "ShapeContainer::getFirstShape - illegal call, Word filter only" ); - OSL_ENSURE( maShapes.size() == 1, "ShapeContainer::getFirstShape - single shape expected" ); - return maShapes.get( 0 ).get(); + assert( mrDrawing.getType() == VMLDRAWING_WORD ); + if( maShapes.empty()) + return NULL; + const ShapeBase* ret = maShapes.back().get(); + maShapes.pop_back(); + return ret; } void ShapeContainer::convertAndInsert( const Reference< XShapes >& rxShapes, const ShapeParentAnchor* pParentAnchor ) const |