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

loplugin:useuniqueptr in ScCellsEnumeration

Change-Id: I2ab494c977e6c877064ba6561d850b62bef2b438
Reviewed-on: https://gerrit.libreoffice.org/56911
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 7b6411d0
...@@ -1082,7 +1082,7 @@ private: ...@@ -1082,7 +1082,7 @@ private:
ScDocShell* pDocShell; ScDocShell* pDocShell;
ScRangeList aRanges; ScRangeList aRanges;
ScAddress aPos; ScAddress aPos;
ScMarkData* pMark; std::unique_ptr<ScMarkData> pMark;
bool bAtEnd; bool bAtEnd;
private: private:
......
...@@ -8951,7 +8951,7 @@ void ScCellsEnumeration::CheckPos_Impl() ...@@ -8951,7 +8951,7 @@ void ScCellsEnumeration::CheckPos_Impl()
{ {
if (!pMark) if (!pMark)
{ {
pMark = new ScMarkData; pMark.reset( new ScMarkData );
pMark->MarkFromRangeList(aRanges, false); pMark->MarkFromRangeList(aRanges, false);
pMark->MarkToMulti(); // needed for GetNextMarkedCell pMark->MarkToMulti(); // needed for GetNextMarkedCell
} }
...@@ -8967,7 +8967,7 @@ ScCellsEnumeration::~ScCellsEnumeration() ...@@ -8967,7 +8967,7 @@ ScCellsEnumeration::~ScCellsEnumeration()
if (pDocShell) if (pDocShell)
pDocShell->GetDocument().RemoveUnoObject(*this); pDocShell->GetDocument().RemoveUnoObject(*this);
delete pMark; pMark.reset();
} }
void ScCellsEnumeration::Advance_Impl() void ScCellsEnumeration::Advance_Impl()
...@@ -8975,7 +8975,7 @@ void ScCellsEnumeration::Advance_Impl() ...@@ -8975,7 +8975,7 @@ void ScCellsEnumeration::Advance_Impl()
OSL_ENSURE(!bAtEnd,"too much Advance_Impl"); OSL_ENSURE(!bAtEnd,"too much Advance_Impl");
if (!pMark) if (!pMark)
{ {
pMark = new ScMarkData; pMark.reset( new ScMarkData );
pMark->MarkFromRangeList( aRanges, false ); pMark->MarkFromRangeList( aRanges, false );
pMark->MarkToMulti(); // needed for GetNextMarkedCell pMark->MarkToMulti(); // needed for GetNextMarkedCell
} }
...@@ -9000,8 +9000,7 @@ void ScCellsEnumeration::Notify( SfxBroadcaster&, const SfxHint& rHint ) ...@@ -9000,8 +9000,7 @@ void ScCellsEnumeration::Notify( SfxBroadcaster&, const SfxHint& rHint )
aRanges.UpdateReference( pRefHint->GetMode(), &pDocShell->GetDocument(), pRefHint->GetRange(), aRanges.UpdateReference( pRefHint->GetMode(), &pDocShell->GetDocument(), pRefHint->GetRange(),
pRefHint->GetDx(), pRefHint->GetDy(), pRefHint->GetDz() ); pRefHint->GetDx(), pRefHint->GetDy(), pRefHint->GetDz() );
delete pMark; // recreate from moved area pMark.reset(); // recreate from moved area
pMark = nullptr;
if (!bAtEnd) // adjust aPos if (!bAtEnd) // adjust aPos
{ {
......
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