diff options
Diffstat (limited to 'sw/source')
29 files changed, 107 insertions, 111 deletions
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 |