diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2016-09-20 17:00:44 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2016-09-20 17:15:46 +0200 |
commit | ccb979c53931ab3f4712d0a3f7d0f844dcfc5c5d (patch) | |
tree | 3d976914257ddc8b64885e614a289799ce94f88e | |
parent | 5e0edd5fafbc8696fe75d9518a93b59969418c43 (diff) |
tdf#101359 Really walk the document mark list
In both functions we want to walk the current mark list and
act on the MarkType::BOOKMARK, so mimic the behaviour of
PopulateTable in HaveBookmarksChanged.
My previous commit 96454829f7dc6480f9ddd4262bc03d5ccabadea4
is broken and just works out of luck...
Change-Id: I2f53b775208cad7e83992d1ae4fb67a41588cb92
-rw-r--r-- | sw/source/ui/misc/bookmark.cxx | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx index b932883359db..fdf0262f2307 100644 --- a/sw/source/ui/misc/bookmark.cxx +++ b/sw/source/ui/misc/bookmark.cxx @@ -249,15 +249,18 @@ bool SwInsertBookmarkDlg::HaveBookmarksChanged() if (pMarkAccess->getBookmarksCount() != m_nLastBookmarksCount) return true; - IDocumentMarkAccess::const_iterator_t ppBookmark = pMarkAccess->getBookmarksBegin(); - for (std::pair<sw::mark::IMark*,OUString> & aTableBookmark : aTableBookmarks) + std::vector<std::pair<sw::mark::IMark*, OUString>>::const_iterator aListIter = aTableBookmarks.begin(); + for (IDocumentMarkAccess::const_iterator_t ppBookmark = pMarkAccess->getBookmarksBegin(); + ppBookmark != pMarkAccess->getBookmarksEnd(); ++ppBookmark) { if (IDocumentMarkAccess::MarkType::BOOKMARK == IDocumentMarkAccess::GetType(**ppBookmark)) { - if (aTableBookmark.first != ppBookmark->get() || - aTableBookmark.second != ppBookmark->get()->GetName()) + if (aListIter == aTableBookmarks.end()) return true; - ++ppBookmark; + if (aListIter->first != ppBookmark->get() || + aListIter->second != ppBookmark->get()->GetName()) + return true; + ++aListIter; } } return false; @@ -267,6 +270,7 @@ void SwInsertBookmarkDlg::PopulateTable() { aTableBookmarks.clear(); m_pBookmarksBox->Clear(); + IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess(); for (IDocumentMarkAccess::const_iterator_t ppBookmark = pMarkAccess->getBookmarksBegin(); ppBookmark != pMarkAccess->getBookmarksEnd(); ++ppBookmark) |