summaryrefslogtreecommitdiff
path: root/sc/source/ui/undo
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2012-02-10 17:26:44 +0100
committerEike Rathke <erack@redhat.com>2012-02-10 17:27:27 +0100
commit43aa1115c88f1300c73337a3622c2c03faa699f7 (patch)
treedf60e4e395da7cc4f74534a784bd3286821fe702 /sc/source/ui/undo
parentd4a31e6ae28825a42cb8b1935fdfd777cda41e8f (diff)
changes to "convert detdata.cxx in SC module to boost:ptr_vector"
* for includes from other modules use <> instead of "", i.e. <boost/ptr_container/ptr_vector.hpp> * use size_t instead of int for container positions and count * no need for DeleteAndDestroy(), in fact delete p followed by ptr_vector::erase() attempted to delete the instance twice and would crash * adapted places that accessed DeleteAndDestroy() to operate on the vector instead * introduced GetDataVector() for that * changed the DeleteOnTab() loop that used DeleteAndDestroy() to properly iterate over the container instead * changed UpdateReference() to a loop using iterator * changed operator==() to use size_t instead of sal_uInt16 * note aside: mixing sal_uInt16 with a container's size isn't a good idea * adapted places that access Count() and GetObject() to use size_t instead of sal_uInt16 * made GetObject() const and return const ScDetOpData* * changed indentation to 4 spaces per level
Diffstat (limited to 'sc/source/ui/undo')
-rw-r--r--sc/source/ui/undo/undocell.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx
index 321cf789bf68..114964220a19 100644
--- a/sc/source/ui/undo/undocell.cxx
+++ b/sc/source/ui/undo/undocell.cxx
@@ -1028,10 +1028,10 @@ void ScUndoDetective::Undo()
ScDetOpList* pList = pDoc->GetDetOpList();
if (pList && pList->Count())
{
- sal_uInt16 nPos = pList->Count() - 1;
- ScDetOpData* pData = pList->GetObject(nPos);
- if ( pData->GetOperation() == (ScDetOpType) nAction && pData->GetPos() == aPos )
- pList->DeleteAndDestroy( nPos );
+ ScDetOpDataVector& rVec = pList->GetDataVector();
+ ScDetOpDataVector::iterator it = rVec.begin() + rVec.size() - 1;
+ if ( it->GetOperation() == (ScDetOpType) nAction && it->GetPos() == aPos )
+ rVec.erase( it);
else
{
OSL_FAIL("Detektiv-Eintrag in der Liste nicht gefunden");