sc/inc/editsrc.hxx | 4 ++-- sc/source/ui/unoobj/editsrc.cxx | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-)
New commits: commit c0241bad4ee36cac66eab4ab1435aa4874f5bddb Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Thu Jun 28 10:48:27 2018 +0200 loplugin:useuniqueptr in ScAnnotationEditSource Change-Id: Ia1ba66e511fc5ad9b0871d04df859cd79d7521a5 Reviewed-on: https://gerrit.libreoffice.org/56621 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sc/inc/editsrc.hxx b/sc/inc/editsrc.hxx index 71c5f90c488d..a719230bb379 100644 --- a/sc/inc/editsrc.hxx +++ b/sc/inc/editsrc.hxx @@ -97,8 +97,8 @@ class ScAnnotationEditSource : public SvxEditSource, public SfxListener private: ScDocShell* pDocShell; ScAddress aCellPos; - ScEditEngineDefaulter* pEditEngine; - SvxEditEngineForwarder* pForwarder; + std::unique_ptr<ScEditEngineDefaulter> pEditEngine; + std::unique_ptr<SvxEditEngineForwarder> pForwarder; bool bDataValid; SdrObject* GetCaptionObj(); diff --git a/sc/source/ui/unoobj/editsrc.cxx b/sc/source/ui/unoobj/editsrc.cxx index 2989c6aed34a..1b604a517949 100644 --- a/sc/source/ui/unoobj/editsrc.cxx +++ b/sc/source/ui/unoobj/editsrc.cxx @@ -125,8 +125,8 @@ ScAnnotationEditSource::~ScAnnotationEditSource() if (pDocShell) pDocShell->GetDocument().RemoveUnoObject(*this); - delete pForwarder; - delete pEditEngine; + pForwarder.reset(); + pEditEngine.reset(); } std::unique_ptr<SvxEditSource> ScAnnotationEditSource::Clone() const @@ -147,19 +147,19 @@ SvxTextForwarder* ScAnnotationEditSource::GetTextForwarder() // notes don't have fields if ( pDocShell ) { - pEditEngine = new ScNoteEditEngine( pDocShell->GetDocument().GetNoteEngine() ); + pEditEngine.reset( new ScNoteEditEngine( pDocShell->GetDocument().GetNoteEngine() ) ); } else { SfxItemPool* pEnginePool = EditEngine::CreatePool(); pEnginePool->FreezeIdRanges(); - pEditEngine = new ScEditEngineDefaulter( pEnginePool, true ); + pEditEngine.reset( new ScEditEngineDefaulter( pEnginePool, true ) ); } - pForwarder = new SvxEditEngineForwarder(*pEditEngine); + pForwarder.reset( new SvxEditEngineForwarder(*pEditEngine) ); } if (bDataValid) - return pForwarder; + return pForwarder.get(); if ( pDocShell ) if ( ScPostIt* pNote = pDocShell->GetDocument().GetNote(aCellPos) ) @@ -167,7 +167,7 @@ SvxTextForwarder* ScAnnotationEditSource::GetTextForwarder() pEditEngine->SetText( *pEditObj ); // incl. breaks (line, etc.) bDataValid = true; - return pForwarder; + return pForwarder.get(); } void ScAnnotationEditSource::UpdateData() @@ -207,8 +207,8 @@ void ScAnnotationEditSource::Notify( SfxBroadcaster&, const SfxHint& rHint ) { pDocShell = nullptr; - DELETEZ( pForwarder ); - DELETEZ( pEditEngine ); // EditEngine uses document's pool + pForwarder.reset(); + pEditEngine.reset(); // EditEngine uses document's pool } else if ( nId == SfxHintId::DataChanged ) bDataValid = false; // text must be retrieved again _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits