sw/source/ui/misc/bookmark.cxx | 12 +++++++----- sw/source/uibase/inc/bookmark.hxx | 1 + 2 files changed, 8 insertions(+), 5 deletions(-)
New commits: commit 11aa7278659d5f56288df620978107947aec4adc Author: Caolán McNamara <caol...@redhat.com> Date: Mon Aug 8 15:37:10 2016 +0100 Resolves: tdf#101359 getBookmarksCount includes more than aTableBookmarks aTableBookmarks is just "BOOKMARK"s while getBookmarksCount() includes two extra types. So cache the result of getBookmarksCount when filling aTableBookmarks to compare if the count from the time of filling aTableBookmarks is unchanged. Change-Id: I69fedab613f23e4e2b30498e4620a370d92272e0 (cherry picked from commit cdb708291b59ac89b43c24154f0edc77f237eadd) Reviewed-on: https://gerrit.libreoffice.org/27992 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx index 1ab72f8..6798738 100644 --- a/sw/source/ui/misc/bookmark.cxx +++ b/sw/source/ui/misc/bookmark.cxx @@ -246,7 +246,7 @@ bool SwInsertBookmarkDlg::ValidateBookmarks() bool SwInsertBookmarkDlg::HaveBookmarksChanged() { IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess(); - if (pMarkAccess->getBookmarksCount() != static_cast<sal_Int32>(aTableBookmarks.size())) + if (pMarkAccess->getBookmarksCount() != m_nLastBookmarksCount) return true; IDocumentMarkAccess::const_iterator_t ppBookmark = pMarkAccess->getBookmarksBegin(); @@ -277,16 +277,18 @@ void SwInsertBookmarkDlg::PopulateTable() aTableBookmarks.push_back(std::make_pair(ppBookmark->get(), ppBookmark->get()->GetName())); } } + m_nLastBookmarksCount = pMarkAccess->getBookmarksCount(); } void SwInsertBookmarkDlg::Apply() { } -SwInsertBookmarkDlg::SwInsertBookmarkDlg(vcl::Window* pParent, SwWrtShell& rS, SfxRequest& rRequest) : - SvxStandardDialog(pParent, "InsertBookmarkDialog", "modules/swriter/ui/insertbookmark.ui"), - rSh(rS), - rReq(rRequest) +SwInsertBookmarkDlg::SwInsertBookmarkDlg(vcl::Window* pParent, SwWrtShell& rS, SfxRequest& rRequest) + : SvxStandardDialog(pParent, "InsertBookmarkDialog", "modules/swriter/ui/insertbookmark.ui") + , rSh(rS) + , rReq(rRequest) + , m_nLastBookmarksCount(0) { get(m_pBookmarksContainer, "bookmarks"); get(m_pEditBox, "name"); diff --git a/sw/source/uibase/inc/bookmark.hxx b/sw/source/uibase/inc/bookmark.hxx index 0754f69..472cedb 100644 --- a/sw/source/uibase/inc/bookmark.hxx +++ b/sw/source/uibase/inc/bookmark.hxx @@ -61,6 +61,7 @@ class SwInsertBookmarkDlg: public SvxStandardDialog SwWrtShell& rSh; SfxRequest& rReq; std::vector<std::pair<sw::mark::IMark*, OUString>> aTableBookmarks; + sal_Int32 m_nLastBookmarksCount; DECL_LINK_TYPED(ModifyHdl, Edit&, void); DECL_LINK_TYPED(InsertHdl, Button*, void);
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits