Kaydet (Commit) 3b518953 authored tarafından Xisco Fauli's avatar Xisco Fauli Kaydeden (comit) Xisco Faulí

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
9634f5ee, 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/70092Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
Reviewed-by: 's avatarXisco Faulí <xiscofauli@libreoffice.org>
üst e651a4f4
......@@ -1084,16 +1084,15 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu
--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)
......
......@@ -203,7 +203,7 @@ namespace
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 @@ namespace
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);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment