summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2016-09-20 17:00:44 +0200
committerMichael Stahl <mstahl@redhat.com>2016-09-21 19:42:27 +0000
commita1468f50241c87ac7687128f852d6f2f2e705b93 (patch)
tree02232bf9de7fd57972f9eed8492047bc6a6b4894 /sw
parent137e42521944c0f3d7ff73891917a476f2868996 (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... It also contains commit adfb650bec005a46c2192852a8f5801497a19611, which handles the case with less bookmarks then expected. (cherry picked from commit ccb979c53931ab3f4712d0a3f7d0f844dcfc5c5d) Change-Id: I2f53b775208cad7e83992d1ae4fb67a41588cb92 Reviewed-on: https://gerrit.libreoffice.org/29098 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/ui/misc/bookmark.cxx18
1 files changed, 13 insertions, 5 deletions
diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx
index 1395fc1e0fa8..625399a349b3 100644
--- a/sw/source/ui/misc/bookmark.cxx
+++ b/sw/source/ui/misc/bookmark.cxx
@@ -249,17 +249,24 @@ 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())
+ // more bookmarks then expected
+ if (aListIter == aTableBookmarks.end())
+ return true;
+ if (aListIter->first != ppBookmark->get() ||
+ aListIter->second != ppBookmark->get()->GetName())
return true;
- ++ppBookmark;
+ ++aListIter;
}
}
+ // less bookmarks then expected
+ if (aListIter != aTableBookmarks.end())
+ return true;
return false;
}
@@ -267,6 +274,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)