diff options
Diffstat (limited to 'sot/source/sdstor/storage.cxx')
-rw-r--r-- | sot/source/sdstor/storage.cxx | 123 |
1 files changed, 0 insertions, 123 deletions
diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx index ef398d081904..ae76765a5a3f 100644 --- a/sot/source/sdstor/storage.cxx +++ b/sot/source/sdstor/storage.cxx @@ -744,129 +744,6 @@ void SotStorage::RemoveUNOStorageHolder( UNOStorageHolder* pHolder ) } /************************************************************************* -|* SotStorage::GetUNOAPIDuplicate() -|* -|* Beschreibung -*************************************************************************/ -uno::Reference< embed::XStorage > SotStorage::GetUNOAPIDuplicate( const String& rEleName, sal_Int32 nUNOStorageMode ) -{ - // after we create a duplicate we will register wrapper - // for storage messages, the wrapper will control the real storage - // the real storage will be able to ask the duplicate to dispose if it's parent is disposed - - uno::Reference< embed::XStorage > xResult; - - UCBStorage* pStg = PTR_CAST( UCBStorage, m_pOwnStg ); - if ( !pStg ) - return xResult; - - UNOStorageHolderList* pUNOStorageHolderList = pStg->GetUNOStorageHolderList(); - if ( !pUNOStorageHolderList ) - return xResult; - - for ( UNOStorageHolderList::iterator aIter = pUNOStorageHolderList->begin(); - aIter != pUNOStorageHolderList->end(); ++aIter ) - if ( (*aIter) && (*aIter)->GetStorageName().Equals( rEleName ) ) - { - // the storage is already in use - return xResult; - } - - if ( IsStream( rEleName ) ) - return xResult; - - if ( GetError() == ERRCODE_NONE ) - { - StreamMode nMode = ( ( nUNOStorageMode & embed::ElementModes::WRITE ) == embed::ElementModes::WRITE ) ? - STREAM_WRITE : ( STREAM_READ | STREAM_NOCREATE ); - if ( nUNOStorageMode & embed::ElementModes::NOCREATE ) - nMode |= STREAM_NOCREATE; - - sal_Bool bStorageReady = !IsStorage( rEleName ); - SotStorageRef pChildStorage = OpenUCBStorage( rEleName, nMode, STORAGE_TRANSACTED ); - if ( pChildStorage->GetError() == ERRCODE_NONE && pChildStorage->m_pOwnStg ) - { - ::utl::TempFile* pTempFile = new ::utl::TempFile(); - if ( pTempFile->GetURL().Len() ) - { - if ( !bStorageReady ) - { - UCBStorage* pChildUCBStg = PTR_CAST( UCBStorage, pChildStorage->m_pOwnStg ); - if ( pChildUCBStg ) - { - UCBStorage* pTempStorage = new UCBStorage( pTempFile->GetURL(), STREAM_WRITE, sal_False, sal_True ); - if ( pTempStorage ) - { - pChildUCBStg->CopyTo( pTempStorage ); - - // CopyTo does not transport unknown media type - // just workaround it - uno::Any aMediaType; - - if ( pChildUCBStg->GetProperty( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")), aMediaType ) ) - pTempStorage->SetProperty( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")), aMediaType ); - - bStorageReady = !pChildUCBStg->GetError() && !pTempStorage->GetError() - && pTempStorage->Commit(); - - delete ((BaseStorage*)pTempStorage); - pTempStorage = NULL; - } - } - - OSL_ENSURE( bStorageReady, "Problem on storage copy!\n" ); - } - - if ( bStorageReady ) - { - try { - uno::Reference< lang::XSingleServiceFactory > xStorageFactory( - ::comphelper::getProcessServiceFactory()->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.StorageFactory")) ), - uno::UNO_QUERY ); - - OSL_ENSURE( xStorageFactory.is(), "Can't create storage factory!\n" ); - if ( xStorageFactory.is() ) - { - uno::Sequence< uno::Any > aArg( 2 ); - aArg[0] <<= ::rtl::OUString( pTempFile->GetURL() ); - aArg[1] <<= nUNOStorageMode; - uno::Reference< embed::XStorage > xDuplStorage( - xStorageFactory->createInstanceWithArguments( aArg ), - uno::UNO_QUERY ); - - OSL_ENSURE( xDuplStorage.is(), "Can't open storage!\n" ); - if ( xDuplStorage.is() ) - { - UNOStorageHolder* pHolder = - new UNOStorageHolder( *this, *pChildStorage, xDuplStorage, pTempFile ); - pHolder->acquire(); - pTempFile = NULL; - pUNOStorageHolderList->push_back( pHolder ); - xResult = xDuplStorage; - } - } - } - catch( uno::Exception& e ) - { - (void)e; - OSL_FAIL( ::rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ) ); - } - } - } - - if ( pTempFile != NULL ) - delete pTempFile; - } - else - SetError( pChildStorage->GetError() ); - } - - return xResult; -} - -/************************************************************************* |* SotStorage::CreateMemoryStream() |* |* Beschreibung |