diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-03 10:45:07 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-04 08:36:41 +0200 |
commit | 7b6411d0160ea9b714607274aa89ad3b09c09cae (patch) | |
tree | c1d1be8615bb7e9cd929910cea35784163dee795 /sc | |
parent | 13eb18a3874fe2bfdba4b93e8035494fd83563bf (diff) |
loplugin:useuniqueptr in ScCellRangesBase
Change-Id: I4416b012f20c71885211350e605e7ad856642fea
Reviewed-on: https://gerrit.libreoffice.org/56909
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/cellsuno.hxx | 12 | ||||
-rw-r--r-- | sc/source/ui/unoobj/cellsuno.cxx | 25 |
2 files changed, 18 insertions, 19 deletions
diff --git a/sc/inc/cellsuno.hxx b/sc/inc/cellsuno.hxx index 236000218bcb..5b41dfbaef42 100644 --- a/sc/inc/cellsuno.hxx +++ b/sc/inc/cellsuno.hxx @@ -182,12 +182,12 @@ private: css::uno::WeakReference<css::uno::XInterface> m_wThis; const SfxItemPropertySet* pPropSet; ScDocShell* pDocShell; - ScLinkListener* pValueListener; - std::unique_ptr<ScPatternAttr> pCurrentFlat; - std::unique_ptr<ScPatternAttr> pCurrentDeep; - SfxItemSet* pCurrentDataSet; - SfxItemSet* pNoDfltCurrentDataSet; - ScMarkData* pMarkData; + std::unique_ptr<ScLinkListener> pValueListener; + std::unique_ptr<ScPatternAttr> pCurrentFlat; + std::unique_ptr<ScPatternAttr> pCurrentDeep; + std::unique_ptr<SfxItemSet> pCurrentDataSet; + std::unique_ptr<SfxItemSet> pNoDfltCurrentDataSet; + std::unique_ptr<ScMarkData> pMarkData; ScRangeList aRanges; sal_Int64 nObjectId; bool bChartColAsHdr; diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index e0993bdede86..1255e6cd9d9d 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -1479,7 +1479,7 @@ ScCellRangesBase::~ScCellRangesBase() ForgetCurrentAttrs(); ForgetMarkData(); - delete pValueListener; + pValueListener.reset(); //! unregister XChartDataChangeEventListener ?? //! (ChartCollection will then hold this object as well!) @@ -1489,8 +1489,8 @@ void ScCellRangesBase::ForgetCurrentAttrs() { pCurrentFlat.reset(); pCurrentDeep.reset(); - delete pCurrentDataSet; - delete pNoDfltCurrentDataSet; + pCurrentDataSet.reset(); + pNoDfltCurrentDataSet.reset(); pCurrentDataSet = nullptr; pNoDfltCurrentDataSet = nullptr; @@ -1499,8 +1499,7 @@ void ScCellRangesBase::ForgetCurrentAttrs() void ScCellRangesBase::ForgetMarkData() { - delete pMarkData; - pMarkData = nullptr; + pMarkData.reset(); } const ScPatternAttr* ScCellRangesBase::GetCurrentAttrsFlat() @@ -1535,22 +1534,22 @@ SfxItemSet* ScCellRangesBase::GetCurrentDataSet(bool bNoDflt) if ( pPattern ) { // replace Dontcare with Default, so that we always have a reflection - pCurrentDataSet = new SfxItemSet( pPattern->GetItemSet() ); - pNoDfltCurrentDataSet = new SfxItemSet( pPattern->GetItemSet() ); + pCurrentDataSet.reset( new SfxItemSet( pPattern->GetItemSet() ) ); + pNoDfltCurrentDataSet.reset( new SfxItemSet( pPattern->GetItemSet() ) ); pCurrentDataSet->ClearInvalidItems(); } } - return bNoDflt ? pNoDfltCurrentDataSet : pCurrentDataSet; + return bNoDflt ? pNoDfltCurrentDataSet.get() : pCurrentDataSet.get(); } const ScMarkData* ScCellRangesBase::GetMarkData() { if (!pMarkData) { - pMarkData = new ScMarkData(); + pMarkData.reset( new ScMarkData() ); pMarkData->MarkFromRangeList( aRanges, false ); } - return pMarkData; + return pMarkData.get(); } void ScCellRangesBase::Notify( SfxBroadcaster&, const SfxHint& rHint ) @@ -1684,7 +1683,7 @@ void ScCellRangesBase::RefChanged() ScDocument& rDoc = pDocShell->GetDocument(); for ( size_t i = 0, nCount = aRanges.size(); i < nCount; ++i ) - rDoc.StartListeningArea( aRanges[ i ], false, pValueListener ); + rDoc.StartListeningArea( aRanges[ i ], false, pValueListener.get() ); } ForgetCurrentAttrs(); @@ -3375,11 +3374,11 @@ void SAL_CALL ScCellRangesBase::addModifyListener(const uno::Reference<util::XMo if ( aValueListeners.size() == 1 ) { if (!pValueListener) - pValueListener = new ScLinkListener( LINK( this, ScCellRangesBase, ValueListenerHdl ) ); + pValueListener.reset( new ScLinkListener( LINK( this, ScCellRangesBase, ValueListenerHdl ) ) ); ScDocument& rDoc = pDocShell->GetDocument(); for ( size_t i = 0, nCount = aRanges.size(); i < nCount; i++) - rDoc.StartListeningArea( aRanges[ i ], false, pValueListener ); + rDoc.StartListeningArea( aRanges[ i ], false, pValueListener.get() ); acquire(); // don't lose this object (one ref for all listeners) } |