diff options
author | Luboš Luňák <l.lunak@suse.cz> | 2012-06-13 18:04:51 +0200 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2012-06-19 11:52:40 +0200 |
commit | 886e29cff76d0358889aa676dbe90765950c990e (patch) | |
tree | 0945fb0e3f2917e0a78f860ae5346bfd18e5156e /oox/source/vml/vmlshapecontainer.cxx | |
parent | 544ab2ed627e207adb54a0db9b31388e29d041a8 (diff) |
rework handling the case of recursive ooxml shapes again
Another attempt, whoever has written this apparently didn't consider
the possibility of recursion at all, and this still feels a bit hackish.
Writerfilter keeps just one oox::shape::ShapeContextHandler object during
the entire time of parsing the document, because e.g. <v:shapetype> needs
to be reachable even across VML block (see sw testcases for bnc#705956).
This however presents a problem when VML contains <w:txbxContent> which
contains another VML, as this code previously just took whatever has been
read and returned it to writerfilter, and it broke with recursion.
So now try to mark recursion entry and returns the right shape.
Related to 36c12c246d886b2d96d7a2d4d0c250db9d925c74 and the previous
commits it reverted.
Change-Id: I949a6b52ec7540aa59b047c7b6e908b10fb3bdc1
Diffstat (limited to 'oox/source/vml/vmlshapecontainer.cxx')
-rw-r--r-- | oox/source/vml/vmlshapecontainer.cxx | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/oox/source/vml/vmlshapecontainer.cxx b/oox/source/vml/vmlshapecontainer.cxx index 0309839a9817..c30994c5cfc8 100644 --- a/oox/source/vml/vmlshapecontainer.cxx +++ b/oox/source/vml/vmlshapecontainer.cxx @@ -118,11 +118,26 @@ const ShapeBase* ShapeContainer::getShapeById( const OUString& rShapeId, bool bD return 0; } -const ShapeBase* ShapeContainer::getFirstShape() const +boost::shared_ptr< 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(); + OSL_ENSURE( mrDrawing.getType() == VMLDRAWING_WORD, "ShapeContainer::takeLastShape - illegal call, Word filter only" ); + assert( !markStack.empty()); + if( markStack.top() >= maShapes.size()) + return boost::shared_ptr< ShapeBase >(); + boost::shared_ptr< ShapeBase > ret = maShapes.back(); + maShapes.pop_back(); + return ret; +} + +void ShapeContainer::pushMark() +{ + markStack.push( maShapes.size()); +} + +void ShapeContainer::popMark() +{ + assert( !markStack.empty()); + markStack.pop(); } void ShapeContainer::convertAndInsert( const Reference< XShapes >& rxShapes, const ShapeParentAnchor* pParentAnchor ) const |