[Libreoffice-commits] core.git: 2 commits - sdext/source svx/source
Noel Grandin
noel at peralex.com
Fri Jun 19 04:24:54 PDT 2015
sdext/source/pdfimport/tree/drawtreevisiting.cxx | 3 -
sdext/source/pdfimport/tree/writertreevisiting.cxx | 2
svx/source/svdraw/svdpage.cxx | 62 ++++++++++++++-------
3 files changed, 46 insertions(+), 21 deletions(-)
New commits:
commit a99f068fa0ca0e42fe67b706e87d88ccb167af85
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jun 19 13:23:52 2015 +0200
once more unto the breech dear fellows
workaround GCC4.8 issue
Change-Id: Iea4d10a02a114ce94e0219e8b89acf48db5411d0
diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
index 66d20b4..6c7235d 100644
--- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx
@@ -452,14 +452,13 @@ void DrawXmlOptimizer::visit( PolyPolyElement& elem, const std::list< Element* >
elem.Children.splice( elem.Children.end(), pNext->Children );
// workaround older compilers that do not have std::list::erase(const_iterator)
-#if defined __GNUC__ == 4 && __GNUC_MINOR__ <= 8
+#if defined __GNUC__ && __GNUC__ == 4 && __GNUC_MINOR__ <= 8
std::list< Element* >::iterator tmpIt = elem.Parent->Children.begin();
std::advance(tmpIt, std::distance(elem.Parent->Children.cbegin(), next_it));
elem.Parent->Children.erase(tmpIt);
#else
elem.Parent->Children.erase(next_it);
#endif
-
delete pNext;
}
}
diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx b/sdext/source/pdfimport/tree/writertreevisiting.cxx
index 4759b19..82f8c38 100644
--- a/sdext/source/pdfimport/tree/writertreevisiting.cxx
+++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx
@@ -403,7 +403,7 @@ void WriterXmlOptimizer::visit( PolyPolyElement& elem, const std::list< Element*
elem.Children.splice( elem.Children.end(), pNext->Children );
// workaround older compilers that do not have std::list::erase(const_iterator)
-#if defined __GNUC__ == 4 && __GNUC_MINOR__ <= 8
+#if defined __GNUC__ && __GNUC__ == 4 && __GNUC_MINOR__ <= 8
std::list< Element* >::iterator tmpIt = elem.Parent->Children.begin();
std::advance(tmpIt, std::distance(elem.Parent->Children.cbegin(), next_it));
elem.Parent->Children.erase(tmpIt);
commit 30e87214781dd9ca5830aad674e08354d3f9ae30
Author: Noel Grandin <noel at peralex.com>
Date: Fri Jun 19 12:02:57 2015 +0200
optimise SdrObjList::SetObjectOrdNum
the benefit here is that we avoid setting bObjOrdNumsDirty to true,
because we almost always need the ord number the very next time this is
called.
Change-Id: I0b974b79e69754d35095e197400584df4a89bfe9
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index 648a675..5be2392 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -577,26 +577,52 @@ SdrObject* SdrObjList::SetObjectOrdNum(size_t nOldObjNum, size_t nNewObjNum)
return NULL;
}
- 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);
+ 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.");
- // No need to delete visualisation data since same object
- // gets inserted again. Also a single ActionChanged is enough
- pObj->ActionChanged();
+ assert(pObj->IsInserted() && "SdrObjList::SetObjectOrdNum: ZObjekt does not have status Inserted.");
- 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();
- }
+ // 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);
+ }
+
+ // 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();
}
return pObj;
}
More information about the Libreoffice-commits
mailing list