embeddedobjectcontainer.cxx (dde7d3fa) embeddedobjectcontainer.cxx (6170fa3c)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 936 unchanged lines hidden (view full) ---

945 }
946
947 // rSrc.RemoveGraphicStream( aName );
948 }
949
950 return bRet;
951}
952
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 936 unchanged lines hidden (view full) ---

945 }
946
947 // rSrc.RemoveGraphicStream( aName );
948 }
949
950 return bRet;
951}
952
953sal_Bool EmbeddedObjectContainer::RemoveEmbeddedObject( const ::rtl::OUString& rName, sal_Bool bClose )
953//sal_Bool EmbeddedObjectContainer::RemoveEmbeddedObject( const ::rtl::OUString& rName, sal_Bool bClose )
954// #i119941, bKeepToTempStorage: use to specify whether store the removed object to temporary storage+
955sal_Bool EmbeddedObjectContainer::RemoveEmbeddedObject( const ::rtl::OUString& rName, sal_Bool bClose, sal_Bool bKeepToTempStorage )
954{
955 RTL_LOGFILE_CONTEXT( aLog, "comphelper (mv76033) comphelper::EmbeddedObjectContainer::RemoveEmbeddedObject( Name )" );
956
957 uno::Reference < embed::XEmbeddedObject > xObj = GetEmbeddedObject( rName );
958 if ( xObj.is() )
956{
957 RTL_LOGFILE_CONTEXT( aLog, "comphelper (mv76033) comphelper::EmbeddedObjectContainer::RemoveEmbeddedObject( Name )" );
958
959 uno::Reference < embed::XEmbeddedObject > xObj = GetEmbeddedObject( rName );
960 if ( xObj.is() )
959 return RemoveEmbeddedObject( xObj, bClose );
961 //return RemoveEmbeddedObject( xObj, bClose );
962 return RemoveEmbeddedObject( xObj, bClose, bKeepToTempStorage );
960 else
961 return sal_False;
962}
963
964sal_Bool EmbeddedObjectContainer::MoveEmbeddedObject( const ::rtl::OUString& rName, EmbeddedObjectContainer& rCnt )
965{
966 RTL_LOGFILE_CONTEXT( aLog, "comphelper (mv76033) comphelper::EmbeddedObjectContainer::MoveEmbeddedObject( Name )" );
967

--- 41 unchanged lines hidden (view full) ---

1009 }
1010
1011 }
1012 else
1013 OSL_ENSURE(0,"Unknown object!");
1014 return sal_False;
1015}
1016
963 else
964 return sal_False;
965}
966
967sal_Bool EmbeddedObjectContainer::MoveEmbeddedObject( const ::rtl::OUString& rName, EmbeddedObjectContainer& rCnt )
968{
969 RTL_LOGFILE_CONTEXT( aLog, "comphelper (mv76033) comphelper::EmbeddedObjectContainer::MoveEmbeddedObject( Name )" );
970

--- 41 unchanged lines hidden (view full) ---

1012 }
1013
1014 }
1015 else
1016 OSL_ENSURE(0,"Unknown object!");
1017 return sal_False;
1018}
1019
1017sal_Bool EmbeddedObjectContainer::RemoveEmbeddedObject( const uno::Reference < embed::XEmbeddedObject >& xObj, sal_Bool bClose )
1020//sal_Bool EmbeddedObjectContainer::RemoveEmbeddedObject( const uno::Reference < embed::XEmbeddedObject >& xObj, sal_Bool bClose )
1021// #i119941, bKeepToTempStorage: use to specify whether store the removed object to temporary storage+
1022sal_Bool EmbeddedObjectContainer::RemoveEmbeddedObject( const uno::Reference < embed::XEmbeddedObject >& xObj, sal_Bool bClose, sal_Bool bKeepToTempStorage )
1018{
1019 RTL_LOGFILE_CONTEXT( aLog, "comphelper (mv76033) comphelper::EmbeddedObjectContainer::RemoveEmbeddedObject( Object )" );
1020
1021 uno::Reference < embed::XEmbedPersist > xPersist( xObj, uno::UNO_QUERY );
1022 ::rtl::OUString aName;
1023 if ( xPersist.is() )
1024 aName = xPersist->getEntryName();
1025

--- 20 unchanged lines hidden (view full) ---

1046 }
1047 }
1048
1049 if ( !bClose )
1050 {
1051 // somebody still needs the object, so we must assign a temporary persistence
1052 try
1053 {
1023{
1024 RTL_LOGFILE_CONTEXT( aLog, "comphelper (mv76033) comphelper::EmbeddedObjectContainer::RemoveEmbeddedObject( Object )" );
1025
1026 uno::Reference < embed::XEmbedPersist > xPersist( xObj, uno::UNO_QUERY );
1027 ::rtl::OUString aName;
1028 if ( xPersist.is() )
1029 aName = xPersist->getEntryName();
1030

--- 20 unchanged lines hidden (view full) ---

1051 }
1052 }
1053
1054 if ( !bClose )
1055 {
1056 // somebody still needs the object, so we must assign a temporary persistence
1057 try
1058 {
1054 if ( xPersist.is() )
1059 // if ( xPersist.is() )
1060 if ( xPersist.is() && bKeepToTempStorage ) // #i119941
1055 {
1056 /*
1057 //TODO/LATER: needs storage handling! Why not letting the object do it?!
1058 if ( !pImpl->mxTempStorage.is() )
1059 pImpl->mxTempStorage = ::comphelper::OStorageHelper::GetTemporaryStorage();
1060 uno::Sequence < beans::PropertyValue > aSeq;
1061
1062 ::rtl::OUString aTmpPersistName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Object ") );

--- 63 unchanged lines hidden (view full) ---

1126 xChild->setParent( uno::Reference < uno::XInterface >() );
1127 break;
1128 }
1129
1130 aIt++;
1131 }
1132
1133 OSL_ENSURE( bFound, "Object not found for removal!" );
1061 {
1062 /*
1063 //TODO/LATER: needs storage handling! Why not letting the object do it?!
1064 if ( !pImpl->mxTempStorage.is() )
1065 pImpl->mxTempStorage = ::comphelper::OStorageHelper::GetTemporaryStorage();
1066 uno::Sequence < beans::PropertyValue > aSeq;
1067
1068 ::rtl::OUString aTmpPersistName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Object ") );

--- 63 unchanged lines hidden (view full) ---

1132 xChild->setParent( uno::Reference < uno::XInterface >() );
1133 break;
1134 }
1135
1136 aIt++;
1137 }
1138
1139 OSL_ENSURE( bFound, "Object not found for removal!" );
1134 if ( xPersist.is() )
1140 // if ( xPersist.is() )
1141 if ( xPersist.is() && bKeepToTempStorage ) // #i119941
1135 {
1136 // remove replacement image (if there is one)
1137 RemoveGraphicStream( aName );
1138
1139 // now it's time to remove the storage from the container storage
1140 try
1141 {
1142#if OSL_DEBUG_LEVEL > 1

--- 517 unchanged lines hidden ---
1142 {
1143 // remove replacement image (if there is one)
1144 RemoveGraphicStream( aName );
1145
1146 // now it's time to remove the storage from the container storage
1147 try
1148 {
1149#if OSL_DEBUG_LEVEL > 1

--- 517 unchanged lines hidden ---