[Libreoffice-commits] core.git: sc/inc sc/source
Noel Grandin
noel.grandin at collabora.co.uk
Wed Jul 4 06:37:06 UTC 2018
sc/inc/cellsuno.hxx | 12 ++++++------
sc/source/ui/unoobj/cellsuno.cxx | 25 ++++++++++++-------------
2 files changed, 18 insertions(+), 19 deletions(-)
New commits:
commit 7b6411d0160ea9b714607274aa89ad3b09c09cae
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Tue Jul 3 10:45:07 2018 +0200
loplugin:useuniqueptr in ScCellRangesBase
Change-Id: I4416b012f20c71885211350e605e7ad856642fea
Reviewed-on: https://gerrit.libreoffice.org/56909
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
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)
}
More information about the Libreoffice-commits
mailing list