diff options
author | Michael Stahl <Michael.Stahl@cib.de> | 2020-09-15 13:49:02 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@cib.de> | 2020-09-16 16:56:43 +0200 |
commit | 8f098afced6e974ef83c4d9de988822cb3854c9a (patch) | |
tree | 045bb0a4f26ea2986dec227c9e486f9f01ba2410 /sw | |
parent | 9711904c9a26e89d36a9d5aeb61b99f7fe59fb43 (diff) |
sw: remove dead code in lcl_FillBookmarkArray()
Change-Id: Idb9fbac5bd1c74f8ccd434a2337daea58b624e57
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102738
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/unocore/unoportenum.cxx | 53 |
1 files changed, 17 insertions, 36 deletions
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index 17688f1a3351..17f0ac08431b 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -177,43 +177,24 @@ namespace const SwNodeIndex nOwnNode = rUnoCursor.GetPoint()->nNode; SwTextNode* pTextNode = nOwnNode.GetNode().GetTextNode(); - if (!pTextNode) - { - // no need to consider marks starting after aEndOfPara - SwPosition aEndOfPara(*rUnoCursor.GetPoint()); - aEndOfPara.nContent = aEndOfPara.nNode.GetNode().GetTextNode()->Len(); - const IDocumentMarkAccess::const_iterator_t pCandidatesEnd = - pMarkAccess->findFirstBookmarkStartsAfter(aEndOfPara); - - // search for all bookmarks that start or end in this paragraph - for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getBookmarksBegin(); - ppMark != pCandidatesEnd; - ++ppMark) - { - ::sw::mark::IMark* const pBkmk = *ppMark; - lcl_FillBookmark(pBkmk, nOwnNode, rDoc, rBkmArr); - } - } - else + assert(pTextNode); + // A text node already knows its marks via its SwIndexes. + o3tl::sorted_vector<const sw::mark::IMark*> aSeenMarks; + for (const SwIndex* pIndex = pTextNode->GetFirstIndex(); pIndex; pIndex = pIndex->GetNext()) { - // A text node already knows its marks via its SwIndexes. - 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 a UNO wrapper around it. - sw::mark::IMark* pBkmk = const_cast<sw::mark::IMark*>(pIndex->GetMark()); - if (!pBkmk) - continue; - IDocumentMarkAccess::MarkType eType = IDocumentMarkAccess::GetType(*pBkmk); - // These are the types stored in the container otherwise accessible via getBookmarks*() - if (eType != IDocumentMarkAccess::MarkType::BOOKMARK && eType != IDocumentMarkAccess::MarkType::CROSSREF_NUMITEM_BOOKMARK && - eType != IDocumentMarkAccess::MarkType::CROSSREF_HEADING_BOOKMARK) - continue; - // Only handle bookmarks once, if they start and end at this node as well. - if (!aSeenMarks.insert(pBkmk).second) - continue; - lcl_FillBookmark(pBkmk, nOwnNode, rDoc, rBkmArr); - } + // Need a non-cost mark here, as we'll create a UNO wrapper around it. + sw::mark::IMark* pBkmk = const_cast<sw::mark::IMark*>(pIndex->GetMark()); + if (!pBkmk) + continue; + IDocumentMarkAccess::MarkType eType = IDocumentMarkAccess::GetType(*pBkmk); + // These are the types stored in the container otherwise accessible via getBookmarks*() + if (eType != IDocumentMarkAccess::MarkType::BOOKMARK && eType != IDocumentMarkAccess::MarkType::CROSSREF_NUMITEM_BOOKMARK && + eType != IDocumentMarkAccess::MarkType::CROSSREF_HEADING_BOOKMARK) + continue; + // Only handle bookmarks once, if they start and end at this node as well. + if (!aSeenMarks.insert(pBkmk).second) + continue; + lcl_FillBookmark(pBkmk, nOwnNode, rDoc, rBkmArr); } } |