Kaydet (Commit) ccb979c5 authored tarafından Jan-Marek Glogowski's avatar Jan-Marek Glogowski

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 96454829
is broken and just works out of luck...

Change-Id: I2f53b775208cad7e83992d1ae4fb67a41588cb92
üst 5e0edd5f
...@@ -249,15 +249,18 @@ bool SwInsertBookmarkDlg::HaveBookmarksChanged() ...@@ -249,15 +249,18 @@ bool SwInsertBookmarkDlg::HaveBookmarksChanged()
if (pMarkAccess->getBookmarksCount() != m_nLastBookmarksCount) if (pMarkAccess->getBookmarksCount() != m_nLastBookmarksCount)
return true; return true;
IDocumentMarkAccess::const_iterator_t ppBookmark = pMarkAccess->getBookmarksBegin(); std::vector<std::pair<sw::mark::IMark*, OUString>>::const_iterator aListIter = aTableBookmarks.begin();
for (std::pair<sw::mark::IMark*,OUString> & aTableBookmark : aTableBookmarks) for (IDocumentMarkAccess::const_iterator_t ppBookmark = pMarkAccess->getBookmarksBegin();
ppBookmark != pMarkAccess->getBookmarksEnd(); ++ppBookmark)
{ {
if (IDocumentMarkAccess::MarkType::BOOKMARK == IDocumentMarkAccess::GetType(**ppBookmark)) if (IDocumentMarkAccess::MarkType::BOOKMARK == IDocumentMarkAccess::GetType(**ppBookmark))
{ {
if (aTableBookmark.first != ppBookmark->get() || if (aListIter == aTableBookmarks.end())
aTableBookmark.second != ppBookmark->get()->GetName())
return true; return true;
++ppBookmark; if (aListIter->first != ppBookmark->get() ||
aListIter->second != ppBookmark->get()->GetName())
return true;
++aListIter;
} }
} }
return false; return false;
...@@ -267,6 +270,7 @@ void SwInsertBookmarkDlg::PopulateTable() ...@@ -267,6 +270,7 @@ void SwInsertBookmarkDlg::PopulateTable()
{ {
aTableBookmarks.clear(); aTableBookmarks.clear();
m_pBookmarksBox->Clear(); m_pBookmarksBox->Clear();
IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess(); IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
for (IDocumentMarkAccess::const_iterator_t ppBookmark = pMarkAccess->getBookmarksBegin(); for (IDocumentMarkAccess::const_iterator_t ppBookmark = pMarkAccess->getBookmarksBegin();
ppBookmark != pMarkAccess->getBookmarksEnd(); ++ppBookmark) ppBookmark != pMarkAccess->getBookmarksEnd(); ++ppBookmark)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment