Kaydet (Commit) f46f871f authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in ScChangeTrack

Change-Id: I98f9263660c6c9cfe03b47f0a71dc92d26aa2859
Reviewed-on: https://gerrit.libreoffice.org/56199
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst b35fa775
......@@ -523,6 +523,7 @@ public:
class ScChangeActionMove : public ScChangeAction
{
friend class ScChangeTrack;
friend struct std::default_delete<ScChangeActionMove>; // for std::unique_ptr
friend class ScChangeActionDel;
ScBigRange aFromRange;
......@@ -870,7 +871,7 @@ class ScChangeTrack : public utl::ConfigurationListener
ScChangeAction* pLast;
ScChangeActionContent* pFirstGeneratedDelContent;
std::unique_ptr<ScChangeActionContent*[]> ppContentSlots;
ScChangeActionMove* pLastCutMove;
std::unique_ptr<ScChangeActionMove> pLastCutMove;
ScChangeActionLinkEntry* pLinkInsertCol;
ScChangeActionLinkEntry* pLinkInsertRow;
ScChangeActionLinkEntry* pLinkInsertTab;
......@@ -1084,11 +1085,7 @@ public:
void ResetLastCut()
{
nStartLastCut = nEndLastCut = 0;
if ( pLastCutMove )
{
delete pLastCutMove;
pLastCutMove = nullptr;
}
pLastCutMove.reset();
}
bool HasLastCut() const
{
......
......@@ -2152,7 +2152,7 @@ void ScChangeTrack::DtorClear()
{
delete itChangeAction->second;
}
delete pLastCutMove;
pLastCutMove.reset();
ClearMsgQueue();
}
......@@ -2719,7 +2719,7 @@ void ScChangeTrack::AppendContentRange( const ScRange& rRange,
if ( eClipMode == SC_CACM_CUT )
{
ResetLastCut();
pLastCutMove = new ScChangeActionMove( rRange, rRange, this );
pLastCutMove.reset(new ScChangeActionMove( rRange, rRange, this ));
SetLastCutMoveRange( rRange, pRefDoc );
}
SCCOL nCol1;
......@@ -2767,8 +2767,7 @@ void ScChangeTrack::AppendContentRange( const ScRange& rRange,
LookUpContents( aRange, pRefDoc, 0, 0, 0 );
pLastCutMove->SetStartLastCut( nStartLastCut );
pLastCutMove->SetEndLastCut( nEndLastCut );
Append( pLastCutMove );
pLastCutMove = nullptr;
Append( pLastCutMove.release() );
ResetLastCut();
SetInPasteCut( false );
}
......@@ -3197,7 +3196,7 @@ void ScChangeTrack::Undo( sal_uLong nStartAction, sal_uLong nEndAction, bool bMe
ResetLastCut();
nStartLastCut = nStart;
nEndLastCut = nEnd;
pLastCutMove = pMove;
pLastCutMove.reset(pMove);
SetLastCutMoveRange(
pMove->GetFromRange().MakeRange(), pDoc );
}
......@@ -3673,7 +3672,7 @@ void ScChangeTrack::UpdateReference( ScChangeAction** ppFirstAction,
else if ( eActType == SC_CAT_MOVE )
{
ScChangeActionMove* pActMove = static_cast<ScChangeActionMove*>(pAct);
bool bLastCutMove = ( pActMove == pLastCutMove );
bool bLastCutMove = ( pActMove == pLastCutMove.get() );
const ScBigRange& rTo = pActMove->GetBigRange();
const ScBigRange& rFrom = pActMove->GetFromRange();
if ( !bUndo )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment