tdf#158279 TOC links lost when converting .doc to HTML
regression from commit8ce36e943f
Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Sun May 26 15:15:41 2019 +0200 move some searching inside IDocumentMarkAccess where I called the wrong method from inside Writer::FindPos_Bkmk The code was then removed in commit7bad1516c5
Author: Noel Grandin <noel.grandin@collabora.co.uk> Date: Wed Jul 17 05:41:08 2019 +0200 loplugin:unusedmethods Change-Id: I3f1e14a1e3ae2dd134738363e6b2679d2a2f418a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163095 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
2439016c56
commit
0a32def8b5
4 changed files with 21 additions and 3 deletions
|
@ -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 */
|
||||
|
|
|
@ -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(); }
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -157,9 +157,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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue