[Libreoffice-commits] core.git: sc/source

Noel Grandin noel.grandin at collabora.co.uk
Thu Apr 12 12:18:53 UTC 2018


 sc/source/ui/Accessibility/AccessibleText.cxx |   14 +++++++-------
 sc/source/ui/inc/AccessibleText.hxx           |    4 ++--
 2 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 92ac45b1920fcce8259c1eab94357415e8f50d82
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Apr 10 11:19:35 2018 +0200

    loplugin:useuniqueptr in ScAccessibleHeaderTextData
    
    Change-Id: I545988d672b9b07ab7930ce280d93ced8b31f327
    Reviewed-on: https://gerrit.libreoffice.org/52761
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx
index 3ca075385213..e75f49850177 100644
--- a/sc/source/ui/Accessibility/AccessibleText.cxx
+++ b/sc/source/ui/Accessibility/AccessibleText.cxx
@@ -1325,8 +1325,8 @@ ScAccessibleHeaderTextData::~ScAccessibleHeaderTextData()
         mpDocSh->GetDocument().RemoveUnoObject(*this);
     if (mpEditEngine)
         mpEditEngine->SetNotifyHdl(Link<EENotify&,void>());
-    delete mpEditEngine;
-    delete mpForwarder;
+    mpEditEngine.reset();
+    mpForwarder.reset();
 }
 
 ScAccessibleTextData* ScAccessibleHeaderTextData::Clone() const
@@ -1351,7 +1351,7 @@ SvxTextForwarder* ScAccessibleHeaderTextData::GetTextForwarder()
     {
         SfxItemPool* pEnginePool = EditEngine::CreatePool();
         pEnginePool->FreezeIdRanges();
-        ScHeaderEditEngine* pHdrEngine = new ScHeaderEditEngine( pEnginePool );
+        std::unique_ptr<ScHeaderEditEngine> pHdrEngine(new ScHeaderEditEngine( pEnginePool ));
 
         pHdrEngine->EnableUndo( false );
         pHdrEngine->SetRefMapMode(MapMode(MapUnit::MapTwip));
@@ -1380,12 +1380,12 @@ SvxTextForwarder* ScAccessibleHeaderTextData::GetTextForwarder()
             ScHeaderFooterTextObj::FillDummyFieldData( aData );
         pHdrEngine->SetData( aData );
 
-        mpEditEngine = pHdrEngine;
-        mpForwarder = new SvxEditEngineForwarder(*mpEditEngine);
+        mpEditEngine = std::move(pHdrEngine);
+        mpForwarder.reset(new SvxEditEngineForwarder(*mpEditEngine));
     }
 
     if (mbDataValid)
-        return mpForwarder;
+        return mpForwarder.get();
 
     if ( mpViewShell  )
     {
@@ -1401,7 +1401,7 @@ SvxTextForwarder* ScAccessibleHeaderTextData::GetTextForwarder()
         mpEditEngine->SetText(*mpEditObj);
 
     mbDataValid = true;
-    return mpForwarder;
+    return mpForwarder.get();
 }
 
 SvxViewForwarder* ScAccessibleHeaderTextData::GetViewForwarder()
diff --git a/sc/source/ui/inc/AccessibleText.hxx b/sc/source/ui/inc/AccessibleText.hxx
index 860534504c85..e802af493082 100644
--- a/sc/source/ui/inc/AccessibleText.hxx
+++ b/sc/source/ui/inc/AccessibleText.hxx
@@ -216,8 +216,8 @@ public:
 private:
     ScPreviewViewForwarder* mpViewForwarder;
     ScPreviewShell*         mpViewShell;
-    ScEditEngineDefaulter*  mpEditEngine;
-    SvxEditEngineForwarder* mpForwarder;
+    std::unique_ptr<ScEditEngineDefaulter>  mpEditEngine;
+    std::unique_ptr<SvxEditEngineForwarder> mpForwarder;
     ScDocShell*             mpDocSh;
     const EditTextObject*   mpEditObj;
     bool                    mbHeader;


More information about the Libreoffice-commits mailing list