diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-23 11:16:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-24 08:33:29 +0200 |
commit | c92d89b4e481d7f1777592d9f55a250e2d1a9869 (patch) | |
tree | f20b3e6e36a79e60ca08c6907c0186d4a9f27437 | |
parent | 14377b33bd35a34d5be2d015c9a8d3d108153292 (diff) |
loplugin:useuniqueptr inSwDocShell
Change-Id: I9b834406b391695a18c9fdcdad9a6dd13be34c9e
Reviewed-on: https://gerrit.libreoffice.org/57867
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sw/inc/docsh.hxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/app/docsh.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/app/docshini.cxx | 9 |
3 files changed, 9 insertions, 10 deletions
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx index d61cd712a51a..9a88de3abeb6 100644 --- a/sw/inc/docsh.hxx +++ b/sw/inc/docsh.hxx @@ -67,7 +67,7 @@ class SW_DLLPUBLIC SwDocShell { rtl::Reference< SwDoc > m_xDoc; ///< Document. rtl::Reference< SfxStyleSheetBasePool > m_xBasePool; ///< Passing through for formats. - FontList* m_pFontList; ///< Current Fontlist. + std::unique_ptr<FontList> m_pFontList; ///< Current Fontlist. bool m_IsInUpdateFontList; ///< prevent nested calls of UpdateFontList std::unique_ptr<sfx2::StyleManager> m_pStyleManager; @@ -80,7 +80,7 @@ class SW_DLLPUBLIC SwDocShell SwView* m_pView; SwWrtShell* m_pWrtShell; - comphelper::EmbeddedObjectContainer* m_pOLEChildList; + std::unique_ptr<comphelper::EmbeddedObjectContainer> m_pOLEChildList; sal_Int16 m_nUpdateDocMode; ///< contains the css::document::UpdateDocMode bool m_IsATemplate; ///< prevent nested calls of UpdateFontList diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index 1692517501c5..2a40bc1d12da 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -827,7 +827,7 @@ bool SwDocShell::SaveCompleted( const uno::Reference < embed::XStorage >& xStor } } - DELETEZ(m_pOLEChildList); + m_pOLEChildList.reset(); if( bResetModified ) EnableSetModified(); } @@ -1080,7 +1080,7 @@ void SwDocShell::GetState(SfxItemSet& rSet) break; case SID_ATTR_CHAR_FONTLIST: { - rSet.Put( SvxFontListItem(m_pFontList, SID_ATTR_CHAR_FONTLIST) ); + rSet.Put( SvxFontListItem(m_pFontList.get(), SID_ATTR_CHAR_FONTLIST) ); } break; case SID_MAIL_PREPAREEXPORT: @@ -1235,7 +1235,7 @@ void SwDocShell::RemoveOLEObjects() pOLENd->IsInGlobalDocSection() ) ) { if (!m_pOLEChildList) - m_pOLEChildList = new comphelper::EmbeddedObjectContainer; + m_pOLEChildList.reset( new comphelper::EmbeddedObjectContainer ); OUString aObjName = pOLENd->GetOLEObj().GetCurrentPersistName(); GetEmbeddedObjectContainer().MoveEmbeddedObject( aObjName, *m_pOLEChildList ); diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx index cb9241609f77..0a402d2466af 100644 --- a/sw/source/uibase/app/docshini.cxx +++ b/sw/source/uibase/app/docshini.cxx @@ -391,13 +391,13 @@ SwDocShell::~SwDocShell() } RemoveLink(); - delete m_pFontList; + m_pFontList.reset(); // we, as BroadCaster also become our own Listener // (for DocInfo/FileNames/....) EndListening( *this ); - delete m_pOLEChildList; + m_pOLEChildList.reset(); } void SwDocShell::Init_Impl() @@ -441,9 +441,8 @@ void SwDocShell::UpdateFontList() OSL_ENSURE(m_xDoc.get(), "No Doc no FontList"); if (m_xDoc.get()) { - delete m_pFontList; - m_pFontList = new FontList( m_xDoc->getIDocumentDeviceAccess().getReferenceDevice(true) ); - PutItem( SvxFontListItem( m_pFontList, SID_ATTR_CHAR_FONTLIST ) ); + m_pFontList.reset( new FontList( m_xDoc->getIDocumentDeviceAccess().getReferenceDevice(true) ) ); + PutItem( SvxFontListItem( m_pFontList.get(), SID_ATTR_CHAR_FONTLIST ) ); } m_IsInUpdateFontList = false; } |