diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-08-08 15:37:10 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-08-08 15:41:50 +0100 |
commit | cdb708291b59ac89b43c24154f0edc77f237eadd (patch) | |
tree | 1d69d8ec763ca392cc6ec5ba4f8c0b7b8f1db46c /sw | |
parent | 2d3470e120574662f1d203862df9e49c45d01365 (diff) |
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
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/ui/misc/bookmark.cxx | 12 | ||||
-rw-r--r-- | sw/source/uibase/inc/bookmark.hxx | 1 |
2 files changed, 8 insertions, 5 deletions
diff --git a/sw/source/ui/misc/bookmark.cxx b/sw/source/ui/misc/bookmark.cxx index 56734dc38fab..5aeb4621c853 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 0754f6988bac..472cedb2bb64 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); |