diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-28 10:48:27 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-29 08:38:32 +0200 |
commit | c0241bad4ee36cac66eab4ab1435aa4874f5bddb (patch) | |
tree | a0af58348f6197447d70f1e8b1d38f41598d42d1 | |
parent | f7355a9e7c91098052e22b45ab80caa64edf7871 (diff) |
loplugin:useuniqueptr in ScAnnotationEditSource
Change-Id: Ia1ba66e511fc5ad9b0871d04df859cd79d7521a5
Reviewed-on: https://gerrit.libreoffice.org/56621
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | sc/inc/editsrc.hxx | 4 | ||||
-rw-r--r-- | sc/source/ui/unoobj/editsrc.cxx | 18 |
2 files changed, 11 insertions, 11 deletions
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 |