[Libreoffice-commits] core.git: Branch 'libreoffice-5-2' - sw/source
Jan-Marek Glogowski
glogow at fbihome.de
Wed Sep 21 19:43:32 UTC 2016
sw/source/ui/misc/bookmark.cxx | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
New commits:
commit a1468f50241c87ac7687128f852d6f2f2e705b93
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date: Tue Sep 20 17:00:44 2016 +0200
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 at libreoffice.org>
Reviewed-by: Michael Stahl <mstahl at redhat.com>
diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx
index 1395fc1..625399a 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)
More information about the Libreoffice-commits
mailing list