[Libreoffice-commits] core.git: svx/source

Noel Grandin noel at peralex.com
Fri Jun 19 04:26:05 PDT 2015


 svx/source/svdraw/svdpage.cxx |   62 ++++++++++++------------------------------
 1 file changed, 18 insertions(+), 44 deletions(-)

New commits:
commit 2f6af46dedcf3ad5ec3a40876dbf1120eec359b6
Author: Noel Grandin <noel at peralex.com>
Date:   Fri Jun 19 13:25:24 2015 +0200

    Revert "optimise SdrObjList::SetObjectOrdNum"
    
    This reverts commit 30e87214781dd9ca5830aad674e08354d3f9ae30.
    which I accidentally pushed.

diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index 5be2392..648a675 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;
 }


More information about the Libreoffice-commits mailing list