summaryrefslogtreecommitdiff
path: root/sc/source/ui/unoobj/nameuno.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-03-13 17:02:09 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-03-15 07:30:26 +0100
commita3aceef8200e48173df4b5e67b5d6fb393a23ad9 (patch)
tree7b0b0b117c8e3c15c2b126b085d11a21c2446991 /sc/source/ui/unoobj/nameuno.cxx
parentd775ef360168271f429466bbc174ae7dec402f1d (diff)
don't use heap for elements in ScRangePairList
no need to store small objects like this out of line. And use std::array for ScRangePair, so we get range checking in debug mode. Change-Id: Ie4690edbb4c3fdc4e08206cb016b8167a399d95a Reviewed-on: https://gerrit.libreoffice.org/51268 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/source/ui/unoobj/nameuno.cxx')
-rw-r--r--sc/source/ui/unoobj/nameuno.cxx29
1 files changed, 12 insertions, 17 deletions
diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx
index 1caa62e9920c..e1e7d1478c28 100644
--- a/sc/source/ui/unoobj/nameuno.cxx
+++ b/sc/source/ui/unoobj/nameuno.cxx
@@ -1041,9 +1041,8 @@ ScLabelRangeObj* ScLabelRangesObj::GetObjectByIndex_Impl(size_t nIndex)
ScRangePairList* pList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges();
if ( pList && nIndex < pList->size() )
{
- ScRangePair* pData = (*pList)[nIndex];
- if (pData)
- return new ScLabelRangeObj( pDocShell, bColumn, pData->GetRange(0) );
+ ScRangePair & rData = (*pList)[nIndex];
+ return new ScLabelRangeObj( pDocShell, bColumn, rData.GetRange(0) );
}
}
return nullptr;
@@ -1094,23 +1093,19 @@ void SAL_CALL ScLabelRangesObj::removeByIndex( sal_Int32 nIndex )
{
ScRangePairListRef xNewList(pOldList->Clone());
- ScRangePair* pEntry = (*xNewList)[nIndex];
- if (pEntry)
- {
- xNewList->Remove( pEntry );
+ xNewList->Remove( nIndex );
- if (bColumn)
- rDoc.GetColNameRangesRef() = xNewList;
- else
- rDoc.GetRowNameRangesRef() = xNewList;
+ if (bColumn)
+ rDoc.GetColNameRangesRef() = xNewList;
+ else
+ rDoc.GetRowNameRangesRef() = xNewList;
- rDoc.CompileColRowNameFormula();
- pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Grid );
- pDocShell->SetDocumentModified();
- bDone = true;
+ rDoc.CompileColRowNameFormula();
+ pDocShell->PostPaint( 0,0,0, MAXCOL,MAXROW,MAXTAB, PaintPartFlags::Grid );
+ pDocShell->SetDocumentModified();
+ bDone = true;
- //! Undo ?!?! (here and from dialog)
- }
+ //! Undo ?!?! (here and from dialog)
}
}
if (!bDone)