From 450cd772aa734cfcb989c8cedd3c0a454db74a34 Mon Sep 17 00:00:00 2001 From: Thorsten Behrens Date: Wed, 15 May 2013 11:05:45 +0200 Subject: Fix fdo#64512 Handle xml:id correctly on multi-image draw:frames Fixes a regression from the pick-best-image from draw:frame in ODF, where before sometimes the XShape got deleted that the UnoInterfaceToUniqueIdentifierMapper::registerReference stored. For that, added a UnoInterfaceToUniqueIdentifierMapper::registerReferenceAlways function, which overwrites potentially existing earlier entries with the same identifier string. This fix was originally much more messy, but then dtardon committed 30b248dfe5bfb8a0649e36f22c943b3feb2f1385 which also fixes this here bug. Now only sneaking in slightly less involved interface map handling and a safeguard in ximpshap.cxx. Change-Id: I87501e43518a5fc2fee166c45a4e2f01718f5228 --- xmloff/source/draw/ximpshap.cxx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'xmloff/source/draw') diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 75dae5d23e74..eb7171b90723 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -3455,9 +3455,6 @@ SvXMLImportContext *SdXMLFrameShapeContext::CreateChildContext( sal_uInt16 nPref if(getSupportsMultipleContents() && dynamic_cast< SdXMLGraphicObjectShapeContext* >(pContext)) { - if ( !maShapeId.isEmpty() ) - GetImport().getInterfaceToIdentifierMapper().reserveIdentifier( maShapeId ); - addContent(*mxImplContext); } } @@ -3534,11 +3531,13 @@ void SdXMLFrameShapeContext::EndElement() // solve if multiple image child contexts were imported const SvXMLImportContext* const pSelectedContext(solveMultipleImages()); const SdXMLGraphicObjectShapeContext* pShapeContext( dynamic_cast( pSelectedContext ) ); - if ( pShapeContext ) + if ( pShapeContext && !maShapeId.isEmpty() ) { + // fdo#64512 and fdo#60075 - make sure *this* shape is + // registered for given ID assert( mxImplContext.Is() ); const uno::Reference< uno::XInterface > xShape( pShapeContext->getShape() ); - GetImport().getInterfaceToIdentifierMapper().registerReservedReference( maShapeId, xShape ); + GetImport().getInterfaceToIdentifierMapper().registerReferenceAlways( maShapeId, xShape ); } if( !mxImplContext.Is() ) -- cgit