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

Noel Grandin noel.grandin at collabora.co.uk
Wed Jul 4 07:57:18 UTC 2018


 sc/inc/textuno.hxx                            |    4 ++--
 sc/source/ui/Accessibility/AccessibleText.cxx |   10 +++++-----
 sc/source/ui/unoobj/textuno.cxx               |   16 ++++++++--------
 3 files changed, 15 insertions(+), 15 deletions(-)

New commits:
commit aab78c06f42fea5662c32d842e513bd212aa9c31
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Tue Jul 3 09:40:40 2018 +0200

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

diff --git a/sc/inc/textuno.hxx b/sc/inc/textuno.hxx
index f8ae5f60bff8..ec66fdcf17c0 100644
--- a/sc/inc/textuno.hxx
+++ b/sc/inc/textuno.hxx
@@ -323,8 +323,8 @@ protected:
     ScDocShell*             pDocShell;
     ScAddress               aCellPos;
     std::unique_ptr<ScFieldEditEngine> pEditEngine;
-    SvxEditEngineForwarder* pForwarder;
-    ScCellEditSource* pOriginalSource;
+    std::unique_ptr<SvxEditEngineForwarder> pForwarder;
+    std::unique_ptr<ScCellEditSource> pOriginalSource;
     bool                    bDataValid;
     bool                    bInUpdate;
     bool                    bDirty;
diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx
index 7983e978c160..3f45c7f3de94 100644
--- a/sc/source/ui/Accessibility/AccessibleText.cxx
+++ b/sc/source/ui/Accessibility/AccessibleText.cxx
@@ -831,7 +831,7 @@ SvxTextForwarder* ScAccessibleCellTextData::GetTextForwarder()
         pEditEngine->SetNotifyHdl( LINK(this, ScAccessibleCellTextData, NotifyHdl) );
     }
 
-    return pForwarder;
+    return pForwarder.get();
 }
 
 SvxViewForwarder* ScAccessibleCellTextData::GetViewForwarder()
@@ -1179,7 +1179,7 @@ SvxTextForwarder* ScAccessiblePreviewCellTextData::GetTextForwarder()
     if (pEditEngine)
         pEditEngine->SetNotifyHdl( LINK(this, ScAccessiblePreviewCellTextData, NotifyHdl) );
 
-    return pForwarder;
+    return pForwarder.get();
 }
 
 SvxViewForwarder* ScAccessiblePreviewCellTextData::GetViewForwarder()
@@ -1253,11 +1253,11 @@ SvxTextForwarder* ScAccessiblePreviewHeaderCellTextData::GetTextForwarder()
             pEditEngine->SetRefDevice(pDocShell->GetRefDevice());
         else
             pEditEngine->SetRefMapMode(MapMode(MapUnit::Map100thMM));
-        pForwarder = new SvxEditEngineForwarder(*pEditEngine);
+        pForwarder.reset( new SvxEditEngineForwarder(*pEditEngine) );
     }
 
     if (bDataValid)
-        return pForwarder;
+        return pForwarder.get();
 
     if (!maText.isEmpty())
     {
@@ -1280,7 +1280,7 @@ SvxTextForwarder* ScAccessiblePreviewHeaderCellTextData::GetTextForwarder()
 
     pEditEngine->SetNotifyHdl( LINK(this, ScAccessiblePreviewHeaderCellTextData, NotifyHdl) );
 
-    return pForwarder;
+    return pForwarder.get();
 }
 
 SvxViewForwarder* ScAccessiblePreviewHeaderCellTextData::GetViewForwarder()
diff --git a/sc/source/ui/unoobj/textuno.cxx b/sc/source/ui/unoobj/textuno.cxx
index 6642e3af57a8..9bf082c2b184 100644
--- a/sc/source/ui/unoobj/textuno.cxx
+++ b/sc/source/ui/unoobj/textuno.cxx
@@ -886,16 +886,16 @@ ScCellTextData::~ScCellTextData()
     else
         pEditEngine.reset();
 
-    delete pForwarder;
+    pForwarder.reset();
 
-    delete pOriginalSource;
+    pOriginalSource.reset();
 }
 
 ScCellEditSource* ScCellTextData::GetOriginalSource()
 {
     if (!pOriginalSource)
-        pOriginalSource = new ScCellEditSource(pDocShell, aCellPos);
-    return pOriginalSource;
+        pOriginalSource.reset( new ScCellEditSource(pDocShell, aCellPos) );
+    return pOriginalSource.get();
 }
 
 SvxTextForwarder* ScCellTextData::GetTextForwarder()
@@ -921,11 +921,11 @@ SvxTextForwarder* ScCellTextData::GetTextForwarder()
             pEditEngine->SetRefDevice(pDocShell->GetRefDevice());
         else
             pEditEngine->SetRefMapMode(MapMode(MapUnit::Map100thMM));
-        pForwarder = new SvxEditEngineForwarder(*pEditEngine);
+        pForwarder.reset( new SvxEditEngineForwarder(*pEditEngine) );
     }
 
     if (bDataValid)
-        return pForwarder;
+        return pForwarder.get();
 
     OUString aText;
 
@@ -959,7 +959,7 @@ SvxTextForwarder* ScCellTextData::GetTextForwarder()
     }
 
     bDataValid = true;
-    return pForwarder;
+    return pForwarder.get();
 }
 
 void ScCellTextData::UpdateData()
@@ -990,7 +990,7 @@ void ScCellTextData::Notify( SfxBroadcaster&, const SfxHint& rHint )
     {
         pDocShell = nullptr;                       // invalid now
 
-        DELETEZ( pForwarder );
+        pForwarder.reset();
         pEditEngine.reset();     // EditEngine uses document's pool
     }
     else if ( nId == SfxHintId::DataChanged )


More information about the Libreoffice-commits mailing list