diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-03-06 16:06:40 +0600 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-03-11 04:43:28 +0100 |
commit | 1ac5353bbb25bd9ff0ab0e157b3dbd0da325480a (patch) | |
tree | 540dc6574b0d1b2e67afee3d670b8805493f28fa | |
parent | e2bfc34d146806a8f96be0cd2323d716f12cba4e (diff) |
Use weak reference to SfxObjectShell in SfxEventHint to avoid use-after-free
The events may be processed after the shell has been destroyed. This is
happening reliably after commit e2bfc34d146806a8f96be0cd2323d716f12cba4e
(Reimplement OleComponentNative_Impl to use IGlobalInterfaceTable,
2024-03-11) when controlling LibreOffice from external Java scripts; but
obviously, it could happen before as well.
Now SotObject inherits from cppu::OWeakObject, instead of SvRefBase.
Change-Id: I73a3531499a3068c801c98f40de39bdf8ad90b2b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164458
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
142 files changed, 491 insertions, 508 deletions
diff --git a/basctl/source/basicide/unomodel.cxx b/basctl/source/basicide/unomodel.cxx index 180bf3d17fa7..64938be7754b 100644 --- a/basctl/source/basicide/unomodel.cxx +++ b/basctl/source/basicide/unomodel.cxx @@ -173,7 +173,7 @@ com_sun_star_comp_basic_BasicID_get_implementation( { SolarMutexGuard aGuard; basctl::EnsureIde(); - SfxObjectShell* pShell = new basctl::DocShell(); + rtl::Reference<SfxObjectShell> pShell = new basctl::DocShell(); auto pModel = pShell->GetModel(); pModel->acquire(); return pModel.get(); diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx index bf0c6ee53a46..525482d8dbae 100644 --- a/basic/source/basmgr/basicmanagerrepository.cxx +++ b/basic/source/basmgr/basicmanagerrepository.cxx @@ -430,7 +430,7 @@ namespace basic OUString aAppBasicDir = SvtPathOptions().GetBasicPath(); // Storage and BaseURL are only needed by binary documents! - tools::SvRef<SotStorage> xDummyStor = new SotStorage( OUString() ); + rtl::Reference<SotStorage> xDummyStor = new SotStorage(OUString()); _out_rpBasicManager.reset(new BasicManager( *xDummyStor, u"" /* TODO/LATER: xStorage */, pAppBasic, &aAppBasicDir, true )); diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 03998f30ca9b..72b6f0de5ddf 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -632,7 +632,7 @@ void BasicManager::ImpCreateStdLib( StarBASIC* pParentFromStdLib ) void BasicManager::LoadBasicManager( SotStorage& rStorage, std::u16string_view rBaseURL ) { - tools::SvRef<SotStorageStream> xManagerStream = rStorage.OpenSotStream( szManagerStream, eStreamReadMode ); + rtl::Reference<SotStorageStream> xManagerStream = rStorage.OpenSotStream( szManagerStream, eStreamReadMode ); OUString aStorName( rStorage.GetName() ); // #i13114 removed, DBG_ASSERT( aStorName.Len(), "No Storage Name!" ); @@ -724,7 +724,7 @@ void BasicManager::LoadBasicManager( SotStorage& rStorage, std::u16string_view r void BasicManager::LoadOldBasicManager( SotStorage& rStorage ) { - tools::SvRef<SotStorageStream> xManagerStream = rStorage.OpenSotStream( szOldManagerStream, eStreamReadMode ); + rtl::Reference<SotStorageStream> xManagerStream = rStorage.OpenSotStream( szOldManagerStream, eStreamReadMode ); OUString aStorName( rStorage.GetName() ); DBG_ASSERT( aStorName.getLength(), "No Storage Name!" ); @@ -777,7 +777,7 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage ) aLibRelStorage = aLibRelStorage.smartRel2Abs( aLibRelStorageName, bWasAbsolute); DBG_ASSERT(!bWasAbsolute, "RelStorageName was absolute!" ); - tools::SvRef<SotStorage> xStorageRef; + rtl::Reference<SotStorage> xStorageRef; if ( aLibAbsStorage == aCurStorage || aLibRelStorageName == szImbedded ) { xStorageRef = &rStorage; @@ -838,7 +838,7 @@ bool BasicManager::ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurStora { aStorageName = GetStorageName(); } - tools::SvRef<SotStorage> xStorage; + rtl::Reference<SotStorage> xStorage; // The current must not be opened again... if ( pCurStorage ) { @@ -861,7 +861,7 @@ bool BasicManager::ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurStora { xStorage = new SotStorage( false, aStorageName, eStorageReadMode ); } - tools::SvRef<SotStorage> xBasicStorage = xStorage->OpenSotStorage( szBasicStorage, eStorageReadMode, false ); + rtl::Reference<SotStorage> xBasicStorage = xStorage->OpenSotStorage( szBasicStorage, eStorageReadMode, false ); if ( !xBasicStorage.is() || xBasicStorage->GetError() ) { @@ -871,7 +871,7 @@ bool BasicManager::ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurStora else { // In the Basic-Storage every lib is in a Stream... - tools::SvRef<SotStorageStream> xBasicStream = xBasicStorage->OpenSotStream( pLibInfo->GetLibName(), eStreamReadMode ); + rtl::Reference<SotStorageStream> xBasicStream = xBasicStorage->OpenSotStream( pLibInfo->GetLibName(), eStreamReadMode ); if ( !xBasicStream.is() || xBasicStream->GetError() ) { ErrCodeMsg aErrInf( ERRCODE_BASMGR_LIBLOAD , pLibInfo->GetLibName(), DialogMask::ButtonsOk ); @@ -1093,7 +1093,7 @@ bool BasicManager::RemoveLib( sal_uInt16 nLib, bool bDelBasicFromStorage ) if (bDelBasicFromStorage && !(*itLibInfo)->IsReference() && (!(*itLibInfo)->IsExtern() || SotStorage::IsStorageFile((*itLibInfo)->GetStorageName()))) { - tools::SvRef<SotStorage> xStorage; + rtl::Reference<SotStorage> xStorage; try { if (!(*itLibInfo)->IsExtern()) @@ -1112,7 +1112,7 @@ bool BasicManager::RemoveLib( sal_uInt16 nLib, bool bDelBasicFromStorage ) if (xStorage.is() && xStorage->IsStorage(szBasicStorage)) { - tools::SvRef<SotStorage> xBasicStorage = xStorage->OpenSotStorage + rtl::Reference<SotStorage> xBasicStorage = xStorage->OpenSotStorage ( szBasicStorage, StreamMode::STD_READWRITE, false ); if ( !xBasicStorage.is() || xBasicStorage->GetError() ) @@ -1286,7 +1286,7 @@ StarBASIC* BasicManager::CreateLib( const OUString& rLibName, const OUString& Pa { try { - tools::SvRef<SotStorage> xStorage = new SotStorage(false, LinkTargetURL, StreamMode::READ | StreamMode::SHARE_DENYWRITE); + rtl::Reference<SotStorage> xStorage = new SotStorage(false, LinkTargetURL, StreamMode::READ | StreamMode::SHARE_DENYWRITE); if (!xStorage->GetError()) { pLib = AddLib(*xStorage, rLibName, true); diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx index f534856dc11b..2a5a1249a017 100644 --- a/basic/source/uno/scriptcont.cxx +++ b/basic/source/uno/scriptcont.cxx @@ -334,7 +334,7 @@ rtl::Reference<SfxLibraryContainer> SfxScriptLibraryContainer::createInstanceImp void SfxScriptLibraryContainer::importFromOldStorage( const OUString& aFile ) { // TODO: move loading from old storage to binary filters? - auto xStorage = tools::make_ref<SotStorage>( false, aFile ); + rtl::Reference<SotStorage> xStorage(new SotStorage(false, aFile)); if( xStorage->GetError() == ERRCODE_NONE ) { auto pBasicManager = std::make_unique<BasicManager> ( *xStorage, aFile ); diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index b723c7958843..401dc9d8ff17 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -2280,7 +2280,7 @@ bool SvxAutoCorrectLanguageLists::IsFileChanged_Imp() void SvxAutoCorrectLanguageLists::LoadXMLExceptList_Imp( std::unique_ptr<SvStringsISortDtor>& rpLst, const OUString& sStrmName, - tools::SvRef<SotStorage>& rStg) + rtl::Reference<SotStorage>& rStg) { if( rpLst ) rpLst->clear(); @@ -2290,7 +2290,7 @@ void SvxAutoCorrectLanguageLists::LoadXMLExceptList_Imp( { if( rStg.is() && rStg->IsStream( sStrmName ) ) { - tools::SvRef<SotStorageStream> xStrm = rStg->OpenSotStream( sStrmName, + rtl::Reference<SotStorageStream> xStrm = rStg->OpenSotStream( sStrmName, ( StreamMode::READ | StreamMode::SHARE_DENYWRITE | StreamMode::NOCREATE ) ); if( ERRCODE_NONE != xStrm->GetError()) { @@ -2351,7 +2351,7 @@ void SvxAutoCorrectLanguageLists::LoadXMLExceptList_Imp( void SvxAutoCorrectLanguageLists::SaveExceptList_Imp( const SvStringsISortDtor& rLst, const OUString& sStrmName, - tools::SvRef<SotStorage> const &rStg, + rtl::Reference<SotStorage> const &rStg, bool bConvert ) { if( !rStg.is() ) @@ -2364,7 +2364,7 @@ void SvxAutoCorrectLanguageLists::SaveExceptList_Imp( } else { - tools::SvRef<SotStorageStream> xStrm = rStg->OpenSotStream( sStrmName, + rtl::Reference<SotStorageStream> xStrm = rStg->OpenSotStream( sStrmName, ( StreamMode::READ | StreamMode::WRITE | StreamMode::SHARE_DENYWRITE ) ); if( xStrm.is() ) { @@ -2483,7 +2483,7 @@ bool SvxAutoCorrectLanguageLists::AddToCplSttExceptList(const OUString& rNew) if( !rNew.isEmpty() && GetCplSttExceptList()->insert( rNew ).second ) { MakeUserStorage_Impl(); - tools::SvRef<SotStorage> xStg = new SotStorage( sUserAutoCorrFile, StreamMode::READWRITE ); + rtl::Reference<SotStorage> xStg = new SotStorage(sUserAutoCorrFile, StreamMode::READWRITE); SaveExceptList_Imp( *pCplStt_ExcptLst, pXMLImplCplStt_ExcptLstStr, xStg ); @@ -2503,7 +2503,7 @@ bool SvxAutoCorrectLanguageLists::AddToWordStartExceptList(const OUString& rNew) if( !rNew.isEmpty() && GetWordStartExceptList()->insert( rNew ).second ) { MakeUserStorage_Impl(); - tools::SvRef<SotStorage> xStg = new SotStorage( sUserAutoCorrFile, StreamMode::READWRITE ); + rtl::Reference<SotStorage> xStg = new SotStorage(sUserAutoCorrFile, StreamMode::READWRITE); SaveExceptList_Imp( *pWordStart_ExcptLst, pXMLImplWordStart_ExcptLstStr, xStg ); @@ -2521,7 +2521,7 @@ SvStringsISortDtor* SvxAutoCorrectLanguageLists::LoadCplSttExceptList() { try { - tools::SvRef<SotStorage> xStg = new SotStorage( sShareAutoCorrFile, StreamMode::READ | StreamMode::SHARE_DENYNONE ); + rtl::Reference<SotStorage> xStg = new SotStorage( sShareAutoCorrFile, StreamMode::READ | StreamMode::SHARE_DENYNONE ); if( xStg.is() && xStg->IsContained( pXMLImplCplStt_ExcptLstStr ) ) LoadXMLExceptList_Imp( pCplStt_ExcptLst, pXMLImplCplStt_ExcptLstStr, xStg ); } @@ -2534,7 +2534,7 @@ SvStringsISortDtor* SvxAutoCorrectLanguageLists::LoadCplSttExceptList() void SvxAutoCorrectLanguageLists::SaveCplSttExceptList() { MakeUserStorage_Impl(); - tools::SvRef<SotStorage> xStg = new SotStorage( sUserAutoCorrFile, StreamMode::READWRITE ); + rtl::Reference<SotStorage> xStg = new SotStorage(sUserAutoCorrFile, StreamMode::READWRITE); SaveExceptList_Imp( *pCplStt_ExcptLst, pXMLImplCplStt_ExcptLstStr, xStg ); @@ -2550,7 +2550,7 @@ SvStringsISortDtor* SvxAutoCorrectLanguageLists::LoadWordStartExceptList() { try { - tools::SvRef<SotStorage> xStg = new SotStorage( sShareAutoCorrFile, StreamMode::READ | StreamMode::SHARE_DENYNONE ); + rtl::Reference<SotStorage> xStg = new SotStorage( sShareAutoCorrFile, StreamMode::READ | StreamMode::SHARE_DENYNONE ); if( xStg.is() && xStg->IsContained( pXMLImplWordStart_ExcptLstStr ) ) LoadXMLExceptList_Imp( pWordStart_ExcptLst, pXMLImplWordStart_ExcptLstStr, xStg ); } @@ -2564,7 +2564,7 @@ SvStringsISortDtor* SvxAutoCorrectLanguageLists::LoadWordStartExceptList() void SvxAutoCorrectLanguageLists::SaveWordStartExceptList() { MakeUserStorage_Impl(); - tools::SvRef<SotStorage> xStg = new SotStorage( sUserAutoCorrFile, StreamMode::READWRITE ); + rtl::Reference<SotStorage> xStg = new SotStorage(sUserAutoCorrFile, StreamMode::READWRITE); SaveExceptList_Imp( *pWordStart_ExcptLst, pXMLImplWordStart_ExcptLstStr, xStg ); @@ -2594,7 +2594,7 @@ void SvxAutoCorrectLanguageLists::RemoveStream_Imp( const OUString& rName ) { if( sShareAutoCorrFile != sUserAutoCorrFile ) { - tools::SvRef<SotStorage> xStg = new SotStorage( sUserAutoCorrFile, StreamMode::READWRITE ); + rtl::Reference<SotStorage> xStg = new SotStorage(sUserAutoCorrFile, StreamMode::READWRITE); if( xStg.is() && ERRCODE_NONE == xStg->GetError() && xStg->IsStream( rName ) ) { @@ -2656,8 +2656,8 @@ void SvxAutoCorrectLanguageLists::MakeUserStorage_Impl() } if (bConvert && !bError) { - tools::SvRef<SotStorage> xSrcStg = new SotStorage( aDest.GetMainURL( INetURLObject::DecodeMechanism::ToIUri ), StreamMode::READ ); - tools::SvRef<SotStorage> xDstStg = new SotStorage( sUserAutoCorrFile, StreamMode::WRITE ); + rtl::Reference<SotStorage> xSrcStg = new SotStorage( aDest.GetMainURL( INetURLObject::DecodeMechanism::ToIUri ), StreamMode::READ ); + rtl::Reference<SotStorage> xDstStg = new SotStorage(sUserAutoCorrFile, StreamMode::WRITE); if( xSrcStg.is() && xDstStg.is() ) { @@ -2705,7 +2705,7 @@ bool SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( SotStorage& rStg ) bool bRet = true, bRemove = !pAutocorr_List || pAutocorr_List->empty(); if( !bRemove ) { - tools::SvRef<SotStorageStream> refList = rStg.OpenSotStream( pXMLImplAutocorr_ListStr, + rtl::Reference<SotStorageStream> refList = rStg.OpenSotStream( pXMLImplAutocorr_ListStr, ( StreamMode::READ | StreamMode::WRITE | StreamMode::SHARE_DENYWRITE ) ); if( refList.is() ) { @@ -2756,7 +2756,7 @@ bool SvxAutoCorrectLanguageLists::MakeCombinedChanges( std::vector<SvxAutocorrWo GetAutocorrWordList(); MakeUserStorage_Impl(); - tools::SvRef<SotStorage> xStorage = new SotStorage( sUserAutoCorrFile, StreamMode::READWRITE ); + rtl::Reference<SotStorage> xStorage = new SotStorage(sUserAutoCorrFile, StreamMode::READWRITE); bool bRet = xStorage.is() && ERRCODE_NONE == xStorage->GetError(); @@ -2825,7 +2825,7 @@ bool SvxAutoCorrectLanguageLists::PutText( const OUString& rShort, const OUStrin GetAutocorrWordList(); MakeUserStorage_Impl(); - tools::SvRef<SotStorage> xStg = new SotStorage( sUserAutoCorrFile, StreamMode::READWRITE ); + rtl::Reference<SotStorage> xStg = new SotStorage(sUserAutoCorrFile, StreamMode::READWRITE); bool bRet = xStg.is() && ERRCODE_NONE == xStg->GetError(); @@ -2883,7 +2883,7 @@ void SvxAutoCorrectLanguageLists::PutText( const OUString& rShort, { if( pAutocorr_List->Insert( SvxAutocorrWord(rShort, sLong, false) ) ) { - tools::SvRef<SotStorage> xStor = new SotStorage( sUserAutoCorrFile, StreamMode::READWRITE ); + rtl::Reference<SotStorage> xStor = new SotStorage( sUserAutoCorrFile, StreamMode::READWRITE ); MakeBlocklist_Imp( *xStor ); } } diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index ccd0f53f4313..702e14d64d89 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -6770,7 +6770,7 @@ void SvxMSDffManager::ProcessClientAnchor2( SvStream& /* rSt */, DffRecordHeader // will be overridden by SJ in Draw } -bool SvxMSDffManager::GetOLEStorageName( sal_uInt32, OUString&, tools::SvRef<SotStorage>&, uno::Reference < embed::XStorage >& ) const +bool SvxMSDffManager::GetOLEStorageName( sal_uInt32, OUString&, rtl::Reference<SotStorage>&, uno::Reference < embed::XStorage >& ) const { return false; } @@ -6789,7 +6789,7 @@ rtl::Reference<SdrObject> SvxMSDffManager::ImportOLE( sal_uInt32 nOLEId, { rtl::Reference<SdrObject> pRet; OUString sStorageName; - tools::SvRef<SotStorage> xSrcStg; + rtl::Reference<SotStorage> xSrcStg; ErrCode nError = ERRCODE_NONE; uno::Reference < embed::XStorage > xDstStg; if( GetOLEStorageName( nOLEId, sStorageName, xSrcStg, xDstStg )) @@ -6811,7 +6811,7 @@ rtl::Reference<SdrObject> SvxMSDffManager::ImportOLE( sal_uInt32 nOLEId, bool SvxMSDffManager::MakeContentStream( SotStorage * pStor, const GDIMetaFile & rMtf ) { - tools::SvRef<SotStorageStream> xStm = pStor->OpenSotStream(SVEXT_PERSIST_STREAM); + rtl::Reference<SotStorageStream> xStm = pStor->OpenSotStream(SVEXT_PERSIST_STREAM); xStm->SetVersion( pStor->GetVersion() ); xStm->SetBufferSize( 8192 ); @@ -6951,10 +6951,10 @@ const ClsIDs aClsIDs[] = { bool SvxMSDffManager::ConvertToOle2( SvStream& rStm, sal_uInt32 nReadLen, - const GDIMetaFile * pMtf, const tools::SvRef<SotStorage>& rDest ) + const GDIMetaFile * pMtf, const rtl::Reference<SotStorage>& rDest ) { bool bMtfRead = false; - tools::SvRef<SotStorageStream> xOle10Stm = rDest->OpenSotStream( "\1Ole10Native", + rtl::Reference<SotStorageStream> xOle10Stm = rDest->OpenSotStream( "\1Ole10Native", StreamMode::WRITE| StreamMode::SHARE_DENYALL ); if( xOle10Stm->GetError() ) return false; @@ -7000,7 +7000,7 @@ bool SvxMSDffManager::ConvertToOle2( SvStream& rStm, sal_uInt32 nReadLen, // write to ole10 stream xOle10Stm->WriteUInt32( nDataLen ); xOle10Stm->WriteBytes(pData.get(), nDataLen); - xOle10Stm = tools::SvRef<SotStorageStream>(); + xOle10Stm.clear(); // set the compobj stream const ClsIDs* pIds; @@ -7118,7 +7118,7 @@ OUString SvxMSDffManager::GetFilterNameFromClassID( const SvGlobalName& aGlobNam void SvxMSDffManager::ExtractOwnStream(SotStorage& rSrcStg, SvMemoryStream& rMemStream) { - tools::SvRef<SotStorageStream> xStr + rtl::Reference<SotStorageStream> xStr = rSrcStg.OpenSotStream("package_stream", StreamMode::STD_READ); xStr->ReadStream(rMemStream); } @@ -7191,7 +7191,7 @@ css::uno::Reference < css::embed::XEmbeddedObject > SvxMSDffManager::CheckForCo } else { - tools::SvRef<SotStorage> xStorage = new SotStorage( false, aMemStream ); + rtl::Reference<SotStorage> xStorage = new SotStorage(false, aMemStream); rSrcStg.CopyTo( xStorage.get() ); xStorage->Commit(); xStorage.clear(); @@ -7305,7 +7305,7 @@ css::uno::Reference < css::embed::XEmbeddedObject > SvxMSDffManager::CheckForCo rtl::Reference<SdrOle2Obj> SvxMSDffManager::CreateSdrOLEFromStorage( SdrModel& rSdrModel, const OUString& rStorageName, - tools::SvRef<SotStorage> const & rSrcStorage, + rtl::Reference<SotStorage> const & rSrcStorage, const uno::Reference < embed::XStorage >& xDestStorage, const Graphic& rGrf, const tools::Rectangle& rBoundRect, @@ -7328,12 +7328,12 @@ rtl::Reference<SdrOle2Obj> SvxMSDffManager::CreateSdrOLEFromStorage( OUString aDstStgName = MSO_OLE_Obj + OUString::number( ++nMSOleObjCntr ); { - tools::SvRef<SotStorage> xObjStg = rSrcStorage->OpenSotStorage( rStorageName ); + rtl::Reference<SotStorage> xObjStg = rSrcStorage->OpenSotStorage(rStorageName); if( xObjStg.is() ) { { sal_uInt8 aTestA[10]; // exist the \1CompObj-Stream ? - tools::SvRef<SotStorageStream> xSrcTst = xObjStg->OpenSotStream( "\1CompObj" ); + rtl::Reference<SotStorageStream> xSrcTst = xObjStg->OpenSotStream("\1CompObj"); bValidStorage = xSrcTst.is() && sizeof( aTestA ) == xSrcTst->ReadBytes(aTestA, sizeof(aTestA)); if( !bValidStorage ) @@ -7354,7 +7354,7 @@ rtl::Reference<SdrOle2Obj> SvxMSDffManager::CreateSdrOLEFromStorage( // is a kind of embedded objects in Word documents // TODO/LATER: should the caller be notified if the aspect changes in future? - tools::SvRef<SotStorageStream> xObjInfoSrc = xObjStg->OpenSotStream( + rtl::Reference<SotStorageStream> xObjInfoSrc = xObjStg->OpenSotStream( "\3ObjInfo", StreamMode::STD_READ ); if ( xObjInfoSrc.is() && !xObjInfoSrc->GetError() ) { @@ -7396,11 +7396,11 @@ rtl::Reference<SdrOle2Obj> SvxMSDffManager::CreateSdrOLEFromStorage( if( bValidStorage ) { // object is not an own object - tools::SvRef<SotStorage> xObjStor = SotStorage::OpenOLEStorage( xDestStorage, aDstStgName, StreamMode::READWRITE ); + rtl::Reference<SotStorage> xObjStor = SotStorage::OpenOLEStorage( xDestStorage, aDstStgName, StreamMode::READWRITE ); if ( xObjStor.is() ) { - tools::SvRef<SotStorage> xSrcStor = rSrcStorage->OpenSotStorage( rStorageName, StreamMode::READ ); + rtl::Reference<SotStorage> xSrcStor = rSrcStorage->OpenSotStorage( rStorageName, StreamMode::READ ); xSrcStor->CopyTo( xObjStor.get() ); if( !xObjStor->GetError() ) @@ -7427,7 +7427,7 @@ rtl::Reference<SdrOle2Obj> SvxMSDffManager::CreateSdrOLEFromStorage( else { // or is it an OLE-1 Stream in the DataStream? - tools::SvRef<SotStorage> xObjStor = SotStorage::OpenOLEStorage( xDestStorage, aDstStgName ); + rtl::Reference<SotStorage> xObjStor = SotStorage::OpenOLEStorage( xDestStorage, aDstStgName ); //TODO/MBA: remove metafile conversion from ConvertToOle2 //when is this code used?! GDIMetaFile aMtf; diff --git a/filter/source/msfilter/msoleexp.cxx b/filter/source/msfilter/msoleexp.cxx index 679082080c3c..5e0729be55bd 100644 --- a/filter/source/msfilter/msoleexp.cxx +++ b/filter/source/msfilter/msoleexp.cxx @@ -168,7 +168,7 @@ void SvxMSExportOLEObjects::ExportOLEObject( svt::EmbeddedObjectRef const & rObj } catch( const uno::Exception& ) {} // #TODO really handle exceptions - interactionalhandler etc. ? - tools::SvRef<SotStorage> xOLEStor = new SotStorage( pStream, true ); + rtl::Reference<SotStorage> xOLEStor = new SotStorage( pStream, true ); xOLEStor->CopyTo( &rDestStg ); rDestStg.Commit(); } @@ -189,7 +189,7 @@ void SvxMSExportOLEObjects::ExportOLEObject( svt::EmbeddedObjectRef const & rObj rDestStg.SetClass( aEmbName, SotClipboardFormatId::EMBEDDED_OBJ_OLE, GetStorageType( aEmbName ) ); - tools::SvRef<SotStorageStream> xExtStm = rDestStg.OpenSotStream( + rtl::Reference<SotStorageStream> xExtStm = rDestStg.OpenSotStream( "properties_stream"); bool bExtentSuccess = false; @@ -244,7 +244,7 @@ void SvxMSExportOLEObjects::ExportOLEObject( svt::EmbeddedObjectRef const & rObj if ( bExtentSuccess ) { - tools::SvRef<SotStorageStream> xEmbStm = rDestStg.OpenSotStream( + rtl::Reference<SotStorageStream> xEmbStm = rDestStg.OpenSotStream( "package_stream"); if( !xEmbStm->GetError() ) { @@ -291,7 +291,7 @@ void SvxMSExportOLEObjects::ExportOLEObject( svt::EmbeddedObjectRef const & rObj catch ( const uno::Exception& ) {} - tools::SvRef<SotStorage> xOLEStor = SotStorage::OpenOLEStorage( xStor, aTempName, StreamMode::STD_READ ); + rtl::Reference<SotStorage> xOLEStor = SotStorage::OpenOLEStorage( xStor, aTempName, StreamMode::STD_READ ); xOLEStor->CopyTo( &rDestStg ); rDestStg.Commit(); } diff --git a/filter/source/msfilter/rtfutil.cxx b/filter/source/msfilter/rtfutil.cxx index 108b52daf0c0..a46bf99b730b 100644 --- a/filter/source/msfilter/rtfutil.cxx +++ b/filter/source/msfilter/rtfutil.cxx @@ -26,7 +26,7 @@ namespace void WrapOle1InOle2(SvStream& rOle1, sal_uInt32 nOle1Size, SvStream& rOle2, const OString& rClassName) { - tools::SvRef<SotStorage> pStorage = new SotStorage(rOle2); + rtl::Reference<SotStorage> pStorage = new SotStorage(rOle2); OString aAnsiUserType; SvGlobalName aName; if (rClassName == "PBrush") @@ -46,7 +46,7 @@ void WrapOle1InOle2(SvStream& rOle1, sal_uInt32 nOle1Size, SvStream& rOle2, pStorage->SetClass(aName, SotClipboardFormatId::NONE, ""); // [MS-OLEDS] 2.3.7 CompObjHeader - tools::SvRef<SotStorageStream> pCompObj = pStorage->OpenSotStream("\1CompObj"); + rtl::Reference<SotStorageStream> pCompObj = pStorage->OpenSotStream("\1CompObj"); // Reserved1 pCompObj->WriteUInt32(0xfffe0001); // Version @@ -80,7 +80,7 @@ void WrapOle1InOle2(SvStream& rOle1, sal_uInt32 nOle1Size, SvStream& rOle2, pCompObj.clear(); // [MS-OLEDS] 2.3.6 OLENativeStream - tools::SvRef<SotStorageStream> pOleNative = pStorage->OpenSotStream("\1Ole10Native"); + rtl::Reference<SotStorageStream> pOleNative = pStorage->OpenSotStream("\1Ole10Native"); // NativeDataSize pOleNative->WriteUInt32(nOle1Size); pOleNative->WriteStream(rOle1, nOle1Size); diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index 0a93095d4ddf..42b31c99af02 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -1671,7 +1671,7 @@ SdrPowerPointImport::~SdrPowerPointImport() m_pNotePages.reset(); } -bool PPTConvertOCXControls::ReadOCXStream( tools::SvRef<SotStorage>& rSrc, +bool PPTConvertOCXControls::ReadOCXStream( rtl::Reference<SotStorage>& rSrc, css::uno::Reference< css::drawing::XShape > *pShapeRef ) { bool bRes = false; @@ -1850,14 +1850,14 @@ rtl::Reference<SdrObject> SdrPowerPointImport::ImportOLE( sal_uInt32 nOLEId, { pDest->Seek(0); Storage* pObjStor = new Storage(*pDest, false); - tools::SvRef<SotStorage> xObjStor( new SotStorage( pObjStor ) ); + rtl::Reference<SotStorage> xObjStor(new SotStorage(pObjStor)); if ( xObjStor.is() && !xObjStor->GetError() ) { if ( xObjStor->GetClassName() == SvGlobalName() ) { xObjStor->SetClass( SvGlobalName( pObjStor->GetClassId() ), pObjStor->GetFormat(), pObjStor->GetUserName() ); } - tools::SvRef<SotStorageStream> xSrcTst = xObjStor->OpenSotStream( "\1Ole" ); + rtl::Reference<SotStorageStream> xSrcTst = xObjStor->OpenSotStream("\1Ole"); if ( xSrcTst.is() ) { sal_uInt8 aTestA[ 10 ]; @@ -1908,7 +1908,7 @@ rtl::Reference<SdrObject> SdrPowerPointImport::ImportOLE( sal_uInt32 nOLEId, const css::uno::Reference < css::embed::XStorage >& rStorage = rOe.pShell->GetStorage(); if (rStorage.is()) { - tools::SvRef<SotStorage> xTarget = SotStorage::OpenOLEStorage(rStorage, aNm, StreamMode::READWRITE); + rtl::Reference<SotStorage> xTarget = SotStorage::OpenOLEStorage(rStorage, aNm, StreamMode::READWRITE); if (xObjStor.is() && xTarget.is()) { xObjStor->CopyTo(xTarget.get()); @@ -2029,16 +2029,16 @@ void SdrPowerPointImport::SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOpt std::unique_ptr<SvMemoryStream> pBas = ImportExOleObjStg( nPersistPtr, nOleId ); if ( pBas ) { - tools::SvRef<SotStorage> xSource( new SotStorage( pBas.release(), true ) ); - tools::SvRef<SotStorage> xDest( new SotStorage( new SvMemoryStream(), true ) ); + rtl::Reference<SotStorage> xSource(new SotStorage(pBas.release(), true)); + rtl::Reference<SotStorage> xDest( new SotStorage( new SvMemoryStream(), true ) ); if ( xSource.is() && xDest.is() ) { // is this a visual basic storage ? - tools::SvRef<SotStorage> xSubStorage = xSource->OpenSotStorage( "VBA", + rtl::Reference<SotStorage> xSubStorage = xSource->OpenSotStorage( "VBA", StreamMode::READWRITE | StreamMode::NOCREATE | StreamMode::SHARE_DENYALL ); if( xSubStorage.is() && ( ERRCODE_NONE == xSubStorage->GetError() ) ) { - tools::SvRef<SotStorage> xMacros = xDest->OpenSotStorage( "MACROS" ); + rtl::Reference<SotStorage> xMacros = xDest->OpenSotStorage( "MACROS" ); if ( xMacros.is() ) { SvStorageInfoList aList; @@ -2057,13 +2057,13 @@ void SdrPowerPointImport::SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOpt uno::Reference < embed::XStorage > xDoc( pShell->GetStorage() ); if ( xDoc.is() ) { - tools::SvRef<SotStorage> xVBA = SotStorage::OpenOLEStorage( xDoc, SvxImportMSVBasic::GetMSBasicStorageName() ); + rtl::Reference<SotStorage> xVBA = SotStorage::OpenOLEStorage( xDoc, SvxImportMSVBasic::GetMSBasicStorageName() ); if ( xVBA.is() && ( xVBA->GetError() == ERRCODE_NONE ) ) { - tools::SvRef<SotStorage> xSubVBA = xVBA->OpenSotStorage( "_MS_VBA_Overhead" ); + rtl::Reference<SotStorage> xSubVBA = xVBA->OpenSotStorage( "_MS_VBA_Overhead" ); if ( xSubVBA.is() && ( xSubVBA->GetError() == ERRCODE_NONE ) ) { - tools::SvRef<SotStorageStream> xOriginal = xSubVBA->OpenSotStream( "_MS_VBA_Overhead2" ); + rtl::Reference<SotStorageStream> xOriginal = xSubVBA->OpenSotStream( "_MS_VBA_Overhead2" ); if ( xOriginal.is() && ( xOriginal->GetError() == ERRCODE_NONE ) ) { if ( nPersistPtr && ( nPersistPtr < m_nPersistPtrCnt ) ) diff --git a/filter/source/msfilter/svxmsbas2.cxx b/filter/source/msfilter/svxmsbas2.cxx index 8a4ce43f1914..71ac50fd3928 100644 --- a/filter/source/msfilter/svxmsbas2.cxx +++ b/filter/source/msfilter/svxmsbas2.cxx @@ -33,7 +33,7 @@ ErrCode SvxImportMSVBasic::SaveOrDelMSVBAStorage( bool bSaveInto, ErrCode nRet = ERRCODE_NONE; uno::Reference < embed::XStorage > xSrcRoot( rDocSh.GetStorage() ); OUString aDstStgName( GetMSBasicStorageName() ); - tools::SvRef<SotStorage> xVBAStg( SotStorage::OpenOLEStorage( xSrcRoot, aDstStgName, + rtl::Reference<SotStorage> xVBAStg( SotStorage::OpenOLEStorage( xSrcRoot, aDstStgName, StreamMode::READWRITE | StreamMode::NOCREATE | StreamMode::SHARE_DENYALL ) ); if( xVBAStg.is() && !xVBAStg->GetError() ) { @@ -45,8 +45,8 @@ ErrCode SvxImportMSVBasic::SaveOrDelMSVBAStorage( bool bSaveInto, if( pBasicMan && pBasicMan->IsBasicModified() ) nRet = ERRCODE_SVX_MODIFIED_VBASIC_STORAGE; #endif - tools::SvRef<SotStorage> xSrc = SotStorage::OpenOLEStorage( xSrcRoot, aDstStgName, StreamMode::STD_READ ); - tools::SvRef<SotStorage> xDst = xRoot->OpenSotStorage( rStorageName, StreamMode::READWRITE | StreamMode::TRUNC ); + rtl::Reference<SotStorage> xSrc = SotStorage::OpenOLEStorage( xSrcRoot, aDstStgName, StreamMode::STD_READ ); + rtl::Reference<SotStorage> xDst = xRoot->OpenSotStorage( rStorageName, StreamMode::READWRITE | StreamMode::TRUNC ); xSrc->CopyTo( xDst.get() ); xDst->Commit(); ErrCode nError = xDst->GetError(); @@ -65,7 +65,7 @@ ErrCode SvxImportMSVBasic::SaveOrDelMSVBAStorage( bool bSaveInto, ErrCode SvxImportMSVBasic::GetSaveWarningOfMSVBAStorage( SfxObjectShell &rDocSh) { uno::Reference < embed::XStorage > xSrcRoot( rDocSh.GetStorage() ); - tools::SvRef<SotStorage> xVBAStg( SotStorage::OpenOLEStorage( xSrcRoot, GetMSBasicStorageName(), + rtl::Reference<SotStorage> xVBAStg( SotStorage::OpenOLEStorage( xSrcRoot, GetMSBasicStorageName(), StreamMode::READ | StreamMode::NOCREATE | StreamMode::SHARE_DENYALL )); return ( xVBAStg.is() && !xVBAStg->GetError() ) ? ERRCODE_SVX_VBASIC_STORAGE_EXIST diff --git a/include/editeng/svxacorr.hxx b/include/editeng/svxacorr.hxx index 4bc359ddf8f8..d85a3d242783 100644 --- a/include/editeng/svxacorr.hxx +++ b/include/editeng/svxacorr.hxx @@ -24,6 +24,7 @@ #include <o3tl/typed_flags_set.hxx> #include <o3tl/string_view.hxx> #include <i18nlangtag/languagetag.hxx> +#include <rtl/ref.hxx> #include <tools/time.hxx> #include <tools/date.hxx> #include <editeng/swafopt.hxx> @@ -200,10 +201,10 @@ class EDITENG_DLLPUBLIC SvxAutoCorrectLanguageLists bool IsFileChanged_Imp(); void LoadXMLExceptList_Imp( std::unique_ptr<SvStringsISortDtor>& rpLst, const OUString& sStrmName, - tools::SvRef<SotStorage>& rStg); + rtl::Reference<SotStorage>& rStg); static void SaveExceptList_Imp( const SvStringsISortDtor& rLst, const OUString& sStrmName, - tools::SvRef<SotStorage> const & rStg, + rtl::Reference<SotStorage> const & rStg, bool bConvert = false); bool MakeBlocklist_Imp( SotStorage& rStg ); diff --git a/include/filter/msfilter/msdffimp.hxx b/include/filter/msfilter/msdffimp.hxx index c48280c7a4a4..3b51d5b71424 100644 --- a/include/filter/msfilter/msdffimp.hxx +++ b/include/filter/msfilter/msdffimp.hxx @@ -535,7 +535,7 @@ protected: // the following method needs to be overridden for the import of OLE objects virtual bool GetOLEStorageName( sal_uInt32 nOLEId, OUString& rStorageName, - tools::SvRef<SotStorage>& rSrcStorage, + rtl::Reference<SotStorage>& rSrcStorage, css::uno::Reference < css::embed::XStorage >& xDestStg ) const; @@ -630,7 +630,7 @@ public: static bool ConvertToOle2( SvStream& rStm, sal_uInt32 nLen, const GDIMetaFile*, - const tools::SvRef<SotStorage> & rDest ); + const rtl::Reference<SotStorage> & rDest ); void SetModel(SdrModel* pModel, tools::Long nApplicationScale); SdrModel* GetModel() const { return pSdrModel; } @@ -718,7 +718,7 @@ public: static rtl::Reference<SdrOle2Obj> CreateSdrOLEFromStorage( SdrModel& rSdrModel, const OUString& rStorageName, - tools::SvRef<SotStorage> const & rSrcStorage, + rtl::Reference<SotStorage> const & rSrcStorage, const css::uno::Reference < css::embed::XStorage >& xDestStg, const Graphic& rGraf, const tools::Rectangle& rBoundRect, diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx index 55a648a70354..5c77580e4507 100644 --- a/include/filter/msfilter/svdfppt.hxx +++ b/include/filter/msfilter/svdfppt.hxx @@ -655,7 +655,7 @@ public: const sal_uInt32* pTableArry, SvxMSDffSolverContainer* pSolverContainer ); - virtual bool ReadFormControl( tools::SvRef<SotStorage>& rSrc1, css::uno::Reference< css::form::XFormComponent > & rFormComp ) const = 0; + virtual bool ReadFormControl( rtl::Reference<SotStorage>& rSrc1, css::uno::Reference< css::form::XFormComponent > & rFormComp ) const = 0; }; struct PPTTextParagraphStyleAtomInterpreter @@ -1285,7 +1285,7 @@ public: ePageKind ( ePKind ), mpPPTImporter ( pPPTImporter ) {}; - bool ReadOCXStream( tools::SvRef<SotStorage>& rSrc1, + bool ReadOCXStream( rtl::Reference<SotStorage>& rSrc1, css::uno::Reference<css::drawing::XShape > *pShapeRef ); virtual bool InsertControl( const css::uno::Reference< css::form::XFormComponent > &rFComp, diff --git a/include/filter/msfilter/svxmsbas.hxx b/include/filter/msfilter/svxmsbas.hxx index 304191ab7950..7d4578e98037 100644 --- a/include/filter/msfilter/svxmsbas.hxx +++ b/include/filter/msfilter/svxmsbas.hxx @@ -64,7 +64,7 @@ public: static OUString GetMSBasicStorageName(); private: - tools::SvRef<SotStorage> xRoot; + rtl::Reference<SotStorage> xRoot; SfxObjectShell& rDocSh; }; diff --git a/include/oox/ole/olehelper.hxx b/include/oox/ole/olehelper.hxx index a2810460bcd3..256896193903 100644 --- a/include/oox/ole/olehelper.hxx +++ b/include/oox/ole/olehelper.hxx @@ -25,9 +25,9 @@ #include <oox/dllapi.h> #include <oox/helper/binarystreambase.hxx> #include <oox/helper/graphichelper.hxx> +#include <rtl/ref.hxx> #include <rtl/ustring.hxx> #include <sal/types.h> -#include <tools/ref.hxx> #include <memory> namespace com::sun::star { @@ -183,10 +183,10 @@ protected: public: MSConvertOCXControls( const css::uno::Reference< css::frame::XModel >& rxModel ); virtual ~MSConvertOCXControls() override; - bool ReadOCXStorage( tools::SvRef<SotStorage> const & rSrc1, css::uno::Reference< css::form::XFormComponent > & rxFormComp ); - bool ReadOCXCtlsStream(tools::SvRef<SotStorageStream> const & rSrc1, css::uno::Reference< css::form::XFormComponent > & rxFormComp, + bool ReadOCXStorage( rtl::Reference<SotStorage> const & rSrc1, css::uno::Reference< css::form::XFormComponent > & rxFormComp ); + bool ReadOCXCtlsStream(rtl::Reference<SotStorageStream> const & rSrc1, css::uno::Reference< css::form::XFormComponent > & rxFormComp, sal_Int32 nPos, sal_Int32 nSize ); - static bool WriteOCXStream( const css::uno::Reference< css::frame::XModel >& rxModel, tools::SvRef<SotStorage> const &rSrc1, const css::uno::Reference< css::awt::XControlModel > &rControlModel, const css::awt::Size& rSize,OUString &rName); + static bool WriteOCXStream( const css::uno::Reference< css::frame::XModel >& rxModel, rtl::Reference<SotStorage> const &rSrc1, const css::uno::Reference< css::awt::XControlModel > &rControlModel, const css::awt::Size& rSize,OUString &rName); static bool WriteOCXExcelKludgeStream( const css::uno::Reference< css::frame::XModel >& rxModel, const css::uno::Reference< css::io::XOutputStream >& xOutStrm, const css::uno::Reference< css::awt::XControlModel > &rControlModel, const css::awt::Size& rSize,OUString &rName); }; diff --git a/include/sfx2/event.hxx b/include/sfx2/event.hxx index 1024dd5b2423..0e4fd8977a7d 100644 --- a/include/sfx2/event.hxx +++ b/include/sfx2/event.hxx @@ -23,10 +23,12 @@ #include <ostream> +#include <unotools/weakref.hxx> #include <sfx2/dllapi.h> #include <svl/hint.hxx> #include <unotools/eventcfg.hxx> #include <rtl/ustring.hxx> +#include <sfx2/objsh.hxx> #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/frame/XController2.hpp> @@ -111,8 +113,6 @@ inline std::basic_ostream<charT, traits> & operator <<( } } -class SfxObjectShell; - enum class SfxEventHintId { NONE = 0, ActivateDoc, @@ -191,7 +191,7 @@ inline std::basic_ostream<charT, traits> & operator <<( class SFX2_DLLPUBLIC SfxEventHint : public SfxHint { - SfxObjectShell* pObjShell; + unotools::WeakReference<SfxObjectShell> pObjShell; OUString aEventName; SfxEventHintId nEventId; @@ -210,8 +210,7 @@ public: const OUString& GetEventName() const { return aEventName; } - SfxObjectShell* GetObjShell() const - { return pObjShell; } + rtl::Reference<SfxObjectShell> GetObjShell() const { return pObjShell.get(); } }; diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx index 3175cb283642..c961394db08c 100644 --- a/include/sfx2/objsh.hxx +++ b/include/sfx2/objsh.hxx @@ -176,7 +176,7 @@ template<class T> bool checkSfxObjectShell(const SfxObjectShell* pShell) } class SFX2_DLLPUBLIC SfxObjectShell : - public SfxShell, virtual public SotObject, + public SfxShell, public SotObject, public ::comphelper::IEmbeddedHelper { friend struct ModifyBlocker_Impl; @@ -837,7 +837,7 @@ public: }; -typedef tools::SvRef<SfxObjectShell> SfxObjectShellRef; +typedef rtl::Reference<SfxObjectShell> SfxObjectShellRef; class SfxObjectShellLock { diff --git a/include/sot/object.hxx b/include/sot/object.hxx index 1657986c8490..6cd3634bd557 100644 --- a/include/sot/object.hxx +++ b/include/sot/object.hxx @@ -22,10 +22,11 @@ #include <sal/config.h> -#include <tools/ref.hxx> +#include <cppuhelper/weak.hxx> +#include <rtl/ref.hxx> #include <sot/sotdllapi.h> -class SOT_DLLPUBLIC SotObject : virtual public SvRefBase +class SOT_DLLPUBLIC SotObject : public cppu::OWeakObject { sal_uInt16 nOwnerLockCount; bool bInClose; // TRUE, in DoClose @@ -42,6 +43,7 @@ public: void OwnerLock(bool bLock); bool DoClose(); bool IsInClose() const { return bInClose; } + oslInterlockedCount GetRefCount() const { return m_refCount; } private: SotObject& operator=(const SotObject&) = delete; diff --git a/include/sot/storage.hxx b/include/sot/storage.hxx index ac11340ac26d..2a49b4a39475 100644 --- a/include/sot/storage.hxx +++ b/include/sot/storage.hxx @@ -142,9 +142,9 @@ public: // create stream with connection to Storage, // more or less a Parent-Child relationship - tools::SvRef<SotStorageStream> OpenSotStream(const OUString & rEleName, + rtl::Reference<SotStorageStream> OpenSotStream(const OUString & rEleName, StreamMode = StreamMode::STD_READWRITE); - SotStorage* OpenSotStorage(const OUString & rEleName, + rtl::Reference<SotStorage> OpenSotStorage(const OUString & rEleName, StreamMode = StreamMode::STD_READWRITE, bool transacted = true); @@ -161,7 +161,7 @@ public: static bool IsOLEStorage(const OUString & rFileName); static bool IsOLEStorage(SvStream* pStream); - static SotStorage* OpenOLEStorage(css::uno::Reference<css::embed::XStorage> const & xStorage, + static rtl::Reference<SotStorage> OpenOLEStorage(css::uno::Reference<css::embed::XStorage> const & xStorage, OUString const & rEleName, StreamMode = StreamMode::STD_READWRITE); static SotClipboardFormatId GetFormatID(css::uno::Reference<css::embed::XStorage> const & xStorage); static sal_Int32 GetVersion(css::uno::Reference<css::embed::XStorage> const & xStorage); diff --git a/oox/source/ole/olehelper.cxx b/oox/source/ole/olehelper.cxx index d953cf17f9da..e5a81320156b 100644 --- a/oox/source/ole/olehelper.cxx +++ b/oox/source/ole/olehelper.cxx @@ -437,7 +437,7 @@ MSConvertOCXControls::importControlFromStream( ::oox::BinaryInputStream& rInStrm } bool -MSConvertOCXControls::ReadOCXCtlsStream( tools::SvRef<SotStorageStream> const & rSrc1, Reference< XFormComponent > & rxFormComp, +MSConvertOCXControls::ReadOCXCtlsStream( rtl::Reference<SotStorageStream> const & rSrc1, Reference< XFormComponent > & rxFormComp, sal_Int32 nPos, sal_Int32 nStreamSize) { @@ -486,18 +486,18 @@ bool MSConvertOCXControls::importControlFromStream( ::oox::BinaryInputStream& rI return rxFormComp.is(); } -bool MSConvertOCXControls::ReadOCXStorage( tools::SvRef<SotStorage> const & xOleStg, +bool MSConvertOCXControls::ReadOCXStorage( rtl::Reference<SotStorage> const & xOleStg, Reference< XFormComponent > & rxFormComp ) { if ( xOleStg.is() ) { - tools::SvRef<SotStorageStream> pNameStream = xOleStg->OpenSotStream("\3OCXNAME", StreamMode::READ); + rtl::Reference<SotStorageStream> pNameStream = xOleStg->OpenSotStream("\3OCXNAME", StreamMode::READ); BinaryXInputStream aNameStream( Reference< XInputStream >( new utl::OSeekableInputStreamWrapper( *pNameStream ) ), true ); - tools::SvRef<SotStorageStream> pContents = xOleStg->OpenSotStream("contents", StreamMode::READ); + rtl::Reference<SotStorageStream> pContents = xOleStg->OpenSotStream("contents", StreamMode::READ); BinaryXInputStream aInStrm( Reference< XInputStream >( new utl::OSeekableInputStreamWrapper( *pContents ) ), true ); - tools::SvRef<SotStorageStream> pClsStrm = xOleStg->OpenSotStream("\1CompObj", StreamMode::READ); + rtl::Reference<SotStorageStream> pClsStrm = xOleStg->OpenSotStream("\1CompObj", StreamMode::READ); BinaryXInputStream aClsStrm( Reference< XInputStream >( new utl::OSeekableInputStreamWrapper(*pClsStrm ) ), true ); aClsStrm.skip(12); @@ -533,7 +533,7 @@ bool MSConvertOCXControls::WriteOCXExcelKludgeStream( const css::uno::Reference< return true; } -bool MSConvertOCXControls::WriteOCXStream( const Reference< XModel >& rxModel, tools::SvRef<SotStorage> const &xOleStg, +bool MSConvertOCXControls::WriteOCXStream( const Reference< XModel >& rxModel, rtl::Reference<SotStorage> const &xOleStg, const Reference< XControlModel > &rxControlModel, const css::awt::Size& rSize, OUString &rName) { @@ -550,17 +550,17 @@ bool MSConvertOCXControls::WriteOCXStream( const Reference< XModel >& rxModel, t rName = exportHelper.getTypeName(); xOleStg->SetClass( aName, SotClipboardFormatId::EMBEDDED_OBJ_OLE, sFullName); { - tools::SvRef<SotStorageStream> pNameStream = xOleStg->OpenSotStream("\3OCXNAME"); + rtl::Reference<SotStorageStream> pNameStream = xOleStg->OpenSotStream("\3OCXNAME"); Reference< XOutputStream > xOut = new utl::OSeekableOutputStreamWrapper( *pNameStream ); exportHelper.exportName( xOut ); } { - tools::SvRef<SotStorageStream> pObjStream = xOleStg->OpenSotStream("\1CompObj"); + rtl::Reference<SotStorageStream> pObjStream = xOleStg->OpenSotStream("\1CompObj"); Reference< XOutputStream > xOut = new utl::OSeekableOutputStreamWrapper( *pObjStream ); exportHelper.exportCompObj( xOut ); } { - tools::SvRef<SotStorageStream> pContents = xOleStg->OpenSotStream("contents"); + rtl::Reference<SotStorageStream> pContents = xOleStg->OpenSotStream("contents"); Reference< XOutputStream > xOut = new utl::OSeekableOutputStreamWrapper( *pContents ); exportHelper.exportControl( xOut, rSize ); } diff --git a/oox/source/ole/vbaexport.cxx b/oox/source/ole/vbaexport.cxx index c59895246a09..44657ebc3408 100644 --- a/oox/source/ole/vbaexport.cxx +++ b/oox/source/ole/vbaexport.cxx @@ -1040,12 +1040,12 @@ void VbaExport::exportVBA(SotStorage* pRootStorage) getCorrectExportOrder(xNameContainer, aLibraryMap); // start here with the VBA export - tools::SvRef<SotStorage> xVBAStream = pRootStorage->OpenSotStorage("VBA", StreamMode::READWRITE); - tools::SvRef<SotStorageStream> pDirStream = xVBAStream->OpenSotStream("dir", StreamMode::READWRITE); + rtl::Reference<SotStorage> xVBAStream = pRootStorage->OpenSotStorage("VBA", StreamMode::READWRITE); + rtl::Reference<SotStorageStream> pDirStream = xVBAStream->OpenSotStream("dir", StreamMode::READWRITE); - tools::SvRef<SotStorageStream> pVBAProjectStream = xVBAStream->OpenSotStream("_VBA_PROJECT", StreamMode::READWRITE); - tools::SvRef<SotStorageStream> pPROJECTStream = pRootStorage->OpenSotStream("PROJECT", StreamMode::READWRITE); - tools::SvRef<SotStorageStream> pPROJECTwmStream = pRootStorage->OpenSotStream("PROJECTwm", StreamMode::READWRITE); + rtl::Reference<SotStorageStream> pVBAProjectStream = xVBAStream->OpenSotStream("_VBA_PROJECT", StreamMode::READWRITE); + rtl::Reference<SotStorageStream> pPROJECTStream = pRootStorage->OpenSotStream("PROJECT", StreamMode::READWRITE); + rtl::Reference<SotStorageStream> pPROJECTwmStream = pRootStorage->OpenSotStream("PROJECTwm", StreamMode::READWRITE); const rtl_TextEncoding eTextEncoding = getVBATextEncoding(); @@ -1106,7 +1106,7 @@ void VbaExport::exportVBA(SotStorage* pRootStorage) for (sal_Int32 i = 0; i < n; ++i) { const OUString& rModuleName = aElementNames[aLibraryMap[i]]; - tools::SvRef<SotStorageStream> pModuleStream = xVBAStream->OpenSotStream(rModuleName, StreamMode::READWRITE); + rtl::Reference<SotStorageStream> pModuleStream = xVBAStream->OpenSotStream(rModuleName, StreamMode::READWRITE); css::uno::Any aCode = xNameContainer->getByName(rModuleName); css::script::ModuleInfo aModuleInfo = xModuleInfo->getModuleInfo(rModuleName); OUString aSourceCode; diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx index 1539858434bc..535c919f5fe2 100644 --- a/sc/inc/global.hxx +++ b/sc/inc/global.hxx @@ -23,7 +23,7 @@ #include "typedstrdata.hxx" #include <i18nlangtag/lang.h> #include <svx/svdtypes.hxx> -#include <tools/ref.hxx> +#include <rtl/ref.hxx> #include <sal/types.h> #include <com/sun/star/i18n/CollatorOptions.hpp> #include <com/sun/star/sheet/CellFlags.hpp> @@ -591,7 +591,7 @@ public: /// Vertical pixel per twips factor. SC_DLLPUBLIC static double nScreenPPTY; - static tools::SvRef<ScDocShell> xDrawClipDocShellRef; + static rtl::Reference<ScDocShell> xDrawClipDocShellRef; static sal_uInt16 nDefFontHeight; SC_DLLPUBLIC static sal_uInt16 nStdRowHeight; diff --git a/sc/inc/rangelst.hxx b/sc/inc/rangelst.hxx index efbc697b4ca4..f1618b06c9d9 100644 --- a/sc/inc/rangelst.hxx +++ b/sc/inc/rangelst.hxx @@ -23,6 +23,7 @@ #include "address.hxx" #include <ostream> #include <vector> +#include <tools/ref.hxx> #include <sal/types.h> class ScDocument; diff --git a/sc/inc/tablink.hxx b/sc/inc/tablink.hxx index 63eba3b2efa9..56bd64881835 100644 --- a/sc/inc/tablink.hxx +++ b/sc/inc/tablink.hxx @@ -73,8 +73,7 @@ class SfxFilter; class SC_DLLPUBLIC ScDocumentLoader { private: - ScDocShell* pDocShell; - SfxObjectShellRef aRef; + rtl::Reference<ScDocShell> pDocShell; SfxMedium* pMedium; public: @@ -84,7 +83,7 @@ public: = css::uno::Reference<css::io::XInputStream>()); ~ScDocumentLoader(); ScDocument* GetDocument(); - ScDocShell* GetDocShell() { return pDocShell; } + ScDocShell* GetDocShell() { return pDocShell.get(); } bool IsError() const; void ReleaseDocRef(); // without calling DoClose diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index 8fcdaf5782c2..9443d6e0324a 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -76,7 +76,7 @@ #include <sharedstringpoolpurge.hxx> #include <formulaopt.hxx> -tools::SvRef<ScDocShell> ScGlobal::xDrawClipDocShellRef; +rtl::Reference<ScDocShell> ScGlobal::xDrawClipDocShellRef; std::unique_ptr<SvxSearchItem> ScGlobal::xSearchItem; std::unique_ptr<ScAutoFormat> ScGlobal::xAutoFormat; std::atomic<LegacyFuncCollection*> ScGlobal::pLegacyFuncCollection(nullptr); diff --git a/sc/source/filter/excel/excel.cxx b/sc/source/filter/excel/excel.cxx index 862e85d08545..82dca81539ae 100644 --- a/sc/source/filter/excel/excel.cxx +++ b/sc/source/filter/excel/excel.cxx @@ -61,13 +61,13 @@ static void lcl_getListOfStreams(SotStorage * pStorage, comphelper::SequenceAsHa OUString sStreamFullName = sPrefix.size() ? OUString::Concat(sPrefix) + "/" + aElement.GetName() : aElement.GetName(); if (aElement.IsStorage()) { - tools::SvRef<SotStorage> xSubStorage = pStorage->OpenSotStorage(aElement.GetName(), StreamMode::STD_READ | StreamMode::SHARE_DENYALL); + rtl::Reference<SotStorage> xSubStorage = pStorage->OpenSotStorage(aElement.GetName(), StreamMode::STD_READ | StreamMode::SHARE_DENYALL); lcl_getListOfStreams(xSubStorage.get(), aStreamsData, sStreamFullName); } else { // Read stream - tools::SvRef<SotStorageStream> rStream = pStorage->OpenSotStream(aElement.GetName(), StreamMode::READ | StreamMode::SHARE_DENYALL); + rtl::Reference<SotStorageStream> rStream = pStorage->OpenSotStream(aElement.GetName(), StreamMode::READ | StreamMode::SHARE_DENYALL); if (rStream.is()) { sal_Int32 nStreamSize = rStream->GetSize(); @@ -81,9 +81,9 @@ static void lcl_getListOfStreams(SotStorage * pStorage, comphelper::SequenceAsHa } } -static tools::SvRef<SotStorage> lcl_DRMDecrypt(const SfxMedium& rMedium, const tools::SvRef<SotStorage>& rStorage, std::shared_ptr<SvStream>& rNewStorageStrm) +static rtl::Reference<SotStorage> lcl_DRMDecrypt(const SfxMedium& rMedium, const rtl::Reference<SotStorage>& rStorage, std::shared_ptr<SvStream>& rNewStorageStrm) { - tools::SvRef<SotStorage> aNewStorage; + rtl::Reference<SotStorage> aNewStorage; // We have DRM encrypted storage. We should try to decrypt it first, if we can uno::Sequence< uno::Any > aArguments; @@ -109,7 +109,7 @@ static tools::SvRef<SotStorage> lcl_DRMDecrypt(const SfxMedium& rMedium, const t return aNewStorage; } - tools::SvRef<SotStorageStream> rContentStream = rStorage->OpenSotStream("\011DRMContent", StreamMode::READ | StreamMode::SHARE_DENYALL); + rtl::Reference<SotStorageStream> rContentStream = rStorage->OpenSotStream("\011DRMContent", StreamMode::READ | StreamMode::SHARE_DENYALL); if (!rContentStream.is()) { return aNewStorage; @@ -168,8 +168,8 @@ ErrCode ScFormatFilterPluginImpl::ScImportExcel( SfxMedium& rMedium, ScDocument* bool bUnableToDecryptContent = false; // try to open an OLE storage - tools::SvRef<SotStorage> xRootStrg; - tools::SvRef<SotStorageStream> xStrgStrm; + rtl::Reference<SotStorage> xRootStrg; + rtl::Reference<SotStorageStream> xStrgStrm; std::shared_ptr<SvStream> aNewStorageStrm; if( SotStorage::IsStorageFile( pMedStrm ) ) { @@ -182,7 +182,7 @@ ErrCode ScFormatFilterPluginImpl::ScImportExcel( SfxMedium& rMedium, ScDocument* if( xRootStrg.is() ) { // Check if there is DRM encryption in storage - tools::SvRef<SotStorageStream> xDRMStrm = ScfTools::OpenStorageStreamRead(xRootStrg, "\011DRMContent"); + rtl::Reference<SotStorageStream> xDRMStrm = ScfTools::OpenStorageStreamRead(xRootStrg, "\011DRMContent"); if (xDRMStrm.is()) { auto pDecryptedStorage = lcl_DRMDecrypt(rMedium, xRootStrg, aNewStorageStrm); @@ -195,11 +195,11 @@ ErrCode ScFormatFilterPluginImpl::ScImportExcel( SfxMedium& rMedium, ScDocument* } // try to open the "Book" stream - tools::SvRef<SotStorageStream> xBookStrm = ScfTools::OpenStorageStreamRead( xRootStrg, EXC_STREAM_BOOK ); + rtl::Reference<SotStorageStream> xBookStrm = ScfTools::OpenStorageStreamRead( xRootStrg, EXC_STREAM_BOOK ); XclBiff eBookBiff = xBookStrm.is() ? XclImpStream::DetectBiffVersion( *xBookStrm ) : EXC_BIFF_UNKNOWN; // try to open the "Workbook" stream - tools::SvRef<SotStorageStream> xWorkbookStrm = ScfTools::OpenStorageStreamRead( xRootStrg, EXC_STREAM_WORKBOOK ); + rtl::Reference<SotStorageStream> xWorkbookStrm = ScfTools::OpenStorageStreamRead( xRootStrg, EXC_STREAM_WORKBOOK ); XclBiff eWorkbookBiff = xWorkbookStrm.is() ? XclImpStream::DetectBiffVersion( *xWorkbookStrm ) : EXC_BIFF_UNKNOWN; // decide which stream to use @@ -297,7 +297,7 @@ static ErrCode lcl_ExportExcelBiff( SfxMedium& rMedium, ScDocument *pDocument, } // try to open an OLE storage - tools::SvRef<SotStorage> xRootStrg = new SotStorage( pMedStrm, false ); + rtl::Reference<SotStorage> xRootStrg = new SotStorage(pMedStrm, false); if( xRootStrg->GetError() ) return SCERR_IMPORT_OPEN; // create BIFF dependent strings @@ -316,7 +316,7 @@ static ErrCode lcl_ExportExcelBiff( SfxMedium& rMedium, ScDocument *pDocument, } // open the "Book"/"Workbook" stream - tools::SvRef<SotStorageStream> xStrgStrm = ScfTools::OpenStorageStreamWrite( xRootStrg, aStrmName ); + rtl::Reference<SotStorageStream> xStrgStrm = ScfTools::OpenStorageStreamWrite( xRootStrg, aStrmName ); if( !xStrgStrm.is() || xStrgStrm->GetError() ) return SCERR_IMPORT_OPEN; xStrgStrm->SetBufferSize( 0x8000 ); // still needed? @@ -354,12 +354,12 @@ static ErrCode lcl_ExportExcelBiff( SfxMedium& rMedium, ScDocument *pDocument, uno::Reference<io::XInputStream > xInputStream(new utl::OSeekableInputStreamWrapper(pMedStrm, false)); uno::Sequence<beans::NamedValue> aStreams = xPackageEncryption->encrypt(xInputStream); - tools::SvRef<SotStorage> xEncryptedRootStrg = new SotStorage(pOriginalMediaStrm, false); + rtl::Reference<SotStorage> xEncryptedRootStrg = new SotStorage(pOriginalMediaStrm, false); for (const beans::NamedValue& aStreamData : aStreams) { // To avoid long paths split and open substorages recursively // Splitting paths manually, since comphelper::string::split is trimming special characters like \0x01, \0x09 - tools::SvRef<SotStorage> pStorage = xEncryptedRootStrg.get(); + rtl::Reference<SotStorage> pStorage = xEncryptedRootStrg; OUString sFileName; sal_Int32 idx = 0; do @@ -384,7 +384,7 @@ static ErrCode lcl_ExportExcelBiff( SfxMedium& rMedium, ScDocument *pDocument, break; } - tools::SvRef<SotStorageStream> pStream = pStorage->OpenSotStream(sFileName); + rtl::Reference<SotStorageStream> pStream = pStorage->OpenSotStream(sFileName); if (!pStream) { eRet = ERRCODE_IO_GENERAL; diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx index 2df1ec268324..12ed36cebd48 100644 --- a/sc/source/filter/excel/excimp8.cxx +++ b/sc/source/filter/excel/excimp8.cxx @@ -322,7 +322,7 @@ void ImportExcel8::Feat() void ImportExcel8::ReadBasic() { ScDocShell* pShell = GetDocShell(); - tools::SvRef<SotStorage> xRootStrg = GetRootStorage(); + rtl::Reference<SotStorage> xRootStrg = GetRootStorage(); if( !pShell || !xRootStrg.is() ) return; @@ -335,7 +335,7 @@ void ImportExcel8::ReadBasic() officecfg::Office::Calc::Filter::Import::VBA::Executable::get() ) { // see if we have the XCB stream - tools::SvRef<SotStorageStream> xXCB = xRootStrg->OpenSotStream( "XCB", StreamMode::STD_READ ); + rtl::Reference<SotStorageStream> xXCB = xRootStrg->OpenSotStream( "XCB", StreamMode::STD_READ ); if ( xXCB.is()|| ERRCODE_NONE == xXCB->GetError() ) { ScCTBWrapper wrapper; @@ -412,7 +412,7 @@ void ImportExcel8::PostDocLoad() return; // BIFF5+ without storage is possible - tools::SvRef<SotStorage> xRootStrg = GetRootStorage(); + rtl::Reference<SotStorage> xRootStrg = GetRootStorage(); if( xRootStrg.is() ) try { uno::Reference< document::XDocumentPropertiesSupplier > xDPS( static_cast<cppu::OWeakObject*>(pShell->GetModel()), uno::UNO_QUERY_THROW ); diff --git a/sc/source/filter/excel/expop2.cxx b/sc/source/filter/excel/expop2.cxx index 936a09b2f3ed..1c9ea2ae0b72 100644 --- a/sc/source/filter/excel/expop2.cxx +++ b/sc/source/filter/excel/expop2.cxx @@ -71,7 +71,7 @@ ErrCode ExportBiff5::Write() ScDocShell* pDocShell = GetDocShell(); OSL_ENSURE( pDocShell, "ExportBiff5::Write - no document shell" ); - tools::SvRef<SotStorage> xRootStrg = GetRootStorage(); + rtl::Reference<SotStorage> xRootStrg = GetRootStorage(); OSL_ENSURE( xRootStrg.is(), "ExportBiff5::Write - no root storage" ); VBAExportMode eVbaExportMode = VBAExportMode::NONE; @@ -91,7 +91,7 @@ ErrCode ExportBiff5::Write() VbaExport aExport(pDocShell->GetModel()); if (aExport.containsVBAProject()) { - tools::SvRef<SotStorage> xVBARoot = xRootStrg->OpenSotStorage("_VBA_PROJECT_CUR"); + rtl::Reference<SotStorage> xVBARoot = xRootStrg->OpenSotStorage("_VBA_PROJECT_CUR"); aExport.exportVBA( xVBARoot.get() ); } } diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx index a8aab5b694d3..c03c35b2cdb5 100644 --- a/sc/source/filter/excel/xepivot.cxx +++ b/sc/source/filter/excel/xepivot.cxx @@ -810,8 +810,8 @@ void XclExpPivotCache::WriteDConName( XclExpStream& rStrm ) const void XclExpPivotCache::WriteCacheStream() { - tools::SvRef<SotStorage> xSvStrg = OpenStorage( EXC_STORAGE_PTCACHE ); - tools::SvRef<SotStorageStream> xSvStrm = OpenStream( xSvStrg, ScfTools::GetHexStr( maPCInfo.mnStrmId ) ); + rtl::Reference<SotStorage> xSvStrg = OpenStorage(EXC_STORAGE_PTCACHE); + rtl::Reference<SotStorageStream> xSvStrm = OpenStream( xSvStrg, ScfTools::GetHexStr( maPCInfo.mnStrmId ) ); if( !xSvStrm.is() ) return; diff --git a/sc/source/filter/excel/xeroot.cxx b/sc/source/filter/excel/xeroot.cxx index c1959767d97d..3d3b4c0b922b 100644 --- a/sc/source/filter/excel/xeroot.cxx +++ b/sc/source/filter/excel/xeroot.cxx @@ -55,7 +55,7 @@ using namespace ::com::sun::star; // Global data ================================================================ XclExpRootData::XclExpRootData( XclBiff eBiff, SfxMedium& rMedium, - const tools::SvRef<SotStorage>& xRootStrg, ScDocument& rDoc, rtl_TextEncoding eTextEnc ) : + const rtl::Reference<SotStorage>& xRootStrg, ScDocument& rDoc, rtl_TextEncoding eTextEnc ) : XclRootData( eBiff, rMedium, xRootStrg, rDoc, eTextEnc, true ) { mbRelUrl = mrMedium.IsRemote() diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index a70e4e08bd71..32cecf352de3 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -1035,7 +1035,7 @@ bool XclExpXmlStream::exportDocument() // NOTE: Don't use SotStorage or SvStream any more, and never call // SfxMedium::GetOutStream() anywhere in the xlsx export filter code! // Instead, write via XOutputStream instance. - tools::SvRef<SotStorage> rStorage = static_cast<SotStorage*>(nullptr); + rtl::Reference<SotStorage> rStorage; drawingml::DrawingML::ResetMlCounters(); auto& rGraphicExportCache = drawingml::GraphicExportCache::get(); @@ -1113,7 +1113,7 @@ bool XclExpXmlStream::exportDocument() if (aExport.containsVBAProject()) { SvMemoryStream aVbaStream(4096, 4096); - tools::SvRef<SotStorage> pVBAStorage(new SotStorage(aVbaStream)); + rtl::Reference<SotStorage> pVBAStorage(new SotStorage(aVbaStream)); aExport.exportVBA( pVBAStorage.get() ); aVbaStream.Seek(0); css::uno::Reference<css::io::XInputStream> xVBAStream( diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index c6d0a972b78b..5072d23a76e5 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -3534,7 +3534,7 @@ rtl::Reference<SdrObject> XclImpDffConverter::CreateSdrObject( const XclImpPictu else { SfxObjectShell* pDocShell = GetDocShell(); - tools::SvRef<SotStorage> xSrcStrg = GetRootStorage(); + rtl::Reference<SotStorage> xSrcStrg = GetRootStorage(); OUString aStrgName = rPicObj.GetOleStorageName(); if( pDocShell && xSrcStrg.is() && (!aStrgName.isEmpty()) ) { diff --git a/sc/source/filter/excel/xipivot.cxx b/sc/source/filter/excel/xipivot.cxx index 12b86f679604..7e67ad4e8ae2 100644 --- a/sc/source/filter/excel/xipivot.cxx +++ b/sc/source/filter/excel/xipivot.cxx @@ -714,8 +714,8 @@ void XclImpPivotCache::ReadPivotCacheStream( const XclImpStream& rStrm ) } // open pivot cache storage stream - tools::SvRef<SotStorage> xSvStrg = OpenStorage( EXC_STORAGE_PTCACHE ); - tools::SvRef<SotStorageStream> xSvStrm = OpenStream( xSvStrg, ScfTools::GetHexStr( mnStrmId ) ); + rtl::Reference<SotStorage> xSvStrg = OpenStorage(EXC_STORAGE_PTCACHE); + rtl::Reference<SotStorageStream> xSvStrm = OpenStream(xSvStrg, ScfTools::GetHexStr(mnStrmId)); if( !xSvStrm.is() ) return; diff --git a/sc/source/filter/excel/xiroot.cxx b/sc/source/filter/excel/xiroot.cxx index 673414745017..d8959affe5fd 100644 --- a/sc/source/filter/excel/xiroot.cxx +++ b/sc/source/filter/excel/xiroot.cxx @@ -42,7 +42,7 @@ // Global data ================================================================ XclImpRootData::XclImpRootData( XclBiff eBiff, SfxMedium& rMedium, - const tools::SvRef<SotStorage>& xRootStrg, ScDocument& rDoc, rtl_TextEncoding eTextEnc ) : + const rtl::Reference<SotStorage>& xRootStrg, ScDocument& rDoc, rtl_TextEncoding eTextEnc ) : XclRootData( eBiff, rMedium, xRootStrg, rDoc, eTextEnc, false ), mxDocImport(std::make_shared<ScDocumentImport>(rDoc)), mbHasCodePage( false ), diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx index 97e9cbffb385..836c08b3f5e4 100644 --- a/sc/source/filter/excel/xlroot.cxx +++ b/sc/source/filter/excel/xlroot.cxx @@ -85,7 +85,7 @@ XclDebugObjCounter::~XclDebugObjCounter() #endif XclRootData::XclRootData( XclBiff eBiff, SfxMedium& rMedium, - tools::SvRef<SotStorage> xRootStrg, ScDocument& rDoc, rtl_TextEncoding eTextEnc, bool bExport ) : + rtl::Reference<SotStorage> xRootStrg, ScDocument& rDoc, rtl_TextEncoding eTextEnc, bool bExport ) : meBiff( eBiff ), meOutput( EXC_OUTPUT_BINARY ), mrMedium( rMedium ), @@ -258,30 +258,30 @@ uno::Sequence< beans::NamedValue > XclRoot::RequestEncryptionData( ::comphelper: bool XclRoot::HasVbaStorage() const { - tools::SvRef<SotStorage> xRootStrg = GetRootStorage(); + rtl::Reference<SotStorage> xRootStrg = GetRootStorage(); return xRootStrg.is() && xRootStrg->IsContained( EXC_STORAGE_VBA_PROJECT ); } -tools::SvRef<SotStorage> XclRoot::OpenStorage( tools::SvRef<SotStorage> const & xStrg, const OUString& rStrgName ) const +rtl::Reference<SotStorage> XclRoot::OpenStorage( rtl::Reference<SotStorage> const & xStrg, const OUString& rStrgName ) const { return mrData.mbExport ? ScfTools::OpenStorageWrite( xStrg, rStrgName ) : ScfTools::OpenStorageRead( xStrg, rStrgName ); } -tools::SvRef<SotStorage> XclRoot::OpenStorage( const OUString& rStrgName ) const +rtl::Reference<SotStorage> XclRoot::OpenStorage(const OUString& rStrgName) const { return OpenStorage( GetRootStorage(), rStrgName ); } -tools::SvRef<SotStorageStream> XclRoot::OpenStream( tools::SvRef<SotStorage> const & xStrg, const OUString& rStrmName ) const +rtl::Reference<SotStorageStream> XclRoot::OpenStream( rtl::Reference<SotStorage> const & xStrg, const OUString& rStrmName ) const { return mrData.mbExport ? ScfTools::OpenStorageStreamWrite( xStrg, rStrmName ) : ScfTools::OpenStorageStreamRead( xStrg, rStrmName ); } -tools::SvRef<SotStorageStream> XclRoot::OpenStream( const OUString& rStrmName ) const +rtl::Reference<SotStorageStream> XclRoot::OpenStream(const OUString& rStrmName) const { return OpenStream( GetRootStorage(), rStrmName ); } diff --git a/sc/source/filter/ftools/ftools.cxx b/sc/source/filter/ftools/ftools.cxx index 860ecf71c454..bf2b784a994b 100644 --- a/sc/source/filter/ftools/ftools.cxx +++ b/sc/source/filter/ftools/ftools.cxx @@ -162,34 +162,34 @@ OUString ScfTools::ConvertToScDefinedName(const OUString& rName ) // *** streams and storages *** ----------------------------------------------- -tools::SvRef<SotStorage> ScfTools::OpenStorageRead( tools::SvRef<SotStorage> const & xStrg, const OUString& rStrgName ) +rtl::Reference<SotStorage> ScfTools::OpenStorageRead( rtl::Reference<SotStorage> const & xStrg, const OUString& rStrgName ) { - tools::SvRef<SotStorage> xSubStrg; + rtl::Reference<SotStorage> xSubStrg; if( xStrg.is() && xStrg->IsContained( rStrgName ) ) xSubStrg = xStrg->OpenSotStorage( rStrgName, StreamMode::STD_READ ); return xSubStrg; } -tools::SvRef<SotStorage> ScfTools::OpenStorageWrite( tools::SvRef<SotStorage> const & xStrg, const OUString& rStrgName ) +rtl::Reference<SotStorage> ScfTools::OpenStorageWrite( rtl::Reference<SotStorage> const & xStrg, const OUString& rStrgName ) { - tools::SvRef<SotStorage> xSubStrg; + rtl::Reference<SotStorage> xSubStrg; if( xStrg.is() ) xSubStrg = xStrg->OpenSotStorage( rStrgName, StreamMode::STD_WRITE ); return xSubStrg; } -tools::SvRef<SotStorageStream> ScfTools::OpenStorageStreamRead( tools::SvRef<SotStorage> const & xStrg, const OUString& rStrmName ) +rtl::Reference<SotStorageStream> ScfTools::OpenStorageStreamRead( rtl::Reference<SotStorage> const & xStrg, const OUString& rStrmName ) { - tools::SvRef<SotStorageStream> xStrm; + rtl::Reference<SotStorageStream> xStrm; if( xStrg.is() && xStrg->IsContained( rStrmName ) && xStrg->IsStream( rStrmName ) ) xStrm = xStrg->OpenSotStream( rStrmName, StreamMode::STD_READ ); return xStrm; } -tools::SvRef<SotStorageStream> ScfTools::OpenStorageStreamWrite( tools::SvRef<SotStorage> const & xStrg, const OUString& rStrmName ) +rtl::Reference<SotStorageStream> ScfTools::OpenStorageStreamWrite( rtl::Reference<SotStorage> const & xStrg, const OUString& rStrmName ) { OSL_ENSURE( !xStrg.is() || !xStrg->IsContained( rStrmName ), "ScfTools::OpenStorageStreamWrite - stream exists already" ); - tools::SvRef<SotStorageStream> xStrm; + rtl::Reference<SotStorageStream> xStrm; if( xStrg.is() ) xStrm = xStrg->OpenSotStream( rStrmName, StreamMode::STD_WRITE | StreamMode::TRUNC ); return xStrm; diff --git a/sc/source/filter/inc/XclImpChangeTrack.hxx b/sc/source/filter/inc/XclImpChangeTrack.hxx index 532cc9e32464..e37586ca2276 100644 --- a/sc/source/filter/inc/XclImpChangeTrack.hxx +++ b/sc/source/filter/inc/XclImpChangeTrack.hxx @@ -52,7 +52,7 @@ private: OUString sOldUsername; std::unique_ptr<ScChangeTrack> pChangeTrack; - tools::SvRef<SotStorageStream> xInStrm; // input stream + rtl::Reference<SotStorageStream> xInStrm; // input stream std::unique_ptr<XclImpStream> pStrm; // stream import class sal_uInt16 nTabIdCount; bool bGlobExit; // global exit loop diff --git a/sc/source/filter/inc/ftools.hxx b/sc/source/filter/inc/ftools.hxx index 5e5b8dd6c5b9..7e8a07bce8c8 100644 --- a/sc/source/filter/inc/ftools.hxx +++ b/sc/source/filter/inc/ftools.hxx @@ -24,7 +24,7 @@ #include <limits> #include <string_view> -#include <tools/ref.hxx> +#include <rtl/ref.hxx> #include <filter.hxx> // Common macros ============================================================== @@ -152,14 +152,14 @@ public: // *** streams and storages *** ----------------------------------------------- /** Tries to open an existing storage with the specified name in the passed storage (read-only). */ - static tools::SvRef<SotStorage> OpenStorageRead( tools::SvRef<SotStorage> const & xStrg, const OUString& rStrgName ); + static rtl::Reference<SotStorage> OpenStorageRead( rtl::Reference<SotStorage> const & xStrg, const OUString& rStrgName ); /** Creates and opens a storage with the specified name in the passed storage (read/write). */ - static tools::SvRef<SotStorage> OpenStorageWrite( tools::SvRef<SotStorage> const & xStrg, const OUString& rStrgName ); + static rtl::Reference<SotStorage> OpenStorageWrite( rtl::Reference<SotStorage> const & xStrg, const OUString& rStrgName ); /** Tries to open an existing stream with the specified name in the passed storage (read-only). */ - static tools::SvRef<SotStorageStream> OpenStorageStreamRead( tools::SvRef<SotStorage> const & xStrg, const OUString& rStrmName ); + static rtl::Reference<SotStorageStream> OpenStorageStreamRead( rtl::Reference<SotStorage> const & xStrg, const OUString& rStrmName ); /** Creates and opens a stream with the specified name in the passed storage (read/write). */ - static tools::SvRef<SotStorageStream> OpenStorageStreamWrite( tools::SvRef<SotStorage> const & xStrg, const OUString& rStrmName ); + static rtl::Reference<SotStorageStream> OpenStorageStreamWrite( rtl::Reference<SotStorage> const & xStrg, const OUString& rStrmName ); // *** item handling *** ------------------------------------------------------ diff --git a/sc/source/filter/inc/xcl97esc.hxx b/sc/source/filter/inc/xcl97esc.hxx index 3a0a606113a7..728c71b7223f 100644 --- a/sc/source/filter/inc/xcl97esc.hxx +++ b/sc/source/filter/inc/xcl97esc.hxx @@ -102,7 +102,7 @@ public: const tools::Rectangle* pChildAnchor ); private: - tools::SvRef<SotStorageStream> mxCtlsStrm; /// The 'Ctls' stream. + rtl::Reference<SotStorageStream> mxCtlsStrm; /// The 'Ctls' stream. /** Creates a TBX form control OBJ record from the passed form control. */ std::unique_ptr<XclExpTbxControlObj> CreateTBXCtrlObj( css::uno::Reference< css::drawing::XShape > const & xShape, diff --git a/sc/source/filter/inc/xeroot.hxx b/sc/source/filter/inc/xeroot.hxx index 421a389a3737..f2c1984506c3 100644 --- a/sc/source/filter/inc/xeroot.hxx +++ b/sc/source/filter/inc/xeroot.hxx @@ -104,7 +104,7 @@ struct XclExpRootData : public XclRootData OStringBuffer maStringBuf; /// buffer to avoid massive OUString allocations explicit XclExpRootData( XclBiff eBiff, SfxMedium& rMedium, - const tools::SvRef<SotStorage>& xRootStrg, ScDocument& rDoc, rtl_TextEncoding eTextEnc ); + const rtl::Reference<SotStorage>& xRootStrg, ScDocument& rDoc, rtl_TextEncoding eTextEnc ); virtual ~XclExpRootData() override; }; diff --git a/sc/source/filter/inc/xiescher.hxx b/sc/source/filter/inc/xiescher.hxx index cf09c161fe11..f43e91eba729 100644 --- a/sc/source/filter/inc/xiescher.hxx +++ b/sc/source/filter/inc/xiescher.hxx @@ -1030,7 +1030,7 @@ private: typedef std::shared_ptr< ScfProgressBar > ScfProgressBarRef; typedef std::shared_ptr< XclImpDffConvData > XclImpDffConvDataRef; - tools::SvRef<SotStorageStream> mxCtlsStrm; /// The 'Ctls' stream for OCX form controls. + rtl::Reference<SotStorageStream> mxCtlsStrm; /// The 'Ctls' stream for OCX form controls. ScfProgressBarRef mxProgress; /// The progress bar used in ProcessObj(). std::vector< XclImpDffConvDataRef > maDataStack; /// Stack for registered drawing managers. diff --git a/sc/source/filter/inc/xiroot.hxx b/sc/source/filter/inc/xiroot.hxx index d290a01db01d..cea998e5c4ac 100644 --- a/sc/source/filter/inc/xiroot.hxx +++ b/sc/source/filter/inc/xiroot.hxx @@ -120,7 +120,7 @@ struct XclImpRootData : public XclRootData bool mbHasBasic; /// true = document contains VB project. explicit XclImpRootData( XclBiff eBiff, SfxMedium& rMedium, - const tools::SvRef<SotStorage>& xRootStrg, ScDocument& rDoc, rtl_TextEncoding eTextEnc ); + const rtl::Reference<SotStorage>& xRootStrg, ScDocument& rDoc, rtl_TextEncoding eTextEnc ); virtual ~XclImpRootData() override; }; diff --git a/sc/source/filter/inc/xlroot.hxx b/sc/source/filter/inc/xlroot.hxx index 8d9c54928218..aa86378416b4 100644 --- a/sc/source/filter/inc/xlroot.hxx +++ b/sc/source/filter/inc/xlroot.hxx @@ -20,7 +20,7 @@ #pragma once #include <i18nlangtag/lang.h> -#include <tools/ref.hxx> +#include <rtl/ref.hxx> #include <tools/long.hxx> #include "xlconst.hxx" #include <memory> @@ -76,7 +76,7 @@ struct XclRootData XclBiff meBiff; /// Current BIFF version. XclOutput meOutput; /// Current Output format. SfxMedium& mrMedium; /// The medium to import from. - tools::SvRef<SotStorage> mxRootStrg; /// The root OLE storage of imported/exported file. + rtl::Reference<SotStorage> mxRootStrg; /// The root OLE storage of imported/exported file. ScDocument& mrDoc; /// The source or destination document. OUString maDocUrl; /// Document URL of imported/exported file. OUString maBasePath; /// Base path of imported/exported file (path of maDocUrl). @@ -110,7 +110,7 @@ struct XclRootData const bool mbExport; /// false = Import, true = Export. explicit XclRootData( XclBiff eBiff, SfxMedium& rMedium, - tools::SvRef<SotStorage> xRootStrg, ScDocument& rDoc, + rtl::Reference<SotStorage> xRootStrg, ScDocument& rDoc, rtl_TextEncoding eTextEnc, bool bExport ); virtual ~XclRootData(); }; @@ -184,18 +184,18 @@ public: /** Returns the OLE2 root storage of the imported/exported file. @return Pointer to root storage or 0, if the file is a simple stream. */ - const tools::SvRef<SotStorage>& GetRootStorage() const { return mrData.mxRootStrg; } + const rtl::Reference<SotStorage>& GetRootStorage() const { return mrData.mxRootStrg; } /** Returns true, if the document contains a VBA storage. */ bool HasVbaStorage() const; /** Tries to open a storage as child of the specified storage for reading or writing. */ - tools::SvRef<SotStorage> OpenStorage( tools::SvRef<SotStorage> const & xStrg, const OUString& rStrgName ) const; + rtl::Reference<SotStorage> OpenStorage( rtl::Reference<SotStorage> const & xStrg, const OUString& rStrgName ) const; /** Tries to open a storage as child of the root storage for reading or writing. */ - tools::SvRef<SotStorage> OpenStorage( const OUString& rStrgName ) const; + rtl::Reference<SotStorage> OpenStorage(const OUString& rStrgName) const; /** Tries to open a new stream in the specified storage for reading or writing. */ - tools::SvRef<SotStorageStream> OpenStream( tools::SvRef<SotStorage> const & xStrg, const OUString& rStrmName ) const; + rtl::Reference<SotStorageStream> OpenStream( rtl::Reference<SotStorage> const & xStrg, const OUString& rStrmName ) const; /** Tries to open a new stream in the root storage for reading or writing. */ - tools::SvRef<SotStorageStream> OpenStream( const OUString& rStrmName ) const; + rtl::Reference<SotStorageStream> OpenStream(const OUString& rStrmName) const; /** Returns reference to the destination document (import) or source document (export). */ ScDocument& GetDoc() const; diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx index 9c22af8a6420..936e00f6a221 100644 --- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx +++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx @@ -1648,7 +1648,7 @@ void XclExpChangeTrack::PushActionRecord( const ScChangeAction& rAction ) bool XclExpChangeTrack::WriteUserNamesStream() { bool bRet = false; - tools::SvRef<SotStorageStream> xSvStrm = OpenStream( EXC_STREAM_USERNAMES ); + rtl::Reference<SotStorageStream> xSvStrm = OpenStream(EXC_STREAM_USERNAMES); OSL_ENSURE( xSvStrm.is(), "XclExpChangeTrack::WriteUserNamesStream - no stream" ); if( xSvStrm.is() ) { @@ -1671,7 +1671,7 @@ void XclExpChangeTrack::Write() if( !WriteUserNamesStream() ) return; - tools::SvRef<SotStorageStream> xSvStrm = OpenStream( EXC_STREAM_REVLOG ); + rtl::Reference<SotStorageStream> xSvStrm = OpenStream(EXC_STREAM_REVLOG); OSL_ENSURE( xSvStrm.is(), "XclExpChangeTrack::Write - no stream" ); if( xSvStrm.is() ) { diff --git a/sc/source/filter/xcl97/XclImpChangeTrack.cxx b/sc/source/filter/xcl97/XclImpChangeTrack.cxx index 83e3c74cf216..8e68a312d17b 100644 --- a/sc/source/filter/xcl97/XclImpChangeTrack.cxx +++ b/sc/source/filter/xcl97/XclImpChangeTrack.cxx @@ -44,7 +44,7 @@ XclImpChangeTrack::XclImpChangeTrack( const XclImpRoot& rRoot, const XclImpStrea // Verify that the User Names stream exists before going any further. Excel adds both // "Revision Log" and "User Names" streams when Change Tracking is active but the Revision log // remains if Change Tracking is turned off. - tools::SvRef<SotStorageStream> xUserStrm = OpenStream( EXC_STREAM_USERNAMES ); + rtl::Reference<SotStorageStream> xUserStrm = OpenStream( EXC_STREAM_USERNAMES ); if( !xUserStrm.is() ) return; diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 8abe7dc68372..c29eba781b3f 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -1015,7 +1015,7 @@ void XclObjOle::WriteSubRecs( XclExpStream& rStrm ) sal_uInt32 nPictureId = sal_uInt32(reinterpret_cast<sal_uIntPtr>(this) >> 2); o3tl::sprintf( aBuf, "%08X", static_cast< unsigned int >( nPictureId ) ); aStorageName += OUString::createFromAscii(aBuf); - tools::SvRef<SotStorage> xOleStg = pRootStorage->OpenSotStorage( aStorageName ); + rtl::Reference<SotStorage> xOleStg = pRootStorage->OpenSotStorage(aStorageName); if( !xOleStg.is() ) return; diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx index 3257a6cae4d3..76c221dd18d3 100644 --- a/sc/source/ui/app/drwtrans.cxx +++ b/sc/source/ui/app/drwtrans.cxx @@ -677,13 +677,12 @@ void ScDrawTransferObj::InitDocShell() if ( m_aDocShellRef.is() ) return; - ScDocShell* pDocSh = new ScDocShell; - m_aDocShellRef = pDocSh; // ref must be there before InitNew + m_aDocShellRef = new ScDocShell; // ref must be there before InitNew - pDocSh->DoInitNew(); + m_aDocShellRef->DoInitNew(); - ScDocument& rDestDoc = pDocSh->GetDocument(); - rDestDoc.InitDrawLayer( pDocSh ); + ScDocument& rDestDoc = m_aDocShellRef->GetDocument(); + rDestDoc.InitDrawLayer(m_aDocShellRef.get()); auto pPool = rDestDoc.GetStyleSheetPool(); pPool->CopyStyleFrom(m_pModel->GetStyleSheetPool(), ScResId(STR_STYLENAME_STANDARD), SfxStyleFamily::Frame); @@ -717,18 +716,18 @@ void ScDrawTransferObj::InitDocShell() } tools::Rectangle aDestArea( Point(), m_aSrcSize ); - pDocSh->SetVisArea( aDestArea ); + m_aDocShellRef->SetVisArea(aDestArea); ScViewOptions aViewOpt( rDestDoc.GetViewOptions() ); aViewOpt.SetOption( VOPT_GRID, false ); rDestDoc.SetViewOptions( aViewOpt ); - ScViewData aViewData( *pDocSh, nullptr ); + ScViewData aViewData(*m_aDocShellRef, nullptr); aViewData.SetTabNo( 0 ); aViewData.SetScreen( aDestArea ); aViewData.SetCurX( 0 ); aViewData.SetCurY( 0 ); - pDocSh->UpdateOle(aViewData, true); + m_aDocShellRef->UpdateOle(aViewData, true); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/app/seltrans.cxx b/sc/source/ui/app/seltrans.cxx index 7122afab9bdb..3c0345e9466b 100644 --- a/sc/source/ui/app/seltrans.cxx +++ b/sc/source/ui/app/seltrans.cxx @@ -293,8 +293,7 @@ void ScSelectionTransferObj::CreateCellData() // SetDragHandlePos is not used - there is no mouse position //? pTransferObj->SetVisibleTab( nTab ); - SfxObjectShellRef aPersistRef( aDragShellRef.get() ); - pTransferObj->SetDrawPersist( aPersistRef ); // keep persist for ole objects alive + pTransferObj->SetDrawPersist(aDragShellRef); // keep persist for ole objects alive pTransferObj->SetDragSource( pDocSh, aNewMark ); @@ -340,8 +339,7 @@ void ScSelectionTransferObj::CreateDrawData() rtl::Reference<ScDrawTransferObj> pTransferObj = new ScDrawTransferObj( std::move(pModel), pDocSh, std::move(aObjDesc) ); - SfxObjectShellRef aPersistRef( aDragShellRef.get() ); - pTransferObj->SetDrawPersist( aPersistRef ); // keep persist for ole objects alive + pTransferObj->SetDrawPersist(aDragShellRef); // keep persist for ole objects alive pTransferObj->SetDragSource( pDrawView ); // copies selection mxDrawData = pTransferObj; diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index 5f0599c888b3..d604963fd451 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -668,12 +668,11 @@ void ScTransferObj::InitDocShell(bool bLimitToPageSize) if ( m_aDocShellRef.is() ) return; - ScDocShell* pDocSh = new ScDocShell; - m_aDocShellRef = pDocSh; // ref must be there before InitNew + m_aDocShellRef = new ScDocShell; // ref must be there before InitNew - pDocSh->DoInitNew(); + m_aDocShellRef->DoInitNew(); - ScDocument& rDestDoc = pDocSh->GetDocument(); + ScDocument& rDestDoc = m_aDocShellRef->GetDocument(); ScMarkData aDestMark(rDestDoc.GetSheetLimits()); aDestMark.SelectTable( 0, true ); @@ -683,7 +682,7 @@ void ScTransferObj::InitDocShell(bool bLimitToPageSize) m_pDoc->GetName( m_aBlock.aStart.Tab(), aTabName ); rDestDoc.RenameTab( 0, aTabName ); - pDocSh->MakeDrawLayer(); + m_aDocShellRef->MakeDrawLayer(); rDestDoc.CopyStdStylesFrom(*m_pDoc); @@ -758,7 +757,7 @@ void ScTransferObj::InitDocShell(bool bLimitToPageSize) pDestPool->CopyStyleFrom( pStylePool, aStyleName, SfxStyleFamily::Page ); } - ScViewData aViewData( *pDocSh, nullptr ); + ScViewData aViewData(*m_aDocShellRef, nullptr); aViewData.SetScreen( nStartX,nStartY, nEndX,nEndY ); aViewData.SetCurX( nStartX ); aViewData.SetCurY( nStartY ); @@ -799,14 +798,14 @@ void ScTransferObj::InitDocShell(bool bLimitToPageSize) nSizeX = o3tl::convert(nSizeX, o3tl::Length::twip, o3tl::Length::mm100); nSizeY = o3tl::convert(nSizeY, o3tl::Length::twip, o3tl::Length::mm100); -// pDocSh->SetVisAreaSize( Size(nSizeX,nSizeY) ); +// m_aDocShellRef->SetVisAreaSize( Size(nSizeX,nSizeY) ); tools::Rectangle aNewArea( Point(nPosX,nPosY), Size(nSizeX,nSizeY) ); //TODO/LATER: why twice?! - //pDocSh->SvInPlaceObject::SetVisArea( aNewArea ); - pDocSh->SetVisArea( aNewArea ); + //m_aDocShellRef->SvInPlaceObject::SetVisArea( aNewArea ); + m_aDocShellRef->SetVisArea(aNewArea); - pDocSh->UpdateOle(aViewData, true); + m_aDocShellRef->UpdateOle(aViewData, true); //! SetDocumentModified? if ( rDestDoc.IsChartListenerCollectionNeedsUpdate() ) diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx index 1ebd60763654..e1226c01579d 100644 --- a/sc/source/ui/docshell/arealink.cxx +++ b/sc/source/ui/docshell/arealink.cxx @@ -254,8 +254,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter, SfxMedium* pMed = ScDocumentLoader::CreateMedium( aNewUrl, pFilter, aOptions); // aRef->DoClose() will be closed explicitly, but it is still more safe to use SfxObjectShellLock here - ScDocShell* pSrcShell = new ScDocShell(SfxModelFlags::EMBEDDED_OBJECT | SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS); - SfxObjectShellLock aRef = pSrcShell; + rtl::Reference<ScDocShell> pSrcShell = new ScDocShell(SfxModelFlags::EMBEDDED_OBJECT | SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS); pSrcShell->DoLoad(pMed); ScDocument& rSrcDoc = pSrcShell->GetDocument(); @@ -480,7 +479,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter, // clean up - aRef->DoClose(); + pSrcShell->DoClose(); rDoc.SetInLinkUpdate( false ); diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index a9419dbb5b57..9bf7c1beb7b2 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -713,8 +713,7 @@ void ScDocShell::Execute( SfxRequest& rReq ) SfxErrorContext aEc( ERRCTX_SFX_OPENDOC, pMed->GetName() ); // pOtherDocSh->DoClose() will be called explicitly later, but it is still more safe to use SfxObjectShellLock here - ScDocShell* pOtherDocSh = new ScDocShell; - SfxObjectShellLock aDocShTablesRef = pOtherDocSh; + rtl::Reference<ScDocShell> pOtherDocSh = new ScDocShell; pOtherDocSh->DoLoad( pMed ); ErrCodeMsg nErr = pOtherDocSh->GetErrorCode(); if (nErr) diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index f5b3dbd26fa1..3e66cfe68016 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -2607,8 +2607,7 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUSt // To load encrypted documents with password, user interaction needs to be enabled. pMedium->UseInteractionHandler(mbUserInteractionEnabled); - ScDocShell* pNewShell = new ScDocShell(SfxModelFlags::EXTERNAL_LINK); - SfxObjectShellRef aRef = pNewShell; + rtl::Reference<ScDocShell> pNewShell = new ScDocShell(SfxModelFlags::EXTERNAL_LINK); // increment the recursive link count of the source document. ScExtDocOptions* pExtOpt = mrDoc.GetExtDocOptions(); @@ -2629,9 +2628,9 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUSt if (!pNewShell->DoLoad(pMedium.release())) { - aRef->DoClose(); - aRef.clear(); - return aRef; + pNewShell->DoClose(); + pNewShell.clear(); + return pNewShell; } // with UseInteractionHandler, options may be set by dialog during DoLoad @@ -2640,7 +2639,7 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUSt aOptions = aNew; setFilterData(nFileId, rFilter, aOptions); // update the filter data, including the new options - return aRef; + return pNewShell; } ScDocument& ScExternalRefManager::cacheNewDocShell( sal_uInt16 nFileId, SrcShell& rSrcShell ) @@ -3315,8 +3314,8 @@ void ScExternalRefManager::Notify( SfxBroadcaster&, const SfxHint& rHint ) case SfxEventHintId::SaveDocDone: case SfxEventHintId::SaveAsDocDone: { - SfxObjectShell* pObjShell = static_cast<const SfxEventHint&>( rHint ).GetObjShell(); - transformUnsavedRefToSavedRef(pObjShell); + rtl::Reference<SfxObjectShell> pObjShell = static_cast<const SfxEventHint&>( rHint ).GetObjShell(); + transformUnsavedRefToSavedRef(pObjShell.get()); } break; default: diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx index 5a20b1c94075..04f21b9c05b6 100644 --- a/sc/source/ui/docshell/tablink.cxx +++ b/sc/source/ui/docshell/tablink.cxx @@ -177,8 +177,7 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter, pMed->UseInteractionHandler(true); // enable the filter options dialog // aRef->DoClose() will be called explicitly, but it is still more safe to use SfxObjectShellLock here - ScDocShell* pSrcShell = new ScDocShell(SfxModelFlags::EMBEDDED_OBJECT | SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS); - SfxObjectShellLock aRef = pSrcShell; + rtl::Reference<ScDocShell> pSrcShell = new ScDocShell(SfxModelFlags::EMBEDDED_OBJECT | SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS); pSrcShell->DoLoad(pMed); // options might have been set @@ -358,7 +357,7 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter, // clean up - aRef->DoClose(); + pSrcShell->DoClose(); // Undo @@ -491,8 +490,7 @@ ScDocumentLoader::ScDocumentLoader(const OUString& rFileName, OUString& rFilterName, OUString& rOptions, sal_uInt32 nRekCnt, weld::Window* pInteractionParent, css::uno::Reference<css::io::XInputStream> xInputStream) - : pDocShell(nullptr) - , pMedium(nullptr) + : pMedium(nullptr) { if ( rFilterName.isEmpty() ) GetFilterName(rFileName, rFilterName, rOptions, true, pInteractionParent != nullptr); @@ -506,7 +504,6 @@ ScDocumentLoader::ScDocumentLoader(const OUString& rFileName, return ; pDocShell = new ScDocShell( SfxModelFlags::EMBEDDED_OBJECT | SfxModelFlags::DISABLE_EMBEDDED_SCRIPTS ); - aRef = pDocShell; ScDocument& rDoc = pDocShell->GetDocument(); ScExtDocOptions* pExtDocOpt = rDoc.GetExtDocOptions(); @@ -526,22 +523,21 @@ ScDocumentLoader::ScDocumentLoader(const OUString& rFileName, ScDocumentLoader::~ScDocumentLoader() { - if ( aRef.is() ) - aRef->DoClose(); + if (pDocShell) + pDocShell->DoClose(); else delete pMedium; } void ScDocumentLoader::ReleaseDocRef() { - if ( aRef.is() ) + if (pDocShell) { // release reference without calling DoClose - caller must // have another reference to the doc and call DoClose later - pDocShell = nullptr; pMedium = nullptr; - aRef.clear(); + pDocShell.clear(); } } diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx index e60b9f2b94e8..2f78bd16ef18 100644 --- a/sc/source/ui/inc/docsh.hxx +++ b/sc/source/ui/inc/docsh.hxx @@ -445,7 +445,7 @@ private: void UpdateAcceptChangesDialog(); -typedef tools::SvRef<ScDocShell> ScDocShellRef; +typedef rtl::Reference<ScDocShell> ScDocShellRef; /** Create before modifications of the document and destroy thereafter. Call SetDocumentModified() at an instance of this class instead of at diff --git a/sc/source/ui/inc/drwtrans.hxx b/sc/source/ui/inc/drwtrans.hxx index 71213739dd2b..2e485db9a2af 100644 --- a/sc/source/ui/inc/drwtrans.hxx +++ b/sc/source/ui/inc/drwtrans.hxx @@ -40,7 +40,7 @@ private: std::unique_ptr<SdrModel> m_pModel; TransferableDataHelper m_aOleData; TransferableObjectDescriptor m_aObjDesc; - SfxObjectShellRef m_aDocShellRef; + rtl::Reference<ScDocShell> m_aDocShellRef; SfxObjectShellRef m_aDrawPersistRef; // extracted from model in ctor: diff --git a/sc/source/ui/inc/instbdlg.hxx b/sc/source/ui/inc/instbdlg.hxx index 9698229b69cc..81e48e3f0990 100644 --- a/sc/source/ui/inc/instbdlg.hxx +++ b/sc/source/ui/inc/instbdlg.hxx @@ -44,7 +44,7 @@ public: const OUString* GetFirstTable( sal_uInt16* pN ); const OUString* GetNextTable( sal_uInt16* pN ); - ScDocShell* GetDocShellTables() { return pDocShTables; } + ScDocShell* GetDocShellTables() { return pDocShTables.get(); } bool IsTableBefore() const { return m_xBtnBefore->get_active(); } SCTAB GetTableCount() const { return nTableCount;} @@ -52,9 +52,8 @@ private: Timer aBrowseTimer; ScViewData& rViewData; ScDocument& rDoc; - ScDocShell* pDocShTables; + rtl::Reference<ScDocShell> pDocShTables; std::unique_ptr<sfx2::DocumentInserter> pDocInserter; - SfxObjectShellRef aDocShTablesRef; bool bMustClose; sal_uInt16 nSelTabIndex; // for GetFirstTable() / GetNextTable() diff --git a/sc/source/ui/inc/linkarea.hxx b/sc/source/ui/inc/linkarea.hxx index a209d3b8a39f..bde58e601b3b 100644 --- a/sc/source/ui/inc/linkarea.hxx +++ b/sc/source/ui/inc/linkarea.hxx @@ -31,9 +31,8 @@ class SvtURLBox; class ScLinkedAreaDlg : public weld::GenericDialogController { private: - ScDocShell* m_pSourceShell; + rtl::Reference<ScDocShell> m_pSourceShell; std::unique_ptr<sfx2::DocumentInserter> m_xDocInserter; - SfxObjectShellRef aSourceRef; std::unique_ptr<SvtURLBox> m_xCbUrl; std::unique_ptr<weld::Button> m_xBtnBrowse; diff --git a/sc/source/ui/inc/transobj.hxx b/sc/source/ui/inc/transobj.hxx index 1c81610e6fc9..9b160e127cc9 100644 --- a/sc/source/ui/inc/transobj.hxx +++ b/sc/source/ui/inc/transobj.hxx @@ -44,7 +44,7 @@ private: ScRange m_aBlock; SCROW m_nNonFiltered; // non-filtered rows TransferableObjectDescriptor m_aObjDesc; - SfxObjectShellRef m_aDocShellRef; + rtl::Reference<ScDocShell> m_aDocShellRef; SfxObjectShellRef m_aDrawPersistRef; rtl::Reference<ScCellRangesBase> m_xDragSourceRanges; SCCOL m_nDragHandleX; diff --git a/sc/source/ui/miscdlgs/instbdlg.cxx b/sc/source/ui/miscdlgs/instbdlg.cxx index e34b22a6f336..ae81f4e3c17b 100644 --- a/sc/source/ui/miscdlgs/instbdlg.cxx +++ b/sc/source/ui/miscdlgs/instbdlg.cxx @@ -38,7 +38,6 @@ ScInsertTableDlg::ScInsertTableDlg(weld::Window* pParent, ScViewData& rData, SCT , aBrowseTimer("ScInsertTableDlg aBrowseTimer") , rViewData(rData) , rDoc(rData.GetDocument()) - , pDocShTables(nullptr) , bMustClose(false) , nSelTabIndex(0) , nTableCount(nTabCount) @@ -318,7 +317,6 @@ IMPL_LINK( ScInsertTableDlg, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg pMed->UseInteractionHandler( true ); // to enable the filter options dialog pDocShTables = new ScDocShell; - aDocShTablesRef = pDocShTables; { weld::WaitObject aWait(m_xDialog.get()); @@ -337,8 +335,7 @@ IMPL_LINK( ScInsertTableDlg, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg else { pDocShTables->DoClose(); - aDocShTablesRef.clear(); - pDocShTables = nullptr; + pDocShTables.clear(); FillTables_Impl( nullptr ); m_xFtPath->set_label(OUString()); diff --git a/sc/source/ui/miscdlgs/linkarea.cxx b/sc/source/ui/miscdlgs/linkarea.cxx index 0b9dc129d7cb..e2737c0a5ff6 100644 --- a/sc/source/ui/miscdlgs/linkarea.cxx +++ b/sc/source/ui/miscdlgs/linkarea.cxx @@ -38,7 +38,6 @@ ScLinkedAreaDlg::ScLinkedAreaDlg(weld::Widget* pParent) : GenericDialogController(pParent, "modules/scalc/ui/externaldata.ui", "ExternalDataDialog") - , m_pSourceShell(nullptr) , m_xCbUrl(new SvtURLBox(m_xBuilder->weld_combo_box("url"))) , m_xBtnBrowse(m_xBuilder->weld_button("browse")) , m_xLbRanges(m_xBuilder->weld_tree_view("ranges")) @@ -109,8 +108,7 @@ void ScLinkedAreaDlg::LoadDocument( const OUString& rFile, const OUString& rFilt { // unload old document m_pSourceShell->DoClose(); - m_pSourceShell = nullptr; - aSourceRef.clear(); + m_pSourceShell.clear(); } if ( rFile.isEmpty() ) @@ -131,7 +129,6 @@ void ScLinkedAreaDlg::LoadDocument( const OUString& rFile, const OUString& rFilt if (nErr) ErrorHandler::HandleError( nErr ); // including warnings - aSourceRef = m_pSourceShell; aLoader.ReleaseDocRef(); // don't call DoClose in DocLoader dtor } } @@ -208,7 +205,6 @@ IMPL_LINK( ScLinkedAreaDlg, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, pMed->UseInteractionHandler( true ); // to enable the filter options dialog m_pSourceShell = new ScDocShell; - aSourceRef = m_pSourceShell; m_pSourceShell->DoLoad( pMed.get() ); ErrCodeMsg nErr = m_pSourceShell->GetErrorCode(); @@ -222,8 +218,7 @@ IMPL_LINK( ScLinkedAreaDlg, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, else { m_pSourceShell->DoClose(); - m_pSourceShell = nullptr; - aSourceRef.clear(); + m_pSourceShell.clear(); m_xCbUrl->set_entry_text(OUString()); } diff --git a/sc/source/ui/unoobj/exceldetect.cxx b/sc/source/ui/unoobj/exceldetect.cxx index 0c4373356ad9..d14a7d52eef8 100644 --- a/sc/source/ui/unoobj/exceldetect.cxx +++ b/sc/source/ui/unoobj/exceldetect.cxx @@ -62,7 +62,7 @@ bool hasStream(const uno::Reference<io::XInputStream>& xInStream, const OUString try { - tools::SvRef<SotStorage> xStorage = new SotStorage(pStream, false); + rtl::Reference<SotStorage> xStorage = new SotStorage(pStream, false); if (!xStorage.is() || xStorage->GetError()) return false; return xStorage->IsStream(rName); diff --git a/sc/source/ui/unoobj/unodoc.cxx b/sc/source/ui/unoobj/unodoc.cxx index bed297df7c0f..a992e0f4a6fc 100644 --- a/sc/source/ui/unoobj/unodoc.cxx +++ b/sc/source/ui/unoobj/unodoc.cxx @@ -35,7 +35,7 @@ Calc_SpreadsheetDocument_get_implementation( css::uno::Reference<css::uno::XInterface> xInterface = sfx2::createSfxModelInstance(args, [](SfxModelFlags _nCreationFlags) { - SfxObjectShell* pShell = new ScDocShell( _nCreationFlags ); + rtl::Reference<SfxObjectShell> pShell = new ScDocShell(_nCreationFlags); return uno::Reference< uno::XInterface >( pShell->GetModel() ); }); xInterface->acquire(); diff --git a/sc/source/ui/view/drawvie4.cxx b/sc/source/ui/view/drawvie4.cxx index 2bd329098206..dd5740023bd5 100644 --- a/sc/source/ui/view/drawvie4.cxx +++ b/sc/source/ui/view/drawvie4.cxx @@ -95,7 +95,7 @@ void ScDrawView::BeginDrag( vcl::Window* pWindow, const Point& rStartPos ) rtl::Reference<ScDrawTransferObj> pTransferObj = new ScDrawTransferObj( std::move(pModel), pDocSh, std::move(aObjDesc) ); - pTransferObj->SetDrawPersist( aDragShellRef.get() ); // keep persist for ole objects alive + pTransferObj->SetDrawPersist(aDragShellRef); // keep persist for ole objects alive pTransferObj->SetDragSource( this ); // copies selection SC_MOD()->SetDragObject( nullptr, pTransferObj.get() ); // for internal D&D @@ -366,7 +366,7 @@ void ScDrawView::DoCopy() if ( ScGlobal::xDrawClipDocShellRef.is() ) { - pTransferObj->SetDrawPersist( ScGlobal::xDrawClipDocShellRef.get() ); // keep persist for ole objects alive + pTransferObj->SetDrawPersist( ScGlobal::xDrawClipDocShellRef ); // keep persist for ole objects alive } pTransferObj->CopyToClipboard( pViewData->GetActiveWin() ); // system clipboard @@ -400,7 +400,7 @@ uno::Reference<datatransfer::XTransferable> ScDrawView::CopyToTransferable() if ( ScGlobal::xDrawClipDocShellRef.is() ) { - pTransferObj->SetDrawPersist( ScGlobal::xDrawClipDocShellRef.get() ); // keep persist for ole objects alive + pTransferObj->SetDrawPersist( ScGlobal::xDrawClipDocShellRef ); // keep persist for ole objects alive } return pTransferObj; diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index 30c5e0079ea5..3ae5cbc52c61 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -294,7 +294,7 @@ bool ScViewFunc::CopyToClipSingleRange( ScDocument* pClipDoc, const ScRangeList& rtl::Reference<ScTransferObj> pTransferObj(new ScTransferObj( pSysClipDoc, std::move(aObjDesc) )); if ( ScGlobal::xDrawClipDocShellRef.is() ) { - SfxObjectShellRef aPersistRef( ScGlobal::xDrawClipDocShellRef.get() ); + SfxObjectShellRef aPersistRef(ScGlobal::xDrawClipDocShellRef); pTransferObj->SetDrawPersist( aPersistRef );// keep persist for ole objects alive } pTransferObj->CopyToClipboard( GetActiveWin() ); @@ -410,7 +410,7 @@ bool ScViewFunc::CopyToClipMultiRange( const ScDocument* pInputClipDoc, const Sc rtl::Reference<ScTransferObj> pTransferObj(new ScTransferObj( std::move(pDocClip), std::move(aObjDesc) )); if ( ScGlobal::xDrawClipDocShellRef.is() ) { - SfxObjectShellRef aPersistRef( ScGlobal::xDrawClipDocShellRef.get() ); + SfxObjectShellRef aPersistRef(ScGlobal::xDrawClipDocShellRef); pTransferObj->SetDrawPersist( aPersistRef ); // keep persist for ole objects alive } pTransferObj->CopyToClipboard( GetActiveWin() ); // system clipboard diff --git a/sd/inc/drawdoc.hxx b/sd/inc/drawdoc.hxx index 401bde6b5f88..f2a28131f888 100644 --- a/sd/inc/drawdoc.hxx +++ b/sd/inc/drawdoc.hxx @@ -68,7 +68,7 @@ namespace sd class DrawDocShell; #ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED #define SV_DECL_DRAW_DOC_SHELL_DEFINED -typedef ::tools::SvRef<DrawDocShell> DrawDocShellRef; +typedef rtl::Reference<DrawDocShell> DrawDocShellRef; #endif class UndoManager; class ShapeList; diff --git a/sd/inc/sdfilter.hxx b/sd/inc/sdfilter.hxx index 1a8c8b6739a6..ef3fb7763210 100644 --- a/sd/inc/sdfilter.hxx +++ b/sd/inc/sdfilter.hxx @@ -20,8 +20,8 @@ #pragma once #include <osl/module.h> +#include <rtl/ref.hxx> #include <rtl/ustring.hxx> -#include <tools/ref.hxx> #include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/frame/XModel.hpp> #include <com/sun/star/task/XStatusIndicator.hpp> @@ -57,7 +57,7 @@ protected: }; SD_DLLPUBLIC bool ExportPPT( const std::vector< css::beans::PropertyValue >& rMediaData, - tools::SvRef<SotStorage> const & rSvStorage, + rtl::Reference<SotStorage> const & rSvStorage, css::uno::Reference< css::frame::XModel > const & rXModel, css::uno::Reference< css::task::XStatusIndicator > const & rXStatInd, SvMemoryStream* pVBA, diff --git a/sd/inc/sdmod.hxx b/sd/inc/sdmod.hxx index e1a2c51b6446..5008fc001f0b 100644 --- a/sd/inc/sdmod.hxx +++ b/sd/inc/sdmod.hxx @@ -104,7 +104,7 @@ public: void GetState(SfxItemSet&); SdOptions* GetSdOptions(DocumentType eDocType); - SD_DLLPUBLIC tools::SvRef<SotStorageStream> GetOptionStream( std::u16string_view rOptionName, SdOptionStreamMode eMode ); + SD_DLLPUBLIC rtl::Reference<SotStorageStream> GetOptionStream( std::u16string_view rOptionName, SdOptionStreamMode eMode ); bool GetWaterCan() const { return bWaterCan; } void SetWaterCan( bool bWC ) { bWaterCan = bWC; } @@ -140,7 +140,7 @@ private: SdOptions* pDrawOptions; std::unique_ptr<SvxSearchItem> pSearchItem; std::unique_ptr<SvNumberFormatter> pNumberFormatter; - tools::SvRef<SotStorage> xOptionStorage; + rtl::Reference<SotStorage> xOptionStorage; bool bWaterCan; std::unique_ptr<SfxErrorHandler> mpErrorHdl; /** This device is used for printer independent layout. It is virtual diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx index a239eaad2ef3..e6a71eb3f56c 100644 --- a/sd/source/filter/eppt/eppt.cxx +++ b/sd/source/filter/eppt/eppt.cxx @@ -65,7 +65,7 @@ using ::com::sun::star::beans::XPropertySet; //============================ PPTWriter ================================== -PPTWriter::PPTWriter( tools::SvRef<SotStorage> xSvStorage, +PPTWriter::PPTWriter( rtl::Reference<SotStorage> xSvStorage, css::uno::Reference< css::frame::XModel > const & rXModel, css::uno::Reference< css::task::XStatusIndicator > const & rXStatInd, SvMemoryStream* pVBA, sal_uInt32 nCnvrtFlags ) : @@ -1251,16 +1251,16 @@ void PPTWriter::ImplWriteOLE( ) const ::uno::Reference < embed::XEmbeddedObject >& xObj( pSdrOle2Obj->GetObjRef() ); if( xObj.is() ) { - tools::SvRef<SotStorage> xTempStorage( new SotStorage( new SvMemoryStream(), true ) ); + rtl::Reference<SotStorage> xTempStorage( new SotStorage( new SvMemoryStream(), true ) ); aOleExport.ExportOLEObject( xObj, *xTempStorage ); //TODO/MBA: testing SvMemoryStream aStream; - tools::SvRef<SotStorage> xCleanStorage( new SotStorage( false, aStream ) ); + rtl::Reference<SotStorage> xCleanStorage(new SotStorage(false, aStream)); xTempStorage->CopyTo( xCleanStorage.get() ); // create a dummy content stream, the dummy content is necessary for ppt, but not for // doc files, so we can't share code. - tools::SvRef<SotStorageStream> xStm = xCleanStorage->OpenSotStream( SVEXT_PERSIST_STREAM ); + rtl::Reference<SotStorageStream> xStm = xCleanStorage->OpenSotStream( SVEXT_PERSIST_STREAM ); xStm->WriteUInt32( 0 ) // no ClipboardId .WriteUInt32( 4 ) // no target device .WriteUInt32( 1 ) // aspect ratio @@ -1283,7 +1283,7 @@ void PPTWriter::ImplWriteOLE( ) OUString aName; //Initialize the graphic size which will be used on export css::awt::Size aSize( pPtr->xShape->getSize() ); - tools::SvRef<SotStorage> xDest( new SotStorage( new SvMemoryStream(), true ) ); + rtl::Reference<SotStorage> xDest(new SotStorage(new SvMemoryStream(), true)); bool bOk = oox::ole::MSConvertOCXControls::WriteOCXStream( mXModel, xDest, pPtr->xControlModel, aSize, aName ); if ( bOk ) pStrm = xDest->CreateMemoryStream(); @@ -1419,7 +1419,7 @@ void PPTWriter::ImplWriteAtomEnding() // - exported function - SAL_DLLPUBLIC_EXPORT bool ExportPPT( const std::vector< css::beans::PropertyValue >& rMediaData, - tools::SvRef<SotStorage> const & rSvStorage, + rtl::Reference<SotStorage> const & rSvStorage, css::uno::Reference< css::frame::XModel > const & rXModel, css::uno::Reference< css::task::XStatusIndicator > const & rXStatInd, SvMemoryStream* pVBA, @@ -1433,17 +1433,17 @@ SAL_DLLPUBLIC_EXPORT bool ExportPPT( const std::vector< css::beans::PropertyValu SAL_DLLPUBLIC_EXPORT bool SaveVBA( SfxObjectShell& rDocShell, SvMemoryStream*& pBas ) { - tools::SvRef<SotStorage> xDest( new SotStorage( new SvMemoryStream(), true ) ); + rtl::Reference<SotStorage> xDest(new SotStorage(new SvMemoryStream(), true)); SvxImportMSVBasic aMSVBas( rDocShell, *xDest ); aMSVBas.SaveOrDelMSVBAStorage( true, "_MS_VBA_Overhead" ); - tools::SvRef<SotStorage> xOverhead = xDest->OpenSotStorage( "_MS_VBA_Overhead" ); + rtl::Reference<SotStorage> xOverhead = xDest->OpenSotStorage("_MS_VBA_Overhead"); if ( xOverhead.is() && ( xOverhead->GetError() == ERRCODE_NONE ) ) { - tools::SvRef<SotStorage> xOverhead2 = xOverhead->OpenSotStorage( "_MS_VBA_Overhead" ); + rtl::Reference<SotStorage> xOverhead2 = xOverhead->OpenSotStorage("_MS_VBA_Overhead"); if ( xOverhead2.is() && ( xOverhead2->GetError() == ERRCODE_NONE ) ) { - tools::SvRef<SotStorageStream> xTemp = xOverhead2->OpenSotStream( "_MS_VBA_Overhead2" ); + rtl::Reference<SotStorageStream> xTemp = xOverhead2->OpenSotStream("_MS_VBA_Overhead2"); if ( xTemp.is() && ( xTemp->GetError() == ERRCODE_NONE ) ) { sal_uInt32 nLen = xTemp->GetSize(); diff --git a/sd/source/filter/eppt/eppt.hxx b/sd/source/filter/eppt/eppt.hxx index 635d5a2223a1..1ef07d1dcff4 100644 --- a/sd/source/filter/eppt/eppt.hxx +++ b/sd/source/filter/eppt/eppt.hxx @@ -127,10 +127,10 @@ class PPTWriter final : public PPTWriterBase, public PPTExBulletProvider bool mbFontIndependentLineSpacing; sal_uInt32 mnTextSize; - tools::SvRef<SotStorage> mrStg; - tools::SvRef<SotStorageStream> mpCurUserStrm; - tools::SvRef<SotStorageStream> mpStrm; - tools::SvRef<SotStorageStream> mpPicStrm; + rtl::Reference<SotStorage> mrStg; + rtl::Reference<SotStorageStream> mpCurUserStrm; + rtl::Reference<SotStorageStream> mpStrm; + rtl::Reference<SotStorageStream> mpPicStrm; std::unique_ptr<PptEscherEx> mpPptEscherEx; std::vector<std::unique_ptr<PPTExOleObjEntry>> maExOleObj; @@ -217,7 +217,7 @@ class PPTWriter final : public PPTWriterBase, public PPTExBulletProvider virtual void ImplWriteSlideMaster( sal_uInt32 nPageNum, css::uno::Reference< css::beans::XPropertySet > const & aXBackgroundPropSet ) override; public: - PPTWriter( tools::SvRef<SotStorage> xSvStorage, + PPTWriter( rtl::Reference<SotStorage> xSvStorage, css::uno::Reference< css::frame::XModel > const & rModel, css::uno::Reference< css::task::XStatusIndicator > const & rStatInd, SvMemoryStream* pVBA, sal_uInt32 nCnvrtFlags ); diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index e6923533c92d..97a0f170edf0 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -1981,14 +1981,14 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a css::awt::Size aSize; OUString aControlName; - tools::SvRef<SotStorage> xTemp( new SotStorage( new SvMemoryStream(), true ) ); + rtl::Reference<SotStorage> xTemp(new SotStorage(new SvMemoryStream(), true)); if ( oox::ole::MSConvertOCXControls::WriteOCXStream( mXModel, xTemp, aXControlModel, aSize, aControlName ) ) { OUString aUserName( xTemp->GetUserName() ); OUString aOleIdentifier; if ( !aUserName.isEmpty() ) { - tools::SvRef<SotStorageStream> xCompObj = xTemp->OpenSotStream( + rtl::Reference<SotStorageStream> xCompObj = xTemp->OpenSotStream( "\1CompObj", StreamMode::READ | StreamMode::NOCREATE | StreamMode::SHARE_DENYALL ); sal_uInt32 const nStreamLen = xCompObj->remainingSize(); diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index 83570ca2ba8f..5f5c4e87bcb4 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -127,7 +127,7 @@ SdPPTImport::SdPPTImport( SdDrawDocument* pDocument, SvStream& rDocStream, SotSt pSummaryInformation.reset(); #endif - tools::SvRef<SotStorageStream> pCurrentUserStream(rStorage.OpenSotStream("Current User", StreamMode::STD_READ)); + rtl::Reference<SotStorageStream> pCurrentUserStream(rStorage.OpenSotStream("Current User", StreamMode::STD_READ)); if (pCurrentUserStream) { ReadPptCurrentUserAtom(*pCurrentUserStream, maParam.aCurrentUserAtom); @@ -2746,7 +2746,7 @@ rtl::Reference<SdrObject> ImplSdPPTImport::ProcessObj( SvStream& rSt, DffObjData } bool -ImplSdPPTImport::ReadFormControl( tools::SvRef<SotStorage>& rSrc1, css::uno::Reference< css::form::XFormComponent > & rFormComp ) const +ImplSdPPTImport::ReadFormControl( rtl::Reference<SotStorage>& rSrc1, css::uno::Reference< css::form::XFormComponent > & rFormComp ) const { uno::Reference< frame::XModel > xModel; if ( mpDoc->GetDocSh() ) @@ -2771,11 +2771,11 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportPPT(SvStream &rStream) bool bRet = false; try { - tools::SvRef<SotStorage> xStorage(new SotStorage(rStream)); + rtl::Reference<SotStorage> xStorage(new SotStorage(rStream)); if (xStorage->GetError()) return false; - tools::SvRef<SotStorageStream> xDocStream(xStorage->OpenSotStream( "PowerPoint Document", StreamMode::STD_READ)); + rtl::Reference<SotStorageStream> xDocStream(xStorage->OpenSotStream( "PowerPoint Document", StreamMode::STD_READ)); if ( !xDocStream.is() ) return false; diff --git a/sd/source/filter/ppt/pptin.hxx b/sd/source/filter/ppt/pptin.hxx index c0d239fd23c5..49f15925baf1 100644 --- a/sd/source/filter/ppt/pptin.hxx +++ b/sd/source/filter/ppt/pptin.hxx @@ -43,7 +43,7 @@ typedef ::std::map < SdrObject*, Ppt97AnimationPtr > tAnimationMap; class ImplSdPPTImport : public SdrPowerPointImport { - tools::SvRef<SotStorageStream> mxPicturesStream; + rtl::Reference<SotStorageStream> mxPicturesStream; SfxMedium& mrMed; SotStorage& mrStorage; DffRecordHeader maDocHd; @@ -73,7 +73,7 @@ public: virtual ~ImplSdPPTImport() override; bool Import(); - virtual bool ReadFormControl( tools::SvRef<SotStorage>& rSrc1, css::uno::Reference< css::form::XFormComponent > & rFormComp ) const override; + virtual bool ReadFormControl( rtl::Reference<SotStorage>& rSrc1, css::uno::Reference< css::form::XFormComponent > & rFormComp ) const override; }; class SdPPTImport diff --git a/sd/source/filter/ppt/propread.hxx b/sd/source/filter/ppt/propread.hxx index d5521a6020d5..94b8d12e13a6 100644 --- a/sd/source/filter/ppt/propread.hxx +++ b/sd/source/filter/ppt/propread.hxx @@ -23,6 +23,7 @@ #include <vector> #include <memory> +#include <rtl/ref.hxx> #include <sal/types.h> #include <sot/storage.hxx> #include <tools/stream.hxx> @@ -133,7 +134,7 @@ class Section final class PropRead { bool mbStatus; - tools::SvRef<SotStorageStream> mpSvStream; + rtl::Reference<SotStorageStream> mpSvStream; sal_uInt16 mnByteOrder; sal_uInt8 mApplicationCLSID[ 16 ]; diff --git a/sd/source/filter/sdpptwrp.cxx b/sd/source/filter/sdpptwrp.cxx index a4b0d90bfead..20ae1cba18c2 100644 --- a/sd/source/filter/sdpptwrp.cxx +++ b/sd/source/filter/sdpptwrp.cxx @@ -61,13 +61,13 @@ static void lcl_getListOfStreams(SotStorage * pStorage, comphelper::SequenceAsHa OUString sStreamFullName = sPrefix.size() ? OUString::Concat(sPrefix) + "/" + aElement.GetName() : aElement.GetName(); if (aElement.IsStorage()) { - tools::SvRef<SotStorage> xSubStorage = pStorage->OpenSotStorage(aElement.GetName(), StreamMode::STD_READ | StreamMode::SHARE_DENYALL); + rtl::Reference<SotStorage> xSubStorage = pStorage->OpenSotStorage(aElement.GetName(), StreamMode::STD_READ | StreamMode::SHARE_DENYALL); lcl_getListOfStreams(xSubStorage.get(), aStreamsData, sStreamFullName); } else { // Read stream - tools::SvRef<SotStorageStream> rStream = pStorage->OpenSotStream(aElement.GetName(), StreamMode::READ | StreamMode::SHARE_DENYALL); + rtl::Reference<SotStorageStream> rStream = pStorage->OpenSotStream(aElement.GetName(), StreamMode::READ | StreamMode::SHARE_DENYALL); if (rStream.is()) { sal_Int32 nStreamSize = rStream->GetSize(); @@ -81,9 +81,9 @@ static void lcl_getListOfStreams(SotStorage * pStorage, comphelper::SequenceAsHa } } -static tools::SvRef<SotStorage> lcl_DRMDecrypt(const SfxMedium& rMedium, const tools::SvRef<SotStorage>& rStorage, std::shared_ptr<SvStream>& rNewStorageStrm) +static rtl::Reference<SotStorage> lcl_DRMDecrypt(const SfxMedium& rMedium, const rtl::Reference<SotStorage>& rStorage, std::shared_ptr<SvStream>& rNewStorageStrm) { - tools::SvRef<SotStorage> aNewStorage; + rtl::Reference<SotStorage> aNewStorage; // We have DRM encrypted storage. We should try to decrypt it first, if we can Sequence< Any > aArguments; @@ -109,7 +109,7 @@ static tools::SvRef<SotStorage> lcl_DRMDecrypt(const SfxMedium& rMedium, const t return aNewStorage; } - tools::SvRef<SotStorageStream> rContentStream = rStorage->OpenSotStream("\011DRMContent", StreamMode::READ | StreamMode::SHARE_DENYALL); + rtl::Reference<SotStorageStream> rContentStream = rStorage->OpenSotStream("\011DRMContent", StreamMode::READ | StreamMode::SHARE_DENYALL); if (!rContentStream.is()) { return aNewStorage; @@ -147,12 +147,12 @@ bool SdPPTFilter::Import() { bool bRet = false; std::shared_ptr<SvStream> aDecryptedStorageStrm; - tools::SvRef<SotStorage> pStorage = new SotStorage( mrMedium.GetInStream(), false ); + rtl::Reference<SotStorage> pStorage = new SotStorage(mrMedium.GetInStream(), false); if( !pStorage->GetError() ) { /* check if there is a dualstorage, then the document is probably a PPT95 containing PPT97 */ - tools::SvRef<SotStorage> xDualStorage; + rtl::Reference<SotStorage> xDualStorage; OUString sDualStorage( "PP97_DUALSTORAGE" ); if ( pStorage->IsContained( sDualStorage ) ) { @@ -164,7 +164,7 @@ bool SdPPTFilter::Import() // Document is DRM encrypted pStorage = lcl_DRMDecrypt(mrMedium, pStorage, aDecryptedStorageStrm); } - tools::SvRef<SotStorageStream> pDocStream(pStorage->OpenSotStream( "PowerPoint Document" , StreamMode::STD_READ )); + rtl::Reference<SotStorageStream> pDocStream(pStorage->OpenSotStream( "PowerPoint Document" , StreamMode::STD_READ )); if( pDocStream ) { pDocStream->SetVersion( pStorage->GetVersion() ); @@ -244,7 +244,7 @@ bool SdPPTFilter::Export() } } - tools::SvRef<SotStorage> xStorRef = new SotStorage(pOutputStrm, false); + rtl::Reference<SotStorage> xStorRef = new SotStorage(pOutputStrm, false); if (xStorRef.is()) { @@ -261,12 +261,12 @@ bool SdPPTFilter::Export() Reference<css::io::XInputStream > xInputStream(new utl::OSeekableInputStreamWrapper(pOutputStrm, false)); Sequence<NamedValue> aStreams = xPackageEncryption->encrypt(xInputStream); - tools::SvRef<SotStorage> xEncryptedRootStrg = new SotStorage(mrMedium.GetOutStream(), false); + rtl::Reference<SotStorage> xEncryptedRootStrg = new SotStorage(mrMedium.GetOutStream(), false); for (const NamedValue& aStreamData : aStreams) { // To avoid long paths split and open substorages recursively // Splitting paths manually, since comphelper::string::split is trimming special characters like \0x01, \0x09 - tools::SvRef<SotStorage> pStorage = xEncryptedRootStrg.get(); + rtl::Reference<SotStorage> pStorage = xEncryptedRootStrg; OUString sFileName; sal_Int32 idx = 0; do @@ -291,7 +291,7 @@ bool SdPPTFilter::Export() break; } - tools::SvRef<SotStorageStream> pStream = pStorage->OpenSotStream(sFileName); + rtl::Reference<SotStorageStream> pStream = pStorage->OpenSotStream(sFileName); if (!pStream) { bRet = false; diff --git a/sd/source/ui/app/sdmod.cxx b/sd/source/ui/app/sdmod.cxx index 22f566706c46..f1b9a9bbe8a1 100644 --- a/sd/source/ui/app/sdmod.cxx +++ b/sd/source/ui/app/sdmod.cxx @@ -162,11 +162,11 @@ SdOptions* SdModule::GetSdOptions(DocumentType eDocType) * if the stream is opened for reading but does not exist, an 'empty' * RefObject is returned */ -tools::SvRef<SotStorageStream> SdModule::GetOptionStream( std::u16string_view rOptionName, +rtl::Reference<SotStorageStream> SdModule::GetOptionStream( std::u16string_view rOptionName, SdOptionStreamMode eMode ) { ::sd::DrawDocShell* pDocSh = dynamic_cast< ::sd::DrawDocShell *>( SfxObjectShell::Current() ); - tools::SvRef<SotStorageStream> xStm; + rtl::Reference<SotStorageStream> xStm; if( pDocSh ) { diff --git a/sd/source/ui/app/sdmod1.cxx b/sd/source/ui/app/sdmod1.cxx index 66e1ecd8bad8..14f507fb1a1d 100644 --- a/sd/source/ui/app/sdmod1.cxx +++ b/sd/source/ui/app/sdmod1.cxx @@ -255,10 +255,9 @@ bool SdModule::OutlineToImpress(SfxRequest const & rRequest) if (pBytes.getLength()) { - SfxObjectShellLock xDocShell; - ::sd::DrawDocShell* pDocSh; - xDocShell = pDocSh = new ::sd::DrawDocShell( + rtl::Reference<sd::DrawDocShell> pDocSh = new ::sd::DrawDocShell( SfxObjectCreateMode::STANDARD, false, DocumentType::Impress); + SfxObjectShellLock xDocShell(pDocSh.get()); pDocSh->DoInitNew(); SdDrawDocument* pDoc = pDocSh->GetDoc(); @@ -518,9 +517,8 @@ SfxFrame* SdModule::CreateEmptyDocument( const Reference< XFrame >& i_rFrame ) { SfxFrame* pFrame = nullptr; - SfxObjectShellLock xDocShell; - ::sd::DrawDocShell* pNewDocSh; - xDocShell = pNewDocSh = new ::sd::DrawDocShell(SfxObjectCreateMode::STANDARD,false,DocumentType::Impress); + rtl::Reference<sd::DrawDocShell> pNewDocSh = new ::sd::DrawDocShell(SfxObjectCreateMode::STANDARD,false,DocumentType::Impress); + SfxObjectShellLock xDocShell(pNewDocSh.get()); pNewDocSh->DoInitNew(); SdDrawDocument* pDoc = pNewDocSh->GetDoc(); if (pDoc) diff --git a/sd/source/ui/dlg/morphdlg.cxx b/sd/source/ui/dlg/morphdlg.cxx index c0d7f4e5af20..96ed63f0b52d 100644 --- a/sd/source/ui/dlg/morphdlg.cxx +++ b/sd/source/ui/dlg/morphdlg.cxx @@ -65,7 +65,7 @@ MorphDlg::~MorphDlg() void MorphDlg::LoadSettings() { - tools::SvRef<SotStorageStream> xIStm( SD_MOD()->GetOptionStream( SD_OPTION_MORPHING , + rtl::Reference<SotStorageStream> xIStm( SD_MOD()->GetOptionStream( SD_OPTION_MORPHING , SdOptionStreamMode::Load ) ); sal_uInt16 nSteps; bool bOrient, bAttrib; @@ -89,7 +89,7 @@ void MorphDlg::LoadSettings() void MorphDlg::SaveSettings() const { - tools::SvRef<SotStorageStream> xOStm( SD_MOD()->GetOptionStream( SD_OPTION_MORPHING , + rtl::Reference<SotStorageStream> xOStm( SD_MOD()->GetOptionStream( SD_OPTION_MORPHING , SdOptionStreamMode::Store ) ); if( xOStm.is() ) diff --git a/sd/source/ui/dlg/vectdlg.cxx b/sd/source/ui/dlg/vectdlg.cxx index de555ceedb05..92961bb432a9 100644 --- a/sd/source/ui/dlg/vectdlg.cxx +++ b/sd/source/ui/dlg/vectdlg.cxx @@ -290,7 +290,7 @@ IMPL_LINK_NOARG(SdVectorizeDlg, MetricModifyHdl, weld::MetricSpinButton&, void) void SdVectorizeDlg::LoadSettings() { - tools::SvRef<SotStorageStream> xIStm( SD_MOD()->GetOptionStream( + rtl::Reference<SotStorageStream> xIStm( SD_MOD()->GetOptionStream( SD_OPTION_VECTORIZE , SdOptionStreamMode::Load ) ); sal_uInt16 nLayers; @@ -321,7 +321,7 @@ void SdVectorizeDlg::LoadSettings() void SdVectorizeDlg::SaveSettings() const { - tools::SvRef<SotStorageStream> xOStm( SD_MOD()->GetOptionStream( + rtl::Reference<SotStorageStream> xOStm( SD_MOD()->GetOptionStream( SD_OPTION_VECTORIZE , SdOptionStreamMode::Store ) ); diff --git a/sd/source/ui/inc/DrawDocShell.hxx b/sd/source/ui/inc/DrawDocShell.hxx index b53debc7dcbe..2ae1a106d7c2 100644 --- a/sd/source/ui/inc/DrawDocShell.hxx +++ b/sd/source/ui/inc/DrawDocShell.hxx @@ -23,6 +23,7 @@ #include <span> +#include <rtl/ref.hxx> #include <sfx2/docfac.hxx> #include <sfx2/objsh.hxx> #include <svl/style.hxx> @@ -228,7 +229,7 @@ private: #ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED #define SV_DECL_DRAW_DOC_SHELL_DEFINED -typedef ::tools::SvRef<DrawDocShell> DrawDocShellRef; +typedef rtl::Reference<DrawDocShell> DrawDocShellRef; #endif } // end of namespace sd diff --git a/sd/source/ui/inc/sdtreelb.hxx b/sd/source/ui/inc/sdtreelb.hxx index 4ee9cdf0507d..bb09653db584 100644 --- a/sd/source/ui/inc/sdtreelb.hxx +++ b/sd/source/ui/inc/sdtreelb.hxx @@ -44,7 +44,7 @@ class ViewShell; class DrawDocShell; #ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED #define SV_DECL_DRAW_DOC_SHELL_DEFINED -typedef ::tools::SvRef<DrawDocShell> DrawDocShellRef; +typedef rtl::Reference<DrawDocShell> DrawDocShellRef; #endif } namespace svt { diff --git a/sd/source/ui/unoidl/sddetect.cxx b/sd/source/ui/unoidl/sddetect.cxx index cfa50d14188a..b3f3dabff605 100644 --- a/sd/source/ui/unoidl/sddetect.cxx +++ b/sd/source/ui/unoidl/sddetect.cxx @@ -76,7 +76,7 @@ OUString SAL_CALL SdFilterDetect::detect( Sequence< beans::PropertyValue >& lDes try { - tools::SvRef<SotStorage> aStorage = new SotStorage( pInStrm, false ); + rtl::Reference<SotStorage> aStorage = new SotStorage(pInStrm, false); if ( !aStorage->GetError() && aStorage->IsStream( "PowerPoint Document" ) ) return aTypeName; } diff --git a/sd/source/ui/unoidl/unodoc.cxx b/sd/source/ui/unoidl/unodoc.cxx index cfb97c186cdb..b19e31f674f1 100644 --- a/sd/source/ui/unoidl/unodoc.cxx +++ b/sd/source/ui/unoidl/unodoc.cxx @@ -40,7 +40,7 @@ sd_DrawingDocument_get_implementation( css::uno::Reference<css::uno::XInterface> xInterface = sfx2::createSfxModelInstance(args, [](SfxModelFlags _nCreationFlags) { - SfxObjectShell* pShell = new ::sd::GraphicDocShell( _nCreationFlags ); + rtl::Reference<SfxObjectShell> pShell = new ::sd::GraphicDocShell(_nCreationFlags); return uno::Reference< uno::XInterface >( pShell->GetModel() ); }); xInterface->acquire(); @@ -61,7 +61,7 @@ sd_PresentationDocument_get_implementation( css::uno::Reference<css::uno::XInterface> xInterface = sfx2::createSfxModelInstance(args, [](SfxModelFlags _nCreationFlags) { - SfxObjectShell* pShell = + rtl::Reference<SfxObjectShell> pShell = new ::sd::DrawDocShell( _nCreationFlags, false, DocumentType::Impress ); return pShell->GetModel(); diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx index ee45f9da2661..f18b93792236 100644 --- a/sfx2/source/appl/appcfg.cxx +++ b/sfx2/source/appl/appcfg.cxx @@ -66,6 +66,7 @@ public: virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override; explicit SfxEventAsyncer_Impl(const SfxEventHint& rHint); + ~SfxEventAsyncer_Impl(); DECL_LINK( IdleHdl, Timer*, void ); }; @@ -93,6 +94,13 @@ SfxEventAsyncer_Impl::SfxEventAsyncer_Impl( const SfxEventHint& rHint ) } +SfxEventAsyncer_Impl::~SfxEventAsyncer_Impl() +{ + if (aHint.GetObjShell()) + EndListening(*aHint.GetObjShell()); +} + + IMPL_LINK(SfxEventAsyncer_Impl, IdleHdl, Timer*, pAsyncIdle, void) { SfxObjectShellRef xRef( aHint.GetObjShell() ); @@ -325,7 +333,7 @@ void SfxApplication::SetOptions(const SfxItemSet &rSet) void SfxApplication::NotifyEvent( const SfxEventHint& rEventHint, bool bSynchron ) { - SfxObjectShell *pDoc = rEventHint.GetObjShell(); + rtl::Reference<SfxObjectShell> pDoc = rEventHint.GetObjShell(); if ( pDoc && ( pDoc->IsPreview() || !pDoc->Get_Impl()->bInitialized ) ) return; diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index b19e0a36fa63..03ad8039be7b 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -1123,9 +1123,6 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq ) DBG_ASSERT( pSh, "Controller without ObjectShell ?!" ); rReq.SetReturnValue( SfxViewFrameItem( pCntrFrame->GetCurrentViewFrame() ) ); - - if ( bHidden ) - pSh->RestoreNoDelete(); } } diff --git a/sfx2/source/appl/sfxpicklist.cxx b/sfx2/source/appl/sfxpicklist.cxx index 64ebcc1a342c..9453d8ee8b2c 100644 --- a/sfx2/source/appl/sfxpicklist.cxx +++ b/sfx2/source/appl/sfxpicklist.cxx @@ -166,7 +166,7 @@ void SfxPickListImpl::Notify( SfxBroadcaster&, const SfxHint& rHint ) const SfxEventHint& rEventHint = static_cast<const SfxEventHint&>(rHint); // only ObjectShell-related events with media interest - SfxObjectShell* pDocSh = rEventHint.GetObjShell(); + rtl::Reference<SfxObjectShell> pDocSh = rEventHint.GetObjShell(); if( !pDocSh ) return; @@ -199,7 +199,7 @@ void SfxPickListImpl::Notify( SfxBroadcaster&, const SfxHint& rHint ) case SfxEventHintId::CloseDoc: { const bool bNoThumbnail = rEventHint.GetEventId() == SfxEventHintId::CloseDoc; - AddDocumentToPickList(pDocSh, bNoThumbnail); + AddDocumentToPickList(pDocSh.get(), bNoThumbnail); } break; @@ -216,7 +216,7 @@ void SfxPickListImpl::Notify( SfxBroadcaster&, const SfxHint& rHint ) OUString path = pMedium->GetOrigURL(); if (!path.isEmpty()) { - AddDocumentToPickList(pDocSh); + AddDocumentToPickList(pDocSh.get()); } } break; diff --git a/sfx2/source/appl/xpackcreator.cxx b/sfx2/source/appl/xpackcreator.cxx index 29ebcc615552..8108327cd39a 100644 --- a/sfx2/source/appl/xpackcreator.cxx +++ b/sfx2/source/appl/xpackcreator.cxx @@ -74,12 +74,12 @@ void SAL_CALL OPackageStructureCreator::convertToPackage( const OUString& aFolde StreamMode::READ, false, true ); - tools::SvRef<SotStorage> aStorage = new SotStorage( pUCBStorage ); + rtl::Reference<SotStorage> aStorage = new SotStorage(pUCBStorage); if ( !aTempURL.isEmpty() ) { SvFileStream aTempStream( aTempURL, StreamMode::STD_READWRITE ); - tools::SvRef<SotStorage> aTargetStorage = new SotStorage( true, aTempStream ); + rtl::Reference<SotStorage> aTargetStorage = new SotStorage(true, aTempStream); aStorage->CopyTo( aTargetStorage.get() ); aTargetStorage->Commit(); diff --git a/sfx2/source/doc/oleprops.cxx b/sfx2/source/doc/oleprops.cxx index 4cde3ed014ba..891110c43780 100644 --- a/sfx2/source/doc/oleprops.cxx +++ b/sfx2/source/doc/oleprops.cxx @@ -1091,7 +1091,7 @@ ErrCode const & SfxOlePropertySet::LoadPropertySet( SotStorage* pStrg, const OUS { if( pStrg ) { - tools::SvRef<SotStorageStream> xStrm = pStrg->OpenSotStream( rStrmName, StreamMode::STD_READ ); + rtl::Reference<SotStorageStream> xStrm = pStrg->OpenSotStream( rStrmName, StreamMode::STD_READ ); if( xStrm.is() && (xStrm->GetError() == ERRCODE_NONE) ) { xStrm->SetBufferSize( STREAM_BUFFER_SIZE ); @@ -1109,7 +1109,7 @@ ErrCode const & SfxOlePropertySet::SavePropertySet( SotStorage* pStrg, const OUS { if( pStrg ) { - tools::SvRef<SotStorageStream> xStrm = pStrg->OpenSotStream( rStrmName, StreamMode::TRUNC | StreamMode::STD_WRITE ); + rtl::Reference<SotStorageStream> xStrm = pStrg->OpenSotStream( rStrmName, StreamMode::TRUNC | StreamMode::STD_WRITE ); if( xStrm.is() ) Save( *xStrm ); else diff --git a/sfx2/source/inc/objshimp.hxx b/sfx2/source/inc/objshimp.hxx index 88b715a124c3..acd85eb0d1a9 100644 --- a/sfx2/source/inc/objshimp.hxx +++ b/sfx2/source/inc/objshimp.hxx @@ -23,6 +23,7 @@ #include <rtl/ustring.hxx> #include <rtl/ref.hxx> #include <tools/datetime.hxx> +#include <tools/ref.hxx> #include <sfx2/objsh.hxx> #include <sfx2/docmacromode.hxx> diff --git a/sot/qa/cppunit/test_sot.cxx b/sot/qa/cppunit/test_sot.cxx index fde0757fba42..76a4492001c1 100644 --- a/sot/qa/cppunit/test_sot.cxx +++ b/sot/qa/cppunit/test_sot.cxx @@ -32,10 +32,10 @@ namespace public: SotTest() {} - bool checkStream( const tools::SvRef<SotStorage> &xObjStor, + bool checkStream( const rtl::Reference<SotStorage> &xObjStor, const OUString &rStreamName, sal_uInt64 nSize ); - bool checkStorage( const tools::SvRef<SotStorage> &xObjStor ); + bool checkStorage(const rtl::Reference<SotStorage>& xObjStor); virtual bool load(const OUString &, const OUString &rURL, const OUString &, @@ -52,7 +52,7 @@ namespace CPPUNIT_TEST_SUITE_END(); }; - bool SotTest::checkStream( const tools::SvRef<SotStorage> &xObjStor, + bool SotTest::checkStream( const rtl::Reference<SotStorage> &xObjStor, const OUString &rStreamName, sal_uInt64 nSize ) { @@ -62,7 +62,7 @@ namespace return true; { // Read the data in one block - tools::SvRef<SotStorageStream> xStream( xObjStor->OpenSotStream( rStreamName ) ); + rtl::Reference<SotStorageStream> xStream(xObjStor->OpenSotStream(rStreamName)); xStream->Seek(0); sal_uInt64 nRemaining = xStream->GetSize() - xStream->Tell(); @@ -73,7 +73,7 @@ namespace nReadableSize = xStream->ReadBytes(static_cast<void *>(pData), nSize); } { // Read the data backwards as well - tools::SvRef<SotStorageStream> xStream( xObjStor->OpenSotStream( rStreamName ) ); + rtl::Reference<SotStorageStream> xStream(xObjStor->OpenSotStream(rStreamName)); for( sal_uInt64 i = nReadableSize; i > 0; i-- ) { CPPUNIT_ASSERT_MESSAGE( "sot reading error", !xStream->GetError() ); @@ -89,7 +89,7 @@ namespace return true; } - bool SotTest::checkStorage( const tools::SvRef<SotStorage> &xObjStor ) + bool SotTest::checkStorage(const rtl::Reference<SotStorage>& xObjStor) { SvStorageInfoList aInfoList; xObjStor->FillInfoList( &aInfoList ); @@ -98,7 +98,7 @@ namespace { if( rInfo.IsStorage() ) { - tools::SvRef<SotStorage> xChild( xObjStor->OpenSotStorage( rInfo.GetName() ) ); + rtl::Reference<SotStorage> xChild(xObjStor->OpenSotStorage(rInfo.GetName())); checkStorage( xChild ); } else if( rInfo.IsStream() ) @@ -113,7 +113,7 @@ namespace SfxFilterFlags, SotClipboardFormatId, unsigned int) { SvFileStream aStream(rURL, StreamMode::READ); - tools::SvRef<SotStorage> xObjStor = new SotStorage(aStream); + rtl::Reference<SotStorage> xObjStor = new SotStorage(aStream); if (!xObjStor.is() || xObjStor->GetError()) return false; @@ -132,12 +132,12 @@ namespace OUString aURL( m_directories.getURLFromSrc(u"/sot/qa/cppunit/data/pass/fdo84229-1.compound")); SvFileStream aStream(aURL, StreamMode::READ); - tools::SvRef<SotStorage> xObjStor = new SotStorage(aStream); + rtl::Reference<SotStorage> xObjStor = new SotStorage(aStream); CPPUNIT_ASSERT_MESSAGE("sot storage failed to open", xObjStor.is()); CPPUNIT_ASSERT_MESSAGE("sot storage failed to open", !xObjStor->GetError()); - tools::SvRef<SotStorageStream> xStream = xObjStor->OpenSotStream("Book"); + rtl::Reference<SotStorageStream> xStream = xObjStor->OpenSotStream("Book"); CPPUNIT_ASSERT_MESSAGE("stream failed to open", xStream.is()); CPPUNIT_ASSERT_MESSAGE("stream failed to open", diff --git a/sot/source/base/object.cxx b/sot/source/base/object.cxx index 98dd8ea064d6..403467bd781a 100644 --- a/sot/source/base/object.cxx +++ b/sot/source/base/object.cxx @@ -38,13 +38,13 @@ void SotObject::OwnerLock(bool bLock) if (bLock) { nOwnerLockCount++; - AddFirstRef(); + acquire(); } else if (nOwnerLockCount) { if (0 == --nOwnerLockCount) DoClose(); - ReleaseRef(); + release(); } } @@ -53,7 +53,7 @@ bool SotObject::DoClose() bool bRet = false; if (!bInClose) { - tools::SvRef<SotObject> xHoldAlive(this); + rtl::Reference<SotObject> xHoldAlive(this); bInClose = true; bRet = Close(); bInClose = false; diff --git a/sot/source/sdstor/storage.cxx b/sot/source/sdstor/storage.cxx index eff6a4fdf650..766c339f497d 100644 --- a/sot/source/sdstor/storage.cxx +++ b/sot/source/sdstor/storage.cxx @@ -402,7 +402,7 @@ SotStorage::~SotStorage() std::unique_ptr<SvMemoryStream> SotStorage::CreateMemoryStream() { std::unique_ptr<SvMemoryStream> pStm(new SvMemoryStream( 0x8000, 0x8000 )); - tools::SvRef<SotStorage> aStg = new SotStorage( *pStm ); + rtl::Reference<SotStorage> aStg = new SotStorage(*pStm); if( CopyTo( aStg.get() ) ) { aStg->Commit(); @@ -529,10 +529,10 @@ bool SotStorage::Commit() return ERRCODE_NONE == GetError(); } -tools::SvRef<SotStorageStream> SotStorage::OpenSotStream( const OUString & rEleName, +rtl::Reference<SotStorageStream> SotStorage::OpenSotStream(const OUString& rEleName, StreamMode nMode ) { - tools::SvRef<SotStorageStream> pStm; + rtl::Reference<SotStorageStream> pStm; if( m_pOwnStg ) { // enable full Ole patches, @@ -540,7 +540,7 @@ tools::SvRef<SotStorageStream> SotStorage::OpenSotStream( const OUString & rEleN nMode |= StreamMode::SHARE_DENYALL; ErrCode nE = m_pOwnStg->GetError(); BaseStorageStream * p = m_pOwnStg->OpenStream( rEleName, nMode ); - pStm = new SotStorageStream( p ); + pStm = new SotStorageStream(p); if( !nE ) m_pOwnStg->ResetError(); // don't set error @@ -553,7 +553,7 @@ tools::SvRef<SotStorageStream> SotStorage::OpenSotStream( const OUString & rEleN return pStm; } -SotStorage * SotStorage::OpenSotStorage( const OUString & rEleName, +rtl::Reference<SotStorage> SotStorage::OpenSotStorage( const OUString & rEleName, StreamMode nMode, bool transacted ) { @@ -564,7 +564,7 @@ SotStorage * SotStorage::OpenSotStorage( const OUString & rEleName, BaseStorage * p = m_pOwnStg->OpenStorage(rEleName, nMode, !transacted); if( p ) { - SotStorage * pStor = new SotStorage( p ); + rtl::Reference<SotStorage> pStor = new SotStorage( p ); if( !nE ) m_pOwnStg->ResetError(); // don't set error @@ -657,7 +657,7 @@ bool SotStorage::IsOLEStorage( SvStream* pStream ) return Storage::IsStorageFile( pStream ); } -SotStorage* SotStorage::OpenOLEStorage( const css::uno::Reference < css::embed::XStorage >& xStorage, +rtl::Reference<SotStorage> SotStorage::OpenOLEStorage( const css::uno::Reference < css::embed::XStorage >& xStorage, const OUString& rEleName, StreamMode nMode ) { sal_Int32 nEleMode = embed::ElementModes::SEEKABLEREAD; @@ -757,7 +757,7 @@ sal_Int32 SotStorage::GetVersion( const css::uno::Reference < css::embed::XStora namespace { - void traverse(const tools::SvRef<SotStorage>& rStorage, std::vector<unsigned char>& rBuf) + void traverse(const rtl::Reference<SotStorage>& rStorage, std::vector<unsigned char>& rBuf) { SvStorageInfoList infos; @@ -768,14 +768,14 @@ namespace if (info.IsStream()) { // try to open and read all content - tools::SvRef<SotStorageStream> xStream(rStorage->OpenSotStream(info.GetName(), StreamMode::STD_READ)); + rtl::Reference<SotStorageStream> xStream(rStorage->OpenSotStream(info.GetName(), StreamMode::STD_READ)); const size_t nSize = xStream->GetSize(); const size_t nRead = xStream->ReadBytes(rBuf.data(), nSize); SAL_INFO("sot", "Read " << nRead << "bytes"); } else if (info.IsStorage()) { - tools::SvRef<SotStorage> xStorage(rStorage->OpenSotStorage(info.GetName(), StreamMode::STD_READ)); + rtl::Reference<SotStorage> xStorage(rStorage->OpenSotStorage(info.GetName(), StreamMode::STD_READ)); // continue with children traverse(xStorage, rBuf); @@ -789,7 +789,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportOLE2(SvStream &rStream) try { size_t nSize = rStream.remainingSize(); - tools::SvRef<SotStorage> xRootStorage(new SotStorage(&rStream, false)); + rtl::Reference<SotStorage> xRootStorage(new SotStorage(&rStream, false)); std::vector<unsigned char> aTmpBuf(nSize); traverse(xRootStorage, aTmpBuf); } diff --git a/starmath/qa/cppunit/test_cursor.cxx b/starmath/qa/cppunit/test_cursor.cxx index 12e63626eee3..002a445745c9 100644 --- a/starmath/qa/cppunit/test_cursor.cxx +++ b/starmath/qa/cppunit/test_cursor.cxx @@ -21,7 +21,7 @@ #include <memory> -typedef tools::SvRef<SmDocShell> SmDocShellRef; +typedef rtl::Reference<SmDocShell> SmDocShellRef; using namespace ::com::sun::star; diff --git a/starmath/qa/cppunit/test_node.cxx b/starmath/qa/cppunit/test_node.cxx index acb1c27d4c79..7b42056fb35e 100644 --- a/starmath/qa/cppunit/test_node.cxx +++ b/starmath/qa/cppunit/test_node.cxx @@ -26,7 +26,7 @@ namespace { using namespace ::com::sun::star; -typedef tools::SvRef<SmDocShell> SmDocShellRef; +typedef rtl::Reference<SmDocShell> SmDocShellRef; class NodeTest : public test::BootstrapFixture { diff --git a/starmath/qa/cppunit/test_nodetotextvisitors.cxx b/starmath/qa/cppunit/test_nodetotextvisitors.cxx index 1b8c0292ba31..d4981445d8bb 100644 --- a/starmath/qa/cppunit/test_nodetotextvisitors.cxx +++ b/starmath/qa/cppunit/test_nodetotextvisitors.cxx @@ -23,7 +23,7 @@ #include "mock-visitor.hxx" #include <memory> -typedef tools::SvRef<SmDocShell> SmDocShellRef; +typedef rtl::Reference<SmDocShell> SmDocShellRef; using namespace ::com::sun::star; diff --git a/starmath/qa/cppunit/test_parse.cxx b/starmath/qa/cppunit/test_parse.cxx index 2171cde80e56..cb158a15491d 100644 --- a/starmath/qa/cppunit/test_parse.cxx +++ b/starmath/qa/cppunit/test_parse.cxx @@ -23,7 +23,7 @@ namespace { using namespace ::com::sun::star; -typedef tools::SvRef<SmDocShell> SmDocShellRef; +typedef rtl::Reference<SmDocShell> SmDocShellRef; class ParseTest : public test::BootstrapFixture { diff --git a/starmath/qa/cppunit/test_starmath.cxx b/starmath/qa/cppunit/test_starmath.cxx index 60eb85944571..79b1bd461181 100644 --- a/starmath/qa/cppunit/test_starmath.cxx +++ b/starmath/qa/cppunit/test_starmath.cxx @@ -31,7 +31,7 @@ #include <starmath.hrc> #include <memory> -typedef tools::SvRef<SmDocShell> SmDocShellRef; +typedef rtl::Reference<SmDocShell> SmDocShellRef; using namespace ::com::sun::star; diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 6da2c96e4265..0f15e6049015 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -638,7 +638,7 @@ bool SmDocShell::ConvertFrom(SfxMedium &rMedium) { if ( SotStorage::IsStorageFile( pStream ) ) { - tools::SvRef<SotStorage> aStorage = new SotStorage( pStream, false ); + rtl::Reference<SotStorage> aStorage = new SotStorage(pStream, false); if ( aStorage->IsStream("Equation Native") ) { // is this a MathType Storage? diff --git a/starmath/source/eqnolefilehdr.cxx b/starmath/source/eqnolefilehdr.cxx index f211f1aaa942..d178e3d072c0 100644 --- a/starmath/source/eqnolefilehdr.cxx +++ b/starmath/source/eqnolefilehdr.cxx @@ -29,7 +29,7 @@ bool GetMathTypeVersion( SotStorage* pStor, sal_uInt8 &nVersion ) // code snippet copied from MathType::Parse - tools::SvRef<SotStorageStream> xSrc = pStor->OpenSotStream( + rtl::Reference<SotStorageStream> xSrc = pStor->OpenSotStream( "Equation Native", StreamMode::STD_READ); if ( (!xSrc.is()) || (ERRCODE_NONE != xSrc->GetError())) diff --git a/starmath/source/mathtype.cxx b/starmath/source/mathtype.cxx index aca49f034ad0..8ebef375cb8c 100644 --- a/starmath/source/mathtype.cxx +++ b/starmath/source/mathtype.cxx @@ -549,7 +549,7 @@ void MathType::TypeFaceToString(OUString &rTxt,sal_uInt8 nFace) bool MathType::Parse(SotStorage *pStor) { - tools::SvRef<SotStorageStream> xSrc = pStor->OpenSotStream( + rtl::Reference<SotStorageStream> xSrc = pStor->OpenSotStream( "Equation Native", StreamMode::STD_READ); if ( (!xSrc.is()) || (ERRCODE_NONE != xSrc->GetError())) @@ -1869,7 +1869,7 @@ bool MathType::ConvertFromStarMath( SfxMedium& rMedium ) SvStream *pStream = rMedium.GetOutStream(); if ( pStream ) { - tools::SvRef<SotStorage> pStor = new SotStorage( pStream, false ); + rtl::Reference<SotStorage> pStor = new SotStorage(pStream, false); SvGlobalName aGName(MSO_EQUATION3_CLASSID); pStor->SetClass( aGName, SotClipboardFormatId::NONE, "Microsoft Equation 3.0"); @@ -1889,7 +1889,7 @@ bool MathType::ConvertFromStarMath( SfxMedium& rMedium ) 0xB2, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - tools::SvRef<SotStorageStream> xStor( pStor->OpenSotStream("\1CompObj")); + rtl::Reference<SotStorageStream> xStor(pStor->OpenSotStream("\1CompObj")); xStor->WriteBytes(aCompObj, sizeof(aCompObj)); static sal_uInt8 const aOle[] = { @@ -1897,12 +1897,12 @@ bool MathType::ConvertFromStarMath( SfxMedium& rMedium ) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; - tools::SvRef<SotStorageStream> xStor2( pStor->OpenSotStream("\1Ole")); + rtl::Reference<SotStorageStream> xStor2(pStor->OpenSotStream("\1Ole")); xStor2->WriteBytes(aOle, sizeof(aOle)); xStor.clear(); xStor2.clear(); - tools::SvRef<SotStorageStream> xSrc = pStor->OpenSotStream("Equation Native"); + rtl::Reference<SotStorageStream> xSrc = pStor->OpenSotStream("Equation Native"); if ( (!xSrc.is()) || (ERRCODE_NONE != xSrc->GetError())) return false; diff --git a/starmath/source/smdetect.cxx b/starmath/source/smdetect.cxx index 80231c21b7fe..825186bb08d4 100644 --- a/starmath/source/smdetect.cxx +++ b/starmath/source/smdetect.cxx @@ -71,7 +71,7 @@ OUString SAL_CALL SmFilterDetect::detect( Sequence< PropertyValue >& lDescriptor bool bStorageOk = false; try { - tools::SvRef<SotStorage> aStorage = new SotStorage( pInStrm, false ); + rtl::Reference<SotStorage> aStorage = new SotStorage(pInStrm, false); bStorageOk = !aStorage->GetError(); if (bStorageOk) { diff --git a/starmath/source/unodoc.cxx b/starmath/source/unodoc.cxx index 3c125077c402..5eaab9cdc412 100644 --- a/starmath/source/unodoc.cxx +++ b/starmath/source/unodoc.cxx @@ -35,7 +35,7 @@ Math_FormulaDocument_get_implementation( css::uno::Reference<css::uno::XInterface> xInterface = sfx2::createSfxModelInstance(args, [](SfxModelFlags _nCreationFlags) { - SfxObjectShell* pShell = new SmDocShell( _nCreationFlags ); + rtl::Reference<SfxObjectShell> pShell = new SmDocShell(_nCreationFlags); return pShell->GetModel(); }); xInterface->acquire(); diff --git a/starmath/source/unofilter.cxx b/starmath/source/unofilter.cxx index 0b73175b003b..568e4e6e683d 100644 --- a/starmath/source/unofilter.cxx +++ b/starmath/source/unofilter.cxx @@ -60,7 +60,7 @@ sal_Bool MathTypeFilter::filter(const uno::Sequence<beans::PropertyValue>& rDesc { if (SotStorage::IsStorageFile(pStream.get())) { - tools::SvRef<SotStorage> aStorage(new SotStorage(pStream.get(), false)); + rtl::Reference<SotStorage> aStorage(new SotStorage(pStream.get(), false)); // Is this a MathType Storage? if (aStorage->IsStream("Equation Native")) { diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx index 85376581ee51..1e868c43e7ce 100644 --- a/svtools/source/misc/imagemgr.cxx +++ b/svtools/source/misc/imagemgr.cxx @@ -403,7 +403,7 @@ static SvImageId GetImageId_Impl( SvImageId nId = SvImageId::WriterTemplate; try { - tools::SvRef<SotStorage> aStorage = new SotStorage( sURL, StreamMode::STD_READ ); + rtl::Reference<SotStorage> aStorage = new SotStorage(sURL, StreamMode::STD_READ); if ( !aStorage->GetError() ) { SvGlobalName aGlobalName = aStorage->GetClassName(); diff --git a/svx/inc/galleryfilestorage.hxx b/svx/inc/galleryfilestorage.hxx index 886bcd7d53d5..f913b0574fc1 100644 --- a/svx/inc/galleryfilestorage.hxx +++ b/svx/inc/galleryfilestorage.hxx @@ -44,7 +44,7 @@ class GalleryThemeEntry; class GalleryFileStorage final { private: - tools::SvRef<SotStorage> m_aSvDrawStorageRef; + rtl::Reference<SotStorage> m_aSvDrawStorageRef; const GalleryStorageLocations& maGalleryStorageLocations; GalleryObjectCollection& mrGalleryObjectCollection; bool mbReadOnly; @@ -65,7 +65,7 @@ public: void setDestDir(const OUString& rDestDir, bool bRelative); void ImplCreateSvDrawStorage(); - const tools::SvRef<SotStorage>& GetSvDrawStorage() const; + const rtl::Reference<SotStorage>& GetSvDrawStorage() const; const INetURLObject& getThemeURL() const { return maGalleryStorageLocations.getThemeURL(); } diff --git a/svx/source/gallery2/galleryfilestorage.cxx b/svx/source/gallery2/galleryfilestorage.cxx index 16f2a1c27773..bef365a0060c 100644 --- a/svx/source/gallery2/galleryfilestorage.cxx +++ b/svx/source/gallery2/galleryfilestorage.cxx @@ -91,7 +91,7 @@ void GalleryFileStorage::ImplCreateSvDrawStorage() } } -const tools::SvRef<SotStorage>& GalleryFileStorage::GetSvDrawStorage() const +const rtl::Reference<SotStorage>& GalleryFileStorage::GetSvDrawStorage() const { return m_aSvDrawStorageRef; } @@ -265,14 +265,14 @@ bool GalleryFileStorage::implWriteSgaObject(const SgaObject& rObj, sal_uInt32 nP bool GalleryFileStorage::readModel(const GalleryObject* pObject, SdrModel& rModel) { - tools::SvRef<SotStorage> xSotStorage(GetSvDrawStorage()); + rtl::Reference<SotStorage> xSotStorage(GetSvDrawStorage()); bool bRet = false; const INetURLObject aURL(ImplGetURL(pObject)); if (xSotStorage.is()) { const OUString aStreamName(GetSvDrawStreamNameFromURL(aURL)); - tools::SvRef<SotStorageStream> xInputStream( + rtl::Reference<SotStorageStream> xInputStream( xSotStorage->OpenSotStream(aStreamName, StreamMode::READ)); if (xInputStream.is() && !xInputStream->GetError()) @@ -289,13 +289,13 @@ SgaObjectSvDraw GalleryFileStorage::insertModel(const FmFormModel& rModel, const INetURLObject& rUserURL) { INetURLObject aURL(implCreateUniqueURL(SgaObjKind::SvDraw, rUserURL)); - tools::SvRef<SotStorage> xSotStorage(GetSvDrawStorage()); + rtl::Reference<SotStorage> xSotStorage(GetSvDrawStorage()); bool bRet = false; if (xSotStorage.is()) { const OUString aStreamName(GetSvDrawStreamNameFromURL(aURL)); - tools::SvRef<SotStorageStream> xOutputStream( + rtl::Reference<SotStorageStream> xOutputStream( xSotStorage->OpenSotStream(aStreamName, StreamMode::WRITE | StreamMode::TRUNC)); if (xOutputStream.is() && !xOutputStream->GetError()) @@ -336,13 +336,13 @@ bool GalleryFileStorage::readModelStream(const GalleryObject* pObject, tools::SvRef<SotTempStream> const& rxModelStream) { const INetURLObject aURL(ImplGetURL(pObject)); - tools::SvRef<SotStorage> xSotStorage(GetSvDrawStorage()); + rtl::Reference<SotStorage> xSotStorage(GetSvDrawStorage()); bool bRet = false; if (xSotStorage.is()) { const OUString aStreamName(GetSvDrawStreamNameFromURL(aURL)); - tools::SvRef<SotStorageStream> xInputStream( + rtl::Reference<SotStorageStream> xInputStream( xSotStorage->OpenSotStream(aStreamName, StreamMode::READ)); if (xInputStream.is() && !xInputStream->GetError()) @@ -384,12 +384,12 @@ GalleryFileStorage::insertModelStream(const tools::SvRef<SotTempStream>& rxModel const INetURLObject& rUserURL) { INetURLObject aURL(implCreateUniqueURL(SgaObjKind::SvDraw, rUserURL)); - tools::SvRef<SotStorage> xSotStorage(GetSvDrawStorage()); + rtl::Reference<SotStorage> xSotStorage(GetSvDrawStorage()); if (xSotStorage.is()) { const OUString aStreamName(GetSvDrawStreamNameFromURL(aURL)); - tools::SvRef<SotStorageStream> xOutputStream( + rtl::Reference<SotStorageStream> xOutputStream( xSotStorage->OpenSotStream(aStreamName, StreamMode::WRITE | StreamMode::TRUNC)); if (xOutputStream.is() && !xOutputStream->GetError()) @@ -533,7 +533,7 @@ SgaObjectSvDraw GalleryFileStorage::updateSvDrawObject(const GalleryObject* pEnt if (GetSvDrawStorage().is()) { const OUString aStmName(GetSvDrawStreamNameFromURL(*pEntry->m_oStorageUrl)); - tools::SvRef<SotStorageStream> pIStm + rtl::Reference<SotStorageStream> pIStm = GetSvDrawStorage()->OpenSotStream(aStmName, StreamMode::READ); if (pIStm.is() && !pIStm->GetError()) @@ -618,7 +618,7 @@ void GalleryFileStorage::updateTheme() try { - tools::SvRef<SotStorage> aTempStorageRef( + rtl::Reference<SotStorage> aTempStorageRef( new SotStorage(false, aTmpURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::STD_READWRITE)); GetSvDrawStorage()->CopyTo(aTempStorageRef.get()); diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index d9dde916b798..e359cb0ba293 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -1657,7 +1657,7 @@ public: SW_DLLPUBLIC ::sw::UndoManager & GetUndoManager(); ::sw::UndoManager const& GetUndoManager() const; - SfxObjectShell* CreateCopy(bool bCallInitNew, bool bEmpty) const; + rtl::Reference<SfxObjectShell> CreateCopy(bool bCallInitNew, bool bEmpty) const; SwNodeIndex AppendDoc(const SwDoc& rSource, sal_uInt16 nStartPageNumber, bool bDeletePrevious, int physicalPageOffset, const sal_uLong nDocNo); diff --git a/sw/inc/shellio.hxx b/sw/inc/shellio.hxx index c9fc67ea378e..d802cc80d446 100644 --- a/sw/inc/shellio.hxx +++ b/sw/inc/shellio.hxx @@ -146,7 +146,7 @@ public: class SW_DLLPUBLIC SwReader: public SwDocFac { SvStream* mpStrm; - tools::SvRef<SotStorage> mpStg; + rtl::Reference<SotStorage> mpStg; css::uno::Reference < css::embed::XStorage > mxStg; SfxMedium* mpMedium; // Who wants to obtain a Medium (W4W). @@ -213,7 +213,7 @@ class SW_DLLPUBLIC Reader protected: SvStream* m_pStream; - tools::SvRef<SotStorage> m_pStorage; + rtl::Reference<SotStorage> m_pStorage; css::uno::Reference < css::embed::XStorage > m_xStorage; SfxMedium* m_pMedium; // Who wants to obtain a Medium (W4W). @@ -271,8 +271,8 @@ public: virtual size_t GetSectionList( SfxMedium& rMedium, std::vector<OUString>& rStrings) const; - const tools::SvRef<SotStorage>& getSotStorageRef() const { return m_pStorage; }; - void setSotStorageRef(const tools::SvRef<SotStorage>& pStgRef) { m_pStorage = pStgRef; }; + const rtl::Reference<SotStorage>& getSotStorageRef() const { return m_pStorage; }; + void setSotStorageRef(const rtl::Reference<SotStorage>& pStgRef) { m_pStorage = pStgRef; }; private: virtual ErrCodeMsg Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &)=0; @@ -475,7 +475,7 @@ typedef tools::SvRef<Writer> WriterRef; class SW_DLLPUBLIC StgWriter : public Writer { protected: - tools::SvRef<SotStorage> m_pStg; + rtl::Reference<SotStorage> m_pStg; css::uno::Reference < css::embed::XStorage > m_xStg; // Create error at call. diff --git a/sw/qa/core/filters-test.cxx b/sw/qa/core/filters-test.cxx index ffc24cbda4b8..13595d42adbc 100644 --- a/sw/qa/core/filters-test.cxx +++ b/sw/qa/core/filters-test.cxx @@ -24,7 +24,7 @@ #include <iodetect.hxx> #include <docsh.hxx> -typedef tools::SvRef<SwDocShell> SwDocShellRef; +typedef rtl::Reference<SwDocShell> SwDocShellRef; using namespace ::com::sun::star; diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx index 19e2c81a0690..410cc07f7d5d 100644 --- a/sw/qa/core/macros-test.cxx +++ b/sw/qa/core/macros-test.cxx @@ -51,7 +51,7 @@ #include <docsh.hxx> #include <unotxdoc.hxx> -typedef tools::SvRef<SwDocShell> SwDocShellRef; +typedef rtl::Reference<SwDocShell> SwDocShellRef; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index 58308fce6c92..8171b318818f 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -77,7 +77,7 @@ #include <IDocumentMarkAccess.hxx> #include <itabenum.hxx> -typedef tools::SvRef<SwDocShell> SwDocShellRef; +typedef rtl::Reference<SwDocShell> SwDocShellRef; using namespace ::com::sun::star; diff --git a/sw/qa/extras/htmlexport/htmlexport.cxx b/sw/qa/extras/htmlexport/htmlexport.cxx index 45eb06130d3e..9ac7b8f35e12 100644 --- a/sw/qa/extras/htmlexport/htmlexport.cxx +++ b/sw/qa/extras/htmlexport/htmlexport.cxx @@ -1265,8 +1265,8 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOle1PDF) uno::Reference<io::XInputStream> xInputStream(xNameAccess->getByName("Object 2"), uno::UNO_QUERY); std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true)); - tools::SvRef<SotStorage> pStorage = new SotStorage(*pStream); - tools::SvRef<SotStorageStream> pOleNative = pStorage->OpenSotStream("\1Ole10Native"); + rtl::Reference<SotStorage> pStorage = new SotStorage(*pStream); + rtl::Reference<SotStorageStream> pOleNative = pStorage->OpenSotStream("\1Ole10Native"); // Without the accompanying fix in place, this test would have failed with: // - Expected: 39409 // - Actual : 0 @@ -1288,7 +1288,7 @@ CPPUNIT_TEST_FIXTURE(SwHtmlDomExportTest, testReqifOle1Paint) uno::Reference<io::XInputStream> xInputStream(xNameAccess->getByName("Object 2"), uno::UNO_QUERY); std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true)); - tools::SvRef<SotStorage> pStorage = new SotStorage(*pStream); + rtl::Reference<SotStorage> pStorage = new SotStorage(*pStream); // Check the clsid of the root stream of the OLE2 storage. SvGlobalName aActual = pStorage->GetClassName(); SvGlobalName aExpected(0x0003000A, 0, 0, 0xc0, 0, 0, 0, 0, 0, 0, 0x46); diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index fc722b391de1..cae96a360491 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -904,7 +904,7 @@ void SwDoc::ReplaceCompatibilityOptions(const SwDoc& rSource) ((idx).GetNode().GetIndex() - GetNodes().GetEndOfExtras().GetIndex() - 1) #endif -SfxObjectShell* SwDoc::CreateCopy( bool bCallInitNew, bool bEmpty ) const +rtl::Reference<SfxObjectShell> SwDoc::CreateCopy(bool bCallInitNew, bool bEmpty) const { SAL_INFO( "sw.pageframe", "(SwDoc::CreateCopy in" ); rtl::Reference<SwDoc> xRet( new SwDoc ); @@ -912,7 +912,7 @@ SfxObjectShell* SwDoc::CreateCopy( bool bCallInitNew, bool bEmpty ) const // we have to use pointer here, since the callee has to decide whether // SfxObjectShellLock or SfxObjectShellRef should be used sometimes the // object will be returned with refcount set to 0 ( if no DoInitNew is done ) - SfxObjectShell* pRetShell = new SwDocShell( *xRet, SfxObjectCreateMode::STANDARD ); + rtl::Reference<SfxObjectShell> pRetShell = new SwDocShell(*xRet, SfxObjectCreateMode::STANDARD); if( bCallInitNew ) { // it could happen that DoInitNew creates model, diff --git a/sw/source/core/inc/SwXMLTextBlocks.hxx b/sw/source/core/inc/SwXMLTextBlocks.hxx index 05a97ded5942..563f79f6a811 100644 --- a/sw/source/core/inc/SwXMLTextBlocks.hxx +++ b/sw/source/core/inc/SwXMLTextBlocks.hxx @@ -26,8 +26,10 @@ #include <sfx2/objsh.hxx> #include "swblocks.hxx" #include <o3tl/typed_flags_set.hxx> +#include <tools/ref.hxx> class SwDoc; +class SwDocShell; class SvxMacroTableDtor; enum class SwXmlFlags { @@ -40,7 +42,7 @@ namespace o3tl { class SwXMLTextBlocks final : public SwImpBlocks { - SfxObjectShellRef m_xDocShellRef; + rtl::Reference<SwDocShell> m_xDocShellRef; SwXmlFlags m_nFlags; OUString m_aPackageName; tools::SvRef<SfxMedium> m_xMedium; diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx index 00a727c72a6d..0bb1669dd5ef 100644 --- a/sw/source/core/ole/ndole.cxx +++ b/sw/source/core/ole/ndole.cxx @@ -301,7 +301,7 @@ bool SwOLENode::RestorePersistentData() if ( maOLEObj.m_xOLERef.is() ) { // If a SvPersist instance already exists, we use it - SfxObjectShell* p = GetDoc().GetPersist(); + rtl::Reference<SfxObjectShell> p = GetDoc().GetPersist(); if( !p ) { // TODO/LATER: Isn't an EmbeddedObjectContainer sufficient here? @@ -472,13 +472,13 @@ Size SwOLENode::GetTwipSize() const SwContentNode* SwOLENode::MakeCopy( SwDoc& rDoc, SwNode& rIdx, bool) const { // If there's already a SvPersist instance, we use it - SfxObjectShell* pPersistShell = rDoc.GetPersist(); + rtl::Reference<SfxObjectShell> pPersistShell = rDoc.GetPersist(); if( !pPersistShell ) { // TODO/LATER: is EmbeddedObjectContainer not enough? // the created document will be closed by rDoc ( should use SfxObjectShellLock ) pPersistShell = new SwDocShell( rDoc, SfxObjectCreateMode::INTERNAL ); - rDoc.SetTmpDocShell( pPersistShell ); + rDoc.SetTmpDocShell(pPersistShell.get()); pPersistShell->DoInitNew(); } @@ -940,7 +940,7 @@ void SwOLEObj::SetNode( SwOLENode* pNode ) SwDoc& rDoc = pNode->GetDoc(); // If there's already a SvPersist instance, we use it - SfxObjectShell* p = rDoc.GetPersist(); + rtl::Reference<SfxObjectShell> p = rDoc.GetPersist(); if( !p ) { // TODO/LATER: Isn't an EmbeddedObjectContainer sufficient here? diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx index f69311dfdb5f..6baafb758630 100644 --- a/sw/source/core/swg/SwXMLTextBlocks.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks.cxx @@ -64,12 +64,11 @@ SwXMLTextBlocks::SwXMLTextBlocks( const OUString& rFile ) : SwImpBlocks(rFile) , m_nFlags(SwXmlFlags::NONE) { - SwDocShell* pDocSh = new SwDocShell ( SfxObjectCreateMode::INTERNAL ); - if( !pDocSh->DoInitNew() ) + m_xDocShellRef = new SwDocShell(SfxObjectCreateMode::INTERNAL); + if (!m_xDocShellRef->DoInitNew()) return; m_bReadOnly = true; - m_xDoc = pDocSh->GetDoc(); - m_xDocShellRef = pDocSh; + m_xDoc = m_xDocShellRef->GetDoc(); m_xDoc->SetOle2Link( Link<bool,void>() ); m_xDoc->GetIDocumentUndoRedo().DoUndo(false); uno::Reference< embed::XStorage > refStg; @@ -106,12 +105,11 @@ SwXMLTextBlocks::SwXMLTextBlocks( const uno::Reference < embed::XStorage >& rStg : SwImpBlocks( rName ) , m_nFlags(SwXmlFlags::NONE) { - SwDocShell* pDocSh = new SwDocShell ( SfxObjectCreateMode::INTERNAL ); - if( !pDocSh->DoInitNew() ) + m_xDocShellRef = new SwDocShell(SfxObjectCreateMode::INTERNAL); + if (!m_xDocShellRef->DoInitNew()) return; m_bReadOnly = false; - m_xDoc = pDocSh->GetDoc(); - m_xDocShellRef = pDocSh; + m_xDoc = m_xDocShellRef->GetDoc(); m_xDoc->SetOle2Link( Link<bool,void>() ); m_xDoc->GetIDocumentUndoRedo().DoUndo(false); diff --git a/sw/source/filter/basflt/iodetect.cxx b/sw/source/filter/basflt/iodetect.cxx index 86395100501d..9afff4d8b23b 100644 --- a/sw/source/filter/basflt/iodetect.cxx +++ b/sw/source/filter/basflt/iodetect.cxx @@ -130,7 +130,7 @@ bool SwIoSystem::IsValidStgFilter(SotStorage& rStg, const SfxFilter& rFilter) == (rFilter.GetUserData() == FILTER_WW8); if (bRet && !rFilter.IsAllowedAsTemplate()) { - tools::SvRef<SotStorageStream> xRef = + rtl::Reference<SotStorageStream> xRef = rStg.OpenSotStream("WordDocument", StreamMode::STD_READ ); xRef->Seek(10); @@ -161,7 +161,7 @@ std::shared_ptr<const SfxFilter> SwIoSystem::GetFileFilter(const OUString& rFile if (SotStorage::IsStorageFile(rFileName)) { // package storage or OLEStorage based format - tools::SvRef<SotStorage> xStg; + rtl::Reference<SotStorage> xStg; INetURLObject aObj; aObj.SetSmartProtocol( INetProtocol::File ); aObj.SetSmartURL( rFileName ); diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx index 2870be965950..9c306617d501 100644 --- a/sw/source/filter/basflt/shellio.cxx +++ b/sw/source/filter/basflt/shellio.cxx @@ -495,8 +495,8 @@ SwDoc* Reader::GetTemplateDoc(SwDoc& rDoc) SvtModuleOptions aModuleOptions; if (aModuleOptions.IsWriter()) { - SwDocShell *pDocSh = new SwDocShell(SfxObjectCreateMode::INTERNAL); - SfxObjectShellLock xDocSh = pDocSh; + rtl::Reference<SwDocShell> pDocSh = new SwDocShell(SfxObjectCreateMode::INTERNAL); + SfxObjectShellLock xDocSh = pDocSh.get(); if (pDocSh->DoInitNew()) { mxTemplate = pDocSh->GetDoc(); diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx index 8b2ff71cd3f9..d70634e2dddf 100644 --- a/sw/source/filter/html/htmlplug.cxx +++ b/sw/source/filter/html/htmlplug.cxx @@ -1707,7 +1707,7 @@ SwHTMLWriter& OutHTML_FrameFormatOLENodeGrf( SwHTMLWriter& rWrt, const SwFrameFo // export it. pOLENd->GetTwipSize(); SvMemoryStream aMemory; - tools::SvRef<SotStorage> pStorage = new SotStorage(aMemory); + rtl::Reference<SotStorage> pStorage = new SotStorage(aMemory); aOLEExp.ExportOLEObject(rOLEObj.GetObject(), *pStorage); pStorage->Commit(); aMemory.Seek(0); diff --git a/sw/source/filter/html/htmlreqifreader.cxx b/sw/source/filter/html/htmlreqifreader.cxx index 8df0d5b4834b..d784312b6fd2 100644 --- a/sw/source/filter/html/htmlreqifreader.cxx +++ b/sw/source/filter/html/htmlreqifreader.cxx @@ -72,11 +72,11 @@ bool ReqIfRtfReader::WriteObjectData(SvStream& rOLE) } /// Looks up what OLE1 calls the ClassName, see [MS-OLEDS] 2.3.8 CompObjStream. -OString ExtractOLEClassName(const tools::SvRef<SotStorage>& xStorage) +OString ExtractOLEClassName(const rtl::Reference<SotStorage>& xStorage) { OString aRet; - tools::SvRef<SotStorageStream> pCompObj = xStorage->OpenSotStream("\1CompObj"); + rtl::Reference<SotStorageStream> pCompObj = xStorage->OpenSotStream("\1CompObj"); if (!pCompObj) return aRet; @@ -106,8 +106,8 @@ bool ParseOLE2Presentation(SvStream& rOle2, sal_uInt32& nWidth, sal_uInt32& nHei { // See [MS-OLEDS] 2.3.4, OLEPresentationStream rOle2.Seek(0); - tools::SvRef<SotStorage> pStorage = new SotStorage(rOle2); - tools::SvRef<SotStorageStream> xOle2Presentation + rtl::Reference<SotStorage> pStorage = new SotStorage(rOle2); + rtl::Reference<SotStorageStream> xOle2Presentation = pStorage->OpenSotStream("\002OlePres000", StreamMode::STD_READ); // Read AnsiClipboardFormat. @@ -164,10 +164,10 @@ bool ParseOLE2Presentation(SvStream& rOle2, sal_uInt32& nWidth, sal_uInt32& nHei * Inserts an OLE1 header before an OLE2 storage, assuming that the storage has an Ole10Native * stream. */ -OString InsertOLE1HeaderFromOle10NativeStream(const tools::SvRef<SotStorage>& xStorage, +OString InsertOLE1HeaderFromOle10NativeStream(const rtl::Reference<SotStorage>& xStorage, SwOLENode& rOLENode, SvStream& rOle1) { - tools::SvRef<SotStorageStream> xOle1Stream + rtl::Reference<SotStorageStream> xOle1Stream = xStorage->OpenSotStream("\1Ole10Native", StreamMode::STD_READ); sal_uInt32 nOle1Size = 0; xOle1Stream->ReadUInt32(nOle1Size); @@ -271,7 +271,7 @@ OString InsertOLE1Header(SvStream& rOle2, SvStream& rOle1, sal_uInt32& nWidth, s sal_uInt64 nPresentationData) { rOle2.Seek(0); - tools::SvRef<SotStorage> xStorage(new SotStorage(rOle2)); + rtl::Reference<SotStorage> xStorage(new SotStorage(rOle2)); if (xStorage->GetError() != ERRCODE_NONE) return {}; @@ -407,7 +407,7 @@ bool ExtractOleFromRtf(SvStream& rRtf, SvStream& rOle, bool& bOwnFormat) if (!xReader->WriteObjectData(rOle)) return false; - tools::SvRef<SotStorage> pStorage = new SotStorage(rOle); + rtl::Reference<SotStorage> pStorage = new SotStorage(rOle); OUString aFilterName = SvxMSDffManager::GetFilterNameFromClassID(pStorage->GetClassName()); bOwnFormat = !aFilterName.isEmpty(); if (!bOwnFormat) diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx index ded3ea80d9d2..3f63f4d3eb5b 100644 --- a/sw/source/filter/writer/writer.cxx +++ b/sw/source/filter/writer/writer.cxx @@ -205,7 +205,7 @@ ErrCodeMsg Writer::Write( SwPaM& rPaM, SvStream& rStrm, const OUString* pFName ) ErrCodeMsg nResult = ERRCODE_ABORT; try { - tools::SvRef<SotStorage> aRef = new SotStorage( rStrm ); + rtl::Reference<SotStorage> aRef = new SotStorage(rStrm); nResult = Write( rPaM, *aRef, pFName ); if ( nResult == ERRCODE_NONE ) aRef->Commit(); diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 55c140e2a7c9..c910d1e28bc8 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -2995,7 +2995,7 @@ SwMSConvertControls::SwMSConvertControls( SfxObjectShell const *pDSh, SwPaM *pP // in transitioning away old filter for ole/ocx controls, ReadOCXStream has been made pure virtual in // filter/source/msocximex.cxx, so... we need an implementation here -bool SwMSConvertControls::ReadOCXStream( tools::SvRef<SotStorage> const & rSrc1, +bool SwMSConvertControls::ReadOCXStream( rtl::Reference<SotStorage> const & rSrc1, css::uno::Reference< css::drawing::XShape > *pShapeRef, bool bFloatingCtrl ) { @@ -3025,12 +3025,12 @@ void SwMSConvertControls::ExportControl(WW8Export &rWW8Wrt, const SdrUnoObj& rFo aSize.Height = convertTwipToMm100(aRect.Bottom()); //Open the ObjectPool - tools::SvRef<SotStorage> xObjPool = rWW8Wrt.GetWriter().GetStorage().OpenSotStorage(SL::aObjectPool); + rtl::Reference<SotStorage> xObjPool = rWW8Wrt.GetWriter().GetStorage().OpenSotStorage(SL::aObjectPool); //Create a destination storage for the microsoft control sal_uInt32 nObjId = ++mnObjectId; OUString sStorageName = "_" + OUString::number( static_cast<sal_Int64>( nObjId )); - tools::SvRef<SotStorage> xOleStg = xObjPool->OpenSotStorage(sStorageName); + rtl::Reference<SotStorage> xOleStg = xObjPool->OpenSotStorage(sStorageName); if (!xOleStg.is()) return; diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 3b8abbc0bc7b..23bc15c8f941 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3552,8 +3552,8 @@ ErrCode WW8Export::ExportDocument_Impl() m_pFib.reset(new WW8Fib(8, m_bDot)); - tools::SvRef<SotStorageStream> xWwStrm( GetWriter().GetStorage().OpenSotStream( m_aMainStg ) ); - tools::SvRef<SotStorageStream> xTableStrm( xWwStrm ), xDataStrm( xWwStrm ); + rtl::Reference<SotStorageStream> xWwStrm(GetWriter().GetStorage().OpenSotStream(m_aMainStg)); + rtl::Reference<SotStorageStream> xTableStrm(xWwStrm), xDataStrm(xWwStrm); xWwStrm->SetBufferSize( 32768 ); m_pFib->m_fWhichTableStm = true; @@ -3765,7 +3765,7 @@ void WW8Export::PrepareStorage() SvGlobalName aGName(MSO_WW8_CLASSID); GetWriter().GetStorage().SetClass( aGName, SotClipboardFormatId::NONE, "Microsoft Word-Document"); - tools::SvRef<SotStorageStream> xStor( GetWriter().GetStorage().OpenSotStream(sCompObj) ); + rtl::Reference<SotStorageStream> xStor(GetWriter().GetStorage().OpenSotStream(sCompObj)); xStor->WriteBytes(pData, sizeof(pData)); SwDocShell* pDocShell = m_rDoc.GetDocShell (); @@ -3796,7 +3796,7 @@ void WW8Export::PrepareStorage() ErrCodeMsg SwWW8Writer::WriteStorage() { - tools::SvRef<SotStorage> pOrigStg; + rtl::Reference<SotStorage> pOrigStg; uno::Reference< packages::XPackageEncryption > xPackageEncryption; std::shared_ptr<SvStream> pSotStorageStream; uno::Sequence< beans::NamedValue > aEncryptionData; @@ -3850,7 +3850,7 @@ ErrCodeMsg SwWW8Writer::WriteStorage() { // To avoid long paths split and open substorages recursively // Splitting paths manually, since comphelper::string::split is trimming special characters like \0x01, \0x09 - tools::SvRef<SotStorage> pStorage = m_pStg.get(); + rtl::Reference<SotStorage> pStorage = m_pStg; OUString sFileName; sal_Int32 idx = 0; while (pStorage && idx >= 0) @@ -3877,7 +3877,7 @@ ErrCodeMsg SwWW8Writer::WriteStorage() break; } - tools::SvRef<SotStorageStream> pStream = pStorage->OpenSotStream(sFileName); + rtl::Reference<SotStorageStream> pStream = pStorage->OpenSotStream(sFileName); if (!pStream) { nErrorCode = ERRCODE_IO_GENERAL; diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index fcc39c44aab4..e69d35e07c7a 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -1023,7 +1023,7 @@ protected: std::unique_ptr<WW8AttributeOutput> m_pAttrOutput; ///< Converting attributes to stream data private: - tools::SvRef<SotStorage> m_xEscherStg; /// memory leak #i120098#, to hold the reference to unnamed SotStorage obj + rtl::Reference<SotStorage> m_xEscherStg; /// memory leak #i120098#, to hold the reference to unnamed SotStorage obj public: /// Access to the attribute output class. @@ -1088,8 +1088,8 @@ public: void StartCommentOutput( std::u16string_view rName ); void EndCommentOutput( std::u16string_view rName ); void OutGrf(const ww8::Frame &rFrame); - bool TestOleNeedsGraphic(const SwAttrSet& rSet, tools::SvRef<SotStorage> const& xOleStg, - const tools::SvRef<SotStorage>& xObjStg, OUString const& rStorageName, + bool TestOleNeedsGraphic(const SwAttrSet& rSet, rtl::Reference<SotStorage> const& xOleStg, + const rtl::Reference<SotStorage>& xObjStg, OUString const& rStorageName, SwOLENode* pOLENd); virtual void AppendBookmarks( const SwTextNode& rNd, sal_Int32 nCurrentPos, sal_Int32 nLen, const SwRedlineData* pRedlineData = nullptr ) override; diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx index 824794430ee6..9b041e4a5c32 100644 --- a/sw/source/filter/ww8/wrtww8gr.cxx +++ b/sw/source/filter/ww8/wrtww8gr.cxx @@ -83,8 +83,8 @@ void WW8Export::OutputGrfNode( const SwGrfNode& /*rNode*/ ) } } -bool WW8Export::TestOleNeedsGraphic(const SwAttrSet& rSet, tools::SvRef<SotStorage> const& xOleStg, - const tools::SvRef<SotStorage>& xObjStg, +bool WW8Export::TestOleNeedsGraphic(const SwAttrSet& rSet, rtl::Reference<SotStorage> const& xOleStg, + const rtl::Reference<SotStorage>& xObjStg, OUString const& rStorageName, SwOLENode* pOLENd) { bool bGraphicNeeded = false; @@ -206,7 +206,7 @@ void WW8Export::OutputOLENode( const SwOLENode& rOLENode ) nSize = sizeof( aSpecOLE_WW8 ); pDataAdr = pSpecOLE + 2; //WW6 sprm is 1 but has 1 byte len as well. - tools::SvRef<SotStorage> xObjStg = GetWriter().GetStorage().OpenSotStorage(SL::aObjectPool); + rtl::Reference<SotStorage> xObjStg = GetWriter().GetStorage().OpenSotStorage(SL::aObjectPool); if( !xObjStg.is() ) return; @@ -227,7 +227,7 @@ void WW8Export::OutputOLENode( const SwOLENode& rOLENode ) nPictureId = aRes.first->second; Set_UInt32(pDataAdr, nPictureId); OUString sStorageName = "_" + OUString::number( nPictureId ); - tools::SvRef<SotStorage> xOleStg = xObjStg->OpenSotStorage( sStorageName ); + rtl::Reference<SotStorage> xOleStg = xObjStg->OpenSotStorage(sStorageName); if( !xOleStg.is() ) return; @@ -246,7 +246,7 @@ void WW8Export::OutputOLENode( const SwOLENode& rOLENode ) if ( !xOleStg->IsStream( aObjInfo ) ) { const sal_uInt8 pObjInfoData[] = { 0x40, 0x00, 0x03, 0x00 }; - tools::SvRef<SotStorageStream> rObjInfoStream = xOleStg->OpenSotStream( aObjInfo ); + rtl::Reference<SotStorageStream> rObjInfoStream = xOleStg->OpenSotStream(aObjInfo); if ( rObjInfoStream.is() && !rObjInfoStream->GetError() ) { rObjInfoStream->WriteBytes(pObjInfoData, sizeof(pObjInfoData)); @@ -317,14 +317,14 @@ void WW8Export::OutputLinkedOLE( const OUString& rOleId ) { uno::Reference< embed::XStorage > xDocStg = m_rDoc.GetDocStorage(); uno::Reference< embed::XStorage > xOleStg = xDocStg->openStorageElement( "OLELinks", embed::ElementModes::READ ); - tools::SvRef<SotStorage> xObjSrc = SotStorage::OpenOLEStorage( xOleStg, rOleId, StreamMode::READ ); + rtl::Reference<SotStorage> xObjSrc = SotStorage::OpenOLEStorage( xOleStg, rOleId, StreamMode::READ ); - tools::SvRef<SotStorage> xObjStg = GetWriter().GetStorage().OpenSotStorage(SL::aObjectPool); + rtl::Reference<SotStorage> xObjStg = GetWriter().GetStorage().OpenSotStorage(SL::aObjectPool); if( !(xObjStg.is() && xObjSrc.is()) ) return; - tools::SvRef<SotStorage> xOleDst = xObjStg->OpenSotStorage( rOleId ); + rtl::Reference<SotStorage> xOleDst = xObjStg->OpenSotStorage(rOleId); if ( xOleDst.is() ) xObjSrc->CopyTo( xOleDst.get() ); diff --git a/sw/source/filter/ww8/ww8glsy.cxx b/sw/source/filter/ww8/ww8glsy.cxx index 4b50d48b7742..ac4338b7921b 100644 --- a/sw/source/filter/ww8/ww8glsy.cxx +++ b/sw/source/filter/ww8/ww8glsy.cxx @@ -34,7 +34,7 @@ #include "ww8glsy.hxx" #include "ww8par.hxx" -WW8Glossary::WW8Glossary(tools::SvRef<SotStorageStream> &refStrm, sal_uInt8 nVersion, SotStorage *pStg) +WW8Glossary::WW8Glossary(rtl::Reference<SotStorageStream> &refStrm, sal_uInt8 nVersion, SotStorage *pStg) : m_rStrm(refStrm) , m_xStg(pStg) , m_nStrings(0) diff --git a/sw/source/filter/ww8/ww8glsy.hxx b/sw/source/filter/ww8/ww8glsy.hxx index 35babac1d07f..65dfc328effc 100644 --- a/sw/source/filter/ww8/ww8glsy.hxx +++ b/sw/source/filter/ww8/ww8glsy.hxx @@ -60,7 +60,7 @@ private: class WW8Glossary { public: - WW8Glossary( tools::SvRef<SotStorageStream> &refStrm, sal_uInt8 nVersion, SotStorage *pStg); + WW8Glossary(rtl::Reference<SotStorageStream>& refStrm, sal_uInt8 nVersion, SotStorage* pStg); bool Load( SwTextBlocks &rBlocks, bool bSaveRelFile ); std::shared_ptr<WW8GlossaryFib>& GetFib() { @@ -73,9 +73,9 @@ public: private: std::shared_ptr<WW8GlossaryFib> m_xGlossary; - tools::SvRef<SotStorageStream> m_xTableStream; - tools::SvRef<SotStorageStream> &m_rStrm; - tools::SvRef<SotStorage> m_xStg; + rtl::Reference<SotStorageStream> m_xTableStream; + rtl::Reference<SotStorageStream> &m_rStrm; + rtl::Reference<SotStorage> m_xStg; sal_uInt16 m_nStrings; static bool MakeEntries(SwDoc *pD, SwTextBlocks &rBlocks, bool bSaveRelFile, diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 827fe755a003..b51239d436ac 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -523,11 +523,11 @@ rtl::Reference<SdrObject> SwMSDffManager::ImportOLE( sal_uInt32 nOLEId, rtl::Reference<SdrObject> pRet; OUString sStorageName; - tools::SvRef<SotStorage> xSrcStg; + rtl::Reference<SotStorage> xSrcStg; uno::Reference < embed::XStorage > xDstStg; if( GetOLEStorageName( nOLEId, sStorageName, xSrcStg, xDstStg )) { - tools::SvRef<SotStorage> xSrc = xSrcStg->OpenSotStorage( sStorageName ); + rtl::Reference<SotStorage> xSrc = xSrcStg->OpenSotStorage(sStorageName); OSL_ENSURE(m_rReader.m_xFormImpl, "No Form Implementation!"); css::uno::Reference< css::drawing::XShape > xShape; if ( (!(m_rReader.m_bIsHeader || m_rReader.m_bIsFooter)) && @@ -4985,17 +4985,17 @@ void SwWW8ImplReader::ReadGlobalTemplateSettings( std::u16string_view sCreatedFr if ( !aURL.endsWithIgnoreAsciiCase( ".dot" ) || ( !sCreatedFrom.empty() && sCreatedFrom == aURL ) ) continue; // don't try and read the same document as ourselves - tools::SvRef<SotStorage> rRoot = new SotStorage( aURL, StreamMode::STD_READWRITE ); + rtl::Reference<SotStorage> rRoot = new SotStorage(aURL, StreamMode::STD_READWRITE); BasicProjImportHelper aBasicImporter( *m_pDocShell ); // Import vba via oox filter aBasicImporter.import( m_pDocShell->GetMedium()->GetInputStream() ); lcl_createTemplateToProjectEntry( xPrjNameCache, aURL, aBasicImporter.getProjectName() ); // Read toolbars & menus - tools::SvRef<SotStorageStream> refMainStream = rRoot->OpenSotStream( "WordDocument"); + rtl::Reference<SotStorageStream> refMainStream = rRoot->OpenSotStream("WordDocument"); refMainStream->SetEndian(SvStreamEndian::LITTLE); WW8Fib aWwFib( *refMainStream, 8 ); - tools::SvRef<SotStorageStream> xTableStream = + rtl::Reference<SotStorageStream> xTableStream = rRoot->OpenSotStream(aWwFib.m_fWhichTableStm ? SL::a1Table : SL::a0Table, StreamMode::STD_READ); if (xTableStream.is() && ERRCODE_NONE == xTableStream->GetError()) @@ -5506,8 +5506,8 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary const *pGloss) return ERRCODE_NONE; } -ErrCode SwWW8ImplReader::SetSubStreams(tools::SvRef<SotStorageStream> &rTableStream, - tools::SvRef<SotStorageStream> &rDataStream) +ErrCode SwWW8ImplReader::SetSubStreams(rtl::Reference<SotStorageStream>& rTableStream, + rtl::Reference<SotStorageStream>& rDataStream) { ErrCode nErrRet = ERRCODE_NONE; // 6 stands for "6 OR 7", 7 stands for "ONLY 7" @@ -5779,7 +5779,7 @@ ErrCode SwWW8ImplReader::LoadThroughDecryption(WW8Glossary *pGloss) if (m_xWwFib->m_nFibError) nErrRet = ERR_SWG_READ_ERROR; - tools::SvRef<SotStorageStream> xTableStream, xDataStream; + rtl::Reference<SotStorageStream> xTableStream, xDataStream; if (!nErrRet) nErrRet = SetSubStreams(xTableStream, xDataStream); @@ -6333,13 +6333,13 @@ bool TestImportDOC(SvStream &rStream, const OUString &rFltName) FontCacheGuard aFontCacheGuard; std::unique_ptr<Reader> xReader(ImportDOC()); - tools::SvRef<SotStorage> xStorage; + rtl::Reference<SotStorage> xStorage; xReader->m_pStream = &rStream; if (rFltName != "WW6") { try { - xStorage = tools::SvRef<SotStorage>(new SotStorage(rStream)); + xStorage.set(new SotStorage(rStream)); if (xStorage->GetError()) return false; } @@ -6380,7 +6380,7 @@ extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportWW2(SvStream &rStream) return TestImportDOC(rStream, "WW6"); } -ErrCode WW8Reader::OpenMainStream( tools::SvRef<SotStorageStream>& rRef, sal_uInt16& rBuffSize ) +ErrCode WW8Reader::OpenMainStream(rtl::Reference<SotStorageStream>& rRef, sal_uInt16& rBuffSize) { ErrCode nRet = ERR_SWG_READ_ERROR; OSL_ENSURE(m_pStorage, "Where is my Storage?"); @@ -6410,13 +6410,13 @@ static void lcl_getListOfStreams(SotStorage * pStorage, comphelper::SequenceAsHa OUString sStreamFullName = sPrefix.size() ? OUString::Concat(sPrefix) + "/" + aElement.GetName() : aElement.GetName(); if (aElement.IsStorage()) { - tools::SvRef<SotStorage> xSubStorage = pStorage->OpenSotStorage(aElement.GetName(), StreamMode::STD_READ | StreamMode::SHARE_DENYALL); + rtl::Reference<SotStorage> xSubStorage = pStorage->OpenSotStorage(aElement.GetName(), StreamMode::STD_READ | StreamMode::SHARE_DENYALL); lcl_getListOfStreams(xSubStorage.get(), aStreamsData, sStreamFullName); } else { // Read stream - tools::SvRef<SotStorageStream> rStream = pStorage->OpenSotStream(aElement.GetName(), StreamMode::READ | StreamMode::SHARE_DENYALL); + rtl::Reference<SotStorageStream> rStream = pStorage->OpenSotStream(aElement.GetName(), StreamMode::READ | StreamMode::SHARE_DENYALL); if (rStream.is()) { sal_Int32 nStreamSize = rStream->GetSize(); @@ -6456,7 +6456,7 @@ ErrCode WW8Reader::DecryptDRMPackage() return ERRCODE_IO_ACCESSDENIED; } - tools::SvRef<SotStorageStream> rContentStream = m_pStorage->OpenSotStream("\011DRMContent", StreamMode::READ | StreamMode::SHARE_DENYALL); + rtl::Reference<SotStorageStream> rContentStream = m_pStorage->OpenSotStream("\011DRMContent", StreamMode::READ | StreamMode::SHARE_DENYALL); if (!rContentStream.is()) { return ERRCODE_IO_NOTEXISTS; @@ -6495,7 +6495,7 @@ ErrCodeMsg WW8Reader::Read(SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, c sal_uInt16 nOldBuffSize = 32768; bool bNew = !m_bInsertMode; // New Doc (no inserting) - tools::SvRef<SotStorageStream> refStrm; // So that no one else can steal the Stream + rtl::Reference<SotStorageStream> refStrm; // So that no one else can steal the Stream SvStream* pIn = m_pStream; ErrCode nRet = ERRCODE_NONE; @@ -6522,7 +6522,7 @@ ErrCodeMsg WW8Reader::Read(SwDoc &rDoc, const OUString& rBaseURL, SwPaM &rPaM, c if( m_pStorage.is() ) { // Check if we have special encrypted content - tools::SvRef<SotStorageStream> rRef = m_pStorage->OpenSotStream("\006DataSpaces/DataSpaceInfo/\011DRMDataSpace", StreamMode::READ | StreamMode::SHARE_DENYALL); + rtl::Reference<SotStorageStream> rRef = m_pStorage->OpenSotStream("\006DataSpaces/DataSpaceInfo/\011DRMDataSpace", StreamMode::READ | StreamMode::SHARE_DENYALL); if (rRef.is()) { nRet = DecryptDRMPackage(); @@ -6586,7 +6586,7 @@ bool WW8Reader::ReadGlossaries(SwTextBlocks& rBlocks, bool bSaveRelFiles) const WW8Reader *pThis = const_cast<WW8Reader *>(this); sal_uInt16 nOldBuffSize = 32768; - tools::SvRef<SotStorageStream> refStrm; + rtl::Reference<SotStorageStream> refStrm; if (!pThis->OpenMainStream(refStrm, nOldBuffSize)) { WW8Glossary aGloss( refStrm, 8, m_pStorage.get() ); @@ -6596,7 +6596,7 @@ bool WW8Reader::ReadGlossaries(SwTextBlocks& rBlocks, bool bSaveRelFiles) const } bool SwMSDffManager::GetOLEStorageName(sal_uInt32 nOLEId, OUString& rStorageName, - tools::SvRef<SotStorage>& rSrcStorage, uno::Reference < embed::XStorage >& rDestStorage) const + rtl::Reference<SotStorage>& rSrcStorage, uno::Reference < embed::XStorage >& rDestStorage) const { bool bRet = false; diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index f98bcc2ff58e..caaafc2b122a 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -137,7 +137,7 @@ class WW8Reader : public StgReader { std::shared_ptr<SvStream> mDecodedStream; virtual ErrCodeMsg Read(SwDoc &, const OUString& rBaseURL, SwPaM &, const OUString &) override; - ErrCode OpenMainStream( tools::SvRef<SotStorageStream>& rRef, sal_uInt16& rBuffSize ); + ErrCode OpenMainStream(rtl::Reference<SotStorageStream>& rRef, sal_uInt16& rBuffSize); ErrCode DecryptDRMPackage(); public: WW8Reader() {} @@ -739,7 +739,7 @@ public: const css::awt::Size& rSize, css::uno::Reference< css::drawing::XShape > *pShape, bool bFloatingCtrl) override; void ExportControl(WW8Export &rWrt, const SdrUnoObj& rFormObj); - bool ReadOCXStream( tools::SvRef<SotStorage> const & rSrc1, + bool ReadOCXStream(rtl::Reference<SotStorage> const& rSrc1, css::uno::Reference< css::drawing::XShape > *pShapeRef, bool bFloatingCtrl=false ); private: @@ -755,7 +755,7 @@ private: std::unordered_map<sal_uInt32, Graphic> m_aOldEscherBlipCache; virtual bool GetOLEStorageName( sal_uInt32 nOLEId, OUString& rStorageName, - tools::SvRef<SotStorage>& rSrcStorage, css::uno::Reference < css::embed::XStorage >& rDestStorage ) const override; + rtl::Reference<SotStorage>& rSrcStorage, css::uno::Reference < css::embed::XStorage >& rDestStorage ) const override; virtual bool ShapeHasText( sal_uLong nShapeId, sal_uLong nFilePos ) const override; // #i32596# - new parameter <_nCalledByGroup>, which // indicates, if the OLE object is imported inside a group object @@ -1586,7 +1586,7 @@ private: void ImportDopTypography(const WW8DopTypography &rTypo); ErrCode LoadThroughDecryption(WW8Glossary *pGloss); - ErrCode SetSubStreams(tools::SvRef<SotStorageStream> &rTableStream, tools::SvRef<SotStorageStream> &rDataStream); + ErrCode SetSubStreams(rtl::Reference<SotStorageStream> &rTableStream, rtl::Reference<SotStorageStream> &rDataStream); ErrCode CoreLoad(WW8Glossary const *pGloss); void ReadDocVars(); @@ -1932,7 +1932,7 @@ public: // really private, but can only be done public static bool GetPictGrafFromStream(Graphic& rGraphic, SvStream& rSrc); SAL_WARN_UNUSED_RESULT static bool PicRead(SvStream *pDataStream, WW8_PIC *pPic, bool bVer67); - static bool ImportOleWMF(const tools::SvRef<SotStorage>& xSrc1, GDIMetaFile& rWMF, tools::Long& rX, + static bool ImportOleWMF(const rtl::Reference<SotStorage>& xSrc1, GDIMetaFile& rWMF, tools::Long& rX, tools::Long& rY); static Color GetCol(sal_uInt8 nIco); diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx index 46bfa7325d68..981cc95faffa 100644 --- a/sw/source/filter/ww8/ww8par4.cxx +++ b/sw/source/filter/ww8/ww8par4.cxx @@ -64,7 +64,7 @@ struct OLE_MFP using namespace ::com::sun::star; -static bool SwWw8ReadScaling(tools::Long& rX, tools::Long& rY, tools::SvRef<SotStorage> const & rSrc1) +static bool SwWw8ReadScaling(tools::Long& rX, tools::Long& rY, rtl::Reference<SotStorage> const & rSrc1) { // Getting the scaling factor: // Information in the PIC-stream (by trying out) @@ -79,7 +79,7 @@ static bool SwWw8ReadScaling(tools::Long& rX, tools::Long& rY, tools::SvRef<SotS // 0x2c, 0x30 scaling x,y in per thousand // 0x34, 0x38, 0x3c, 0x40 Crop Left, Top, Right, Bot in tw - tools::SvRef<SotStorageStream> xSrc3 = rSrc1->OpenSotStream( "\3PIC", + rtl::Reference<SotStorageStream> xSrc3 = rSrc1->OpenSotStream( "\3PIC", StreamMode::STD_READ ); SotStorageStream* pS = xSrc3.get(); pS->SetEndian( SvStreamEndian::LITTLE ); @@ -121,9 +121,9 @@ static bool SwWw8ReadScaling(tools::Long& rX, tools::Long& rY, tools::SvRef<SotS } static bool SwWw6ReadMetaStream(GDIMetaFile& rWMF, OLE_MFP* pMfp, - tools::SvRef<SotStorage> const & rSrc1) + rtl::Reference<SotStorage> const& rSrc1) { - tools::SvRef<SotStorageStream> xSrc2 = rSrc1->OpenSotStream( "\3META", + rtl::Reference<SotStorageStream> xSrc2 = rSrc1->OpenSotStream( "\3META", StreamMode::STD_READ ); SotStorageStream* pSt = xSrc2.get(); pSt->SetEndian( SvStreamEndian::LITTLE ); @@ -174,10 +174,10 @@ static bool SwWw6ReadMetaStream(GDIMetaFile& rWMF, OLE_MFP* pMfp, return true; } -static bool SwWw6ReadMacPICTStream(Graphic& rGraph, tools::SvRef<SotStorage> const & rSrc1) +static bool SwWw6ReadMacPICTStream(Graphic& rGraph, rtl::Reference<SotStorage> const& rSrc1) { // 03-META-stream does not exist. Maybe a 03-PICT? - tools::SvRef<SotStorageStream> xSrc4 = rSrc1->OpenSotStream("\3PICT"); + rtl::Reference<SotStorageStream> xSrc4 = rSrc1->OpenSotStream("\3PICT"); SotStorageStream* pStp = xSrc4.get(); pStp->SetEndian( SvStreamEndian::LITTLE ); sal_uInt8 aTestA[10]; // Does the 01Ole-stream even exist? @@ -300,7 +300,7 @@ SwFrameFormat* SwWW8ImplReader::ImportOle(const Graphic* pGrf, return pFormat; } -bool SwWW8ImplReader::ImportOleWMF(const tools::SvRef<SotStorage>& xSrc1, GDIMetaFile& rWMF, +bool SwWW8ImplReader::ImportOleWMF(const rtl::Reference<SotStorage>& xSrc1, GDIMetaFile& rWMF, tools::Long& rX, tools::Long& rY) { bool bOk = false; @@ -340,8 +340,8 @@ rtl::Reference<SdrObject> SwWW8ImplReader::ImportOleBase( Graphic& rGraph, // results in the name "_4711" OUString aSrcStgName = "_" + OUString::number( m_nObjLocFc ); - tools::SvRef<SotStorage> xSrc0 = m_pStg->OpenSotStorage(SL::aObjectPool); - tools::SvRef<SotStorage> xSrc1 = xSrc0->OpenSotStorage( aSrcStgName ); + rtl::Reference<SotStorage> xSrc0 = m_pStg->OpenSotStorage(SL::aObjectPool); + rtl::Reference<SotStorage> xSrc1 = xSrc0->OpenSotStorage(aSrcStgName); if (pGrf) { @@ -414,7 +414,7 @@ rtl::Reference<SdrObject> SwWW8ImplReader::ImportOleBase( Graphic& rGraph, sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT; { - tools::SvRef<SotStorageStream> xObjInfoSrc = xSrc1->OpenSotStream("\3ObjInfo", + rtl::Reference<SotStorageStream> xObjInfoSrc = xSrc1->OpenSotStream("\3ObjInfo", StreamMode::STD_READ ); if ( xObjInfoSrc.is() && !xObjInfoSrc->GetError() ) { diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 1995f7b49936..a5b9f881065e 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -698,8 +698,8 @@ sal_uInt16 SwWW8ImplReader::End_Field() OUString sOleId = "_" + OUString::number( m_aFieldStack.back().mnObjLocFc ); - tools::SvRef<SotStorage> xSrc0 = m_pStg->OpenSotStorage(SL::aObjectPool); - tools::SvRef<SotStorage> xSrc1 = xSrc0->OpenSotStorage( sOleId, StreamMode::READ ); + rtl::Reference<SotStorage> xSrc0 = m_pStg->OpenSotStorage(SL::aObjectPool); + rtl::Reference<SotStorage> xSrc1 = xSrc0->OpenSotStorage( sOleId, StreamMode::READ ); // Store it now! uno::Reference< embed::XStorage > xDocStg = GetDoc().GetDocStorage(); @@ -707,7 +707,7 @@ sal_uInt16 SwWW8ImplReader::End_Field() { uno::Reference< embed::XStorage > xOleStg = xDocStg->openStorageElement( "OLELinks", embed::ElementModes::WRITE ); - tools::SvRef<SotStorage> xObjDst = SotStorage::OpenOLEStorage( xOleStg, sOleId ); + rtl::Reference<SotStorage> xObjDst = SotStorage::OpenOLEStorage( xOleStg, sOleId ); if ( xObjDst.is() ) { diff --git a/sw/source/ui/uno/swdetect.cxx b/sw/source/ui/uno/swdetect.cxx index 83b7162ae2a0..dade95903803 100644 --- a/sw/source/ui/uno/swdetect.cxx +++ b/sw/source/ui/uno/swdetect.cxx @@ -91,7 +91,7 @@ OUString SAL_CALL SwFilterDetect::detect( Sequence< PropertyValue >& lDescriptor try { - tools::SvRef<SotStorage> aStorage = new SotStorage ( pInStrm, false ); + rtl::Reference<SotStorage> aStorage = new SotStorage ( pInStrm, false ); if ( !aStorage->GetError() ) { bIsDetected = aStorage->IsContained( "WordDocument" ); @@ -116,7 +116,7 @@ OUString SAL_CALL SwFilterDetect::detect( Sequence< PropertyValue >& lDescriptor // that byte. if (aParser.getExtension().toAsciiLowerCase() != "dot") { - tools::SvRef<SotStorageStream> xWordDocument + rtl::Reference<SotStorageStream> xWordDocument = aStorage->OpenSotStream("WordDocument", StreamMode::STD_READ); xWordDocument->Seek(10); if (xWordDocument->Tell() == 10) diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx index 8289fff19861..03657db5447f 100644 --- a/sw/source/uibase/app/apphdl.cxx +++ b/sw/source/uibase/app/apphdl.cxx @@ -876,7 +876,7 @@ void SwModule::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) if (rHint.GetId() == SfxHintId::ThisIsAnSfxEventHint) { const SfxEventHint& rEvHint = static_cast<const SfxEventHint&>(rHint); - SwDocShell* pDocSh = dynamic_cast<SwDocShell*>(rEvHint.GetObjShell()); + rtl::Reference<SwDocShell> pDocSh = dynamic_cast<SwDocShell*>(rEvHint.GetObjShell().get()); if( pDocSh ) { SwWrtShell* pWrtSh = pDocSh->GetWrtShell(); diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index 7f69029bebb4..8ab97c5964f5 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -202,7 +202,7 @@ bool SwDocShell::ConvertFrom( SfxMedium& rMedium ) Reader* pRead = StartConvertFrom(rMedium, pRdr); if (!pRead) return false; // #129881# return if no reader is found - tools::SvRef<SotStorage> pStg=pRead->getSotStorageRef(); // #i45333# save sot storage ref in case of recursive calls + rtl::Reference<SotStorage> pStg=pRead->getSotStorageRef(); // #i45333# save sot storage ref in case of recursive calls m_xDoc->setDocAccTitle(OUString()); if (const auto pFrame1 = SfxViewFrame::GetFirst(this)) @@ -612,7 +612,7 @@ bool SwDocShell::ConvertTo( SfxMedium& rMedium ) if ( bSave ) { - tools::SvRef<SotStorage> xStg = new SotStorage( rMedium.GetOutStream(), false ); + rtl::Reference<SotStorage> xStg = new SotStorage(rMedium.GetOutStream(), false); OSL_ENSURE( !xStg->GetError(), "No storage available for storing VBA macros!" ); if ( !xStg->GetError() ) { diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 87344ccedd43..0ec9c84f97c6 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -1778,8 +1778,7 @@ int SwFindDocShell( SfxObjectShellRef& xDocSh, xMed->SetFilter( pSfxFlt ); // If the new shell is created, SfxObjectShellLock should be used to let it be closed later for sure - SwDocShell *const pNew(new SwDocShell(SfxObjectCreateMode::INTERNAL)); - xLockRef = pNew; + xLockRef = new SwDocShell(SfxObjectCreateMode::INTERNAL); xDocSh = static_cast<SfxObjectShell*>(xLockRef); if (xDocSh->DoLoad(xMed.release())) { diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index a862c7dd90b8..94acc82b0973 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -680,9 +680,7 @@ bool SwTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDo if( !m_aDocShellRef.Is() ) { SwDoc& rDoc = lcl_GetDoc(*m_pClpDocFac); - SwDocShell* pNewDocSh = new SwDocShell( rDoc, - SfxObjectCreateMode::EMBEDDED ); - m_aDocShellRef = pNewDocSh; + m_aDocShellRef = new SwDocShell(rDoc, SfxObjectCreateMode::EMBEDDED); m_aDocShellRef->DoInitNew(); SwTransferable::InitOle( m_aDocShellRef ); } diff --git a/sw/source/uibase/inc/glosdoc.hxx b/sw/source/uibase/inc/glosdoc.hxx index f879dc1c7bc5..e2ece010b121 100644 --- a/sw/source/uibase/inc/glosdoc.hxx +++ b/sw/source/uibase/inc/glosdoc.hxx @@ -28,8 +28,8 @@ class SwDocShell; #ifndef SW_DECL_SWDOCSHELL_DEFINED #define SW_DECL_SWDOCSHELL_DEFINED -#include <tools/ref.hxx> -typedef tools::SvRef<SwDocShell> SwDocShellRef; +#include <rtl/ref.hxx> +typedef rtl::Reference<SwDocShell> SwDocShellRef; #endif #include <cppuhelper/weakref.hxx> diff --git a/sw/source/uibase/inc/unoatxt.hxx b/sw/source/uibase/inc/unoatxt.hxx index 48f0c8137994..d9f0d3c0d913 100644 --- a/sw/source/uibase/inc/unoatxt.hxx +++ b/sw/source/uibase/inc/unoatxt.hxx @@ -42,8 +42,7 @@ class SwXBodyText; #ifndef SW_DECL_SWDOCSHELL_DEFINED #define SW_DECL_SWDOCSHELL_DEFINED -#include <tools/ref.hxx> -typedef tools::SvRef<SwDocShell> SwDocShellRef; +typedef rtl::Reference<SwDocShell> SwDocShellRef; #endif class SwXAutoTextContainer final : public cppu::WeakImplHelper diff --git a/sw/source/uibase/misc/glshell.cxx b/sw/source/uibase/misc/glshell.cxx index 59ede231e820..b15be1f8f833 100644 --- a/sw/source/uibase/misc/glshell.cxx +++ b/sw/source/uibase/misc/glshell.cxx @@ -207,7 +207,7 @@ SwDocShellRef SwGlossaries::EditGroupDoc( const OUString& rGroup, const OUString if( SfxInterfaceId(6) == nViewId ) { - SwWebGlosDocShell* pDocSh = new SwWebGlosDocShell(); + rtl::Reference<SwWebGlosDocShell> pDocSh = new SwWebGlosDocShell(); xDocSh = pDocSh; pDocSh->DoInitNew(); pDocSh->SetLongName( sLongName ); @@ -216,7 +216,7 @@ SwDocShellRef SwGlossaries::EditGroupDoc( const OUString& rGroup, const OUString } else { - SwGlosDocShell* pDocSh = new SwGlosDocShell(bShow); + rtl::Reference<SwGlosDocShell> pDocSh = new SwGlosDocShell(bShow); xDocSh = pDocSh; pDocSh->DoInitNew(); pDocSh->SetLongName( sLongName ); diff --git a/sw/source/uibase/uno/unodoc.cxx b/sw/source/uibase/uno/unodoc.cxx index b525d2e366d3..900fcd9a2c34 100644 --- a/sw/source/uibase/uno/unodoc.cxx +++ b/sw/source/uibase/uno/unodoc.cxx @@ -42,7 +42,7 @@ Writer_SwTextDocument_get_implementation( css::uno::Reference<css::uno::XInterface> xInterface = sfx2::createSfxModelInstance(args, [](SfxModelFlags _nCreationFlags) { - SfxObjectShell* pShell = new SwDocShell( _nCreationFlags ); + rtl::Reference<SfxObjectShell> pShell = new SwDocShell(_nCreationFlags); return pShell->GetModel(); }); xInterface->acquire(); @@ -55,7 +55,7 @@ com_sun_star_comp_Writer_WebDocument_get_implementation(css::uno::XComponentCont { SolarMutexGuard aGuard; SwGlobals::ensure(); - SfxObjectShell* pShell = new SwWebDocShell; + rtl::Reference<SfxObjectShell> pShell = new SwWebDocShell; uno::Reference< uno::XInterface > model( pShell->GetModel() ); model->acquire(); return model.get(); @@ -68,7 +68,7 @@ com_sun_star_comp_Writer_GlobalDocument_get_implementation(css::uno::XComponentC { SolarMutexGuard aGuard; SwGlobals::ensure(); - SfxObjectShell* pShell = new SwGlobalDocShell( SfxObjectCreateMode::STANDARD ); + rtl::Reference<SfxObjectShell> pShell = new SwGlobalDocShell(SfxObjectCreateMode::STANDARD); uno::Reference< uno::XInterface > model( pShell->GetModel() ); model->acquire(); return model.get(); diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx index a859e4ec5657..fd6e6fdf8bb6 100644 --- a/sw/source/uibase/uno/unotxvw.cxx +++ b/sw/source/uibase/uno/unotxvw.cxx @@ -604,8 +604,8 @@ SfxObjectShellLock SwXTextView::BuildTmpSelectionDoc() { SwWrtShell& rOldSh = m_pView->GetWrtShell(); SfxPrinter *pPrt = rOldSh.getIDocumentDeviceAccess().getPrinter( false ); - SwDocShell* pDocSh; - SfxObjectShellLock xDocSh( pDocSh = new SwDocShell(SfxObjectCreateMode::STANDARD) ); + rtl::Reference<SwDocShell> pDocSh = new SwDocShell(SfxObjectCreateMode::STANDARD); + SfxObjectShellLock xDocSh(pDocSh.get()); xDocSh->DoInitNew(); SwDoc *const pTempDoc( pDocSh->GetDoc() ); // #i103634#, #i112425#: do not expand numbering and fields on PDF export diff --git a/writerperfect/inc/WPXSvInputStream.hxx b/writerperfect/inc/WPXSvInputStream.hxx index 66ed90a958b4..b7e6a7a04484 100644 --- a/writerperfect/inc/WPXSvInputStream.hxx +++ b/writerperfect/inc/WPXSvInputStream.hxx @@ -57,7 +57,7 @@ private: bool isZip(); void ensureZipIsInitialized(); static librevenge::RVNGInputStream* - createWPXStream(const tools::SvRef<SotStorageStream>& rxStorage); + createWPXStream(const rtl::Reference<SotStorageStream>& rxStorage); static librevenge::RVNGInputStream* createWPXStream(const css::uno::Reference<css::io::XInputStream>& rxStream); diff --git a/writerperfect/source/common/WPXSvInputStream.cxx b/writerperfect/source/common/WPXSvInputStream.cxx index dee82500dea3..ee975584edcf 100644 --- a/writerperfect/source/common/WPXSvInputStream.cxx +++ b/writerperfect/source/common/WPXSvInputStream.cxx @@ -96,7 +96,7 @@ struct OLEStreamData { } - tools::SvRef<SotStorageStream> stream; + rtl::Reference<SotStorageStream> stream; /** Name of the stream. * @@ -114,7 +114,7 @@ struct OLEStreamData } // anonymous namespace typedef std::unordered_map<OUString, std::size_t> NameMap_t; -typedef std::unordered_map<OUString, tools::SvRef<SotStorage>> OLEStorageMap_t; +typedef std::unordered_map<OUString, rtl::Reference<SotStorage>> OLEStorageMap_t; /** Representation of an OLE2 storage. * @@ -138,16 +138,16 @@ struct OLEStorageImpl void initialize(std::unique_ptr<SvStream> pStream); - tools::SvRef<SotStorageStream> getStream(const OUString& rPath); - tools::SvRef<SotStorageStream> const& getStream(std::size_t nId); + rtl::Reference<SotStorageStream> getStream(const OUString& rPath); + rtl::Reference<SotStorageStream> const& getStream(std::size_t nId); private: - void traverse(const tools::SvRef<SotStorage>& rStorage, std::u16string_view rPath); + void traverse(const rtl::Reference<SotStorage>& rStorage, std::u16string_view rPath); - tools::SvRef<SotStorageStream> createStream(const OUString& rPath); + rtl::Reference<SotStorageStream> createStream(const OUString& rPath); public: - tools::SvRef<SotStorage> mxRootStorage; //< root storage of the OLE2 + rtl::Reference<SotStorage> mxRootStorage; //< root storage of the OLE2 OLEStorageMap_t maStorageMap; //< map of all sub storages by name ::std::vector<OLEStreamData> maStreams; //< list of streams and their names NameMap_t maNameMap; //< map of stream names to indexes (into @c maStreams) @@ -171,7 +171,7 @@ void OLEStorageImpl::initialize(std::unique_ptr<SvStream> pStream) mbInitialized = true; } -tools::SvRef<SotStorageStream> OLEStorageImpl::getStream(const OUString& rPath) +rtl::Reference<SotStorageStream> OLEStorageImpl::getStream(const OUString& rPath) { const OUString aPath(lcl_normalizeSubStreamPath(rPath)); NameMap_t::iterator aIt = maNameMap.find(aPath); @@ -180,7 +180,7 @@ tools::SvRef<SotStorageStream> OLEStorageImpl::getStream(const OUString& rPath) // Later, given how libcdr's zip stream implementation behaves, // return the first stream in the storage if there is one. if (maNameMap.end() == aIt) - return tools::SvRef<SotStorageStream>(); + return rtl::Reference<SotStorageStream>(); if (!maStreams[aIt->second].stream.is()) maStreams[aIt->second].stream @@ -189,7 +189,7 @@ tools::SvRef<SotStorageStream> OLEStorageImpl::getStream(const OUString& rPath) return maStreams[aIt->second].stream; } -tools::SvRef<SotStorageStream> const& OLEStorageImpl::getStream(const std::size_t nId) +rtl::Reference<SotStorageStream> const& OLEStorageImpl::getStream(const std::size_t nId) { if (!maStreams[nId].stream.is()) maStreams[nId].stream @@ -198,7 +198,7 @@ tools::SvRef<SotStorageStream> const& OLEStorageImpl::getStream(const std::size_ return maStreams[nId].stream; } -void OLEStorageImpl::traverse(const tools::SvRef<SotStorage>& rStorage, std::u16string_view rPath) +void OLEStorageImpl::traverse(const rtl::Reference<SotStorage>& rStorage, std::u16string_view rPath) { SvStorageInfoList infos; @@ -220,7 +220,7 @@ void OLEStorageImpl::traverse(const tools::SvRef<SotStorage>& rStorage, std::u16 else if (info.IsStorage()) { const OUString aPath = concatPath(rPath, info.GetName()); - tools::SvRef<SotStorage> aStorage + rtl::Reference<SotStorage> aStorage = rStorage->OpenSotStorage(info.GetName(), StreamMode::STD_READ); maStorageMap[aPath] = aStorage; @@ -235,7 +235,7 @@ void OLEStorageImpl::traverse(const tools::SvRef<SotStorage>& rStorage, std::u16 } } -tools::SvRef<SotStorageStream> OLEStorageImpl::createStream(const OUString& rPath) +rtl::Reference<SotStorageStream> OLEStorageImpl::createStream(const OUString& rPath) { const sal_Int32 nDelim = rPath.lastIndexOf(u'/'); @@ -655,7 +655,7 @@ librevenge::RVNGInputStream* WPXSvInputStream::getSubStreamById(const unsigned i } librevenge::RVNGInputStream* -WPXSvInputStream::createWPXStream(const tools::SvRef<SotStorageStream>& rxStorage) +WPXSvInputStream::createWPXStream(const rtl::Reference<SotStorageStream>& rxStorage) { if (rxStorage.is()) { |