[Libreoffice-commits] core.git: Branch 'libreoffice-7-2' - sc/source
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Tue Aug 10 17:33:23 UTC 2021
sc/source/core/data/drwlayer.cxx | 32 ++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)
New commits:
commit 2e5635122b9c59b2f67cd4949f5e259cff2993d5
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Fri Jul 23 16:55:04 2021 +0200
Commit: Michael Stahl <michael.stahl at allotropia.de>
CommitDate: Tue Aug 10 19:32:45 2021 +0200
Use vector instead of unique_ptr
Change-Id: Iea1fb26d9e176283a96d6f0d18dae5b58e55602e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119432
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
Signed-off-by: Xisco Fauli <xiscofauli at libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120222
Reviewed-by: Michael Stahl <michael.stahl at allotropia.de>
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 27d00144a52d..5b70046e4448 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -1550,7 +1550,6 @@ void ScDrawLayer::DeleteObjectsInArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1,
if (!nObjCount)
return;
- size_t nDelCount = 0;
tools::Rectangle aDelRect = pDoc->GetMMRect( nCol1, nRow1, nCol2, nRow2, nTab );
tools::Rectangle aDelCircle = pDoc->GetMMRect( nCol1, nRow1, nCol2, nRow2, nTab );
aDelCircle.AdjustLeft(-250);
@@ -1558,7 +1557,8 @@ void ScDrawLayer::DeleteObjectsInArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1,
aDelCircle.AdjustTop(-70);
aDelCircle.AdjustBottom(70);
- std::unique_ptr<SdrObject*[]> ppObj(new SdrObject*[nObjCount]);
+ std::vector<SdrObject*> ppObj;
+ ppObj.reserve(nObjCount);
SdrObjListIter aIter( pPage, SdrIterMode::Flat );
SdrObject* pObject = aIter.Next();
@@ -1574,7 +1574,7 @@ void ScDrawLayer::DeleteObjectsInArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1,
{
aObjRect = pObject->GetLogicRect();
if(aDelCircle.IsInside(aObjRect))
- ppObj[nDelCount++] = pObject;
+ ppObj.push_back(pObject);
}
else
{
@@ -1585,10 +1585,10 @@ void ScDrawLayer::DeleteObjectsInArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1,
{
ScAnchorType aAnchorType = ScDrawLayer::GetAnchorType(*pObject);
if (aAnchorType == SCA_CELL || aAnchorType == SCA_CELL_RESIZE)
- ppObj[nDelCount++] = pObject;
+ ppObj.push_back(pObject);
}
else
- ppObj[nDelCount++] = pObject;
+ ppObj.push_back(pObject);
}
}
}
@@ -1597,11 +1597,11 @@ void ScDrawLayer::DeleteObjectsInArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1,
}
if (bRecording)
- for (size_t i=1; i<=nDelCount; ++i)
- AddCalcUndo( std::make_unique<SdrUndoRemoveObj>( *ppObj[nDelCount-i] ) );
+ for (auto p : ppObj)
+ AddCalcUndo(std::make_unique<SdrUndoRemoveObj>(*p));
- for (size_t i=1; i<=nDelCount; ++i)
- pPage->RemoveObject( ppObj[nDelCount-i]->GetOrdNum() );
+ for (auto p : ppObj)
+ pPage->RemoveObject(p->GetOrdNum());
}
void ScDrawLayer::DeleteObjectsInSelection( const ScMarkData& rMark )
@@ -1629,13 +1629,13 @@ void ScDrawLayer::DeleteObjectsInSelection( const ScMarkData& rMark )
const size_t nObjCount = pPage->GetObjCount();
if (nObjCount)
{
- size_t nDelCount = 0;
// Rectangle around the whole selection
tools::Rectangle aMarkBound = pDoc->GetMMRect(
aMarkRange.aStart.Col(), aMarkRange.aStart.Row(),
aMarkRange.aEnd.Col(), aMarkRange.aEnd.Row(), nTab );
- std::unique_ptr<SdrObject*[]> ppObj(new SdrObject*[nObjCount]);
+ std::vector<SdrObject*> ppObj;
+ ppObj.reserve(nObjCount);
SdrObjListIter aIter( pPage, SdrIterMode::Flat );
SdrObject* pObject = aIter.Next();
@@ -1657,7 +1657,7 @@ void ScDrawLayer::DeleteObjectsInSelection( const ScMarkData& rMark )
pObjData->maStart.Row()));
if (bObjectInMarkArea || bObjectAnchoredToMarkedCell)
{
- ppObj[nDelCount++] = pObject;
+ ppObj.push_back(pObject);
}
}
@@ -1667,11 +1667,11 @@ void ScDrawLayer::DeleteObjectsInSelection( const ScMarkData& rMark )
// Delete objects (backwards)
if (bRecording)
- for (size_t i=1; i<=nDelCount; ++i)
- AddCalcUndo( std::make_unique<SdrUndoRemoveObj>( *ppObj[nDelCount-i] ) );
+ for (auto p : ppObj)
+ AddCalcUndo(std::make_unique<SdrUndoRemoveObj>(*p));
- for (size_t i=1; i<=nDelCount; ++i)
- pPage->RemoveObject( ppObj[nDelCount-i]->GetOrdNum() );
+ for (auto p : ppObj)
+ pPage->RemoveObject(p->GetOrdNum());
}
}
else
More information about the Libreoffice-commits
mailing list