tdf#122926: Use o3tl::sorted_vector in other similar places

it doesn't give any win to the attached document,
but seeing we get a 2 secs win with
9634f5ee73e57e8cef75461316d5d45b06ee104f, we can use
the same logic in two similar places hoping other
documents will get benefited

Change-Id: Ie1e76a4317d5b2274335479037b248fe7b1e2a61
Reviewed-on: https://gerrit.libreoffice.org/70092
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
Reviewed-by: Xisco FaulĂ­ <xiscofauli@libreoffice.org>
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 87f51c3..613c0b5 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -1084,16 +1084,15 @@
                --aNodeIndex;
                SwPaM aPaM(aNodeIndex);
                // Collect the marks starting or ending at this text node.
                std::set<sw::mark::IMark*> aSeenMarks;
                o3tl::sorted_vector<sw::mark::IMark*> aSeenMarks;
                IDocumentMarkAccess* pMarkAccess = getIDocumentMarkAccess();
                for (const SwIndex* pIndex = pTextNode->GetFirstIndex(); pIndex; pIndex = pIndex->GetNext())
                {
                    sw::mark::IMark* pMark = const_cast<sw::mark::IMark*>(pIndex->GetMark());
                    if (!pMark)
                        continue;
                    if (aSeenMarks.find(pMark) != aSeenMarks.end())
                    if (!aSeenMarks.insert(pMark).second)
                        continue;
                    aSeenMarks.insert(pMark);
                }
                // And move them back.
                for (sw::mark::IMark* pMark : aSeenMarks)
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index a370fe2..9a760564 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -203,7 +203,7 @@
        else
        {
            // A text node already knows its marks via its SwIndexes.
            std::set<sw::mark::IMark*> aSeenMarks;
            o3tl::sorted_vector<const sw::mark::IMark*> aSeenMarks;
            for (const SwIndex* pIndex = pTextNode->GetFirstIndex(); pIndex; pIndex = pIndex->GetNext())
            {
                // Need a non-cost mark here, as we'll create an UNO wrapper around it.
@@ -216,9 +216,8 @@
                    eType != IDocumentMarkAccess::MarkType::CROSSREF_HEADING_BOOKMARK)
                    continue;
                // Only handle bookmarks once, if they start and end at this node as well.
                if (aSeenMarks.find(pBkmk) != aSeenMarks.end())
                if (!aSeenMarks.insert(pBkmk).second)
                    continue;
                aSeenMarks.insert(pBkmk);
                lcl_FillBookmark(pBkmk, nOwnNode, rDoc, rBkmArr);
            }
        }