diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-07-21 18:56:16 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-07-21 18:56:16 +0200 |
commit | a233dac0653f3f3054f7ad2da114ed989747e89a (patch) | |
tree | bf1e11438321c06125a94308649c496648061ccb /sot | |
parent | acb6133d89abe071108577f821d7eaa381378879 (diff) | |
parent | e5647de7dd26775e45af24f11ac4f82a5518bd9e (diff) |
resyncing to master
Diffstat (limited to 'sot')
-rw-r--r-- | sot/Library_sot.mk | 6 | ||||
-rw-r--r-- | sot/inc/sot/stg.hxx | 1 | ||||
-rw-r--r-- | sot/inc/sot/storage.hxx | 6 | ||||
-rw-r--r-- | sot/source/base/factory.cxx | 7 | ||||
-rw-r--r-- | sot/source/sdstor/stgdir.cxx | 5 | ||||
-rw-r--r-- | sot/source/sdstor/stgstrms.cxx | 2 | ||||
-rw-r--r-- | sot/source/sdstor/storage.cxx | 155 | ||||
-rw-r--r-- | sot/source/sdstor/ucbstorage.cxx | 12 | ||||
-rw-r--r-- | sot/source/unoolestorage/register.cxx | 7 | ||||
-rw-r--r-- | sot/util/sot.component | 2 |
10 files changed, 18 insertions, 185 deletions
diff --git a/sot/Library_sot.mk b/sot/Library_sot.mk index 79f94858a688..dc4d1912e2be 100644 --- a/sot/Library_sot.mk +++ b/sot/Library_sot.mk @@ -36,7 +36,11 @@ $(eval $(call gb_Library_set_componentfile,sot,sot/util/sot)) $(eval $(call gb_Library_set_include,sot,\ -I$(realpath $(SRCDIR)/sot/inc/pch) \ $$(INCLUDE) \ - -I$(OUTDIR)/inc/offuh \ +)) + +$(eval $(call gb_Library_add_api,sot,\ + udkapi \ + offapi \ )) $(eval $(call gb_Library_add_defs,sot,\ diff --git a/sot/inc/sot/stg.hxx b/sot/inc/sot/stg.hxx index 2d17974d0a2d..df43ca771e3c 100644 --- a/sot/inc/sot/stg.hxx +++ b/sot/inc/sot/stg.hxx @@ -262,7 +262,6 @@ protected: ~UCBStorageStream(); public: TYPEINFO(); - UCBStorageStream( const String& rName, StreamMode nMode, sal_Bool bDirect, const ByteString* pKey=0 ); UCBStorageStream( const String& rName, StreamMode nMode, sal_Bool bDirect, const ByteString* pKey, sal_Bool bRepair, ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XProgressHandler > xProgress ); UCBStorageStream( UCBStorageStream_Impl* ); diff --git a/sot/inc/sot/storage.hxx b/sot/inc/sot/storage.hxx index e1ce95158b12..9913edaaa40f 100644 --- a/sot/inc/sot/storage.hxx +++ b/sot/inc/sot/storage.hxx @@ -208,9 +208,6 @@ public: SotStorageStream * OpenSotStream( const String & rEleName, StreamMode = STREAM_STD_READWRITE, StorageMode = 0 ); - SotStorageStream * OpenEncryptedSotStream( const String & rEleName, const ByteString& rKey, - StreamMode = STREAM_STD_READWRITE, - StorageMode = 0 ); SotStorage * OpenSotStorage( const String & rEleName, StreamMode = STREAM_STD_READWRITE, StorageMode = STORAGE_TRANSACTED ); @@ -242,9 +239,6 @@ public: static sal_Bool IsOLEStorage( const String & rFileName ); static sal_Bool IsOLEStorage( SvStream* pStream ); - // this is temporary HACK, _MUST_ be removed before release - ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > - GetUNOAPIDuplicate( const String& rEleName, sal_Int32 nUNOStorageMode ); void RemoveUNOStorageHolder( UNOStorageHolder* pHolder ); static SotStorage* OpenOLEStorage( const com::sun::star::uno::Reference < com::sun::star::embed::XStorage >& xStorage, diff --git a/sot/source/base/factory.cxx b/sot/source/base/factory.cxx index 01d098e62a75..79393375138d 100644 --- a/sot/source/base/factory.cxx +++ b/sot/source/base/factory.cxx @@ -39,6 +39,7 @@ #include <sot/sotdata.hxx> #include <sot/clsids.hxx> #include <rtl/instance.hxx> +#include <rtl/strbuf.hxx> /************** class SotData_Impl *********************************************/ /************************************************************************* @@ -78,9 +79,9 @@ void SotFactory::DeInit() if( pSotData->nSvObjCount ) { #ifdef DBG_UTIL - ByteString aStr( "Objects alive: " ); - aStr.Append( ByteString::CreateFromInt32( pSotData->nSvObjCount ) ); - DBG_WARNING( aStr.GetBuffer() ); + rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM("Objects alive: ")); + aStr.append(static_cast<sal_Int32>(pSotData->nSvObjCount)); + DBG_WARNING(aStr.getStr()); #endif return; } diff --git a/sot/source/sdstor/stgdir.cxx b/sot/source/sdstor/stgdir.cxx index 4951daa70a6c..fc9610a6af3b 100644 --- a/sot/source/sdstor/stgdir.cxx +++ b/sot/source/sdstor/stgdir.cxx @@ -853,7 +853,10 @@ void StgDirStrm::SetupEntry( sal_Int32 n, StgDirEntry* pUpper ) } else { - rIo.SetError( SVSTREAM_CANNOT_MAKE ); + // bnc#682484: There are some really broken docs out there + // that contain duplicate entries in 'Directory' section + // so don't set the error flag here and just skip those + // (was: rIo.SetError( SVSTREAM_CANNOT_MAKE );) delete pCur; pCur = NULL; return; } diff --git a/sot/source/sdstor/stgstrms.cxx b/sot/source/sdstor/stgstrms.cxx index fe40be155b9e..48e8de3ede6d 100644 --- a/sot/source/sdstor/stgstrms.cxx +++ b/sot/source/sdstor/stgstrms.cxx @@ -798,7 +798,7 @@ void* StgDataStrm::GetPtr( sal_Int32 Pos, sal_Bool bForce, sal_Bool bDirty ) if( Pos2Page( Pos ) ) { StgPage* pPg = rIo.Get( nPage, bForce ); - if( pPg ) + if (pPg && nOffset < pPg->GetSize()) { pPg->SetOwner( pEntry ); if( bDirty ) diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx index ef398d081904..50a30d89b45e 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 @@ -1110,38 +987,6 @@ sal_Bool SotStorage::Revert() return SVSTREAM_OK == GetError(); } -/************************************************************************* -|* SotStorage::OpenStream() -|* -|* Beschreibung -*************************************************************************/ -SotStorageStream * SotStorage::OpenEncryptedSotStream( const String & rEleName, const ByteString& rKey, - StreamMode nMode, - StorageMode nStorageMode ) -{ - DBG_ASSERT( !nStorageMode, "StorageModes ignored" ); - SotStorageStream * pStm = NULL; - DBG_ASSERT( Owner(), "must be owner" ); - if( m_pOwnStg ) - { - // volle Ole-Patches einschalten - // egal was kommt, nur exclusiv gestattet - nMode |= STREAM_SHARE_DENYALL; - ErrCode nE = m_pOwnStg->GetError(); - BaseStorageStream* p = m_pOwnStg->OpenStream( rEleName, nMode, - (nStorageMode & STORAGE_TRANSACTED) ? sal_False : sal_True, &rKey ); - pStm = new SotStorageStream( p ); - - if( !nE ) - m_pOwnStg->ResetError(); // kein Fehler setzen - if( nMode & STREAM_TRUNC ) - pStm->SetSize( 0 ); - } - else - SetError( SVSTREAM_GENERALERROR ); - return pStm; -} - SotStorageStream * SotStorage::OpenSotStream( const String & rEleName, StreamMode nMode, StorageMode nStorageMode ) diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx index 198a6572dec3..dfc5024889a3 100644 --- a/sot/source/sdstor/ucbstorage.cxx +++ b/sot/source/sdstor/ucbstorage.cxx @@ -1336,15 +1336,6 @@ void UCBStorageStream_Impl::PrepareCachedForReopen( StreamMode nMode ) } } -UCBStorageStream::UCBStorageStream( const String& rName, StreamMode nMode, sal_Bool bDirect, const ByteString* pKey ) -{ - // pImp must be initialized in the body, because otherwise the vtable of the stream is not initialized - // to class UCBStorageStream ! - pImp = new UCBStorageStream_Impl( rName, nMode, this, bDirect, pKey ); - pImp->AddRef(); // use direct refcounting because in header file only a pointer should be used - StorageBase::m_nMode = pImp->m_nMode; -} - UCBStorageStream::UCBStorageStream( const String& rName, StreamMode nMode, sal_Bool bDirect, const ByteString* pKey, sal_Bool bRepair, Reference< XProgressHandler > xProgress ) { // pImp must be initialized in the body, because otherwise the vtable of the stream is not initialized @@ -3275,7 +3266,7 @@ sal_Bool UCBStorage::IsStorageFile( SvStream* pFile ) return sal_False; pFile->Seek(0); - sal_uInt32 nBytes; + sal_uInt32 nBytes(0); *pFile >> nBytes; // search for the magic bytes @@ -3286,6 +3277,7 @@ sal_Bool UCBStorage::IsStorageFile( SvStream* pFile ) bRet = ( nBytes == 0x08074b50 ); if ( bRet ) { + nBytes = 0; *pFile >> nBytes; bRet = ( nBytes == 0x04034b50 ); } diff --git a/sot/source/unoolestorage/register.cxx b/sot/source/unoolestorage/register.cxx index 696e0cefed93..2738a8054af3 100644 --- a/sot/source/unoolestorage/register.cxx +++ b/sot/source/unoolestorage/register.cxx @@ -41,12 +41,7 @@ using namespace ::com::sun::star; extern "C" { -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) +SAL_DLLPUBLIC_EXPORT void * SAL_CALL sot_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) { void * pRet = 0; diff --git a/sot/util/sot.component b/sot/util/sot.component index 7d17c7d54475..44ca8cea7a9a 100644 --- a/sot/util/sot.component +++ b/sot/util/sot.component @@ -26,7 +26,7 @@ * **********************************************************************--> -<component loader="com.sun.star.loader.SharedLibrary" +<component loader="com.sun.star.loader.SharedLibrary" prefix="sot" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.comp.embed.OLESimpleStorage"> <service name="com.sun.star.embed.OLESimpleStorage"/> |