diff options
author | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2024-02-22 12:35:14 +0100 |
---|---|---|
committer | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2024-02-22 12:35:14 +0100 |
commit | f127328b7fc1163c5f0bd34a4a50602fc40db7a9 (patch) | |
tree | 5ffaabc2d71162a3ea483de19bb0d72b065ada6b /sw | |
parent | f273d7cbabfa37a409d79f4afef089563d915a93 (diff) | |
parent | 38d5f62f85355c192ef5f1dd47c5c0c0c6d6598b (diff) |
Merge tag 'libreoffice-7.6.5.2-hotfix1' into feature/cib_contract49
Tag libreoffice-7.6.5.2-hotfix1
Change-Id: I2aabb70a2e7dd36e614c63b2d866171d103a8a2e
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/IDocumentMarkAccess.hxx | 7 | ||||
-rw-r--r-- | sw/source/core/doc/docbm.cxx | 10 | ||||
-rw-r--r-- | sw/source/core/inc/MarkManager.hxx | 1 | ||||
-rw-r--r-- | sw/source/filter/writer/writer.cxx | 6 |
4 files changed, 21 insertions, 3 deletions
diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx index d63b58f606c4..bc8f2e1c03d6 100644 --- a/sw/inc/IDocumentMarkAccess.hxx +++ b/sw/inc/IDocumentMarkAccess.hxx @@ -279,6 +279,13 @@ class IDocumentMarkAccess */ virtual const_iterator_t findMark(const OUString& rMark) const =0; + /** Find the first Mark that does not start before. + + @returns + an iterator pointing to the mark, or pointing to getAllMarksEnd() if nothing was found. + */ + virtual const_iterator_t findFirstMarkNotStartsBefore(const SwPosition& rPos) const =0; + // interface IBookmarks (BOOKMARK, CROSSREF_NUMITEM_BOOKMARK, CROSSREF_HEADING_BOOKMARK ) /** check if the selection would delete a BOOKMARK */ diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index bb8e75969239..0a88f3b3e44a 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -1410,6 +1410,16 @@ namespace sw::mark return IDocumentMarkAccess::iterator(ret); } + // find the first Mark that does not start before + IDocumentMarkAccess::const_iterator_t MarkManager::findFirstMarkNotStartsBefore(const SwPosition& rPos) const + { + return std::lower_bound( + m_vAllMarks.begin(), + m_vAllMarks.end(), + rPos, + CompareIMarkStartsBefore()); + } + IDocumentMarkAccess::const_iterator_t MarkManager::getAllMarksBegin() const { return m_vAllMarks.begin(); } diff --git a/sw/source/core/inc/MarkManager.hxx b/sw/source/core/inc/MarkManager.hxx index ef0e79d74c11..dd7eb9f6f18b 100644 --- a/sw/source/core/inc/MarkManager.hxx +++ b/sw/source/core/inc/MarkManager.hxx @@ -81,6 +81,7 @@ namespace sw::mark { virtual const_iterator_t getAllMarksEnd() const override; virtual sal_Int32 getAllMarksCount() const override; virtual const_iterator_t findMark(const OUString& rName) const override; + virtual const_iterator_t findFirstMarkNotStartsBefore(const SwPosition& rPos) const override; // bookmarks virtual bool isBookmarkDeleted(SwPaM const& rPaM, bool isReplace) const override; diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx index 6c7565e5dcc4..efc9d875f9c8 100644 --- a/sw/source/filter/writer/writer.cxx +++ b/sw/source/filter/writer/writer.cxx @@ -160,9 +160,9 @@ bool Writer::CopyNextPam( SwPaM ** ppPam ) sal_Int32 Writer::FindPos_Bkmk(const SwPosition& rPos) const { const IDocumentMarkAccess* const pMarkAccess = m_pDoc->getIDocumentMarkAccess(); - const IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->findFirstBookmarkStartsAfter(rPos); - if(ppBkmk != pMarkAccess->getBookmarksEnd()) - return ppBkmk - pMarkAccess->getBookmarksBegin(); + const IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->findFirstMarkNotStartsBefore(rPos); + if(ppBkmk != pMarkAccess->getAllMarksEnd()) + return ppBkmk - pMarkAccess->getAllMarksBegin(); return -1; } |