diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2017-12-03 22:15:10 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2017-12-04 07:09:12 +0100 |
commit | 9634a818e8a9432db52bc8fcd534e7437e6bacee (patch) | |
tree | 40f5e2e10deff130d7975a1b0b427376865a502f /sw/source/uibase/docvw | |
parent | 8444bf1d7314f7ff2ea4d17da19b4d276c4086ae (diff) |
Replace list by vector for mvPostItFields (sw)
Change-Id: I22009cd051a990cbc6e5f67a01958da889437840
Reviewed-on: https://gerrit.libreoffice.org/45759
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'sw/source/uibase/docvw')
-rw-r--r-- | sw/source/uibase/docvw/PostItMgr.cxx | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 4e024c731b33..f7571ffb0398 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -243,13 +243,14 @@ SwPostItMgr::~SwPostItMgr() void SwPostItMgr::CheckForRemovedPostIts() { bool bRemoved = false; - for(auto i = mvPostItFields.begin(); i != mvPostItFields.end(); ) + auto currentIt = mvPostItFields.begin(); + while(currentIt != mvPostItFields.end()) { - auto it = i++; + auto it = currentIt++; if ( !(*it)->UseElement() ) { SwSidebarItem* p = (*it); - mvPostItFields.remove(*it); + currentIt = mvPostItFields.erase(std::remove(mvPostItFields.begin(), mvPostItFields.end(), *it), mvPostItFields.end()); if (GetActiveSidebarWin() == p->pPostIt) SetActiveSidebarWin(nullptr); p->pPostIt.disposeAndClear(); @@ -573,7 +574,7 @@ bool SwPostItMgr::CalcRects() // show notes in right order in navigator //prevent Anchors during layout to overlap, e.g. when moving a frame if (mvPostItFields.size()>1 ) - mvPostItFields.sort(comp_pos); + std::stable_sort(mvPostItFields.begin(), mvPostItFields.end(), comp_pos); // sort the items into the right page vector, so layout can be done by page for (auto const& pItem : mvPostItFields) @@ -1385,7 +1386,7 @@ public: //Fields more than once. class FieldDocWatchingStack : public SfxListener { - std::list<SwSidebarItem*>& l; + std::vector<SwSidebarItem*>& sidebarItemVector; std::vector<const SwFormatField*> v; SwDocShell& m_rDocShell; FilterFunctor& m_rFilter; @@ -1425,8 +1426,8 @@ class FieldDocWatchingStack : public SfxListener } public: - FieldDocWatchingStack(std::list<SwSidebarItem*>& in, SwDocShell &rDocShell, FilterFunctor& rFilter) - : l(in) + FieldDocWatchingStack(std::vector<SwSidebarItem*>& in, SwDocShell &rDocShell, FilterFunctor& rFilter) + : sidebarItemVector(in) , m_rDocShell(rDocShell) , m_rFilter(rFilter) { @@ -1437,8 +1438,8 @@ public: { EndListeningToAllFields(); v.clear(); - v.reserve(l.size()); - for (auto const& p : l) + v.reserve(sidebarItemVector.size()); + for (auto const& p : sidebarItemVector) { const SwFormatField& rField = p->GetFormatField(); if (!m_rFilter(&rField)) |