diff options
author | Noel Grandin <noel@peralex.com> | 2015-06-19 13:25:24 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-06-19 13:25:24 +0200 |
commit | 2f6af46dedcf3ad5ec3a40876dbf1120eec359b6 (patch) | |
tree | 64f57eb2ac955f87e5e54e016abaf4bf2a05ed6b | |
parent | a99f068fa0ca0e42fe67b706e87d88ccb167af85 (diff) |
Revert "optimise SdrObjList::SetObjectOrdNum"
This reverts commit 30e87214781dd9ca5830aad674e08354d3f9ae30.
which I accidentally pushed.
-rw-r--r-- | svx/source/svdraw/svdpage.cxx | 62 |
1 files changed, 18 insertions, 44 deletions
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 5be2392abd7f..648a675d078f 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -577,52 +577,26 @@ SdrObject* SdrObjList::SetObjectOrdNum(size_t nOldObjNum, size_t nNewObjNum) return NULL; } - SdrObject* pObj = maList[nOldObjNum]; - assert(pObj!=NULL && "SdrObjList::SetObjectOrdNum: Object not found."); - if (nOldObjNum == nNewObjNum) - return pObj; - SdrObject* pOtherObj = maList[nNewObjNum]; - assert(pOtherObj!=NULL && "SdrObjList::SetObjectOrdNum: other Object not found."); - - assert(pObj->IsInserted() && "SdrObjList::SetObjectOrdNum: ZObjekt does not have status Inserted."); - - // Update the navigation positions. - if (HasObjectNavigationOrder()) - { - SdrObjectWeakRef aReference (pOtherObj); - WeakSdrObjectContainerType::iterator iObject (::std::find( - mxNavigationOrder->begin(), - mxNavigationOrder->end(), - aReference)); - if (iObject != mxNavigationOrder->end()) - mxNavigationOrder->erase(iObject); - mbIsNavigationOrderDirty = true; - // The new object does not have a user defined position so append it - // to the list. - pObj->SetNavigationPosition(mxNavigationOrder->size()); - mxNavigationOrder->push_back(pObj); - } - - maList.erase(maList.begin()+nOldObjNum); - if (nNewObjNum >= maList.size()) - maList.push_back(pObj); - else - maList.insert(maList.begin()+nNewObjNum, pObj); - - const size_t nCount = maList.size(); - for (size_t no=nOldObjNum; no<nCount; ++no) { - maList[no]->SetOrdNum(no); - } + SdrObject* pObj=maList[nOldObjNum]; + if (nOldObjNum==nNewObjNum) return pObj; + DBG_ASSERT(pObj!=NULL,"SdrObjList::SetObjectOrdNum: Object not found."); + if (pObj!=NULL) { + DBG_ASSERT(pObj->IsInserted(),"SdrObjList::SetObjectOrdNum: ZObjekt does not have status Inserted."); + RemoveObjectFromContainer(nOldObjNum); + InsertObjectIntoContainer(*pObj,nNewObjNum); - // No need to delete visualisation data since same object - // gets inserted again. Also a single ActionChanged is enough - pObj->ActionChanged(); + // No need to delete visualisation data since same object + // gets inserted again. Also a single ActionChanged is enough + pObj->ActionChanged(); - if (pModel!=NULL) - { - // TODO: We need a different broadcast here. - if (pObj->GetPage()!=NULL) pModel->Broadcast(SdrHint(*pObj)); - pModel->SetChanged(); + pObj->SetOrdNum(nNewObjNum); + bObjOrdNumsDirty=true; + if (pModel!=NULL) + { + // TODO: We need a different broadcast here. + if (pObj->GetPage()!=NULL) pModel->Broadcast(SdrHint(*pObj)); + pModel->SetChanged(); + } } return pObj; } |