sw/source/core/unocore/unoportenum.cxx | 53 ++++++++++----------------------- 1 file changed, 17 insertions(+), 36 deletions(-)
New commits: commit 8f098afced6e974ef83c4d9de988822cb3854c9a Author: Michael Stahl <michael.st...@cib.de> AuthorDate: Tue Sep 15 13:49:02 2020 +0200 Commit: Michael Stahl <michael.st...@cib.de> CommitDate: Wed Sep 16 16:56:43 2020 +0200 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.st...@cib.de> 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); } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits