summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2012-06-12 17:11:10 +0200
committerLuboš Luňák <l.lunak@suse.cz>2012-06-19 11:52:39 +0200
commit831c2d95289f41529ea1f85c90f8bb112e522d97 (patch)
treeab7a925e4e6b1110ccbd486600d08220bd91f8c1 /oox
parente28c8f3b75cb46906a8479cf9a52f272fdb17682 (diff)
Revert "rework getting shape for the .docx import filter"
Stupid containers with shared_ptr. Trying to remove the object from it gets it deleted because it's owned by the shared_ptr and there's no sensible way to wrestle it out of it. This will need to be redone somehow. This reverts commit 04d600d4be7c50db4b3b505039eb8bc96856f593.
Diffstat (limited to 'oox')
-rw-r--r--oox/inc/oox/vml/vmlshapecontainer.hxx6
-rw-r--r--oox/source/shape/ShapeContextHandler.cxx5
-rw-r--r--oox/source/vml/vmlshapecontainer.cxx11
3 files changed, 12 insertions, 10 deletions
diff --git a/oox/inc/oox/vml/vmlshapecontainer.hxx b/oox/inc/oox/vml/vmlshapecontainer.hxx
index 973890e8c829..20671bbb05f3 100644
--- a/oox/inc/oox/vml/vmlshapecontainer.hxx
+++ b/oox/inc/oox/vml/vmlshapecontainer.hxx
@@ -92,14 +92,16 @@ public:
template< typename Functor >
const ShapeBase* findShape( const Functor& rFunctor ) const;
- /** Returns and removes the last shape in the collection (Word only). */
- const ShapeBase* takeLastShape();
+ /** Returns the first shape in the collection (Word only). */
+ const ShapeBase* getFirstShape() const;
/** 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 241ae868ca2b..04e2330ca14d 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -280,8 +280,11 @@ ShapeContextHandler::getShape() throw (uno::RuntimeException)
if ( getContextHandler() == getDrawingShapeContext() )
{
mpDrawing->finalizeFragmentImport();
- if( const ::oox::vml::ShapeBase* pShape = mpDrawing->getShapes().takeLastShape() )
+ if( const ::oox::vml::ShapeBase* pShape = mpDrawing->getShapes().getFirstShape() )
+ {
xResult = pShape->convertAndInsert( xShapes );
+ mpDrawing->getShapes( ).clearShapes( );
+ }
}
else if (mxDiagramShapeContext.is())
{
diff --git a/oox/source/vml/vmlshapecontainer.cxx b/oox/source/vml/vmlshapecontainer.cxx
index 144aa78f7c28..0309839a9817 100644
--- a/oox/source/vml/vmlshapecontainer.cxx
+++ b/oox/source/vml/vmlshapecontainer.cxx
@@ -118,14 +118,11 @@ const ShapeBase* ShapeContainer::getShapeById( const OUString& rShapeId, bool bD
return 0;
}
-const ShapeBase* ShapeContainer::takeLastShape()
+const ShapeBase* ShapeContainer::getFirstShape() const
{
- assert( mrDrawing.getType() == VMLDRAWING_WORD );
- if( maShapes.empty())
- return NULL;
- const ShapeBase* ret = maShapes.back().get();
- maShapes.pop_back();
- return ret;
+ 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();
}
void ShapeContainer::convertAndInsert( const Reference< XShapes >& rxShapes, const ShapeParentAnchor* pParentAnchor ) const