summaryrefslogtreecommitdiff
path: root/svx/source/xml
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2007-12-12 12:19:48 +0000
committerKurt Zenker <kz@openoffice.org>2007-12-12 12:19:48 +0000
commit951409194e0404dd794bda0fbd890999d4c394f2 (patch)
tree8e5a4fe47e5a28c8337a5920252d2e5598924e63 /svx/source/xml
parent64de2e43a7fdba76489131ab37f316301f0bb42e (diff)
INTEGRATION: CWS mav26 (1.22.552); FILE MERGED
2007/11/27 15:23:19 mav 1.22.552.1: #i79302# avoid duplicate objects
Diffstat (limited to 'svx/source/xml')
-rw-r--r--svx/source/xml/xmleohlp.cxx18
1 files changed, 13 insertions, 5 deletions
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 )