From 951409194e0404dd794bda0fbd890999d4c394f2 Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Wed, 12 Dec 2007 12:19:48 +0000 Subject: INTEGRATION: CWS mav26 (1.22.552); FILE MERGED 2007/11/27 15:23:19 mav 1.22.552.1: #i79302# avoid duplicate objects --- svx/source/xml/xmleohlp.cxx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'svx/source/xml') diff --git a/svx/source/xml/xmleohlp.cxx b/svx/source/xml/xmleohlp.cxx index c4b90d69b52b..694cf1e07ac8 100644 --- a/svx/source/xml/xmleohlp.cxx +++ b/svx/source/xml/xmleohlp.cxx @@ -4,9 +4,9 @@ * * $RCSfile: xmleohlp.cxx,v $ * - * $Revision: 1.22 $ + * $Revision: 1.23 $ * - * last change: $Author: obo $ $Date: 2006-10-12 13:29:01 $ + * last change: $Author: kz $ $Date: 2007-12-12 13:19:48 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -437,11 +437,19 @@ sal_Bool SvXMLEmbeddedObjectHelper::ImplReadObject( String aSrcObjName( rObjName ); comphelper::EmbeddedObjectContainer& rContainer = mpDocPersist->GetEmbeddedObjectContainer(); - if( xDocStor != xCntnrStor || pTemp ) + + // Is the object name unique? + // if the object is already instantiated by GetEmbeddedObject + // that means that the duplication is being loaded + sal_Bool bDuplicate = rContainer.HasInstantiatedEmbeddedObject( rObjName ); + DBG_ASSERT( !bDuplicate, "An object in the document is referenced twice!" ); + + if( xDocStor != xCntnrStor || pTemp || bDuplicate ) { - // Is the object name unique? // TODO/LATER: make this alltogether a method in the EmbeddedObjectContainer - if( rContainer.HasEmbeddedObject( rObjName ) ) + + // create a unique name for the duplicate object + if( bDuplicate ) rObjName = rContainer.CreateUniqueObjectName(); if( pTemp ) -- cgit