diff options
author | Daniel Rentz <dr@openoffice.org> | 2010-05-21 10:11:51 +0200 |
---|---|---|
committer | Daniel Rentz <dr@openoffice.org> | 2010-05-21 10:11:51 +0200 |
commit | 87523ea7109b044939ff51bb481aad00171c2e3a (patch) | |
tree | f4451a2a1db327b942d0f18df9211d474c061f97 /basic | |
parent | cff39a2614347c6db8ae1a214947d90a3ea57000 (diff) | |
parent | 2f4bff8415b28e36346872157104eb71322a743a (diff) |
npower13_objectmodules: rebase and merge with DEV300_m78
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/app/basic.src | 4 | ||||
-rw-r--r-- | basic/source/basmgr/basmgr.cxx | 27 | ||||
-rwxr-xr-x[-rw-r--r--] | basic/source/classes/sb.cxx | 23 | ||||
-rw-r--r--[-rwxr-xr-x] | basic/source/classes/sbunoobj.cxx | 52 | ||||
-rw-r--r-- | basic/source/runtime/makefile.mk | 3 | ||||
-rw-r--r-- | basic/source/uno/namecont.cxx | 157 |
6 files changed, 179 insertions, 87 deletions
diff --git a/basic/source/app/basic.src b/basic/source/app/basic.src index fe7bcff7f6b3..0713fd859f56 100644 --- a/basic/source/app/basic.src +++ b/basic/source/app/basic.src @@ -87,7 +87,7 @@ ModalDialog IDD_ABOUT_DIALOG { FixedText { Pos = MAP_APPFONT( 40, 60 ); Size = MAP_APPFONT( 110, 10 ); - TEXT = "1995 Sun Microsystems, Inc."; + TEXT = "1995-2010 Oracle"; CENTER = TRUE; }; }; @@ -127,7 +127,7 @@ ModalDialog IDD_TT_ABOUT_DIALOG { Pos = MAP_APPFONT( 5, 40 ); Size = MAP_APPFONT( 110, 10 ); CENTER = TRUE; - TEXT[ en-US ] = "©1995-2005 Sun Microsystems, Inc."; + TEXT[ en-US ] = "©1995-2010 Oracle"; }; OKButton RID_OK { Pos = MAP_APPFONT( 40, 60 ); diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 1caa22980f1b..c242165df825 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -101,20 +101,13 @@ typedef WeakImplHelper1< XStarBasicAccess > StarBasicAccessHelper; // + BOOL bReference static const char* szStdLibName = "Standard"; -static const char* szBasicStorage = "StarBASIC"; +static const char szBasicStorage[] = "StarBASIC"; static const char* szOldManagerStream = "BasicManager"; -static const char* szManagerStream = "BasicManager2"; +static const char szManagerStream[] = "BasicManager2"; static const char* szImbedded = "LIBIMBEDDED"; static const char* szCryptingKey = "CryptedBasic"; static const char* szScriptLanguage = "StarBasic"; -static const String BasicStreamName( String::CreateFromAscii(szBasicStorage) ); -static const String ManagerStreamName( String::CreateFromAscii(szManagerStream) ); - - -#define DEFINE_CONST_UNICODE(CONSTASCII) UniString(RTL_CONSTASCII_USTRINGPARAM(CONSTASCII)) - - TYPEINIT1( BasicManager, SfxBroadcaster ); DBG_NAME( BasicManager ); @@ -693,7 +686,7 @@ BasicManager::BasicManager( SotStorage& rStorage, const String& rBaseURL, StarBA // DBG_ASSERT(aStorageName.Len() != 0, "Bad storage name"); // If there is no Manager Stream, no further actions are necessary - if ( rStorage.IsStream( ManagerStreamName ) ) + if ( rStorage.IsStream( String(RTL_CONSTASCII_USTRINGPARAM(szManagerStream)) ) ) { LoadBasicManager( rStorage, rBaseURL ); // StdLib contains Parent: @@ -734,12 +727,12 @@ BasicManager::BasicManager( SotStorage& rStorage, const String& rBaseURL, StarBA // #91626 Save all stream data to save it unmodified if basic isn't modified // in an 6.0+ office. So also the old basic dialogs can be saved. SotStorageStreamRef xManagerStream = rStorage.OpenSotStream - ( ManagerStreamName, eStreamReadMode ); + ( String(RTL_CONSTASCII_USTRINGPARAM(szManagerStream)), eStreamReadMode ); mpImpl->mpManagerStream = new SvMemoryStream(); *static_cast<SvStream*>(&xManagerStream) >> *mpImpl->mpManagerStream; SotStorageRef xBasicStorage = rStorage.OpenSotStorage - ( BasicStreamName, eStorageReadMode, FALSE ); + ( String(RTL_CONSTASCII_USTRINGPARAM(szBasicStorage)), eStorageReadMode, FALSE ); if( xBasicStorage.Is() && !xBasicStorage->GetError() ) { USHORT nLibs = GetLibCount(); @@ -948,7 +941,7 @@ void BasicManager::LoadBasicManager( SotStorage& rStorage, const String& rBaseUR // StreamMode eStreamMode = STREAM_READ | STREAM_NOCREATE | STREAM_SHARE_DENYWRITE; SotStorageStreamRef xManagerStream = rStorage.OpenSotStream - ( ManagerStreamName, eStreamReadMode ); + ( String(RTL_CONSTASCII_USTRINGPARAM(szManagerStream)), eStreamReadMode ); String aStorName( rStorage.GetName() ); // #i13114 removed, DBG_ASSERT( aStorName.Len(), "No Storage Name!" ); @@ -1196,7 +1189,7 @@ BOOL BasicManager::ImpLoadLibary( BasicLibInfo* pLibInfo, SotStorage* pCurStorag xStorage = new SotStorage( FALSE, aStorageName, eStorageReadMode ); SotStorageRef xBasicStorage = xStorage->OpenSotStorage - ( BasicStreamName, eStorageReadMode, FALSE ); + ( String(RTL_CONSTASCII_USTRINGPARAM(szBasicStorage)), eStorageReadMode, FALSE ); if ( !xBasicStorage.Is() || xBasicStorage->GetError() ) { @@ -1449,10 +1442,10 @@ BOOL BasicManager::RemoveLib( USHORT nLib, BOOL bDelBasicFromStorage ) else xStorage = new SotStorage( FALSE, pLibInfo->GetStorageName() ); - if ( xStorage->IsStorage( BasicStreamName ) ) + if ( xStorage->IsStorage( String(RTL_CONSTASCII_USTRINGPARAM(szBasicStorage)) ) ) { SotStorageRef xBasicStorage = xStorage->OpenSotStorage - ( BasicStreamName, STREAM_STD_READWRITE, FALSE ); + ( String(RTL_CONSTASCII_USTRINGPARAM(szBasicStorage)), STREAM_STD_READWRITE, FALSE ); if ( !xBasicStorage.Is() || xBasicStorage->GetError() ) { @@ -1472,7 +1465,7 @@ BOOL BasicManager::RemoveLib( USHORT nLib, BOOL bDelBasicFromStorage ) if ( !aInfoList.Count() ) { xBasicStorage.Clear(); - xStorage->Remove( BasicStreamName ); + xStorage->Remove( String(RTL_CONSTASCII_USTRINGPARAM(szBasicStorage)) ); xStorage->Commit(); // If no further Streams or SubStorages available, // delete the Storage, too. diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 233b181757f0..47ef141632c3 100644..100755 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -55,6 +55,7 @@ #include "sb.hrc" #include <basrid.hxx> #include <vos/mutex.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/script/ModuleType.hpp> #include <com/sun/star/script/ModuleInfo.hpp> @@ -68,6 +69,10 @@ TYPEINIT1(StarBASIC,SbxObject) #define RTLNAME "@SBRTL" // i#i68894# +using com::sun::star::uno::Reference; +using com::sun::star::uno::Any; +using com::sun::star::uno::UNO_QUERY; +using com::sun::star::lang::XMultiServiceFactory; const static String aThisComponent( RTL_CONSTASCII_USTRINGPARAM("ThisComponent") ); const static String aVBAHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) ); @@ -75,7 +80,25 @@ const static String aVBAHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) ); SbxObject* StarBASIC::getVBAGlobals( ) { if ( !pVBAGlobals ) + { + Any aThisDoc; + if ( GetUNOConstant("ThisComponent", aThisDoc) ) + { + Reference< XMultiServiceFactory > xDocFac( aThisDoc, UNO_QUERY ); + if ( xDocFac.is() ) + { + try + { + xDocFac->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAGlobals" ) ) ); + } + catch( Exception& ) + { + // Ignore + } + } + } pVBAGlobals = (SbUnoObject*)Find( aVBAHook , SbxCLASS_DONTCARE ); + } return pVBAGlobals; } diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 1e278bf583a7..1c95b4f30de6 100755..100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -112,9 +112,9 @@ typedef WeakImplHelper1< XAllListener > BasicAllListenerHelper; // Identifier fuer die dbg_-Properies als Strings anlegen -static String ID_DBG_SUPPORTEDINTERFACES( RTL_CONSTASCII_USTRINGPARAM("Dbg_SupportedInterfaces") ); -static String ID_DBG_PROPERTIES( RTL_CONSTASCII_USTRINGPARAM("Dbg_Properties") ); -static String ID_DBG_METHODS( RTL_CONSTASCII_USTRINGPARAM("Dbg_Methods") ); +static char const ID_DBG_SUPPORTEDINTERFACES[] = "Dbg_SupportedInterfaces"; +static char const ID_DBG_PROPERTIES[] = "Dbg_Properties"; +static char const ID_DBG_METHODS[] = "Dbg_Methods"; static ::rtl::OUString aSeqLevelStr( RTL_CONSTASCII_USTRINGPARAM("[]") ); static ::rtl::OUString defaultNameSpace( RTL_CONSTASCII_USTRINGPARAM("ooo.vba") ); @@ -139,16 +139,19 @@ bool SbUnoObject::getDefaultPropName( SbUnoObject* pUnoObj, String& sDfltProp ) SbxVariable* getDefaultProp( SbxVariable* pRef ) { SbxVariable* pDefaultProp = NULL; - SbxObject* pObj = PTR_CAST(SbxObject,(SbxVariable*) pRef); - if ( !pObj ) + if ( pRef->GetType() == SbxOBJECT ) { - SbxBase* pObjVarObj = pRef->GetObject(); - pObj = PTR_CAST(SbxObject,pObjVarObj); - } - if ( pObj && pObj->ISA(SbUnoObject) ) - { - SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,(SbxObject*)pObj); - pDefaultProp = pUnoObj->GetDfltProperty(); + SbxObject* pObj = PTR_CAST(SbxObject,(SbxVariable*) pRef); + if ( !pObj ) + { + SbxBase* pObjVarObj = pRef->GetObject(); + pObj = PTR_CAST(SbxObject,pObjVarObj); + } + if ( pObj && pObj->ISA(SbUnoObject) ) + { + SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,(SbxObject*)pObj); + pDefaultProp = pUnoObj->GetDfltProperty(); + } } return pDefaultProp; } @@ -1601,6 +1604,23 @@ bool checkUnoObjectType( SbUnoObject* pUnoObj, break; } ::rtl::OUString sClassName = xClass->getName(); + if ( sClassName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.bridge.oleautomation.XAutomationObject" ) ) ) ) + { + // there is a hack in the extensions/source/ole/oleobj.cxx to return the typename of the automation object, lets check if it + // matches + Reference< XInvocation > xInv( aToInspectObj, UNO_QUERY ); + if ( xInv.is() ) + { + rtl::OUString sTypeName; + xInv->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("$GetTypeName") ) ) >>= sTypeName; + if ( sTypeName.getLength() == 0 || sTypeName.equals( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IDispatch") ) ) ) + // can't check type, leave it pass + result = true; + else + result = sTypeName.equals( aClass ); + } + break; // finished checking automation object + } OSL_TRACE("Checking if object implements %s", OUStringToOString( defaultNameSpace + aClass, RTL_TEXTENCODING_UTF8 ).getStr() ); @@ -1630,7 +1650,7 @@ String Impl_GetSupportedInterfaces( SbUnoObject* pUnoObj ) String aRet; if( eType != TypeClass_INTERFACE ) { - aRet += ID_DBG_SUPPORTEDINTERFACES; + aRet.AppendAscii( RTL_CONSTASCII_STRINGPARAM(ID_DBG_SUPPORTEDINTERFACES) ); aRet.AppendAscii( " not available.\n(TypeClass is not TypeClass_INTERFACE)\n" ); } else @@ -2653,15 +2673,15 @@ void SbUnoObject::implCreateDbgProperties( void ) Property aProp; // Id == -1: Implementierte Interfaces gemaess ClassProvider anzeigen - SbxVariableRef xVarRef = new SbUnoProperty( ID_DBG_SUPPORTEDINTERFACES, SbxSTRING, aProp, -1, false ); + SbxVariableRef xVarRef = new SbUnoProperty( String(RTL_CONSTASCII_USTRINGPARAM(ID_DBG_SUPPORTEDINTERFACES)), SbxSTRING, aProp, -1, false ); QuickInsert( (SbxVariable*)xVarRef ); // Id == -2: Properties ausgeben - xVarRef = new SbUnoProperty( ID_DBG_PROPERTIES, SbxSTRING, aProp, -2, false ); + xVarRef = new SbUnoProperty( String(RTL_CONSTASCII_USTRINGPARAM(ID_DBG_PROPERTIES)), SbxSTRING, aProp, -2, false ); QuickInsert( (SbxVariable*)xVarRef ); // Id == -3: Methoden ausgeben - xVarRef = new SbUnoProperty( ID_DBG_METHODS, SbxSTRING, aProp, -3, false ); + xVarRef = new SbUnoProperty( String(RTL_CONSTASCII_USTRINGPARAM(ID_DBG_METHODS)), SbxSTRING, aProp, -3, false ); QuickInsert( (SbxVariable*)xVarRef ); } diff --git a/basic/source/runtime/makefile.mk b/basic/source/runtime/makefile.mk index c0b4bd3bdc10..9bd197975ee6 100644 --- a/basic/source/runtime/makefile.mk +++ b/basic/source/runtime/makefile.mk @@ -82,8 +82,5 @@ EXCEPTIONSFILES=$(SLO)$/step0.obj \ $(SLO)$/%.obj: %.s #kendy: Cut'n'paste from bridges/source/cpp_uno/mingw_intel/makefile.mk -#cmc: Ideally --noexecstack would be in operations, but with #i51385# pyuno -#remote bridgeing breaks -# $(CC) -Wa,--noexecstack -c -o $(SLO)$/$(@:b).o $< $(CC) -c -o $(SLO)$/$(@:b).obj $< touch $@ diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index 7b1839089bf9..90e7cb4cb4d5 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -1744,7 +1744,7 @@ void SfxLibraryContainer::implImportLibDescriptor // Methods of new XLibraryStorage interface? -void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XStorage >& xStorage, sal_Bool bComplete ) +void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XStorage >& i_rStorage, sal_Bool bComplete ) { const Sequence< OUString > aNames = maNameContainer.getElementNames(); sal_Int32 nNameCount = aNames.getLength(); @@ -1765,35 +1765,13 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto ::xmlscript::LibDescriptorArray* pLibArray = new ::xmlscript::LibDescriptorArray( nLibsToSave ); // Write to storage? - sal_Bool bStorage = xStorage.is(); - uno::Reference< embed::XStorage > xLibrariesStor; + sal_Bool bStorage = i_rStorage.is(); uno::Reference< embed::XStorage > xSourceLibrariesStor; - if( bStorage ) + uno::Reference< embed::XStorage > xTargetLibrariesStor; + ::rtl::OUString sTempTargetStorName; + const bool bInplaceStorage = bStorage && ( i_rStorage == mxStorage ); + if ( bStorage ) { - // when we save to our root storage, ensure the libs are all loaded. Else the below cleaning - // of the target storage will loose them. - if ( xStorage == mxStorage ) - { - pName = aNames.getConstArray(); - for ( ; pName != pNamesEnd; ++pName ) - { - if ( !isLibraryLoaded( *pName ) ) - loadLibrary( *pName ); - } - } - - // first of all, clean the target library storage, since the storing procedure must do overwrite - try - { - if ( xStorage->hasByName( maLibrariesDir ) ) - xStorage->removeElement( maLibrariesDir ); - } - catch( const uno::Exception& ) - { - DBG_UNHANDLED_EXCEPTION(); - return; - } - // Don't write if only empty standard lib exists if ( ( nNameCount == 1 ) && ( aNames[0].equalsAscii( "Standard" ) ) ) { @@ -1804,29 +1782,54 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto return; } - try { - xLibrariesStor.set( xStorage->openStorageElement( maLibrariesDir, embed::ElementModes::READWRITE ), UNO_QUERY_THROW ); + // create the empty target storage + try + { + ::rtl::OUString sTargetLibrariesStoreName; + if ( bInplaceStorage ) + { + // create a temporary target storage + const ::rtl::OUStringBuffer aTempTargetNameBase = maLibrariesDir + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_temp_" ) ); + sal_Int32 index = 0; + do + { + ::rtl::OUStringBuffer aTempTargetName( aTempTargetNameBase ); + aTempTargetName.append( index++ ); + + sTargetLibrariesStoreName = aTempTargetName.makeStringAndClear(); + if ( !i_rStorage->hasByName( sTargetLibrariesStoreName ) ) + break; + } + while ( true ); + sTempTargetStorName = sTargetLibrariesStoreName; + } + else + { + sTargetLibrariesStoreName = maLibrariesDir; + if ( i_rStorage->hasByName( sTargetLibrariesStoreName ) ) + i_rStorage->removeElement( sTargetLibrariesStoreName ); + } + + xTargetLibrariesStor.set( i_rStorage->openStorageElement( sTargetLibrariesStoreName, embed::ElementModes::READWRITE ), UNO_QUERY_THROW ); } - catch( uno::Exception& ) + catch( const uno::Exception& ) { - #if OSL_DEBUG_LEVEL > 0 - Any aError( ::cppu::getCaughtException() ); - ::rtl::OStringBuffer aMessage; - aMessage.append( "couln't open source library storage.\n\nException:" ); - aMessage.append( ::rtl::OUStringToOString( ::comphelper::anyToString( aError ), osl_getThreadTextEncoding() ) ); - OSL_ENSURE( false, aMessage.makeStringAndClear().getStr() ); - #endif + DBG_UNHANDLED_EXCEPTION(); return; } + // open the source storage which might be used to copy yet-unmodified libraries try { - if ( ( mxStorage != xStorage ) && ( mxStorage->hasByName( maLibrariesDir ) ) ) - xSourceLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, embed::ElementModes::READ ); + if ( mxStorage->hasByName( maLibrariesDir ) ) + xSourceLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, bInplaceStorage ? embed::ElementModes::READWRITE : embed::ElementModes::READ ); + else if ( bInplaceStorage ) + xSourceLibrariesStor = mxStorage->openStorageElement( maLibrariesDir, embed::ElementModes::READWRITE ); } catch( const uno::Exception& ) { DBG_UNHANDLED_EXCEPTION(); + return; } } @@ -1838,7 +1841,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto SfxLibrary* pImplLib = getImplLib( *pName ); if( pImplLib->mbSharedIndexFile ) continue; - bool bExtensionLib = pImplLib->mbExtension; + const bool bExtensionLib = pImplLib->mbExtension; ::xmlscript::LibDescriptor& rLib = bExtensionLib ? aLibDescriptorForExtensionLibs : pLibArray->mpLibs[iArray]; if( !bExtensionLib ) @@ -1858,12 +1861,14 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto if( pImplLib->implIsModified() || bComplete ) { - // Can we copy the storage? + // Can we simply copy the storage? if( !mbOldInfoFormat && !pImplLib->implIsModified() && !mbOasis2OOoFormat && xSourceLibrariesStor.is() ) { - try { - xSourceLibrariesStor->copyElementTo( rLib.aName, xLibrariesStor, rLib.aName ); - } catch( uno::Exception& ) + try + { + xSourceLibrariesStor->copyElementTo( rLib.aName, xTargetLibrariesStor, rLib.aName ); + } + catch( const uno::Exception& ) { DBG_UNHANDLED_EXCEPTION(); // TODO: error handling? @@ -1876,7 +1881,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto { try { - xLibraryStor = xLibrariesStor->openStorageElement( + xLibraryStor = xTargetLibrariesStor->openStorageElement( rLib.aName, embed::ElementModes::READWRITE ); } @@ -1908,7 +1913,8 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto implStoreLibraryIndexFile( pImplLib, rLib, xLibraryStor ); if( bStorage ) { - try { + try + { uno::Reference< embed::XTransactedObject > xTransact( xLibraryStor, uno::UNO_QUERY_THROW ); xTransact->commit(); } @@ -1928,6 +1934,59 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto rLib.bReadOnly = pImplLib->mbReadOnlyLink; } + // if we did an in-place save into a storage (i.e. a save into the storage we were already based on), + // then we need to clean up the temporary storage we used for this + if ( bInplaceStorage && sTempTargetStorName.getLength() ) + { + OSL_ENSURE( xSourceLibrariesStor.is(), "SfxLibrariesContainer::storeLibraries_impl: unexpected: we should have a source storage here!" ); + try + { + // for this, we first remove everything from the source storage, then copy the complete content + // from the temporary target storage. From then on, what used to be the "source storage" becomes + // the "targt storage" for all subsequent operations. + + // (We cannot simply remove the storage, denoted by maLibrariesDir, from i_rStorage - there might be + // open references to it.) + + if ( xSourceLibrariesStor.is() ) + { + // remove + const Sequence< ::rtl::OUString > aRemoveNames( xSourceLibrariesStor->getElementNames() ); + for ( const ::rtl::OUString* pRemoveName = aRemoveNames.getConstArray(); + pRemoveName != aRemoveNames.getConstArray() + aRemoveNames.getLength(); + ++pRemoveName + ) + { + xSourceLibrariesStor->removeElement( *pRemoveName ); + } + + // copy + const Sequence< ::rtl::OUString > aCopyNames( xTargetLibrariesStor->getElementNames() ); + for ( const ::rtl::OUString* pCopyName = aCopyNames.getConstArray(); + pCopyName != aCopyNames.getConstArray() + aCopyNames.getLength(); + ++pCopyName + ) + { + xTargetLibrariesStor->copyElementTo( *pCopyName, xSourceLibrariesStor, *pCopyName ); + } + } + + // close and remove temp target + xTargetLibrariesStor->dispose(); + i_rStorage->removeElement( sTempTargetStorName ); + xTargetLibrariesStor.clear(); + sTempTargetStorName = ::rtl::OUString(); + + // adjust target + xTargetLibrariesStor = xSourceLibrariesStor; + xSourceLibrariesStor.clear(); + } + catch( const Exception& ) + { + DBG_UNHANDLED_EXCEPTION(); + } + } + if( !mbOldInfoFormat && !maModifiable.isModified() ) return; maModifiable.setModified( sal_False ); @@ -1953,7 +2012,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto aStreamName += String( RTL_CONSTASCII_USTRINGPARAM("-lc.xml") ); try { - xInfoStream = xLibrariesStor->openStreamElement( aStreamName, embed::ElementModes::READWRITE ); + xInfoStream = xTargetLibrariesStor->openStreamElement( aStreamName, embed::ElementModes::READWRITE ); uno::Reference< beans::XPropertySet > xProps( xInfoStream, uno::UNO_QUERY ); OSL_ENSURE ( xProps.is(), "The stream must implement XPropertySet!\n" ); if ( !xProps.is() ) @@ -2012,7 +2071,7 @@ void SfxLibraryContainer::storeLibraries_Impl( const uno::Reference< embed::XSto xmlscript::exportLibraryContainer( xHandler, pLibArray ); if ( bStorage ) { - uno::Reference< embed::XTransactedObject > xTransact( xLibrariesStor, uno::UNO_QUERY ); + uno::Reference< embed::XTransactedObject > xTransact( xTargetLibrariesStor, uno::UNO_QUERY ); OSL_ENSURE( xTransact.is(), "The storage must implement XTransactedObject!\n" ); if ( !xTransact.is() ) throw uno::RuntimeException(); |